Merge "Allow putting the app ID in the password for bot passwords"
[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, wgInterwikiMagic
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 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3060 !! wikitext
3061 <table>
3062 <tr>
3063 <td>
3064 Text that should be rendered preformatted
3065 </td>
3066 </tr>
3067 </table>
3068 !! html
3069 <table>
3070 <tr>
3071 <td>
3072 <pre>Text that should be rendered preformatted
3073 </pre>
3074 </td>
3075 </tr>
3076 </table>
3077
3078 !! end
3079
3080 !!test
3081 3a. Indent-Pre and block tags (single-line html)
3082 !! wikitext
3083 a <p> foo </p>
3084 b <div> foo </div>
3085 c <blockquote> foo </blockquote>
3086 <span> foo </span>
3087 !! html
3088 a <p> foo </p>
3089 b <div> foo </div>
3090 c <blockquote> foo </blockquote>
3091 <pre><span> foo </span>
3092 </pre>
3093 !! html/parsoid
3094 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3095 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3096 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3097 <pre><span> foo </span>
3098 </pre>
3099 !! html+tidy
3100 <p>a</p>
3101 <p>foo</p>
3102 <p>b</p>
3103 <div>foo</div>
3104 <p>c</p>
3105 <blockquote>
3106 <p>foo</p>
3107 </blockquote>
3108 <pre>
3109 <span> foo </span>
3110 </pre>
3111 !! end
3112
3113 !!test
3114 3b. Indent-Pre and block tags (multi-line html)
3115 !! wikitext
3116 a <span>foo</span>
3117 b <div> foo </div>
3118 !! html
3119 <pre>a <span>foo</span>
3120 </pre>
3121 b <div> foo </div>
3122
3123 !! html/parsoid
3124 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3125 b <div data-parsoid='{"stx":"html"}'> foo </div>
3126 !! html+tidy
3127 <pre>
3128 a <span>foo</span>
3129 </pre>
3130 <p>b</p>
3131 <div>foo</div>
3132 !!end
3133
3134 !!test
3135 3c. Indent-Pre and block tags (pre-content on separate line)
3136 !! wikitext
3137 <p>
3138 foo
3139 </p>
3140
3141 <div>
3142 foo
3143 </div>
3144
3145 <center>
3146 foo
3147 </center>
3148
3149 <blockquote>
3150 foo
3151 </blockquote>
3152
3153 <blockquote>
3154 <pre>
3155 foo
3156 </pre>
3157 </blockquote>
3158
3159 <table><tr><td>
3160 foo
3161 </td></tr></table>
3162
3163 <ul><li>
3164 foo
3165 </li></ul>
3166
3167 !! html
3168 <p>
3169 foo
3170 </p>
3171 <div>
3172 <pre>foo
3173 </pre>
3174 </div>
3175 <center>
3176 <pre>foo
3177 </pre>
3178 </center>
3179 <blockquote>
3180 <p> foo
3181 </p>
3182 </blockquote>
3183 <blockquote>
3184 <pre>
3185 foo
3186 </pre>
3187 </blockquote>
3188 <table><tr><td>
3189 <pre>foo
3190 </pre>
3191 </td></tr></table>
3192 <ul><li>
3193 foo
3194 </li></ul>
3195
3196 !!end
3197
3198 !! test
3199 4. Indent-Pre and extension tags
3200 !! wikitext
3201 a <tag />
3202 !! html/php
3203 a <pre>
3204 NULL
3205 array (
3206 )
3207 </pre>
3208
3209 !! html/parsoid
3210 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3211 !! end
3212
3213 !!test
3214 Render paragraphs when indent-pre is suppressed in blocklevels
3215 !! wikitext
3216 <blockquote>
3217 foo
3218
3219 bar
3220 </blockquote>
3221 !! html
3222 <blockquote>
3223 <p> foo
3224 </p><p> bar
3225 </p>
3226 </blockquote>
3227
3228 !!end
3229
3230 !!test
3231 4. Multiple spaces at start-of-line
3232 !! wikitext
3233 <p> foo </p>
3234 foo
3235 {|
3236 |foo
3237 |}
3238 !! html
3239 <p> foo </p>
3240 <pre> foo
3241 </pre>
3242 <table>
3243 <tr>
3244 <td>foo
3245 </td></tr></table>
3246
3247 !!end
3248
3249 ## NOTE: the leading white-space chars on empty line are significant
3250 !! test
3251 5a. White-space in indent-pre
3252 !! wikitext
3253 a<br />
3254
3255 b
3256 !! html
3257 <pre>a<br />
3258
3259 b
3260 </pre>
3261 !! end
3262
3263 ## NOTE: the leading white-space chars on empty line are significant
3264 !! test
3265 5b. White-space in indent-pre
3266 !! wikitext
3267 a
3268
3269 b
3270
3271
3272 c
3273 !! html
3274 <pre>a
3275
3276 b
3277
3278
3279 c
3280 </pre>
3281 !! end
3282
3283 !! test
3284 5c. White-space in indent-pre
3285 !! wikitext
3286 ''a''
3287 ''b''
3288 ''c''
3289 !! html
3290 <pre><i>a</i>
3291 <i>b</i>
3292 <i>c</i>
3293 </pre>
3294 !! end
3295
3296 !! test
3297 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3298 !! wikitext
3299 a
3300
3301 <!-- continue -->
3302 b
3303
3304 c
3305
3306 d
3307 !! html
3308 <pre>a
3309
3310 b
3311 </pre>
3312 <pre>c
3313
3314 </pre>
3315 <p>d
3316 </p>
3317 !! end
3318
3319 !! test
3320 7a. Indent-pre and category links
3321 !! options
3322 parsoid=wt2html,wt2wt
3323 !! wikitext
3324 [[Category:foo]] <!-- No pre-wrapping -->
3325 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3326 !! html/php+tidy
3327 !! html/parsoid
3328 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3329 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3330 !! end
3331
3332 ## We used to, but no longer wt2wt this test since the default serializer
3333 ## will normalize all categories to serialize on their own line.
3334 ## This wikitext usage is going to be fairly uncommon in production and
3335 ## selser will take care of preserving formatting in those scenarios.
3336 !! test
3337 7b. Indent-pre and category links
3338 !! options
3339 parsoid=wt2html
3340 !! wikitext
3341 [[Category:foo]] a
3342 [[Category:foo]] {{echo|b}}
3343 !! html/parsoid
3344 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3345 <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>
3346 !! end
3347
3348 !! test
3349 Indent-Pre: Newlines in comments shouldn't affect sol state
3350 !! wikitext
3351 a <!--
3352 foo
3353 --> b
3354 !! html/php+tidy
3355 <p>a b</p>
3356 !! html/parsoid
3357 <p>a <!--
3358 foo
3359 --> b</p>
3360 !! end
3361
3362 ###
3363 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3364 ###
3365
3366 !!test
3367 HTML-pre: 1. embedded newlines
3368 !! wikitext
3369 <pre>foo</pre>
3370
3371 <pre>
3372 foo
3373 </pre>
3374
3375 <pre>
3376
3377 foo
3378 </pre>
3379
3380 <pre>
3381
3382
3383 foo
3384 </pre>
3385 !! html/php+tidy
3386 <pre>
3387 foo
3388 </pre>
3389 <pre>
3390 foo
3391 </pre>
3392 <pre>
3393
3394 foo
3395 </pre>
3396 <pre>
3397
3398
3399 foo
3400 </pre>
3401 !! html/parsoid
3402 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3403
3404 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3405 foo
3406 </pre>
3407
3408 <pre data-parsoid='{"stx":"html"}'>
3409
3410 foo
3411 </pre>
3412
3413 <pre data-parsoid='{"stx":"html"}'>
3414
3415
3416 foo
3417 </pre>
3418 !!end
3419
3420 !! test
3421 HTML-pre: big spaces
3422 !! wikitext
3423 <pre>
3424
3425
3426
3427
3428 haha
3429
3430
3431
3432
3433 haha
3434
3435
3436
3437
3438 </pre>
3439 !! html/php+tidy
3440 <pre>
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 haha
3451
3452
3453
3454
3455 </pre>
3456 !! html/parsoid
3457 <pre data-parsoid='{"stx":"html"}'>
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 haha
3468
3469
3470
3471
3472 </pre>
3473 !! end
3474
3475 !!test
3476 HTML-pre: 2: indented text
3477 !! wikitext
3478 <pre>
3479 foo
3480 </pre>
3481 !! html
3482 <pre>
3483 foo
3484 </pre>
3485
3486 !!end
3487
3488 !!test
3489 HTML-pre: 3: other wikitext
3490 !! wikitext
3491 <pre>
3492 * foo
3493 # bar
3494 = no-h =
3495 '' no-italic ''
3496 [[ NoLink ]]
3497 </pre>
3498 !! html/php
3499 <pre>
3500 * foo
3501 # bar
3502 = no-h =
3503 '' no-italic ''
3504 [[ NoLink ]]
3505 </pre>
3506
3507 !! html/parsoid
3508 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3509 # bar
3510 = no-h =
3511 '' no-italic ''
3512 [[ NoLink ]]
3513 </pre>
3514 !!end
3515
3516 ###
3517 ### Definition lists
3518 ###
3519 !! test
3520 Simple definition
3521 !! wikitext
3522 ; name : Definition
3523 !! html
3524 <dl><dt> name&#160;</dt>
3525 <dd> Definition</dd></dl>
3526
3527 !! end
3528
3529 !! test
3530 Definition list for indentation only
3531 !! wikitext
3532 : Indented text
3533 !! html
3534 <dl><dd> Indented text</dd></dl>
3535
3536 !! end
3537
3538 !! test
3539 Definition list with no space
3540 !! wikitext
3541 ;name:Definition
3542 !! html
3543 <dl><dt>name</dt>
3544 <dd>Definition</dd></dl>
3545
3546 !!end
3547
3548 !! test
3549 Definition list with URL link
3550 !! wikitext
3551 ; http://example.com/ : definition
3552 !! html
3553 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3554 <dd> definition</dd></dl>
3555
3556 !! end
3557
3558 !! test
3559 Definition list with bracketed URL link
3560 !! wikitext
3561 ;[http://www.example.com/ Example]:Something about it
3562 !! html
3563 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3564 <dd>Something about it</dd></dl>
3565
3566 !! end
3567
3568 !! test
3569 Definition list with wikilink containing colon
3570 !! wikitext
3571 ; [[Help:FAQ]]: The least-read page on Wikipedia
3572 !! html
3573 <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>
3574 <dd> The least-read page on Wikipedia</dd></dl>
3575
3576 !! end
3577
3578 # At Brion's and JeLuF's insistence... :)
3579 !! test
3580 Definition list with news link containing colon
3581 !! wikitext
3582 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3583 !! html/php
3584 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3585 <dd> This isn't even a real newsgroup!</dd></dl>
3586
3587 !! html/parsoid
3588 <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>
3589 !! end
3590
3591 !! test
3592 Malformed definition list with colon
3593 !! wikitext
3594 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3595 !! html
3596 <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>
3597
3598 !! end
3599
3600 !! test
3601 Definition lists: colon in external link text
3602 !! wikitext
3603 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3604 !! html
3605 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3606 <dd> OK, I made that up</dd></dl>
3607
3608 !! end
3609
3610 !! test
3611 Definition lists: colon in HTML attribute
3612 !! wikitext
3613 ;<b style="display: inline">bold</b>
3614 !! html
3615 <dl><dt><b style="display: inline">bold</b></dt></dl>
3616
3617 !! end
3618
3619 !! test
3620 Definition lists: self-closed tag
3621 !! wikitext
3622 ;one<br/>two : two-line fun
3623 !! html
3624 <dl><dt>one<br />two&#160;</dt>
3625 <dd> two-line fun</dd></dl>
3626
3627 !! end
3628
3629 !! test
3630 Bug 11748: Literal closing tags
3631 !! wikitext
3632 <dl>
3633 <dt>test 1</dt>
3634 <dd>test test test test test</dd>
3635 <dt>test 2</dt>
3636 <dd>test test test test test</dd>
3637 </dl>
3638 !! html
3639 <dl>
3640 <dt>test 1</dt>
3641 <dd>test test test test test</dd>
3642 <dt>test 2</dt>
3643 <dd>test test test test test</dd>
3644 </dl>
3645
3646 !! end
3647
3648 !! test
3649 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3650 !! wikitext
3651 <ul><li>
3652 ; term : description
3653 * unordered
3654 </li></ul>
3655 !! html
3656 <ul><li>
3657 <dl><dt> term&#160;</dt>
3658 <dd> description</dd></dl>
3659 <ul><li> unordered</li></ul>
3660 </li></ul>
3661
3662 !! end
3663
3664 !! test
3665
3666 Definition list with empty definition and following paragraph
3667 !! wikitext
3668 ; term:
3669 Paragraph text
3670 !! html
3671 <dl><dt> term</dt>
3672 <dd></dd></dl>
3673 <p>Paragraph text
3674 </p>
3675 !! end
3676
3677 !! test
3678 Nested definition lists using html syntax
3679 !! wikitext
3680 <dl><dt>x</dt>
3681 <dd>a</dd>
3682 <dd>b</dd></dl>
3683
3684 !! end
3685
3686 !! test
3687 Definition Lists: No nesting: Multiple dd's
3688 !! wikitext
3689 ;x
3690 :a
3691 :b
3692 !! html
3693 <dl><dt>x</dt>
3694 <dd>a</dd>
3695 <dd>b</dd></dl>
3696
3697 !! end
3698
3699 !! test
3700 Definition Lists: Indentation: Regular
3701 !! wikitext
3702 :i1
3703 ::i2
3704 :::i3
3705 !! html
3706 <dl><dd>i1
3707 <dl><dd>i2
3708 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition Lists: Indentation: Missing 1st level
3714 !! wikitext
3715 ::i2
3716 :::i3
3717 !! html
3718 <dl><dd><dl><dd>i2
3719 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3720
3721 !! end
3722
3723 !! test
3724 Definition Lists: Indentation: Multi-level indent
3725 !! wikitext
3726 :::i3
3727 !! html
3728 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3729
3730 !! end
3731
3732 !! test
3733 Definition Lists: Hacky use to indent tables
3734 !! wikitext
3735 ::{|
3736 |foo
3737 |bar
3738 |}
3739 this text
3740 should be left alone
3741 !! html
3742 <dl><dd><dl><dd><table>
3743 <tr>
3744 <td>foo
3745 </td>
3746 <td>bar
3747 </td></tr></table></dd></dl></dd></dl>
3748 <p>this text
3749 should be left alone
3750 </p>
3751 !! end
3752
3753 !! test
3754 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3755 !! wikitext
3756 <!-- foo -->
3757 ::{|
3758 |foo
3759 |bar
3760 |}<!-- bar -->
3761 this text
3762 should be left alone
3763 !! html/parsoid
3764 <!-- foo -->
3765 <dl><dd><dl><dd><table><tr>
3766 <td>foo</td>
3767 <td>bar</td>
3768 </tr></table><!-- bar --></dd></dl></dd></dl>
3769 <p>this text
3770 should be left alone</p>
3771 !! end
3772
3773 !! test
3774 Definition Lists: Hacky use to indent tables, with comment before table
3775 !! wikitext
3776 ::<!-- foo -->{|
3777 |foo
3778 |}
3779 !! html/parsoid
3780 <dl><dd><dl><dd><!-- foo --><table><tr>
3781 <td>foo</td>
3782 </tr></table></dd></dl></dd></dl>
3783 !! end
3784
3785 # The trailing whitespace in this test is to catch a regression in
3786 # Parsoid after T54473.
3787 !! test
3788 Definition Lists: Hacky use to indent tables (WS-insensitive)
3789 !! wikitext
3790 : {|
3791 |a
3792 |}
3793 !! html/php
3794 <dl><dd><table>
3795 <tr>
3796 <td>a
3797 </td></tr></table></dd></dl>
3798
3799 !! html/parsoid
3800 <dl><dd> <table>
3801 <tbody><tr><td>a</td></tr>
3802 </tbody></table> </dd></dl>
3803 !! end
3804
3805 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3806 ## as an empty dt item. It also ignores all but the last ";" when followed
3807 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3808 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3809 ## ";"s.
3810 ##
3811 ## Ex: ";;t2 ::d2" is transformed into:
3812 ##
3813 ## <dl>
3814 ## <dt>t2 </dt>
3815 ## <dd>
3816 ## <dl>
3817 ## <dt></dt>
3818 ## <dd>d2</dd>
3819 ## </dl>
3820 ## </dd>
3821 ## </dl>
3822 ##
3823 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3824 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3825 ##
3826 ## <dl>
3827 ## <dt>
3828 ## <dl>
3829 ## <dt>t2 </dt>
3830 ## <dd>:d2</dd>
3831 ## </dl>
3832 ## </dt>
3833 ## </dl>
3834 ##
3835 ## All Parsoid only definition list tests have this difference.
3836 ##
3837 ## See also: https://phabricator.wikimedia.org/T8569
3838 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3839
3840 !! test
3841 Table / list interaction: indented table with lists in table contents
3842 !! wikitext
3843 :{|
3844 |-
3845 | a
3846 * b
3847 |-
3848 | c
3849 * d
3850 |}
3851 !! html
3852 <dl><dd><table>
3853
3854 <tr>
3855 <td> a
3856 <ul><li> b</li></ul>
3857 </td></tr>
3858 <tr>
3859 <td> c
3860 <ul><li> d</li></ul>
3861 </td></tr></table></dd></dl>
3862
3863 !! end
3864
3865 !!test
3866 Table / list interaction: lists nested in tables nested in indented lists
3867 !! wikitext
3868 :{|
3869 |
3870 :a
3871 :b
3872 |
3873 *c
3874 *d
3875 |}
3876
3877 *e
3878 *f
3879 !! html
3880 <dl><dd><table>
3881 <tr>
3882 <td>
3883 <dl><dd>a</dd>
3884 <dd>b</dd></dl>
3885 </td>
3886 <td>
3887 <ul><li>c</li>
3888 <li>d</li></ul>
3889 </td></tr></table></dd></dl>
3890 <ul><li>e</li>
3891 <li>f</li></ul>
3892
3893 !!end
3894
3895 !! test
3896 Definition Lists: Nesting: Multi-level (Parsoid only)
3897 !! options
3898 parsoid
3899 !! wikitext
3900 ;t1 :d1
3901 ;;t2 ::d2
3902 ;;;t3 :::d3
3903 !! html
3904 <dl>
3905 <dt>t1 </dt>
3906 <dd>d1</dd>
3907 <dt>
3908 <dl>
3909 <dt>t2 </dt>
3910 <dd>:d2</dd>
3911 <dt>
3912 <dl>
3913 <dt>t3 </dt>
3914 <dd>::d3</dd>
3915 </dl>
3916 </dt>
3917 </dl>
3918 </dt>
3919 </dl>
3920
3921
3922 !! end
3923
3924
3925 !! test
3926 Definition Lists: Nesting: Test 2 (Parsoid only)
3927 !! wikitext
3928 ;t1
3929 ::d2
3930 !! html/php+tidy
3931 <dl>
3932 <dt>t1</dt>
3933 <dd>
3934 <dl>
3935 <dd>d2</dd>
3936 </dl>
3937 </dd>
3938 </dl>
3939 !! html/parsoid
3940 <dl>
3941 <dt>t1</dt>
3942 <dd>
3943 <dl>
3944 <dd>d2</dd>
3945 </dl>
3946 </dd>
3947 </dl>
3948
3949 !! end
3950
3951
3952 !! test
3953 Definition Lists: Nesting: Test 3 (Parsoid only)
3954 !! wikitext
3955 :;t1
3956 ::::d2
3957 !! html/php+tidy
3958 <dl>
3959 <dd>
3960 <dl>
3961 <dt>t1</dt>
3962 <dd>
3963 <dl>
3964 <dd>
3965 <dl>
3966 <dd>d2</dd>
3967 </dl>
3968 </dd>
3969 </dl>
3970 </dd>
3971 </dl>
3972 </dd>
3973 </dl>
3974 !! html/parsoid
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
3992 !! end
3993
3994
3995 !! test
3996 Definition Lists: Nesting: Test 4
3997 !! wikitext
3998 ::;t3
3999 :::d3
4000 !! html
4001 <dl><dd><dl><dd><dl><dt>t3</dt>
4002 <dd>d3</dd></dl></dd></dl></dd></dl>
4003
4004 !! end
4005
4006
4007 ## The Parsoid team believes the following three test exposes a
4008 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4009 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4010 ## It also exposes a "misfeature" in tidy, which doesn't like
4011 ## <dl> tags with a single <dt> child; it converts the <dt> into
4012 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4013 !! test
4014 Definition Lists: Mixed Lists: Test 1
4015 !! wikitext
4016 :;* foo
4017 ::* bar
4018 :; baz
4019 !! html/php
4020 <dl><dd><dl><dt><ul><li> foo</li>
4021 <li> bar</li></ul></dt></dl>
4022 <dl><dt> baz</dt></dl></dd></dl>
4023
4024 !! html/php+tidy
4025 <dl>
4026 <dd>
4027 <dl>
4028 <dd>
4029 <ul>
4030 <li>foo</li>
4031 <li>bar</li>
4032 </ul>
4033 </dd>
4034 </dl>
4035 <dl>
4036 <dt>baz</dt>
4037 </dl>
4038 </dd>
4039 </dl>
4040 !! html/parsoid
4041 <dl>
4042 <dd><dl>
4043 <dt><ul>
4044 <li> foo
4045 </li>
4046 </ul></dt>
4047 <dd><ul>
4048 <li> bar
4049 </li>
4050 </ul></dd>
4051 <dt> baz</dt>
4052 </dl></dd>
4053 </dl>
4054 !! end
4055
4056 !! test
4057 Definition Lists: Mixed Lists: Test 2
4058 !! wikitext
4059 *: d1
4060 *: d2
4061 !! html
4062 <ul><li><dl><dd> d1</dd>
4063 <dd> d2</dd></dl></li></ul>
4064
4065 !! end
4066
4067
4068 !! test
4069 Definition Lists: Mixed Lists: Test 3
4070 !! wikitext
4071 *::: d1
4072 *::: d2
4073 !! html
4074 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4075 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4076
4077 !! end
4078
4079
4080 !! test
4081 Definition Lists: Mixed Lists: Test 4
4082 !! wikitext
4083 *;d1 :d2
4084 *;d3 :d4
4085 !! html
4086 <ul><li><dl><dt>d1&#160;</dt>
4087 <dd>d2</dd>
4088 <dt>d3&#160;</dt>
4089 <dd>d4</dd></dl></li></ul>
4090
4091 !! end
4092
4093
4094 !! test
4095 Definition Lists: Mixed Lists: Test 5
4096 !! wikitext
4097 *:d1
4098 *:: d2
4099 !! html
4100 <ul><li><dl><dd>d1
4101 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4102
4103 !! end
4104
4105
4106 !! test
4107 Definition Lists: Mixed Lists: Test 6
4108 !! wikitext
4109 #*:d1
4110 #*::: d3
4111 !! html
4112 <ol><li><ul><li><dl><dd>d1
4113 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4114
4115 !! end
4116
4117
4118 !! test
4119 Definition Lists: Mixed Lists: Test 7
4120 !! wikitext
4121 :* d1
4122 :* d2
4123 !! html
4124 <dl><dd><ul><li> d1</li>
4125 <li> d2</li></ul></dd></dl>
4126
4127 !! end
4128
4129
4130 !! test
4131 Definition Lists: Mixed Lists: Test 8
4132 !! wikitext
4133 :* d1
4134 ::* d2
4135 !! html
4136 <dl><dd><ul><li> d1</li></ul>
4137 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4138
4139 !! end
4140
4141
4142 !! test
4143 Definition Lists: Mixed Lists: Test 9
4144 !! wikitext
4145 *;foo :bar
4146 !! html
4147 <ul><li><dl><dt>foo&#160;</dt>
4148 <dd>bar</dd></dl></li></ul>
4149
4150 !! end
4151
4152
4153 !! test
4154 Definition Lists: Mixed Lists: Test 10
4155 !! wikitext
4156 *#;foo :bar
4157 !! html
4158 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4159 <dd>bar</dd></dl></li></ol></li></ul>
4160
4161 !! end
4162
4163 # The Parsoid team disagrees with the PHP parser's seemingly-random
4164 # rules regarding dd/dt on the next two tests. Parsoid is more
4165 # consistent, and recognizes the shared nesting and keeps the
4166 # still-open tags around until the nesting is complete.
4167 # (And tidy again converts <dt> to <dd> before 'bar'.)
4168
4169 !! test
4170 Definition Lists: Mixed Lists: Test 11
4171 !! wikitext
4172 *#*#;*;;foo :bar
4173 *#*#;boo :baz
4174 !! html/php
4175 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4176 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4177 <dl><dt>boo&#160;</dt>
4178 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4179
4180 !! html/php+tidy
4181 <ul>
4182 <li>
4183 <ol>
4184 <li>
4185 <ul>
4186 <li>
4187 <ol>
4188 <li>
4189 <dl>
4190 <dt>foo&#160;</dt>
4191 <dd>
4192 <ul>
4193 <li>
4194 <dl>
4195 <dd>
4196 <dl>
4197 <dt>bar</dt>
4198 </dl>
4199 </dd>
4200 </dl>
4201 </li>
4202 </ul>
4203 </dd>
4204 </dl>
4205 <dl>
4206 <dt>boo&#160;</dt>
4207 <dd>baz</dd>
4208 </dl>
4209 </li>
4210 </ol>
4211 </li>
4212 </ul>
4213 </li>
4214 </ol>
4215 </li>
4216 </ul>
4217 !! html/parsoid
4218 <ul>
4219 <li>
4220 <ol>
4221 <li>
4222 <ul>
4223 <li>
4224 <ol>
4225 <li>
4226 <dl>
4227 <dt>
4228 <ul>
4229 <li>
4230 <dl>
4231 <dt>
4232 <dl>
4233 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4234 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4235 </dl></dt>
4236 </dl></li>
4237 </ul></dt>
4238 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4239 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4240 </dl></li>
4241 </ol></li>
4242 </ul></li>
4243 </ol></li>
4244 </ul>
4245 !! end
4246
4247
4248 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4249 # From whitelist:
4250 # * The test is wrong, there are two colons where there should be :;
4251 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4252 !! test
4253 Definition Lists: Weird Ones: Test 1
4254 !! wikitext
4255 *#;*::;; foo : bar (who uses this?)
4256 !! html/php
4257 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4258 <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>
4259
4260 !! html/php+tidy
4261 <ul>
4262 <li>
4263 <ol>
4264 <li>
4265 <dl>
4266 <dt>foo&#160;</dt>
4267 <dd>
4268 <ul>
4269 <li>
4270 <dl>
4271 <dd>
4272 <dl>
4273 <dd>
4274 <dl>
4275 <dd>
4276 <dl>
4277 <dt>bar (who uses this?)</dt>
4278 </dl>
4279 </dd>
4280 </dl>
4281 </dd>
4282 </dl>
4283 </dd>
4284 </dl>
4285 </li>
4286 </ul>
4287 </dd>
4288 </dl>
4289 </li>
4290 </ol>
4291 </li>
4292 </ul>
4293 !! html/parsoid
4294 <ul>
4295 <li>
4296 <ol>
4297 <li>
4298 <dl>
4299 <dt>
4300 <ul>
4301 <li>
4302 <dl>
4303 <dd>
4304 <dl>
4305 <dd>
4306 <dl>
4307 <dt>
4308 <dl>
4309 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4310 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4311 </dl></dt>
4312 </dl></dd>
4313 </dl></dd>
4314 </dl></li>
4315 </ul></dt>
4316 </dl></li>
4317 </ol></li>
4318 </ul>
4319 !! end
4320
4321 !! test
4322 Definition Lists: colons occurring in tags
4323 !! wikitext
4324 ;a:b
4325 ;'''a:b'''
4326 ;<i>a:b</i>
4327 ;<span>a:b</span>
4328 ;<div>a:b</div>
4329 ;<div>a
4330 :b</div>
4331 ;{{echo|a:b}}
4332 ;{{echo|''a:b''}}
4333 ;;;''a:b''
4334 !! html+tidy
4335 <dl>
4336 <dt>a</dt>
4337 <dd>b</dd>
4338 <dt><b>a:b</b></dt>
4339 <dt><i>a:b</i></dt>
4340 <dt><span>a:b</span></dt>
4341 <dd>
4342 <div>a:b</div>
4343 </dd>
4344 <dd>
4345 <div>a
4346 <dl>
4347 <dd>b</dd>
4348 </dl>
4349 </div>
4350 </dd>
4351 <dt>a</dt>
4352 <dd>b</dd>
4353 <dt><i>a:b</i></dt>
4354 </dl>
4355 <dl>
4356 <dd>
4357 <dl>
4358 <dd>
4359 <dl>
4360 <dt><i>a:b</i></dt>
4361 </dl>
4362 </dd>
4363 </dl>
4364 </dd>
4365 </dl>
4366 !! html/parsoid
4367 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4368 <dt><b>a:b</b></dt>
4369 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4370 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4371 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4372 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4373 <dd>b</dd>
4374 <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>
4375 <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>
4376 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4377 !! end
4378
4379 !! test
4380 Definition Lists: colons and tables 1
4381 !! wikitext
4382 :{|
4383 | x
4384 |}
4385 :{|
4386 | y
4387 |}
4388 !! html
4389 <dl><dd><table>
4390 <tr>
4391 <td> x
4392 </td></tr></table></dd></dl>
4393 <dl><dd><table>
4394 <tr>
4395 <td> y
4396 </td></tr></table></dd></dl>
4397
4398 !! end
4399
4400 # Parsoid's output (as documented below) differs from php's in this case.
4401 # This is probably a bug. If we fixup parsoid to match php's output, the
4402 # above test should pass and the below test case can be removed. It is
4403 # unclear which output is more desirable.
4404
4405 !! test
4406 Definition Lists: colons and tables 2
4407 !! wikitext
4408 :{|
4409 | x
4410 |}
4411 :{|
4412 | y
4413 |}
4414 !! html/parsoid
4415 <dl><dd><table>
4416 <tr>
4417 <td> x
4418 </td></tr></table></dd>
4419 <dd><table>
4420 <tr>
4421 <td> y
4422 </td></tr></table></dd></dl>
4423 !! end
4424
4425 !! test
4426 Definition Lists: template interaction
4427 !! wikitext
4428 ::{{definition_list}}
4429
4430 :one
4431 ::{{definition_list}}
4432 :::two
4433 :::three
4434 ::four
4435 !! html/parsoid
4436 <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">
4437 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4438
4439 <dl><dd data-parsoid='{}'>one
4440 <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">
4441 </span><dd about="#mwt2">two
4442 <dl><dd>two</dd>
4443 <dd>three</dd></dl></dd>
4444 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4445 !! end
4446
4447
4448 ###
4449 ### External links
4450 ###
4451 !! test
4452 External links: non-bracketed
4453 !! wikitext
4454 Non-bracketed: http://example.com
4455 !! html
4456 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4457 </p>
4458 !! end
4459
4460 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4461 !! test
4462 External links: numbered
4463 !! wikitext
4464 Numbered: [http://example.com]
4465 Numbered: [http://example.net]
4466 Numbered: [http://example.com]
4467 !! html/php
4468 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4469 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4470 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4471 </p>
4472 !! html/parsoid
4473 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4474 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4475 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4476 !!end
4477
4478 !! test
4479 External links: specified text
4480 !! wikitext
4481 Specified text: [http://example.com link]
4482 !! html
4483 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4484 </p>
4485 !!end
4486
4487 !! test
4488 External links: trail
4489 !! wikitext
4490 Linktrails should not work for external links: [http://example.com link]s
4491 !! html
4492 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4493 </p>
4494 !! end
4495
4496 !! test
4497 External links: dollar sign in URL
4498 !! wikitext
4499 http://example.com/1$2345
4500 !! html
4501 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4502 </p>
4503 !! end
4504
4505 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4506 !! test
4507 External links: dollar sign in URL (autonumber)
4508 !! wikitext
4509 [http://example.com/1$2345]
4510 !! html/php
4511 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4512 </p>
4513 !! html/parsoid
4514 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4515 !!end
4516
4517 !! test
4518 External links: open square bracket forbidden in URL (bug 4377)
4519 !! options
4520 parsoid=wt2html,wt2wt,html2html
4521 !! wikitext
4522 http://example.com/1[2345
4523 !! html/php
4524 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4525 </p>
4526 !! html/parsoid
4527 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4528 !! end
4529
4530 !! test
4531 External links: open square bracket forbidden in URL (named) (bug 4377)
4532 !! options
4533 parsoid=wt2html,html2html
4534 !! wikitext
4535 [http://example.com/1[2345]
4536 !! html/php
4537 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4538 </p>
4539 !! html/parsoid
4540 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4541 !!end
4542
4543 # parsoid adds a space before the link name
4544 !! test
4545 External links: open square bracket forbidden in URL (named) (bug 4377)
4546 Parsoid variant.
4547 !! wikitext
4548 [http://example.com/1 [2345]
4549 !! html
4550 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: nowiki in URL link text (bug 6230)
4556 !! wikitext
4557 [http://example.com/ <nowiki>''example site''</nowiki>]
4558 !! html
4559 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4560 </p>
4561 !! end
4562
4563 !! test
4564 External links: newline forbidden in text (bug 6230 regression check)
4565 !! wikitext
4566 [http://example.com/ first
4567 second]
4568 !! html
4569 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4570 second]
4571 </p>
4572 !!end
4573
4574 !! test
4575 External links: Pipe char between url and text
4576 !! wikitext
4577 [http://example.com | link]
4578 !! html
4579 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4580 </p>
4581 !!end
4582
4583 !! test
4584 External links: protocol-relative URL in brackets
4585 !! wikitext
4586 [//example.com/ Test]
4587 !! html
4588 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4589 </p>
4590 !! end
4591
4592 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4593 !! test
4594 External links: protocol-relative URL in brackets without text
4595 !! wikitext
4596 [//example.com]
4597 !! html/php
4598 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4599 </p>
4600 !! html/parsoid
4601 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4602 !! end
4603
4604 !! test
4605 External links: protocol-relative URL in free text is left alone
4606 !! wikitext
4607 //example.com/Foo
4608 !! html
4609 <p>//example.com/Foo
4610 </p>
4611 !!end
4612
4613 !! test
4614 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4615 !! wikitext
4616 foo//example.com/Foo
4617 !! html
4618 <p>foo//example.com/Foo
4619 </p>
4620 !! end
4621
4622 !! test
4623 External links: with no contents
4624 !! wikitext
4625 [http://en.wikipedia.org/wiki/Foo]
4626
4627 [[wikipedia:Foo|Bar]]
4628
4629 [[wikipedia:Foo|<span>Bar</span>]]
4630 !! html/php
4631 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4632 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4633 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4634 </p>
4635 !! html/parsoid
4636 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4637 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4638 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4639 !! end
4640
4641 !! test
4642 External links: Free with trailing punctuation
4643 !! wikitext
4644 http://example.com,
4645 http://example.com;
4646 http://example.com\
4647 http://example.com.
4648 http://example.com:
4649 http://example.com!
4650 http://example.com?
4651 http://example.com)
4652 http://example.com/url_with_(brackets)
4653 (http://example.com/url_without_brackets)
4654 http://example.com/url_with_entity&amp;
4655 http://example.com/url_with_entity&#x26;
4656 http://example.com/url_with_entity&#038;
4657 http://example.com/url_with_entity&nbsp;
4658 http://example.com/url_with_entity&#xA0;
4659 http://example.com/url_with_entity&#160;
4660 http://example.com/url_with_entity&lt;
4661 http://example.com/url_with_entity&#x3C;
4662 http://example.com/url_with_entity&#60;
4663 !! html/php
4664 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4665 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4667 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4670 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4672 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4673 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4674 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4683 </p>
4684 !! html/parsoid
4685 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4686 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4687 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4688 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4691 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4693 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4694 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4695 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4696 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4697 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4704 !! end
4705
4706 !! test
4707 External links: tricky Parsoid html2html case
4708 !! options
4709 parsoid=wt2html,wt2wt,html2html
4710 !! wikitext
4711 http://example.com/url_with_entity&amp;amp;
4712 !! html/php
4713 <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>;
4714 </p>
4715 !! html/parsoid
4716 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4717 !! end
4718
4719 !! test
4720 External links: Free with trailing quotes (T113666)
4721 !! wikitext
4722 '''News:''' Stuff here
4723
4724 news:'a'b''c''d e
4725 !! html/php
4726 <p><b>News:</b> Stuff here
4727 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4728 </p>
4729 !! html/parsoid
4730 <p><b>News:</b> Stuff here</p>
4731 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4732 !! end
4733
4734 !! test
4735 External links: Lone protocols are never linked (T105697)
4736 !! wikitext
4737 http://
4738 http://;
4739 (http://)
4740 bitcoin:
4741 bitcoin:;
4742 (bitcoin:)
4743 !! html
4744 <p>http://
4745 http://;
4746 (http://)
4747 bitcoin:
4748 bitcoin:;
4749 (bitcoin:)
4750 </p>
4751 !! end
4752
4753 !! test
4754 External links: No preceding word characters allowed (bug 65278)
4755 !! wikitext
4756 NOPEhttp://example.com
4757 N0http://example.com
4758 ok:http://example.com
4759 ok-http://example.com
4760 !! html
4761 <p>NOPEhttp://example.com
4762 N0http://example.com
4763 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4764 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4765 </p>
4766 !! end
4767
4768 !! test
4769 External links: nofollow domain exception
4770 !! wikitext
4771 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4772 !! html
4773 <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>.
4774 </p>
4775 !!end
4776
4777 !! test
4778 External image
4779 !! wikitext
4780 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4781 !! html
4782 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4783 </p>
4784 !! end
4785
4786 !! test
4787 External image from https
4788 !! wikitext
4789 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4790 !! html
4791 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4792 </p>
4793 !! end
4794
4795 !! test
4796 External image (when not allowed)
4797 !! options
4798 wgAllowExternalImages=0
4799 !! wikitext
4800 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4801 !! html
4802 <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>
4803 </p>
4804 !! end
4805
4806 !! test
4807 Link to non-http image, no img tag
4808 !! wikitext
4809 Link to non-http image, no img tag: ftp://example.com/test.jpg
4810 !! html
4811 <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>
4812 </p>
4813 !! end
4814
4815 !! test
4816 External links: terminating separator
4817 !! wikitext
4818 Terminating separator: http://example.com/thing,
4819 !! html
4820 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4821 </p>
4822 !! end
4823
4824 !! test
4825 External links: intervening separator
4826 !! wikitext
4827 Intervening separator: http://example.com/1,2,3
4828 !! html
4829 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4830 </p>
4831 !! end
4832
4833 !! test
4834 External links: old bug with URL in query
4835 !! wikitext
4836 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4837 !! html
4838 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4839 </p>
4840 !! end
4841
4842 !! test
4843 External links: old URL-in-URL bug, mixed protocols
4844 !! wikitext
4845 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4846 !! html
4847 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4848 </p>
4849 !!end
4850
4851 # Since Parsoid is starting to emit canonical wikitext for links,
4852 # [http://example.com http://example.com] will not RT back to that
4853 # form anymore.
4854 !! test
4855 External links: URL in text
4856 !! options
4857 parsoid=wt2html
4858 !! wikitext
4859 URL in text: [http://example.com http://example.com]
4860 !! html/php
4861 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4862 </p>
4863 !! html/parsoid
4864 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4865 !! end
4866
4867 !! test
4868 External links: Clickable images
4869 !! wikitext
4870 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4871 !! html/php
4872 <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>
4873 </p>
4874 !! html/parsoid
4875 <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>
4876 !! end
4877
4878 !! test
4879 External links: raw ampersand
4880 !! wikitext
4881 Old &amp; use: http://x&y
4882 !! html
4883 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4884 </p>
4885 !! end
4886
4887 !! test
4888 External links: encoded ampersand
4889 !! wikitext
4890 Old &amp; use: http://x&amp;y
4891 !! html/php
4892 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4893 </p>
4894 !! html/parsoid
4895 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4896 !! end
4897
4898 !! test
4899 External links: encoded equals (bug 6102)
4900 !! wikitext
4901 http://example.com/?foo&#61;bar
4902 !! html/php
4903 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4907 !! end
4908
4909 ##
4910 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4911 ## does it number them. As discussed in bug 53505, we can identify
4912 ## autonumbered links via CSS.
4913 ##
4914
4915 !! test
4916 External links: [raw ampersand]
4917 !! wikitext
4918 Old &amp; use: [http://x&y]
4919 !! html/php
4920 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4921 </p>
4922 !! html/parsoid
4923 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4924 !! end
4925
4926 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4927 # mode will return the [raw ampersand] wikitext
4928 !! test
4929 External links: [encoded ampersand]
4930 !! options
4931 parsoid=wt2html,wt2wt,html2html
4932 !! wikitext
4933 Old &amp; use: [http://x&amp;y]
4934 !! html/php
4935 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4936 </p>
4937 !! html/parsoid
4938 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4939 !! end
4940
4941 !! test
4942 External links: [raw equals]
4943 !! wikitext
4944 [http://example.com/?foo=bar]
4945 !! html/php
4946 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4947 </p>
4948 !! html/parsoid
4949 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4950 !! end
4951
4952 # note that parsoid html is identical to [raw equals] case; so html2wt
4953 # mode will return the [raw equals] wikitext
4954 !! test
4955 External links: [encoded equals] (bug 6102)
4956 !! options
4957 parsoid=wt2html,wt2wt,html2html
4958 !! wikitext
4959 [http://example.com/?foo&#61;bar]
4960 !! html/php
4961 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4962 </p>
4963 !! html/parsoid
4964 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4965 !! end
4966
4967 # xxx parsoid strips the IDN character, so the round-trip tests will
4968 # obviously fail and are disabled. --cscott
4969 !! test
4970 External links: [IDN ignored character reference in hostname; strip it right off]
4971 !! options
4972 parsoid=wt2html,wt2wt,html2html
4973 !! wikitext
4974 [http://e&zwnj;xample.com/]
4975 !! html/php
4976 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4977 </p>
4978 !! html/parsoid
4979 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4980 !! end
4981
4982 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4983 # Where an external link could easily circumvent the sanitization of the text of
4984 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4985 # test demands a higher standard. That's a bit strange.
4986 #
4987 # Example:
4988 #
4989 # http://e‌xample.com -> [http://example.com|http://example.com]
4990 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4991 #
4992 # The first example is sanitized, but the second is not. Any security benefits
4993 # from this production are trivial to circumvent. Either remove this test and
4994 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4995 # the test accordingly.
4996 #
4997 # All our love,
4998 # The Parsoid team.
4999 # xxx parsoid strips the IDN character, so the round-trip tests will
5000 # obviously fail and are disabled. --cscott
5001 !! test
5002 External links: IDN ignored character reference in hostname; strip it right off
5003 !! options
5004 parsoid=wt2html,html2html
5005 !! wikitext
5006 http://e&zwnj;xample.com/
5007 !! html/php
5008 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5009 </p>
5010 !! html/parsoid
5011 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5012 !! end
5013
5014 !! test
5015 External links: www.jpeg.org (bug 554)
5016 !! wikitext
5017 http://www.jpeg.org
5018 !! html
5019 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5020 </p>
5021 !! end
5022
5023 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5024 !! test
5025 External links: URL within URL (original bug 2)
5026 !! wikitext
5027 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5028 !! html/php
5029 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5030 </p>
5031 !! html/parsoid
5032 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5033 !! end
5034
5035 !! test
5036 BUG 361: URL inside bracketed URL
5037 !! wikitext
5038 [http://www.example.com/foo http://www.example.com/bar]
5039 !! html
5040 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5041 </p>
5042 !! end
5043
5044 !! test
5045 BUG 361: URL within URL, not bracketed
5046 !! wikitext
5047 http://www.example.com/foo?=http://www.example.com/bar
5048 !! html
5049 <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>
5050 </p>
5051 !! end
5052
5053 !! test
5054 BUG 289: ">"-token in URL-tail
5055 !! wikitext
5056 http://www.example.com/<hello>
5057 !! html
5058 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5059 </p>
5060 !!end
5061
5062 !! test
5063 BUG 289: literal ">"-token in URL-tail
5064 !! wikitext
5065 http://www.example.com/<b>html</b>
5066 !! html/php
5067 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5068 </p>
5069 !! html/parsoid
5070 <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>
5071 !! end
5072
5073 !! test
5074 BUG 289: ">"-token in bracketed URL
5075 !! wikitext
5076 [http://www.example.com/<hello> stuff]
5077 !! html
5078 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5079 </p>
5080 !!end
5081
5082 !! test
5083 BUG 289: literal ">"-token in bracketed URL
5084 !! wikitext
5085 [http://www.example.com/<b>html</b> stuff]
5086 !! html
5087 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5088 </p>
5089 !!end
5090
5091 !! test
5092 BUG 289: literal double quote at end of URL
5093 !! wikitext
5094 http://www.example.com/"hello"
5095 !! html
5096 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5097 </p>
5098 !!end
5099
5100 !! test
5101 BUG 289: literal double quote in bracketed URL
5102 !! wikitext
5103 [http://www.example.com/"hello" stuff]
5104 !! html
5105 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5106 </p>
5107 !!end
5108
5109 !! test
5110 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5111 !! wikitext
5112 [http://www.example.com test]
5113 !! html
5114 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5115 </p>
5116 !! end
5117
5118 !! test
5119 External links: link text with spaces
5120 !! wikitext
5121 [http://www.example.com a b c]
5122 [http://www.example.com ''a'' ''b'']
5123 !! html
5124 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5125 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5126 </p>
5127 !! end
5128
5129 !! test
5130 External links: wiki links within external link (Bug 3695)
5131 !! options
5132 parsoid=wt2html,html2html
5133 !! wikitext
5134 [http://example.com [[wikilink]] embedded in ext link]
5135 !! html/php
5136 <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>
5137 </p>
5138 !! html/parsoid
5139 <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>
5140 !! end
5141
5142 !! test
5143 BUG 787: Links with one slash after the url protocol are invalid
5144 !! wikitext
5145 http:/example.com
5146
5147 [http:/example.com title]
5148 !! html
5149 <p>http:/example.com
5150 </p><p>[http:/example.com title]
5151 </p>
5152 !! end
5153
5154 !! test
5155 Bracketed external links with template-generated invalid target
5156 !! wikitext
5157 [{{echo|http:/example.com}} title]
5158 !! html
5159 <p>[http:/example.com title]
5160 </p>
5161 !! end
5162
5163 !! test
5164 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5165 !! wikitext
5166 ''[http://example.com text'']
5167 [http://example.com '''text]'''
5168 ''Something [http://example.com in italic'']
5169 ''Something [http://example.com mixed''''', even bold]'''
5170 '''''Now [http://example.com both''''']
5171 !! html
5172 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5173 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5174 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5175 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5176 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5177 </p>
5178 !! end
5179
5180
5181 !! test
5182 Bug 4781: %26 in URL
5183 !! wikitext
5184 http://www.example.com/?title=AT%26T
5185 !! html/php
5186 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5187 </p>
5188 !! html/parsoid
5189 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5190 !! end
5191
5192 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5193 # % is actually legal in HTML5. Any change in output would need testing though.
5194 !! test
5195 Bug 4781, 5267: %25 in URL
5196 !! wikitext
5197 http://www.example.com/?title=100%25_Bran
5198 !! html/php
5199 <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>
5200 </p>
5201 !! html/parsoid
5202 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5203 !! end
5204
5205 !! test
5206 Bug 4781, 5267: %28, %29 in URL
5207 !! wikitext
5208 http://www.example.com/?title=Ben-Hur_%281959_film%29
5209 !! html/php
5210 <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>
5211 </p>
5212 !! html/parsoid
5213 <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>
5214 !! end
5215
5216
5217 !! test
5218 Bug 4781: %26 in autonumber URL
5219 !! wikitext
5220 [http://www.example.com/?title=AT%26T]
5221 !! html/php
5222 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5223 </p>
5224 !! html/parsoid
5225 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5226 !! end
5227
5228 !! test
5229 Bug 4781, 5267: %26 in autonumber URL
5230 !! wikitext
5231 [http://www.example.com/?title=100%25_Bran]
5232 !! html/php
5233 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5234 </p>
5235 !! html/parsoid
5236 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5237 !! end
5238
5239 !! test
5240 Bug 4781, 5267: %28, %29 in autonumber URL
5241 !! wikitext
5242 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5243 !! html/php
5244 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5245 </p>
5246 !! html/parsoid
5247 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5248 !! end
5249
5250
5251 !! test
5252 Bug 4781: %26 in bracketed URL
5253 !! wikitext
5254 [http://www.example.com/?title=AT%26T link]
5255 !! html/php
5256 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5257 </p>
5258 !! html/parsoid
5259 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5260 !! end
5261
5262 !! test
5263 Bug 4781, 5267: %25 in bracketed URL
5264 !! wikitext
5265 [http://www.example.com/?title=100%25_Bran link]
5266 !! html
5267 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5268 </p>
5269 !! end
5270
5271 !! test
5272 Bug 4781, 5267: %28, %29 in bracketed URL
5273 !! wikitext
5274 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5275 !! html/php
5276 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5277 </p>
5278 !! html/parsoid
5279 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5280 !! end
5281
5282 !! test
5283 External link containing a period in the anchor. (bug 63947)
5284 !! wikitext
5285 [//foo.org/bar#baz. bang]
5286
5287 [//foo.org/bar. bang]
5288 !! html/php
5289 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5290 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5291 </p>
5292 !! html/parsoid
5293 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5294 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5295 !! end
5296
5297 !! test
5298 External link containing a single quote. (bug 63947)
5299 !! wikitext
5300 [//foo.org/bar'baz]
5301
5302 [//foo.org/bar'baz bang]
5303 !! html/php
5304 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5305 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5306 </p>
5307 !! html/parsoid
5308 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5309 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5310 !! end
5311
5312 !! test
5313 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5314 !! wikitext
5315 Some [http://example.com/ pretty ''italics'' and stuff]!
5316 !! html
5317 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5318 </p>
5319 !! end
5320
5321 !! test
5322 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5323 !! wikitext
5324 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5325 !! html
5326 <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>
5327 </p>
5328 !! end
5329
5330 !! test
5331 External link containing double-single-quotes with no space separating the url from text in italics
5332 !! wikitext
5333 [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]].]
5334 !! html/php
5335 <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>
5336 </p>
5337 !! html/php+tidy
5338 <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>
5339 !! html/parsoid
5340 <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>
5341 !! end
5342
5343 !! test
5344 External link with comments in link text
5345 !! wikitext
5346 [http://www.google.com Google <!-- comment -->]
5347 !! html/php
5348 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5349 </p>
5350 !! html/parsoid
5351 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5352 !! end
5353
5354 !! test
5355 External link to bare IPv4 address
5356 !! wikitext
5357 [http://192.168.0.1 Link]
5358 !! html/php
5359 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5360 </p>
5361 !! html/parsoid
5362 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5363 !! end
5364
5365 !! test
5366 URL-encoding in URL functions (single parameter)
5367 !! wikitext
5368 {{localurl:Some page|amp=&}}
5369 !! html
5370 <p>/index.php?title=Some_page&amp;amp=&amp;
5371 </p>
5372 !! end
5373
5374 !! test
5375 URL-encoding in URL functions (multiple parameters)
5376 !! wikitext
5377 {{localurl:Some page|q=?&amp=&}}
5378 !! html
5379 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5380 </p>
5381 !! end
5382
5383 !! test
5384 Brackets in urls
5385 !! wikitext
5386 http://example.com/index.php?foozoid%5B%5D=bar
5387
5388 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5389 !! html/php
5390 <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>
5391 </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>
5392 </p>
5393 !! html/parsoid
5394 <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>
5395
5396 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5397 !! end
5398
5399 !! test
5400 IPv6 urls, autolink format (T23261)
5401 !! wikitext
5402 http://[2404:130:0:1000::187:2]/index.php
5403
5404 Examples from RFC 2373, section 2.2:
5405 * http://[1080::8:800:200C:417A]/unicast
5406 * http://[FF01::101]/multicast
5407 * http://[::1]/loopback
5408 * http://[::]/unspecified
5409 * http://[::13.1.68.3]/ipv4compat
5410 * http://[::FFFF:129.144.52.38]/ipv4compat
5411
5412 Examples from RFC 2732, section 2:
5413 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5414 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5415 * http://[3ffe:2a00:100:7031::1]
5416 * http://[1080::8:800:200C:417A]/foo
5417 * http://[::192.9.5.5]/ipng
5418 * http://[::FFFF:129.144.52.38]:80/index.html
5419 * http://[2010:836B:4179::836B:4179]
5420
5421 !! html/php
5422 <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>
5423 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5424 </p>
5425 <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>
5426 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5428 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5429 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5430 <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>
5431 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5432 </p>
5433 <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>
5434 <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>
5435 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5436 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5438 <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>
5439 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5440
5441 !! html/parsoid
5442 <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>
5443
5444 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5445 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5448 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5450 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5451
5452 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5453 <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>
5454 <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>
5455 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5458 <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>
5459 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5460 !! end
5461
5462 !! test
5463 IPv6 urls, bracketed format (T23261)
5464 !! wikitext
5465 [http://[2404:130:0:1000::187:2]/index.php test]
5466
5467 Examples from RFC 2373, section 2.2:
5468 * [http://[1080::8:800:200C:417A] unicast]
5469 * [http://[FF01::101] multicast]
5470 * [http://[::1]/ loopback]
5471 * [http://[::] unspecified]
5472 * [http://[::13.1.68.3] ipv4compat]
5473 * [http://[::FFFF:129.144.52.38] ipv4compat]
5474
5475 Examples from RFC 2732, section 2:
5476 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5477 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5478 * [http://[3ffe:2a00:100:7031::1] 3]
5479 * [http://[1080::8:800:200C:417A]/foo 4]
5480 * [http://[::192.9.5.5]/ipng 5]
5481 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5482 * [http://[2010:836B:4179::836B:4179] 7]
5483
5484 !! html/php
5485 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5486 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5487 </p>
5488 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5493 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5494 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5495 </p>
5496 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5497 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5498 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5503
5504 !! html/parsoid
5505 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5506
5507 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5508 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5514
5515 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5516 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5523 !! end
5524
5525 !! test
5526 Non-extlinks in brackets
5527 !! wikitext
5528 [foo]
5529 [foo bar]
5530 [foo ''bar'']
5531 [fool's] errand
5532 [fool's errand]
5533 [{{echo|foo}}]
5534 [{{echo|foo}} bar]
5535 [{{echo|foo}} ''bar'']
5536 [{{echo|foo}}l's] errand
5537 [{{echo|foo}}l's errand]
5538 [url={{echo|foo}}]
5539 [url=http://example.com]
5540 [http:// bare protocols don't count]
5541 !! html/php
5542 <p>[foo]
5543 [foo bar]
5544 [foo <i>bar</i>]
5545 [fool's] errand
5546 [fool's errand]
5547 [foo]
5548 [foo bar]
5549 [foo <i>bar</i>]
5550 [fool's] errand
5551 [fool's errand]
5552 [url=foo]
5553 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5554 [http:// bare protocols don't count]
5555 </p>
5556 !! html/parsoid
5557 <p>[foo]
5558 [foo bar]
5559 [foo <i>bar</i>]
5560 [fool's] errand
5561 [fool's errand]
5562 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5563 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5564 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5565 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5566 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5567 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5568 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5569 [http:// bare protocols don't count]</p>
5570 !! end
5571
5572 !! test
5573 Percent encoding in external links
5574 !! wikitext
5575 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5576 !! html/php
5577 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5578 </p>
5579 !! html/parsoid
5580 <p><a rel="mw:ExtLink"
5581 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5582 !! end
5583
5584 !! test
5585 Use url link syntax for links where the content is equal the link target
5586 !! wikitext
5587 http://example.com
5588 !! html/php
5589 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5590 </p>
5591 !! html/parsoid
5592 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5593 !! end
5594
5595 !! test
5596 Parenthesis in external links, especially URL links
5597 !! wikitext
5598 http://example.com)
5599
5600 http://example.com/test)
5601
5602 http://example.com/(test)
5603
5604 http://example.com/((test)
5605
5606 (http://example.com/(test))
5607
5608 (http://example.com/(test)))))
5609
5610 http://example.com/a)b
5611
5612 [http://example.com) foo]
5613 !! html/php
5614 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5615 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5616 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5617 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5618 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5619 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5620 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5621 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5622 </p>
5623 !! html/parsoid
5624 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5625 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5626 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5627 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5628 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5629 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5630 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5631 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5632 !! end
5633
5634 !! test
5635 Parenthesis in external links, w/ transclusion or comment
5636 !! wikitext
5637 (http://example.com/{{echo|hi}})
5638
5639 (http://example.com<!-- hi -->)
5640 !! html/php
5641 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5642 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5643 </p>
5644 !! html/parsoid
5645 <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>
5646
5647 <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>
5648 !! end
5649
5650 !! test
5651 Serialize <a> tags with invalid link targets as plain text
5652 !! options
5653 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5654 !! html/parsoid
5655 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5656 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5657 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5658 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5659 !! wikitext
5660 text
5661 <nowiki>*</nowiki>text
5662 <nowiki>[[foo]]</nowiki>
5663 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5664 !! end
5665
5666 !! test
5667 mw:ExtLink -vs- mw:WikiLink (T94723)
5668 !! options
5669 parsoid=html2wt
5670 !! html/parsoid
5671 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5672 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5673 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5674 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5675 <p>
5676 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5677 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5678 </p>
5679 !! wikitext
5680 [[Foo|Bar]]
5681 [[Foo|Bar]]
5682 [[wikipedia:Foo|Bar]]
5683 [[wikipedia:Foo|Bar]]
5684
5685 [[wikipedia:European_Robin|European Robin]]
5686 [[wikipedia:European_Robin|European Robin]]
5687 !! end
5688
5689 !! test
5690 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5691 !! options
5692 parsoid=wt2wt
5693 !! wikitext
5694 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5695 !! html/parsoid
5696 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5697 !! end
5698
5699
5700 ###
5701 ### Quotes
5702 ###
5703
5704 !! test
5705 Quotes
5706 !! wikitext
5707 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5708
5709 Normal text. '''''Bold italic text.''''' Normal text.
5710 !! html
5711 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5712 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5713 </p>
5714 !! end
5715
5716
5717 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5718 # parser strips. The wikitext contains just the first half of the bold
5719 # quote pair.
5720 !! test
5721 Unclosed and unmatched quotes
5722 !! wikitext
5723 '''''Bold italic text '''with bold deactivated''' in between.'''''
5724
5725 '''''Bold italic text ''with italic deactivated'' in between.'''''
5726
5727 '''Bold text..
5728
5729 ..spanning two paragraphs (should not work).'''
5730
5731 '''Bold tag left open
5732
5733 ''Italic tag left open
5734
5735 Normal text.
5736
5737 <!-- Unmatching number of opening, closing tags: -->
5738 '''This year''''s election ''should'' beat '''last year''''s.
5739
5740 ''Tom'''s car is bigger than ''Susan'''s.
5741
5742 Plain ''italic'''s plain
5743 !! html/php
5744 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5745 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5746 </p><p><b>Bold text..</b>
5747 </p><p>..spanning two paragraphs (should not work).
5748 </p><p><b>Bold tag left open</b>
5749 </p><p><i>Italic tag left open</i>
5750 </p><p>Normal text.
5751 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5752 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5753 </p><p>Plain <i>italic'</i>s plain
5754 </p>
5755 !! html/parsoid
5756 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5757 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5758 </p><p><b>Bold text..</b>
5759 </p><p>..spanning two paragraphs (should not work).<b></b>
5760 </p><p><b>Bold tag left open</b>
5761 </p><p><i>Italic tag left open</i>
5762 </p><p>Normal text.
5763 </p>
5764 <!-- Unmatching number of opening, closing tags: -->
5765 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5766 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5767 </p><p>Plain <i>italic'</i>s plain
5768 </p>
5769 !! end
5770
5771 ###
5772 ### Tables
5773 ###
5774 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5775 ###
5776
5777 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5778 # is the bare minimum required by the spec, see:
5779 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5780 # Parsoid team replies: empty table tags are legal in HTML5
5781 !! test
5782 A table with no data.
5783 !! options
5784 parsoid=wt2html
5785 !! wikitext
5786 {||}
5787 !! html/php
5788
5789 !! html/parsoid
5790 <table></table>
5791
5792 !! end
5793
5794 !! test
5795 A table with stray table end tags on start tag line (wt2html)
5796 !! options
5797 parsoid=wt2html
5798 !! wikitext
5799 {|style="color: red;"|}
5800
5801 {|style="color: red;" |}
5802 |foo
5803 |}
5804
5805 {|style="color: red;"|} id="foo"
5806 |foo
5807 |}
5808
5809 {|style="color: red;" |} id="foo"
5810 |foo
5811 |}
5812 !! html
5813 <table style="color: red;"></table>
5814
5815 <table style="color: red;">
5816 <tbody><tr>
5817 <td>foo</td>
5818 </tr></tbody>
5819 </table>
5820
5821 <table style="color: red;" id="foo">
5822 <tbody><tr>
5823 <td>foo</td>
5824 </tr></tbody>
5825 </table>
5826
5827 <table style="color: red;" id="foo">
5828 <tbody><tr>
5829 <td>foo</td>
5830 </tr></tbody>
5831 </table>
5832
5833 !! end
5834
5835 !! test
5836 A table with no data (take 2)
5837 !! wikitext
5838 {|
5839 |}
5840 !! html/parsoid
5841 <table></table>
5842 !! end
5843
5844 # A table with nothing but a caption is invalid XHTML, we might want to render
5845 # this as <p>caption</p>
5846 # Parsoid team replies: table with only a caption is legal in HTML5
5847 !! test
5848 A table with nothing but a caption
5849 !! wikitext
5850 {|
5851 |+ caption
5852 |}
5853 !! html/php
5854 <table>
5855 <caption> caption
5856 </caption><tr><td></td></tr></table>
5857
5858 !! html/parsoid
5859 <table><caption> caption</caption></table>
5860 !! end
5861
5862 !! test
5863 A table with caption with default-spaced attributes and a table row
5864 !! wikitext
5865 {|
5866 |+ style="color: red;" | caption1
5867 |-
5868 | foo
5869 |}
5870 !! html
5871 <table>
5872 <caption style="color: red;"> caption1
5873 </caption>
5874 <tr>
5875 <td> foo
5876 </td></tr></table>
5877
5878 !! end
5879
5880 !! test
5881 A table with captions with non-default spaced attributes and a table row
5882 !! wikitext
5883 {|
5884 |+style="color: red;"|caption2
5885 |+ style="color: red;"| caption3
5886 |-
5887 | foo
5888 |}
5889 !! html
5890 <table>
5891 <caption style="color: red;">caption2
5892 </caption>
5893 <caption style="color: red;"> caption3
5894 </caption>
5895 <tr>
5896 <td> foo
5897 </td></tr></table>
5898
5899 !! end
5900
5901 !! test
5902 Table td-cell syntax variations
5903 !! wikitext
5904 {|
5905 | foo bar foo | baz
5906 | foo bar foo || baz
5907 | style='color:red;' | baz
5908 | style='color:red;' || baz
5909 |}
5910 !! html
5911 <table>
5912 <tr>
5913 <td> baz
5914 </td>
5915 <td> foo bar foo </td>
5916 <td> baz
5917 </td>
5918 <td style="color:red;"> baz
5919 </td>
5920 <td> style='color:red;' </td>
5921 <td> baz
5922 </td></tr></table>
5923
5924 !! end
5925
5926 !! test
5927 Simple table
5928 !! wikitext
5929 {|
5930 | 1 || 2
5931 |-
5932 | 3 || 4
5933 |}
5934 !! html
5935 <table>
5936 <tr>
5937 <td> 1 </td>
5938 <td> 2
5939 </td></tr>
5940 <tr>
5941 <td> 3 </td>
5942 <td> 4
5943 </td></tr></table>
5944
5945 !! end
5946
5947 !! test
5948 Simple table but with multiple dashes for row wikitext
5949 !! wikitext
5950 {|
5951 | foo
5952 |-----
5953 | bar
5954 |}
5955 !! html
5956 <table>
5957 <tr>
5958 <td> foo
5959 </td></tr>
5960 <tr>
5961 <td> bar
5962 </td></tr></table>
5963
5964 !! end
5965
5966 !! test
5967 Multiplication table
5968 !! wikitext
5969 {| border="1" cellpadding="2"
5970 |+Multiplication table
5971 |-
5972 ! &times; !! 1 !! 2 !! 3
5973 |-
5974 ! 1
5975 | 1 || 2 || 3
5976 |-
5977 ! 2
5978 | 2 || 4 || 6
5979 |-
5980 ! 3
5981 | 3 || 6 || 9
5982 |-
5983 ! 4
5984 | 4 || 8 || 12
5985 |-
5986 ! 5
5987 | 5 || 10 || 15
5988 |}
5989 !! html
5990 <table border="1" cellpadding="2">
5991 <caption>Multiplication table
5992 </caption>
5993 <tr>
5994 <th> &#215; </th>
5995 <th> 1 </th>
5996 <th> 2 </th>
5997 <th> 3
5998 </th></tr>
5999 <tr>
6000 <th> 1
6001 </th>
6002 <td> 1 </td>
6003 <td> 2 </td>
6004 <td> 3
6005 </td></tr>
6006 <tr>
6007 <th> 2
6008 </th>
6009 <td> 2 </td>
6010 <td> 4 </td>
6011 <td> 6
6012 </td></tr>
6013 <tr>
6014 <th> 3
6015 </th>
6016 <td> 3 </td>
6017 <td> 6 </td>
6018 <td> 9
6019 </td></tr>
6020 <tr>
6021 <th> 4
6022 </th>
6023 <td> 4 </td>
6024 <td> 8 </td>
6025 <td> 12
6026 </td></tr>
6027 <tr>
6028 <th> 5
6029 </th>
6030 <td> 5 </td>
6031 <td> 10 </td>
6032 <td> 15
6033 </td></tr></table>
6034
6035 !! end
6036
6037 !! test
6038 Accept "||" in table headings
6039 !! wikitext
6040 {|
6041 !h1 || h2
6042 |}
6043 !! html
6044 <table>
6045 <tr>
6046 <th>h1 </th>
6047 <th> h2
6048 </th></tr></table>
6049
6050 !! end
6051
6052 !! test
6053 Accept "!!" in table data
6054 !! wikitext
6055 {|
6056 | Foo!! ||
6057 |}
6058 !! html
6059 <table>
6060 <tr>
6061 <td> Foo!! </td>
6062 <td>
6063 </td></tr></table>
6064
6065 !! html/parsoid
6066 <table>
6067 <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>
6068 </tbody></table>
6069 !! end
6070
6071 !! test
6072 Accept "||" in indented table headings
6073 !! wikitext
6074 :{|
6075 !h1 || h2
6076 |}
6077 !! html
6078 <dl><dd><table>
6079 <tr>
6080 <th>h1 </th>
6081 <th> h2
6082 </th></tr></table></dd></dl>
6083
6084 !! end
6085
6086 !! test
6087 Accept "!!" in templates
6088 !! wikitext
6089 {|
6090 !a {{echo|b!!c}}
6091 |}
6092 !! html/php
6093 <table>
6094 <tr>
6095 <th>a b</th>
6096 <th>c
6097 </th></tr></table>
6098
6099 !! html/parsoid
6100 <table>
6101 <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>
6102 !! end
6103
6104 !! test
6105 Accept "!!" in table headings after newline
6106 !! wikitext
6107 {|
6108 !a
6109 b!!c
6110 |}
6111 !! html/php
6112 <table>
6113 <tr>
6114 <th>a
6115 <p>b!!c
6116 </p>
6117 </th></tr></table>
6118
6119 !! html/parsoid
6120 <table>
6121 <tbody><tr><th>a
6122 <p>b!!c</p></th></tr>
6123 </tbody></table>
6124 !! end
6125
6126 !! test
6127 Accept "!!" in table data of mixed wikitext / html syntax
6128 !! wikitext
6129 {|
6130 !a
6131 <tr><td>b!!c</td></tr>
6132 |}
6133 !! html+tidy
6134 <table>
6135 <tr>
6136 <th>a</th>
6137 </tr>
6138 <tr>
6139 <td>b!!c</td>
6140 </tr>
6141 </table>
6142 !! html/parsoid
6143 <table>
6144 <tbody><tr><th>a</th></tr>
6145 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6146 </tbody></table>
6147 !! end
6148
6149 !! test
6150 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6151 !! wikitext
6152 {|
6153 !| h1
6154 || a
6155 |}
6156 !! html
6157 <table>
6158 <tr>
6159 <th> h1
6160 </th>
6161 <td> a
6162 </td></tr></table>
6163
6164 !! end
6165
6166 !!test
6167 Accept "| !" at start of line in tables (ignore !-attribute)
6168 !! wikitext
6169 {|
6170 |-
6171 | !style="color:red" | bar
6172 |}
6173 !! html
6174 <table>
6175
6176 <tr>
6177 <td> bar
6178 </td></tr></table>
6179
6180 !!end
6181
6182 !!test
6183 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 +/-
6184 !! wikitext
6185 {|
6186 |-
6187 |style='color:red;'|+1
6188 |style='color:blue;'|-1
6189 |-
6190 | 1 || 2 || 3
6191 | 1 ||+2 ||-3
6192 |-
6193 | +1
6194 | -1
6195 |}
6196 !! html
6197 <table>
6198
6199 <tr>
6200 <td style="color:red;">+1
6201 </td>
6202 <td style="color:blue;">-1
6203 </td></tr>
6204 <tr>
6205 <td> 1 </td>
6206 <td> 2 </td>
6207 <td> 3
6208 </td>
6209 <td> 1 </td>
6210 <td>+2 </td>
6211 <td>-3
6212 </td></tr>
6213 <tr>
6214 <td> +1
6215 </td>
6216 <td> -1
6217 </td></tr></table>
6218
6219 !!end
6220
6221 !! test
6222 Table rowspan
6223 !! wikitext
6224 {| border=1
6225 | Cell 1, row 1
6226 |rowspan=2| Cell 2, row 1 (and 2)
6227 | Cell 3, row 1
6228 |-
6229 | Cell 1, row 2
6230 | Cell 3, row 2
6231 |}
6232 !! html
6233 <table border="1">
6234 <tr>
6235 <td> Cell 1, row 1
6236 </td>
6237 <td rowspan="2"> Cell 2, row 1 (and 2)
6238 </td>
6239 <td> Cell 3, row 1
6240 </td></tr>
6241 <tr>
6242 <td> Cell 1, row 2
6243 </td>
6244 <td> Cell 3, row 2
6245 </td></tr></table>
6246
6247 !! end
6248
6249 !! test
6250 Nested table
6251 !! wikitext
6252 {| border=1
6253 | &alpha;
6254 |
6255 {| bgcolor=#ABCDEF border=2
6256 |nested
6257 |-
6258 |table
6259 |}
6260 |the original table again
6261 |}
6262 !! html
6263 <table border="1">
6264 <tr>
6265 <td> &#945;
6266 </td>
6267 <td>
6268 <table bgcolor="#ABCDEF" border="2">
6269 <tr>
6270 <td>nested
6271 </td></tr>
6272 <tr>
6273 <td>table
6274 </td></tr></table>
6275 </td>
6276 <td>the original table again
6277 </td></tr></table>
6278
6279 !! end
6280
6281 !! test
6282 Invalid attributes in table cell (bug 1830)
6283 !! wikitext
6284 {|
6285 |Cell:|broken
6286 |}
6287 !! html
6288 <table>
6289 <tr>
6290 <td>broken
6291 </td></tr></table>
6292
6293 !! end
6294
6295 !! test
6296 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6297 !! wikitext
6298 {|
6299 | title="foo" |bar
6300 | title="foo<nowiki>|</nowiki>" |bar
6301 | title="foo<nowiki>|</nowiki>" bar
6302 |}
6303 !! html/php
6304 <table>
6305 <tr>
6306 <td title="foo">bar
6307 </td>
6308 <td title="foo&#124;">bar
6309 </td>
6310 <td> title="foo|" bar
6311 </td></tr></table>
6312
6313 !! html/parsoid
6314 <table>
6315 <tbody><tr><td title="foo">bar</td>
6316 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6317 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6318 </tbody></table>
6319 !! end
6320
6321 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6322 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6323 # *2wt modes will fail.
6324 !! test
6325 Table security: embedded pipes
6326 !! options
6327 parsoid=wt2html,html2html
6328 !! wikitext
6329 {|
6330 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6331 !! html/php
6332 <table>
6333 <tr>
6334 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6335 <td>]" onmouseover="alert(document.cookie)"&gt;test
6336 </td>
6337 </tr>
6338 </table>
6339
6340 !! html/parsoid
6341 <table><tbody>
6342 <tr>
6343 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6344 !! end
6345
6346 !! test
6347 Element attributes with double ! should not be broken up by <th>
6348 !! wikitext
6349 {|
6350 ! hi <div class="!!">ha</div> ho
6351 |}
6352 !! html/php
6353 <table>
6354 <tr>
6355 <th> hi <div class="!!">ha</div> ho
6356 </th></tr></table>
6357
6358 !! html/parsoid
6359 <table>
6360 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6361 </tbody></table>
6362 !! end
6363
6364 !! test
6365 ! and || in element attributes should not be parsed as <th>/<td>
6366 !! wikitext
6367 {|
6368 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6369 |}
6370 !! html/php
6371 <table>
6372 <tr>
6373 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6374 </td></tr></table>
6375
6376 !! html/parsoid
6377 <table>
6378 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6379 </tbody></table>
6380 !! end
6381
6382 # FIXME: The output seems broken. Filed as T110268.
6383 !! test
6384 ! and || in td attributes should not be parsed as <th>/<td>
6385 !! options
6386 parsoid=wt2html
6387 !! wikitext
6388 {|
6389 | style="color: red !important;" data-contrived="put this here ||" | foo
6390 |}
6391 !! html/php
6392 <table>
6393 <tr>
6394 <td> style="color: red !important;" data-contrived="put this here </td>
6395 <td> foo
6396 </td></tr></table>
6397
6398 !! html/parsoid
6399 <table>
6400 <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>
6401 </tbody></table>
6402 !! end
6403
6404 !! test
6405 Break on | in element attribute in template
6406 !! options
6407 parsoid=wt2html,html2html
6408 !! wikitext
6409 {{echo|1=<div class="hi|ho">ha</div>}}
6410 !! html/php
6411 <p>ho"&gt;ha&lt;/div&gt;
6412 </p>
6413 !! html/parsoid
6414 <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>
6415 !! end
6416
6417 ## We don't support roundtripping of these attributes in Parsoid.
6418 ## Selective serialization takes care of preventing dirty diffs.
6419 ## But, on edits, we dirty-diff the invalid attribute text.
6420 !! test
6421 Invalid text in table attributes should be discarded
6422 !! options
6423 parsoid=wt2html
6424 !! wikitext
6425 {| <span>boo</span> style='border:1px solid black'
6426 | <span>boo</span> style='color:blue' | 1
6427 |<span>boo</span> style='color:blue'| 2
6428 |}
6429 !! html/php
6430 <table style="border:1px solid black">
6431 <tr>
6432 <td style="color:blue"> 1
6433 </td>
6434 <td style="color:blue"> 2
6435 </td></tr></table>
6436
6437 !! html/parsoid
6438 <table style="border:1px solid black">
6439 <tr>
6440 <td style="color:blue"> 1</td>
6441 <td style="color:blue"> 2</td>
6442 </tr>
6443 </table>
6444 !! end
6445
6446 !! test
6447 Invalid text in table attributes should be preserved by selective serializer
6448 !! options
6449 parsoid={
6450 "modes": ["selser"],
6451 "changes": [
6452 ["td:first-child", "text", "abc"],
6453 ["td + td", "text", "xyz"]
6454 ]
6455 }
6456 !! wikitext
6457 {| <span>boo</span> style='border:1px solid black'
6458 | <span>boo</span> style='color:blue' | 1
6459 |<span>boo</span> style='color:blue'| 2
6460 |}
6461 !! wikitext/edited
6462 {| <span>boo</span> style='border:1px solid black'
6463 | <span>boo</span> style='color:blue' |abc
6464 |<span>boo</span> style='color:blue'|xyz
6465 |}
6466 !! end
6467
6468 !! test
6469 1. Template-generated table cell attributes and cell content
6470 !! wikitext
6471 {|
6472 |{{table_attribs}}
6473 | {{table_attribs}}
6474 || {{table_attribs_5}}
6475 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6476 |align=center {{table_attribs}}
6477 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6478 |}
6479 !! html
6480 <table>
6481 <tr>
6482 <td style="color:red;">Foo
6483 </td>
6484 <td style="color:red;">Foo
6485 </td>
6486 <td> style="color:red;"</td>
6487 <td>Bar
6488 </td>
6489 <td style="color:red;">Foo
6490 </td>
6491 <td align="center" style="color:red;">Foo
6492 </td>
6493 <td align="center" style="color:red;">Foo
6494 </td></tr></table>
6495
6496 !! end
6497
6498 !! test
6499 2. Template-generated table cell attributes and cell content
6500 !! wikitext
6501 {|
6502 |{{table_attribs_2}}
6503 |}
6504 !! html/php
6505 <table>
6506 <tr>
6507 <td style="color:red;">Foo
6508 </td>
6509 <td>Bar</td>
6510 <td>Baz
6511 </td></tr></table>
6512
6513 !! html/parsoid
6514 <table>
6515 <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>
6516 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6517 </tbody></table>
6518 !! end
6519
6520 !! test
6521 3. Template-generated table cell attributes and cell content
6522 !! wikitext
6523 {|
6524 !align=center {{table_header_cells}}
6525 |-
6526 |align=center {{table_cells}}
6527 |}
6528 !! html/php
6529 <table>
6530 <tr>
6531 <th align="center" style="color:red;">Foo</th>
6532 <th style="color:red;"><i>Bar</i></th>
6533 <th style="color:brown;"><i>Foo</i> and Baz
6534 </th></tr>
6535 <tr>
6536 <td align="center" style="color:red;">Foo</td>
6537 <td style="color:red;"><i>Bar</i></td>
6538 <td style="color:brown;"><i>Foo</i> and Baz
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <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>
6544 <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>
6545 </tbody></table>
6546 !! end
6547
6548 !! test
6549 4. Template-generated table cell attributes and cell content inside a templated table
6550 !! wikitext
6551 {{tbl-start}}
6552 !align=center {{table_header_cells}}
6553 |-
6554 |align=center {{table_cells}}
6555 {{tbl-end}}
6556 !! html/php
6557 <table>
6558 <tr>
6559 <th align="center" style="color:red;">Foo</th>
6560 <th style="color:red;"><i>Bar</i></th>
6561 <th style="color:brown;"><i>Foo</i> and Baz
6562 </th></tr>
6563 <tr>
6564 <td align="center" style="color:red;">Foo</td>
6565 <td style="color:red;"><i>Bar</i></td>
6566 <td style="color:brown;"><i>Foo</i> and Baz
6567 </td></tr></table>
6568
6569 !! html/parsoid
6570 <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}}]}'>
6571 <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>
6572 <tr>
6573 <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>
6574 </tbody></table>
6575 !! end
6576
6577 ## Edge case fix to prevent future regressions
6578 !! test
6579 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6580 !! wikitext
6581 {|
6582 |{{table_attribs_7}}
6583 |}
6584 <references />
6585 !! html/parsoid
6586 <table>
6587 <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>
6588 </tbody></table>
6589 <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>
6590 !! end
6591
6592 !! test
6593 Table with row followed by newlines and table heading
6594 !! options
6595 parsoid=wt2html,html2html
6596 !! wikitext
6597 {|
6598 |-
6599
6600 ! foo
6601 |}
6602 !! html/*
6603 <table>
6604
6605
6606 <tr>
6607 <th> foo
6608 </th></tr></table>
6609
6610 !! end
6611
6612 !! test
6613 Table with empty line following the start tag
6614 !! options
6615 parsoid=wt2html,html2html
6616 !! wikitext
6617 {|
6618
6619 |-
6620 | foo
6621 |}
6622 !! html/*
6623 <table>
6624
6625
6626 <tr>
6627 <td> foo
6628 </td></tr></table>
6629
6630 !! end
6631
6632 !! test
6633 Table attributes with empty value
6634 !! options
6635 parsoid=wt2html,html2html
6636 !! wikitext
6637 {|
6638 | style=| hello
6639 |}
6640 !! html/php
6641 <table>
6642 <tr>
6643 <td style=""> hello
6644 </td></tr></table>
6645
6646 !! html/parsoid
6647 <table>
6648 <tbody><tr><td style=""> hello</td></tr>
6649 </tbody></table>
6650 !! end
6651
6652 !! test
6653 Wikitext table with a lot of comments
6654 !! wikitext
6655 {|
6656 <!-- c0 -->
6657 | foo
6658 <!-- c1 -->
6659 |-<!-- c2 -->
6660 <!-- c3 -->
6661 |<!-- c4 -->
6662 <!-- c5 -->
6663 |}
6664 !! html
6665 <table>
6666 <tr>
6667 <td> foo
6668 </td></tr>
6669 <tr>
6670 <td>
6671 </td></tr></table>
6672
6673 !! end
6674
6675 !! test
6676 Wikitext table comments represented in parsoid dom
6677 !! wikitext
6678 {|<!--c1--><!--c2-->
6679 |-<!--c3-->
6680 | x
6681 |}
6682 !! html/php+tidy
6683 <table>
6684 <tr>
6685 <td>x</td>
6686 </tr>
6687 </table>
6688 !! html/parsoid
6689 <table><!--c1--><!--c2-->
6690 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6691 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6692 </tbody></table>
6693 !! end
6694
6695 !! test
6696 Wikitext table with double-line table cell
6697 !! wikitext
6698 {|
6699 |a
6700 b
6701 |}
6702 !! html
6703 <table>
6704 <tr>
6705 <td>a
6706 <p>b
6707 </p>
6708 </td></tr></table>
6709
6710 !! end
6711
6712 !! test
6713 Table cell with a single comment
6714 !! wikitext
6715 {|
6716 | <!-- c1 -->
6717 | a
6718 |}
6719 !! html
6720 <table>
6721 <tr>
6722 <td>
6723 </td>
6724 <td> a
6725 </td></tr></table>
6726
6727 !! end
6728
6729 !! test
6730 Table-cell after a comment-only-empty-line
6731 !! wikitext
6732 {|
6733 |a
6734 <!--c1-->
6735 <!--c2-->| b
6736 |}
6737 !! html
6738 <table>
6739 <tr>
6740 <td>a
6741 </td>
6742 <td> b
6743 </td></tr></table>
6744
6745 !! html/parsoid
6746 <table>
6747 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6748 <!--c1-->
6749 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6750 </tbody></table>
6751
6752 !! end
6753
6754 !! test
6755 Build table with {{!}}
6756 !! wikitext
6757 {{{!}} class="wikitable"
6758 ! header
6759 ! second header
6760 {{!}}- style="color:red;"
6761 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6762 {{!}}}
6763 !! html
6764 <table class="wikitable">
6765 <tr>
6766 <th> header
6767 </th>
6768 <th> second header
6769 </th></tr>
6770 <tr style="color:red;">
6771 <td> data </td>
6772 <td style="color:red;"> second data
6773 </td></tr></table>
6774
6775 !! end
6776
6777 !! test
6778 Build table with pipe as data
6779 !! wikitext
6780 {| class="wikitable"
6781 ! header
6782 ! second header
6783 |- style="color:red;"
6784 | data || style="color:red;" | second data
6785 |-
6786 | style="color:red;" | data with | || style="color:red;" | second data with |
6787 |-
6788 || data with | ||| second data with |
6789 |}
6790 !! html
6791 <table class="wikitable">
6792 <tr>
6793 <th> header
6794 </th>
6795 <th> second header
6796 </th></tr>
6797 <tr style="color:red;">
6798 <td> data </td>
6799 <td style="color:red;"> second data
6800 </td></tr>
6801 <tr>
6802 <td style="color:red;"> data with | </td>
6803 <td style="color:red;"> second data with |
6804 </td></tr>
6805 <tr>
6806 <td> data with | </td>
6807 <td> second data with |
6808 </td></tr></table>
6809
6810 !! end
6811
6812 !! test
6813 Build table with wikilink
6814 !! wikitext
6815 {| class="wikitable"
6816 ! header || second header
6817 |- style="color:red;"
6818 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6819 |-
6820 | data || second data [[Main Page|link|text with pipe]]
6821 |}
6822 !! html
6823 <table class="wikitable">
6824 <tr>
6825 <th> header </th>
6826 <th> second header
6827 </th></tr>
6828 <tr style="color:red;">
6829 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6830 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6831 </td></tr>
6832 <tr>
6833 <td> data </td>
6834 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6835 </td></tr></table>
6836
6837 !! end
6838
6839 # The expected HTML structure in this test is debatable. The PHP parser does
6840 # not parse this kind of table at all. The main focus for Parsoid is on
6841 # round-tripping, so this output is ok for now. TODO: revisit!
6842 !! test
6843 Wikitext table with html-syntax row
6844 !! wikitext
6845 {|
6846 |-
6847 <td>foo</td>
6848 |}
6849 !! html/parsoid
6850 <table>
6851 <tbody>
6852 <tr>
6853 <td>foo</td></tr></tbody></table>
6854 !! end
6855
6856 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6857 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6858 ## PHP parser, which tidy then compounds by fostering the content
6859 ## entirely out of the table. Parsoid recognizes the table context
6860 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6861 ## depends on PHP's treatment of broken table markup!
6862 !! test
6863 Implicit <td> after a |-
6864 !! options
6865 parsoid=wt2html,html2html
6866 !! wikitext
6867 {|
6868 |-
6869 a
6870 |}
6871 !! html/php
6872 <table>
6873
6874 a
6875 </table>
6876
6877 !! html/php+tidy
6878 <p>a</p>
6879 !! html/parsoid
6880 <table>
6881 <tr><td>a</td></tr>
6882 </table>
6883 !! end
6884
6885 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6886 !! test
6887 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6888 !! options
6889 parsoid=wt2html,html2html
6890 !! wikitext
6891 {|
6892 |-
6893 |
6894 a
6895 |-
6896 b
6897 |}
6898 !! html/php
6899 <table>
6900
6901 <tr>
6902 <td>
6903 <pre>a
6904 </pre>
6905 </td></tr>
6906 b
6907 </table>
6908
6909 !! html/php+tidy
6910 <p>b</p>
6911 <table>
6912 <tr>
6913 <td>
6914 <pre>
6915 a
6916 </pre></td>
6917 </tr>
6918 </table>
6919 !! html/parsoid
6920 <table>
6921 <tbody>
6922 <tr><td><pre>a</pre></td></tr>
6923 <tr><td> b</td></tr>
6924 </tbody>
6925 </table>
6926 !! end
6927
6928 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6929 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6930 !! test
6931 Lists should be recognized in an implicit <td> context
6932 !! options
6933 parsoid=wt2html,html2html
6934 !! wikitext
6935 {|
6936 |-
6937 *a
6938 |}
6939 !! html/php
6940 <table>
6941
6942 <ul><li>a</li></ul>
6943 </table>
6944
6945 !! html/php+tidy
6946 <ul>
6947 <li>a</li>
6948 </ul>
6949 !! html/parsoid
6950 <table>
6951 <tr>
6952 <td><ul>
6953 <li>a</li>
6954 </ul></td>
6955 </tr>
6956 </table>
6957 !! end
6958
6959 !! test
6960 Table cells not properly parsed in an implicit-td context
6961 !! wikitext
6962 {|
6963 |-
6964 {{table_attribs_4}} || a || b
6965 |}
6966 !! html/php+tidy
6967 <table>
6968 <tr>
6969 <td style="background-color:#DC241f;" width="10px"></td>
6970 <td>a</td>
6971 <td>b</td>
6972 </tr>
6973 </table>
6974 !! html/parsoid
6975 <table>
6976 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6977 <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>
6978 </tbody></table>
6979 !! end
6980
6981 !! test
6982 Parsoid: Round-trip tables directly followed by content (bug 51219)
6983 !! options
6984 parsoid=wt2html,wt2wt
6985 !! wikitext
6986 {|
6987 |foo
6988 |} bar
6989
6990 {|
6991 |baz
6992 |}<b>quux</b>
6993 !! html+tidy
6994 <table>
6995 <tr>
6996 <td>foo</td>
6997 </tr>
6998 </table>
6999 <p>bar</p>
7000 <table>
7001 <tr>
7002 <td>baz</td>
7003 </tr>
7004 </table>
7005 <p><b>quux</b></p>
7006 !! end
7007
7008 !! test
7009 Parsoid: Default to a newline after tables in new content (bug 51219)
7010 !! options
7011 parsoid=html2wt
7012 !! html/parsoid
7013 <table><tbody>
7014 <tr><td>foo</td></tr></tbody></table> bar
7015 <table><tbody>
7016 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7017 !! wikitext
7018 {|
7019 |foo
7020 |}
7021 <nowiki> </nowiki>bar
7022 {|
7023 |baz
7024 |}
7025 '''quux'''
7026 !! end
7027
7028 !! test
7029 Parsoid: newline inducing block nodes don't suppress <nowiki>
7030 !! options
7031 parsoid=html2wt
7032 !! html/parsoid
7033 a<h1>foo</h1>
7034 !! wikitext
7035 <nowiki> </nowiki>a
7036
7037 = foo =
7038 !! end
7039
7040 !! test
7041 Parsoid: Row-syntax table headings followed by comment & table cells
7042 !! options
7043 parsoid=wt2html,wt2wt
7044 !! wikitext
7045 {|
7046 ! foo || bar
7047 <!-- foo --> || baz || quux
7048 |}
7049 !! html/php
7050 <table>
7051 <tr>
7052 <th> foo </th>
7053 <th> bar
7054 </th>
7055 <td> baz </td>
7056 <td> quux
7057 </td></tr></table>
7058
7059 !! html/parsoid
7060 <table>
7061 <tbody><tr><th> foo </th><th> bar
7062 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7063 </tbody></table>
7064 !! end
7065
7066 !!test
7067 Parsoid: Recover better from broken table attributes
7068 !!options
7069 parsoid=wt2html
7070 !!wikitext
7071 {| class="foo
7072 | class="bar" |
7073 foo
7074 |}
7075 !!html/php+tidy
7076 <table class="foo">
7077 <tr>
7078 <td class="bar">
7079 <p>foo</p>
7080 </td>
7081 </tr>
7082 </table>
7083 !!html/parsoid
7084 <table class="foo">
7085 <tr>
7086 <td class="bar">
7087 <p>foo</p></td></tr>
7088 </tbody></table>
7089 !!end
7090
7091 !! test
7092 Tables: Digest broken attributes on table and tr tag
7093 !! options
7094 parsoid=wt2html
7095 !! wikitext
7096 {| || |} ++
7097 |- || || ++ --
7098 |- > [
7099 |}
7100 !! html
7101 <table>
7102 <tbody>
7103 <tr></tr>
7104 <tr></tr>
7105 </tbody></table>
7106 !! end
7107
7108 # T137406: Whitespace in the HTML
7109 !! test
7110 1. Generate correct wikitext for tables with thead/tbody/tfoot
7111 !! options
7112 parsoid=html2wt
7113 !! html/parsoid
7114 <table>
7115 <caption>Test</caption>
7116 <thead>
7117 <tr>
7118 <th>Month</th>
7119 <th>Savings</th>
7120 </tr>
7121 </thead>
7122 <tbody>
7123 <tr>
7124 <td>January</td>
7125 <td>$100</td>
7126 </tr>
7127 <tr>
7128 <td>February</td>
7129 <td>$80</td>
7130 </tr>
7131 </tbody>
7132 <tfoot>
7133 <tr>
7134 <td>Sum</td>
7135 <td>$180</td>
7136 </tr>
7137 </tfoot>
7138 </table>
7139 !! wikitext
7140 {|
7141 |+Test
7142 !Month
7143 !Savings
7144 |-
7145 |January
7146 |$100
7147 |-
7148 |February
7149 |$80
7150 |-
7151 |Sum
7152 |$180
7153 |}
7154 !! html/php+tidy
7155 <table>
7156 <caption>Test</caption>
7157 <tr>
7158 <th>Month</th>
7159 <th>Savings</th>
7160 </tr>
7161 <tr>
7162 <td>January</td>
7163 <td>$100</td>
7164 </tr>
7165 <tr>
7166 <td>February</td>
7167 <td>$80</td>
7168 </tr>
7169 <tr>
7170 <td>Sum</td>
7171 <td>$180</td>
7172 </tr>
7173 </table>
7174 !! end
7175
7176 # T137406: No whitespace in the HTML
7177 !! test
7178 2. Generate correct wikitext for tables with thead/tbody/tfoot
7179 !! options
7180 parsoid=html2wt
7181 !! html/parsoid
7182 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7183 !! wikitext
7184 {|
7185 !heading
7186 |-
7187 |foo
7188 |}
7189 !! end
7190
7191 !! test
7192 Testing serialization after deletion in references
7193 !! options
7194 parsoid={
7195 "modes": ["wt2wt"],
7196 "changes": [
7197 ["#x", "remove"]
7198 ]
7199 }
7200 !! wikitext
7201 hi <ref><div id="x">ho</div></ref>
7202
7203 <references />
7204 !! wikitext/edited
7205 hi <ref></ref>
7206
7207 <references />
7208 !! end
7209
7210 !!test
7211 Testing serialization after deletion of table cells
7212 !!options
7213 parsoid={
7214 "modes": ["wt2wt", "selser"],
7215 "changes": [
7216 ["#x", "remove"]
7217 ]
7218 }
7219 !!wikitext
7220 {|
7221 !h1 !!h2 !!h3
7222 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7223 |}
7224 !! wikitext/edited
7225 {|
7226 !h1 !!h2 !!h3
7227 |c2 |||c3
7228 |}
7229 !!end
7230
7231 !! test
7232 Testing selser after addition of new row before first row (T125419)
7233 !! options
7234 parsoid={
7235 "modes": ["wt2wt", "selser"],
7236 "changes": [
7237 [ "tr", "before", "<tr><td>X</td></tr>" ]
7238 ]
7239 }
7240 !! wikitext
7241 {|
7242 |a
7243 |}
7244 !! wikitext/edited
7245 {|
7246 |X
7247 |-
7248 |a
7249 |}
7250 !! end
7251
7252 !! test
7253 Serialize new table rows in a HTML table using HTML tags
7254 !! options
7255 parsoid={
7256 "modes": ["wt2wt", "selser"],
7257 "changes": [
7258 [ "tr", "before", "<tr><td>X</td></tr>" ]
7259 ]
7260 }
7261 !! wikitext
7262 <table><tr><td>a</td></tr></table>
7263 !! wikitext/edited
7264 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7265 !! end
7266
7267 !! test
7268 Serialize new table cells in a HTML row using HTML tags
7269 !! options
7270 parsoid={
7271 "modes": ["wt2wt", "selser"],
7272 "changes": [
7273 [ "td", "before", "<td>X</td>" ]
7274 ]
7275 }
7276 !! wikitext
7277 <table><tr><td>a</td></tr></table>
7278 !! wikitext/edited
7279 <table><tr><td>X</td><td>a</td></tr></table>
7280 !! end
7281
7282 !! test
7283 Wikitext tables can be nested inside HTML tables
7284 !! options
7285 parsoid=html2wt
7286 !! html
7287 <table data-parsoid='{"stx":"html"}'>
7288 <tr><td>
7289 <table>
7290 <tr><td>foo</td></tr>
7291 </table>
7292 </td></tr>
7293 </table>
7294 !! wikitext
7295 <table>
7296 <tr><td>
7297 {|
7298 |foo
7299 |}
7300 </td></tr>
7301 </table>
7302 !! end
7303
7304 !! test
7305 Serialize wikitext list items as HTML list items when embedded in a HTML list
7306 !! options
7307 parsoid=html2wt
7308 !! html
7309 <ul data-parsoid='{"stx": "html"}'>
7310 <li data-parsoid='{}'>a</li>
7311 <li>b</li>
7312 </ul>
7313 !! wikitext
7314 <ul>
7315 <li>a</li>
7316 <li>b</li>
7317 </ul>
7318 !! end
7319
7320 # SSS FIXME: Is this actually a good thing given the
7321 # odd nested list output that is generated by MW?
7322 # <ul><li>foo<ul>..</ul></li></ul> instead of
7323 # <ul><li>foo</li><ul>..</ul></ul>
7324 !! test
7325 Wikitext lists can be nested inside HTML lists
7326 !! options
7327 parsoid=html2wt
7328 !! html
7329 <ul data-parsoid='{"stx": "html"}'>
7330 <li data-parsoid='{"stx": "html"}'>a
7331 <ul><li>b</li></ul>
7332 </li>
7333 </ul>
7334
7335 <ul data-parsoid='{"stx": "html"}'>
7336 <li>x
7337 <ul><li>y</li></ul>
7338 </li>
7339 </ul>
7340 !! wikitext
7341 <ul>
7342 <li>a
7343 * b
7344 </li>
7345 </ul>
7346
7347 <ul>
7348 <li>x
7349 * y
7350 </li>
7351 </ul>
7352 !! end
7353
7354 ###
7355 ### Internal links
7356 ###
7357 !! test
7358 Plain link, capitalized
7359 !! wikitext
7360 [[Main Page]]
7361 !! html
7362 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7363 </p>
7364 !! end
7365
7366 !! test
7367 Plain link, uncapitalized
7368 !! wikitext
7369 [[main Page]]
7370 !! html
7371 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7372 </p>
7373 !! end
7374
7375 !! test
7376 Piped link
7377 !! wikitext
7378 [[Main Page|The Main Page]]
7379 !! html
7380 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7381 </p>
7382 !! end
7383
7384 !! test
7385 Piped link with comment in link text
7386 !! wikitext
7387 [[Main Page|The Main<!--front--> Page]]
7388 !! html
7389 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7390 </p>
7391 !! end
7392
7393 !! test
7394 Piped link with multiple pipe characters in link text
7395 !! wikitext
7396 [[Main Page||The|Main|Page|]]
7397 !! html/php
7398 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7399 </p>
7400 !! html/parsoid
7401 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7402 !! end
7403
7404 !! test
7405 Piped link with no link text
7406 !! wikitext
7407 [[Thomas Bek (bishop of St David's)|]]
7408 !! html/php
7409 <p>[[Thomas Bek (bishop of St David's)|]]
7410 </p>
7411 !! html/parsoid
7412 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7413 !! end
7414
7415 !! test
7416 Broken link
7417 !! wikitext
7418 [[Zigzagzogzagzig]]
7419 !! html
7420 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7421 </p>
7422 !! end
7423
7424 !! test
7425 Broken link with fragment
7426 !! wikitext
7427 [[Zigzagzogzagzig#zug]]
7428 !! html
7429 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7430 </p>
7431 !! end
7432
7433 !! test
7434 Special page link with fragment
7435 !! wikitext
7436 [[Special:Version#anchor]]
7437 !! html
7438 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7439 </p>
7440 !! end
7441
7442 !! test
7443 Nonexistent special page link with fragment
7444 !! wikitext
7445 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7446 !! html
7447 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7448 </p>
7449 !! end
7450
7451 !! test
7452 Link with prefix
7453 !! wikitext
7454 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7455 !! html
7456 <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>
7457 </p>
7458 !! end
7459
7460 !! test
7461 Link with suffix
7462 !! wikitext
7463 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7464 !! html
7465 <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>!!!
7466 </p>
7467 !! end
7468
7469 !! article
7470 prefixed article
7471 !! text
7472 Some text
7473 !! endarticle
7474
7475 !! test
7476 Bug 43661: Piped links with identical prefixes
7477 !! wikitext
7478 [[prefixed article|prefixed articles with spaces]]
7479
7480 [[prefixed article|prefixed articlesaoeu]]
7481
7482 [[Main Page|Main Page test]]
7483 !! html
7484 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7485 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7486 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7487 </p>
7488 !! end
7489
7490
7491 !! test
7492 Link with HTML entity in suffix / tail
7493 !! wikitext
7494 [[Main Page]]&quot;, [[Main Page]]&#97;
7495 !! html/php
7496 <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;
7497 </p>
7498 !! html/parsoid
7499 <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>
7500 !! end
7501
7502 !! test
7503 Link with 3 brackets
7504 !! wikitext
7505 [[[Main Page]]]
7506 Foo [[[Main Page]]]
7507 !! html
7508 <p>[[[Main Page]]]
7509 Foo [[[Main Page]]]
7510 </p>
7511 !! end
7512
7513 !! test
7514 Link with 4 brackets
7515 !! wikitext
7516 [[[[Main Page]]]]
7517 !! html
7518 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7519 </p>
7520 !! end
7521
7522 !! test
7523 Piped link with 3 brackets
7524 !! wikitext
7525 [[[main page|the main page]]]
7526 !! html
7527 <p>[[[main page|the main page]]]
7528 </p>
7529 !! end
7530
7531 !! test
7532 Piped link with extlink-like text
7533 !! wikitext
7534 [[Main Page|[bar]]]
7535 [[Main Page|This is a [bar]]]
7536 !! html/php
7537 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7538 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7539 </p>
7540 !! html/parsoid
7541 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7542 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7543 !! end
7544
7545 !! test
7546 Link with multiple pipes
7547 !! wikitext
7548 [[Main Page|The|Main|Page]]
7549 !! html
7550 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7551 </p>
7552 !! end
7553
7554 # Note that parsoid does not munge anchor text; all non-space
7555 # characters are valid in HTML5 ids.
7556 !! test
7557 Anchor containing a #. (bug 63430)
7558 !! wikitext
7559 [[Main Page#And#Link]]
7560 !! html/php
7561 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7562 </p>
7563 !! html/parsoid
7564 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7565 !! end
7566
7567 !! test
7568 Link to namespaces
7569 !! wikitext
7570 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7571 !! html
7572 <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>
7573 </p>
7574 !! end
7575
7576 !! test
7577 Link with space in namespace
7578 !! wikitext
7579 [[User talk:Foo bar]]
7580 !! html
7581 <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>
7582 </p>
7583 !! end
7584
7585 !! article
7586 MemoryAlpha:AlphaTest
7587 !! text
7588 This is an article in the MemoryAlpha namespace
7589 (which shadows the memoryalpha interwiki link).
7590 !! endarticle
7591
7592 !! test
7593 Namespace takes precedence over interwiki link (bug 51680)
7594 !! wikitext
7595 [[MemoryAlpha:AlphaTest]]
7596 !! html
7597 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7598 </p>
7599 !! end
7600
7601 # The previous test doesn't work correctly in html2*, due to not recognizing the
7602 # link as an internal one. This one checks for the correct behavior.
7603 !! test
7604 Link to namespace preferred over interwiki with correct rel attribute
7605 !! options
7606 parsoid=html2wt,html2html
7607 !! html/parsoid
7608 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7609 !! wikitext
7610 [[MemoryAlpha:AlphaTest]]
7611 !! end
7612
7613 !! test
7614 Piped link to namespace
7615 !! wikitext
7616 [[Meta:Disclaimers|The disclaimers]]
7617 !! html
7618 <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>
7619 </p>
7620 !! end
7621
7622 !! test
7623 Link containing }
7624 !! wikitext
7625 [[Usually caused by a typo (oops}]]
7626 !! html
7627 <p>[[Usually caused by a typo (oops}]]
7628 </p>
7629 !! end
7630
7631 !! article
7632 7% Solution
7633 !! text
7634 Just a test of an article title containing a percent.
7635 !! endarticle
7636
7637 !! test
7638 Link containing % (not as a hex sequence)
7639 !! wikitext
7640 [[7% Solution]]
7641 [[7% Solution|7%25 Solution]]
7642 !! html/php
7643 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7644 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7645 </p>
7646 !! html/parsoid
7647 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7648 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7649 !! end
7650
7651 # note that the parsoid HTML is identical to the previous test output,
7652 # so the previous test ensures that the html2wt mode will generate the
7653 # "not as a hex sequence" wikitext.
7654 !! test
7655 Link containing % as a single hex sequence interpreted to char
7656 !! options
7657 parsoid=wt2wt,wt2html,html2html
7658 !! wikitext
7659 [[7%25 Solution]]
7660 [[7%25 Solution|7%25 Solution]]
7661 !! html/php
7662 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7663 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7664 </p>
7665 !! html/parsoid
7666 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7667 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7668 !!end
7669
7670 !! test
7671 Link containing % as a double hex sequence interpreted to hex sequence
7672 !! wikitext
7673 [[7%2525 Solution]]
7674 !! html
7675 <p>[[7%2525 Solution]]
7676 </p>
7677 !!end
7678
7679 # note that parsoid does not munge anchor text; all non-space
7680 # characters are valid in HTML5 anchors.
7681 !! test
7682 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7683 Example for such a section: == < ==
7684 !! wikitext
7685 [[%23%3c]][[%23%3e]]
7686 !! html/php
7687 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7688 </p>
7689 !! html/parsoid
7690 <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>
7691 !! end
7692
7693 !! test
7694 Link containing "<#" and ">#" as a hex sequences
7695 !! wikitext
7696 [[%3c%23]][[%3e%23]]
7697 !! html
7698 <p>[[%3c%23]][[%3e%23]]
7699 </p>
7700 !! end
7701
7702 !! test
7703 Link containing an equals sign
7704 !! wikitext
7705 [[Special:BookSources/isbn=4-00-026157-6]]
7706 !! html/php
7707 <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>
7708 </p>
7709 !! html/parsoid
7710 <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>
7711 !! end
7712
7713 !! article
7714 Foo~bar
7715 !! text
7716 Just a test of an article title containing a tilde.
7717 !! endarticle
7718
7719 # note that links containing signatures, like [[Foo~~~~]], are
7720 # massaged by the pre-save transform (PST) and so the tildes are never
7721 # seen by the parser.
7722 !! test
7723 Link containing a tilde
7724 !! wikitext
7725 [[Foo~bar]]
7726 !! html/php
7727 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7728 </p>
7729 !! html/parsoid
7730 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7731 !! end
7732
7733 !! test
7734 Link containing double-single-quotes '' (bug 4598)
7735 !! wikitext
7736 [[Lista d''e paise d''o munno]]
7737 !! html/php
7738 <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>
7739 </p>
7740 !! html/parsoid
7741 <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>
7742 !! end
7743
7744 !! test
7745 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7746 !! wikitext
7747 Some [[Link|pretty ''italics'' and stuff]]!
7748 !! html/php
7749 <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>!
7750 </p>
7751 !! html/parsoid
7752 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7753 !! end
7754
7755 !! test
7756 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7757 !! wikitext
7758 ''Some [[Link|pretty ''italics'' and stuff]]!''
7759 !! html
7760 <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>
7761 </p>
7762 !! end
7763
7764 !! test
7765 Link with double quotes in title part (literal) and alternate part (interpreted)
7766 !! wikitext
7767 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7768
7769 [[''Pentecoste'']]
7770
7771 [[''Pentecoste''|Pentecoste]]
7772
7773 [[''Pentecoste''|''Pentecoste'']]
7774 !! html/php
7775 <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>
7776 </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>
7777 </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>
7778 </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>
7779 </p>
7780 !! html/parsoid
7781 <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>
7782 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7783 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7784 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7785 !! end
7786
7787 !! test
7788 Broken image links with HTML captions (bug 39700)
7789 !! wikitext
7790 [[File:Nonexistent|<script></script>]]
7791 [[File:Nonexistent|100x100px|<script></script>]]
7792 [[File:Nonexistent|&lt;]]
7793 [[File:Nonexistent|a<i>b</i>c]]
7794 !! html/php
7795 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7796 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7797 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7798 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7799 </p>
7800 !! html/parsoid
7801 <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>
7802 <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>
7803 <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>
7804 <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>
7805 !! end
7806
7807 !! test
7808 Plain link to URL
7809 !! wikitext
7810 [[http://www.example.com]]
7811 !! html/php
7812 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7813 </p>
7814 !! html/parsoid
7815 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7816 !! end
7817
7818 !! test
7819 Plain link to URL with link text
7820 !! wikitext
7821 [[http://www.example.com Link text]]
7822 !! html
7823 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7824 </p>
7825 !! end
7826
7827 !! test
7828 Plain link to protocol-relative URL
7829 !! wikitext
7830 [[//www.example.com]]
7831 !! html/php
7832 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7833 </p>
7834 !! html/parsoid
7835 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7836 !! end
7837
7838 !! test
7839 Plain link to protocol-relative URL with link text
7840 !! wikitext
7841 [[//www.example.com Link text]]
7842 !! html
7843 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7844 </p>
7845 !! end
7846
7847 !! test
7848 Plain link to page with question mark in title
7849 !! wikitext
7850 [[A?b]]
7851
7852 [[A?b|Baz]]
7853 !! html
7854 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7855 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7856 </p>
7857 !! end
7858
7859
7860 # I'm fairly sure the expected result here is wrong.
7861 # We want these to be URL links, not pseudo-pages with URLs for titles....
7862 # However the current output is also pretty screwy.
7863 #
7864 # ----
7865 # I'm changing it to match the current output--it arguably makes more
7866 # sense in the light of the test above. Old expected result was:
7867 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7868 #</p>
7869 # But I think this test is bordering on "garbage in, garbage out" anyway.
7870 # -- wtm
7871 !! test
7872 Piped link to URL
7873 !! wikitext
7874 Piped link to URL: [[http://www.example.com|an example URL]]
7875 !! html/php
7876 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7877 </p>
7878 !! html/parsoid
7879 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7880 !! end
7881
7882 !! test
7883 BUG 2: [[page|http://url/]] should link to page, not http://url/
7884 !! wikitext
7885 [[Main Page|http://url/]]
7886 !! html/php
7887 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7888 </p>
7889 !! html/parsoid
7890 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7891 !! end
7892
7893 # Parsoid does not mark self-links, by design.
7894 !! test
7895 BUG 337: Escaped self-links should be bold
7896 !! options
7897 title=[[Bug462]]
7898 !! wikitext
7899 [[Bu&#103;462]] [[Bug462]]
7900 !! html/php
7901 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7902 </p>
7903 !! html/php+tidy
7904 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7905 !! html/parsoid
7906 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7907 !! end
7908
7909 !! test
7910 Self-link to section should not be bold
7911 !! options
7912 title=[[Main Page]]
7913 !! wikitext
7914 [[Main Page#section]]
7915 !! html
7916 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7917 </p>
7918 !! end
7919
7920 !! article
7921 00
7922 !! text
7923 This is 00.
7924 !! endarticle
7925
7926 !!test
7927 Self-link to numeric title
7928 !!options
7929 title=[[0]]
7930 !! wikitext
7931 [[0]]
7932 !! html
7933 <p><strong class="selflink">0</strong>
7934 </p>
7935 !!end
7936
7937 !!test
7938 Link to numeric-equivalent title
7939 !!options
7940 title=[[0]]
7941 !! wikitext
7942 [[00]]
7943 !! html
7944 <p><a href="/wiki/00" title="00">00</a>
7945 </p>
7946 !!end
7947
7948 !! test
7949 <nowiki> inside a link
7950 !! wikitext
7951 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7952 !! html
7953 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7954 </p>
7955 !! end
7956
7957 !! test
7958 Non-breaking spaces in title
7959 !! wikitext
7960 [[&nbsp; Main &nbsp; Page &nbsp;]]
7961 !! html
7962 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7963 </p>
7964 !!end
7965
7966 !! test
7967 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7968 !! options
7969 language=ca
7970 !! wikitext
7971 '''[[Main Page]]'''
7972 !! html
7973 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7974 </p>
7975 !! end
7976
7977 !! test
7978 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7979 !! options
7980 language=ca
7981 !! wikitext
7982 ''[[Main Page]]''
7983 !! html
7984 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7985 </p>
7986 !! end
7987
7988 !! test
7989 Internal link with en linktrail: no apostrophes (bug 27473)
7990 !! options
7991 language=en
7992 !! wikitext
7993 [[Something]]'nice
7994 !! html
7995 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7996 </p>
7997 !! end
7998
7999 !! test
8000 Internal link with ca linktrail with apostrophes (bug 27473)
8001 !! options
8002 language=ca
8003 !! wikitext
8004 [[Something]]'nice
8005 !! html
8006 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8007 </p>
8008 !! end
8009
8010 !! test
8011 Internal link with kaa linktrail with apostrophes (bug 27473)
8012 !! options
8013 language=kaa
8014 !! wikitext
8015 [[Something]]'nice
8016 !! html
8017 <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>
8018 </p>
8019 !! end
8020
8021 !! test
8022 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8023 !! wikitext
8024 [[User:Foo/Test/63636:Bar|Test]]
8025 !! html/php
8026 <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>
8027 </p>
8028 !! html/parsoid
8029 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8030 !! end
8031
8032 ## Mainly a sanity check for Parsoid
8033 !! test
8034 Handle title parsing for subpages
8035 !! options
8036 title=[[/123123]]
8037 !! wikitext
8038 123
8039 !! html/parsoid
8040 <p>123</p>
8041 !! end
8042
8043 ## FIXME: Add a working php section here
8044 !! test
8045 Link to a subpage from a namespace other than main
8046 !! options
8047 title=[[User:test]]
8048 !! wikitext
8049 [[/123]]
8050 !! html/parsoid
8051 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8052 !! end
8053
8054 !! test
8055 Ensure that transclusion titles are not url-decoded
8056 !! options
8057 subpage title=[[Test]]
8058 parsoid=wt2html
8059 !! wikitext
8060 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8061 !! html/php
8062 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8063 </p>
8064 !! html/parsoid
8065 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8066 !! end
8067
8068 !! test
8069 Purely hash wikilink
8070 !! options
8071 title=[[User:test/123]]
8072 !! wikitext
8073 [[#a|b]]
8074 !! html/php
8075 <p><a href="#a">b</a>
8076 </p>
8077 !! html/parsoid
8078 <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>
8079 !! end
8080
8081 !! test
8082 1. Interaction of linktrail and template encapsulation
8083 !! options
8084 parsoid
8085 !! wikitext
8086 {{echo|[[Foo]]}}l
8087 !! html
8088 <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>
8089 !! end
8090
8091 !! test
8092 2. Interaction of linktrail and template encapsulation
8093 !! options
8094 parsoid
8095 !! wikitext
8096 {{echo|Some [[Fool]]}}s
8097 !! html
8098 <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>
8099 !! end
8100
8101 !! test
8102 3. Interaction of linktrail and template encapsulation
8103 !! options
8104 parsoid
8105 !! wikitext
8106 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8107 !! html
8108 <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>
8109 !! end
8110
8111 !! article
8112 Söfnuður
8113 !! text
8114 Test.
8115 !! endarticle
8116
8117 !! test
8118 Internal link with is link prefix
8119 !! options
8120 language=is
8121 !! wikitext
8122 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8123 !! html
8124 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8125 </p>
8126 !! end
8127
8128 !! article
8129 Mótmælendatrú
8130 !! text
8131 Test.
8132 !! endarticle
8133
8134 !! test
8135 Internal link with is link trail and link prefix
8136 !! options
8137 language=is
8138 !! wikitext
8139 [[mótmælendatrú|xxx]]ar
8140 [[mótmælendatrú]]ar
8141 mótmælenda[[söfnuður]]
8142 mótmælenda[[söfnuður|söfnuðir]]
8143 mótmælenda[[söfnuður|söfnuðir]]xxx
8144 !! html
8145 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8146 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8147 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8148 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8149 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8150 </p>
8151 !! end
8152
8153 !! test
8154 Parsoid link trail escaping
8155 !! options
8156 parsoid=html2wt,html2html
8157 !! html/parsoid
8158 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8159 !! wikitext
8160 [[apple]]<nowiki/>s
8161 !! end
8162
8163 !! test
8164 Parsoid link prefix escaping
8165 !! options
8166 language=is
8167 parsoid=html2wt,html2html
8168 !! html/parsoid
8169 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8170 !! wikitext
8171 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8172 !! end
8173
8174 !! test
8175 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8176 !! wikitext
8177 [[Foo| bar]]
8178
8179 [[Foo| ''bar'']]
8180
8181 [http://wp.org foo]
8182
8183 [http://wp.org ''foo'']
8184 !! html
8185 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8186 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8187 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8188 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8189 </p>
8190 !! end
8191
8192 !! test
8193 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8194 !! options
8195 parsoid
8196 !! wikitext
8197 [[Foo|{{echo|a}} b {{echo|c}}]]
8198 !! html
8199 <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>
8200 !! end
8201
8202 !! test
8203 Link with angle bracket after anchor
8204 !! wikitext
8205 [[Foo#<bar>]]
8206 !! html/php
8207 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8208 </p>
8209 !! html/parsoid
8210 <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>
8211 !! end
8212
8213 ###
8214 ### Interwiki links (see maintenance/interwiki.sql)
8215 ###
8216
8217 !! test
8218 Inline interwiki link
8219 !! options
8220 parsoid=wt2html,wt2wt,html2html
8221 !! wikitext
8222 [[MeatBall:SoftSecurity]]
8223 !! html/php
8224 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8225 </p>
8226 !! html/parsoid
8227 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8228 !! end
8229
8230 !! test
8231 Inline interwiki link with empty title (bug 2372)
8232 !! options
8233 parsoid=wt2html,wt2wt,html2html
8234 !! wikitext
8235 [[MeatBall:]]
8236 !! html/php
8237 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8238 </p>
8239 !! html/parsoid
8240 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8241 !! end
8242
8243 !! test
8244 Interwiki link encoding conversion (bug 1636)
8245 !! wikitext
8246 *[[Wikipedia:ro:Olteni&#0355;a]]
8247 *[[Wikipedia:ro:Olteni&#355;a]]
8248 !! html
8249 <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>
8250 <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>
8251
8252 !! html+tidy
8253 <ul>
8254 <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>
8255 <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>
8256 </ul>
8257 !! end
8258
8259 !! test
8260 Interwiki link with fragment (bug 2130)
8261 !! wikitext
8262 [[MeatBall:SoftSecurity#foo]]
8263 !! html
8264 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8265 </p>
8266 !! end
8267
8268 # Ideally the wikipedia: prefix here should be proto-relative too
8269 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8270 # define the 'en' prefix, and originally the test used 'wikipedia',
8271 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8272 # article.
8273 !! test
8274 Different interwiki prefixes mapping to the same URL
8275 !! wikitext
8276 [[:en:Foo]]
8277
8278 [[:en:Foo|Foo]]
8279
8280 [[wikipedia:Foo]]
8281
8282 [[:wikipedia:Foo|Foo]]
8283
8284 [[wikipedia:en:Foo]]
8285
8286 [[:wikipedia:en:Foo]]
8287
8288 [[ wikiPEdia :Foo]]
8289 !! html/parsoid
8290 <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>
8291
8292 <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>
8293
8294 <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>
8295
8296 <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>
8297
8298 <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>
8299
8300 <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>
8301
8302 <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>
8303 !! end
8304
8305 !! test
8306 Interwiki links that cannot be represented in wiki syntax
8307 !! wikitext
8308 [[meatball:ok]]
8309 [[meatball:ok#foo|ok with fragment]]
8310 [[meatball:ok_as_well?|ok ending with ? mark]]
8311 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8312 [http://de.wikipedia.org/wiki/#foo is just fragment]
8313
8314 !! html/php
8315 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8316 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8317 <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>
8318 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8319 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8320 </p>
8321 !! html/parsoid
8322 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8323 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8324 <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>
8325 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8326 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8327 !! end
8328
8329 !! test
8330 Interwiki links: trail
8331 !! wikitext
8332 [[wikipedia:Foo|Ba]]r
8333 !! html/php
8334 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8335 </p>
8336 !! html/parsoid
8337 <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>
8338 !! end
8339
8340 !! test
8341 Local interwiki link
8342 !! options
8343 parsoid=wt2html,wt2wt,html2html
8344 !! wikitext
8345 [[local:Template:Foo]]
8346 !! html/php
8347 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8348 </p>
8349 !! html/parsoid
8350 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8351 !! end
8352
8353 # Parsoid does not mark self-links, by design.
8354 !! test
8355 Local interwiki link: self-link to current page
8356 !! options
8357 title=[[Main Page]]
8358 parsoid=wt2html,wt2wt,html2html
8359 !! wikitext
8360 [[local:Main Page]]
8361 !! html/php
8362 <p><strong class="selflink">local:Main Page</strong>
8363 </p>
8364 !! html/parsoid
8365 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8366 !! end
8367
8368 !! test
8369 Local interwiki link: prefix only (bug 64167)
8370 !! options
8371 parsoid=wt2html,wt2wt,html2html
8372 !! wikitext
8373 [[local:]]
8374 !! html/php
8375 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8376 </p>
8377 !! html/parsoid
8378 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8379 !! end
8380
8381 !! test
8382 Local interwiki link: with additional interwiki prefix (bug 61357)
8383 !! options
8384 parsoid=wt2html,wt2wt,html2html
8385 !! wikitext
8386 [[local:meatball:Hello]]
8387 !! html/php
8388 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8389 </p>
8390 !! html/parsoid
8391 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8392 !! end
8393
8394 !! test
8395 Multiple local interwiki link prefixes
8396 !! wikitext
8397 [[local:local:local:local:mi:local:Foo]]
8398 !! options
8399 parsoid=wt2html,wt2wt,html2html
8400 !! html/php
8401 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8402 </p>
8403 !! html/parsoid
8404 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8405 !! end
8406
8407 ###
8408 ### Interlanguage links
8409 ### Language links (so that searching for '### language' matches..)
8410 ###
8411
8412 !! test
8413 Interlanguage link
8414 !! wikitext
8415 Blah blah blah
8416 [[zh:Chinese]]
8417 !! html/php
8418 <p>Blah blah blah
8419 </p>
8420 !! html/parsoid
8421 <p>Blah blah blah</p>
8422 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8423 !! end
8424
8425 ## parsoid html2wt will lose the space variations
8426 !! test
8427 Interlanguage link with spacing
8428 !! options
8429 parsoid=wt2html,wt2wt,html2html
8430 !! wikitext
8431 Blah blah blah
8432 [[ zh : Chinese ]]
8433 !! html/php
8434 <p>Blah blah blah
8435 </p>
8436 !! html/parsoid
8437 <p>Blah blah blah</p>
8438 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8439 !! end
8440
8441 !! test
8442 Double interlanguage link
8443 !! wikitext
8444 Blah blah blah
8445 [[es:Spanish]]
8446 [[zh:Chinese]]
8447 !! html/php
8448 <p>Blah blah blah
8449 </p>
8450 !! html/parsoid
8451 <p>Blah blah blah</p>
8452 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8453 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8454 !! end
8455
8456 ## parsoid html2wt will lose the space variations
8457 !! test
8458 Interlanguage link variations
8459 !! options
8460 parsoid=wt2html,wt2wt,html2html
8461 !! wikitext
8462 Blah blah blah
8463 [[ es :Spanish]]
8464 [[ ZH :Chinese]]
8465 [[es:Foo_bar]]
8466 !! html/php
8467 <p>Blah blah blah
8468 </p>
8469 !! html/parsoid
8470 <p>Blah blah blah</p>
8471 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8472 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8473 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8474 !! end
8475
8476 ## parsoid html2wt will normalize the space to _
8477 !! test
8478 Space and question mark encoding in interlanguage links (T95473)
8479 !! options
8480 parsoid=wt2html,wt2wt,html2html
8481 !! wikitext
8482 Blah blah blah
8483 [[es:Foo bar?]]
8484 !! html/php
8485 <p>Blah blah blah
8486 </p>
8487 !! html/parsoid
8488 <p>Blah blah blah</p>
8489 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8490 !! end
8491
8492 !! test
8493 Interlanguage link, with prefix links
8494 !! options
8495 language=ln
8496 !! wikitext
8497 Blah blah blah
8498 [[zh:Chinese]]
8499 !! html/php
8500 <p>Blah blah blah
8501 </p>
8502 !! html/parsoid
8503 <p>Blah blah blah</p>
8504 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8505 !! end
8506
8507 !! test
8508 Double interlanguage link, with prefix links (bug 8897)
8509 !! options
8510 language=ln
8511 !! wikitext
8512 Blah blah blah
8513 [[es:Spanish]]
8514 [[zh:Chinese]]
8515 !! html/php
8516 <p>Blah blah blah
8517 </p>
8518 !! html/parsoid
8519 <p>Blah blah blah</p>
8520 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8521 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8522 !! end
8523
8524 !! test
8525 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8526 !! wikitext
8527 Blah blah blah
8528 [[mul:Article]]
8529 !! html/php
8530 <p>Blah blah blah
8531 </p>
8532 !! html/parsoid
8533 <p>Blah blah blah</p>
8534 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8535 !! end
8536
8537 ## PHP parser tests script needs an update
8538 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8539 !! test
8540 Language links render as inline links if $wgInterwikiMagic=false
8541 !! options
8542 wgInterwikiMagic=false
8543 parsoid=wt2html,wt2wt,html2html
8544 !! wikitext
8545 Blah blah blah
8546 [[zh:Chinese]]
8547 !! html/parsoid
8548 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8549 !! end
8550
8551 ## PHP parser tests script needs an update
8552 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8553 !! test
8554 Language links render as inline links in the Talk namespace
8555 !! options
8556 title=Talk:Foo
8557 parsoid=wt2html,wt2wt,html2html
8558 !! wikitext
8559 Blah blah blah
8560 [[zh:Chinese]]
8561 !! html/parsoid
8562 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8563 !! end
8564
8565 !! test
8566 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8567 !! options
8568 language=ln
8569 !! wikitext
8570 [[WW&nbsp;II]]
8571 !! html
8572 <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>
8573 </p>
8574 !! end
8575
8576 !! test
8577 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8578 !! options
8579 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8580 !! html/parsoid
8581 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8582 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8583 !! wikitext
8584 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8585
8586 He&amp;nbsp;llo He&amp;nbsp;llo
8587 !! html/php
8588 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8589 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8590 </p>
8591 !! end
8592
8593 # html2wt will fail because of title normalization without data-parsoid
8594 !! test
8595 Parsoid: handle constructor well
8596 !! options
8597 parsoid=wt2html,wt2wt
8598 !! wikitext
8599 [[constructor]]
8600
8601 [[constructor:foo]]
8602 !! html/php
8603 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8604 </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>
8605 </p>
8606 !! html/parsoid
8607 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8608
8609 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8610 !! end
8611
8612 !! article
8613 ko:
8614 !! text
8615 Test.
8616 !! endarticle
8617
8618 # Note that `ko` isn't a known interlanguage prefix
8619 !! test
8620 Parsoid: recognize interlanguage links without a target page
8621 !! options
8622 ill
8623 !! wikitext
8624 [[es:]]
8625
8626 [[ko:]]
8627 !! html/php
8628 es:
8629 !! html/parsoid
8630 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8631
8632 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8633 !! end
8634
8635 # Note that `ko` isn't a known interwiki prefix
8636 !! test
8637 Parsoid: recognize interwiki links without a target page
8638 !! options
8639 parsoid=wt2html,wt2wt,html2html
8640 !! wikitext
8641 [[:es:]]
8642
8643 [[:ko:]]
8644 !! html/php
8645 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8646 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8647 </p>
8648 !! html/parsoid
8649 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8650 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8651 !! end
8652
8653 !! test
8654 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8655 !! wikitext
8656 [[mi:Foo]]
8657 !! html/php
8658 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8659 </p>
8660 !! html/parsoid
8661 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8662 !! end
8663
8664 !! test
8665 Interlanguage link with preceding local interwiki link (bug 68085)
8666 !! options
8667 parsoid=wt2html,wt2wt,html2html
8668 !! wikitext
8669 Blah blah blah
8670 [[local:es:Spanish]]
8671 !! html/php
8672 <p>Blah blah blah
8673 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8674 </p>
8675 !! html/parsoid
8676 <p>Blah blah blah
8677 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8678 !! end
8679
8680 !! test
8681 Looks like an interlanguage link, but is actually a local interwiki
8682 !! options
8683 parsoid=wt2html,wt2wt,html2html
8684 !! wikitext
8685 Blah blah blah
8686 [[mi:Template:Foo]]
8687 !! html/php
8688 <p>Blah blah blah
8689 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8690 </p>
8691 !! html/parsoid
8692 <p>Blah blah blah
8693 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8694 !! end
8695
8696 ###
8697 ### Redirects, Parsoid-only
8698 ###
8699
8700 !! test
8701 1. Simple redirect to page
8702 !! wikitext
8703 #REDIRECT [[Main Page]]
8704 !! html/parsoid
8705 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8706 !! end
8707
8708 !! test
8709 2. Other redirect variants
8710 !! wikitext
8711 #REDIRECT [[Main_Page]]
8712 !! html/parsoid
8713 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8714 !! end
8715
8716 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8717 # This tests the Parsoid bail-out code.
8718 !! test
8719 3. Other redirect variants
8720 !! wikitext
8721 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8722 !! html/parsoid
8723 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8724 !! end
8725
8726 !! test
8727 4. Redirect to a templated destination
8728 !! wikitext
8729 #REDIRECT [[{{echo|Foo}}bar]]
8730 !! html/parsoid
8731 <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"}]]}'/>
8732 !! end
8733
8734 !! test
8735 Empty redirect
8736 !! options
8737 parsoid=wt2html,wt2wt
8738 !! wikitext
8739 #REDIRECT [[]]
8740 !! html/parsoid
8741 <ol>
8742 <li>REDIRECT [[]]</li></ol>
8743 !! end
8744
8745 !! test
8746 Optional colon in #REDIRECT
8747 !! options
8748 # the colon is archaic syntax. we support it for wt2html, but we
8749 # don't care that it roundtrips back to the modern syntax.
8750 parsoid=wt2html,html2html
8751 !! wikitext
8752 #REDIRECT:[[Main Page]]
8753 !! html/parsoid
8754 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8755 !! end
8756
8757 !! test
8758 Whitespace in #REDIRECT with optional colon
8759 !! options
8760 # the colon and gratuitous whitespace is archaic syntax. we support
8761 # it for wt2html, but we don't care that it roundtrips back to the
8762 # modern syntax (without extra whitespace)
8763 parsoid=wt2html,html2html
8764 !! wikitext
8765
8766 #REDIRECT
8767 :
8768 [[Main Page]]
8769 !! html/parsoid
8770 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8771 !! end
8772
8773 !! test
8774 Piped link in #REDIRECT
8775 !! options
8776 # content after piped link is ignored. we support this syntax,
8777 # but don't care that the piped link is lost when we roundtrip this.
8778 parsoid=wt2html
8779 !! wikitext
8780 #REDIRECT [[Main Page|bar]]
8781 !! html/parsoid
8782 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8783 !! end
8784
8785 !! test
8786 Redirect to category (T104502)
8787 !! options
8788 parsoid=wt2html,wt2wt
8789 !! wikitext
8790 #REDIRECT [[Category:Foo]]
8791 !! html/parsoid
8792 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8793 !! end
8794
8795 !! test
8796 Redirect to category with URL encoding (T104502)
8797 !! options
8798 parsoid=wt2html
8799 !! wikitext
8800 #REDIRECT [[Category%3AFoo]]
8801 !! html/parsoid
8802 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8803 !! end
8804
8805 !! test
8806 Redirect to category page
8807 !! wikitext
8808 #REDIRECT [[:Category:Foo]]
8809 !! html/parsoid
8810 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8811 !! end
8812
8813 !! test
8814 Redirect to image page (1)
8815 !! wikitext
8816 #REDIRECT [[File:Wiki.png]]
8817 !! html/parsoid
8818 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8819 !! end
8820
8821 !! test
8822 Redirect to image page (2)
8823 !! wikitext
8824 #REDIRECT [[Image:Wiki.png]]
8825 !! html/parsoid
8826 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8827 !! end
8828
8829 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8830 # Next test confirms this.
8831 !! test
8832 Redirect to language (1) (T104918)
8833 !! options
8834 parsoid=wt2html,wt2wt,html2html
8835 !! wikitext
8836 #REDIRECT [[en:File:Wiki.png]]
8837 !! html/parsoid
8838 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8839 !! end
8840
8841 !! test
8842 Redirect to language (2) (T104918)
8843 !! wikitext
8844 #REDIRECT [[:en:File:Wiki.png]]
8845 !! html/parsoid
8846 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8847 !! end
8848
8849 !! test
8850 Redirect to interwiki (T104918)
8851 !! wikitext
8852 #REDIRECT [[meatball:File:Wiki.png]]
8853 !! html/parsoid
8854 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8855 !! end
8856
8857 !! test
8858 Non-English #REDIRECT
8859 !! options
8860 language=is
8861 !! wikitext
8862 #TILVÍSUN [[Main Page]]
8863 !! html/parsoid
8864 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8865 !! end
8866
8867 !! test
8868 Redirect syntax under text isn't considered a redirect
8869 !! wikitext
8870 some text
8871 #redirect [[Main Page]]
8872 !! html/parsoid
8873 <p>some text</p>
8874 <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>
8875 !! end
8876
8877 # FIXME: Should hoist the redirect to the top of the page and ensure there
8878 # is only one.
8879 !! test
8880 New redirect
8881 !! options
8882 parsoid=html2wt
8883 !! html/parsoid
8884 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8885 !! wikitext
8886 Foo
8887 #REDIRECT [[Foo]]
8888 !! end
8889
8890 ##
8891 ## XHTML tidiness
8892 ###
8893
8894 !! test
8895 <br> to <br />
8896 !! wikitext
8897 1<br>2<br />3
8898 !! html
8899 <p>1<br />2<br />3
8900 </p>
8901 !! end
8902
8903 !! test
8904 Broken br tag sanitization
8905 !! wikitext
8906 </br>
8907 !! html/php
8908 <p>&lt;/br&gt;
8909 </p>
8910 !! end
8911
8912 # TODO: Fix html2html mode (bug 51055)!
8913 !! test
8914 Parsoid: Broken br tag recognition
8915 !! options
8916 parsoid=wt2html
8917 !! wikitext
8918 </br>
8919
8920 <br/ >
8921 !! html+tidy
8922 <p><br /></p>
8923 <p><br /></p>
8924 !! end
8925
8926 !! test
8927 Incorrecly removing closing slashes from correctly formed XHTML
8928 !! wikitext
8929 <br style="clear:both;" />
8930 !! html
8931 <p><br style="clear:both;" />
8932 </p>
8933 !! end
8934
8935 !! test
8936 Failing to transform badly formed HTML into correct XHTML
8937 !! wikitext
8938 <br style="clear: left;">
8939 <br style="clear: right;">
8940 <br style="clear: both;">
8941 !! html
8942 <p><br style="clear: left;" />
8943 <br style="clear: right;" />
8944 <br style="clear: both;" />
8945 </p>
8946 !!end
8947
8948 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8949 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8950 !! test
8951 Handling html with a div self-closing tag
8952 !! wikitext
8953 <div title />
8954 <div title/>
8955 <div title/ >
8956 <div title=bar />
8957 <div title=bar/>
8958 <div title=bar/ >
8959 !! html/php
8960 <p>&lt;div title /&gt;
8961 &lt;div title/&gt;
8962 </p>
8963 <div>
8964 <p>&lt;div title=bar /&gt;
8965 &lt;div title=bar/&gt;
8966 </p>
8967 <div title="bar/"></div>
8968 </div>
8969
8970 !! html/parsoid
8971 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8972 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8973 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8974 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8975 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8976 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8977 !! end
8978
8979 !! test
8980 Handling html with a br self-closing tag
8981 !! wikitext
8982 <br title />
8983 <br title/>
8984 <br title/ >
8985 <br title=bar />
8986 <br title=bar/>
8987 <br title=bar/ >
8988 !! html/php
8989 <p><br title="" />
8990 <br title="" />
8991 <br />
8992 <br title="bar" />
8993 <br title="bar" />
8994 <br title="bar/" />
8995 </p>
8996 !! html/parsoid
8997 <p><br title="" />
8998 <br title="" />
8999 <br title="" />
9000 <br title="bar" />
9001 <br title="bar" />
9002 <br title="bar/" />
9003 </p>
9004 !! end
9005
9006 !! test
9007 Horizontal ruler (should it add that extra space?)
9008 !! wikitext
9009 <hr>
9010 <hr >
9011 foo <hr
9012 > bar
9013 !! html+tidy
9014 <hr />
9015 <hr />
9016 <p>foo</p>
9017 <hr />
9018 <p>bar</p>
9019 !! end
9020
9021 !! test
9022 Horizontal ruler -- 4+ dashes render hr
9023 !! wikitext
9024 ----
9025 !! html
9026 <hr />
9027
9028 !! end
9029
9030 !! test
9031 Horizontal ruler -- eats additional dashes on the same line
9032 !! wikitext
9033 ---------
9034 !! html
9035 <hr />
9036
9037 !! end
9038
9039 !! test
9040 Horizontal ruler -- does not collapse dashes on consecutive lines
9041 !! wikitext
9042 ----
9043 ----
9044 !! html
9045 <hr />
9046 <hr />
9047
9048 !! end
9049
9050 !! test
9051 Horizontal ruler -- <4 dashes render as plain text
9052 !! wikitext
9053 ---
9054 !! html
9055 <p>---
9056 </p>
9057 !! end
9058
9059 !! test
9060 Horizontal ruler -- Supports content following dashes on same line
9061 !! wikitext
9062 ---- Foo
9063 !! html
9064 <hr /> Foo
9065
9066 !! html+tidy
9067 <hr />
9068 <p>Foo</p>
9069 !! end
9070
9071 ###
9072 ### Block-level elements
9073 ###
9074 !! test
9075 Common list
9076 !! wikitext
9077 *Common list
9078 * item 2
9079 *item 3
9080 !! html
9081 <ul><li>Common list</li>
9082 <li> item 2</li>
9083 <li>item 3</li></ul>
9084
9085 !! end
9086
9087 !! test
9088 Numbered list
9089 !! wikitext
9090 #Numbered list
9091 #item 2
9092 # item 3
9093 !! html
9094 <ol><li>Numbered list</li>
9095 <li>item 2</li>
9096 <li> item 3</li></ol>
9097
9098 !! end
9099
9100 !! test
9101 Mixed list
9102 !! wikitext
9103 *Mixed list
9104 *# with numbers
9105 ** and bullets
9106 *# and numbers
9107 *bullets again
9108 **bullet level 2
9109 ***bullet level 3
9110 ***#Number on level 4
9111 **bullet level 2
9112 **#Number on level 3
9113 **#Number on level 3
9114 *#number level 2
9115 *Level 1
9116 *** Level 3
9117 #** Level 3, but ordered
9118 !! html
9119 <ul><li>Mixed list
9120 <ol><li> with numbers</li></ol>
9121 <ul><li> and bullets</li></ul>
9122 <ol><li> and numbers</li></ol></li>
9123 <li>bullets again
9124 <ul><li>bullet level 2
9125 <ul><li>bullet level 3
9126 <ol><li>Number on level 4</li></ol></li></ul></li>
9127 <li>bullet level 2
9128 <ol><li>Number on level 3</li>
9129 <li>Number on level 3</li></ol></li></ul>
9130 <ol><li>number level 2</li></ol></li>
9131 <li>Level 1
9132 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9133 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9134
9135 !! end
9136
9137 !! test
9138 1. Nested mixed wikitext and html list
9139 !! wikitext
9140 * hi
9141 * <ul><li>ho</li></ul>
9142 * hi
9143 ** ho
9144 !! html/php
9145 <ul><li> hi</li>
9146 <li> <ul><li>ho</li></ul></li>
9147 <li> hi
9148 <ul><li> ho</li></ul></li></ul>
9149
9150 !! html/parsoid
9151 <ul><li> hi</li>
9152 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9153 <li> hi
9154 <ul><li> ho</li></ul></li></ul>
9155 !! end
9156
9157 !! test
9158 2. Nested mixed wikitext and html list (incompatible)
9159 !! wikitext
9160 ; hi
9161 : {{echo|<li>ho</li>}}
9162 !! html/php
9163 <dl><dt> hi</dt>
9164 <dd> <li>ho</li></dd></dl>
9165
9166 !! html/parsoid
9167 <dl><dt> hi</dt>
9168 <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>
9169 !! end
9170
9171 !! test
9172 Nested lists 1
9173 !! wikitext
9174 *foo
9175 **bar
9176 !! html
9177 <ul><li>foo
9178 <ul><li>bar</li></ul></li></ul>
9179
9180 !! end
9181
9182 !! test
9183 Nested lists 2
9184 !! wikitext
9185 **foo
9186 *bar
9187 !! html
9188 <ul><li><ul><li>foo</li></ul></li>
9189 <li>bar</li></ul>
9190
9191 !! end
9192
9193 !! test
9194 Nested lists 3 (first element empty)
9195 !! wikitext
9196 *
9197 **bar
9198 !! html
9199 <ul><li>
9200 <ul><li>bar</li></ul></li></ul>
9201
9202 !! end
9203
9204 !! test
9205 Nested lists 4 (first element empty)
9206 !! wikitext
9207 **
9208 *bar
9209 !! html
9210 <ul><li><ul><li></li></ul></li>
9211 <li>bar</li></ul>
9212
9213 !! end
9214
9215 !! test
9216 Nested lists 5 (both elements empty)
9217 !! wikitext
9218 **
9219 *
9220 !! html
9221 <ul><li><ul><li></li></ul></li>
9222 <li></li></ul>
9223
9224 !! end
9225
9226 !! test
9227 Nested lists 6 (both elements empty)
9228 !! wikitext
9229 *
9230 **
9231 !! html
9232 <ul><li>
9233 <ul><li></li></ul></li></ul>
9234
9235 !! end
9236
9237 !! test
9238 Nested lists 7 (skip initial nesting levels)
9239 !! wikitext
9240 *** foo
9241 !! html
9242 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9243
9244 !! end
9245
9246 !! test
9247 Nested lists 8 (multiple nesting transitions)
9248 !! wikitext
9249 * foo
9250 *** bar
9251 ** baz
9252 * boo
9253 !! html
9254 <ul><li> foo
9255 <ul><li><ul><li> bar</li></ul></li>
9256 <li> baz</li></ul></li>
9257 <li> boo</li></ul>
9258
9259 !! end
9260
9261 !! test
9262 Nested lists 9 (extension interaction)
9263 !! options
9264 parsoid
9265 !! wikitext
9266 *<references />
9267 !! html/parsoid
9268 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9269 !! end
9270
9271 !! test
9272 1. Lists with start-of-line-transparent tokens before bullets: Comments
9273 !! wikitext
9274 *foo
9275 *<!--cmt-->bar
9276 <!--cmt-->*baz
9277 !! html
9278 <ul><li>foo</li>
9279 <li>bar</li>
9280 <li>baz</li></ul>
9281
9282 !! end
9283
9284 !! test
9285 2. Lists with start-of-line-transparent tokens before bullets: Template close
9286 !! wikitext
9287 *foo {{echo|bar
9288 }}*baz
9289 !! html
9290 <ul><li>foo bar</li>
9291 <li>baz</li></ul>
9292
9293 !! end
9294
9295 !! test
9296 List items are not parsed correctly following a <pre> block (bug 785)
9297 !! wikitext
9298 * <pre>foo</pre>
9299 * <pre>bar</pre>
9300 * zar
9301 !! html/php
9302 <ul><li> <pre>foo</pre></li>
9303 <li> <pre>bar</pre></li>
9304 <li> zar</li></ul>
9305
9306 !! html/parsoid
9307 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9308 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9309 <li> zar</li></ul>
9310 !! end
9311
9312 !! test
9313 List items from template
9314 !! wikitext
9315
9316 {{inner list}}
9317 * item 2
9318
9319 * item 0
9320 {{inner list}}
9321 * item 2
9322
9323 * item 0
9324 * notSOL{{inner list}}
9325 * item 2
9326 !! html
9327 <ul><li> item 1</li>
9328 <li> item 2</li></ul>
9329 <ul><li> item 0</li>
9330 <li> item 1</li>
9331 <li> item 2</li></ul>
9332 <ul><li> item 0</li>
9333 <li> notSOL</li>
9334 <li> item 1</li>
9335 <li> item 2</li></ul>
9336
9337 !! end
9338
9339 !! test
9340 List interrupted by empty line or heading
9341 !! wikitext
9342 * foo
9343
9344 ** bar
9345 == A heading ==
9346 * Another list item
9347 !! html
9348 <ul><li> foo</li></ul>
9349 <ul><li><ul><li> bar</li></ul></li></ul>
9350 <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>
9351 <ul><li> Another list item</li></ul>
9352
9353 !!end
9354
9355 !!test
9356 Multiple list tags generated by templates
9357 !! wikitext
9358 {{echo|<li>}}a
9359 {{echo|<li>}}b
9360 {{echo|<li>}}c
9361 !! html
9362 <li>a
9363 <li>b
9364 <li>c</li>
9365 </li>
9366 </li>
9367
9368 !! html+tidy
9369 <ul>
9370 <li>a</li>
9371 <li>b</li>
9372 <li>c</li>
9373 </ul>
9374 !!end
9375
9376 !!test
9377 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9378 !! wikitext
9379 *a
9380 <!--This line will NOT split the list-->
9381 *b
9382 <!--This line will NOT split the list either-->
9383 *c
9384 <!--foo--> <!----> <!--This line NOT split the list either-->
9385 *d
9386 !! html
9387 <ul><li>a</li>
9388 <li>b</li>
9389 <li>c</li>
9390 <li>d</li></ul>
9391
9392 !!end
9393
9394 !!test
9395 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9396 !! wikitext
9397 *a
9398 <!--This line will NOT split the list-->
9399 *b
9400 <!--This line will NOT split the list either-->
9401 *c
9402 <!--foo--> <!----> <!--This line NOT split the list
9403 either-->
9404 *d
9405 !! html
9406 <ul><li>a</li>
9407 <li>b</li>
9408 <li>c</li>
9409 <li>d</li></ul>
9410
9411 !!end
9412
9413 !!test
9414 Test the li-hack
9415 (The PHP parser relies on Tidy for the hack)
9416 !!options
9417 parsoid=wt2html,wt2wt
9418 !! wikitext
9419 * foo
9420 * <li>li-hack
9421 * {{echo|<li>templated li-hack}}
9422 * <!--foo--> <li> unsupported li-hack with preceding comments
9423
9424 <ul>
9425 <li><li>not a li-hack
9426 </li>
9427 </ul>
9428 !! html+tidy
9429 <ul>
9430 <li>foo</li>
9431 <li>li-hack</li>
9432 <li>templated li-hack</li>
9433 <li>unsupported li-hack with preceding comments</li>
9434 </ul>
9435 <ul>
9436 <li>not a li-hack</li>
9437 </ul>
9438 !!end
9439
9440 !! test
9441 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9442 !! options
9443 parsoid
9444 !! wikitext
9445 # foo
9446 ## bar
9447 * foo
9448 ** bar
9449 : foo
9450 :: bar
9451 !! html
9452 <ol>
9453 <li> foo<ol>
9454 <li> bar</li>
9455 </ol></li>
9456 </ol><ul>
9457 <li> foo<ul>
9458 <li> bar</li>
9459 </ul></li>
9460 </ul><dl>
9461 <dd> foo<dl>
9462 <dd> bar</dd>
9463 </dl></dd>
9464 </dl>
9465 !! end
9466
9467 !! test
9468 Parsoid: Test of whitespace serialization with Templated bullets
9469 !! options
9470 parsoid
9471 !! wikitext
9472 * {{bullet}}
9473 !! html
9474 <ul>
9475 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9476 </ul>
9477 !! end
9478
9479 # ------------------------------------------------------------------------
9480 # The next set of tests are about Parsoid's ability to handle badly nested
9481 # tags (parse, minimize scope of fixup, and roundtrip back)
9482 # ------------------------------------------------------------------------
9483
9484 !! test
9485 Unbalanced closing block tags break a list
9486 (php parser relies on Tidy to fix up)
9487 !! wikitext
9488 <div>
9489 *a</div><div>
9490 *b</div>
9491 !! html+tidy
9492 <div>
9493 <ul>
9494 <li>a</li>
9495 </ul>
9496 </div>
9497 <div>
9498 <ul>
9499 <li>b</li>
9500 </ul>
9501 </div>
9502 !! end
9503
9504 # Parsoid fails this test, but it might be tricky to support properly.
9505 # See bug 68395.
9506 !! test
9507 Unbalanced closing non-block tags don't break a list
9508 (php parser relies on Tidy to fix up)
9509 !! wikitext
9510 <span>
9511 *a</span><span>
9512 *b</span>
9513 !! html/php+tidy
9514 <ul>
9515 <li><span>a</span></li>
9516 <li><span>b</span></li>
9517 </ul>
9518 !! html/parsoid
9519 <span>
9520 <ul>
9521 <li>a<span></span>
9522 </li>
9523 <li>b
9524 </li>
9525 </ul>
9526 </span>
9527 !! end
9528
9529 !! test
9530 Unclosed formatting tags that straddle lists are closed and reopened
9531 (php parser relies on Tidy to fix up)
9532 !! options
9533 parsoid=wt2html,wt2wt,html2html
9534 !! wikitext
9535 # <s> a
9536 # b </s>
9537 !! html/php+tidy
9538 <ol>
9539 <li><s>a</s></li>
9540 <li><s>b</s></li>
9541 </ol>
9542 !! html/parsoid
9543 <ol><li> <s> a</s></li>
9544 <li><s> b </s></li></ol>
9545 !! end
9546
9547 # See bug 68395.
9548 !!test
9549 1. List embedded in a formatting tag
9550 !! wikitext
9551 <small>
9552 * foo
9553 </small>
9554 !! html/php+tidy
9555 <ul>
9556 <li><small>foo</small></li>
9557 </ul>
9558 !! html/parsoid
9559 <small>
9560 <ul>
9561 <li> foo</li>
9562 </ul>
9563 </small>
9564 !!end
9565
9566 ## Ugly Parsoid output here
9567 ## Not sure what the right output is.
9568 !!test
9569 2. List embedded in a formatting tag
9570 !! wikitext
9571 <small>
9572 *a
9573 *b</small>
9574 !! html/php+tidy
9575 <ul>
9576 <li><small>a</small></li>
9577 <li><small>b</small></li>
9578 </ul>
9579 !! html/parsoid
9580 <small></small>
9581 <ul><small>
9582 <li>a</li>
9583 </small>
9584 <li><small>b</small></li>
9585 </ul>
9586 !!end
9587
9588 # Ugly Parsoid and PHP parser output here
9589 # Not sure if we want to make this a test!
9590 #
9591 ## !!test
9592 ## 3. Unclosed formatting tags in list elements
9593 ## !! wikitext
9594 ## *<small>a
9595 ## *<small>b
9596 ## !! html/php+tidy
9597 ## <ul>
9598 ## <li><small>a</small></li>
9599 ## <li><small><small>b</small></small></li>
9600 ## </ul>
9601 ## !! html/parsoid
9602 ## <ul>
9603 ## <li><small>a</small></li>
9604 ## <small>
9605 ## <li><small>b</small></li>
9606 ## </small></ul>
9607 ## !!end
9608
9609 # This is a bug in the PHP parser + tidy combination.
9610 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9611 # and then fostered out of the table by tidy.)
9612 # We believe the Parsoid output to be correct.
9613 !! test
9614 Table with missing opening <tr> tag
9615 !! options
9616 parsoid=wt2html,wt2wt
9617 !! wikitext
9618 <table>
9619 <td>foo</td>
9620 </tr>
9621 </table>
9622 !! html+tidy
9623 <table>
9624 <tr>
9625 <td>foo</td>
9626 </tr>
9627 </table>
9628 !! end
9629
9630 ###
9631 ### Magic Words
9632 ###
9633
9634 # Note that the current date is hard-coded as
9635 # 1970-01-01T00:02:03Z (a Thursday)
9636 # when running parser tests. The timezone is also fixed to GMT, so
9637 # local date will be identical to current date.
9638
9639 !! test
9640 Magic Word: {{CURRENTDAY}}
9641 !! wikitext
9642 {{CURRENTDAY}}
9643 !! html
9644 <p>1
9645 </p>
9646 !! end
9647
9648 !! test
9649 Magic Word: {{CURRENTDAY2}}
9650 !! wikitext
9651 {{CURRENTDAY2}}
9652 !! html
9653 <p>01
9654 </p>
9655 !! end
9656
9657 !! test
9658 Magic Word: {{CURRENTDAYNAME}}
9659 !! wikitext
9660 {{CURRENTDAYNAME}}
9661 !! html
9662 <p>Thursday
9663 </p>
9664 !! end
9665
9666 !! test
9667 Magic Word: {{CURRENTDOW}}
9668 !! wikitext
9669 {{CURRENTDOW}}
9670 !! html
9671 <p>4
9672 </p>
9673 !! end
9674
9675 !! test
9676 Magic Word: {{CURRENTMONTH}}
9677 !! wikitext
9678 {{CURRENTMONTH}}
9679 !! html
9680 <p>01
9681 </p>
9682 !! end
9683
9684 !! test
9685 Magic Word: {{CURRENTMONTH1}}
9686 !! wikitext
9687 {{CURRENTMONTH1}}
9688 !! html
9689 <p>1
9690 </p>
9691 !! end
9692
9693 !! test
9694 Magic Word: {{CURRENTMONTHABBREV}}
9695 !! wikitext
9696 {{CURRENTMONTHABBREV}}
9697 !! html
9698 <p>Jan
9699 </p>
9700 !! end
9701
9702 !! test
9703 Magic Word: {{CURRENTMONTHNAME}}
9704 !! wikitext
9705 {{CURRENTMONTHNAME}}
9706 !! html
9707 <p>January
9708 </p>
9709 !! end
9710
9711 !! test
9712 Magic Word: {{CURRENTMONTHNAMEGEN}}
9713 !! wikitext
9714 {{CURRENTMONTHNAMEGEN}}
9715 !! html
9716 <p>January
9717 </p>
9718 !! end
9719
9720 !! test
9721 Magic Word: {{CURRENTTIME}}
9722 !! wikitext
9723 {{CURRENTTIME}}
9724 !! html
9725 <p>00:02
9726 </p>
9727 !! end
9728
9729 !! test
9730 Magic Word: {{CURRENTHOUR}}
9731 !! wikitext
9732 {{CURRENTHOUR}}
9733 !! html
9734 <p>00
9735 </p>
9736 !! end
9737
9738 !! test
9739 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9740 !! wikitext
9741 {{CURRENTWEEK}}
9742 !! html
9743 <p>1
9744 </p>
9745 !! end
9746
9747 !! test
9748 Magic Word: {{CURRENTYEAR}}
9749 !! wikitext
9750 {{CURRENTYEAR}}
9751 !! html
9752 <p>1970
9753 </p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{CURRENTTIMESTAMP}}
9758 !! wikitext
9759 {{CURRENTTIMESTAMP}}
9760 !! html
9761 <p>19700101000203
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Words LOCAL (UTC)
9767 !! wikitext
9768 * {{LOCALMONTH}}
9769 * {{LOCALMONTH1}}
9770 * {{LOCALMONTHNAME}}
9771 * {{LOCALMONTHNAMEGEN}}
9772 * {{LOCALMONTHABBREV}}
9773 * {{LOCALDAY}}
9774 * {{LOCALDAY2}}
9775 * {{LOCALDAYNAME}}
9776 * {{LOCALYEAR}}
9777 * {{LOCALTIME}}
9778 * {{LOCALHOUR}}
9779 * {{LOCALWEEK}}
9780 * {{LOCALDOW}}
9781 * {{LOCALTIMESTAMP}}
9782 !! html
9783 <ul><li> 01</li>
9784 <li> 1</li>
9785 <li> January</li>
9786 <li> January</li>
9787 <li> Jan</li>
9788 <li> 1</li>
9789 <li> 01</li>
9790 <li> Thursday</li>
9791 <li> 1970</li>
9792 <li> 00:02</li>
9793 <li> 00</li>
9794 <li> 1</li>
9795 <li> 4</li>
9796 <li> 19700101000203</li></ul>
9797
9798 !! end
9799
9800 !! test
9801 Magic Word: {{FULLPAGENAME}}
9802 !! options
9803 title=[[User:Ævar Arnfjörð Bjarmason]]
9804 !! wikitext
9805 {{FULLPAGENAME}}
9806 !! html
9807 <p>User:Ævar Arnfjörð Bjarmason
9808 </p>
9809 !! end
9810
9811 !! test
9812 Magic Word: {{FULLPAGENAMEE}}
9813 !! options
9814 title=[[User:Ævar Arnfjörð Bjarmason]]
9815 !! wikitext
9816 {{FULLPAGENAMEE}}
9817 !! html
9818 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9819 </p>
9820 !! end
9821
9822 !! test
9823 Magic Word: {{TALKSPACE}}
9824 !! options
9825 title=[[User:Ævar Arnfjörð Bjarmason]]
9826 !! wikitext
9827 {{TALKSPACE}}
9828 !! html
9829 <p>User talk
9830 </p>
9831 !! end
9832
9833 !! test
9834 Magic Word: {{TALKSPACE}}, same namespace
9835 !! options
9836 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9837 !! wikitext
9838 {{TALKSPACE}}
9839 !! html
9840 <p>User talk
9841 </p>
9842 !! end
9843
9844 !! test
9845 Magic Word: {{TALKSPACE}}, main namespace
9846 !! options
9847 title=[[Parser Test]]
9848 !! wikitext
9849 {{TALKSPACE}}
9850 !! html
9851 <p>Talk
9852 </p>
9853 !! end
9854
9855 !! test
9856 Magic Word: {{TALKSPACEE}}
9857 !! options
9858 title=[[User:Ævar Arnfjörð Bjarmason]]
9859 !! wikitext
9860 {{TALKSPACEE}}
9861 !! html
9862 <p>User_talk
9863 </p>
9864 !! end
9865
9866 !! test
9867 Magic Word: {{SUBJECTSPACE}}
9868 !! options
9869 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9870 !! wikitext
9871 {{SUBJECTSPACE}}
9872 !! html
9873 <p>User
9874 </p>
9875 !! end
9876
9877 !! test
9878 Magic Word: {{SUBJECTSPACE}}, same namespace
9879 !! options
9880 title=[[User:Ævar Arnfjörð Bjarmason]]
9881 !! wikitext
9882 {{SUBJECTSPACE}}
9883 !! html
9884 <p>User
9885 </p>
9886 !! end
9887
9888 !! test
9889 Magic Word: {{SUBJECTSPACE}}, main namespace
9890 !! options
9891 title=[[Parser Test]]
9892 !! wikitext
9893 {{SUBJECTSPACE}}
9894 !! html
9895
9896 !! end
9897
9898 !! test
9899 Magic Word: {{SUBJECTSPACEE}}
9900 !! options
9901 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9902 !! wikitext
9903 {{SUBJECTSPACEE}}
9904 !! html
9905 <p>User
9906 </p>
9907 !! end
9908
9909 !! test
9910 Magic Word: {{NAMESPACE}}
9911 !! options
9912 title=[[User:Ævar Arnfjörð Bjarmason]]
9913 !! wikitext
9914 {{NAMESPACE}}
9915 !! html
9916 <p>User
9917 </p>
9918 !! end
9919
9920 !! test
9921 Magic Word: {{NAMESPACEE}}
9922 !! options
9923 title=[[User:Ævar Arnfjörð Bjarmason]]
9924 !! wikitext
9925 {{NAMESPACEE}}
9926 !! html
9927 <p>User
9928 </p>
9929 !! end
9930
9931 !! test
9932 Magic Word: {{NAMESPACENUMBER}}
9933 !! options
9934 title=[[User:Ævar Arnfjörð Bjarmason]]
9935 !! wikitext
9936 {{NAMESPACENUMBER}}
9937 !! html
9938 <p>2
9939 </p>
9940 !! end
9941
9942 !! test
9943 Magic Word: {{SUBPAGENAME}}
9944 !! options
9945 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9946 !! wikitext
9947 {{SUBPAGENAME}}
9948 !! html
9949 <p>sub ö
9950 </p>
9951 !! end
9952
9953 !! test
9954 Magic Word: {{SUBPAGENAMEE}}
9955 !! options
9956 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9957 !! wikitext
9958 {{SUBPAGENAMEE}}
9959 !! html
9960 <p>sub_%C3%B6
9961 </p>
9962 !! end
9963
9964 !! test
9965 Magic Word: {{ROOTPAGENAME}}
9966 !! options
9967 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9968 !! wikitext
9969 {{ROOTPAGENAME}}
9970 !! html
9971 <p>Ævar Arnfjörð Bjarmason
9972 </p>
9973 !! end
9974
9975 !! test
9976 Magic Word: {{ROOTPAGENAMEE}}
9977 !! options
9978 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9979 !! wikitext
9980 {{ROOTPAGENAMEE}}
9981 !! html
9982 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9983 </p>
9984 !! end
9985
9986 !! test
9987 Magic Word: {{BASEPAGENAME}}
9988 !! options
9989 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9990 !! wikitext
9991 {{BASEPAGENAME}}
9992 !! html
9993 <p>Ævar Arnfjörð Bjarmason
9994 </p>
9995 !! end
9996
9997 !! test
9998 Magic Word: {{BASEPAGENAMEE}}
9999 !! options
10000 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10001 !! wikitext
10002 {{BASEPAGENAMEE}}
10003 !! html
10004 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10005 </p>
10006 !! end
10007
10008 !! test
10009 Magic Word: {{TALKPAGENAME}}
10010 !! options
10011 title=[[User:Ævar Arnfjörð Bjarmason]]
10012 !! wikitext
10013 {{TALKPAGENAME}}
10014 !! html
10015 <p>User talk:Ævar Arnfjörð Bjarmason
10016 </p>
10017 !! end
10018
10019 !! test
10020 Magic Word: {{TALKPAGENAMEE}}
10021 !! options
10022 title=[[User:Ævar Arnfjörð Bjarmason]]
10023 !! wikitext
10024 {{TALKPAGENAMEE}}
10025 !! html
10026 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10027 </p>
10028 !! end
10029
10030 !! test
10031 Magic Word: {{SUBJECTPAGENAME}}
10032 !! options
10033 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10034 !! wikitext
10035 {{SUBJECTPAGENAME}}
10036 !! html
10037 <p>User:Ævar Arnfjörð Bjarmason
10038 </p>
10039 !! end
10040
10041 !! test
10042 Magic Word: {{SUBJECTPAGENAMEE}}
10043 !! options
10044 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10045 !! wikitext
10046 {{SUBJECTPAGENAMEE}}
10047 !! html
10048 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10049 </p>
10050 !! end
10051
10052 !! test
10053 Magic Word: {{NUMBEROFFILES}}
10054 !! wikitext
10055 {{NUMBEROFFILES}}
10056 !! html
10057 <p>7
10058 </p>
10059 !! end
10060
10061 !! test
10062 Magic Word: {{PAGENAME}}
10063 !! options
10064 title=[[User:Ævar Arnfjörð Bjarmason]]
10065 !! wikitext
10066 {{PAGENAME}}
10067 !! html
10068 <p>Ævar Arnfjörð Bjarmason
10069 </p>
10070 !! end
10071
10072 !! test
10073 Magic Word: {{PAGENAME}} with metacharacters
10074 !! options
10075 title=[['foo & bar = baz']]
10076 !! wikitext
10077 ''{{PAGENAME}}''
10078 !! html/php
10079 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10080 </p>
10081 !! html+tidy
10082 <p><i>'foo &amp; bar = baz'</i></p>
10083 !! end
10084
10085 !! test
10086 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10087 !! options
10088 title=[[*RFC 1234 http://example.com/]]
10089 !! wikitext
10090 {{PAGENAME}}
10091 !! html/php
10092 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10093 </p>
10094 !! html+tidy
10095 <p>*RFC 1234 http://example.com/</p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{PAGENAMEE}}
10100 !! options
10101 title=[[User:Ævar Arnfjörð Bjarmason]]
10102 !! wikitext
10103 {{PAGENAMEE}}
10104 !! html
10105 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10106 </p>
10107 !! end
10108
10109 !! test
10110 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10111 !! options
10112 title=[[*RFC 1234 http://example.com/]]
10113 !! wikitext
10114 {{PAGENAMEE}}
10115 !! html/php
10116 <p>&#42;RFC_1234_http&#58;//example.com/
10117 </p>
10118 !! html+tidy
10119 <p>*RFC_1234_http://example.com/</p>
10120 !! end
10121
10122 !! test
10123 Magic Word: {{REVISIONID}}
10124 !! wikitext
10125 {{REVISIONID}}
10126 !! html
10127 <p>1337
10128 </p>
10129 !! end
10130
10131 !! test
10132 Magic Word: {{SCRIPTPATH}}
10133 !! wikitext
10134 {{SCRIPTPATH}}
10135 !! html
10136
10137 !! end
10138
10139 !! test
10140 Magic Word: {{STYLEPATH}}
10141 !! wikitext
10142 {{STYLEPATH}}
10143 !! html
10144 <p>/skins
10145 </p>
10146 !! end
10147
10148 !! test
10149 Magic Word: {{SERVER}}
10150 !! wikitext
10151 {{SERVER}}
10152 !! html
10153 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10154 </p>
10155 !! end
10156
10157 !! test
10158 Magic Word: {{SERVERNAME}}
10159 !! wikitext
10160 {{SERVERNAME}}
10161 !! html
10162 <p>example.org
10163 </p>
10164 !! end
10165
10166 !! test
10167 Magic Word: {{SITENAME}}
10168 !! wikitext
10169 {{SITENAME}}
10170 !! html
10171 <p>MediaWiki
10172 </p>
10173 !! end
10174
10175 !! test
10176 Case-sensitive magic words, when cased differently, should just be template transclusions
10177 !! wikitext
10178 {{CurrentMonth}}
10179 {{currentday}}
10180 {{cURreNTweEK}}
10181 {{currentHour}}
10182 !! html
10183 <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>
10184 <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>
10185 <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>
10186 <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>
10187 </p>
10188 !! end
10189
10190 !! test
10191 Case-insensitive magic words should still work with weird casing.
10192 !! wikitext
10193 {{sErVeRNaMe}}
10194 {{LCFirst:AOEU}}
10195 {{ucFIRST:aoeu}}
10196 {{SERver}}
10197 !! html
10198 <p>example.org
10199 aOEU
10200 Aoeu
10201 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10202 </p>
10203 !! end
10204
10205 # From plwiki:PLOS_ONE
10206 !! test
10207 Parsoid: Page property magic word with magic word contents
10208 !! wikitext
10209 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10210 !! html/parsoid
10211 <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>"}]]}'/>
10212 !! end
10213
10214 !! test
10215 Parsoid: Template-generated DISPLAYTITLE
10216 !! wikitext
10217 {{{{echo|DISPLAYTITLE}}:Foo}}
10218 !! html/parsoid
10219 <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}}]}'/>
10220 !! end
10221
10222 !! test
10223 Namespace 1 {{ns:1}}
10224 !! wikitext
10225 {{ns:1}}
10226 !! html
10227 <p>Talk
10228 </p>
10229 !! end
10230
10231 !! test
10232 Namespace 1 {{ns:01}}
10233 !! wikitext
10234 {{ns:01}}
10235 !! html
10236 <p>Talk
10237 </p>
10238 !! end
10239
10240 !! test
10241 Namespace 0 {{ns:0}} (bug 4783)
10242 !! wikitext
10243 {{ns:0}}
10244 !! html
10245
10246 !! end
10247
10248 !! test
10249 Namespace 0 {{ns:00}} (bug 4783)
10250 !! wikitext
10251 {{ns:00}}
10252 !! html
10253
10254 !! end
10255
10256 !! test
10257 Namespace -1 {{ns:-1}}
10258 !! wikitext
10259 {{ns:-1}}
10260 !! html
10261 <p>Special
10262 </p>
10263 !! end
10264
10265 !! test
10266 Namespace User {{ns:User}}
10267 !! wikitext
10268 {{ns:User}}
10269 !! html
10270 <p>User
10271 </p>
10272 !! end
10273
10274 !! test
10275 Namespace User talk {{ns:User_talk}}
10276 !! wikitext
10277 {{ns:User_talk}}
10278 !! html
10279 <p>User talk
10280 </p>
10281 !! end
10282
10283 !! test
10284 Namespace User talk {{ns:uSeR tAlK}}
10285 !! wikitext
10286 {{ns:uSeR tAlK}}
10287 !! html
10288 <p>User talk
10289 </p>
10290 !! end
10291
10292 !! test
10293 Namespace File {{ns:File}}
10294 !! wikitext
10295 {{ns:File}}
10296 !! html
10297 <p>File
10298 </p>
10299 !! end
10300
10301 !! test
10302 Namespace File {{ns:Image}}
10303 !! wikitext
10304 {{ns:Image}}
10305 !! html
10306 <p>File
10307 </p>
10308 !! end
10309
10310 !! test
10311 Namespace (lang=de) Benutzer {{ns:User}}
10312 !! options
10313 language=de
10314 !! wikitext
10315 {{ns:User}}
10316 !! html
10317 <p>Benutzer
10318 </p>
10319 !! end
10320
10321 !! test
10322 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10323 !! options
10324 language=de
10325 !! wikitext
10326 {{ns:3}}
10327 !! html
10328 <p>Benutzer Diskussion
10329 </p>
10330 !! end
10331
10332
10333 !! test
10334 Urlencode
10335 !! wikitext
10336 {{urlencode:hi world?!}}
10337 {{urlencode:hi world?!|WIKI}}
10338 {{urlencode:hi world?!|PATH}}
10339 {{urlencode:hi world?!|QUERY}}
10340 !! html
10341 <p>hi+world%3F%21
10342 hi_world%3F!
10343 hi%20world%3F%21
10344 hi+world%3F%21
10345 </p>
10346 !! end
10347
10348 !! test
10349 Magic Word: prioritize type info over data-parsoid
10350 !! options
10351 parsoid=html2wt
10352 !! html/parsoid
10353 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10354 !! wikitext
10355 __FORCETOC__
10356 !! end
10357
10358 !! test
10359 Magic Word: serialize on separate line (parsoid)
10360 !! options
10361 parsoid=wt2wt,html2wt
10362 !! wikitext
10363 foo
10364 __NOTOC__
10365 bar
10366 !! html/parsoid
10367 foo<meta property="mw:PageProp/notoc"/>bar
10368 !! end
10369
10370 !! test
10371 Magic Word: rt non-english wikis
10372 !! options
10373 parsoid=wt2wt
10374 language=de
10375 !! wikitext
10376 __NOEDITSECTION__
10377 !! html/parsoid
10378 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10379 !! end
10380
10381 !!test
10382 __proto__ is treated as normal wikitext (T105997)
10383 !!wikitext
10384 __proto__
10385 !!html
10386 <p>__proto__
10387 </p>
10388 !!end
10389
10390 ###
10391 ### Magic links
10392 ###
10393 !! test
10394 Magic links: internal link to RFC (bug 479)
10395 !! wikitext
10396 [[RFC 123]]
10397 !! html/php
10398 <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>
10399 </p>
10400 !! html/parsoid
10401 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10402 !! end
10403
10404 !! test
10405 Magic links: RFC (bug 479)
10406 !! wikitext
10407 RFC 822
10408 !! html/php
10409 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10410 </p>
10411 !! html/parsoid
10412 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10413 !! end
10414
10415 !! test
10416 Magic links: RFC (bug 65278)
10417 !! wikitext
10418 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10419 !! html/php
10420 <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.
10421 </p>
10422 !! html/parsoid
10423 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10424 !! end
10425
10426 !! test
10427 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10428 !! wikitext
10429 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10430 RFC
10431 822
10432 !! html/php
10433 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10434 RFC
10435 822
10436 </p>
10437 !! html/parsoid
10438 <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>
10439 RFC
10440 822</p>
10441 !! end
10442
10443 !! test
10444 Magic links: ISBN (bug 1937)
10445 !! wikitext
10446 ISBN 0-306-40615-2
10447 !! html/php
10448 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10449 </p>
10450 !! html/parsoid
10451 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10452 !! end
10453
10454 !! test
10455 Magic links: ISBN (bug 65278)
10456 !! wikitext
10457 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10458 !! html/php
10459 <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.
10460 </p>
10461 !! html/parsoid
10462 <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>
10463 !! end
10464
10465 !! test
10466 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10467 !! wikitext
10468 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10469 ISBN
10470 9780316098113
10471 ISBN 978
10472 0316098113
10473 !! html/php
10474 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10475 ISBN
10476 9780316098113
10477 ISBN 978
10478 0316098113
10479 </p>
10480 !! html/parsoid
10481 <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>
10482 ISBN
10483 9780316098113
10484 ISBN 978
10485 0316098113</p>
10486 !! end
10487
10488 !! test
10489 Magic links: PMID incorrectly converts space to underscore
10490 !! wikitext
10491 PMID 1234
10492 !! html/php
10493 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10494 </p>
10495 !! html/parsoid
10496 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10497 !! end
10498
10499 !! test
10500 Magic links: PMID (bug 65278)
10501 !! wikitext
10502 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10503 !! html/php
10504 <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.
10505 </p>
10506 !! html/parsoid
10507 <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>
10508 !! end
10509
10510 !! test
10511 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10512 !! wikitext
10513 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10514 PMID
10515 1234
10516 !! html/php
10517 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10518 PMID
10519 1234
10520 </p>
10521 !! html/parsoid
10522 <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>
10523 PMID
10524 1234</p>
10525 !! end
10526
10527 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10528 # since these are ExtLinkText, not MagicLinkText
10529 !! test
10530 Magic links: use appropriate serialization for "almost" magic links.
10531 !! wikitext
10532 X[[Special:BookSources/0978739256|foo]]
10533
10534 X[//tools.ietf.org/html/rfc1234 foo]
10535 !! html/php
10536 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10537 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10538 </p>
10539 !! html/parsoid
10540 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10541 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10542 !! end
10543
10544 ###
10545 ### Templates
10546 ####
10547
10548 !! test
10549 Nonexistent template
10550 !! wikitext
10551 {{thistemplatedoesnotexist}}
10552 !! html
10553 <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>
10554 </p>
10555 !! end
10556
10557 !! test
10558 Template with invalid target containing tags
10559 !! wikitext
10560 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10561 !! html
10562 <p>{{a<b>b</b>|foo|a=b|a = b}}
10563 </p>
10564 !! end
10565
10566 !! test
10567 Template with invalid target containing unclosed tag
10568 !! wikitext
10569 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10570 !! html
10571 <p>{{a<b>|foo|a=b|a = b}}</b>
10572 </p>
10573 !! end
10574
10575 !! test
10576 Template with invalid target containing wikilink
10577 !! wikitext
10578 {{[[Main Page]]}}
10579 !! html/php
10580 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10581 </p>
10582 !! html/parsoid
10583 <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>
10584 !! end
10585
10586 !! test
10587 Template with just whitespace in it, bug #68421
10588 !! wikitext
10589 {{echo|{{ }}}}
10590 !! html/parsoid
10591 <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>
10592 !! end
10593
10594 !! article
10595 Template:test
10596 !! text
10597 This is a test template
10598 !! endarticle
10599
10600 !! test
10601 Simple template
10602 !! wikitext
10603 {{test}}
10604 !! html
10605 <p>This is a test template
10606 </p>
10607 !! end
10608
10609 !! test
10610 Template with explicit namespace
10611 !! wikitext
10612 {{Template:test}}
10613 !! html
10614 <p>This is a test template
10615 </p>
10616 !! end
10617
10618
10619 !! article
10620 Template:paramtest
10621 !! text
10622 This is a test template with parameter {{{param}}}
10623 !! endarticle
10624
10625 !! test
10626 Template parameter
10627 !! wikitext
10628 {{paramtest|param=foo}}
10629 !! html
10630 <p>This is a test template with parameter foo
10631 </p>
10632 !! end
10633
10634 !! article
10635 Template:paramtestnum
10636 !! text
10637 [[{{{1}}}|{{{2}}}]]
10638 !! endarticle
10639
10640 !! test
10641 Template unnamed parameter
10642 !! wikitext
10643 {{paramtestnum|Main Page|the main page}}
10644 !! html
10645 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10646 </p>
10647 !! end
10648
10649 !! article
10650 Template:templatesimple
10651 !! text
10652 (test)
10653 !! endarticle
10654
10655 !! article
10656 Template:templateredirect
10657 !! text
10658 #redirect [[Template:templatesimple]]
10659 !! endarticle
10660
10661 !! article
10662 Template:templateasargtestnum
10663 !! text
10664 {{{{{1}}}}}
10665 !! endarticle
10666
10667 !! article
10668 Template:templateasargtest
10669 !! text
10670 {{template{{{templ}}}}}
10671 !! endarticle
10672
10673 !! article
10674 Template:templateasargtest2
10675 !! text
10676 {{{{{templ}}}}}
10677 !! endarticle
10678
10679 !! test
10680 Template with template name as unnamed argument
10681 !! wikitext
10682 {{templateasargtestnum|templatesimple}}
10683 !! html
10684 <p>(test)
10685 </p>
10686 !! end
10687
10688 !! test
10689 Template with template name as argument
10690 !! wikitext
10691 {{templateasargtest|templ=simple}}
10692 !! html
10693 <p>(test)
10694 </p>
10695 !! end
10696
10697 !! test
10698 Template with template name as argument (2)
10699 !! wikitext
10700 {{templateasargtest2|templ=templatesimple}}
10701 !! html
10702 <p>(test)
10703 </p>
10704 !! end
10705
10706 !! article
10707 Template:templateasargtestdefault
10708 !! text
10709 {{{{{templ|templatesimple}}}}}
10710 !! endarticle
10711
10712 !! article
10713 Template:templa
10714 !! text
10715 '''templ'''
10716 !! endarticle
10717
10718 !! test
10719 Template with default value
10720 !! wikitext
10721 {{templateasargtestdefault}}
10722 !! html
10723 <p>(test)
10724 </p>
10725 !! end
10726
10727 !! test
10728 Template with default value (value set)
10729 !! wikitext
10730 {{templateasargtestdefault|templ=templa}}
10731 !! html
10732 <p><b>templ</b>
10733 </p>
10734 !! end
10735
10736 !! test
10737 Template redirect
10738 !! wikitext
10739 {{templateredirect}}
10740 !! html/php
10741 <p>(test)
10742 </p>
10743 !! html/parsoid
10744 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10745 !! end
10746
10747 !! test
10748 Template with argument in separate line
10749 !! wikitext
10750 {{ templateasargtest |
10751 templ = simple }}
10752 !! html
10753 <p>(test)
10754 </p>
10755 !! end
10756
10757 !! test
10758 Template with complex template as argument
10759 !! wikitext
10760 {{paramtest|
10761 param ={{ templateasargtest |
10762 templ = simple }}}}
10763 !! html
10764 <p>This is a test template with parameter (test)
10765 </p>
10766 !! end
10767
10768 !! test
10769 Template with thumb image (with link in description)
10770 !! wikitext
10771 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10772 !! html/php
10773 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>
10774
10775 !! html+tidy
10776 <p>This is a test template with parameter</p>
10777 <div class="thumb tright">
10778 <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>
10779 <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>
10780 </div>
10781 </div>
10782 !! html/parsoid
10783 <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>
10784 !! end
10785
10786 !! article
10787 Template:complextemplate
10788 !! text
10789 {{{1}}} {{paramtest|
10790 param ={{{param}}}}}
10791 !! endarticle
10792
10793 !! test
10794 Template with complex arguments
10795 !! wikitext
10796 {{complextemplate|
10797 param ={{ templateasargtest |
10798 templ = simple }}|[[Template:complextemplate|link]]}}
10799 !! html
10800 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10801 </p>
10802 !! end
10803
10804 !! test
10805 BUG 553: link with two variables in a piped link
10806 !! wikitext
10807 {|
10808 |[[{{{1}}}|{{{2}}}]]
10809 |}
10810 !! html/php
10811 <table>
10812 <tr>
10813 <td>[[{{{1}}}|{{{2}}}]]
10814 </td></tr></table>
10815
10816 !! html/parsoid
10817 <table>
10818 <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>
10819 !! end
10820
10821 # See: T2553
10822 !! test
10823 Abort table cell attribute parsing on wikilink
10824 !! wikitext
10825 {|
10826 | testing [[one|two]] | three || four
10827 | testing one two | three || four
10828 | testing="[[one|two]]" | three || four
10829 |}
10830 !! html/php
10831 <table>
10832 <tr>
10833 <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>
10834 <td> four
10835 </td>
10836 <td> three </td>
10837 <td> four
10838 </td>
10839 <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>
10840 <td> four
10841 </td></tr></table>
10842
10843 !! html/parsoid
10844 <table>
10845 <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>
10846 <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>
10847 <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>
10848 </tbody></table>
10849 !! end
10850
10851 !! test
10852 Don't abort table cell attribute parsing if wikilink is found in template arg
10853 !! wikitext
10854 {|
10855 | Test {{#tag:ref|One two "[[three]]" four}}
10856 |}
10857 !! html/parsoid
10858 <table>
10859 <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>
10860 </tbody></table>
10861 !! end
10862
10863 !! test
10864 Magic variable as template parameter
10865 !! wikitext
10866 {{paramtest|param={{SITENAME}}}}
10867 !! html
10868 <p>This is a test template with parameter MediaWiki
10869 </p>
10870 !! end
10871
10872 !! article
10873 Template:linktest
10874 !! text
10875 [[{{{param}}}|link]]
10876 !! endarticle
10877
10878 !! test
10879 Template parameter as link source
10880 !! wikitext
10881 {{linktest|param=Main Page}}
10882 !! html
10883 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10884 </p>
10885 !! end
10886
10887 !!article
10888 Template:paramtest2
10889 !! text
10890 including another template, {{paramtest|param={{{arg}}}}}
10891 !! endarticle
10892
10893 !! test
10894 Template passing argument to another template
10895 !! wikitext
10896 {{paramtest2|arg='hmm'}}
10897 !! html
10898 <p>including another template, This is a test template with parameter 'hmm'
10899 </p>
10900 !! end
10901
10902 !! article
10903 Template:Linktest2
10904 !! text
10905 Main Page
10906 !! endarticle
10907
10908 !! test
10909 Template as link source
10910 !! wikitext
10911 [[{{linktest2}}]]
10912
10913 [[{{linktest2}}|Main Page]]
10914
10915 [[{{linktest2}}]]Page
10916 !! html
10917 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10918 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10919 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10920 </p>
10921 !! end
10922
10923
10924 !! article
10925 Template:loop1
10926 !! text
10927 {{loop2}}
10928 !! endarticle
10929
10930 !! article
10931 Template:loop2
10932 !! text
10933 {{loop1}}
10934 !! endarticle
10935
10936 !! test
10937 Template infinite loop
10938 !! wikitext
10939 {{loop1}}
10940 !! html
10941 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10942 </p>
10943 !! end
10944
10945 !! test
10946 Template from main namespace
10947 !! wikitext
10948 {{:Main Page}}
10949 !! html
10950 <p>blah blah
10951 </p>
10952 !! end
10953
10954 !! article
10955 Template:table
10956 !! text
10957 {|
10958 | 1 || 2
10959 |-
10960 | 3 || 4
10961 |}
10962 !! endarticle
10963
10964 !! test
10965 BUG 529: Template with table, not included at beginning of line
10966 !! wikitext
10967 foo {{table}}
10968 !! html
10969 <p>foo
10970 </p>
10971 <table>
10972 <tr>
10973 <td> 1 </td>
10974 <td> 2
10975 </td></tr>
10976 <tr>
10977 <td> 3 </td>
10978 <td> 4
10979 </td></tr></table>
10980
10981 !! end
10982
10983 !! test
10984 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10985 !! wikitext
10986 foo
10987 {{table}}
10988 !! html
10989 <p>foo
10990 </p>
10991 <table>
10992 <tr>
10993 <td> 1 </td>
10994 <td> 2
10995 </td></tr>
10996 <tr>
10997 <td> 3 </td>
10998 <td> 4
10999 </td></tr></table>
11000
11001 !! end
11002
11003 !! test
11004 BUG 41: Template parameters shown as broken links
11005 !! wikitext
11006 {{{parameter}}}
11007 !! html
11008 <p>{{{parameter}}}
11009 </p>
11010 !! end
11011
11012 !! test
11013 Template with targets containing wikilinks
11014 !! wikitext
11015 {{[[foo]]}}
11016
11017 {{[[{{echo|foo}}]]}}
11018
11019 {{{{echo|[[foo}}]]}}
11020 !! html
11021 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11022 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11023 </p><p>{{[[foo}}]]
11024 </p>
11025 !! end
11026
11027 !! article
11028 Template:''
11029 !! text
11030 bar
11031 !! endarticle
11032
11033 !! test
11034 Templates: Double quotes as template target
11035 !! wikitext
11036 foo {{''}} baz
11037 !! html/php
11038 <p>foo bar baz
11039 </p>
11040 !! html/parsoid
11041 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11042 </p>
11043 !! end
11044
11045 ## This test is about making sure Parsoid's data-mw is well formed in the
11046 ## face of multiple templates with intersecting and overlapping ranges. The
11047 ## wikitext itself is wretched.
11048 !! test
11049 Templates with intersecting and overlapping ranges
11050 !! wikitext
11051 {|{{echo|
11052 <p>ha</p>}}
11053 {|{{echo|
11054 <p>ho</p>}}
11055 {{echo|{{!}}hi}}
11056 |}
11057 !! html/php+tidy
11058 <p>ha</p>
11059 <p>ho</p>
11060 <table>
11061 <tr>
11062 <td></td>
11063 </tr>
11064 <tr>
11065 <td>hi</td>
11066 </tr>
11067 </table>
11068 <table>
11069 <tr>
11070 <td></td>
11071 </tr>
11072 </table>
11073 !! html/parsoid
11074 <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":""}]]}'>
11075
11076 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11077
11078 <tbody><tr><td>hi</td></tr>
11079 </tbody></table>
11080 !! end
11081
11082 !! article
11083 Template:MSGNW test
11084 !! text
11085 ''None'' of '''this''' should be
11086 * interpreted
11087 but rather passed unmodified
11088 {{test}}
11089 <gallery>
11090 File:Foobar.jpg
11091 </gallery>
11092 <!-- comment -->
11093 !! endarticle
11094
11095 # hmm, fix this or just deprecate msgnw and document its behavior?
11096 !! test
11097 msgnw keyword
11098 !! wikitext
11099 {{msgnw:MSGNW test}}
11100 !! html/php
11101 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11102 &#42; interpreted
11103 &#32;but rather passed unmodified
11104 &#123;&#123;test&#125;&#125;
11105 &#60;gallery&#62;
11106 File:Foobar.jpg
11107 &#60;/gallery&#62;
11108 &#60;!-- comment --&#62;
11109 </p>
11110 !! end
11111
11112 !! test
11113 int keyword
11114 !! wikitext
11115 {{int:youhavenewmessages|lots of money|not!}}
11116 !! html
11117 <p>You have lots of money (not!).
11118 </p>
11119 !! end
11120
11121 !! test
11122 int keyword - non-existing message
11123 !! wikitext
11124 {{int:var}}
11125 !! html
11126 <p>⧼var⧽
11127 </p>
11128 !! end
11129
11130 !! article
11131 Template:Includes
11132 !! text
11133 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11134 !! endarticle
11135
11136 !! test
11137 <includeonly> and <noinclude> being included
11138 !! wikitext
11139 {{Includes}}
11140 !! html
11141 <p>Foobar
11142 </p>
11143 !! end
11144
11145 !! article
11146 Template:Includes2
11147 !! text
11148 <onlyinclude>Foo</onlyinclude>bar
11149 !! endarticle
11150
11151 !! test
11152 <onlyinclude> being included
11153 !! wikitext
11154 {{Includes2}}
11155 !! html
11156 <p>Foo
11157 </p>
11158 !! end
11159
11160
11161 !! article
11162 Template:Includes3
11163 !! text
11164 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11165 !! endarticle
11166
11167 !! test
11168 <onlyinclude> and <includeonly> being included
11169 !! wikitext
11170 {{Includes3}}
11171 !! html
11172 <p>Foo
11173 </p>
11174 !! end
11175
11176 !! test
11177 <includeonly> and <noinclude> on a page
11178 !! wikitext
11179 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11180 !! html
11181 <p>Foozar
11182 </p>
11183 !! end
11184
11185 !! test
11186 Un-closed <noinclude>
11187 !! wikitext
11188 <noinclude>
11189 !! html
11190 !! end
11191
11192 !! test
11193 <onlyinclude> on a page
11194 !! wikitext
11195 <onlyinclude>Foo</onlyinclude>bar
11196 !! html
11197 <p>Foobar
11198 </p>
11199 !! end
11200
11201 !! test
11202 Un-closed <onlyinclude>
11203 !! wikitext
11204 <onlyinclude>
11205 !! html
11206 !! end
11207
11208 !!test
11209 Self-closed noinclude, includeonly, onlyinclude tags
11210 !! wikitext
11211 <noinclude />
11212 <includeonly />
11213 <onlyinclude />
11214 !! html
11215 <p><br />
11216 </p>
11217 !!end
11218
11219 !!test
11220 Unbalanced includeonly and noinclude tags
11221 !! wikitext
11222 {|
11223 |a</noinclude>
11224 |b</noinclude></noinclude>
11225 |c</noinclude></includeonly>
11226 |d</includeonly></includeonly>
11227 |}
11228 !! html
11229 <table>
11230 <tr>
11231 <td>a
11232 </td>
11233 <td>b
11234 </td>
11235 <td>c&lt;/includeonly&gt;
11236 </td>
11237 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11238 </td></tr></table>
11239
11240 !!end
11241
11242 !! article
11243 Template:Includeonly section
11244 !! text
11245 <includeonly>
11246 ==Includeonly section==
11247 </includeonly>
11248 ==Section T-1==
11249 !!endarticle
11250
11251 !! test
11252 Bug 6563: Edit link generation for section shown by <includeonly>
11253 !! wikitext
11254 {{includeonly section}}
11255 !! html
11256 <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>
11257 <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>
11258
11259 !! end
11260
11261 # Uses same input as the contents of [[Template:Includeonly section]]
11262 !! test
11263 Bug 6563: Section extraction for section shown by <includeonly>
11264 !! options
11265 section=T-2
11266 !! wikitext
11267 <includeonly>
11268 ==Includeonly section==
11269 </includeonly>
11270 ==Section T-2==
11271 !! html
11272 ==Section T-2==
11273 !! end
11274
11275 !! test
11276 Bug 6563: Edit link generation for section suppressed by <includeonly>
11277 !! wikitext
11278 <includeonly>
11279 ==Includeonly section==
11280 </includeonly>
11281 ==Section 1==
11282 !! html
11283 <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>
11284
11285 !! end
11286
11287 !! test
11288 Bug 6563: Section extraction for section suppressed by <includeonly>
11289 !! options
11290 section=1
11291 !! wikitext
11292 <includeonly>
11293 ==Includeonly section==
11294 </includeonly>
11295 ==Section 1==
11296 !! html
11297 ==Section 1==
11298 !! end
11299
11300 !! test
11301 Un-closed <includeonly>
11302 !! wikitext
11303 <includeonly>
11304 !! html/php
11305 !! html/parsoid
11306 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11307 !! end
11308
11309 ## We used to, but no longer wt2wt this test since the default serializer
11310 ## will normalize the include directives to serialize on their own line.
11311 ## Selser will take care of preserving formatting in scenarios where they
11312 ## intermingled with other wikitext.
11313 !! test
11314 Includes and comments at SOL
11315 !! options
11316 parsoid=wt2html,html2html
11317 !! wikitext
11318 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11319
11320 <noinclude>
11321 some
11322 </noinclude>* stuff
11323 * here
11324
11325 <includeonly>can have stuff</includeonly>=== here ===
11326
11327 !! html/php
11328 <h2><span class="mw-headline" id="hu">hu</span></h2>
11329 <p>some
11330 </p>
11331 <ul><li> stuff</li>
11332 <li> here</li></ul>
11333 <h3><span class="mw-headline" id="here">here</span></h3>
11334
11335 !! html/parsoid
11336 <!-- 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>
11337
11338 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11339 <p>some</p>
11340 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11341 <li> here</li></ul>
11342
11343 <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>
11344
11345 !! end
11346
11347 # TODO: test with DOM fragment reuse!
11348 !! test
11349 Parsoid: DOM fragment reuse
11350 !! options
11351 parsoid=wt2wt,wt2html
11352 !! wikitext
11353 a{{echo|b<table></table>c}}d
11354
11355 a{{echo|b
11356 <table></table>
11357 c}}d
11358
11359 {{echo|a
11360
11361 <table></table>
11362
11363 b}}
11364 !! html
11365 <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>
11366
11367 <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">
11368 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11369 </span><p about="#mwt2">cd</p>
11370
11371 <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">
11372
11373 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11374
11375 </span><p about="#mwt3">b</p>
11376 !! end
11377
11378 !! test
11379 Parsoid: Merge double tds (T52603)
11380 !! options
11381 parsoid
11382 !! wikitext
11383 {|
11384 |{{echo|{{!}} foo}}
11385 |}
11386 !! html
11387 <table><tbody>
11388 <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>
11389 </tbody></table>
11390 !! end
11391
11392 !! test
11393 Parsoid: Merge double tds in nested transclusion content (T52603)
11394 !! options
11395 parsoid
11396 !! wikitext
11397 {{echo|<div>}}
11398 {|
11399 |{{echo|{{!}} foo}}
11400 |}
11401 {{echo|</div>}}
11402 !! html
11403 <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}}]}'>
11404 <table><tbody>
11405 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11406 </tbody></table>
11407 </div>
11408 !! end
11409
11410 ###
11411 ### <includeonly> and <noinclude> in attributes
11412 ###
11413 !!test
11414 0. includeonly around the entire attribute
11415 !! wikitext
11416 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11417 !! html
11418 <p><span id="v2">bar</span>
11419 </p>
11420 !!end
11421
11422 !!test
11423 1. includeonly in html attr key
11424 !! wikitext
11425 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11426 !! html
11427 <p><span id="foo">bar</span>
11428 </p>
11429 !!end
11430
11431 !!test
11432 2. includeonly in html attr value
11433 !! wikitext
11434 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11435 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11436 !! html
11437 <p><span id="v1">bar</span>
11438 <span id="v1">bar</span>
11439 </p>
11440 !!end
11441
11442 !!test
11443 3. includeonly in part of an attr value
11444 !! wikitext
11445 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11446 !! html
11447 <p><span style="color:red;">bar</span>
11448 </p>
11449 !!end
11450
11451 !!test
11452 4. includeonly in table attributes
11453 !! wikitext
11454 {|
11455 |- <noinclude>
11456 |-
11457 |a
11458 </noinclude>
11459 |- <includeonly>
11460 |-
11461 |b
11462 </includeonly>
11463 |}
11464 !! html
11465 <table>
11466
11467
11468 <tr>
11469 <td>a
11470 </td></tr>
11471 </table>
11472
11473 !!end
11474
11475 ###
11476 ### Token Stream Patcher tests
11477 ###
11478 ### These tests won't always pass wt2wt and other modes because
11479 ### on serialization, the table will be output on a new line.
11480 ### For now, we are blacklisting them, and using this to test selser.
11481 ###
11482
11483 !!test
11484 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11485 !!options
11486 parsoid=wt2html,wt2wt
11487 !!wikitext
11488 {{echo|}}{| width = '100%'
11489 |foo
11490 |}
11491 !!html/parsoid
11492 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11493 <tbody><tr><td>foo</td></tr>
11494 </tbody></table>
11495 !!end
11496
11497 ## We used to, but no longer wt2wt this test since the default serializer
11498 ## will normalize the include directives to serialize on their own line.
11499 ## Selser will take care of preserving formatting in scenarios where they
11500 ## intermingled with other wikitext.
11501 !!test
11502 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11503 !!options
11504 parsoid=wt2html
11505 !!wikitext
11506 <includeonly>a</includeonly>{| {{{b}}}
11507 |c
11508 |}
11509 !!html/parsoid
11510 <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":""}]]}'>
11511 <tbody><tr><td>c</td></tr>
11512 </tbody></table>
11513 !!end
11514
11515 !! test
11516 Table wikitext syntax outside wiki-tables
11517 !! wikitext
11518 a
11519 |+ not a caption
11520 ! not a table heading
11521 |- not a table row
11522 | not a table cell
11523 | class="foo bar" | baz
11524 b
11525 |}
11526 |-
11527 c
11528 !! html
11529 <p>a
11530 |+ not a caption
11531 ! not a table heading
11532 |- not a table row
11533 | not a table cell
11534 | class="foo bar" | baz
11535 b
11536 |}
11537 |-
11538 c
11539 </p>
11540 !! end
11541
11542 ###
11543 ### Testing parsing of templates where a template arg
11544 ### has the same name as the template itself.
11545 ###
11546
11547 !! article
11548 Template:quote
11549 !! text
11550 {{{quote|{{{1}}}}}}
11551 !! endarticle
11552
11553 !!test
11554 Templates: Template Name/Arg clash: 1. Use of positional param
11555 !! wikitext
11556 {{quote|foo}}
11557 !! html
11558 <p>foo
11559 </p>
11560 !!end
11561
11562 !!test
11563 Templates: Template Name/Arg clash: 2. Use of named param
11564 !! wikitext
11565 {{quote|quote=foo}}
11566 !! html
11567 <p>foo
11568 </p>
11569 !!end
11570
11571 !!test
11572 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11573 !! wikitext
11574 {{quote|quote}}
11575 !! html
11576 <p>quote
11577 </p>
11578 !!end
11579
11580 ###
11581 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11582 ###
11583
11584 !!test
11585 Templates: 1. Simple use
11586 !! wikitext
11587 {{echo|Foo}}
11588 !! html
11589 <p>Foo
11590 </p>
11591 !!end
11592
11593 !!test
11594 Templates: 2. Inside a block tag
11595 !! wikitext
11596 <div>{{echo|Foo}}</div>
11597 <blockquote>{{echo|Foo}}</blockquote>
11598 !! html
11599 <div>Foo</div>
11600 <blockquote>Foo</blockquote>
11601
11602 !! html+tidy
11603 <div>Foo</div>
11604 <blockquote>
11605 <p>Foo</p>
11606 </blockquote>
11607 !!end
11608
11609 !!test
11610 Templates: P-wrapping: 1a. Templates on consecutive lines
11611 !! wikitext
11612 {{echo|Foo}}
11613 {{echo|bar}}
11614 !! html
11615 <p>Foo
11616 bar
11617 </p>
11618 !!end
11619
11620 !!test
11621 Templates: P-wrapping: 1b. Templates on consecutive lines
11622 !! wikitext
11623 Foo
11624
11625 {{echo|bar}}
11626 {{echo|baz}}
11627 !! html
11628 <p>Foo
11629 </p><p>bar
11630 baz
11631 </p>
11632 !!end
11633
11634 !!test
11635 Templates: P-wrapping: 1c. Templates on consecutive lines
11636 !! wikitext
11637 {{echo|Foo}}
11638 {{echo|bar}} <div>baz</div>
11639 !! html
11640 <p>Foo
11641 </p>
11642 bar <div>baz</div>
11643
11644 !! html+tidy
11645 <p>Foo</p>
11646 <p>bar</p>
11647 <div>baz</div>
11648 !! end
11649
11650 !!test
11651 Templates: P-wrapping: 1d. Template preceded by comment-only line
11652 !!options
11653 parsoid
11654 !! wikitext
11655 <!-- foo -->
11656 {{echo|Bar}}
11657 !! html
11658 <!-- foo -->
11659
11660 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11661 !!end
11662
11663 !!test
11664 Templates: Inline Text: 1. Multiple template uses
11665 !! wikitext
11666 {{echo|Foo}}bar{{echo|baz}}
11667 !! html
11668 <p>Foobarbaz
11669 </p>
11670 !!end
11671
11672 !!test
11673 Templates: Inline Text: 2. Back-to-back template uses
11674 !! wikitext
11675 {{echo|Foo}}{{echo|bar}}
11676 !! html
11677 <p>Foobar
11678 </p>
11679 !!end
11680
11681 !!test
11682 Templates: Block Tags: 1. Multiple template uses
11683 !! wikitext
11684 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11685 !! html
11686 <div>Foo</div><div>bar</div><div>baz</div>
11687
11688 !!end
11689
11690 !!test
11691 Templates: Block Tags: 2. Back-to-back template uses
11692 !! wikitext
11693 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11694 !! html
11695 <div>Foo</div><div>bar</div>
11696
11697 !!end
11698
11699 # This is an edge case relating to paragraph wrapping.
11700 !!test
11701 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11702 !! wikitext
11703 {{echo|a
11704 b</p>}}
11705 !! html/parsoid
11706 <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
11707 b</p>
11708 !!end
11709
11710 !!test
11711 Templates: Links: 1. Simple example
11712 !! wikitext
11713 {{echo|[[Foo|bar]]}}
11714 !! html
11715 <p><a href="/wiki/Foo" title="Foo">bar</a>
11716 </p>
11717 !!end
11718
11719 !!test
11720 Templates: Links: 2. Generation of link href
11721 !! wikitext
11722 [[{{echo|Foo}}|bar]]
11723 !! html
11724 <p><a href="/wiki/Foo" title="Foo">bar</a>
11725 </p>
11726 !!end
11727
11728 !!test
11729 Templates: Links: 3. Generation of part of a link href
11730 !! wikitext
11731 [[Fo{{echo|o}}|bar]]
11732
11733 [[Foo{{echo|bar}}]]
11734
11735 [[Foo{{echo|bar}}baz]]
11736
11737 [[Foo{{echo|bar}}|bar]]
11738
11739 [[:Foo{{echo|bar}}]]
11740
11741 [[:Foo{{echo|bar}}|bar]]
11742 !! html
11743 <p><a href="/wiki/Foo" title="Foo">bar</a>
11744 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11745 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11746 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11747 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11748 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11749 </p>
11750 !!end
11751
11752 !!test
11753 Templates: Links: 4. Multiple templates generating link href
11754 !! wikitext
11755 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11756 !! html
11757 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11758 </p>
11759 !!end
11760
11761 !!test
11762 Templates: Links: 5. Generation of link text
11763 !! wikitext
11764 [[Foo|{{echo|bar}}]]
11765 !! html
11766 <p><a href="/wiki/Foo" title="Foo">bar</a>
11767 </p>
11768 !!end
11769
11770 !!test
11771 Templates: Links: 5. Nested templates (only outermost template should be marked)
11772 !! wikitext
11773 {{echo|[[{{echo|Foo}}|bar]]}}
11774 !! html
11775 <p><a href="/wiki/Foo" title="Foo">bar</a>
11776 </p>
11777 !!end
11778
11779 !!test
11780 Templates: HTML Tag: 1. Generation of HTML attr. key
11781 !! wikitext
11782 <div {{echo|style}}="color:red;">foo</div>
11783 !! html
11784 <div style="color:red;">foo</div>
11785
11786 !!end
11787
11788 !!test
11789 Templates: HTML Tag: 2. Generation of HTML attr. value
11790 !! wikitext
11791 <div style={{echo|'color:red;'}}>foo</div>
11792 !! html
11793 <div style="color:red;">foo</div>
11794
11795 !!end
11796
11797 !!test
11798 Templates: HTML Tag: 3. Generation of HTML attr key and value
11799 !! wikitext
11800 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11801 !! html
11802 <div style="color:red;">foo</div>
11803
11804 !!end
11805
11806 !!test
11807 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11808 !! wikitext
11809 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11810 !! html
11811 <div title="This is a long title with just one piece templated">foo</div>
11812
11813 !!end
11814
11815 !!test
11816 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11817 !! wikitext
11818 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11819 !! html
11820 <div title="This is a long title with just one piece templated">foo</div>
11821
11822 !!end
11823
11824 !!test
11825 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11826 !! wikitext
11827 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11828 !! html
11829 <div title="This is a long title with just one piece templated">foo</div>
11830
11831 !!end
11832
11833 # SSS FIXME: While it is great we added support for all this,
11834 # do we want to make this part of the spec? Maybe we want to
11835 # deprecate this kind of usage in the future?
11836 !!test
11837 Templates: HTML Tag: 7. Generation of partial attribute key string
11838 !! wikitext
11839 <div st{{echo|yle}}="color:red;">foo</div>
11840 !! html
11841 <div style="color:red;">foo</div>
11842
11843 !!end
11844
11845 !! test
11846 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11847 !! wikitext
11848 <div {{echo|1=id="v1"}}>bar</div>
11849 !! html
11850 <div id="v1">bar</div>
11851
11852 !!end
11853
11854 !! test
11855 Templates: HTML Tag: 9. Multiple template-generated attributes
11856 !! wikitext
11857 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11858 !! html
11859 <div id="v1" title="foo">bar</div>
11860
11861 !!end
11862
11863 !! test
11864 Templates: Support for templates generating attributes and content
11865 !! wikitext
11866 {| {{mixed_attr_content_template}}
11867 |-
11868 |bar
11869 |}
11870 !! html/php
11871 <table style="color:red;" title="T48811">
11872
11873 <tr>
11874 <td>foo
11875 </td></tr>
11876 <tr>
11877 <td>bar
11878 </td></tr></table>
11879
11880 !! html/parsoid
11881 <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|}"]}'>
11882 <tbody><tr>
11883 <td>foo</td></tr>
11884 <tr>
11885 <td>bar</td></tr>
11886 </tbody></table>
11887 !!end
11888
11889 !! test
11890 1. Entities and nowikis inside templated attributes should be handled correctly
11891 !! wikitext
11892 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11893 !! html/php
11894 <div style="background:#f9f9f9;">foo</div>
11895
11896 !! html/parsoid
11897 <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>
11898 !! end
11899
11900 !! test
11901 2. Entities and nowikis inside templated attributes should be handled correctly
11902 !! wikitext
11903 {|
11904 |{{table_attribs_3}}
11905 |}
11906 !! html/php
11907 <table>
11908 <tr>
11909 <td style="background:#f9f9f9;">Foo
11910 </td></tr></table>
11911
11912 !! html/parsoid
11913 <table>
11914 <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>
11915 </tbody></table>
11916 !! end
11917
11918 !! test
11919 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11920 !! wikitext
11921 {{tbl-start}}
11922 |{{table_attribs_3}}
11923 {{tbl-end}}
11924 !! html/php
11925 <table>
11926 <tr>
11927 <td style="background:#f9f9f9;">Foo
11928 </td></tr></table>
11929
11930 !! html/parsoid
11931 <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}}]}'>
11932 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11933 </tbody></table>
11934 !! end
11935
11936 # T107622
11937 !! test
11938 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11939 !! wikitext
11940 {|
11941 | {{table_attribs_6}} hi
11942 |}
11943 !! html/php
11944 <table>
11945 <tr>
11946 <td style="background: red;"> hi
11947 </td></tr></table>
11948
11949 !! html/parsoid
11950 <table>
11951 <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>
11952 </tbody></table>
11953 !! end
11954
11955 !!test
11956 Templates: HTML Tables: 1. Generating start of a HTML table
11957 !! wikitext
11958 {{echo|<table><tr><td>foo</td>}}</tr></table>
11959 !! html
11960 <table><tr><td>foo</td></tr></table>
11961
11962 !!end
11963
11964 !!test
11965 Templates: HTML Tables: 2a. Generating middle of a HTML table
11966 !! wikitext
11967 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11968 !! html
11969 <table><tr><td>foo</td></tr></table>
11970
11971 !!end
11972
11973 !!test
11974 Templates: HTML Tables: 2b. Generating middle of a HTML table
11975 !! wikitext
11976 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11977 !! html
11978 <table><tr><td>foo</td></tr></table>
11979
11980 !!end
11981
11982 !!test
11983 Templates: HTML Tables: 3. Generating end of a HTML table
11984 !! wikitext
11985 <table><tr>{{echo|<td>foo</td></tr></table>}}
11986 !! html
11987 <table><tr><td>foo</td></tr></table>
11988
11989 !!end
11990
11991 !!test
11992 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11993 !! wikitext
11994 {{echo|<table>}}<tr><td>foo</td></tr></table>
11995 !! html
11996 <table><tr><td>foo</td></tr></table>
11997
11998 !!end
11999
12000 !!test
12001 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12002 !! wikitext
12003 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12004 !! html
12005 <table><tr><td>foo</td></tr></table>
12006
12007 !!end
12008
12009 !!test
12010 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12011 !! wikitext
12012 <table><tr>{{echo|<td>}}foo</td></tr></table>
12013 !! html
12014 <table><tr><td>foo</td></tr></table>
12015
12016 !!end
12017
12018 !!test
12019 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12020 !! wikitext
12021 <table><tr><td>foo{{echo|</td>}}</tr></table>
12022 !! html
12023 <table><tr><td>foo</td></tr></table>
12024
12025 !!end
12026
12027 !!test
12028 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12029 !! wikitext
12030 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12031 !! html
12032 <table><tr><td>foo</td></tr></table>
12033
12034 !!end
12035
12036 !!test
12037 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12038 !! wikitext
12039 <table><tr><td>foo</td></tr>{{echo|</table>}}
12040 !! html
12041 <table><tr><td>foo</td></tr></table>
12042
12043 !!end
12044
12045 !!test
12046 Templates: HTML Tables: 5. Proper fostering of categories from inside
12047 !!options
12048 parsoid=wt2html,wt2wt
12049 !! wikitext
12050 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12051 <!--Two categories (Bug 50330)-->
12052 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12053 !! html
12054 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12055 <!--Two categories (Bug 50330)-->
12056 <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>
12057 !!end
12058
12059 !!test
12060 Templates: Wiki Tables: 1a. Fostering of entire template content
12061 !! wikitext
12062 {|
12063 {{echo|a}}
12064 |}
12065 !! html
12066 <table>
12067 a
12068 <tr><td></td></tr></table>
12069
12070 !! html+tidy
12071 <p>a</p>
12072 <table>
12073 <tr>
12074 <td></td>
12075 </tr>
12076 </table>
12077 !! end
12078
12079 !!test
12080 Templates: Wiki Tables: 1b. Fostering of entire template content
12081 !! wikitext
12082 {|
12083 {{echo|<div>}}
12084 foo
12085 {{echo|</div>}}
12086 |}
12087 !! html
12088 <table>
12089 <div>
12090 <p>foo
12091 </p>
12092 </div>
12093 <tr><td></td></tr></table>
12094
12095 !! html+tidy
12096 <div>
12097 <p>foo</p>
12098 </div>
12099 <table>
12100 <tr>
12101 <td></td>
12102 </tr>
12103 </table>
12104 !! end
12105
12106 !!test
12107 Templates: Wiki Tables: 2. Fostering of partial template content
12108 !! wikitext
12109 {|
12110 {{echo|a
12111 <div>b</div>}}
12112 |}
12113 !! html
12114 <table>
12115 a
12116 <div>b</div>
12117 <tr><td></td></tr></table>
12118
12119 !! html+tidy
12120 <p>a</p>
12121 <div>b</div>
12122 <table>
12123 <tr>
12124 <td></td>
12125 </tr>
12126 </table>
12127 !! end
12128
12129 !!test
12130 Templates: Wiki Tables: 3. td-content via multiple templates
12131 !! wikitext
12132 {|
12133 {{echo|{{pipe}}a}}{{echo|b}}
12134 |}
12135 !! html
12136 <table>
12137 <tr>
12138 <td>ab
12139 </td></tr></table>
12140
12141 !!end
12142
12143 !!test
12144 Templates: Wiki Tables: 4. Templated tags, no content
12145 !! wikitext
12146 {{tbl-start}}
12147 {{tbl-end}}
12148 !! html
12149 <table>
12150 <tr><td></td></tr></table>
12151
12152 !!end
12153
12154 !!test
12155 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12156 !! wikitext
12157 {{tbl-start}}
12158 |foo
12159 {{tbl-end}}
12160 !! html
12161 <table>
12162 <tr>
12163 <td>foo
12164 </td></tr></table>
12165
12166 !!end
12167
12168 !!test
12169 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12170 !! wikitext
12171 {{tbl-start}}
12172 {{!}}foo
12173 {{tbl-end}}
12174 !! html
12175 <table>
12176 <tr>
12177 <td>foo
12178 </td></tr></table>
12179
12180 !!end
12181
12182 ## This test case is very specific to Parsoid's internals
12183 ## and is hence only tested for Parsoid's code. Parsoid uses
12184 ## a <meta> marker tag for <ref> tags and they are expanded
12185 ## much later. We are verifying that this <meta> tag usage
12186 ## doesn't prevent foster parenting.
12187 !!test
12188 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12189 !!wikitext
12190 {{PartialTable}}<ref>foo</ref>
12191 |}
12192
12193 <references />
12194 !!html/parsoid
12195 <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">
12196 <tbody>
12197 </tbody></table>
12198
12199 <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>
12200 !!end
12201
12202 !! test
12203 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12204 !! wikitext
12205 {{echo|
12206 {{{!}}
12207 {{!}}-}}
12208 <onlyinclude>
12209 |foo
12210 </onlyinclude>
12211 {{!}}}
12212 !! html/parsoid
12213 <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{{!}}}"]}'>
12214 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12215 <tbody><tr>
12216
12217 <td>foo
12218 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12219 </tbody></table>
12220 !! end
12221
12222 !!test
12223 Templates: Lists: Multi-line list-items via templates
12224 !! wikitext
12225 *{{echo|a {{nonexistent|
12226 unused}}}}
12227 *{{echo|b {{nonexistent|
12228 unused}}}}
12229 !! html
12230 <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>
12231 <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>
12232
12233 !!end
12234
12235 !!test
12236 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12237 !! wikitext
12238 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12239 !! html
12240 <p><i>ab</i>c<i>d</i>e
12241 </p>
12242 !!end
12243
12244 !!test
12245 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12246 (PHP parser generates misnested html)
12247 !! wikitext
12248 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12249 !! html/parsoid
12250 <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>
12251 !!end
12252
12253 !!test
12254 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12255 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12256 !! options
12257 parsoid=wt2html,wt2wt
12258 !! wikitext
12259 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12260 !! html
12261 <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>
12262 <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>
12263 <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>
12264 !!end
12265
12266 !!test
12267 Templates: Ugly nesting: 4. Divs opened/closed across templates
12268 !! wikitext
12269 a<div>b{{echo|c</div>d}}e
12270 !! html
12271 a<div>bc</div>de
12272
12273 !! html+tidy
12274 <p>a</p>
12275 <div>bc</div>
12276 <p>de</p>
12277 !! end
12278
12279 !!test
12280 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12281 (Parsoid-centric)
12282 !! options
12283 parsoid
12284 !! wikitext
12285 {|
12286 |{{echo|foo</table>}}
12287 |bar
12288 |}
12289 !! html
12290 <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|}"]}'>
12291
12292 <tbody>
12293 <tr>
12294 <td>foo</td></tr></tbody></table><span about="#mwt1">
12295 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12296 |}</span>
12297 !!end
12298
12299 !!test
12300 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12301 (Parsoid-centric)
12302 !! options
12303 parsoid
12304 !! wikitext
12305 <table>
12306 <tr>
12307 <td>
12308 <table>
12309 <tr>
12310 <td>1. {{echo|foo </table>}}</td>
12311 <td> bar </td>
12312 <td>2. {{echo|baz </table>}}</td>
12313 </tr>
12314 <tr>
12315 <td>abc</td>
12316 </tr>
12317 </table>
12318 </td>
12319 </tr>
12320 <tr>
12321 <td>xyz</td>
12322 </tr>
12323 </table>
12324 !! html
12325 <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>"]}'>
12326 <tbody><tr>
12327 <td>
12328 <table>
12329 <tbody><tr>
12330 <td>1. foo </td></tr></tbody></table></td>
12331 <td> bar </td>
12332 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12333 </span><span about="#mwt2">
12334 </span><span about="#mwt2">
12335 </span><span about="#mwt2">abc</span><span about="#mwt2">
12336 </span><span about="#mwt2">
12337 </span><span about="#mwt2">
12338 </span><span about="#mwt2">
12339 </span><span about="#mwt2">
12340 </span><span about="#mwt2">
12341 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12342 </span><span about="#mwt2">
12343 </span>
12344 !!end
12345
12346 !! test
12347 Templates: Ugly templates: 3. newline-only template parameter
12348 !! wikitext
12349 foo {{echo|
12350 }}
12351 !! html
12352 <p>foo
12353 </p>
12354 !! end
12355
12356 # This looks like a bug: a single newline triggers p/br for some reason.
12357 !! test
12358 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12359 !! wikitext
12360 {{echo|
12361 }}
12362 !! html
12363 <p><br />
12364 </p>
12365 !! end
12366
12367 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12368 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12369 !! test
12370 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12371 !! wikitext
12372 {{echo|<table>}}
12373 {{echo|<div>foo}}
12374 {{echo|</table>}}
12375 !! html/parsoid
12376 <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
12377 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12378 </table>
12379 !! end
12380
12381 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12382 # that are "identical" and generate nesting cycles in the algorithm
12383 !! test
12384 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12385 !! wikitext
12386 {{echo|<table><tr><td><table>}}
12387 {{echo|<div>}}
12388 {{echo|</div>}}
12389 !! html/parsoid
12390 <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"}'>
12391 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12392 </table></td></tr></tbody></table>
12393 !! end
12394
12395 !! test
12396 Templates: Parameters substituted at the top-level
12397 !! wikitext
12398 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12399 !! html/php
12400 <p><i>who</i> me? <b>never!</b>
12401 </p>
12402 !! html/parsoid
12403 <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>
12404 !! end
12405
12406 !!test
12407 Parser Functions: 1. Simple example
12408 !! wikitext
12409 {{uc:foo}}
12410 !! html
12411 <p>FOO
12412 </p>
12413 !!end
12414
12415 !!test
12416 Parser Functions: 2. Nested use (only outermost should be marked up)
12417 !! wikitext
12418 {{uc:{{lc:FOO}}}}
12419 !! html
12420 <p>FOO
12421 </p>
12422 !!end
12423
12424 ###
12425 ### Pre-save transform tests
12426 ###
12427 !! test
12428 pre-save transform: subst:
12429 !! options
12430 pst
12431 !! wikitext
12432 {{subst:test}}
12433 !! html/php
12434 This is a test template
12435 !! end
12436
12437 !! test
12438 pre-save transform: normal template
12439 !! options
12440 pst
12441 !! wikitext
12442 {{test}}
12443 !! html/php
12444 {{test}}
12445 !! end
12446
12447 !! test
12448 pre-save transform: nonexistent template
12449 !! options
12450 pst
12451 !! wikitext
12452 {{thistemplatedoesnotexist}}
12453 !! html/php
12454 {{thistemplatedoesnotexist}}
12455 !! end
12456
12457 !! test
12458 pre-save transform: subst magic variables
12459 !! options
12460 pst
12461 !! wikitext
12462 {{subst:SITENAME}}
12463 !! html/php
12464 MediaWiki
12465 !! end
12466
12467 # This is bug 89, which I fixed. -- wtm
12468 !! test
12469 pre-save transform: subst: templates with parameters
12470 !! options
12471 pst
12472 !! wikitext
12473 {{subst:paramtest|param="something else"}}
12474 !! html/php
12475 This is a test template with parameter "something else"
12476 !! end
12477
12478 !! article
12479 Template:nowikitest
12480 !! text
12481 <nowiki>'''not wiki'''</nowiki>
12482 !! endarticle
12483
12484 !! test
12485 pre-save transform: nowiki in subst (bug 1188)
12486 !! options
12487 pst
12488 !! wikitext
12489 {{subst:nowikitest}}
12490 !! html/php
12491 <nowiki>'''not wiki'''</nowiki>
12492 !! end
12493
12494 !! article
12495 Template:commenttest
12496 !! text
12497 This template has <!-- a comment --> in it.
12498 !! endarticle
12499
12500 !! test
12501 pre-save transform: comment in subst (bug 1936)
12502 !! options
12503 pst
12504 !! wikitext
12505 {{subst:commenttest}}
12506 !! html/php
12507 This template has <!-- a comment --> in it.
12508 !! end
12509
12510 !! test
12511 pre-save transform: unclosed tag
12512 !! options
12513 pst
12514 !! wikitext
12515 <nowiki>'''not wiki'''
12516 !! html/php
12517 <nowiki>'''not wiki'''
12518 !! end
12519
12520 !! test
12521 pre-save transform: mixed tag case
12522 !! options
12523 pst
12524 !! wikitext
12525 <NOwiki>'''not wiki'''</noWIKI>
12526 !! html/php
12527 <NOwiki>'''not wiki'''</noWIKI>
12528 !! end
12529
12530 !! test
12531 pre-save transform: unclosed comment in <nowiki>
12532 !! options
12533 pst
12534 !! wikitext
12535 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12536 !! html/php
12537 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12538 !!end
12539
12540 # Leading @ in this template definition works around a limitation
12541 # in parsoid's parserTests which otherwise strips the <span> from the
12542 # result (confusing it for a template wrapper)
12543 !! article
12544 Template:dangerous
12545 !!text
12546 @<span onmouseover="alert('crap')">Oh no</span>
12547 !!endarticle
12548
12549 !!test
12550 (confirming safety of fix for subst bug 1936)
12551 !! wikitext
12552 {{Template:dangerous}}
12553 !! html
12554 <p>@<span>Oh no</span>
12555 </p>
12556 !! end
12557
12558 !! test
12559 pre-save transform: comment containing gallery (bug 5024)
12560 !! options
12561 pst
12562 !! wikitext
12563 <!-- <gallery>data</gallery> -->
12564 !! html/php
12565 <!-- <gallery>data</gallery> -->
12566 !!end
12567
12568 !! test
12569 pre-save transform: comment containing extension
12570 !! options
12571 pst
12572 !! wikitext
12573 <!-- <tag>data</tag> -->
12574 !! html/php
12575 <!-- <tag>data</tag> -->
12576 !!end
12577
12578 !! test
12579 pre-save transform: comment containing nowiki
12580 !! options
12581 pst
12582 !! wikitext
12583 <!-- <nowiki>data</nowiki> -->
12584 !! html/php
12585 <!-- <nowiki>data</nowiki> -->
12586 !!end
12587
12588 !! test
12589 pre-save transform: <noinclude> in subst (bug 3298)
12590 !! options
12591 pst
12592 !! wikitext
12593 {{subst:Includes}}
12594 !! html/php
12595 Foobar
12596 !! end
12597
12598 !! test
12599 pre-save transform: <onlyinclude> in subst (bug 3298)
12600 !! options
12601 pst
12602 !! wikitext
12603 {{subst:Includes2}}
12604 !! html/php
12605 Foo
12606 !! end
12607
12608 !! article
12609 Template:SubstTest
12610 !!text
12611 {{<includeonly>subst:</includeonly>Includes}}
12612 !! endarticle
12613
12614 !! article
12615 Template:SafeSubstTest
12616 !! text
12617 {{<includeonly>safesubst:</includeonly>Includes}}
12618 !! endarticle
12619
12620 !! test
12621 bug 22297: safesubst: works during PST
12622 !! options
12623 pst
12624 !! wikitext
12625 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12626 !! html/php
12627 FoobarFoobar
12628 !! end
12629
12630 !! test
12631 bug 22297: safesubst: works during normal parse
12632 !! wikitext
12633 {{SafeSubstTest}}
12634 !! html
12635 <p>Foobar
12636 </p>
12637 !! end
12638
12639 !! test
12640 subst: does not work during normal parse
12641 !! wikitext
12642 {{SubstTest}}
12643 !! html
12644 <p>{{subst:Includes}}
12645 </p>
12646 !! end
12647
12648 !! test
12649 pre-save transform: context links ("pipe trick")
12650 !! options
12651 pst
12652 !! wikitext
12653 [[Article (context)|]]
12654 [[Bar:Article|]]
12655 [[:Bar:Article|]]
12656 [[Bar:Article (context)|]]
12657 [[:Bar:Article (context)|]]
12658 [[|Article]]
12659 [[|Article (context)]]
12660 [[Bar:X (Y) Z|]]
12661 [[:Bar:X (Y) Z|]]
12662 !! html/php
12663 [[Article (context)|Article]]
12664 [[Bar:Article|Article]]
12665 [[:Bar:Article|Article]]
12666 [[Bar:Article (context)|Article]]
12667 [[:Bar:Article (context)|Article]]
12668 [[Article]]
12669 [[Article (context)]]
12670 [[Bar:X (Y) Z|X (Y) Z]]
12671 [[:Bar:X (Y) Z|X (Y) Z]]
12672 !! end
12673
12674 !! test
12675 pre-save transform: context links ("pipe trick") with interwiki prefix
12676 !! options
12677 pst
12678 !! wikitext
12679 [[interwiki:Article|]]
12680 [[:interwiki:Article|]]
12681 [[interwiki:Bar:Article|]]
12682 [[:interwiki:Bar:Article|]]
12683 !! html/php
12684 [[interwiki:Article|Article]]
12685 [[:interwiki:Article|Article]]
12686 [[interwiki:Bar:Article|Bar:Article]]
12687 [[:interwiki:Bar:Article|Bar:Article]]
12688 !! end
12689
12690 !! test
12691 pre-save transform: context links ("pipe trick") with parens in title
12692 !! options
12693 pst title=[[Somearticle (context)]]
12694 !! wikitext
12695 [[|Article]]
12696 !! html/php
12697 [[Article (context)|Article]]
12698 !! end
12699
12700 !! test
12701 pre-save transform: context links ("pipe trick") with comma in title
12702 !! options
12703 pst title=[[Someplace, Somewhere]]
12704 !! wikitext
12705 [[|Otherplace]]
12706 [[Otherplace, Elsewhere|]]
12707 [[Otherplace, Elsewhere, Anywhere|]]
12708 !! html/php
12709 [[Otherplace, Somewhere|Otherplace]]
12710 [[Otherplace, Elsewhere|Otherplace]]
12711 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12712 !! end
12713
12714 !! test
12715 pre-save transform: context links ("pipe trick") with parens and comma
12716 !! options
12717 pst title=[[Someplace (IGNORED), Somewhere]]
12718 !! wikitext
12719 [[|Otherplace]]
12720 [[Otherplace (place), Elsewhere|]]
12721 !! html/php
12722 [[Otherplace, Somewhere|Otherplace]]
12723 [[Otherplace (place), Elsewhere|Otherplace]]
12724 !! end
12725
12726 !! test
12727 pre-save transform: context links ("pipe trick") with comma and parens
12728 !! options
12729 pst title=[[Who, me? (context)]]
12730 !! wikitext
12731 [[|Yes, you.]]
12732 [[Me, Myself, and I (1937 song)|]]
12733 !! html/php
12734 [[Yes, you. (context)|Yes, you.]]
12735 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12736 !! end
12737
12738 !! test
12739 pre-save transform: context links ("pipe trick") with namespace
12740 !! options
12741 pst title=[[Ns:Somearticle]]
12742 !! wikitext
12743 [[|Article]]
12744 !! html/php
12745 [[Ns:Article|Article]]
12746 !! end
12747
12748 !! test
12749 pre-save transform: context links ("pipe trick") with namespace and parens
12750 !! options
12751 pst title=[[Ns:Somearticle (context)]]
12752 !! wikitext
12753 [[|Article]]
12754 !! html/php
12755 [[Ns:Article (context)|Article]]
12756 !! end
12757
12758 !! test
12759 pre-save transform: context links ("pipe trick") with namespace and comma
12760 !! options
12761 pst title=[[Ns:Somearticle, Context, Whatever]]
12762 !! wikitext
12763 [[|Article]]
12764 !! html/php
12765 [[Ns:Article, Context, Whatever|Article]]
12766 !! end
12767
12768 !! test
12769 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12770 !! options
12771 pst title=[[Ns:Somearticle, Context (context)]]
12772 !! wikitext
12773 [[|Article]]
12774 !! html/php
12775 [[Ns:Article (context)|Article]]
12776 !! end
12777
12778 !! test
12779 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12780 !! options
12781 pst title=[[Ns:Somearticle (IGNORED), Context]]
12782 !! wikitext
12783 [[|Article]]
12784 !! html/php
12785 [[Ns:Article, Context|Article]]
12786 !! end
12787
12788 !! test
12789 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12790 !! options
12791 pst
12792 !! wikitext
12793 [[Article(context)|]]
12794 [[Bar:Article(context)|]]
12795 [[:Bar:Article(context)|]]
12796 [[|Article(context)]]
12797 [[Bar:X(Y)Z|]]
12798 [[:Bar:X(Y)Z|]]
12799 !! html/php
12800 [[Article(context)|Article]]
12801 [[Bar:Article(context)|Article]]
12802 [[:Bar:Article(context)|Article]]
12803 [[Article(context)]]
12804 [[Bar:X(Y)Z|X(Y)Z]]
12805 [[:Bar:X(Y)Z|X(Y)Z]]
12806 !! end
12807
12808 !! test
12809 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12810 !! options
12811 pst
12812 !! wikitext
12813 [[Article (context)|]]
12814 [[Bar:Article (context)|]]
12815 [[:Bar:Article (context)|]]
12816 [[|Article (context)]]
12817 [[Bar:X (Y) Z|]]
12818 [[:Bar:X (Y) Z|]]
12819 !! html/php
12820 [[Article (context)|Article]]
12821 [[Bar:Article (context)|Article]]
12822 [[:Bar:Article (context)|Article]]
12823 [[Article (context)]]
12824 [[Bar:X (Y) Z|X (Y) Z]]
12825 [[:Bar:X (Y) Z|X (Y) Z]]
12826 !! end
12827
12828 !! test
12829 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12830 !! options
12831 pst
12832 !! wikitext
12833 [[Article(context)|]]
12834 [[Bar:Article(context)|]]
12835 [[:Bar:Article(context)|]]
12836 [[|Article(context)]]
12837 [[Bar:X(Y)Z|]]
12838 [[:Bar:X(Y)Z|]]
12839 !! html/php
12840 [[Article(context)|Article]]
12841 [[Bar:Article(context)|Article]]
12842 [[:Bar:Article(context)|Article]]
12843 [[Article(context)]]
12844 [[Bar:X(Y)Z|X(Y)Z]]
12845 [[:Bar:X(Y)Z|X(Y)Z]]
12846 !! end
12847
12848 !! test
12849 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12850 !! options
12851 pst
12852 !! wikitext
12853 [[Article (context), context|]]
12854 [[Article (context),context|]]
12855 [[Bar:Article (context), context|]]
12856 [[Bar:Article (context),context|]]
12857 [[:Bar:Article (context), context|]]
12858 [[:Bar:Article (context),context|]]
12859 !! html/php
12860 [[Article (context), context|Article]]
12861 [[Article (context),context|Article]]
12862 [[Bar:Article (context), context|Article]]
12863 [[Bar:Article (context),context|Article]]
12864 [[:Bar:Article (context), context|Article]]
12865 [[:Bar:Article (context),context|Article]]
12866 !! end
12867
12868 !! test
12869 pre-save transform: trim trailing empty lines
12870 !! options
12871 pst
12872 !! wikitext
12873 Empty lines are trimmed
12874
12875
12876
12877
12878 !! html/php
12879 Empty lines are trimmed
12880 !! end
12881
12882 !! test
12883 pre-save transform: Signature expansion
12884 !! options
12885 pst
12886 !! wikitext
12887 * ~~~
12888 * <noinclude>~~~</noinclude>
12889 * <includeonly>~~~</includeonly>
12890 * <onlyinclude>~~~</onlyinclude>
12891 !! html/php
12892 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12893 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12894 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12895 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12896 !! end
12897
12898
12899 !! test
12900 pre-save transform: Signature expansion in nowiki tags (bug 93)
12901 !! options
12902 pst disabled
12903 !! wikitext
12904 Shall not expand:
12905
12906 <nowiki>~~~~</nowiki>
12907
12908 <includeonly><nowiki>~~~~</nowiki></includeonly>
12909
12910 <noinclude><nowiki>~~~~</nowiki></noinclude>
12911
12912 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12913
12914 {{subst:Foo}} shall be converted to FOO
12915
12916 As well as inside noinclude/onlyinclude
12917 <noinclude>{{subst:Foo}}</noinclude>
12918 <onlyinclude>{{subst:Foo}}</onlyinclude>
12919
12920 But not inside includeonly
12921 <includeonly>{{subst:Foo}}</includeonly>
12922 !! html/php
12923 Shall not expand:
12924
12925 <nowiki>~~~~</nowiki>
12926
12927 <includeonly><nowiki>~~~~</nowiki></includeonly>
12928
12929 <noinclude><nowiki>~~~~</nowiki></noinclude>
12930
12931 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12932
12933 FOO shall be converted to FOO
12934
12935 As well as inside noinclude/onlyinclude
12936 <noinclude>FOO</noinclude>
12937 <onlyinclude>FOO</onlyinclude>
12938
12939 But not inside includeonly
12940 <includeonly>{{subst:Foo}}</includeonly>
12941 !! end
12942
12943 !! test
12944 Parsoid: Recognize nowiki with trailing space in tags
12945 !! options
12946 parsoid=wt2html
12947 !! wikitext
12948 <nowiki ><div>[[foo]]</nowiki >
12949
12950 a<nowiki / >b
12951
12952 c<nowiki />d
12953
12954 e<nowiki/ >f
12955 !! html
12956 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12957 <p>ab</p>
12958 <p>cd</p>
12959 <p>ef</p>
12960 !! end
12961
12962 !! test
12963 Parsoid: Recognize nowiki with odd capitalization
12964 !! options
12965 parsoid=wt2html
12966 !! wikitext
12967 <noWikI ><div>[[foo]]</Nowiki >
12968 !! html
12969 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12970 !! end
12971
12972
12973 !! test
12974 Parsoid: Escape nowiki with trailing space in tags
12975 !! options
12976 parsoid=html2wt
12977 !! html/parsoid
12978 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12979 <p>a&lt;nowiki /&gt;b</p>
12980 <p>c&lt;nowiki/ &gt;d</p>
12981 !! wikitext
12982 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12983
12984 a&lt;nowiki /&gt;b
12985
12986 c&lt;nowiki/ &gt;d
12987 !! end
12988
12989 !! test
12990 Parsoid: Escape weird noWikI capitalizations
12991 !! options
12992 parsoid=html2wt
12993 !! html/parsoid
12994 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12995 !! wikitext
12996 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12997 !! end
12998
12999 ###
13000 ### Message transform tests
13001 ###
13002 !! test
13003 message transform: magic variables
13004 !! options
13005 msg
13006 !! wikitext
13007 {{SITENAME}}
13008 !! html
13009 MediaWiki
13010 !! end
13011
13012 !! test
13013 message transform: should not transform wiki markup
13014 !! options
13015 msg
13016 !! wikitext
13017 ''test''
13018 !! html
13019 ''test''
13020 !! end
13021
13022 !! test
13023 message transform: <noinclude> in transcluded template (bug 4926)
13024 !! options
13025 msg
13026 !! wikitext
13027 {{Includes}}
13028 !! html
13029 Foobar
13030 !! end
13031
13032 !! test
13033 message transform: <onlyinclude> in transcluded template (bug 4926)
13034 !! options
13035 msg
13036 !! wikitext
13037 {{Includes2}}
13038 !! html
13039 Foo
13040 !! end
13041
13042 !! test
13043 {{#special:}} page name, known
13044 !! options
13045 msg
13046 !! wikitext
13047 {{#special:Recentchanges}}
13048 !! html
13049 Special:RecentChanges
13050 !! end
13051
13052 !! test
13053 {{#special:}} page name with subpage, known
13054 !! options
13055 msg
13056 !! wikitext
13057 {{#special:Recentchanges/param}}
13058 !! html
13059 Special:RecentChanges/param
13060 !! end
13061
13062 !! test
13063 {{#special:}} page name, unknown
13064 !! options
13065 msg
13066 !! wikitext
13067 {{#special:foobar nonexistent}}
13068 !! html
13069 Special:Foobar nonexistent
13070 !! end
13071
13072 !! test
13073 {{#speciale:}} page name, known
13074 !! options
13075 msg
13076 !! wikitext
13077 {{#speciale:Recentchanges}}
13078 !! html
13079 Special:RecentChanges
13080 !! end
13081
13082 !! test
13083 {{#speciale:}} page name with subpage, known
13084 !! options
13085 msg
13086 !! wikitext
13087 {{#speciale:Recentchanges/param}}
13088 !! html
13089 Special:RecentChanges/param
13090 !! end
13091
13092 !! test
13093 {{#speciale:}} page name, unknown
13094 !! options
13095 msg
13096 !! wikitext
13097 {{#speciale:foobar nonexistent}}
13098 !! html
13099 Special:Foobar_nonexistent
13100 !! end
13101
13102 ###
13103 ### Images
13104 ###
13105 ### For Parsoid-specific tests, see
13106 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13107
13108 !! test
13109 Simple image
13110 !! options
13111 parsoid=wt2html,wt2wt,html2html
13112 !! wikitext
13113 [[Image:foobar.jpg]]
13114 !! html/php
13115 <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>
13116 </p>
13117 !! html/parsoid
13118 <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>
13119 !! end
13120
13121 !! test
13122 Simple image (using File: namespace, now canonical)
13123 !! wikitext
13124 [[File:Foobar.jpg]]
13125 !! html/php
13126 <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>
13127 </p>
13128 !! html/parsoid
13129 <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>
13130 !! end
13131
13132 !! test
13133 Right-aligned image
13134 !! wikitext
13135 [[File:Foobar.jpg|right]]
13136 !! html/php
13137 <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>
13138
13139 !! html/parsoid
13140 <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>
13141 !! end
13142
13143 !! test
13144 Image with caption
13145 !! wikitext
13146 [[File:Foobar.jpg|right|Caption text]]
13147 !! html/php
13148 <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>
13149
13150 !! html/parsoid
13151 <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>
13152 !! end
13153
13154 !! test
13155 Image with caption, bug 53312 #1
13156 !! wikitext
13157 [[File:Foobar.jpg|right|Caption page stuff]]
13158 !! html/php
13159 <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>
13160
13161 !! html/parsoid
13162 <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>
13163 !! end
13164
13165 !! test
13166 Image with caption, bug 53312 #2
13167 !! wikitext
13168 [[File:Foobar.jpg|right|Caption page=]]
13169 !! html/php
13170 <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>
13171
13172 !! html/parsoid
13173 <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>
13174 !! end
13175
13176 !! test
13177 Image with caption, bug 53312 #3
13178 !! wikitext
13179 [[File:Foobar.jpg|right|Caption page=stuff]]
13180 !! html/php
13181 <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>
13182
13183 !! html/parsoid
13184 <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>
13185 !! end
13186
13187 !! test
13188 Allow empty links in image captions (Bug 60753)
13189 !! options
13190 thumbsize=220
13191 !! wikitext
13192 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13193 [[]]
13194 [[Link2]]
13195 ]]
13196 !! html/php
13197 <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>
13198
13199 !! html/parsoid
13200 <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>
13201 [[]]
13202 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13203 </figcaption></figure>
13204 !! end
13205
13206 !! test
13207 Titles in unlinked images (T23454)
13208 !! wikitext
13209 [[File:Foobar.jpg|link=|stuff]]
13210 !! html/php
13211 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13212 </p>
13213 !! end
13214
13215 !! test
13216 Link with empty target
13217 !! wikitext
13218 [[]]
13219 !! html
13220 <p>[[]]
13221 </p>
13222 !! end
13223
13224 !! test
13225 Image with link trail
13226 !! wikitext
13227 Linktrails should not work for images: [[File:Foobar.jpg]]s
13228 !! html/php
13229 <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
13230 </p>
13231 !! html/parsoid
13232 <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>
13233 !! end
13234
13235 !! test
13236 Image with empty attribute
13237 !! options
13238 parsoid=wt2html,wt2wt,html2html
13239 !! wikitext
13240 [[File:Foobar.jpg|right||Caption text]]
13241 !! html/php
13242 <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>
13243
13244 !! html/parsoid
13245 <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>
13246 !! end
13247
13248 !! test
13249 1. Block image with individual attributes from templates
13250 !! wikitext
13251 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13252 !! html/php
13253 <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>
13254
13255 !! html/parsoid
13256 <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>
13257 !! end
13258
13259 !! test
13260 2. Block Image with individual attributes from templates
13261 !! wikitext
13262 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13263 !! html/php
13264 <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>
13265
13266 !! html/parsoid
13267 <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>
13268 !! end
13269
13270 !! test
13271 3. Inline image with individual attributes from templates
13272 !! wikitext
13273 [[File:Foobar.jpg|{{echo|50px}}]]
13274 !! html/php
13275 <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>
13276 </p>
13277 !! html/parsoid
13278 <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>
13279 !! end
13280
13281 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13282 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13283 !! test
13284 Image with multiple attributes from the same template
13285 !! wikitext
13286 [[File:Foobar.jpg|{{image_attribs}}]]
13287 !! html/php
13288 <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>
13289
13290 !! html/parsoid
13291 <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>
13292 !! end
13293
13294 !! test
13295 Image with link tails
13296 !! options
13297 thumbsize=220
13298 !! wikitext
13299 123[[File:Foobar.jpg]]456
13300 123[[File:Foobar.jpg|right]]456
13301 123[[File:Foobar.jpg|thumb]]456
13302 !! html/php
13303 <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
13304 </p>
13305 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
13306 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
13307
13308 !! html/php+tidy
13309 <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>
13310 <p>123</p>
13311 <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>
13312 <p>456 123</p>
13313 <div class="thumb tright">
13314 <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>
13315 <div class="thumbcaption">
13316 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13317 </div>
13318 </div>
13319 </div>
13320 <p>456</p>
13321 !! html/parsoid
13322 <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>
13323 <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>
13324 <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>
13325 !! end
13326
13327 !! test
13328 Image with multiple captions -- only last one is accepted
13329 !! wikitext
13330 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13331 !! html/php
13332 <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>
13333
13334 !! html/parsoid
13335 <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>
13336 !! end
13337
13338 !! test
13339 Image with multiple widths -- use last
13340 !! wikitext
13341 [[File:Foobar.jpg|200px|300px|caption]]
13342 !! html/php
13343 <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>
13344 </p>
13345 !! html/parsoid
13346 <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>
13347 !! end
13348
13349 !! test
13350 Image with multiple alignments -- use first (bug 48664)
13351 !! options
13352 thumbsize=220
13353 !! wikitext
13354 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13355
13356 [[File:Foobar.jpg|middle|text-top|caption]]
13357 !! html/php
13358 <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>
13359 <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>
13360 </p>
13361 !! html/parsoid
13362 <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>
13363 <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>
13364 !! end
13365
13366 !! test
13367 Image with width attribute at different positions
13368 !! wikitext
13369 [[File:Foobar.jpg|200px|right|Caption]]
13370 [[File:Foobar.jpg|right|200px|Caption]]
13371 [[File:Foobar.jpg|right|Caption|200px]]
13372 !! html/php
13373 <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>
13374 <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>
13375 <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>
13376
13377 !! html/parsoid
13378 <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>
13379 <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>
13380 <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>
13381 !! end
13382
13383 # a sad bit of backward-compatibility
13384 !! test
13385 Image with size specified with pxpx (bug 13500, 51628)
13386 !! options
13387 parsoid=wt2html,wt2wt,html2html
13388 !! wikitext
13389 [[File:Foobar.jpg|20pxpx]]
13390 [[File:Foobar.jpg|200x20pxpx]]
13391 !! html/php
13392 <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>
13393 <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>
13394 </p>
13395 !! html/parsoid
13396 <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>
13397 !! end
13398
13399 !! test
13400 Image with link parameter, wiki target
13401 !! wikitext
13402 [[File:Foobar.jpg|link=Main Page]]
13403 !! html/php
13404 <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>
13405 </p>
13406 !! html/parsoid
13407 <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>
13408 !! end
13409
13410 # parsoid bug 49293 (part 1)
13411 !! test
13412 Image with link parameter, URL target
13413 !! wikitext
13414 [[File:Foobar.jpg|link=http://example.com/]]
13415 !! html/php
13416 <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>
13417 </p>
13418 !! html/parsoid
13419 <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>
13420 !! end
13421
13422 # parsoid bug 49293 (part 2)
13423 !! test
13424 Image with link parameter, protocol-less URL target
13425 !! wikitext
13426 [[File:Foobar.jpg|link=//example.com/]]
13427 !! html/php
13428 <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>
13429 </p>
13430 !! html/parsoid
13431 <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>
13432 !! end
13433
13434 !! test
13435 Escaping non-block captions (T107435)
13436 !! options
13437 parsoid={
13438 "modes": ["wt2wt"],
13439 "changes": [
13440 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13441 ]
13442 }
13443 !! wikitext
13444 [[Image:Foobar.jpg|caption]]
13445 !! wikitext/edited
13446 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13447 !! end
13448
13449 # wgExternalLinkTarget not supported by Parsoid
13450 !! test
13451 Image with link parameter, wgExternalLinkTarget
13452 !! wikitext
13453 [[Image:foobar.jpg|link=http://example.com/]]
13454 !! config
13455 wgExternalLinkTarget='foobar'
13456 !! html/php
13457 <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>
13458 </p>
13459 !! end
13460
13461 !! test
13462 Image with link parameter, wgNoFollowLinks set to false
13463 !! wikitext
13464 [[Image:foobar.jpg|link=http://example.com/]]
13465 !! config
13466 wgNoFollowLinks=false
13467 !! html
13468 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13469 </p>
13470 !! end
13471
13472 !! test
13473 Image with link parameter, wgNoFollowDomainExceptions
13474 !! wikitext
13475 [[Image:foobar.jpg|link=http://example.com/]]
13476 !! config
13477 wgNoFollowDomainExceptions='example.com'
13478 !! html
13479 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13480 </p>
13481 !! end
13482
13483 # wgExternalLinkTarget not supported by Parsoid
13484 !! test
13485 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13486 !! wikitext
13487 [[Image:foobar.jpg|link=http://example.com/|Title]]
13488 !! config
13489 wgExternalLinkTarget='foobar'
13490 !! html/php
13491 <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>
13492 </p>
13493 !! end
13494
13495 !! test
13496 Image with empty link parameter
13497 !! wikitext
13498 [[File:Foobar.jpg|link=]]
13499 !! html/php
13500 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13501 </p>
13502 !! html/parsoid
13503 <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>
13504 !! end
13505
13506 !! test
13507 Image with link parameter (wiki target) and unnamed parameter
13508 !! wikitext
13509 [[File:Foobar.jpg|link=Main_Page|Title]]
13510 !! html/php
13511 <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>
13512 </p>
13513 !! html/parsoid
13514 <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>
13515 !! end
13516
13517 !! test
13518 Image with link parameter (URL target) and unnamed parameter
13519 !! wikitext
13520 [[File:Foobar.jpg|link=http://example.com/|Title]]
13521 !! html/php
13522 <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>
13523 </p>
13524 !! html/parsoid
13525 <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>
13526 !! end
13527
13528 !! test
13529 Thumbnail image with link parameter
13530 !! options
13531 thumbsize=220
13532 parsoid=wt2html,wt2wt,html2html
13533 !! wikitext
13534 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13535 !! html/php
13536 <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>
13537
13538 !! html/parsoid
13539 <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>
13540 !! end
13541
13542 !! test
13543 Manually-specified thumbnail image
13544 !! options
13545 thumbsize=220
13546 !! wikitext
13547 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13548 !! html/php
13549 <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>
13550
13551 !! html/parsoid
13552 <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>
13553 !! end
13554
13555 !! test
13556 Manually-specified thumbnail image with explicit link to wiki page
13557 !! options
13558 thumbsize=220
13559 parsoid=wt2html,wt2wt,html2html
13560 !! wikitext
13561 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13562 !! html/php
13563 <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>
13564
13565 !! html/parsoid
13566 <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>
13567 !! end
13568
13569 !! test
13570 Manually-specified thumbnail image with explicit link to url
13571 !! options
13572 thumbsize=220
13573 parsoid=wt2html,wt2wt,html2html
13574 !! wikitext
13575 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13576 !! html/php
13577 <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>
13578
13579 !! html/parsoid
13580 <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>
13581 !! end
13582
13583 !! test
13584 Manually-specified thumbnail image with explicit no link
13585 !! options
13586 thumbsize=220
13587 parsoid=wt2html,wt2wt,html2html
13588 !! wikitext
13589 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13590 !! html/php
13591 <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>
13592
13593 !! html/parsoid
13594 <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>
13595 !! end
13596
13597 !! test
13598 Manually-specified thumbnail image with explicit link and alt text
13599 !! options
13600 thumbsize=220
13601 parsoid=wt2html,wt2wt,html2html
13602 !! wikitext
13603 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13604 !! html/php
13605 <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>
13606
13607 !! html/parsoid
13608 <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>
13609 !! end
13610
13611 !! test
13612 Image with frame and link
13613 !! options
13614 parsoid=wt2html,wt2wt,html2html
13615 !! wikitext
13616 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13617 !! html/php
13618 <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>
13619
13620 !! html/parsoid
13621 <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>
13622 !! end
13623
13624 !! test
13625 Image with frame and link and explicit alt
13626 !! options
13627 parsoid=wt2html,wt2wt,html2html
13628 !! wikitext
13629 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13630 !! html/php
13631 <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>
13632
13633 !! html/parsoid
13634 <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>
13635 !! end
13636
13637 !! test
13638 Image with wiki markup in implicit alt
13639 !! wikitext
13640 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13641
13642 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13643 !! html/php
13644 <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>
13645 </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>
13646 </p>
13647 !! html/parsoid
13648 <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>
13649
13650 <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>
13651 !! end
13652
13653 !! test
13654 Alt image option should handle most kinds of wikitext without barfing
13655 !! wikitext
13656 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13657 !! html/php
13658 <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>
13659
13660 !! html/parsoid
13661 <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>
13662 !! end
13663
13664 ###################
13665 # Conflicting image format options.
13666 # First option specified should 'win'.
13667 # All three cases in each test should be identical.
13668
13669 !! test
13670 Image with 'frameless' first.
13671 !! options
13672 parsoid=wt2html,wt2wt,html2html
13673 !! wikitext
13674 [[File:Foobar.jpg|frameless|caption]]
13675
13676 [[File:Foobar.jpg|frameless|frame|caption]]
13677
13678 [[File:Foobar.jpg|frameless|thumb|caption]]
13679 !! html/php
13680 <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>
13681 </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>
13682 </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>
13683 </p>
13684 !! html/parsoid
13685 <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>
13686 <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>
13687 <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>
13688 !! end
13689
13690 !! test
13691 Image with 'frame' first.
13692 !! options
13693 parsoid=wt2html,wt2wt,html2html
13694 !! wikitext
13695 [[File:Foobar.jpg|frame|caption]]
13696 [[File:Foobar.jpg|frame|frameless|caption]]
13697 [[File:Foobar.jpg|frame|thumb|caption]]
13698 !! html/php
13699 <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>
13700 <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>
13701 <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>
13702
13703 !! html/parsoid
13704 <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>
13705 <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>
13706 <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>
13707 !! end
13708
13709 !! test
13710 Image with 'thumb' first.
13711 !! options
13712 parsoid=wt2html,wt2wt,html2html
13713 !! wikitext
13714 [[File:Foobar.jpg|thumb|caption]]
13715 [[File:Foobar.jpg|thumb|frameless|caption]]
13716 [[File:Foobar.jpg|thumb|frame|caption]]
13717 !! html/php
13718 <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>
13719 <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>
13720 <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>
13721
13722 !! html/parsoid
13723 <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>
13724 <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>
13725 <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>
13726 !! end
13727
13728 ###################
13729 # Image sizing.
13730 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13731 # and https://phabricator.wikimedia.org/T64258
13732 # Foobar has actual size of 1941x220
13733 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13734 # a scalable format.
13735 # 2. Framed images always ignore size options; always render at default size.
13736 # 3. "Unspecified format" and border are the only types which can be
13737 # enlarged.
13738
13739 !! test
13740 Image: "unspecified format" and border enlarge
13741 !! options
13742 parsoid=wt2html,wt2wt,html2html
13743 !! wikitext
13744 [[File:Foobar.jpg|2000px]]
13745
13746 [[File:Foobar.jpg|border|2000px]]
13747 !! html/php
13748 <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>
13749 </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>
13750 </p>
13751 !! html/parsoid
13752 <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>
13753 <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>
13754 !! end
13755
13756 !! test
13757 Image: "unspecified format" and border reduce
13758 !! options
13759 parsoid=wt2html,wt2wt,html2html
13760 !! wikitext
13761 [[File:Foobar.jpg|1000px]]
13762
13763 [[File:Foobar.jpg|border|1000px]]
13764 !! html/php
13765 <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>
13766 </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>
13767 </p>
13768 !! html/parsoid
13769 <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>
13770 <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>
13771 !! end
13772
13773 !! test
13774 Image: thumbs reduce
13775 !! options
13776 parsoid=wt2html,wt2wt,html2html
13777 !! wikitext
13778 [[File:Foobar.jpg|thumb|50px]]
13779 !! html/php
13780 <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>
13781
13782 !! html/parsoid
13783 <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>
13784 !! end
13785
13786 !! test
13787 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13788 !! options
13789 parsoid=wt2html,wt2wt,html2html
13790 !! wikitext
13791 [[File:Foobar.jpg|thumb|2000px]]
13792
13793 [[File:Foobar.svg|thumb|2000px]]
13794 !! html/php
13795 <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>
13796 <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>
13797
13798 !! html/parsoid
13799 <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>
13800 <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>
13801 !! end
13802
13803 !! test
13804 Image: frameless can reduce in size
13805 !! options
13806 parsoid=wt2html,wt2wt,html2html
13807 !! wikitext
13808 [[File:Foobar.jpg|frameless|50px]]
13809 !! html/php
13810 <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>
13811 </p>
13812 !! html/parsoid
13813 <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>
13814 !! end
13815
13816 !! test
13817 Image: bitmap frameless can't be enlarged past original size, but vector can
13818 !! options
13819 parsoid=wt2html,wt2wt,html2html
13820 !! wikitext
13821 [[File:Foobar.jpg|frameless|2000px]]
13822
13823 [[File:Foobar.svg|frameless|2000px]]
13824 !! html/php
13825 <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>
13826 </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>
13827 </p>
13828 !! html/parsoid
13829 <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>
13830 <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>
13831 !! end
13832
13833 !! test
13834 Image: framed images are always unscaled.
13835 !! options
13836 parsoid=wt2html,wt2wt,html2html
13837 !! wikitext
13838 [[File:Foobar.jpg|frame]]
13839
13840 [[File:Foobar.jpg|frame|50px]]
13841
13842 [[File:Foobar.jpg|frame|50x50px]]
13843
13844 [[File:Foobar.jpg|frame|2000px]]
13845 !! html/php
13846 <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>
13847 <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>
13848 <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>
13849 <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>
13850
13851 !! html/parsoid
13852 <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>
13853 <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>
13854 <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>
13855 <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>
13856 !! end
13857
13858 ###################
13859
13860 !! test
13861 Link to image page- image page normally doesn't exists, hence edit link
13862 Add test with existing image page
13863 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13864 !! wikitext
13865 [[:Image:test]]
13866 !! html
13867 <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>
13868 </p>
13869 !! end
13870
13871 !! test
13872 bug 18784 Link to non-existent image page with caption should use caption as link text
13873 !! wikitext
13874 [[:Image:test|caption]]
13875 !! html
13876 <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>
13877 </p>
13878 !! end
13879
13880 !! test
13881 Frameless image caption with a free URL
13882 !! wikitext
13883 [[File:Foobar.jpg|http://example.com]]
13884 !! html/php
13885 <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>
13886 </p>
13887 !! html/parsoid
13888 <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>
13889 !! end
13890
13891 !! test
13892 Thumbnail image caption with a free URL
13893 !! options
13894 thumbsize=220
13895 !! wikitext
13896 [[File:Foobar.jpg|thumb|http://example.com]]
13897 !! html/php
13898 <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>
13899
13900 !! html/parsoid
13901 <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>
13902 !! end
13903
13904 !! test
13905 Thumbnail image caption with a free URL and explicit alt
13906 !! options
13907 thumbsize=220
13908 parsoid=wt2html,wt2wt,html2html
13909 !! wikitext
13910 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13911 !! html/php
13912 <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>
13913
13914 !! html/parsoid
13915 <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>
13916 !! end
13917
13918 !! test
13919 SVG thumbnails with no language set
13920 !! options
13921 !! wikitext
13922 [[File:Foobar.svg|thumb|caption]]
13923 !! html/php
13924 <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>
13925
13926 !! html/parsoid
13927 <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>
13928 !! end
13929
13930 !! test
13931 SVG thumbnails with language de
13932 !! options
13933 parsoid=wt2html,wt2wt,html2html
13934 !! wikitext
13935 [[File:Foobar.svg|thumb|caption|lang=de]]
13936 !! html/php
13937 <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>
13938
13939 !! html/parsoid
13940 <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>
13941 !! end
13942
13943 !! test
13944 SVG thumbnails with invalid language code
13945 !! options
13946 parsoid=wt2html,wt2wt,html2html
13947 !! wikitext
13948 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13949 !! html/php
13950 <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>
13951
13952 !! html/parsoid
13953 <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>
13954 !! end
13955
13956 !! test
13957 BUG 1887: A ISBN with a thumbnail
13958 !! wikitext
13959 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13960 !! html/php
13961 <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>
13962
13963 !! html/parsoid
13964 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
13965 !! end
13966
13967 !! test
13968 BUG 1887: A RFC with a thumbnail
13969 !! wikitext
13970 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13971 !! html/php
13972 <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>
13973
13974 !! html/parsoid
13975 <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>
13976 !! end
13977
13978 !! test
13979 BUG 1887: A mailto link with a thumbnail
13980 !! wikitext
13981 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13982 !! html/php
13983 <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>
13984
13985 !! html/parsoid
13986 <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>
13987 !! end
13988
13989 # Pending resolution to bug 368
13990 !! test
13991 BUG 648: Frameless image caption with a link
13992 !! wikitext
13993 [[File:Foobar.jpg|text with a [[link]] in it]]
13994 !! html/php
13995 <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>
13996 </p>
13997 !! html/parsoid
13998 <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>
13999 !! end
14000
14001 !! test
14002 BUG 648: Frameless image caption with a link (suffix)
14003 !! wikitext
14004 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14005 !! html/php
14006 <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>
14007 </p>
14008 !! html/parsoid
14009 <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>
14010 !! end
14011
14012 !! test
14013 BUG 648: Frameless image caption with an interwiki link
14014 !! wikitext
14015 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14016 !! html/php
14017 <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>
14018 </p>
14019 !! html/parsoid
14020 <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>
14021 !! end
14022
14023 !! test
14024 BUG 648: Frameless image caption with a piped interwiki link
14025 !! wikitext
14026 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14027 !! html/php
14028 <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>
14029 </p>
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 T107474: Frameless image caption with <nowiki>
14036 !! wikitext
14037 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14038 !! html/parsoid
14039 <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>
14040 !! end
14041
14042 !! test
14043 Escape HTML special chars in image alt text
14044 !! wikitext
14045 [[File:Foobar.jpg|& < > "]]
14046 !! html/php
14047 <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>
14048 </p>
14049 !! html/parsoid
14050 <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>
14051 !! end
14052
14053 !! test
14054 Entities in file name and attributes
14055 !! wikitext
14056 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14057 !! html/php
14058 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14059 </p>
14060 !! html/parsoid
14061 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14062 !! end
14063
14064 !! test
14065 BUG 499: Alt text should have &#1234;, not &amp;1234;
14066 !! wikitext
14067 [[File:Foobar.jpg|&#9792;]]
14068 !! html/php
14069 <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>
14070 </p>
14071 !! html/parsoid
14072 <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>
14073 !! end
14074
14075 !! test
14076 Broken image caption with link
14077 !! options
14078 parsoid=wt2html,wt2wt,html2html
14079 !! wikitext
14080 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14081 !! html/php
14082 <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.
14083 </p>
14084 !! html/parsoid
14085 <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>
14086 !! end
14087
14088 !! test
14089 Image caption containing another image
14090 !! wikitext
14091 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14092 !! html/php
14093 <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>
14094
14095 !! html/parsoid
14096 <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>
14097 !! end
14098
14099 !! test
14100 Image: caption containing a newline
14101 !! wikitext
14102 [[File:Foobar.jpg|This
14103 *is some text]]
14104 !! html/php
14105 <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>
14106 </p>
14107 !! html/parsoid
14108 <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>
14109 !!end
14110
14111 !!test
14112 Image: caption containing leading space
14113 (The leading space should not trigger nowiki escaping in wt2wt mode)
14114 !! wikitext
14115 [[File:Foobar.jpg|thumb| bar]]
14116 !! html/php
14117 <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>
14118
14119 !! html/parsoid
14120 <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>
14121 !!end
14122
14123 !! test
14124 Image: caption containing a table
14125 !! options
14126 parsoid=wt2html,wt2wt,html2html
14127 !! wikitext
14128 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14129 {|
14130 ! Foo !! Bar
14131 |-
14132 | Foo1 || Bar1
14133 |}
14134 and some more text.]]
14135 !! html/php
14136 <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>
14137
14138 !! html/parsoid
14139 <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
14140 <table>
14141 <tbody>
14142 <tr><th>Foo </th><th>Bar</th></tr>
14143 <tr>
14144 <td>Foo1 </td>
14145 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14146 !! end
14147
14148 !! test
14149 Bug 3090: External links other than http: in image captions
14150 !! wikitext
14151 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14152 !! html/php
14153 <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>
14154
14155 !! html/parsoid
14156 <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>
14157 !! end
14158
14159 !! test
14160 Custom class
14161 !! options
14162 parsoid=wt2html,wt2wt,html2html
14163 !! wikitext
14164 [[Image:foobar.jpg|a|class=b]]
14165 !! html/php
14166 <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>
14167 </p>
14168 !! html/parsoid
14169 <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>
14170 !! end
14171
14172 !! test
14173 Localized image handling (1).
14174 !! options
14175 parsoid=wt2html,wt2wt,html2html
14176 language=es
14177 !! wikitext
14178 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14179 !! html/php
14180 <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>
14181
14182 !! html/parsoid
14183 <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>
14184 !! end
14185
14186 !! test
14187 Localized image handling (2).
14188 !! options
14189 thumbsize=220
14190 parsoid=wt2html,wt2wt,html2html
14191 language=es
14192 !! wikitext
14193 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14194 !! html/php
14195 <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>
14196
14197 !! html/parsoid
14198 <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>
14199 !! end
14200
14201 !! test
14202 Localized image handling (3).
14203 !! options
14204 language=fa
14205 parsoid=html2wt
14206 !! html/parsoid
14207 <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>
14208 !! wikitext
14209 [[File:Foobar.jpg|بندانگشتی]]
14210 !! end
14211
14212 !! test
14213 "border", "frameless" and "class" attributes on an image.
14214 !! options
14215 thumbsize=220
14216 parsoid=wt2html,wt2wt,html2html
14217 !! wikitext
14218 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14219 !! html/php
14220 <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>
14221 </p>
14222 !! html/parsoid
14223 <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>
14224 !! end
14225
14226 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14227 !! test
14228 Invalid image attributes (bug 62500)
14229 !! options
14230 thumbsize=220
14231 parsoid=wt2html,wt2wt,html2html
14232 !! wikitext
14233 [[File:Foobar.jpg|thumb|float|left|caption]]
14234
14235 [[File:Foobar.jpg|thumb|righ|caption]]
14236
14237 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14238 !! html/php
14239 <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>
14240 <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>
14241 <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>
14242
14243 !! html/parsoid
14244 <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>
14245 <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>
14246 <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>
14247 !! end
14248
14249 !! article
14250 File:Barfoo.jpg
14251 !! text
14252 #REDIRECT [[File:Barfoo.jpg]]
14253 !! endarticle
14254
14255 # FIXME: Parsoid should run this test -- but we'd need to teach the
14256 # mockAPI about the redirected Barfoo.jpg image.
14257 !! test
14258 Redirected image
14259 !! wikitext
14260 [[Image:Barfoo.jpg]]
14261 !! html/php
14262 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14263 </p>
14264 !! end
14265
14266 !! test
14267 Missing image with uploads disabled
14268 !! options
14269 wgEnableUploads=0
14270 !! wikitext
14271 [[File:Foobaz.jpg]]
14272 !! html/php
14273 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14274 </p>
14275 !! html/parsoid
14276 <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>
14277 !! end
14278
14279 # Parsoid-specific testing for images
14280 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14281 # Currently imperfect due to a flaw in the Parsoid testrunner
14282 # Work in progress
14283 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14284 # image tests.
14285
14286 !! test
14287 Parsoid-specific image handling - simple image with size and middle alignment
14288 !! wikitext
14289 [[File:Foobar.jpg|middle|50px]]
14290 !! html/parsoid
14291 <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>
14292 !! end
14293
14294 !! test
14295 Parsoid-specific image handling - simple image with size, middle alignment,
14296 non-standard namespace alias
14297 !! options
14298 parsoid=wt2wt,wt2html,html2html
14299 !! wikitext
14300 [[Image:Foobar.jpg|middle|50px]]
14301 !! html/parsoid
14302 <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>
14303 !! end
14304
14305 !! test
14306 Parsoid-specific image handling - simple image with size and middle alignment
14307 (existing content)
14308 !! wikitext
14309 [[File:Foobar.jpg|50px|middle]]
14310 !! html/parsoid
14311 <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>
14312 !! end
14313
14314 !! test
14315 Parsoid-specific image handling - simple image with size and middle alignment
14316 and non-standard namespace name
14317 !! options
14318 parsoid=wt2html,wt2wt,html2html
14319 !! wikitext
14320 [[Image:Foobar.jpg|50px|middle]]
14321 !! html/parsoid
14322 <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>
14323 !! end
14324
14325 !! test
14326 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14327 !! wikitext
14328 [[File:Foobar.jpg|500x10px|baseline|caption]]
14329 !! html/parsoid
14330 <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>
14331 !! end
14332
14333 !! test
14334 Parsoid-specific image handling - simple image with border and size spec
14335 !! wikitext
14336 [[File:Foobar.jpg|50px|border|caption]]
14337 !! html/parsoid
14338 <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>
14339 !! end
14340
14341 !! test
14342 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14343 !! wikitext
14344 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14345 !! html/parsoid
14346 <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>
14347 !! end
14348
14349 !! test
14350 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14351 (existing content)
14352 !! wikitext
14353 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14354 !! html/parsoid
14355 <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>
14356 !! end
14357
14358 !! test
14359 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14360 !! wikitext
14361 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14362 !! html/parsoid
14363 <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>
14364 !! end
14365
14366 !! test
14367 Parsoid-specific image handling - thumbnail with specific size, halign,
14368 valign, and caption (existing content)
14369 !! wikitext
14370 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14371 !! html/parsoid
14372 <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>
14373 !! end
14374
14375 !! test
14376 Parsoid-specific image handling - framed image with specific size and caption
14377 (size is ignored)
14378 !! options
14379 parsoid=wt2html,wt2wt,html2html
14380 !! wikitext
14381 [[File:Foobar.jpg|frame|500x50px|caption]]
14382 !! html/parsoid
14383 <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>
14384 !! end
14385
14386 !! test
14387 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14388 (size is ignored)
14389 !! options
14390 parsoid=wt2html,wt2wt,html2html
14391 !! wikitext
14392 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14393 !! html/parsoid
14394 <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>
14395 !! end
14396
14397 !! test
14398 Parsoid-specific image handling - frameless image with specific size, border, and caption
14399 !! wikitext
14400 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14401 !! html/parsoid
14402 <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>
14403 !! end
14404
14405 !! test
14406 Parsoid-specific image handling - simple image with a formatted caption
14407 !! wikitext
14408 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14409 !! html/parsoid
14410 <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>
14411 !! end
14412
14413 !! test
14414 Parsoid-specific image handling - caption with a template in it
14415 !! wikitext
14416 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14417 !! html/parsoid
14418 <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>
14419 !! end
14420
14421 !! test
14422 Parsoid-specific image handling - caption with unbalanced tags in it
14423 !! options
14424 parsoid=wt2html,wt2wt,html2html
14425 !! wikitext
14426 foo
14427 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14428 bar
14429 !! html/parsoid
14430 <p>foo</p>
14431 <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>
14432 <p>bar</p>
14433 !! end
14434
14435 !! test
14436 Parsoid-specific image handling - empty caption (1)
14437 !! options
14438 parsoid=wt2html,wt2wt
14439 !! wikitext
14440 [[File:Foobar.jpg|thumb|]]
14441 !! html/parsoid
14442 <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>
14443 !! end
14444
14445 # empty captions don't get serialized unless we're in the "round trip" case
14446 !! test
14447 Parsoid-specific image handling - empty caption (2)
14448 !! options
14449 parsoid=html2wt
14450 !! html/parsoid
14451 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14452 <a href="./File:Foobar.jpg">
14453 <img resource="./File:Foobar.jpg"
14454 src="//example.com/images/3/3a/Foobar.jpg"
14455 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14456 height="25" width="220"/>
14457 </a>
14458 <figcaption></figcaption>
14459 </figure>
14460 !! wikitext
14461 [[File:Foobar.jpg|thumb]]
14462 !! end
14463
14464 !! test
14465 Parsoid-specific image handling - whitespace caption
14466 !! wikitext
14467 [[File:Foobar.jpg|thumb| ]]
14468 !! html/parsoid
14469 <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>
14470 !! end
14471
14472 !! test
14473 Parsoid-specific image handling - lang option
14474 !! wikitext
14475 foo
14476 [[File:Foobar.svg|lang=de|caption]]
14477 bar
14478 !! html/parsoid
14479 <p>foo
14480 <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>
14481 bar</p>
14482 !! end
14483
14484 ## Edge case bugs in Parsoid from T93580
14485 !! test
14486 T93580: 1. Templated <ref> inside block images
14487 !! wikitext
14488 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14489
14490 <references />
14491 !! html/parsoid
14492 <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>
14493
14494 <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>
14495 !! end
14496
14497 !! test
14498 T93580: 2. <ref> inside inline images
14499 !! wikitext
14500 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14501
14502 <references />
14503 !! html/parsoid
14504 <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>
14505
14506 <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>
14507 !! end
14508
14509 !! test
14510 T93580: 3. Templated <ref> inside inline images
14511 !! wikitext
14512 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14513
14514 <references />
14515 !! html/parsoid
14516 <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>
14517
14518 <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>
14519 !! end
14520
14521 ###
14522 ### Subpages
14523 ###
14524 !! article
14525 Subpage test/subpage
14526 !! text
14527 foo
14528 !! endarticle
14529
14530 !! test
14531 Subpage link
14532 !! options
14533 subpage title=[[Subpage test]]
14534 !! wikitext
14535 [[/subpage]]
14536 !! html
14537 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14538 </p>
14539 !! end
14540
14541 !! test
14542 Subpage noslash link
14543 !! options
14544 subpage title=[[Subpage test]]
14545 !! wikitext
14546 [[/subpage/]]
14547 !! html
14548 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14549 </p>
14550 !! end
14551
14552 !! article
14553 Subpage test/1/2/subpage
14554 !! text
14555 blah
14556 !! endarticle
14557
14558 !! test
14559 Relative subpage noslash link
14560 !! options
14561 parsoid=wt2wt,wt2html,html2html
14562 subpage title=[[Subpage test/1/2/3/4]]
14563 !! wikitext
14564 [[../../subpage/]]
14565
14566 [[../../subpage]]
14567 !! html/php
14568 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14569 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14570 </p>
14571 !! html/parsoid
14572 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14573 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14574 !! end
14575
14576 !! test
14577 Parsoid: dot-slash prefixed wikilinks
14578 !! wikitext
14579 [[./foo]]
14580
14581 [[././bar]]
14582
14583 [[././baz/]]
14584 !! html/php
14585 <p>[[./foo]]
14586 </p><p>[[././bar]]
14587 </p><p>[[././baz/]]
14588 </p>
14589 !! html/parsoid
14590 <p>[[./foo]]
14591 </p><p>[[././bar]]
14592 </p><p>[[././baz/]]
14593 </p>
14594 !! end
14595
14596 !! test
14597 Render invalid page names as plain text (bug 51090)
14598 !! wikitext
14599 [[./../foo|bar]]
14600 [[foo�|bar]]
14601 [[foo/.|bar]]
14602 [[foo/..|bar]]
14603 [[foo~~~bar]]
14604 [[foo>bar]]
14605 [[foo[bar]]
14606 [[.]]
14607 [[..]]
14608 [[foo././bar]]
14609
14610 [[{{echo|./../foo}}|bar]]
14611 [[{{echo|foo/.}}|bar]]
14612 [[{{echo|foo/..}}|bar]]
14613 [[{{echo|foo~~~~bar}}]]
14614 [[{{echo|foo>bar}}]]
14615 [[{{echo|foo././bar}}]]
14616 [[{{echo|foo{bar}}]]
14617 [[{{echo|foo}bar}}]]
14618 [[{{echo|foo[bar}}]]
14619 [[{{echo|foo]bar}}]]
14620 [[{{echo|foo<bar}}]]
14621 !!html/php
14622 <p>[[./../foo|bar]]
14623 [[foo�|bar]]
14624 [[foo/.|bar]]
14625 [[foo/..|bar]]
14626 [[foo~~~bar]]
14627 [[foo&gt;bar]]
14628 [[foo[bar]]
14629 [[.]]
14630 [[..]]
14631 [[foo././bar]]
14632 </p><p>[[./../foo|bar]]
14633 [[foo/.|bar]]
14634 [[foo/..|bar]]
14635 [[foo~~~~bar]]
14636 [[foo&gt;bar]]
14637 [[foo././bar]]
14638 [[foo{bar]]
14639 [[foo}bar]]
14640 [[foo[bar]]
14641 [[foo]bar]]
14642 [[foo&lt;bar]]
14643 </p>
14644 !!html/parsoid
14645 <p>[[./../foo|bar]]
14646 [[foo�|bar]]
14647 [[foo/.|bar]]
14648 [[foo/..|bar]]
14649 [[foo~~~bar]]
14650 [[foo>bar]]
14651 [[foo[bar]]
14652 [[.]]
14653 [[..]]
14654 [[foo././bar]]</p>
14655
14656 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14657 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14658 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14659 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14660 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14661 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14662 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14663 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14664 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14665 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14666 [[<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>
14667 !!end
14668
14669 !! test
14670 Disabled subpages
14671 !! wikitext
14672 [[/subpage]]
14673 !! html
14674 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14675 </p>
14676 !! end
14677
14678 !! test
14679 BUG 561: {{/Subpage}}
14680 !! options
14681 subpage title=[[Page]]
14682 !! wikitext
14683 {{/Subpage}}
14684 !! html
14685 <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>
14686 </p>
14687 !! end
14688
14689 ###
14690 ### Categories
14691 ###
14692 !! article
14693 Category:MediaWiki User's Guide
14694 !! text
14695 blah
14696 !! endarticle
14697
14698 !! test
14699 Link to category
14700 !! wikitext
14701 [[:Category:MediaWiki User's Guide]]
14702 !! html
14703 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14704 </p>
14705 !! end
14706
14707 !! test
14708 Simple category
14709 !! options
14710 cat
14711 !! wikitext
14712 [[Category:MediaWiki User's Guide]]
14713 !! html
14714 cat=MediaWiki_User's_Guide sort=
14715 !! end
14716
14717 !! test
14718 PAGESINCATEGORY invalid title fatal (r33546 fix)
14719 !! wikitext
14720 {{PAGESINCATEGORY:<bogus>}}
14721 !! html
14722 <p>0
14723 </p>
14724 !! end
14725
14726 !! test
14727 Category with different sort key
14728 !! options
14729 cat
14730 !! wikitext
14731 [[Category:MediaWiki User's Guide|Foo]]
14732 !! html
14733 cat=MediaWiki_User's_Guide sort=Foo
14734 !! end
14735
14736 !! test
14737 Category with identical sort key
14738 !! options
14739 cat
14740 !! wikitext
14741 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14742 !! html
14743 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14744 !! end
14745
14746 !! test
14747 Category with empty sort key
14748 !! options
14749 cat
14750 pst
14751 !! wikitext
14752 [[Category:MediaWiki User's Guide|]]
14753 !! html/php
14754 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14755 !! end
14756
14757 !! test
14758 Category with empty sort key and parentheses
14759 !! options
14760 cat
14761 pst
14762 !! wikitext
14763 [[Category:Foo (bar)|]]
14764 !! html/php
14765 [[Category:Foo (bar)|Foo]]
14766 !! end
14767
14768 ## We used to, but no longer wt2wt this test since the default serializer
14769 ## will normalize all categories to serialize on their own line.
14770 ## This wikitext usage is going to be fairly uncommon in production and
14771 ## selser will take care of preserving formatting in those scenarios.
14772 !! test
14773 Category with link tail
14774 !! options
14775 cat
14776 pst
14777 parsoid=wt2html
14778 !! wikitext
14779 123[[Category:Foo]]456
14780 !! html/php
14781 123[[Category:Foo]]456
14782 !! html/parsoid
14783 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14784 !! end
14785
14786 !! test
14787 Category with template
14788 !! options
14789 cat
14790 pst
14791 !! wikitext
14792 [[Category:{{echo|Foo}}]]
14793 !! html/php
14794 [[Category:{{echo|Foo}}]]
14795 !! end
14796
14797 !! test
14798 Category with template in sort key
14799 !! options
14800 cat
14801 pst
14802 !! wikitext
14803 [[Category:Foo|{{echo|Bar}}]]
14804 !! html/php
14805 [[Category:Foo|{{echo|Bar}}]]
14806 !! end
14807
14808 !! test
14809 Category with template in sort key and title
14810 !! options
14811 cat
14812 pst
14813 !! wikitext
14814 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14815 !! html/php
14816 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14817 !! end
14818
14819 ## We used to, but no longer wt2wt this test since the default serializer
14820 ## will normalize all categories to serialize on their own line.
14821 ## This wikitext usage is going to be fairly uncommon in production and
14822 ## selser will take care of preserving formatting in those scenarios.
14823 !! test
14824 Category / paragraph interactions
14825 !! options
14826 parsoid=wt2html
14827 !! wikitext
14828 Foo [[Category:Baz]] Bar
14829
14830 Foo [[Category:Baz]]
14831 Bar
14832
14833 Foo
14834 [[Category:Baz]]
14835 Bar
14836
14837 Foo
14838 [[Category:Baz]] Bar
14839
14840 Foo
14841 [[Category:Baz]]
14842 [[Category:Baz]]
14843 [[Category:Baz]]
14844 Bar
14845
14846 [[Category:Baz]]
14847 [[Category:Baz]]
14848 [[Category:Baz]]
14849
14850 [[Category:Baz]]
14851 {{echo|[[Category:Baz]]}}
14852 [[Category:Baz]]
14853 !! html/php
14854 <p>Foo Bar
14855 </p><p>Foo
14856 Bar
14857 </p><p>Foo
14858 Bar
14859 </p><p>Foo Bar
14860 </p><p>Foo
14861 Bar
14862 </p>
14863 !! html/parsoid
14864 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14865 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14866 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14867 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14868 <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>
14869 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14870 !! end
14871
14872 ## We used to, but no longer wt2wt this test since the default serializer
14873 ## will normalize all categories to serialize on their own line.
14874 ## This wikitext usage is going to be fairly uncommon in production and
14875 ## selser will take care of preserving formatting in those scenarios.
14876 ##
14877 ## The whitespace on the empty line is part of the test. Please do not delete
14878 !! test
14879 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14880 !! options
14881 parsoid=wt2html
14882 !! wikitext
14883 This
14884
14885 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14886
14887 {{echo|[[Category:Foo]] and so should this!}}
14888 !! html/php
14889 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14890 </p>
14891 !! html/parsoid
14892 <p>This
14893
14894 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14895
14896 <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>
14897 !! end
14898
14899 ## Parsoid will not try to wt2wt this while preserving newlines because
14900 ## it suppresses excess newlines within list items -- and we don't want to
14901 ## introduce a special case just for categories, which is, in reality somewhat
14902 ## odd behavior -- categories are unlikely to be used in list items like this
14903 ## in top-level pages and are only likely to show up in template-generated
14904 ## list items where this RT-ing is a non-issue.
14905 ##
14906 ## The whitespace on the empty line is part of the test. Please do not delete
14907 !! test
14908 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14909 !! options
14910 parsoid=wt2html
14911 !! wikitext
14912 * This
14913
14914 [[Category:Foo]] and this should be part of the same list item
14915 * So should this
14916
14917 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14918 !! html
14919 <ul><li>This and this should be part of the same list item</li>
14920 <li>So should this and this should be part of the same list item</li></ul>
14921 !! html/parsoid
14922 <ul>
14923 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14924 <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>
14925 </ul>
14926 !! end
14927
14928 ## Newlines and categories that follow the last item of a list
14929 ## are treated differently because this (list followed by categories)
14930 ## is an extremely common pattern on wikis.
14931 !! test
14932 3. Categories and newlines: newline suppression for last list item should RT properly
14933 !! wikitext
14934 * a
14935 * b
14936
14937 [[Category:Foo]]
14938
14939 [[Category:Bar]]
14940 [[Category:Baz]]
14941 !! html/parsoid
14942 <ul><li> a</li>
14943 <li> b</li></ul>
14944
14945 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14946
14947 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14948 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14949 !! end
14950
14951 !! test
14952 4. Categories and newlines: newline suppression for last list item should RT properly
14953 !! wikitext
14954 * a
14955 **** b
14956
14957 [[Category:Foo]]
14958 !! html/parsoid
14959 <ul><li> a
14960 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14961
14962 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14963 !! end
14964
14965 ## only wt2html for this to make sure the algo only applies to the rightmost path
14966 !! test
14967 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14968 !! options
14969 parsoid=wt2html
14970 !! wikitext
14971 * a
14972 ** b
14973 [[Category:Foo]]
14974 * c
14975 ** d
14976 [[Category:Foo]]
14977 !! html/parsoid
14978 <ul><li> a
14979 <ul><li> b
14980 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14981 <li> c
14982 <ul><li> d</li></ul></li></ul>
14983 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14984 !! end
14985
14986 ## We used to, but no longer wt2wt this test since the default serializer
14987 ## will normalize all categories to serialize on their own line.
14988 ## This wikitext usage is going to be fairly uncommon in production and
14989 ## selser will take care of preserving formatting in those scenarios.
14990 !! test
14991 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14992 !! options
14993 parsoid=wt2html
14994 !! wikitext
14995 * a [[Category:Foo]]
14996 !! html/parsoid
14997 <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>
14998 !! end
14999
15000 # This test also demonstrates because of newline+category tunneling
15001 # through the list hander, template wrapping doesn't expand to the
15002 # containing list when the list item swallows the category.
15003 !! test
15004 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15005 !! wikitext
15006 * {{echo|a
15007 [[Category:Foo]]}}
15008 !! html/parsoid
15009 <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
15010 </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>
15011 !! end
15012
15013 !! test
15014 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15015 !! wikitext
15016 * a
15017
15018 {{echo|[[Category:Foo]]
15019 [[Category:Bar]]}}
15020 [[Category:Baz]]
15021 !! html/parsoid
15022 <ul><li> a</li></ul>
15023
15024 <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">
15025 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15026 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15027 !! end
15028
15029 !! test
15030 Category links with multiple namespaces
15031 !! wikitext
15032 [[Category:Project:Foo]]
15033 !! html/parsoid
15034 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15035 !! end
15036
15037 !! test
15038 Parsoid: Serialize link to category page with colon escape
15039 !! options
15040 parsoid
15041 !! wikitext
15042
15043 [[:Category:Foo]]
15044 [[:Category:Foo|Bar]]
15045 !! html
15046 <p>
15047 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15048 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15049 </p>
15050 !! end
15051
15052 # We used to, but no longer wt2wt this test since the default serializer
15053 # will normalize all categories to serialize on their own line.
15054 # This wikitext usage is going to be fairly uncommon in production and
15055 # selser will take care of preventing whitespace insertion if this
15056 # occurs in an article.
15057 #
15058 # html2html disabled for the same reason (whitespace insertion between
15059 # x and y).
15060 #
15061 # html2wt disabled because it localizes the "Category" namespace.
15062 !! test
15063 Link prefix/suffixes aren't applied to category links
15064 !! options
15065 parsoid=wt2html
15066 language=is
15067 !! wikitext
15068 x[[Category:Foo]]y
15069 !! html/php
15070 <p>xy
15071 </p>
15072 !! html/parsoid
15073 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15074 !! end
15075
15076 !! test
15077 Parsoid: Serialize link to file page with colon escape
15078 !! options
15079 parsoid
15080 !! wikitext
15081
15082 [[:File:Foo.png]]
15083 [[:File:Foo.png|Bar]]
15084 !! html
15085 <p>
15086 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15087 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15088 </p>
15089 !! end
15090
15091 !! test
15092 Parsoid: Serialize a genuine category link without colon escape
15093 !! options
15094 parsoid
15095 !! wikitext
15096 [[Category:Foo]]
15097 [[Category:Foo|Bar]]
15098 !! html
15099 <link rel="mw:PageProp/Category" href="./Category:Foo">
15100 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15101 !! end
15102
15103 !! test
15104 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15105 !! options
15106 parsoid=html2wt
15107 !! html/parsoid
15108 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15109 !! wikitext
15110 [[Category:Toxine bactérienne]]
15111 !! end
15112
15113 !! test
15114 Parsoid: Defaultsort
15115 !! wikitext
15116 {{DEFAULTSORT:Foo}}
15117 !! html/parsoid
15118 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15119 !! end
15120
15121 !! test
15122 Parsoid: Defaultsort (template-generated)
15123 !! wikitext
15124 {{{{echo|DEFAULTSORT}}:Foo}}
15125 !! html/parsoid
15126 <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}}]}'/>
15127 !! end
15128
15129 ###
15130 ### Inter-language links
15131 ###
15132 !! test
15133 Interlanguage links
15134 !! options
15135 ill
15136 !! wikitext
15137 [[es:Alimento]]
15138 [[fr:Nourriture]]
15139 [[zh:食品]]
15140 !! html/php
15141 es:Alimento fr:Nourriture zh:食品
15142 !! html/parsoid
15143 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15144 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15145 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15146 !! end
15147
15148 !! test
15149 Duplicate interlanguage links (bug 24502)
15150 !! options
15151 ill
15152 !! wikitext
15153 [[es:1]]
15154 [[es:2]]
15155 [[fr:1]]
15156 [[fr:2]]
15157 !! html/php
15158 es:1 fr:1
15159 !! html/parsoid
15160 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15161 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15162 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15163 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15164 !! end
15165
15166 ###
15167 ### Sections
15168 ###
15169 !! test
15170 Basic section headings
15171 !! wikitext
15172 == Headline 1 ==
15173 Some text
15174
15175 ==Headline 2==
15176 More
15177 ===Smaller headline===
15178 Blah blah
15179 !! html
15180 <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>
15181 <p>Some text
15182 </p>
15183 <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>
15184 <p>More
15185 </p>
15186 <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>
15187 <p>Blah blah
15188 </p>
15189 !! end
15190
15191 !! test
15192 Section headings with TOC
15193 !! wikitext
15194 == Headline 1 ==
15195 === Subheadline 1 ===
15196 ===== Skipping a level =====
15197 ====== Skipping a level ======
15198
15199 == Headline 2 ==
15200 Some text
15201 ===Another headline===
15202 !! html
15203 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15204 <ul>
15205 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15206 <ul>
15207 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15208 <ul>
15209 <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>
15210 <ul>
15211 <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>
15212 </ul>
15213 </li>
15214 </ul>
15215 </li>
15216 </ul>
15217 </li>
15218 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15219 <ul>
15220 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15221 </ul>
15222 </li>
15223 </ul>
15224 </div>
15225
15226 <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>
15227 <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>
15228 <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>
15229 <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>
15230 <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>
15231 <p>Some text
15232 </p>
15233 <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>
15234
15235 !! end
15236
15237 !! test
15238 TOC anchors don't collide
15239 !! wikitext
15240 __FORCETOC__
15241 == Headline 2 ==
15242 == Headline ==
15243 == Headline 2 ==
15244 == Headline ==
15245 !! html/php
15246 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15247 <ul>
15248 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15249 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15250 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15251 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15252 </ul>
15253 </div>
15254
15255 <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>
15256 <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>
15257 <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>
15258 <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>
15259
15260 !! end
15261
15262 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15263 !! test
15264 Handling of sections up to level 6 and beyond
15265 !! wikitext
15266 = Level 1 Heading=
15267 == Level 2 Heading==
15268 === Level 3 Heading===
15269 ==== Level 4 Heading====
15270 ===== Level 5 Heading=====
15271 ====== Level 6 Heading======
15272 ======= Level 7 Heading=======
15273 ======== Level 8 Heading========
15274 ========= Level 9 Heading=========
15275 ========== Level 10 Heading==========
15276 !! html
15277 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15278 <ul>
15279 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15280 <ul>
15281 <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>
15282 <ul>
15283 <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>
15284 <ul>
15285 <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>
15286 <ul>
15287 <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>
15288 <ul>
15289 <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>
15290 <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>
15291 <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>
15292 <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>
15293 <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>
15294 </ul>
15295 </li>
15296 </ul>
15297 </li>
15298 </ul>
15299 </li>
15300 </ul>
15301 </li>
15302 </ul>
15303 </li>
15304 </ul>
15305 </div>
15306
15307 <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>
15308 <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>
15309 <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>
15310 <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>
15311 <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>
15312 <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>
15313 <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>
15314 <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>
15315 <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>
15316 <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>
15317
15318 !! end
15319
15320 !! test
15321 TOC regression (T11764)
15322 !! wikitext
15323 == title 1 ==
15324 === title 1.1 ===
15325 ==== title 1.1.1 ====
15326 === title 1.2 ===
15327 == title 2 ==
15328 === title 2.1 ===
15329 !! html
15330 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15331 <ul>
15332 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15333 <ul>
15334 <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>
15335 <ul>
15336 <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>
15337 </ul>
15338 </li>
15339 <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>
15340 </ul>
15341 </li>
15342 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15343 <ul>
15344 <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>
15345 </ul>
15346 </li>
15347 </ul>
15348 </div>
15349
15350 <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>
15351 <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>
15352 <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>
15353 <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>
15354 <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>
15355 <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>
15356
15357 !! end
15358
15359 !! test
15360 TOC for heading containing <span id="..."></span> (T96153)
15361 !! wikitext
15362 __FORCETOC__
15363 ==<span id="old-anchor"></span>New title==
15364 !! html/php
15365 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15366 <ul>
15367 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15368 </ul>
15369 </div>
15370
15371 <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>
15372
15373 !! end
15374
15375 !! test
15376 TOC with wgMaxTocLevel=3 (bug 6204)
15377 !! options
15378 wgMaxTocLevel=3
15379 !! wikitext
15380 == title 1 ==
15381 === title 1.1 ===
15382 ==== title 1.1.1 ====
15383 === title 1.2 ===
15384 == title 2 ==
15385 === title 2.1 ===
15386 !! html
15387 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15388 <ul>
15389 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15390 <ul>
15391 <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>
15392 <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>
15393 </ul>
15394 </li>
15395 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15396 <ul>
15397 <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>
15398 </ul>
15399 </li>
15400 </ul>
15401 </div>
15402
15403 <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>
15404 <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>
15405 <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>
15406 <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>
15407 <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>
15408 <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>
15409
15410 !! end
15411
15412 !! test
15413 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15414 !! options
15415 wgMaxTocLevel=3
15416 !! wikitext
15417 ==Section 1==
15418 ===Section 1.1===
15419 ====Section 1.1.1====
15420 ====Section 1.1.1.1====
15421 ==Section 2==
15422 !! html
15423 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15424 <ul>
15425 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15426 <ul>
15427 <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>
15428 </ul>
15429 </li>
15430 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15431 </ul>
15432 </div>
15433
15434 <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>
15435 <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>
15436 <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>
15437 <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>
15438 <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>
15439
15440 !! end
15441
15442
15443 !! test
15444 Resolving duplicate section names
15445 !! wikitext
15446 == Foo bar ==
15447 == Foo bar ==
15448 !! html
15449 <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>
15450 <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>
15451
15452 !! end
15453
15454 !! test
15455 Resolving duplicate section names with differing case (bug 10721)
15456 !! wikitext
15457 == Foo bar ==
15458 == Foo Bar ==
15459 !! html
15460 <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>
15461 <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>
15462
15463 !! end
15464
15465 !! article
15466 Template:sections
15467 !! text
15468 ===Section 1===
15469 ==Section 2==
15470 !! endarticle
15471
15472 !! test
15473 Template with sections, __NOTOC__
15474 !! wikitext
15475 __NOTOC__
15476 ==Section 0==
15477 {{sections}}
15478 ==Section 4==
15479 !! html
15480 <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>
15481 <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>
15482 <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>
15483 <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>
15484
15485 !! end
15486
15487 !! test
15488 __NOEDITSECTION__ keyword
15489 !! wikitext
15490 __NOEDITSECTION__
15491 ==Section 1==
15492 ==Section 2==
15493 !! html
15494 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15495 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15496
15497 !! end
15498
15499 !! test
15500 Link inside a section heading
15501 !! wikitext
15502 ==Section with a [[Main Page|link]] in it==
15503 !! html
15504 <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>
15505
15506 !! end
15507
15508 !! test
15509 TOC regression (T14077)
15510 !! wikitext
15511 __TOC__
15512 == title 1 ==
15513 === title 1.1 ===
15514 == title 2 ==
15515 !! html
15516 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15517 <ul>
15518 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15519 <ul>
15520 <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>
15521 </ul>
15522 </li>
15523 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15524 </ul>
15525 </div>
15526
15527 <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>
15528 <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>
15529 <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>
15530
15531 !! end
15532
15533 !! test
15534 BUG 1219 URL next to image (good)
15535 !! wikitext
15536 http://example.com [[File:Foobar.jpg]]
15537 !! html/php
15538 <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>
15539 </p>
15540 !! html/parsoid
15541 <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>
15542 !!end
15543
15544 !! test
15545 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15546 !! wikitext
15547 ===
15548 The line above must have a trailing space!
15549 === <!--
15550 --> <!-- -->
15551 But just in case it doesn't...
15552 !! html
15553 <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>
15554 <p>The line above must have a trailing space!
15555 </p>
15556 <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>
15557 <p>But just in case it doesn't...
15558 </p>
15559 !! end
15560
15561 !! test
15562 Header with special characters (bug 25462)
15563 !! wikitext
15564 The tooltips shall not show entities to the user (ie. be double escaped)
15565
15566 == text > text ==
15567 section 1
15568
15569 == text < text ==
15570 section 2
15571
15572 == text & text ==
15573 section 3
15574
15575 == text ' text ==
15576 section 4
15577
15578 == text " text ==
15579 section 5
15580 !! html
15581 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15582 </p>
15583 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15584 <ul>
15585 <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>
15586 <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>
15587 <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>
15588 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15589 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15590 </ul>
15591 </div>
15592
15593 <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>
15594 <p>section 1
15595 </p>
15596 <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>
15597 <p>section 2
15598 </p>
15599 <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>
15600 <p>section 3
15601 </p>
15602 <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>
15603 <p>section 4
15604 </p>
15605 <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>
15606 <p>section 5
15607 </p>
15608 !! end
15609
15610 !! test
15611 Header with space, plus and underscore as entity
15612 !! wikitext
15613 Id should not contain + for spaces
15614
15615 == Space between Text ==
15616 section 1
15617
15618 == Space-Entity&#32;between&#32;Text ==
15619 section 2
15620
15621 == Plus+between+Text ==
15622 section 3
15623
15624 == Plus-Entity&#43;between&#43;Text ==
15625 section 4
15626
15627 == Underscore_between_Text ==
15628 section 5
15629
15630 == Underscore-Entity&#95;between&#95;Text ==
15631 section 6
15632
15633 [[#Space between Text]]
15634 [[#Space-Entity&#32;between&#32;Text]]
15635 [[#Plus+between+Text]]
15636 [[#Plus-Entity&#43;between&#43;Text]]
15637 [[#Underscore_between_Text]]
15638 [[#Underscore-Entity&#95;between&#95;Text]]
15639 !! html
15640 <p>Id should not contain + for spaces
15641 </p>
15642 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15643 <ul>
15644 <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>
15645 <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>
15646 <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>
15647 <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>
15648 <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>
15649 <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>
15650 </ul>
15651 </div>
15652
15653 <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>
15654 <p>section 1
15655 </p>
15656 <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>
15657 <p>section 2
15658 </p>
15659 <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>
15660 <p>section 3
15661 </p>
15662 <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>
15663 <p>section 4
15664 </p>
15665 <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>
15666 <p>section 5
15667 </p>
15668 <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>
15669 <p>section 6
15670 </p><p><a href="#Space_between_Text">#Space between Text</a>
15671 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15672 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15673 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15674 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15675 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15676 </p>
15677 !! end
15678
15679 !! test
15680 Headers with excess '=' characters
15681 (Are similar tests necessary beyond the 1st level?)
15682 !! wikitext
15683 =foo==
15684 ==foo=
15685 =''italic'' heading==
15686 ==''italic'' heading=
15687 !! html
15688 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15689 <ul>
15690 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15691 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15692 <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>
15693 <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>
15694 </ul>
15695 </div>
15696
15697 <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>
15698 <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>
15699 <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>
15700 <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>
15701
15702 !! end
15703
15704 !! test
15705 HTML headers vs TOC (bug 23393)
15706 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15707 !! wikitext
15708 <h1>Header 1</h1>
15709 == Header 1.1 ==
15710 == Header 1.2 ==
15711
15712 <h1>Header 2
15713 </h1>
15714 == Header 2.1 ==
15715 == Header 2.2 ==
15716 __NOEDITSECTION__
15717 !! html
15718 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15719 <ul>
15720 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15721 <ul>
15722 <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>
15723 <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>
15724 </ul>
15725 </li>
15726 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15727 <ul>
15728 <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>
15729 <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>
15730 </ul>
15731 </li>
15732 </ul>
15733 </div>
15734
15735 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15736 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15737 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15738 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15739 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15740 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15741
15742 !! end
15743
15744 !! test
15745 Single-line or multiline-comments can follow headings
15746 !! options
15747 parsoid=wt2html,wt2wt
15748 !! wikitext
15749 ==foo==<!---->
15750 ==bar==<!--c1-->
15751 ==baz==<!--
15752 c2
15753 c3-->
15754 !! html
15755 <h2><span class="mw-headline" id="foo">foo</span></h2>
15756 <h2><span class="mw-headline" id="bar">bar</span></h2>
15757 <h2><span class="mw-headline" id="baz">baz</span></h2>
15758
15759 !! end
15760
15761 !! test
15762 BUG 1219 URL next to image (broken)
15763 !! wikitext
15764 http://example.com[[File:Foobar.jpg]]
15765 !! html/php
15766 <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>
15767 </p>
15768 !! html/parsoid
15769 <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>
15770 !!end
15771
15772 !! test
15773 Bug 1186 news: in the middle of text
15774 !! wikitext
15775 http://en.wikinews.org/wiki/Wikinews:Workplace
15776 !! html
15777 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15778 </p>
15779 !!end
15780
15781
15782 !! test
15783 Namespaced link must have a title
15784 !! wikitext
15785 [[Project:]]
15786 !! html
15787 <p>[[Project:]]
15788 </p>
15789 !!end
15790
15791 !! test
15792 Namespaced link must have a title (bad fragment version)
15793 !! wikitext
15794 [[Project:#fragment]]
15795 !! html
15796 <p>[[Project:#fragment]]
15797 </p>
15798 !!end
15799
15800
15801 ###
15802 ### HTML tags and HTML attributes
15803 ###
15804
15805 !! test
15806 div with no attributes
15807 !! wikitext
15808 <div>HTML rocks</div>
15809 !! html
15810 <div>HTML rocks</div>
15811
15812 !! end
15813
15814 !! test
15815 div with double-quoted attribute
15816 !! wikitext
15817 <div id="rock">HTML rocks</div>
15818 !! html
15819 <div id="rock">HTML rocks</div>
15820
15821 !! end
15822
15823 !! test
15824 div with single-quoted attribute
15825 !! wikitext
15826 <div id='rock'>HTML rocks</div>
15827 !! html
15828 <div id="rock">HTML rocks</div>
15829
15830 !! end
15831
15832 !! test
15833 div with unquoted attribute
15834 !! wikitext
15835 <div id=rock>HTML rocks</div>
15836 !! html
15837 <div id="rock">HTML rocks</div>
15838
15839 !! end
15840
15841 !! test
15842 div with illegal double attributes
15843 !! wikitext
15844 <div id="a" id="b">HTML rocks</div>
15845 !! html
15846 <div id="b">HTML rocks</div>
15847
15848 !!end
15849
15850 !! test
15851 div with empty attribute value, space before equals
15852 !! options
15853 parsoid=wt2html,html2html
15854 !! wikitext
15855 <div class =>HTML rocks</div>
15856 !! html/php
15857 <div class="">HTML rocks</div>
15858
15859 !! html/parsoid
15860 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15861 !! end
15862
15863 !! test
15864 div with multiple empty attribute values
15865 !! options
15866 parsoid=wt2html,html2html
15867 !! wikitext
15868 <div id= title=>HTML rocks</div>
15869 !! html/php
15870 <div id="title.3D">HTML rocks</div>
15871
15872 !! html/parsoid
15873 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15874 !! end
15875
15876 !! test
15877 table with multiple empty attribute values
15878 !! options
15879 parsoid=wt2html,html2html
15880 !! wikitext
15881 {| title= id=
15882 | hi
15883 |}
15884 !! html/php
15885 <table title="id=">
15886 <tr>
15887 <td> hi
15888 </td></tr></table>
15889
15890 !! html/parsoid
15891 <table title="id=">
15892 <tbody><tr><td> hi</td></tr>
15893 </tbody></table>
15894 !! end
15895
15896 !! test
15897 div with braces in attribute value
15898 !! wikitext
15899 <div title="{}">Foo</div>
15900 !! html/php
15901 <div title="&#123;}">Foo</div>
15902
15903 !! html/parsoid
15904 <div title="{}">Foo</div>
15905 !! end
15906
15907 !! test
15908 div with empty attribute value, no space before equals
15909 !! options
15910 parsoid=wt2html,html2html
15911 !! wikitext
15912 <div class=>HTML rocks</div>
15913 !! html/php
15914 <div class="">HTML rocks</div>
15915
15916 !! html/parsoid
15917 <div class="">HTML rocks</div>
15918 !! end
15919
15920 !! test
15921 HTML multiple attributes correction
15922 !! wikitext
15923 <p class="error" class="awesome">Awesome!</p>
15924 !! html
15925 <p class="awesome">Awesome!</p>
15926
15927 !!end
15928
15929 !! test
15930 Table multiple attributes correction
15931 !! wikitext
15932 {|
15933 !+ class="error" class="awesome"| status
15934 |}
15935 !! html
15936 <table>
15937 <tr>
15938 <th class="awesome"> status
15939 </th></tr></table>
15940
15941 !!end
15942
15943 !! test
15944 DIV IN UPPERCASE
15945 !! wikitext
15946 <DIV ID="x">HTML ROCKS</DIV>
15947 !! html
15948 <div id="x">HTML ROCKS</div>
15949
15950 !!end
15951
15952 !! test
15953 Non-ASCII pseudo-tags are rendered as text
15954 !! wikitext
15955 <khyô>
15956 !! html
15957 <p>&lt;khyô&gt;
15958 </p>
15959 !! end
15960
15961 !! test
15962 Pseudo-tag with URL 'name' renders as url link
15963 !! wikitext
15964 <http://example.com/>
15965 !! html
15966 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15967 </p>
15968 !! end
15969
15970 !! test
15971 text with amp in the middle of nowhere
15972 !! wikitext
15973 Remember AT&T?
15974 !! html
15975 <p>Remember AT&amp;T?
15976 </p>
15977 !! end
15978
15979 !! test
15980 text with character entity: eacute
15981 !! wikitext
15982 I always thought &eacute; was a cute letter.
15983 !! html
15984 <p>I always thought &#233; was a cute letter.
15985 </p>
15986 !! html+tidy
15987 <p>I always thought é was a cute letter.</p>
15988 !! end
15989
15990 !! test
15991 text with entity-escaped character entity-like string: eacute
15992 !! wikitext
15993 I always thought &amp;eacute; was a cute letter.
15994 !! html
15995 <p>I always thought &amp;eacute; was a cute letter.
15996 </p>
15997 !! end
15998
15999 !! test
16000 text with undefined character entity: xacute
16001 !! wikitext
16002 I always thought &xacute; was a cute letter.
16003 !! html
16004 <p>I always thought &amp;xacute; was a cute letter.
16005 </p>
16006 !! end
16007
16008 !! test
16009 HTML5 tags
16010 !! wikitext
16011 <data value="5">five</data>
16012 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16013 <mark>This highlighted text</mark>
16014 !! html
16015 <p><data value="5">five</data>
16016 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16017 <mark>This highlighted text</mark>
16018 </p>
16019 !! end
16020
16021 !! test
16022 HTML tag with leading space is parsed as text
16023 !! wikitext
16024 < div>foo< /div>
16025 !! html
16026 <p>&lt; div&gt;foo&lt; /div&gt;
16027 </p>
16028 !! end
16029
16030 ###
16031 ### Nesting tests (see bug 41545, 50604, 51081)
16032 ###
16033
16034 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16035 # Note that html2wt is considerably more difficult if we use <b> in
16036 # the test case, instead of <big>
16037 !! test
16038 Ensure that HTML adoption agency algorithm is properly implemented.
16039 !! wikitext
16040 <big>X<big>Y</big>Z</big>
16041 !! html
16042 <p><big>X<big>Y</big>Z</big>
16043 </p>
16044 !! end
16045
16046 # This was bug 41545 in the PHP parser.
16047 # Note that tidy doesn't handle this correctly.
16048 !! test
16049 Nesting of <kbd>
16050 !! wikitext
16051 <kbd>X<kbd>Y</kbd>Z</kbd>
16052 !! html
16053 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16054 </p>
16055 !! end
16056
16057 # The following cases were bug 51081 in the PHP parser.
16058 # Note that there are some other nestable tags (b, i, etc) which are
16059 # not covered; see bug 51081 for discussion.
16060
16061 # Note that tidy doesn't handle this correctly.
16062 !! test
16063 Nesting of <em>
16064 !! wikitext
16065 <em>X<em>Y</em>Z</em>
16066 !! html
16067 <p><em>X<em>Y</em>Z</em>
16068 </p>
16069 !! end
16070
16071 # Note that tidy doesn't handle this correctly.
16072 !! test
16073 Nesting of <strong>
16074 !! wikitext
16075 <strong>X<strong>Y</strong>Z</strong>
16076 !! html
16077 <p><strong>X<strong>Y</strong>Z</strong>
16078 </p>
16079 !! end
16080
16081 !! test
16082 Nesting of <q>
16083 !! wikitext
16084 <q>X<q>Y</q>Z</q>
16085 !! html+tidy
16086 <p><q>X<q>Y</q>Z</q></p>
16087 !! end
16088
16089 # Note that tidy doesn't handle this correctly.
16090 !! test
16091 Nesting of <ruby>
16092 !! wikitext
16093 <ruby>X<ruby>Y</ruby>Z</ruby>
16094 !! html
16095 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16096 </p>
16097 !! end
16098
16099 # Note that tidy doesn't handle this correctly.
16100 !! test
16101 Nesting of <bdo>
16102 !! wikitext
16103 <bdo>X<bdo>Y</bdo>Z</bdo>
16104 !! html
16105 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16106 </p>
16107 !! end
16108
16109
16110 ###
16111 ### Media links
16112 ###
16113
16114 !! test
16115 Media link
16116 !! wikitext
16117 [[Media:Foobar.jpg]]
16118 !! html
16119 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16120 </p>
16121 !! end
16122
16123 !! test
16124 Media link with text
16125 !! wikitext
16126 [[Media:Foobar.jpg|A neat file to look at]]
16127 !! html
16128 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16129 </p>
16130 !! end
16131
16132 # FIXME: this is still bad HTML tag nesting
16133 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16134 !! test
16135 Media link with nasty text
16136 !! wikitext
16137 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16138 !! html
16139 <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>
16140
16141 !! html+tidy
16142 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16143 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16144 !! end
16145
16146 !! test
16147 Media link to nonexistent file (bug 1702)
16148 !! wikitext
16149 [[Media:No such.jpg]]
16150 !! html
16151 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16152 </p>
16153 !! end
16154
16155 !! test
16156 Image link to nonexistent file (bug 1850 - good)
16157 !! wikitext
16158 [[File:No_such.jpg]]
16159 !! html/php
16160 <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>
16161 </p>
16162 !! html/parsoid
16163 <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>
16164 !! end
16165
16166 !! test
16167 :Image link to nonexistent file (bug 1850 - bad)
16168 !! wikitext
16169 [[:Image:No such.jpg]]
16170 !! html/php
16171 <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>
16172 </p>
16173 !! html/parsoid
16174 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16175 !! end
16176
16177
16178
16179 !! test
16180 Character reference normalization in link text (bug 1938)
16181 !! wikitext
16182 [[Main Page|this&that]]
16183 !! html
16184 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16185 </p>
16186 !!end
16187
16188 !! article
16189 אַ
16190 !! text
16191 Test for unicode normalization
16192
16193 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16194 !! endarticle
16195
16196 !! test
16197 (bug 19451) Links should refer to the normalized form.
16198 !! wikitext
16199 [[&#xFB2E;]]
16200 [[&#x5d0;&#x5b7;]]
16201 [[&#x5d0;ַ]]
16202 [[א&#x5b7;]]
16203 [[אַ]]
16204 !! html
16205 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16206 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16207 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16208 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16209 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16210 </p>
16211 !! end
16212
16213 !! test
16214 Empty attribute crash test (bug 2067)
16215 !! wikitext
16216 <font color="">foo</font>
16217 !! html
16218 <p><font color="">foo</font>
16219 </p>
16220 !! end
16221
16222 !! test
16223 Empty attribute crash test single-quotes (bug 2067)
16224 !! wikitext
16225 <font color=''>foo</font>
16226 !! html
16227 <p><font color="">foo</font>
16228 </p>
16229 !! end
16230
16231 !! test
16232 Attribute test: equals, then nothing
16233 !! options
16234 parsoid=wt2html,html2html
16235 !! wikitext
16236 <font color=>foo</font>
16237 !! html/php
16238 <p><font color="">foo</font>
16239 </p>
16240 !! html/parsoid
16241 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16242 !! end
16243
16244 !! test
16245 Attribute test: unquoted value
16246 !! options
16247 parsoid=wt2html,html2html
16248 !! wikitext
16249 <font color=x>foo</font>
16250 !! html/php
16251 <p><font color="x">foo</font>
16252 </p>
16253 !! html/parsoid
16254 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16255 !! end
16256
16257 !! test
16258 Attribute test: unquoted but illegal value (hash)
16259 !! wikitext
16260 <font color=#x>foo</font>
16261 !! html
16262 <p><font color="#x">foo</font>
16263 </p>
16264 !! end
16265
16266 # Parsoid does not serialize to empty attribute syntax,
16267 # so wt2wt and html2wt cases are skipped
16268 !! test
16269 Attribute test: no value (T54330)
16270 !! options
16271 parsoid=wt2html,html2html
16272 !! wikitext
16273 <font color>foo</font>
16274 !! html/php
16275 <p><font color="">foo</font>
16276 </p>
16277 !! html/parsoid
16278 <p><font color="">foo</font></p>
16279 !! end
16280
16281 !! test
16282 Bug 2095: link with three closing brackets
16283 !! wikitext
16284 [[Main Page]]]
16285 !! html/php
16286 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16287 </p>
16288 !! html/parsoid
16289 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16290 !! end
16291
16292 !! test
16293 Bug 2095: link with pipe and three closing brackets
16294 !! wikitext
16295 [[Main Page|link]]]
16296 !! html/php
16297 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16298 </p>
16299 !! html/parsoid
16300 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16301 !! end
16302
16303 !! test
16304 Bug 2095: link with pipe and three closing brackets, version 2
16305 !! wikitext
16306 [[Main Page|[http://example.com/]]]
16307 !! html/php
16308 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16309 </p>
16310 !! html/parsoid
16311 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16312 !! end
16313
16314
16315 ###
16316 ### Safety
16317 ###
16318
16319 !! article
16320 Template:Dangerous attribute
16321 !! text
16322 " onmouseover="alert(document.cookie)
16323 !! endarticle
16324
16325 !! article
16326 Template:Dangerous style attribute
16327 !! text
16328 border-size: expression(alert(document.cookie))
16329 !! endarticle
16330
16331 !! article
16332 Template:Div style
16333 !! text
16334 <div style="float: right; {{{1}}}">Magic div</div>
16335 !! endarticle
16336
16337 !! test
16338 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16339 !! wikitext
16340 <div title="{{test}}"></div>
16341 !! html
16342 <div title="This is a test template"></div>
16343
16344 !! end
16345
16346 # Parsoid has enough context to handle this case
16347 !! test
16348 Bug 2304: HTML attribute safety (dangerous template; 2309)
16349 !! wikitext
16350 <div title="{{dangerous attribute}}"></div>
16351 !! html/php
16352 <div title=""></div>
16353
16354 !! html/parsoid
16355 <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>
16356 !! end
16357
16358 !! test
16359 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16360 !! wikitext
16361 <div style="{{dangerous style attribute}}"></div>
16362 !! html
16363 <div style="/* insecure input */"></div>
16364
16365 !! end
16366
16367 !! test
16368 Bug 2304: HTML attribute safety (safe parameter; 2309)
16369 !! wikitext
16370 {{div style|width: 200px}}
16371 !! html
16372 <div style="float: right; width: 200px">Magic div</div>
16373
16374 !! end
16375
16376 !! test
16377 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16378 !! wikitext
16379 {{div style|width: expression(alert(document.cookie))}}
16380 !! html
16381 <div style="/* insecure input */">Magic div</div>
16382
16383 !! end
16384
16385 !! test
16386 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16387 !! wikitext
16388 {{div style|"><script>alert(document.cookie)</script>}}
16389 !! html
16390 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16391
16392 !! end
16393
16394 !! test
16395 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16396 !! wikitext
16397 {{div style|" ><script>alert(document.cookie)</script>}}
16398 !! html
16399 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16400
16401 !! end
16402
16403 !! test
16404 Bug 2304: HTML attribute safety (link)
16405 !! wikitext
16406 <div title="[[Main Page]]"></div>
16407 !! html
16408 <div title="&#91;&#91;Main Page]]"></div>
16409
16410 !! end
16411
16412 !! test
16413 Bug 2304: HTML attribute safety (italics)
16414 !! wikitext
16415 <div title="''foobar''"></div>
16416 !! html
16417 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16418
16419 !! end
16420
16421 !! test
16422 Bug 2304: HTML attribute safety (bold)
16423 !! wikitext
16424 <div title="'''foobar'''"></div>
16425 !! html
16426 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16427
16428 !! end
16429
16430
16431 !! test
16432 Bug 2304: HTML attribute safety (ISBN)
16433 !! wikitext
16434 <div title="ISBN 1234567890"></div>
16435 !! html
16436 <div title="&#73;SBN 1234567890"></div>
16437
16438 !! end
16439
16440 !! test
16441 Bug 2304: HTML attribute safety (RFC)
16442 !! wikitext
16443 <div title="RFC 1234"></div>
16444 !! html
16445 <div title="&#82;FC 1234"></div>
16446
16447 !! end
16448
16449 !! test
16450 Bug 2304: HTML attribute safety (PMID)
16451 !! wikitext
16452 <div title="PMID 1234567890"></div>
16453 !! html
16454 <div title="&#80;MID 1234567890"></div>
16455
16456 !! end
16457
16458 !! test
16459 Bug 2304: HTML attribute safety (web link)
16460 !! wikitext
16461 <div title="http://example.com/"></div>
16462 !! html
16463 <div title="http&#58;//example.com/"></div>
16464
16465 !! end
16466
16467 !! test
16468 Bug 2304: HTML attribute safety (named web link)
16469 !! wikitext
16470 <div title="[http://example.com/ link]"></div>
16471 !! html
16472 <div title="&#91;http&#58;//example.com/ link]"></div>
16473
16474 !! end
16475
16476 !! test
16477 Bug 3244: HTML attribute safety (extension; safe)
16478 !! wikitext
16479 <div style="<nowiki>background:blue</nowiki>"></div>
16480 !! html
16481 <div style="background:blue"></div>
16482
16483 !! end
16484
16485 !! test
16486 Bug 3244: HTML attribute safety (extension; unsafe)
16487 !! wikitext
16488 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16489 !! html
16490 <div style="/* insecure input */"></div>
16491
16492 !! end
16493
16494 # More MSIE fun discovered by Tom Gilder
16495
16496 !! test
16497 MSIE CSS safety test: spurious slash
16498 !! wikitext
16499 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16500 !! html
16501 <div style="/* insecure input */">evil</div>
16502
16503 !! end
16504
16505 !! test
16506 MSIE CSS safety test: hex code
16507 !! wikitext
16508 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16509 !! html
16510 <div style="/* insecure input */">evil</div>
16511
16512 !! end
16513
16514 !! test
16515 MSIE CSS safety test: comment in url
16516 !! wikitext
16517 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16518 !! html
16519 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16520
16521 !! end
16522
16523 !! test
16524 MSIE CSS safety test: comment in expression
16525 !! wikitext
16526 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16527 !! html
16528 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16529
16530 !! end
16531
16532 !! test
16533 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16534 !! wikitext
16535 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16536 !! html
16537 <p style="/* invalid control char */">A</p>
16538
16539 !! end
16540
16541 !! test
16542 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16543 !! wikitext
16544 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16545 <div style="top:EXPRESSION(alert())">B</div>
16546 !! html
16547 <p style="/* insecure input */">A</p>
16548 <div style="/* insecure input */">B</div>
16549
16550 !! end
16551
16552 !! test
16553 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16554 !! wikitext
16555 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16556 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16557 !! html
16558 <div style="/* insecure input */">A</div>
16559 <p style="/* insecure input */">B</p>
16560
16561 !! end
16562
16563 !! test
16564 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16565 !! wikitext
16566 <div style="background-image:url⁽javascript:alert())">A</div>
16567 <div style="background-image:url₍javascript:alert())">B</div>
16568 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16569 !! html
16570 <div style="/* insecure input */">A</div>
16571 <div style="/* insecure input */">B</div>
16572 <p style="/* insecure input */">C</p>
16573
16574 !! end
16575
16576 # FIXME: Parsoid fails to sanitize this! See T58846.
16577 !! test
16578 Opera -o-link CSS
16579 !! wikitext
16580 <div
16581 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;"
16582 style="-o-link:attr(title);-o-link-source:current">X</div>
16583 !! html
16584 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16585
16586 !! end
16587
16588 !! test
16589 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16590 !! wikitext
16591 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16592 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16593 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16594 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16595 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16596 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16597 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16598 !! html
16599 <p style="/* insecure input */">A</p>
16600 <p style="/* insecure input */">B</p>
16601 <p style="/* insecure input */">C</p>
16602 <p style="/* insecure input */">D</p>
16603 <p style="/* insecure input */">E</p>
16604 <p style="/* insecure input */">F</p>
16605 <p style="/* insecure input */">G</p>
16606
16607 !! end
16608
16609 !! test
16610 Table attribute legitimate extension
16611 !! wikitext
16612 {|
16613 !+ style="<nowiki>color:blue</nowiki>"| status
16614 |}
16615 !! html
16616 <table>
16617 <tr>
16618 <th style="color:blue"> status
16619 </th></tr></table>
16620
16621 !!end
16622
16623 !! test
16624 Table attribute safety
16625 !! wikitext
16626 {|
16627 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16628 |}
16629 !! html
16630 <table>
16631 <tr>
16632 <th style="/* insecure input */"> status
16633 </th></tr></table>
16634
16635 !! end
16636
16637 !! test
16638 CSS line continuation 1
16639 !! wikitext
16640 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16641 !! html
16642 <div style="/* insecure input */"></div>
16643
16644 !! end
16645
16646 !! test
16647 CSS line continuation 2
16648 !! wikitext
16649 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16650 !! html
16651 <div style="/* invalid control char */"></div>
16652
16653 !! end
16654
16655 !! article
16656 Template:Identity
16657 !! text
16658 {{{1}}}
16659 !! endarticle
16660
16661 !! test
16662 Expansion of multi-line templates in attribute values (bug 6255)
16663 !! wikitext
16664 <div style="background: {{identity|#00FF00}}">-</div>
16665 !! html
16666 <div style="background: #00FF00">-</div>
16667
16668 !! end
16669
16670
16671 !! test
16672 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16673 !! wikitext
16674 <div style="background:
16675 #00FF00">-</div>
16676 !! html/php
16677 <div style="background: #00FF00">-</div>
16678
16679 !! html/parsoid
16680 <div style="background:
16681 #00FF00">-</div>
16682 !! end
16683
16684 !! test
16685 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16686 !! wikitext
16687 <div style="background: &#10;#00FF00">-</div>
16688 !! html
16689 <div style="background: &#10;#00FF00">-</div>
16690
16691 !! end
16692
16693 !! test
16694 evil <math>-wiki-tags without Extension:Math enabled
16695 !! wikitext
16696 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16697 !! html+tidy
16698 <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>
16699 !! end
16700
16701 ###
16702 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16703 ###
16704 !! test
16705 Parser hook: empty input
16706 !! wikitext
16707 <tag></tag>
16708 !! html/php
16709 <pre>
16710 ''
16711 array (
16712 )
16713 </pre>
16714
16715 !! html/parsoid
16716 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16717 !! end
16718
16719 ## Don't expect parsoid to rt this form.
16720 !! test
16721 Parser hook: empty input using terminated empty elements
16722 !! options
16723 parsoid=wt2html,html2html
16724 !! wikitext
16725 <tag/>
16726 !! html/php
16727 <pre>
16728 NULL
16729 array (
16730 )
16731 </pre>
16732
16733 !! html/parsoid
16734 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16735 !! end
16736
16737 !! test
16738 Parser hook: empty input using terminated empty elements (space before)
16739 !! wikitext
16740 <tag />
16741 !! html/php
16742 <pre>
16743 NULL
16744 array (
16745 )
16746 </pre>
16747
16748 !! html/parsoid
16749 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16750 !! end
16751
16752 !! test
16753 Parser hook: basic input
16754 !! wikitext
16755 <tag>input</tag>
16756 !! html/php
16757 <pre>
16758 'input'
16759 array (
16760 )
16761 </pre>
16762
16763 !! html/parsoid
16764 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16765 !! end
16766
16767 ## Don't expect parsoid to rt this form.
16768 !! test
16769 Parser hook: case insensitive
16770 !! options
16771 parsoid=wt2html,html2html
16772 !! wikitext
16773 <TAG>input</TAG>
16774 !! html/php
16775 <pre>
16776 'input'
16777 array (
16778 )
16779 </pre>
16780
16781 !! html/parsoid
16782 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16783 !! end
16784
16785 ## Don't expect parsoid to rt this form.
16786 !! test
16787 Parser hook: case insensitive, redux
16788 !! options
16789 parsoid=wt2html,html2html
16790 !! wikitext
16791 <TaG>input</TAg>
16792 !! html/php
16793 <pre>
16794 'input'
16795 array (
16796 )
16797 </pre>
16798
16799 !! html/parsoid
16800 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16801 !! end
16802
16803 !! test
16804 Parser hook: nested tags
16805 !! wikitext
16806 <tag><tag></tag></tag>
16807 !! html/php
16808 <pre>
16809 '<tag>'
16810 array (
16811 )
16812 </pre>&lt;/tag&gt;
16813
16814 !! html/parsoid
16815 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16816 !! end
16817
16818 !! test
16819 Parser hook: basic arguments
16820 !! wikitext
16821 <tag width="200" height="100" depth="50" square=""></tag>
16822 !! html/php
16823 <pre>
16824 ''
16825 array (
16826 'width' => '200',
16827 'height' => '100',
16828 'depth' => '50',
16829 'square' => '',
16830 )
16831 </pre>
16832
16833 !! html/parsoid
16834 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16835 !! end
16836
16837 ## Don't expect parsoid to rt this form.
16838 !! test
16839 Parser hook: basic arguments, variations
16840 !! options
16841 parsoid=wt2html,html2html
16842 !! wikitext
16843 <tag width=200 height = "100" depth = '50' square></tag>
16844 !! html/php
16845 <pre>
16846 ''
16847 array (
16848 'width' => '200',
16849 'height' => '100',
16850 'depth' => '50',
16851 'square' => '',
16852 )
16853 </pre>
16854
16855 !! html/parsoid
16856 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16857 !! end
16858
16859 !! test
16860 Parser hook: argument containing a forward slash (bug 5344)
16861 !! wikitext
16862 <tag filename="/tmp/bla"></tag>
16863 !! html/php
16864 <pre>
16865 ''
16866 array (
16867 'filename' => '/tmp/bla',
16868 )
16869 </pre>
16870
16871 !! html/parsoid
16872 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16873 !! end
16874
16875 ## Don't expect parsoid to rt this form.
16876 !! test
16877 Parser hook: empty input using terminated empty elements (bug 2374)
16878 !! options
16879 parsoid=wt2html,html2html
16880 !! wikitext
16881 <tag foo=bar/>text
16882 !! html/php
16883 <pre>
16884 NULL
16885 array (
16886 'foo' => 'bar',
16887 )
16888 </pre>text
16889
16890 !! html/parsoid
16891 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16892 !! end
16893
16894 ## </tag> should be output literally since there is no matching tag that begins it
16895 ## Don't expect parsoid to rt this form.
16896 !! test
16897 Parser hook: basic arguments using terminated empty elements (bug 2374)
16898 !! options
16899 parsoid=wt2html
16900 !! wikitext
16901 <tag width=200 height = "100" depth = '50' square/>
16902 other stuff
16903 </tag>
16904 !! html/php
16905 <pre>
16906 NULL
16907 array (
16908 'width' => '200',
16909 'height' => '100',
16910 'depth' => '50',
16911 'square' => '',
16912 )
16913 </pre>
16914 <p>other stuff
16915 &lt;/tag&gt;
16916 </p>
16917 !! html/parsoid
16918 <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
16919 &lt;/tag></p>
16920 !! end
16921
16922 ## Don't expect parsoid to rt this form.
16923 !! test
16924 Parser hook: Don't allow unclosed extension tags
16925 !! options
16926 parsoid=wt2html
16927 !! wikitext
16928 test <tag>123
16929
16930 this is a '''test'''
16931 !! html/php
16932 <p>test &lt;tag&gt;123
16933 </p><p>this is a <b>test</b>
16934 </p>
16935 !! html/parsoid
16936 <p>test &lt;tag>123</p>
16937
16938 <p>this is a <b>test</b></p>
16939 !! end
16940
16941 ###
16942 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16943 ###
16944
16945 !! test
16946 Parser hook: static parser hook not inside a comment
16947 !! wikitext
16948 <statictag>hello, world</statictag>
16949
16950 <statictag action="flush" />
16951 !! html/php
16952 <p><br />
16953 hello, world
16954 </p>
16955 !! html/parsoid
16956 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16957 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16958 !! end
16959
16960 !! test
16961 Parser hook: static parser hook inside a comment
16962 !! wikitext
16963 <!-- <statictag>hello, world</statictag> -->
16964 <statictag action="flush" />
16965 !! html/php
16966 <p><br />
16967 </p>
16968 !! html/parsoid
16969 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16970 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16971 !! end
16972
16973 # Nested template calls; this case was broken by Parser.php rev 1.506,
16974 # since reverted.
16975
16976 !! article
16977 Template:One-parameter
16978 !! text
16979 (My parameter is: {{{1}}})
16980 !! endarticle
16981
16982 !! article
16983 Template:Map-one-parameter
16984 !! text
16985 {{{{{1}}}|{{{2}}}}}
16986 !! endarticle
16987
16988 !! test
16989 Nested template calls
16990 !! wikitext
16991 {{Map-one-parameter|One-parameter|param}}
16992 !! html
16993 <p>(My parameter is: param)
16994 </p>
16995 !! end
16996
16997
16998 ###
16999 ### Sanitizer
17000 ###
17001
17002 # HTML+Tidy effectively strips out the empty tags completely
17003 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17004 # which Tidy would have done for the PHP parser had there been content inside it.
17005 !! test
17006 Sanitizer: Closing of open tags
17007 !! wikitext
17008 <s></s><table></table>
17009 !! html
17010 <s></s><table></table>
17011
17012 !! html/parsoid
17013 <p><s></s></p><table></table>
17014 !! end
17015
17016 !! test
17017 Sanitizer: Closing of open but not closed tags
17018 !! wikitext
17019 <s>foo
17020 !! html
17021 <p><s>foo</s>
17022 </p>
17023 !! end
17024
17025 !! test
17026 Sanitizer: Closing of closed but not open tags
17027 !! options
17028 parsoid=wt2html
17029 !! wikitext
17030 </s>
17031 !! html/php+tidy
17032 !! html/parsoid
17033 !! end
17034
17035 !! test
17036 Sanitizer: Closing of closed but not open table tags
17037 !! options
17038 parsoid=wt2html
17039 !! wikitext
17040 Table not started</td></tr></table>
17041 !! html/php+tidy
17042 <p>Table not started</p>
17043 !! html/parsoid
17044 <p>Table not started</p>
17045 !! end
17046
17047 !! test
17048 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17049 !! wikitext
17050 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17051 !! html
17052 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17053 </p>
17054 !! end
17055
17056 # In HTML5, the restrictions are that id must contain at least one character,
17057 # and must not contain any space characters.
17058 !! test
17059 Sanitizer: Validating the contents of the id attribute (bug 4515)
17060 !! options
17061 disabled
17062 !! wikitext
17063 <br id="" /><br id="a space" />
17064 !! html
17065 Something ...
17066 !! end
17067
17068 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17069 !! test
17070 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17071 !! options
17072 disabled
17073 !! wikitext
17074 <br id="foo" /><br id="foo" />
17075 !! html
17076 Something need to be done. foo-2 ?
17077 !! end
17078
17079 !! test
17080 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17081 !! wikitext
17082 <div itemscope>
17083 <meta itemprop="hello" content="world">
17084 <meta http-equiv="refresh" content="5">
17085 <meta itemprop="hello" http-equiv="refresh" content="5">
17086 <link itemprop="hello" href="{{SERVER}}">
17087 <link rel="stylesheet" href="{{SERVER}}">
17088 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17089 </div>
17090 !! html
17091 <div itemscope="">
17092 <p> <meta itemprop="hello" content="world" />
17093 &lt;meta http-equiv="refresh" content="5"&gt;
17094 <meta itemprop="hello" content="5" />
17095 </p>
17096 <link itemprop="hello" href="http&#58;//example.org" />
17097 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17098 <link itemprop="hello" href="http&#58;//example.org" />
17099 </div>
17100
17101 !! end
17102
17103 !! test
17104 Language converter: output gets cut off unexpectedly (bug 5757)
17105 !! options
17106 language=zh
17107 !! wikitext
17108 this bit is safe: }-
17109
17110 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17111
17112 then we get cut off here: }-
17113
17114 all additional text is vanished
17115 !! html
17116 <p>this bit is safe: }-
17117 </p><p>but if we add a conversion instance: xxx
17118 </p><p>then we get cut off here: }-
17119 </p><p>all additional text is vanished
17120 </p>
17121 !! end
17122
17123 !! test
17124 Self closed html pairs (bug 5487)
17125 !! options
17126 !! wikitext
17127 <center><font id="bug" />Centered text</center>
17128 <div><font id="bug2" />In div text</div>
17129 !! html
17130 <center>&lt;font id="bug" /&gt;Centered text</center>
17131 <div>&lt;font id="bug2" /&gt;In div text</div>
17132
17133 !! end
17134
17135 #
17136 #
17137 #
17138
17139 !! test
17140 Punctuation: nbsp before exclamation
17141 !! wikitext
17142 C'est grave !
17143 !! html
17144 <p>C'est grave&#160;!
17145 </p>
17146 !! end
17147
17148 !! test
17149 Punctuation: CSS !important (bug 11874)
17150 !! wikitext
17151 <div style="width:50% !important">important</div>
17152 !! html
17153 <div style="width:50% !important">important</div>
17154
17155 !!end
17156
17157 !! test
17158 Punctuation: CSS ! important (bug 11874; with space after)
17159 !! wikitext
17160 <div style="width:50% ! important">important</div>
17161 !! html
17162 <div style="width:50% ! important">important</div>
17163
17164 !!end
17165
17166 !! test
17167 HTML bullet list, closed tags (bug 5497)
17168 !! wikitext
17169 <ul>
17170 <li>One</li>
17171 <li>Two</li>
17172 </ul>
17173 !! html/php
17174 <ul>
17175 <li>One</li>
17176 <li>Two</li>
17177 </ul>
17178
17179 !! html/parsoid
17180 <ul data-parsoid='{"stx":"html"}'>
17181 <li data-parsoid='{"stx":"html"}'>One</li>
17182 <li data-parsoid='{"stx":"html"}'>Two</li>
17183 </ul>
17184
17185 !! end
17186
17187 !! test
17188 HTML bullet list, unclosed tags (bug 5497)
17189 !! wikitext
17190 <ul>
17191 <li>One
17192 <li>Two
17193 </ul>
17194 !! html/php+tidy
17195 <ul>
17196 <li>One</li>
17197 <li>Two</li>
17198 </ul>
17199 !! html/parsoid
17200 <ul data-parsoid='{"stx":"html"}'>
17201 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17202 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17203 </ul>
17204
17205 !! end
17206
17207 !! test
17208 HTML ordered list, closed tags (bug 5497)
17209 !! wikitext
17210 <ol>
17211 <li>One</li>
17212 <li>Two</li>
17213 </ol>
17214 !! html/php
17215 <ol>
17216 <li>One</li>
17217 <li>Two</li>
17218 </ol>
17219
17220 !! html/parsoid
17221 <ol data-parsoid='{"stx":"html"}'>
17222 <li data-parsoid='{"stx":"html"}'>One</li>
17223 <li data-parsoid='{"stx":"html"}'>Two</li>
17224 </ol>
17225
17226 !! end
17227
17228 !! test
17229 HTML ordered list, unclosed tags (bug 5497)
17230 !! options
17231 !! wikitext
17232 <ol>
17233 <li>One
17234 <li>Two
17235 </ol>
17236 !! html/php+tidy
17237 <ol>
17238 <li>One</li>
17239 <li>Two</li>
17240 </ol>
17241 !! html/parsoid
17242 <ol data-parsoid='{"stx":"html"}'>
17243 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17244 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17245 </ol>
17246
17247 !! end
17248
17249 !! test
17250 HTML nested bullet list, closed tags (bug 5497)
17251 !! wikitext
17252 <ul>
17253 <li>One</li>
17254 <li>Two:
17255 <ul>
17256 <li>Sub-one</li>
17257 <li>Sub-two</li>
17258 </ul>
17259 </li>
17260 </ul>
17261 !! html/php
17262 <ul>
17263 <li>One</li>
17264 <li>Two:
17265 <ul>
17266 <li>Sub-one</li>
17267 <li>Sub-two</li>
17268 </ul>
17269 </li>
17270 </ul>
17271
17272 !! html/parsoid
17273 <ul data-parsoid='{"stx":"html"}'>
17274 <li data-parsoid='{"stx":"html"}'>One</li>
17275 <li data-parsoid='{"stx":"html"}'>Two:
17276 <ul data-parsoid='{"stx":"html"}'>
17277 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17278 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17279 </ul>
17280 </li>
17281 </ul>
17282 !! end
17283
17284 !! test
17285 HTML nested bullet list, open tags (bug 5497)
17286 !! wikitext
17287 <ul>
17288 <li>One
17289 <li>Two:
17290 <ul>
17291 <li>Sub-one
17292 <li>Sub-two
17293 </ul>
17294 </ul>
17295 !! html/php+tidy
17296 <ul>
17297 <li>One</li>
17298 <li>Two:
17299 <ul>
17300 <li>Sub-one</li>
17301 <li>Sub-two</li>
17302 </ul>
17303 </li>
17304 </ul>
17305 !! html/parsoid
17306 <ul>
17307 <li>One
17308 </li>
17309 <li>Two:
17310 <ul>
17311 <li>Sub-one
17312 </li>
17313 <li>Sub-two
17314 </li>
17315 </ul>
17316 </li>
17317 </ul>
17318
17319 !! end
17320
17321 !! test
17322 HTML nested ordered list, closed tags (bug 5497)
17323 !! wikitext
17324 <ol>
17325 <li>One</li>
17326 <li>Two:
17327 <ol>
17328 <li>Sub-one</li>
17329 <li>Sub-two</li>
17330 </ol>
17331 </li>
17332 </ol>
17333 !! html
17334 <ol>
17335 <li>One</li>
17336 <li>Two:
17337 <ol>
17338 <li>Sub-one</li>
17339 <li>Sub-two</li>
17340 </ol>
17341 </li>
17342 </ol>
17343
17344 !! end
17345
17346 !! test
17347 HTML nested ordered list, open tags (bug 5497)
17348 !! wikitext
17349 <ol>
17350 <li>One
17351 <li>Two:
17352 <ol>
17353 <li>Sub-one
17354 <li>Sub-two
17355 </ol>
17356 </ol>
17357 !! html/php
17358 <ol>
17359 <li>One
17360 <li>Two:
17361 <ol>
17362 <li>Sub-one
17363 <li>Sub-two
17364 </ol>
17365 </ol>
17366
17367 !! html/parsoid
17368 <ol>
17369 <li>One
17370 </li>
17371 <li>Two:
17372 <ol>
17373 <li>Sub-one
17374 </li>
17375 <li>Sub-two
17376 </li>
17377 </ol>
17378 </li>
17379 </ol>
17380
17381 !! end
17382
17383 !! test
17384 HTML ordered list item with parameters oddity
17385 !! wikitext
17386 <ol><li id="fragment">One</li>
17387 </ol>
17388 !! html
17389 <ol><li id="fragment">One</li>
17390 </ol>
17391
17392 !! end
17393
17394 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17395 !!test
17396 bug 5918: autonumbering
17397 !! wikitext
17398 [http://first/] [http://second] [ftp://ftp]
17399
17400 ftp://inlineftp
17401
17402 [mailto:enclosed@mail.tld With target]
17403
17404 [mailto:enclosed@mail.tld]
17405
17406 mailto:inline@mail.tld
17407 !! html/php
17408 <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>
17409 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17410 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17411 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17412 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17413 </p>
17414 !! html/parsoid
17415 <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>
17416 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17417 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17418 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17419 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17420 !! end
17421
17422
17423 #
17424 # Security and HTML correctness
17425 # From Nick Jenkins' fuzz testing
17426 #
17427
17428 !! test
17429 Fuzz testing: Parser13
17430 !! wikitext
17431 {|
17432 | http://a|
17433 !! html
17434 <table>
17435 <tr>
17436 <td>
17437 </td>
17438 </tr>
17439 </table>
17440
17441 !! end
17442
17443 !! test
17444 Fuzz testing: Parser14
17445 !! wikitext
17446 == onmouseover= ==
17447 http://__TOC__
17448 !! html
17449 <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>
17450 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17451 <ul>
17452 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17453 </ul>
17454 </div>
17455
17456
17457 !! html+tidy
17458 <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>
17459 <p>http://</p>
17460 <div id="toc" class="toc">
17461 <div id="toctitle">
17462 <h2>Contents</h2>
17463 </div>
17464 <ul>
17465 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17466 </ul>
17467 </div>
17468 <p></p>
17469 !! end
17470
17471 !! test
17472 Fuzz testing: Parser14-table
17473 !! options
17474 parsoid=wt2html,html2html
17475 !! wikitext
17476 ==a==
17477 {| STYLE=__TOC__
17478 !! html
17479 <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>
17480 <table style="&#95;_TOC&#95;_">
17481 <tr><td></td></tr>
17482 </table>
17483
17484 !! html+tidy
17485 <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>
17486 <table style="__TOC__">
17487 <tr>
17488 <td></td>
17489 </tr>
17490 </table>
17491 !! html/parsoid
17492 <h2>a</h2>
17493 <table style="__TOC__"></table>
17494 !! end
17495
17496 # Known to produce bogus xml (extra </td>)
17497 !! test
17498 Fuzz testing: Parser16
17499 !! wikitext
17500 {|
17501 !https://||||||
17502 !! html
17503 <table>
17504 <tr>
17505 <th>https://</th>
17506 <th></th>
17507 <th></th>
17508 <th>
17509 </td>
17510 </tr>
17511 </table>
17512
17513 !! html+tidy
17514 <table>
17515 <tr>
17516 <th>https://</th>
17517 <th></th>
17518 <th></th>
17519 <th></th>
17520 </tr>
17521 </table>
17522 !! end
17523
17524 !! test
17525 Fuzz testing: Parser21
17526 !! wikitext
17527 {|
17528 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17529 |
17530 !! html
17531 <table>
17532 <tr>
17533 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17534 </th>
17535 <td>
17536 </td>
17537 </tr>
17538 </table>
17539
17540 !! end
17541
17542 !! test
17543 Fuzz testing: Parser22
17544 !! wikitext
17545 http://===r:::https://b
17546
17547 {|
17548 !! html
17549 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17550 </p>
17551 <table>
17552 <tr><td></td></tr>
17553 </table>
17554
17555 !! end
17556
17557 # Known to produce bad XML for now
17558 !! test
17559 Fuzz testing: Parser24
17560 !! wikitext
17561 {|
17562 {{{|
17563 <u CLASS=
17564 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17565 <br style="onmouseover='alert(document.cookie);' " />
17566
17567 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17568 |
17569 !! html
17570 <table>
17571 {{{|
17572 <u class="&#124;">}}}} &gt;
17573 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17574
17575 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17576 <tr>
17577 <td></u>
17578 </td>
17579 </tr>
17580 </table>
17581
17582 !! end
17583
17584 # Note: the current result listed for this is not what the original one was,
17585 # but the original bug was JavaScript injection, which is fixed in any case.
17586 # It's not clear that the original result listed was any more correct than the
17587 # current one. Original result:
17588 # <p>{{{|
17589 # </p>
17590 # <li class="&#124;&#124;">
17591 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17592 !!test
17593 Fuzz testing: Parser25 (bug 6055)
17594 !! wikitext
17595 {{{
17596 |
17597 <LI CLASS=||
17598 >
17599 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17600 !! html
17601 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17602 </p>
17603 !! end
17604
17605 !!test
17606 Fuzz testing: URL adjacent extension (with space, clean)
17607 !! wikitext
17608 http://example.com <nowiki>junk</nowiki>
17609 !! html/php
17610 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17611 </p>
17612 !! html/parsoid
17613 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17614 !! end
17615
17616 !!test
17617 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17618 !! wikitext
17619 http://example.com<nowiki>junk</nowiki>
17620 !! html/php
17621 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17622 </p>
17623 !! html/parsoid
17624 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17625 !! end
17626
17627 !!test
17628 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17629 !! wikitext
17630 http://example.com<pre>junk</pre>
17631 !! html/php
17632 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17633
17634 !! html/php+tidy
17635 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17636 <pre>
17637 junk
17638 </pre>
17639 !! html/parsoid
17640 <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>
17641 !!end
17642
17643 !!test
17644 Fuzz testing: image with bogus manual thumbnail
17645 !! wikitext
17646 [[Image:foobar.jpg|thumbnail= ]]
17647 !! html/php
17648 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17649
17650 !! html/parsoid
17651 <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>
17652 !!end
17653
17654 !! test
17655 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17656 !! wikitext
17657 <pre dir="&#10;"></pre>
17658 !! html
17659 <pre dir="&#10;"></pre>
17660
17661 !! end
17662
17663 !! test
17664 Parsing optional HTML elements (Bug 6171)
17665 !! options
17666 !! wikitext
17667 <table>
17668 <tr>
17669 <td> Some tabular data</td>
17670 <td> More tabular data ...
17671 <td> And yet som tabular data</td>
17672 </tr>
17673 </table>
17674 !! html
17675 <table>
17676 <tr>
17677 <td> Some tabular data</td>
17678 <td> More tabular data ...
17679 </td><td> And yet som tabular data</td>
17680 </tr>
17681 </table>
17682
17683 !! end
17684
17685 !! test
17686 Correct handling of <td>, <tr> (Bug 6171)
17687 !! options
17688 !! wikitext
17689 <table>
17690 <tr>
17691 <td> Some tabular data</td>
17692 <td> More tabular data ...</td>
17693 <td> And yet som tabular data</td>
17694 </tr>
17695 </table>
17696 !! html
17697 <table>
17698 <tr>
17699 <td> Some tabular data</td>
17700 <td> More tabular data ...</td>
17701 <td> And yet som tabular data</td>
17702 </tr>
17703 </table>
17704
17705 !! end
17706
17707
17708 !! test
17709 Parsing crashing regression (fr:JavaScript)
17710 !! wikitext
17711 </body></x>
17712 !! html
17713 <p>&lt;/body&gt;&lt;/x&gt;
17714 </p>
17715 !! end
17716
17717 !! test
17718 Inline wiki vs wiki block nesting
17719 !! wikitext
17720 '''Bold paragraph
17721
17722 New wiki paragraph
17723 !! html
17724 <p><b>Bold paragraph</b>
17725 </p><p>New wiki paragraph
17726 </p>
17727 !! end
17728
17729 # FIXME: The current php output is documented
17730 # and desired output is the parsoid target.
17731 !! test
17732 Inline HTML vs wiki block nesting
17733 !! wikitext
17734 <b>Bold paragraph
17735
17736 New wiki paragraph
17737 !! html/php
17738 <p><b>Bold paragraph
17739 </p><p>New wiki paragraph</b>
17740 </p>
17741 !! html/parsoid
17742 <p><b>Bold paragraph</b>
17743 </p><p>New wiki paragraph
17744 </p>
17745 !! end
17746
17747 # Original result was this:
17748 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17749 # </p>
17750 # While that might be marginally more intuitive, maybe, the six-apostrophe
17751 # construct is clearly pathological and the result stated here (which is what
17752 # the parser actually does) is about as reasonable as anything.
17753 !!test
17754 Mixing markup for italics and bold
17755 !! options
17756 !! wikitext
17757 '''bold''''''bold''bolditalics'''''
17758 !! html
17759 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17760 </p>
17761 !! end
17762
17763
17764 !! article
17765 Xyzzyx
17766 !! text
17767 Article for special page transclusion test
17768 !! endarticle
17769
17770 !! test
17771 Special page transclusion
17772 !! options
17773 !! wikitext
17774 {{Special:Prefixindex/Xyzzyx}}
17775 !! html
17776 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17777 </ul>
17778
17779 !! end
17780
17781 !! test
17782 Special page transclusion twice (bug 5021)
17783 !! options
17784 !! wikitext
17785 {{Special:Prefixindex/Xyzzyx}}
17786 {{Special:Prefixindex/Xyzzyx}}
17787 !! html
17788 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17789 </ul>
17790 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17791 </ul>
17792
17793 !! end
17794
17795 !! test
17796 Transclusion of default MediaWiki message
17797 !! wikitext
17798 {{MediaWiki:Mainpage}}
17799 !! html
17800 <p>Main Page
17801 </p>
17802 !! end
17803
17804 !! test
17805 Transclusion of nonexistent MediaWiki message
17806 !! wikitext
17807 {{MediaWiki:Mainpagexxx}}
17808 !! html
17809 <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>
17810 </p>
17811 !! end
17812
17813 !! test
17814 Transclusion of MediaWiki message with underscore
17815 !! wikitext
17816 {{MediaWiki:history_short}}
17817 !! html
17818 <p>History
17819 </p>
17820 !! end
17821
17822 !! test
17823 Transclusion of MediaWiki message with space
17824 !! wikitext
17825 {{MediaWiki:history short}}
17826 !! html
17827 <p>History
17828 </p>
17829 !! end
17830
17831 !! test
17832 Invalid header with following text
17833 !! wikitext
17834 = x = y
17835 !! html
17836 <p>= x = y
17837 </p>
17838 !! end
17839
17840
17841 !! test
17842 Section extraction test (section 0)
17843 !! options
17844 section=0
17845 !! wikitext
17846 start
17847 ==a==
17848 ===aa===
17849 ====aaa====
17850 ==b==
17851 ===ba===
17852 ===bb===
17853 ====bba====
17854 ===bc===
17855 ==c==
17856 ===ca===
17857 !! html/php
17858 start
17859 !! end
17860
17861 !! test
17862 Section extraction test (section 1)
17863 !! options
17864 section=1
17865 !! wikitext
17866 start
17867 ==a==
17868 ===aa===
17869 ====aaa====
17870 ==b==
17871 ===ba===
17872 ===bb===
17873 ====bba====
17874 ===bc===
17875 ==c==
17876 ===ca===
17877 !! html/php
17878 ==a==
17879 ===aa===
17880 ====aaa====
17881 !! end
17882
17883 !! test
17884 Section extraction test (section 2)
17885 !! options
17886 section=2
17887 !! wikitext
17888 start
17889 ==a==
17890 ===aa===
17891 ====aaa====
17892 ==b==
17893 ===ba===
17894 ===bb===
17895 ====bba====
17896 ===bc===
17897 ==c==
17898 ===ca===
17899 !! html/php
17900 ===aa===
17901 ====aaa====
17902 !! end
17903
17904 !! test
17905 Section extraction test (section 3)
17906 !! options
17907 section=3
17908 !! wikitext
17909 start
17910 ==a==
17911 ===aa===
17912 ====aaa====
17913 ==b==
17914 ===ba===
17915 ===bb===
17916 ====bba====
17917 ===bc===
17918 ==c==
17919 ===ca===
17920 !! html/php
17921 ====aaa====
17922 !! end
17923
17924 !! test
17925 Section extraction test (section 4)
17926 !! options
17927 section=4
17928 !! wikitext
17929 start
17930 ==a==
17931 ===aa===
17932 ====aaa====
17933 ==b==
17934 ===ba===
17935 ===bb===
17936 ====bba====
17937 ===bc===
17938 ==c==
17939 ===ca===
17940 !! html/php
17941 ==b==
17942 ===ba===
17943 ===bb===
17944 ====bba====
17945 ===bc===
17946 !! end
17947
17948 !! test
17949 Section extraction test (section 5)
17950 !! options
17951 section=5
17952 !! wikitext
17953 start
17954 ==a==
17955 ===aa===
17956 ====aaa====
17957 ==b==
17958 ===ba===
17959 ===bb===
17960 ====bba====
17961 ===bc===
17962 ==c==
17963 ===ca===
17964 !! html/php
17965 ===ba===
17966 !! end
17967
17968 !! test
17969 Section extraction test (section 6)
17970 !! options
17971 section=6
17972 !! wikitext
17973 start
17974 ==a==
17975 ===aa===
17976 ====aaa====
17977 ==b==
17978 ===ba===
17979 ===bb===
17980 ====bba====
17981 ===bc===
17982 ==c==
17983 ===ca===
17984 !! html/php
17985 ===bb===
17986 ====bba====
17987 !! end
17988
17989 !! test
17990 Section extraction test (section 7)
17991 !! options
17992 section=7
17993 !! wikitext
17994 start
17995 ==a==
17996 ===aa===
17997 ====aaa====
17998 ==b==
17999 ===ba===
18000 ===bb===
18001 ====bba====
18002 ===bc===
18003 ==c==
18004 ===ca===
18005 !! html/php
18006 ====bba====
18007 !! end
18008
18009 !! test
18010 Section extraction test (section 8)
18011 !! options
18012 section=8
18013 !! wikitext
18014 start
18015 ==a==
18016 ===aa===
18017 ====aaa====
18018 ==b==
18019 ===ba===
18020 ===bb===
18021 ====bba====
18022 ===bc===
18023 ==c==
18024 ===ca===
18025 !! html/php
18026 ===bc===
18027 !! end
18028
18029 !! test
18030 Section extraction test (section 9)
18031 !! options
18032 section=9
18033 !! wikitext
18034 start
18035 ==a==
18036 ===aa===
18037 ====aaa====
18038 ==b==
18039 ===ba===
18040 ===bb===
18041 ====bba====
18042 ===bc===
18043 ==c==
18044 ===ca===
18045 !! html/php
18046 ==c==
18047 ===ca===
18048 !! end
18049
18050 !! test
18051 Section extraction test (section 10)
18052 !! options
18053 section=10
18054 !! wikitext
18055 start
18056 ==a==
18057 ===aa===
18058 ====aaa====
18059 ==b==
18060 ===ba===
18061 ===bb===
18062 ====bba====
18063 ===bc===
18064 ==c==
18065 ===ca===
18066 !! html/php
18067 ===ca===
18068 !! end
18069
18070 !! test
18071 Section extraction test (nonexistent section 11)
18072 !! options
18073 section=11
18074 !! wikitext
18075 start
18076 ==a==
18077 ===aa===
18078 ====aaa====
18079 ==b==
18080 ===ba===
18081 ===bb===
18082 ====bba====
18083 ===bc===
18084 ==c==
18085 ===ca===
18086 !! html/php
18087 !! end
18088
18089 !! test
18090 Section extraction test with bogus heading (section 1)
18091 !! options
18092 section=1
18093 !! wikitext
18094 ==a==
18095 ==bogus== not a legal section
18096 ==b==
18097 !! html/php
18098 ==a==
18099 ==bogus== not a legal section
18100 !! end
18101
18102 !! test
18103 Section extraction test with bogus heading (section 2)
18104 !! options
18105 section=2
18106 !! wikitext
18107 ==a==
18108 ==bogus== not a legal section
18109 ==b==
18110 !! html/php
18111 ==b==
18112 !! end
18113
18114 !! test
18115 Section extraction test with comment after heading (section 1)
18116 !! options
18117 section=1
18118 !! wikitext
18119 ==a==
18120 ==b== <!-- -->
18121 ==c==
18122 !! html/php
18123 ==a==
18124 !! end
18125
18126 !! test
18127 Section extraction test with comment after heading (section 2)
18128 !! options
18129 section=2
18130 !! wikitext
18131 ==a==
18132 ==b== <!-- -->
18133 ==c==
18134 !! html/php
18135 ==b== <!-- -->
18136 !! end
18137
18138 !! test
18139 Section extraction test with bogus <nowiki> heading (section 1)
18140 !! options
18141 section=1
18142 !! wikitext
18143 ==a==
18144 ==bogus== <nowiki>not a legal section</nowiki>
18145 ==b==
18146 !! html/php
18147 ==a==
18148 ==bogus== <nowiki>not a legal section</nowiki>
18149 !! end
18150
18151 !! test
18152 Section extraction test with bogus <nowiki> heading (section 2)
18153 !! options
18154 section=2
18155 !! wikitext
18156 ==a==
18157 ==bogus== <nowiki>not a legal section</nowiki>
18158 ==b==
18159 !! html/php
18160 ==b==
18161 !! end
18162
18163 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18164 # instead of respecting commented sections
18165 !! test
18166 Section extraction prefixed by comment (section 1)
18167 !! options
18168 section=1
18169 !! wikitext
18170 <!-- -->==sec1==
18171 ==sec2==
18172 !! html/php
18173 ==sec2==
18174 !!end
18175
18176 !! test
18177 Section extraction prefixed by comment (section 2)
18178 !! options
18179 section=2
18180 !! wikitext
18181 <!-- -->==sec1==
18182 ==sec2==
18183 !! html/php
18184
18185 !!end
18186
18187 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18188 # instead of respecting HTML-style headings
18189 !! test
18190 Section extraction, mixed wiki and html (section 1)
18191 !! options
18192 section=1
18193 !! wikitext
18194 <h2>unmarked</h2>
18195 unmarked
18196 ==1==
18197 one
18198 ==2==
18199 two
18200 !! html/php
18201 ==1==
18202 one
18203 !! end
18204
18205 !! test
18206 Section extraction, mixed wiki and html (section 2)
18207 !! options
18208 section=2
18209 !! wikitext
18210 <h2>unmarked</h2>
18211 unmarked
18212 ==1==
18213 one
18214 ==2==
18215 two
18216 !! html/php
18217 ==2==
18218 two
18219 !! end
18220
18221
18222 # Formerly testing for bug 3342
18223 !! test
18224 Section extraction, heading surrounded by <noinclude>
18225 !! options
18226 section=1
18227 !! wikitext
18228 <noinclude>==unmarked==</noinclude>
18229 ==marked==
18230 !! html/php
18231 ==marked==
18232 !!end
18233
18234 # Test behavior of bug 19910
18235 !! test
18236 Sectiion with all-equals
18237 !! options
18238 section=2
18239 !! wikitext
18240 ===
18241 The line above must have a trailing space
18242 === <!--
18243 --> <!-- -->
18244 But just in case it doesn't...
18245 !! html/php
18246 === <!--
18247 --> <!-- -->
18248 But just in case it doesn't...
18249 !! end
18250
18251 !! test
18252 Section replacement test (section 0)
18253 !! options
18254 replace=0,"xxx"
18255 !! wikitext
18256 start
18257 ==a==
18258 ===aa===
18259 ====aaa====
18260 ==b==
18261 ===ba===
18262 ===bb===
18263 ====bba====
18264 ===bc===
18265 ==c==
18266 ===ca===
18267 !! html/php
18268 xxx
18269
18270 ==a==
18271 ===aa===
18272 ====aaa====
18273 ==b==
18274 ===ba===
18275 ===bb===
18276 ====bba====
18277 ===bc===
18278 ==c==
18279 ===ca===
18280 !! end
18281
18282 !! test
18283 Section replacement test (section 1)
18284 !! options
18285 replace=1,"xxx"
18286 !! wikitext
18287 start
18288 ==a==
18289 ===aa===
18290 ====aaa====
18291 ==b==
18292 ===ba===
18293 ===bb===
18294 ====bba====
18295 ===bc===
18296 ==c==
18297 ===ca===
18298 !! html/php
18299 start
18300 xxx
18301
18302 ==b==
18303 ===ba===
18304 ===bb===
18305 ====bba====
18306 ===bc===
18307 ==c==
18308 ===ca===
18309 !! end
18310
18311 !! test
18312 Section replacement test (section 2)
18313 !! options
18314 replace=2,"xxx"
18315 !! wikitext
18316 start
18317 ==a==
18318 ===aa===
18319 ====aaa====
18320 ==b==
18321 ===ba===
18322 ===bb===
18323 ====bba====
18324 ===bc===
18325 ==c==
18326 ===ca===
18327 !! html/php
18328 start
18329 ==a==
18330 xxx
18331
18332 ==b==
18333 ===ba===
18334 ===bb===
18335 ====bba====
18336 ===bc===
18337 ==c==
18338 ===ca===
18339 !! end
18340
18341 !! test
18342 Section replacement test (section 3)
18343 !! options
18344 replace=3,"xxx"
18345 !! wikitext
18346 start
18347 ==a==
18348 ===aa===
18349 ====aaa====
18350 ==b==
18351 ===ba===
18352 ===bb===
18353 ====bba====
18354 ===bc===
18355 ==c==
18356 ===ca===
18357 !! html/php
18358 start
18359 ==a==
18360 ===aa===
18361 xxx
18362
18363 ==b==
18364 ===ba===
18365 ===bb===
18366 ====bba====
18367 ===bc===
18368 ==c==
18369 ===ca===
18370 !! end
18371
18372 !! test
18373 Section replacement test (section 4)
18374 !! options
18375 replace=4,"xxx"
18376 !! wikitext
18377 start
18378 ==a==
18379 ===aa===
18380 ====aaa====
18381 ==b==
18382 ===ba===
18383 ===bb===
18384 ====bba====
18385 ===bc===
18386 ==c==
18387 ===ca===
18388 !! html/php
18389 start
18390 ==a==
18391 ===aa===
18392 ====aaa====
18393 xxx
18394
18395 ==c==
18396 ===ca===
18397 !! end
18398
18399 !! test
18400 Section replacement test (section 5)
18401 !! options
18402 replace=5,"xxx"
18403 !! wikitext
18404 start
18405 ==a==
18406 ===aa===
18407 ====aaa====
18408 ==b==
18409 ===ba===
18410 ===bb===
18411 ====bba====
18412 ===bc===
18413 ==c==
18414 ===ca===
18415 !! html/php
18416 start
18417 ==a==
18418 ===aa===
18419 ====aaa====
18420 ==b==
18421 xxx
18422
18423 ===bb===
18424 ====bba====
18425 ===bc===
18426 ==c==
18427 ===ca===
18428 !! end
18429
18430 !! test
18431 Section replacement test (section 6)
18432 !! options
18433 replace=6,"xxx"
18434 !! wikitext
18435 start
18436 ==a==
18437 ===aa===
18438 ====aaa====
18439 ==b==
18440 ===ba===
18441 ===bb===
18442 ====bba====
18443 ===bc===
18444 ==c==
18445 ===ca===
18446 !! html/php
18447 start
18448 ==a==
18449 ===aa===
18450 ====aaa====
18451 ==b==
18452 ===ba===
18453 xxx
18454
18455 ===bc===
18456 ==c==
18457 ===ca===
18458 !! end
18459
18460 !! test
18461 Section replacement test (section 7)
18462 !! options
18463 replace=7,"xxx"
18464 !! wikitext
18465 start
18466 ==a==
18467 ===aa===
18468 ====aaa====
18469 ==b==
18470 ===ba===
18471 ===bb===
18472 ====bba====
18473 ===bc===
18474 ==c==
18475 ===ca===
18476 !! html/php
18477 start
18478 ==a==
18479 ===aa===
18480 ====aaa====
18481 ==b==
18482 ===ba===
18483 ===bb===
18484 xxx
18485
18486 ===bc===
18487 ==c==
18488 ===ca===
18489 !! end
18490
18491 !! test
18492 Section replacement test (section 8)
18493 !! options
18494 replace=8,"xxx"
18495 !! wikitext
18496 start
18497 ==a==
18498 ===aa===
18499 ====aaa====
18500 ==b==
18501 ===ba===
18502 ===bb===
18503 ====bba====
18504 ===bc===
18505 ==c==
18506 ===ca===
18507 !! html/php
18508 start
18509 ==a==
18510 ===aa===
18511 ====aaa====
18512 ==b==
18513 ===ba===
18514 ===bb===
18515 ====bba====
18516 xxx
18517
18518 ==c==
18519 ===ca===
18520 !!end
18521
18522 !! test
18523 Section replacement test (section 9)
18524 !! options
18525 replace=9,"xxx"
18526 !! wikitext
18527 start
18528 ==a==
18529 ===aa===
18530 ====aaa====
18531 ==b==
18532 ===ba===
18533 ===bb===
18534 ====bba====
18535 ===bc===
18536 ==c==
18537 ===ca===
18538 !! html/php
18539 start
18540 ==a==
18541 ===aa===
18542 ====aaa====
18543 ==b==
18544 ===ba===
18545 ===bb===
18546 ====bba====
18547 ===bc===
18548 xxx
18549 !! end
18550
18551 !! test
18552 Section replacement test (section 10)
18553 !! options
18554 replace=10,"xxx"
18555 !! wikitext
18556 start
18557 ==a==
18558 ===aa===
18559 ====aaa====
18560 ==b==
18561 ===ba===
18562 ===bb===
18563 ====bba====
18564 ===bc===
18565 ==c==
18566 ===ca===
18567 !! html/php
18568 start
18569 ==a==
18570 ===aa===
18571 ====aaa====
18572 ==b==
18573 ===ba===
18574 ===bb===
18575 ====bba====
18576 ===bc===
18577 ==c==
18578 xxx
18579 !! end
18580
18581 !! test
18582 Section replacement test with initial whitespace (bug 13728)
18583 !! options
18584 replace=2,"xxx"
18585 !! wikitext
18586 Preformatted initial line
18587 ==a==
18588 ===a===
18589 !! html/php
18590 Preformatted initial line
18591 ==a==
18592 xxx
18593 !! end
18594
18595
18596 !! test
18597 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18598 !! options
18599 section=1
18600 !! wikitext
18601 ==a==
18602 a
18603 !! html/php
18604 ==a==
18605 a
18606 !! end
18607
18608 !! test
18609 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18610 !! options
18611 section=1
18612 !! wikitext
18613 ==a==
18614 a
18615 !! html/php
18616 ==a==
18617 a
18618 !! end
18619
18620
18621 !! test
18622 Section extraction, <pre> around bogus header (bug 10309)
18623 !! options
18624 section=2
18625 !! wikitext
18626 == Section One ==
18627 <pre>
18628 =======
18629 </pre>
18630
18631 == Section Two ==
18632 stuff
18633 !! html/php
18634 == Section Two ==
18635 stuff
18636 !! end
18637
18638 !! test
18639 Section replacement, <pre> around bogus header (bug 10309)
18640 !! options
18641 replace=2,"xxx"
18642 !! wikitext
18643 == Section One ==
18644 <pre>
18645 =======
18646 </pre>
18647
18648 == Section Two ==
18649 stuff
18650 !! html/php
18651 == Section One ==
18652 <pre>
18653 =======
18654 </pre>
18655
18656 xxx
18657 !! end
18658
18659
18660 !! test
18661 Handling of &#x0A; in URLs
18662 !! wikitext
18663 ** irc://&#x0A;a
18664 !! html/php
18665 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18666
18667 !! html/parsoid
18668 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18669 a">irc://
18670 a</a></li></ul></li></ul>
18671 !! end
18672
18673 !! test
18674 Handling of %0A in URLs
18675 !! wikitext
18676 ** irc://%0Aa
18677 !! html/php
18678 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18679
18680 !! html/parsoid
18681 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18682 !! end
18683
18684
18685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18686 !! test
18687 5 quotes, code coverage +1 line
18688 !! options
18689 parsoid=wt2html
18690 !! wikitext
18691 '''''
18692 !! html/php
18693 !! html/parsoid
18694 <p><b><i></i></b></p>
18695 !! end
18696
18697 # same html as previous, but wikitext adjusted to match parsoid html2wt
18698 # note that wt2html and html2html will put the <i> before the <b>
18699 !! test
18700 5 quotes, code coverage +1 line w/ nowiki (1)
18701 !! options
18702 parsoid=wt2wt,html2wt
18703 !! wikitext
18704 '''''<nowiki/>'''''
18705 !! html/php
18706 <p><i></i>
18707 </p>
18708 !! html/parsoid
18709 <p><b><i></i></b></p>
18710 !! end
18711
18712 # same as previous, just swapping the <i> and <b>
18713 !! test
18714 5 quotes, code coverage +1 line w/ nowiki (2)
18715 !! wikitext
18716 '''''<nowiki/>'''''
18717 !! html/php
18718 <p><i></i>
18719 </p>
18720 !! html/parsoid
18721 <p><i><b></b></i></p>
18722 !! end
18723
18724 !! test
18725 Special:Search page linking.
18726 !! wikitext
18727 {{Special:search}}
18728 !! html
18729 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18730 </p>
18731 !! end
18732
18733 !! test
18734 {{!}} is a magic word
18735 !! wikitext
18736 {{!}} is a magic word there and {{!}} is still a magic word here
18737 | is not a magic word here but {{!}} is still a magic word here
18738 !! html/php
18739 <p>| is a magic word there and | is still a magic word here
18740 | is not a magic word here but | is still a magic word here
18741 </p>
18742 !! html/parsoid
18743 <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
18744 | 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>
18745
18746 !! end
18747
18748 !! test
18749 Say the magic word
18750 !! options
18751 title=[[Parser test]]
18752 !! wikitext
18753 * {{PAGENAME}}
18754 * {{PAGENAMEE}}
18755 * {{FULLPAGENAME}}
18756 * {{FULLPAGENAMEE}}
18757 * {{BASEPAGENAME}}
18758 * {{BASEPAGENAMEE}}
18759 * {{SUBPAGENAME}}
18760 * {{SUBPAGENAMEE}}
18761 * {{ROOTPAGENAME}}
18762 * {{ROOTPAGENAMEE}}
18763 * {{TALKPAGENAME}}
18764 * {{TALKPAGENAMEE}}
18765 * {{SUBJECTPAGENAME}}
18766 * {{SUBJECTPAGENAMEE}}
18767 * {{NAMESPACEE}}
18768 * {{NAMESPACE}}
18769 * {{NAMESPACENUMBER}}
18770 * {{TALKSPACE}}
18771 * {{TALKSPACEE}}
18772 * {{SUBJECTSPACE}}
18773 * {{SUBJECTSPACEE}}
18774 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18775 !! html
18776 <ul><li> Parser test</li>
18777 <li> Parser_test</li>
18778 <li> Parser test</li>
18779 <li> Parser_test</li>
18780 <li> Parser test</li>
18781 <li> Parser_test</li>
18782 <li> Parser test</li>
18783 <li> Parser_test</li>
18784 <li> Parser test</li>
18785 <li> Parser_test</li>
18786 <li> Talk:Parser test</li>
18787 <li> Talk:Parser_test</li>
18788 <li> Parser test</li>
18789 <li> Parser_test</li>
18790 <li> </li>
18791 <li> </li>
18792 <li> 0</li>
18793 <li> Talk</li>
18794 <li> Talk</li>
18795 <li> </li>
18796 <li> </li>
18797 <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>
18798
18799 !! end
18800 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18801
18802 !! test
18803 Gallery
18804 !! wikitext
18805 <gallery>
18806 image1.png |
18807 image2.gif|||||
18808
18809 image3|
18810 image4 |300px| centre
18811 image5.svg| http://///////
18812 [[x|xx]]]]
18813 * image6
18814 </gallery>
18815 !! html
18816 <ul class="gallery mw-gallery-traditional">
18817 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18818 <div class="thumb" style="height: 150px;">Image1.png</div>
18819 <div class="gallerytext">
18820 </div>
18821 </div></li>
18822 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18823 <div class="thumb" style="height: 150px;">Image2.gif</div>
18824 <div class="gallerytext">
18825 </div>
18826 </div></li>
18827 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18828 <div class="thumb" style="height: 150px;">Image3</div>
18829 <div class="gallerytext">
18830 </div>
18831 </div></li>
18832 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18833 <div class="thumb" style="height: 150px;">Image4</div>
18834 <div class="gallerytext">
18835 <pre>centre
18836 </pre>
18837 </div>
18838 </div></li>
18839 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18840 <div class="thumb" style="height: 150px;">Image5.svg</div>
18841 <div class="gallerytext">
18842 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18843 </p>
18844 </div>
18845 </div></li>
18846 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18847 <div class="thumb" style="height: 150px;">* image6</div>
18848 <div class="gallerytext">
18849 </div>
18850 </div></li>
18851 </ul>
18852
18853 !! end
18854
18855 !! test
18856 Gallery (with options)
18857 !! wikitext
18858 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18859 File:Nonexistent.jpg|caption
18860 File:Nonexistent.jpg
18861 image:foobar.jpg|some '''caption''' [[Main Page]]
18862 image:foobar.jpg
18863 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18864 </gallery>
18865 !! html
18866 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18867 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18868 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18869 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18870 <div class="gallerytext">
18871 <p>caption
18872 </p>
18873 </div>
18874 </div></li>
18875 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18876 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18877 <div class="gallerytext">
18878 </div>
18879 </div></li>
18880 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18881 <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>
18882 <div class="gallerytext">
18883 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18884 </p>
18885 </div>
18886 </div></li>
18887 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18888 <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>
18889 <div class="gallerytext">
18890 </div>
18891 </div></li>
18892 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18893 <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>
18894 <div class="gallerytext">
18895 <p>blabla.
18896 </p>
18897 </div>
18898 </div></li>
18899 </ul>
18900
18901 !! end
18902
18903 !! test
18904 Gallery with link that has fragment
18905 !! wikitext
18906 <gallery>
18907 image:foobar.jpg|link=Main_Page
18908 image:foobar.jpg|link=Main_Page#section
18909 image:foobar.jpg|link=Main Page#section|caption
18910 </gallery>
18911 !! html
18912 <ul class="gallery mw-gallery-traditional">
18913 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18914 <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>
18915 <div class="gallerytext">
18916 </div>
18917 </div></li>
18918 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18919 <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>
18920 <div class="gallerytext">
18921 </div>
18922 </div></li>
18923 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18924 <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>
18925 <div class="gallerytext">
18926 <p>caption
18927 </p>
18928 </div>
18929 </div></li>
18930 </ul>
18931
18932 !! end
18933
18934 !! test
18935 Gallery with wikitext inside caption
18936 !! wikitext
18937 <gallery>
18938 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18939 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18940 </gallery>
18941 !! html
18942 <ul class="gallery mw-gallery-traditional">
18943 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18944 <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>
18945 <div class="gallerytext">
18946 <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>
18947 </p>
18948 </div>
18949 </div></li>
18950 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18951 <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>
18952 <div class="gallerytext">
18953 <p>This is a test template
18954 </p>
18955 </div>
18956 </div></li>
18957 </ul>
18958
18959 !! end
18960
18961 !! test
18962 gallery (with showfilename option)
18963 !! wikitext
18964 <gallery showfilename>
18965 File:Nonexistent.jpg|caption
18966 File:Nonexistent.jpg
18967 image:foobar.jpg|some '''caption''' [[Main Page]]
18968 File:Foobar.jpg
18969 </gallery>
18970 !! html
18971 <ul class="gallery mw-gallery-traditional">
18972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18973 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18974 <div class="gallerytext">
18975 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18976 caption
18977 </p>
18978 </div>
18979 </div></li>
18980 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18981 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18982 <div class="gallerytext">
18983 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18984 </p>
18985 </div>
18986 </div></li>
18987 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18988 <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>
18989 <div class="gallerytext">
18990 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
18991 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18992 </p>
18993 </div>
18994 </div></li>
18995 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18996 <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>
18997 <div class="gallerytext">
18998 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
18999 </p>
19000 </div>
19001 </div></li>
19002 </ul>
19003
19004 !! end
19005
19006 !! test
19007 Gallery (with namespace-less filenames)
19008 !! wikitext
19009 <gallery>
19010 File:Nonexistent.jpg
19011 Nonexistent.jpg
19012 image:foobar.jpg
19013 foobar.jpg
19014 </gallery>
19015 !! html
19016 <ul class="gallery mw-gallery-traditional">
19017 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19018 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19019 <div class="gallerytext">
19020 </div>
19021 </div></li>
19022 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19023 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19024 <div class="gallerytext">
19025 </div>
19026 </div></li>
19027 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19028 <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>
19029 <div class="gallerytext">
19030 </div>
19031 </div></li>
19032 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19033 <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>
19034 <div class="gallerytext">
19035 </div>
19036 </div></li>
19037 </ul>
19038
19039 !! end
19040
19041 !! test
19042 HTML Hex character encoding (spells the word "JavaScript")
19043 !! options
19044 parsoid=wt2html,wt2wt,html2html
19045 !! wikitext
19046 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19047 !! html/php
19048 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19049 </p>
19050 !! html/php+tidy
19051 <p>JavaScript</p>
19052 !! html/parsoid
19053 <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>
19054 !! end
19055
19056 !! test
19057 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19058 !! wikitext
19059 &#xsee;&#XSEE;
19060 !! html/php
19061 <p>&amp;#xsee;&amp;#XSEE;
19062 </p>
19063 !! html/parsoid
19064 <p>&amp;#xsee;&amp;#XSEE;</p>
19065 !! end
19066
19067 !! test
19068 HTML Hex character encoding mixed case
19069 !! options
19070 parsoid=wt2html,wt2wt,html2html
19071 !! wikitext
19072 &#xEE;&#Xee;
19073 !! html/php
19074 <p>&#xee;&#xee;
19075 </p>
19076 !! html/php+tidy
19077 <p>îî</p>
19078 !! html/parsoid
19079 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19080 !! end
19081
19082 # See: http://www.w3.org/TR/html5/syntax.html#character-references
19083 # Note that U+000C (form feed) is not a valid XML character, so
19084 # it is banned even though allowed in HTML5.
19085 !! test
19086 Illegal character references (T106578)
19087 !! wikitext
19088 ; Null: &#00;
19089 ; FF: &#xC;
19090 ; CR: &#xD;
19091 ; Control (low): &#8;
19092 ; Control (high): &#x7F; &#x9F;
19093 ; Surrogate: &#xD83D;&#xDCA9;
19094 ; This is an okay astral character: &#x1F4A9;
19095 !! html+tidy
19096 <dl>
19097 <dt>Null</dt>
19098 <dd>&amp;#00;</dd>
19099 <dt>FF</dt>
19100 <dd>&amp;#xC;</dd>
19101 <dt>CR</dt>
19102 <dd>&amp;#xD;</dd>
19103 <dt>Control (low)</dt>
19104 <dd>&amp;#8;</dd>
19105 <dt>Control (high)</dt>
19106 <dd>&amp;#x7F; &amp;#x9F;</dd>
19107 <dt>Surrogate</dt>
19108 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19109 <dt>This is an okay astral character</dt>
19110 <dd>💩</dd>
19111 </dl>
19112 !! end
19113
19114 !! test
19115 __FORCETOC__ override
19116 !! wikitext
19117 __NEWSECTIONLINK__
19118 __FORCETOC__
19119 !! html/php
19120 <p><br />
19121 </p>
19122 !! end
19123
19124 !! test
19125 ISBN code coverage
19126 !! wikitext
19127 ISBN 978-0-1234-56&#x20;789
19128 !! html
19129 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19130 </p>
19131 !! html+tidy
19132 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19133 !! html/parsoid
19134 <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>
19135 !! end
19136
19137 !! test
19138 ISBN followed by 5 spaces
19139 !! wikitext
19140 ISBN
19141 !! html
19142 <p>ISBN
19143 </p>
19144 !! end
19145
19146 !! test
19147 Double ISBN
19148 !! wikitext
19149 ISBN ISBN 1234567890
19150 !! html/php
19151 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19152 </p>
19153 !! html/parsoid
19154 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19155 !! end
19156
19157 # Uppercase X and lowercase x as well
19158 !! test
19159 ISBN with an X
19160 !! wikitext
19161 ISBN 3-462-04561-X
19162 ISBN 3-462-04561-x
19163 ISBN 080442957X
19164 ISBN 080442957x
19165 ISBN 978080442957X
19166 ISBN 978080442957x
19167 !! html/php
19168 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19169 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19170 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19171 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19172 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19173 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19174 </p>
19175 !! html/parsoid
19176 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19177 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19178 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19179 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19180 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19181 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19182 !! end
19183
19184 !! test
19185 ISBN with empty prefix (parsoid test)
19186 !! wikitext
19187 ISBN 1234567890
19188 !! html/php
19189 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19190 </p>
19191 !! html/parsoid
19192 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19193 !! end
19194
19195 !! test
19196 Bug 22905: <abbr> followed by ISBN followed by </a>
19197 !! wikitext
19198 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19199 !! html/php
19200 <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>
19201 </p>
19202 !! html/parsoid
19203 <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>
19204 !! end
19205
19206 !! test
19207 Double RFC
19208 !! wikitext
19209 RFC RFC 1234
19210 !! html
19211 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19212 </p>
19213 !! end
19214
19215 !! test
19216 Double RFC with a wiki link
19217 !! wikitext
19218 RFC [[RFC 1234]]
19219 !! html
19220 <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>
19221 </p>
19222 !! end
19223
19224 !! test
19225 RFC code coverage
19226 !! wikitext
19227 RFC 983&#x20;987
19228 !! html
19229 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19230 </p>
19231 !! html+tidy
19232 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19233 !! end
19234
19235 !! test
19236 Centre-aligned image
19237 !! wikitext
19238 [[Image:foobar.jpg|centre]]
19239 !! html
19240 <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>
19241
19242 !!end
19243
19244 !! test
19245 None-aligned image
19246 !! wikitext
19247 [[Image:foobar.jpg|none]]
19248 !! html
19249 <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>
19250
19251 !!end
19252
19253 !! test
19254 Width + Height sized image (using px) (height is ignored)
19255 !! wikitext
19256 [[Image:foobar.jpg|640x480px]]
19257 !! html
19258 <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>
19259 </p>
19260 !!end
19261
19262 !! test
19263 Width-sized image (using px, no following whitespace)
19264 !! wikitext
19265 [[Image:foobar.jpg|640px]]
19266 !! html
19267 <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>
19268 </p>
19269 !!end
19270
19271 !! test
19272 Width-sized image (using px, with following whitespace - test regression from r39467)
19273 !! wikitext
19274 [[Image:foobar.jpg|640px ]]
19275 !! html
19276 <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>
19277 </p>
19278 !!end
19279
19280 !! test
19281 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19282 !! wikitext
19283 [[Image:foobar.jpg| 640px]]
19284 !! html
19285 <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>
19286 </p>
19287 !!end
19288
19289 !! test
19290 Image with page parameter
19291 !! options
19292 djvu
19293 !! wikitext
19294 [[File:LoremIpsum.djvu|page=2]]
19295 !! html/php
19296 <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>
19297 </p>
19298 !! html/parsoid
19299 <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>
19300 !! end
19301
19302 !! test
19303 Another italics / bold test
19304 !! wikitext
19305 ''' ''x'
19306 !! html
19307 <pre>'<i> </i>x'
19308 </pre>
19309 !!end
19310
19311 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19312 !! test
19313 dt/dd/dl test
19314 !! wikitext
19315 :;;;::
19316 !! html/php
19317 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19318
19319 !! html/parsoid
19320 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19321
19322 !!end
19323
19324
19325 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19326 !! test
19327 Images with the "|" character in the comment
19328 !! wikitext
19329 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19330 !! html/php
19331 <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>
19332
19333 !! html/parsoid
19334 <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>
19335 !! end
19336
19337 !! test
19338 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19339 !! wikitext
19340 <html><script>alert(1);</script></html>
19341 !! html
19342 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19343 </p>
19344 !! end
19345
19346 !! test
19347 HTML with raw HTML ($wgRawHtml==true)
19348 !! options
19349 wgRawHtml=1
19350 !! wikitext
19351 <html><script>alert(1);</script></html>
19352 !! html
19353 <p><script>alert(1);</script>
19354 </p>
19355 !! end
19356
19357 !! test
19358 Parents of subpages, one level up
19359 !! options
19360 subpage title=[[Subpage test/L1/L2/L3]]
19361 !! wikitext
19362 [[../|L2]]
19363 !! html
19364 <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>
19365 </p>
19366 !! end
19367
19368
19369 !! test
19370 Parents of subpages, one level up, not named
19371 !! options
19372 subpage title=[[Subpage test/L1/L2/L3]]
19373 !! wikitext
19374 [[../]]
19375 !! html
19376 <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>
19377 </p>
19378 !! end
19379
19380
19381
19382 !! test
19383 Parents of subpages, two levels up
19384 !! options
19385 subpage title=[[Subpage test/L1/L2/L3]]
19386 !! wikitext
19387 [[../../|L1]]2
19388
19389 [[../../|L1]]l
19390 !! html
19391 <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
19392 </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>
19393 </p>
19394 !! end
19395
19396 !! test
19397 Parents of subpages, two levels up, without trailing slash or name.
19398 !! options
19399 subpage title=[[Subpage test/L1/L2/L3]]
19400 !! wikitext
19401 [[../..]]
19402 !! html
19403 <p>[[../..]]
19404 </p>
19405 !! end
19406
19407 !! test
19408 Parents of subpages, two levels up, with lots of extra trailing slashes.
19409 !! options
19410 subpage title=[[Subpage test/L1/L2/L3]]
19411 !! wikitext
19412 [[../../////]]
19413 !! html
19414 <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>
19415 </p>
19416 !! end
19417
19418 !! article
19419 Subpage test/L1/L2/L3Sibling
19420 !! text
19421 Sibling article
19422 !! endarticle
19423
19424 !! test
19425 Transclusion of a sibling page (one level up)
19426 !! options
19427 subpage title=[[Subpage test/L1/L2/L3]]
19428 !! wikitext
19429 {{../L3Sibling}}
19430 !! html
19431 <p>Sibling article
19432 </p>
19433 !! end
19434
19435 !! test
19436 Transclusion of a child page
19437 !! options
19438 subpage title=[[Subpage test/L1/L2]]
19439 !! wikitext
19440 {{/L3Sibling}}
19441 !! html
19442 <p>Sibling article
19443 </p>
19444 !! end
19445
19446 # This is wt2html only in Parsoid because we add <nowiki>
19447 # because of {{..}} and we don't expect to fix that to
19448 # eliminate the nowikis selective for {{..}} markup.
19449 !! test
19450 Non-transclusion because of too many up levels
19451 !! options
19452 subpage title=[[Subpage test/L1/L2/L3]]
19453 parsoid=wt2html
19454 !! wikitext
19455 {{../../../../More than parent}}
19456 !! html/php
19457 <p>{{../../../../More than parent}}
19458 </p>
19459 !! html/parsoid
19460 <p>{{../../../../More than parent}}</p>
19461 !! end
19462
19463 !! test
19464 Definition list code coverage
19465 !! wikitext
19466 ; title : def
19467 ; title : def
19468 ;title: def
19469 !! html/php
19470 <dl><dt> title &#160;</dt>
19471 <dd> def</dd>
19472 <dt> title&#160;</dt>
19473 <dd> def</dd>
19474 <dt>title</dt>
19475 <dd> def</dd></dl>
19476
19477 !! html/parsoid
19478 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19479 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19480 <dt>title</dt><dd> def</dd></dl>
19481 !! end
19482
19483 !! test
19484 Don't fall for the self-closing div
19485 !! wikitext
19486 <div>hello world</div/>
19487 !! html
19488 <div>hello world</div>
19489
19490 !! end
19491
19492 !! test
19493 MSGNW magic word
19494 !! wikitext
19495 {{MSGNW:msg}}
19496 !! html/php
19497 <p>&#91;&#91;:Template:Msg&#93;&#93;
19498 </p>
19499 !! end
19500
19501 !! test
19502 RAW magic word
19503 !! wikitext
19504 {{RAW:QUERTY}}
19505 !! html
19506 <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>
19507 </p>
19508 !! end
19509
19510 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19511 !! test
19512 Always escape literal '>' in output, not just after '<'
19513 !! wikitext
19514 ><>
19515 !! html
19516 <p>&gt;&lt;&gt;
19517 </p>
19518 !! end
19519
19520 !! test
19521 Template caching
19522 !! wikitext
19523 {{Test}}
19524 {{Test}}
19525 !! html
19526 <p>This is a test template
19527 This is a test template
19528 </p>
19529 !! end
19530
19531
19532 !! article
19533 MediaWiki:Fake
19534 !! text
19535 ==header==
19536 !! endarticle
19537
19538 !! test
19539 Inclusion of !userCanEdit() content
19540 !! wikitext
19541 {{MediaWiki:Fake}}
19542 !! html
19543 <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>
19544
19545 !! end
19546
19547
19548 !! test
19549 Out-of-order TOC heading levels
19550 !! wikitext
19551 ==2==
19552 ======6======
19553 ===3===
19554 =1=
19555 =====5=====
19556 ==2==
19557 !! html
19558 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19559 <ul>
19560 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19561 <ul>
19562 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19563 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19564 </ul>
19565 </li>
19566 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19567 <ul>
19568 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19569 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19570 </ul>
19571 </li>
19572 </ul>
19573 </div>
19574
19575 <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>
19576 <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>
19577 <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>
19578 <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>
19579 <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>
19580 <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>
19581
19582 !! end
19583
19584
19585 !! test
19586 ISBN with a dummy number
19587 !! wikitext
19588 ISBN ---
19589 !! html
19590 <p>ISBN ---
19591 </p>
19592 !! end
19593
19594
19595 !! test
19596 ISBN with space-delimited number
19597 !! wikitext
19598 ISBN 92 9017 032 8
19599 !! html
19600 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19601 </p>
19602 !! end
19603
19604
19605 !! test
19606 ISBN with multiple spaces, no number
19607 !! wikitext
19608 ISBN foo
19609 !! html
19610 <p>ISBN foo
19611 </p>
19612 !! end
19613
19614
19615 !! test
19616 ISBN length
19617 !! wikitext
19618 ISBN 123456789
19619
19620 ISBN 1234567890
19621
19622 ISBN 12345678901
19623 !! html
19624 <p>ISBN 123456789
19625 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19626 </p><p>ISBN 12345678901
19627 </p>
19628 !! end
19629
19630
19631 !! test
19632 ISBN with trailing year (bug 8110)
19633 !! wikitext
19634 ISBN 1-234-56789-0 - 2006
19635
19636 ISBN 1 234 56789 0 - 2006
19637 !! html
19638 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19639 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19640 </p>
19641 !! end
19642
19643
19644 !! test
19645 anchorencode
19646 !! wikitext
19647 {{anchorencode:foo bar©#%n}}
19648 !! html
19649 <p>foo_bar.C2.A9.23.25n
19650 </p>
19651 !! end
19652
19653 !! test
19654 anchorencode trims spaces
19655 !! wikitext
19656 {{anchorencode: __pretty__please__}}
19657 !! html
19658 <p>pretty_please
19659 </p>
19660 !! end
19661
19662 !! test
19663 anchorencode deals with links
19664 !! wikitext
19665 {{anchorencode: [[hello|world]] [[hi]]}}
19666 !! html
19667 <p>world_hi
19668 </p>
19669 !! end
19670
19671 !! test
19672 anchorencode deals with templates
19673 !! wikitext
19674 {{anchorencode: {{Foo}} }}
19675 !! html
19676 <p>FOO
19677 </p>
19678 !! end
19679
19680 !! test
19681 anchorencode encodes like the TOC generator: (bug 18431)
19682 !! wikitext
19683 === _ +:.3A%3A&&amp;]] ===
19684 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19685 __NOEDITSECTION__
19686 !! html
19687 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19688 <p>.2B:.3A.253A.26.26.5D.5D
19689 </p>
19690 !! end
19691
19692 !! test
19693 Bug 6200: blockquotes and paragraph formatting
19694 !! wikitext
19695 <blockquote>
19696 foo
19697 </blockquote>
19698
19699 bar
19700
19701 baz
19702 !! html
19703 <blockquote>
19704 <p>foo
19705 </p>
19706 </blockquote>
19707 <p>bar
19708 </p>
19709 <pre>baz
19710 </pre>
19711 !! end
19712
19713 !! test
19714 Bug 8293: Use of center tag ruins paragraph formatting
19715 !! wikitext
19716 <center>
19717 foo
19718 </center>
19719
19720 bar
19721
19722 baz
19723 !! html
19724 <center>
19725 <p>foo
19726 </p>
19727 </center>
19728 <p>bar
19729 </p>
19730 <pre>baz
19731 </pre>
19732 !! end
19733
19734 !!test
19735 Parsing of overlapping (improperly nested) inline html tags
19736 !! wikitext
19737 <span><s>x</span></s>
19738 !! html/php
19739 <p><span><s>x&lt;/span&gt;</s></span>
19740 </p>
19741 !! html/parsoid
19742 <p><span><s>x</s></span>
19743 </p>
19744 !!end
19745
19746 ###
19747 ### Language variants related tests
19748 ###
19749 !! test
19750 Self-link in language variants
19751 !! options
19752 title=[[Dunav]] language=sr
19753 !! wikitext
19754 Both [[Dunav]] and [[Дунав]] are names for this river.
19755 !! html
19756 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19757 </p>
19758 !!end
19759
19760 !! article
19761 Дуна
19762 !! text
19763 content
19764 !! endarticle
19765
19766 !! test
19767 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19768 !! options
19769 title=[[Duna]] language=sr
19770 !! wikitext
19771 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19772 !! html
19773 <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.
19774 </p>
19775 !! end
19776
19777 !! test
19778 Link to a section of a variant of this title shouldn't be parsed as self-link
19779 !! options
19780 title=[[Duna]] language=sr
19781 !! wikitext
19782 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19783 !! html
19784 <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.
19785 </p>
19786 !! end
19787
19788 !! test
19789 Link to pages in language variants
19790 !! options
19791 language=sr
19792 !! wikitext
19793 Main Page can be written as [[Маин Паге]]
19794 !! html
19795 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19796 </p>
19797 !!end
19798
19799
19800 !! test
19801 Multiple links to pages in language variants
19802 !! options
19803 language=sr
19804 !! wikitext
19805 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19806 !! html
19807 <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>.
19808 </p>
19809 !!end
19810
19811
19812 !! test
19813 Simple template in language variants
19814 !! options
19815 language=sr
19816 !! wikitext
19817 {{тест}}
19818 !! html
19819 <p>This is a test template
19820 </p>
19821 !! end
19822
19823
19824 !! test
19825 Template with explicit namespace in language variants
19826 !! options
19827 language=sr
19828 !! wikitext
19829 {{Template:тест}}
19830 !! html
19831 <p>This is a test template
19832 </p>
19833 !! end
19834
19835
19836 !! test
19837 Basic test for template parameter in language variants
19838 !! options
19839 language=sr
19840 !! wikitext
19841 {{парамтест|param=foo}}
19842 !! html
19843 <p>This is a test template with parameter foo
19844 </p>
19845 !! end
19846
19847
19848 !! test
19849 Simple category in language variants
19850 !! options
19851 language=sr cat
19852 !! wikitext
19853 [[Category:МедиаWики Усер'с Гуиде]]
19854 !! html
19855 cat=МедиаWики_Усер'с_Гуиде sort=
19856 !! end
19857
19858
19859 !! article
19860 Category:分类
19861 !! text
19862 blah
19863 !! endarticle
19864
19865 !! article
19866 Category:分類
19867 !! text
19868 blah
19869 !! endarticle
19870
19871 ## We used to, but no longer wt2wt this test since the default serializer
19872 ## will normalize all categories to serialize on their own line.
19873 ## This wikitext usage is going to be fairly uncommon in production and
19874 ## selser will take care of preserving formatting in those scenarios.
19875 !! test
19876 Don't convert blue categorylinks to another variant (bug 33210)
19877 !! options
19878 cat
19879 language=zh
19880 parsoid=wt2html
19881 !! wikitext
19882 [[A]][[Category:分类]]
19883 !! html/php
19884 cat=分类 sort=
19885 !! html/parsoid
19886 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19887 <link rel="mw:PageProp/Category" href="Category:分类"/>
19888 !! end
19889
19890 !! test
19891 Stripping -{}- tags (language variants)
19892 !! options
19893 language=sr
19894 !! wikitext
19895 Latin proverb: -{Ne nuntium necare}-
19896 !! html
19897 <p>Latin proverb: Ne nuntium necare
19898 </p>
19899 !! end
19900
19901
19902 !! test
19903 Prevent conversion with -{}- tags (language variants)
19904 !! options
19905 language=sr variant=sr-ec
19906 !! wikitext
19907 Latinski: -{Ne nuntium necare}-
19908 !! html
19909 <p>Латински: Ne nuntium necare
19910 </p>
19911 !! end
19912
19913
19914 !! test
19915 Prevent conversion of text with -{}- tags (language variants)
19916 !! options
19917 language=sr variant=sr-ec
19918 !! wikitext
19919 Latinski: -{Ne nuntium necare}-
19920 !! html
19921 <p>Латински: Ne nuntium necare
19922 </p>
19923 !! end
19924
19925
19926 !! test
19927 Prevent conversion of links with -{}- tags (language variants)
19928 !! options
19929 language=sr variant=sr-ec
19930 !! wikitext
19931 -{[[Main Page]]}-
19932 !! html
19933 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19934 </p>
19935 !! end
19936
19937
19938 !! test
19939 -{}- tags within headlines (within html for parserConvert())
19940 !! options
19941 language=sr variant=sr-ec
19942 !! wikitext
19943 == -{Naslov}- ==
19944 !! html
19945 <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>
19946
19947 !! end
19948
19949
19950 !! test
19951 Explicit definition of language variant alternatives
19952 !! options
19953 language=zh variant=zh-tw
19954 !! wikitext
19955 -{zh:China;zh-tw:Taiwan}-, not China
19956 !! html
19957 <p>Taiwan, not China
19958 </p>
19959 !! end
19960
19961
19962 !! test
19963 Conversion around HTML tags
19964 !! options
19965 language=sr variant=sr-ec
19966 !! wikitext
19967 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19968 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19969 !! html
19970 <p>
19971 <span title="ЛаCтин">ски</span>
19972 </p>
19973 !! end
19974
19975
19976 !! test
19977 Explicit session-wise language variant mapping (A flag and - flag)
19978 !! options
19979 language=zh variant=zh-tw
19980 !! wikitext
19981 Taiwan is not China.
19982 But -{A|zh:China;zh-tw:Taiwan}- is China,
19983 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19984 and -{China}- is China.
19985 !! html
19986 <p>Taiwan is not China.
19987 But Taiwan is Taiwan,
19988 (This should be stripped!)
19989 and China is China.
19990 </p>
19991 !! end
19992
19993 !! test
19994 Explicit session-wise language variant mapping (H flag for hide)
19995 !! options
19996 language=zh variant=zh-tw
19997 !! wikitext
19998 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19999 Taiwan is China.
20000 !! html
20001 <p>(This should be stripped!)
20002 Taiwan is Taiwan.
20003 </p>
20004 !! end
20005
20006 !! test
20007 Adding explicit conversion rule for title (T flag)
20008 !! options
20009 language=zh variant=zh-tw showtitle
20010 !! wikitext
20011 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20012 !! html
20013 Taiwan
20014 <p>Should be stripped!
20015 </p>
20016 !! end
20017
20018 !! test
20019 Testing that changing the language variant here in the tests actually works
20020 !! options
20021 language=zh variant=zh showtitle
20022 !! wikitext
20023 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20024 !! html
20025 China
20026 <p>Should be stripped!
20027 </p>
20028 !! end
20029
20030 !! test
20031 Recursive conversion of alt and title attrs shouldn't clear converter state
20032 !! options
20033 language=zh variant=zh-cn showtitle
20034 !! wikitext
20035 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20036 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20037 !! html
20038 China
20039 <p>
20040 Should be stripped<span title="Exclamation">!</span>
20041 </p>
20042 !! end
20043
20044 !! test
20045 Bug 24072: more test on conversion rule for title
20046 !! options
20047 language=zh variant=zh-tw showtitle
20048 !! wikitext
20049 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20050 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20051 !! html
20052 Taiwan
20053 <p>This should be stripped!
20054 This won't take interferes with the title rule.
20055 </p>
20056 !! end
20057
20058 !! test
20059 Partly disable title conversion if variant == main language code
20060 !! options
20061 language=zh variant=zh title=[[ZH]] showtitle
20062 !! wikitext
20063 -{T|zh-cn:CN;zh-tw:TW}-
20064 !! html
20065 ZH
20066 <p>
20067 </p>
20068 !! end
20069
20070 !! test
20071 Partly disable title conversion if variant == main language code, more
20072 !! options
20073 language=zh variant=zh title=[[ZH]] showtitle
20074 !! wikitext
20075 -{T|TW}-
20076 !! html
20077 ZH
20078 <p>
20079 </p>
20080 !! end
20081
20082 !! test
20083 Raw output of variant escape tags (R flag)
20084 !! options
20085 language=zh variant=zh-tw
20086 !! wikitext
20087 Raw: -{R|zh:China;zh-tw:Taiwan}-
20088 !! html
20089 <p>Raw: zh:China;zh-tw:Taiwan
20090 </p>
20091 !! end
20092
20093 !! test
20094 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20095 !! options
20096 language=zh variant=zh-cn
20097 !! input
20098 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20099 !! result
20100 <p>0
20101 </p>
20102 !! end
20103
20104 !! test
20105 Conversion rules from [numeric-only string] to [something else] (T48634)
20106 !! options
20107 language=zh variant=zh-cn
20108 !! input
20109 -{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
20110 !! result
20111 <p>D12345EE12345
20112 </p>
20113 !! end
20114
20115 !! test
20116 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20117 !! options
20118 language=zh variant=zh-cn
20119 !! input
20120 -{H|zh-cn:foo;zh-tw:;}-foobar
20121 !! result
20122 <p>foobar
20123 </p>
20124 !! end
20125
20126 !! test
20127 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20128 !! options
20129 language=zh variant=zh-cn
20130 !! input
20131 -{H|=>zh-cn:foo;}-foobar
20132 !! result
20133 <p>foobar
20134 </p>
20135 !! end
20136
20137 !! test
20138 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20139 !! options
20140 language=zh variant=zh-cn
20141 !! input
20142 -{H|}-foobar
20143 !! result
20144 <p>foobar
20145 </p>
20146 !! end
20147
20148 !! test
20149 Nested using of manual convert syntax
20150 !! options
20151 language=zh variant=zh-hk
20152 !! wikitext
20153 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20154 !! html
20155 <p>Nested: Hello Hong Kong!
20156 </p>
20157 !! end
20158
20159 # Since Parsoid is starting to emit canonical wikitext for links,
20160 # [http://example.com http://example.com] will not RT back to that
20161 # form anymore.
20162 !! test
20163 Proper conversion of text in external links
20164 !! options
20165 language=sr variant=sr-ec
20166 parsoid=wt2html
20167 !! wikitext
20168 http://www.google.com
20169 gopher://www.google.com
20170 [http://www.google.com http://www.google.com]
20171 [gopher://www.google.com gopher://www.google.com]
20172 [https://www.google.com irc://www.google.com]
20173 [ftp://www.google.com www.google.com/ftp://dir]
20174 [//www.google.com www.google.com]
20175 !! html/php
20176 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20177 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20178 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20179 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20180 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20181 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20182 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20183 </p>
20184 !! html/parsoid
20185 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20186 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20187 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20188 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20189 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20190 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20191 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20192 !! end
20193
20194 !! test
20195 Do not convert roman numbers to language variants
20196 !! options
20197 language=sr variant=sr-ec
20198 !! wikitext
20199 Fridrih IV je car.
20200 !! html
20201 <p>Фридрих IV је цар.
20202 </p>
20203 !! end
20204
20205 !! test
20206 Unclosed language converter markup "-{"
20207 !! options
20208 language=sr
20209 !! wikitext
20210 -{T|hello
20211 !! html
20212 <p>-{T|hello
20213 </p>
20214 !! end
20215
20216 !! test
20217 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20218 !! options
20219 language=sr
20220 !! wikitext
20221 -{R|=&gt;}-
20222 !! html
20223 <p>=&gt;
20224 </p>
20225 !!end
20226
20227 !! test
20228 Don't break link parsing if language converter markup is in the caption.
20229 !! options
20230 language=sr variant=sr-ec
20231 !! wikitext
20232 [[Main Page|-{R|main page}-]]
20233 !! html
20234 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20235 </p>
20236 !! end
20237
20238 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20239 !! test
20240 Don't break image parsing if language converter markup is in the caption.
20241 !! options
20242 language=sr
20243 !! wikitext
20244 [[File:Foobar.jpg|-{R|caption}-]]
20245 !! html/parsoid
20246 <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>
20247 </p>
20248 !! end
20249
20250 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20251 !! test
20252 Don't break list handling if language converter markup is in the item.
20253 !! options
20254 language=zh variant=zh-cn
20255 !! wikitext
20256 ;-{zh-cn:AAA;zh-tw:BBB}-
20257 !! html/php
20258 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20259
20260 !! html/parsoid
20261 <dl><dt>AAA
20262 </dt></dl>
20263 !! end
20264
20265 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20266 !! test
20267 Don't break table handling if language converter markup is in the cell.
20268 !! options
20269 language=sr variant=sr-ec
20270 !! wikitext
20271 {|
20272 |-
20273 | -{R|B}-
20274 |}
20275 !! html/php
20276 <table>
20277
20278 <tr>
20279 <td>Б}-
20280 </td></tr></table>
20281
20282 !! html/parsoid
20283 <table>
20284
20285 <tr>
20286 <td> B
20287 </td></tr></table>
20288
20289 !! end
20290
20291 !! test
20292 Bug 529: Uncovered bullet
20293 !! wikitext
20294 * Foo {{bullet}}
20295 !! html
20296 <ul><li> Foo </li>
20297 <li> Bar</li></ul>
20298
20299 !! end
20300
20301 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20302 # Templates in Wikipedia rely on this behavior, as tidy has always been
20303 # enabled there. These tests are normally run *without* tidy, so specify the
20304 # full output here.
20305 # To test realistic parsing behavior, apply a tidy-like transformation to both
20306 # the expected output and your parser's output.
20307 !! test
20308 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20309 !! wikitext
20310 ******* Foo {{bullet}}
20311 !! html
20312 <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>
20313 <li> Bar</li></ul>
20314
20315 !! end
20316
20317 !! test
20318 Bug 529: Uncovered table already at line-start
20319 !! wikitext
20320 x
20321
20322 {{table}}
20323 y
20324 !! html
20325 <p>x
20326 </p>
20327 <table>
20328 <tr>
20329 <td> 1 </td>
20330 <td> 2
20331 </td></tr>
20332 <tr>
20333 <td> 3 </td>
20334 <td> 4
20335 </td></tr></table>
20336 <p>y
20337 </p>
20338 !! end
20339
20340 !! test
20341 Bug 529: Uncovered bullet in parser function result
20342 !! wikitext
20343 * Foo {{lc:{{bullet}} }}
20344 !! html
20345 <ul><li> Foo </li>
20346 <li> bar</li></ul>
20347
20348 !! end
20349
20350 !! test
20351 Bug 5678: Double-parsed template argument
20352 !! wikitext
20353 {{lc:{{{1}}}|hello}}
20354 !! html
20355 <p>{{{1}}}
20356 </p>
20357 !! end
20358
20359 !! test
20360 Bug 5678: Double-parsed template invocation
20361 !! wikitext
20362 {{lc:{{paramtest {{!}} param = hello }} }}
20363 !! html
20364 <p>{{paramtest | param = hello }}
20365 </p>
20366 !! end
20367
20368 !! test
20369 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20370 !! options
20371 language=cs
20372 title=[[Main Page]]
20373 !! wikitext
20374 {{PRVNÍVELKÉ:ěščř}}
20375 {{prvnívelké:ěščř}}
20376 {{PRVNÍMALÉ:ěščř}}
20377 {{prvnímalé:ěščř}}
20378 {{MALÁ:ěščř}}
20379 {{malá:ěščř}}
20380 {{VELKÁ:ěščř}}
20381 {{velká:ěščř}}
20382 !! html
20383 <p>Ěščř
20384 Ěščř
20385 ěščř
20386 ěščř
20387 ěščř
20388 ěščř
20389 ĚŠČŘ
20390 ĚŠČŘ
20391 </p>
20392 !! end
20393
20394 !! test
20395 Morwen/13: Unclosed link followed by heading
20396 !! wikitext
20397 [[link
20398 ==heading==
20399 !! html
20400 <p>[[link
20401 </p>
20402 <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>
20403
20404 !! end
20405
20406 !! test
20407 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20408 !! wikitext
20409 {{foo|
20410 =heading=
20411 !! html
20412 <p>{{foo|
20413 </p>
20414 <h1><span class="mw-headline" id="heading">heading</span></h1>
20415
20416 !! end
20417
20418 !! test
20419 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20420 !! wikitext
20421 {{foo|
20422 ==heading==
20423 !! html
20424 <p>{{foo|
20425 </p>
20426 <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>
20427
20428 !! end
20429
20430 !! test
20431 Tildes in comments
20432 !! options
20433 pst
20434 !! wikitext
20435 <!-- ~~~~ -->
20436 !! html/php
20437 <!-- ~~~~ -->
20438 !! end
20439
20440 !! test
20441 Paragraphs inside divs (no extra line breaks)
20442 !! wikitext
20443 <div>Line one
20444
20445 Line two</div>
20446 !! html
20447 <div>Line one
20448 Line two</div>
20449
20450 !! end
20451
20452 !! test
20453 Paragraphs inside divs (extra line break on open)
20454 !! wikitext
20455 <div>
20456 Line one
20457
20458 Line two</div>
20459 !! html
20460 <div>
20461 <p>Line one
20462 </p>
20463 Line two</div>
20464
20465 !! end
20466
20467 !! test
20468 Paragraphs inside divs (extra line break on close)
20469 !! wikitext
20470 <div>Line one
20471
20472 Line two
20473 </div>
20474 !! html
20475 <div>Line one
20476 <p>Line two
20477 </p>
20478 </div>
20479
20480 !! end
20481
20482 !! test
20483 Paragraphs inside divs (extra line break on open and close)
20484 !! wikitext
20485 <div>
20486 Line one
20487
20488 Line two
20489 </div>
20490 !! html
20491 <div>
20492 <p>Line one
20493 </p><p>Line two
20494 </p>
20495 </div>
20496
20497 !! end
20498
20499 !! test
20500 Nesting tags, paragraphs on lines which begin with <div>
20501 !! wikitext
20502 <div></div><strong>A
20503 B</strong>
20504 !! html/php+tidy
20505 <p><strong>A</strong></p>
20506 <p><strong>B</strong></p>
20507 !! html/parsoid
20508 <div></div>
20509 <p><strong>A
20510 B</strong>
20511 </p>
20512 !! end
20513
20514 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20515 !! test
20516 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20517 !! wikitext
20518 <blockquote>Line one
20519
20520 Line two</blockquote>
20521 !! html
20522 <blockquote>Line one
20523 Line two</blockquote>
20524
20525 !! html+tidy
20526 <blockquote>
20527 <p>Line one Line two</p>
20528 </blockquote>
20529 !! end
20530
20531 !! test
20532 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20533 !! wikitext
20534 <blockquote>
20535 Line one
20536
20537 Line two</blockquote>
20538 !! html
20539 <blockquote>
20540 <p>Line one
20541 </p>
20542 Line two</blockquote>
20543
20544 !! html+tidy
20545 <blockquote>
20546 <p>Line one</p>
20547 Line two</blockquote>
20548 !! end
20549
20550 !! test
20551 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20552 !! wikitext
20553 <blockquote>Line one
20554
20555 Line two
20556 </blockquote>
20557 !! html
20558 <blockquote>Line one
20559 <p>Line two
20560 </p>
20561 </blockquote>
20562
20563 !! html+tidy
20564 <blockquote>
20565 <p>Line one</p>
20566 <p>Line two</p>
20567 </blockquote>
20568 !! end
20569
20570 !! test
20571 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20572 !! wikitext
20573 <blockquote>
20574 Line one
20575
20576 Line two
20577 </blockquote>
20578 !! html
20579 <blockquote>
20580 <p>Line one
20581 </p><p>Line two
20582 </p>
20583 </blockquote>
20584
20585 !! html+tidy
20586 <blockquote>
20587 <p>Line one</p>
20588 <p>Line two</p>
20589 </blockquote>
20590 !! end
20591
20592 !! test
20593 Paragraphs inside blockquotes/divs (no extra line breaks)
20594 !! wikitext
20595 <blockquote><div>Line one
20596
20597 Line two</div></blockquote>
20598 !! html
20599 <blockquote><div>Line one
20600 Line two</div></blockquote>
20601
20602 !! end
20603
20604 !! test
20605 Paragraphs inside blockquotes/divs (extra line break on open)
20606 !! wikitext
20607 <blockquote><div>
20608 Line one
20609
20610 Line two</div></blockquote>
20611 !! html
20612 <blockquote><div>
20613 <p>Line one
20614 </p>
20615 Line two</div></blockquote>
20616
20617 !! end
20618
20619 !! test
20620 Paragraphs inside blockquotes/divs (extra line break on close)
20621 !! wikitext
20622 <blockquote><div>Line one
20623
20624 Line two
20625 </div></blockquote>
20626 !! html
20627 <blockquote><div>Line one
20628 <p>Line two
20629 </p>
20630 </div></blockquote>
20631
20632 !! end
20633
20634 !! test
20635 Paragraphs inside blockquotes/divs (extra line break on open and close)
20636 !! wikitext
20637 <blockquote><div>
20638 Line one
20639
20640 Line two
20641 </div></blockquote>
20642 !! html
20643 <blockquote><div>
20644 <p>Line one
20645 </p><p>Line two
20646 </p>
20647 </div></blockquote>
20648
20649 !! end
20650
20651 !! test
20652 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20653 !! options
20654 wgLinkHolderBatchSize=0
20655 !! wikitext
20656 [[meatball:1]]
20657 [[meatball:2]]
20658 [[meatball:3]]
20659 !! html
20660 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20661 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20662 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20663 </p>
20664 !! end
20665
20666 !! test
20667 Free external link invading image caption
20668 !! wikitext
20669 [[Image:Foobar.jpg|thumb|http://x|hello]]
20670 !! html
20671 <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>
20672
20673 !! end
20674
20675 !! test
20676 Bug 15196: localised external link numbers
20677 !! options
20678 language=fa
20679 !! wikitext
20680 [http://en.wikipedia.org/]
20681 !! html/php
20682 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20683 </p>
20684 !! html/parsoid
20685 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20686 !! end
20687
20688 !! test
20689 Multibyte character in padleft
20690 !! wikitext
20691 {{padleft:-Hello|7|Æ}}
20692 !! html
20693 <p>Æ-Hello
20694 </p>
20695 !! end
20696
20697 !! test
20698 Multibyte character in padright
20699 !! wikitext
20700 {{padright:Hello-|7|Æ}}
20701 !! html
20702 <p>Hello-Æ
20703 </p>
20704 !! end
20705
20706 !!test
20707 formatdate parser function
20708 !! wikitext
20709 {{#formatdate:2009-03-24}}
20710 !! html
20711 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20712 </p>
20713 !! end
20714
20715 !!test
20716 formatdate parser function, with default format
20717 !! wikitext
20718 {{#formatdate:2009-03-24|mdy}}
20719 !! html
20720 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20721 </p>
20722 !! end
20723
20724 !! test
20725 Spacing of numbers in formatted dates
20726 !! wikitext
20727 {{#formatdate:January 15}}
20728 !! html
20729 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20730 </p>
20731 !! end
20732
20733 !! test
20734 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
20735 !! options
20736 language=nl title=[[MediaWiki:Common.css]]
20737 !! wikitext
20738 {{#formatdate:2009-03-24|dmy}}
20739 !! html
20740 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20741 </p>
20742 !! end
20743
20744 #
20745 #
20746 #
20747
20748 #
20749 # Edit comments
20750 #
20751
20752 !! test
20753 Edit comment with link
20754 !! options
20755 comment
20756 !! wikitext
20757 I like the [[Main Page]] a lot
20758 !! html/php
20759 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20760 !!end
20761
20762 !! test
20763 Edit comment with link and link text
20764 !! options
20765 comment
20766 !! wikitext
20767 I like the [[Main Page|best pages]] a lot
20768 !! html/php
20769 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20770 !!end
20771
20772 !! test
20773 Edit comment with link and link text with suffix
20774 !! options
20775 comment
20776 !! wikitext
20777 I like the [[Main Page|best page]]s a lot
20778 !! html/php
20779 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20780 !!end
20781
20782 !! test
20783 Edit comment with section link (non-local, eg in history list)
20784 !! options
20785 comment title=[[Main Page]]
20786 !! wikitext
20787 /* External links */ removed bogus entries
20788 !! html/php
20789 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20790 !!end
20791
20792 !! test
20793 Edit comment with section link and text before it (non-local, eg in history list)
20794 !! options
20795 comment title=[[Main Page]]
20796 !! wikitext
20797 pre-comment text /* External links */ removed bogus entries
20798 !! html/php
20799 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>
20800 !!end
20801
20802 !! test
20803 Edit comment with section link (local, eg in diff view)
20804 !! options
20805 comment local title=[[Main Page]]
20806 !! wikitext
20807 /* External links */ removed bogus entries
20808 !! html/php
20809 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20810 !!end
20811
20812 !! test
20813 Edit comment with subpage link (bug 14080)
20814 !! options
20815 comment
20816 subpage
20817 title=[[Subpage test]]
20818 !! wikitext
20819 Poked at a [[/subpage]] here...
20820 !! html/php
20821 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20822 !!end
20823
20824 !! test
20825 Edit comment with subpage link and link text (bug 14080)
20826 !! options
20827 comment
20828 subpage
20829 title=[[Subpage test]]
20830 !! wikitext
20831 Poked at a [[/subpage|neat little page]] here...
20832 !! html/php
20833 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20834 !!end
20835
20836 !! test
20837 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20838 !! options
20839 comment
20840 title=[[Subpage test]]
20841 !! wikitext
20842 Poked at a [[/subpage]] here...
20843 !! html/php
20844 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...
20845 !!end
20846
20847 !! test
20848 Edit comment with bare anchor link (local, as on diff)
20849 !! options
20850 comment
20851 local
20852 title=[[Main Page]]
20853 !! wikitext
20854 [[#section]]
20855 !! html/php
20856 <a href="#section">#section</a>
20857 !! end
20858
20859 !! test
20860 Edit comment with bare anchor link (non-local, as on history)
20861 !! options
20862 comment
20863 title=[[Main Page]]
20864 !! wikitext
20865 [[#section]]
20866 !! html/php
20867 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20868 !! end
20869
20870 !! test
20871 Anchor starting with underscore
20872 !! options
20873 title=[[Foo]]
20874 !! wikitext
20875 [[#_ref|One]]
20876 !! html/php
20877 <p><a href="#_ref">One</a>
20878 </p>
20879 !! html/parsoid
20880 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20881 !! end
20882
20883 !! test
20884 Id starting with underscore
20885 !! wikitext
20886 <div id="_ref"></div>
20887 !! html/*
20888 <div id="_ref"></div>
20889
20890 !! end
20891
20892 !! test
20893 Space normalisation on autocomment (bug 22784)
20894 !! options
20895 comment
20896 title=[[Main Page]]
20897 !! wikitext
20898 /* __hello__world__ */
20899 !! html/php
20900 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20901 !! end
20902
20903 !! test
20904 percent-encoding and + signs in comments (Bug 26410)
20905 !! options
20906 comment
20907 !! wikitext
20908 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20909 !! html/php
20910 <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>
20911 !! end
20912
20913 # Parsoid doesn't support this yet: see bug 73581
20914 # but it *should* omit the 'src' attribute if the image is bad.
20915 # PHP side of tests was disabled in
20916 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20917 # because of issues in the PHP parserTests infrastructure
20918 # (but the output below is indeed what the PHP side emits)
20919 !! test
20920 Bad images - basic functionality
20921 !! wikitext
20922 [[File:Bad.jpg]]
20923 !! DISABLED/html/php
20924 !! html/parsoid
20925 <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>
20926 !! end
20927
20928 !! test
20929 Bad images - bug 16039: text after bad image disappears
20930 !! wikitext
20931 Foo bar
20932 [[File:Bad.jpg]]
20933 Bar foo
20934 !! DISABLED/html/php
20935 <p>Foo bar
20936 </p><p>Bar foo
20937 </p>
20938 !! html/parsoid
20939 <p>Foo bar
20940 <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>
20941 Bar foo</p>
20942 !! end
20943
20944 !! test
20945 Verify that displaytitle works (bug #22501) no displaytitle
20946 !! options
20947 showtitle
20948 !! config
20949 wgAllowDisplayTitle=true
20950 wgRestrictDisplayTitle=false
20951 !! wikitext
20952 this is not the the title
20953 !! html/php
20954 Parser test
20955 <p>this is not the the title
20956 </p>
20957 !! end
20958
20959 !! test
20960 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20961 !! options
20962 showtitle
20963 title=[[Screen]]
20964 !! config
20965 wgAllowDisplayTitle=true
20966 wgRestrictDisplayTitle=false
20967 !! wikitext
20968 this is not the the title
20969 {{DISPLAYTITLE:whatever}}
20970 !! html/php
20971 whatever
20972 <p>this is not the the title
20973 </p>
20974 !! end
20975
20976 !! test
20977 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20978 !! options
20979 showtitle
20980 title=[[Screen]]
20981 !! config
20982 wgAllowDisplayTitle=true
20983 wgRestrictDisplayTitle=true
20984 !! wikitext
20985 this is not the the title
20986 {{DISPLAYTITLE:whatever}}
20987 !! html/php
20988 Screen
20989 <p>this is not the the title
20990 </p>
20991 !! end
20992
20993 !! test
20994 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20995 !! options
20996 showtitle
20997 title=[[Screen]]
20998 !! config
20999 wgAllowDisplayTitle=true
21000 wgRestrictDisplayTitle=true
21001 !! wikitext
21002 this is not the the title
21003 {{DISPLAYTITLE:screen}}
21004 !! html/php
21005 screen
21006 <p>this is not the the title
21007 </p>
21008 !! end
21009
21010 !! test
21011 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21012 !! options
21013 showtitle
21014 title=[[Screen]]
21015 !! config
21016 wgAllowDisplayTitle=false
21017 !! wikitext
21018 this is not the the title
21019 {{DISPLAYTITLE:screen}}
21020 !! html/php
21021 Screen
21022 <p>this is not the the title
21023 <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>
21024 </p>
21025 !! end
21026
21027 !! test
21028 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21029 !! options
21030 showtitle
21031 title=[[Screen]]
21032 !! config
21033 wgAllowDisplayTitle=false
21034 !! wikitext
21035 this is not the the title
21036 !! html/php
21037 Screen
21038 <p>this is not the the title
21039 </p>
21040 !! end
21041
21042 !! test
21043 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21044 !! options
21045 showtitle
21046 title=[[Screen]]
21047 !! config
21048 wgAllowDisplayTitle=true
21049 wgRestrictDisplayTitle=true
21050 !! wikitext
21051 this is not the the title
21052 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21053 !! html/php
21054 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21055 <p>this is not the the title
21056 </p>
21057 !! end
21058
21059 !! test
21060 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21061 !! options
21062 showtitle
21063 title=[[Screen]]
21064 !! config
21065 wgAllowDisplayTitle=true
21066 wgRestrictDisplayTitle=true
21067 !! wikitext
21068 this is not the the title
21069 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21070 !! html/php
21071 <span style="color: red;">s</span>creen
21072 <p>this is not the the title
21073 </p>
21074 !! end
21075
21076 !! test
21077 Page status indicators: Empty name is invalid
21078 !! options
21079 showindicators
21080 !! wikitext
21081 <indicator name=" "></indicator>
21082 <indicator></indicator>
21083 !! html
21084 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21085 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21086 </p>
21087 !! end
21088
21089 !! test
21090 Page status indicators: Weird syntaxes that are okay
21091 !! options
21092 showindicators
21093 !! wikitext
21094 <indicator name="empty" />
21095 <indicator name="name"></indicator>
21096 !! html
21097 empty=
21098 name=
21099 <p><br />
21100 </p>
21101 !! end
21102
21103 !! test
21104 Page status indicators: Torture test
21105 !! options
21106 showindicators
21107 !! wikitext
21108 <indicator name="01">hello world</indicator>
21109 <indicator name="02">[[Main Page]]</indicator>
21110 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21111 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21112 <indicator name="05">* foo
21113 * bar</indicator>
21114 <indicator name="06"><nowiki>foo</nowiki></indicator>
21115 <indicator name="07"> Preformatted</indicator>
21116 <indicator name="08"><div>Broken tag</indicator>
21117 <indicator name="09">{| class=wikitable
21118 | cell
21119 |}</indicator>
21120 <indicator name="10">Two
21121
21122 paragraphs</indicator>
21123 !! html
21124 01=hello world
21125 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21126 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" />
21127 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>
21128 05=<ul><li> foo</li>
21129 <li> bar</li></ul>
21130
21131 06=foo
21132 07=<pre>Preformatted
21133 </pre>
21134 08=<div>Broken tag</div>
21135
21136 09=<table class="wikitable">
21137 <tr>
21138 <td> cell
21139 </td></tr></table>
21140
21141 10=<p>Two
21142 </p><p>paragraphs
21143 </p>
21144 <p><br />
21145 </p><p><br />
21146 </p><p><br />
21147 </p><p><br />
21148 </p><p><br />
21149 </p>
21150 !! end
21151
21152 !! test
21153 preload: check <noinclude> and <includeonly>
21154 !! options
21155 preload
21156 !! wikitext
21157 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21158 !! html/php
21159 Hello kind world.
21160 !! end
21161
21162 !! test
21163 preload: check <onlyinclude>
21164 !! options
21165 preload
21166 !! wikitext
21167 Goodbye <onlyinclude>Hello world</onlyinclude>
21168 !! html/php
21169 Hello world
21170 !! end
21171
21172 !! test
21173 preload: can pass tags through if we want to
21174 !! options
21175 preload
21176 !! wikitext
21177 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21178 !! html/php
21179 <includeonly>Hello world</includeonly>
21180 !! end
21181
21182 !! test
21183 preload: check that it doesn't try to do tricks
21184 !! options
21185 preload
21186 !! wikitext
21187 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21188 !! html/php
21189 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21190 !! end
21191
21192 !! test
21193 Play a bit with r67090 and bug 3158
21194 !! wikitext
21195 <div style="width:50% !important">&nbsp;</div>
21196 <div style="width:50%&nbsp;!important">&nbsp;</div>
21197 <div style="width:50%&#160;!important">&nbsp;</div>
21198 <div style="border : solid;">&nbsp;</div>
21199 !! html/php
21200 <div style="width:50% !important">&#160;</div>
21201 <div style="width:50% !important">&#160;</div>
21202 <div style="width:50% !important">&#160;</div>
21203 <div style="border&#160;: solid;">&#160;</div>
21204
21205 !! html/parsoid
21206 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21207 <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>
21208 <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>
21209 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21210
21211 !! end
21212
21213 !! test
21214 HTML5 data attributes
21215 !! wikitext
21216 <span data-foo="bar">Baz</span>
21217 <p data-abc-def_hij="">Quuz</p>
21218 !! html/php
21219 <p><span data-foo="bar">Baz</span>
21220 </p>
21221 <p data-abc-def_hij="">Quuz</p>
21222
21223 !! html/parsoid
21224 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21225 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21226 !! end
21227
21228 !! test
21229 Strip reserved data attributes
21230 !! wikitext
21231 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21232 !! html/php
21233 <div data-ok="fred">d</div>
21234
21235 !! html/parsoid
21236 <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>
21237 !! end
21238
21239 !! test
21240 percent-encoding and + signs in internal links (Bug 26410)
21241 !! wikitext
21242 [[User:+%]] [[Page+title%]]
21243 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21244 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21245 [[%33%45]] [[%33%45+]]
21246 !! html/php
21247 <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>
21248 <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>
21249 <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>
21250 <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>
21251 </p>
21252 !! html/parsoid
21253 <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>
21254 <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>
21255 <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>
21256 <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>
21257 !! end
21258
21259 !! test
21260 Special characters in embedded file links (bug 27679)
21261 !! wikitext
21262 [[File:Contains & ampersand.jpg]]
21263 [[File:Does not exist.jpg|Title with & ampersand]]
21264 !! html/php
21265 <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>
21266 <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>
21267 </p>
21268 !! html/parsoid
21269 <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>
21270 <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>
21271 !! end
21272
21273 !! test
21274 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21275 !! wikitext
21276 Text&apos;s been normalized?
21277 !! html
21278 <p>Text&#39;s been normalized?
21279 </p>
21280 !! end
21281
21282 !! test
21283 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21284 !! wikitext
21285 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21286 !! html
21287 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21288 </p>
21289 !! end
21290
21291 !! test
21292 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21293 !! wikitext
21294 [http://www.example.org/ ideograms]
21295 !! html
21296 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21297 </p>
21298 !! end
21299
21300 !! test
21301 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21302 !! wikitext
21303 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21304 !! html
21305 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21306 </p>
21307 !! end
21308
21309 !! article
21310 Mediawiki:loop1
21311 !! text
21312 {{Identical|A}}
21313 !! endarticle
21314
21315 !! article
21316 Mediawiki:loop2
21317 !! text
21318 {{Identical|B}}
21319 !! endarticle
21320
21321 !! article
21322 Template:Identical
21323 !! text
21324 {{int:loop1}}
21325 {{int:loop2}}
21326 !! endarticle
21327
21328 !! test
21329 Bug 31098 Template which includes system messages which includes the template
21330 !! wikitext
21331 {{Identical}}
21332 !! html
21333 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21334 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21335 </p>
21336 !! end
21337
21338 !! test
21339 Bug31490 Turkish: ucfirst 'blah'
21340 !! options
21341 language=tr
21342 !! wikitext
21343 {{ucfirst:blah}}
21344 !! html
21345 <p>Blah
21346 </p>
21347 !! end
21348
21349 !! test
21350 Bug31490 Turkish: ucfirst 'ix'
21351 !! options
21352 language=tr
21353 !! wikitext
21354 {{ucfirst:ix}}
21355 !! html
21356 <p>İx
21357 </p>
21358 !! end
21359
21360 !! test
21361 Bug31490 Turkish: lcfirst 'BLAH'
21362 !! options
21363 language=tr
21364 !! wikitext
21365 {{lcfirst:BLAH}}
21366 !! html
21367 <p>bLAH
21368 </p>
21369 !! end
21370
21371 !! test
21372 Bug31490 Turkish: ucfırst (with a dotless i)
21373 !! options
21374 language=tr
21375 !! wikitext
21376 {{ucfırst:blah}}
21377 !! html
21378 <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>
21379 </p>
21380 !! end
21381
21382 !! test
21383 Bug31490 ucfırst (with a dotless i) with English language
21384 !! options
21385 language=en
21386 !! wikitext
21387 {{ucfırst:blah}}
21388 !! html
21389 <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>
21390 </p>
21391 !! end
21392
21393 !! test
21394 Bug 26375: TOC with italics
21395 !! options
21396 title=[[Main Page]]
21397 !! wikitext
21398 __TOC__
21399 == ''Lost'' episodes ==
21400 !! html
21401 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21402 <ul>
21403 <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>
21404 </ul>
21405 </div>
21406
21407 <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>
21408
21409 !! end
21410
21411 !! test
21412 Bug 26375: TOC with bold
21413 !! options
21414 title=[[Main Page]]
21415 !! wikitext
21416 __TOC__
21417 == '''should be bold''' then normal text ==
21418 !! html
21419 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21420 <ul>
21421 <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>
21422 </ul>
21423 </div>
21424
21425 <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>
21426
21427 !! end
21428
21429 !! test
21430 Bug 33845: Headings become cursive in TOC when they contain an image
21431 !! options
21432 title=[[Main Page]]
21433 !! wikitext
21434 __TOC__
21435 == Image [[Image:foobar.jpg]] ==
21436 !! html
21437 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21438 <ul>
21439 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21440 </ul>
21441 </div>
21442
21443 <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>
21444
21445 !! end
21446
21447 !! test
21448 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21449 !! options
21450 title=[[Main Page]]
21451 !! wikitext
21452 __TOC__
21453 == <blockquote>Quote</blockquote> ==
21454 !! html
21455 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21456 <ul>
21457 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21458 </ul>
21459 </div>
21460
21461 <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>
21462
21463 !! html+tidy
21464 <p></p>
21465 <div id="toc" class="toc">
21466 <div id="toctitle">
21467 <h2>Contents</h2>
21468 </div>
21469 <ul>
21470 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21471 </ul>
21472 </div>
21473 <p></p>
21474 <h2><span class="mw-headline" id="Quote"></span></h2>
21475 <blockquote>
21476 <p><span class="mw-headline" id="Quote">Quote</span></p>
21477 </blockquote>
21478 <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>
21479 !! end
21480
21481 !! test
21482 Unclosed tags in TOC
21483 !! options
21484 title=[[Main Page]]
21485 !! wikitext
21486 __TOC__
21487 == Proof: 2 < 3 ==
21488 <small>Hanc marginis exiguitas non caperet.</small>
21489 QED
21490 !! html
21491 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21492 <ul>
21493 <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>
21494 </ul>
21495 </div>
21496
21497 <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>
21498 <p><small>Hanc marginis exiguitas non caperet.</small>
21499 QED
21500 </p>
21501 !! end
21502
21503 !! test
21504 Multiple tags in TOC
21505 !! wikitext
21506 __TOC__
21507 == <i>Foo</i> <b>Bar</b> ==
21508
21509 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21510 !! html
21511 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21512 <ul>
21513 <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>
21514 <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>
21515 </ul>
21516 </div>
21517
21518 <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>
21519 <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>
21520
21521 !! html+tidy
21522 <p></p>
21523 <div id="toc" class="toc">
21524 <div id="toctitle">
21525 <h2>Contents</h2>
21526 </div>
21527 <ul>
21528 <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>
21529 <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>
21530 </ul>
21531 </div>
21532 <p></p>
21533 <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>
21534 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21535 <blockquote>
21536 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21537 </blockquote>
21538 <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>
21539 !! end
21540
21541 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21542 # html5 tag parsing.
21543 !! test
21544 Tags with parameters in TOC
21545 !! options
21546 parsoid=wt2html
21547 !! wikitext
21548 __TOC__
21549 == <sup class="in-h2">Hello</sup> ==
21550
21551 == <sup class="a > b">Evilbye</sup> ==
21552 !! html/php
21553 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21554 <ul>
21555 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21556 <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>
21557 </ul>
21558 </div>
21559
21560 <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>
21561 <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>
21562
21563 !! html/parsoid
21564 <meta property="mw:PageProp/toc" />
21565 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21566
21567 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21568 !! end
21569
21570 !! test
21571 span tags with directionality in TOC
21572 !! wikitext
21573 __TOC__
21574 == <span dir="ltr">C++</span> ==
21575
21576 == <span dir="rtl">זבנג!</span> ==
21577
21578 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21579
21580 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21581
21582 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21583 !! html
21584 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21585 <ul>
21586 <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>
21587 <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>
21588 <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>
21589 <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>
21590 <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>
21591 </ul>
21592 </div>
21593
21594 <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>
21595 <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>
21596 <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>
21597 <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>
21598 <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>
21599
21600 !! end
21601
21602 !! test
21603 Bug 72884: bdi element in ToC
21604 !! wikitext
21605 __TOC__
21606 == <bdi>test</bdi> ==
21607 !! html
21608 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21609 <ul>
21610 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21611 </ul>
21612 </div>
21613
21614 <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>
21615
21616 !! end
21617
21618 # Note that the html output does not have the <p></p>, but the
21619 # html+tidy output *does*. This is because the empty <p></p> is
21620 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21621 !! test
21622 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21623 !! wikitext
21624 __TOC__
21625 == x ==
21626 !! html
21627 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21628 <ul>
21629 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21630 </ul>
21631 </div>
21632
21633 <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>
21634
21635 !! html+tidy
21636 <p></p>
21637 <div id="toc" class="toc">
21638 <div id="toctitle">
21639 <h2>Contents</h2>
21640 </div>
21641 <ul>
21642 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21643 </ul>
21644 </div>
21645 <p></p>
21646 <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>
21647 !! end
21648
21649 !! article
21650 MediaWiki:Bug32057
21651 !! text
21652 == {{int:headline_sample}} ==
21653 !! endarticle
21654
21655 !! test
21656 Bug 32057: Title needed when expanding <h> nodes.
21657 !! options
21658 title=[[Main Page]]
21659 !! wikitext
21660 {{int:Bug32057}}
21661 !! html
21662 <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>
21663
21664 !! end
21665
21666 !! test
21667 Strip marker in urlencode
21668 !! wikitext
21669 {{urlencode:x<nowiki/>y}}
21670 {{urlencode:x<nowiki/>y|wiki}}
21671 {{urlencode:x<nowiki/>y|path}}
21672 {{urlencode:x<pre id="one">two</pre>y}}
21673 !! html
21674 <p>xy
21675 xy
21676 xy
21677 xy
21678 </p>
21679 !! end
21680
21681 !! test
21682 Strip marker in lc
21683 !! wikitext
21684 {{lc:x<nowiki/>y}}
21685 !! html
21686 <p>xy
21687 </p>
21688 !! end
21689
21690 !! test
21691 Strip marker in uc
21692 !! wikitext
21693 {{uc:x<nowiki/>y}}
21694 !! html
21695 <p>XY
21696 </p>
21697 !! end
21698
21699 !! test
21700 Strip marker in formatNum
21701 !! wikitext
21702 {{formatnum:1<nowiki/>2}}
21703 {{formatnum:1<nowiki/>2|R}}
21704 !! html
21705 <p>12
21706 12
21707 </p>
21708 !! end
21709
21710 !! test
21711 Check noCommafy in formatNum
21712 !! options
21713 language=be-tarask
21714 !! wikitext
21715 {{formatnum:123456.78}}
21716 {{formatnum:123456.78|NOSEP}}
21717 !! html
21718 <p>123 456,78
21719 123456.78
21720 </p>
21721 !! end
21722
21723 !! test
21724 Wrong option for formatNum (bug 56199)
21725 !! wikitext
21726 {{formatnum:1,234.56|Random}}
21727 {{formatnum:1,234.56|EVERYTHING}}
21728 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21729 !! html
21730 <p>1,234.56
21731 1,234.56
21732 1,234.56
21733 </p>
21734 !! end
21735
21736 !! test
21737 Strip marker in grammar
21738 !! options
21739 language=fi
21740 !! wikitext
21741 {{grammar:elative|foo<nowiki/>bar}}
21742 !! html
21743 <p>foobarista
21744 </p>
21745 !! end
21746
21747 !! test
21748 Strip marker in padleft
21749 !! wikitext
21750 {{padleft:|2|x<nowiki/>y}}
21751 !! html
21752 <p>xy
21753 </p>
21754 !! end
21755
21756 !! test
21757 Strip marker in padright
21758 !! wikitext
21759 {{padright:|2|x<nowiki/>y}}
21760 !! html
21761 <p>xy
21762 </p>
21763 !! end
21764
21765 !! test
21766 Strip marker in anchorencode
21767 !! wikitext
21768 {{anchorencode:x<nowiki/>y}}
21769 !! html
21770 <p>xy
21771 </p>
21772 !! end
21773
21774 !! test
21775 nowiki inside link inside heading (bug 18295)
21776 !! wikitext
21777 ==[[foo|x<nowiki>y</nowiki>z]]==
21778 !! html
21779 <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>
21780
21781 !! end
21782
21783 !! test
21784 new support for bdi element (bug 31817)
21785 !! wikitext
21786 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21787 !! html
21788 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21789
21790 !!end
21791
21792 !! test
21793 Ignore pipe between table row attributes
21794 !! wikitext
21795 {|
21796 | quux
21797 |- id=foo | style='color: red'
21798 | bar
21799 |}
21800 !! html
21801 <table>
21802 <tr>
21803 <td> quux
21804 </td></tr>
21805 <tr id="foo" style="color: red">
21806 <td> bar
21807 </td></tr></table>
21808
21809 !! end
21810
21811 !!test
21812 Gallery override link with WikiLink (bug 34852)
21813 !! wikitext
21814 <gallery>
21815 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21816 </gallery>
21817 !! html
21818 <ul class="gallery mw-gallery-traditional">
21819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21820 <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>
21821 <div class="gallerytext">
21822 <p>caption
21823 </p>
21824 </div>
21825 </div></li>
21826 </ul>
21827
21828 !! end
21829
21830 !!test
21831 Gallery override link with absolute external link (bug 34852)
21832 !! wikitext
21833 <gallery>
21834 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21835 </gallery>
21836 !! html
21837 <ul class="gallery mw-gallery-traditional">
21838 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21839 <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>
21840 <div class="gallerytext">
21841 <p>caption
21842 </p>
21843 </div>
21844 </div></li>
21845 </ul>
21846
21847 !! end
21848
21849 !!test
21850 Gallery override link with malicious javascript (bug 34852)
21851 !! wikitext
21852 <gallery>
21853 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21854 </gallery>
21855 !! html
21856 <ul class="gallery mw-gallery-traditional">
21857 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21858 <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>
21859 <div class="gallerytext">
21860 <p>caption
21861 </p>
21862 </div>
21863 </div></li>
21864 </ul>
21865
21866 !! end
21867
21868 !!test
21869 Gallery with invalid title as link (bug 43964)
21870 !! wikitext
21871 <gallery>
21872 File:foobar.jpg|link=<
21873 </gallery>
21874 !! html
21875 <ul class="gallery mw-gallery-traditional">
21876 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21877 <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>
21878 <div class="gallerytext">
21879 </div>
21880 </div></li>
21881 </ul>
21882
21883 !! end
21884
21885 !!test
21886 Language parser function
21887 !! wikitext
21888 {{#language:ar}}
21889 !! html
21890 <p>العربية
21891 </p>
21892 !! end
21893
21894 !!test
21895 Padleft and padright as substr
21896 !! wikitext
21897 {{padleft:|3|abcde}}
21898 {{padright:|3|abcde}}
21899 !! html
21900 <p>abc
21901 abc
21902 </p>
21903 !! end
21904
21905 !!test
21906 Special parser function
21907 !! wikitext
21908 {{#special:RandomPage}}
21909 {{#special:BaDtItLe}}
21910 {{#special:Foobar}}
21911 !! html
21912 <p>Special:Random
21913 Special:Badtitle
21914 Special:Foobar
21915 </p>
21916 !! end
21917
21918 !!test
21919 Bug 34939 - Case insensitive link parsing ([HttP://])
21920 !! wikitext
21921 [HttP://MediaWiki.Org/]
21922 !! html/php
21923 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21924 </p>
21925 !! html/parsoid
21926 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21927 !! end
21928
21929 !!test
21930 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21931 !! wikitext
21932 [HttP://MediaWiki.Org/ MediaWiki]
21933 !! html
21934 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21935 </p>
21936 !! end
21937
21938 !!test
21939 Bug 34939 - Case insensitive link parsing (HttP://)
21940 !! wikitext
21941 HttP://MediaWiki.Org/
21942 !! html/php
21943 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21944 </p>
21945 !! html/parsoid
21946 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21947 !! end
21948
21949 !!test
21950 Disable TOC
21951 !! options
21952 notoc
21953 !! wikitext
21954 Lead
21955 == Section 1 ==
21956 == Section 2 ==
21957 == Section 3 ==
21958 == Section 4 ==
21959 == Section 5 ==
21960 !! html
21961 <p>Lead
21962 </p>
21963
21964 <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>
21965 <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>
21966 <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>
21967 <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>
21968 <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>
21969
21970 !! end
21971
21972
21973 ###
21974 ### Parsoid-specific tests
21975 ### Parsoid-PHP parser incompatibilities
21976 ###
21977 !!test
21978 1. SOL-sensitive wikitext tokens as template-args
21979 !!options
21980 parsoid=wt2html,wt2wt
21981 !! wikitext
21982 {{echo|*a}}
21983 {{echo|#a}}
21984 {{echo|:a}}
21985 !! html
21986 <span about="#mwt1" typeof="mw:Transclusion">
21987 </span><ul about="#mwt1"><li>a</li>
21988 </ul>
21989 <span about="#mwt2" typeof="mw:Transclusion">
21990 </span><ol about="#mwt2"><li>a</li>
21991 </ol>
21992 <span about="#mwt3" typeof="mw:Transclusion">
21993 </span><dl about="#mwt3"><dd>a</dd>
21994 </dl>
21995 !!end
21996
21997 #### -----------------------------------------------------------------
21998 #### Parsoid-specific functionality tests
21999 #### -----------------------------------------------------------------
22000
22001 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22002 # We know wt2wt will fail, but we expect selser to pass.
22003 # Due to the nature of our testing, wt2wt and selser tests will enter the
22004 # blacklist and we'll catch selser regressions based on changes to the
22005 # blacklist entries for selser tests.
22006 !! test
22007 1. Bad treebuilder fixup of formatting elt is cleaned up
22008 !! options
22009 parsoid=wt2html,wt2wt
22010 !! wikitext
22011 {|
22012 |
22013 <small>
22014 [[Image:Foobar.jpg|right|Test]]
22015 </small>
22016 |}
22017 !! html/parsoid
22018 <table>
22019 <tbody><tr><td>
22020 <small>
22021 <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>
22022 </small>
22023 </td></tr>
22024 </tbody></table>
22025 !! end
22026
22027 !! test
22028 2. Bad treebuilder fixup of formatting elt is cleaned up
22029 !! options
22030 parsoid=wt2html,wt2wt
22031 !! wikitext
22032 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22033
22034 <small>[[Image:Foobar.jpg|right|300px]]</small>
22035 !! html/parsoid
22036
22037 <p><b>foo</b></p>
22038 <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>
22039 <p><b>bar</b></p>
22040 <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>
22041 !! end
22042
22043 !! test
22044 3. Bad treebuilder fixup of formatting elt is cleaned up
22045 !! options
22046 parsoid=wt2html,wt2wt
22047 !! wikitext
22048 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22049 !! html/parsoid
22050 <p><small><b>foo</b></small></p>
22051 <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>
22052 <p><small><b>bar</b></small></p>
22053 !! end
22054
22055 !! test
22056 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22057 !! options
22058 parsoid=wt2html,wt2wt
22059 !! wikitext
22060 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22061 !! html/parsoid
22062 <p><b><small></small></b></p>
22063 <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>
22064 <p></p>
22065 !! end
22066
22067 #### ----------------------------------------------------------------
22068 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22069 #### tags. Parsoid's output for these tags differs from that of the
22070 #### PHP parser.
22071 #### ----------------------------------------------------------------
22072
22073 !!test
22074 Ref: 1. ref-location should be replaced with an index span
22075 !! wikitext
22076 A <ref>foo</ref>
22077 B <ref name="x">foo</ref>
22078 C <ref name="y" />
22079 <references />
22080 !! html/parsoid
22081 <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>
22082 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>
22083 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>
22084 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22085 <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>
22086 <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>
22087 <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>
22088 </ol>
22089 !!end
22090
22091 !!test
22092 Ref: 2. ref-tags with identical names should all get the same index
22093 !! wikitext
22094 A <ref name="x">foo</ref>
22095 B <ref name="x" />
22096 <references />
22097 !! html/parsoid
22098 <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>
22099 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>
22100 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22101 <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>
22102 </ol>
22103 !!end
22104
22105 !!test
22106 Ref: 3. spaces in ref-names should be ignored
22107 !! wikitext
22108 A <ref name="x">foo</ref>
22109 B <ref name=" x " />
22110 C <ref name= x />
22111 <references />
22112 !! html/parsoid
22113 <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>
22114 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>
22115 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>
22116 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22117 <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>
22118 </ol>
22119 !!end
22120
22121 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22122 !!test
22123 Ref: 4. 'constructor' should be accepted as a valid ref-name
22124 !! wikitext
22125 A <ref name="constructor">foo</ref>
22126 <references />
22127 !! html/parsoid
22128 <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>
22129 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22130 <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>
22131 </ol>
22132 !!end
22133
22134 !!test
22135 Ref: 5. body should accept generic wikitext
22136 !! wikitext
22137 A <ref>
22138 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22139 </ref>
22140
22141 <references />
22142 !! html/parsoid
22143 <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>
22144
22145 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22146 <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>
22147 </span></li>
22148 </ol>
22149 !!end
22150
22151 !!test
22152 Ref: 6. indent-pres should not be output in ref-body
22153 !! wikitext
22154 A <ref>
22155 foo
22156 bar
22157 baz
22158 </ref>
22159
22160 <references />
22161 !! html/parsoid
22162 <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>
22163
22164 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22165 <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
22166 bar
22167 baz
22168 </span></li>
22169 </ol>
22170 !!end
22171
22172 !!test
22173 Ref: 7. No p-wrapping in ref-body
22174 !! wikitext
22175 A <ref>
22176 foo
22177
22178 bar
22179
22180
22181 baz
22182
22183
22184
22185 booz
22186 </ref>
22187
22188 <references />
22189 !! html/parsoid
22190 <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>
22191
22192 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22193 <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
22194
22195 bar
22196
22197
22198 baz
22199
22200
22201
22202 booz
22203 </span></li>
22204 </ol>
22205 !!end
22206
22207 !!test
22208 Ref: 8. transclusion wikitext has lower precedence
22209 !! wikitext
22210 A <ref> foo {{echo|</ref> B C}}
22211
22212 <references />
22213 !! html/parsoid
22214 <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>
22215 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22216 <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>
22217 </ol>
22218 !!end
22219
22220 !!test
22221 Ref: 9. unclosed comments should not leak out of ref-body
22222 !! wikitext
22223 A <ref> foo <!--</ref> B C
22224 <references />
22225 !! html/parsoid
22226 <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>
22227 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22228 <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>
22229 </ol>
22230 !!end
22231
22232 !!test
22233 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22234 !! wikitext
22235 A <ref> <b> foo </ref> B C
22236
22237 <references />
22238 !! html/parsoid
22239 <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>
22240
22241
22242 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22243 <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>
22244 </ol>
22245 !!end
22246
22247 !!test
22248 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22249 !! wikitext
22250 A <ref>foo</ref> B
22251 C <ref>bar</ref> D
22252 <references />
22253 !! html/parsoid
22254 <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
22255 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>
22256 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22257 <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>
22258 <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>
22259 </ol>
22260 !!end
22261
22262 !!test
22263 Ref: 12. ref-tags act as trailing newline migration barrier
22264 !! wikitext
22265 <!--the newline at the end of this line moves out of the p tag-->a
22266
22267 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22268 <ref />
22269
22270 c
22271 <references />
22272 !! html/parsoid
22273 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22274
22275
22276 <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>
22277 <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>
22278
22279 <p>c</p>
22280 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22281 <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>
22282 <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>
22283 !!end
22284
22285 !!test
22286 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22287 !! wikitext
22288 <ref>foo</ref> A
22289 <ref>bar
22290 </ref> B
22291 <references />
22292 !! html/parsoid
22293 <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
22294 <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>
22295 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22296 <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>
22297 <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
22298 </span></li>
22299 </ol>
22300 !!end
22301
22302 !!test
22303 Ref: 14. A nested ref-tag should be emitted as plain text
22304 !! wikitext
22305 <ref>foo <ref>bar</ref> baz</ref>
22306
22307 <references />
22308 !! html/parsoid
22309 <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>
22310 </p>
22311 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22312 <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>
22313 </ol>
22314 !!end
22315
22316 !!test
22317 Ref: 15. ref-tags with identical names should get identical indexes
22318 !! wikitext
22319 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22320 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22321
22322 <references />
22323 !! html/parsoid
22324 <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>
22325 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>
22326
22327 <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>
22328 </ol>
22329 !!end
22330
22331 ## We don't bother wt2wt-ing non-standard whitespace
22332 !!test
22333 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22334 !!options
22335 parsoid=wt2html
22336 !! wikitext
22337 A <ref >foo</ref >
22338
22339 <references />
22340 !! html/parsoid
22341 <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>
22342 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22343 <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>
22344 !!end
22345
22346 !!test
22347 Ref: 17. Generate valid HTML5 id/about attributes
22348 !!wikitext
22349 <ref name="a b">foo</ref>
22350
22351 <references />
22352 !!html/parsoid
22353 <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>
22354 </p>
22355
22356 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22357 <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>
22358 </ol>
22359 !!end
22360
22361 !!test
22362 Ref: 18. T58916: Extension attributes should be parsed as plain text
22363 !!wikitext
22364 <ref name="{{echo|a}}">foo</ref>
22365
22366 <references />
22367 !!html/parsoid
22368 <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>
22369 </p>
22370
22371 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22372 <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>
22373 </ol>
22374 !!end
22375
22376 !!test
22377 Ref: 19. ref-tags with identical name encodings should get identical indexes
22378 !! wikitext
22379 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22380
22381 <references />
22382 !! html/parsoid
22383 <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>
22384 </p>
22385 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22386 <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>
22387 </ol>
22388 !!end
22389
22390 !!test
22391 Ref: 20. ref-tags with identical names but different content should keep it
22392 !! wikitext
22393 A <ref name="foo">Foo one</ref>
22394 B <ref name="foo">Foo two</ref>
22395 C <ref name="foo" />
22396
22397 <references />
22398 !! html/parsoid
22399 <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>
22400 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>
22401 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>
22402
22403 <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>
22404 </ol>
22405 !!end
22406
22407 !!test
22408 References: 1. references tag without any refs should be handled properly
22409 !! wikitext
22410 <references />
22411 !! html/parsoid
22412 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22413 !!end
22414
22415 !!test
22416 References: 2. references tag with group only outputs references from that group
22417 !! wikitext
22418 A <ref group="a">foo</ref>
22419 B <ref group="b">bar</ref>
22420 C <ref>baz</ref>
22421
22422 <references group="a" />
22423 <references />
22424 <references group="b" />
22425 !! html/parsoid
22426 <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>
22427 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>
22428 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>
22429
22430 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22431 <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>
22432 </ol>
22433 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22434 <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>
22435 </ol>
22436 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22437 <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>
22438 </ol>
22439 !!end
22440
22441 !!test
22442 References: 3. ref list should be cleared after processing references
22443 !! wikitext
22444 A <ref>foo</ref>
22445
22446 <references />
22447
22448 B <ref>bar</ref>
22449
22450 <references />
22451 !! html/parsoid
22452 <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>
22453
22454 <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>
22455 </ol>
22456
22457 <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>
22458
22459 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22460 <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>
22461 </ol>
22462 !!end
22463
22464 !!test
22465 References: 4. only referenced group should be cleared after processing references
22466 !! wikitext
22467 A <ref group="a">afoo</ref>
22468 B <ref>bfoo</ref>
22469
22470 <references group="a" />
22471
22472 C <ref>cfoo</ref>
22473
22474 <references />
22475 !! html/parsoid
22476 <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>
22477 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>
22478
22479 <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>
22480 </ol>
22481
22482 <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>
22483
22484 <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>
22485 </ol>
22486 !!end
22487
22488 ## Don't expect this to rt since we're dropping content
22489 !! test
22490 References: 5. ref tags in references should be processed while ignoring all other content
22491 !! options
22492 parsoid=wt2html,html2html
22493 !! wikitext
22494 A <ref name="a" />
22495 B <ref name="b">bar</ref>
22496
22497 <references>
22498 <ref name="a">foo</ref>
22499 This should just get lost.
22500 </references>
22501 !! html/parsoid
22502 <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>
22503 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>
22504
22505
22506 <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>
22507 </ol>
22508 !! end
22509
22510 !! test
22511 References: 6. <references /> from a transclusion
22512 !! wikitext
22513 <ref>Foo</ref> {{echo|<references />}}
22514 !! html/parsoid
22515 <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>
22516 </ol>
22517 !! end
22518
22519 !! test
22520 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22521 !! wikitext
22522 A <ref>foo bar for a</ref>
22523 B <ref group="X" name="b" />
22524
22525 <references />
22526
22527 <references group="X">
22528 <ref name="b">foo</ref>
22529 </references>
22530 !! html/parsoid
22531 <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>
22532 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>
22533 </p>
22534
22535 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22536 <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>
22537 </ol>
22538
22539 <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"}}'>
22540 <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>
22541 </ol>
22542 !! end
22543
22544 !! test
22545 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22546 !! wikitext
22547 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22548 <references />
22549 !! html/parsoid
22550 <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>
22551 <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>
22552 </ol>
22553 !!end
22554
22555 # This test only works in wt2html now as the <references /> are always generated
22556 # unless selser is active. Once T72722 is fixed, we should add a changes test
22557 # here to ensure that unrelated changes don't add the new <references />
22558 # when selser is active.
22559 !! test
22560 References: 9. Generate missing references list at the end
22561 !! wikitext
22562 A <ref>foo</ref>
22563 B <ref group="inexistent">bar</ref>
22564 !! html/parsoid
22565 <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>
22566 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22567 <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>
22568 </ol>
22569 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22570 <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>
22571 </ol>
22572 !! end
22573
22574 !! test
22575 References: 10. New <references/> shouldn't be added for unrelated edits.
22576 !! options
22577 parsoid={
22578 "modes": ["selser"],
22579 "changes": [["#x", "remove"]],
22580 "selser": "noauto"
22581 }
22582 !! wikitext
22583 Unrelated text<span id="x"> that's going to disappear</span>.
22584 A <ref>foo</ref>
22585 !! wikitext/edited
22586 Unrelated text.
22587 A <ref>foo</ref>
22588 !!end
22589
22590 !! test
22591 Entities in ref name
22592 !! wikitext
22593 <ref name="test &amp; me">hi</ref>
22594 <references />
22595 !! html/parsoid
22596 <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>
22597 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22598 <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>
22599 </ol>
22600 !! end
22601
22602 ## The output here may look funny, but it's what the php parser will do. The
22603 ## unclosed references tag becomes escaped text, and then a new references
22604 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22605 ## nowiki tags, and the auto-generated references tag is only dropped in
22606 ## rtTestMode.
22607 !! test
22608 Generate references for unclosed references tag
22609 !! options
22610 parsoid=wt2html
22611 !! wikitext
22612 a<ref>foo</ref>
22613
22614 <references>
22615 !! html/parsoid
22616 <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>
22617
22618 <p>&lt;references></p>
22619 <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>
22620 !! end
22621
22622 !! test
22623 New reference serializes on its own line
22624 !! options
22625 parsoid=wt2wt,html2wt
22626 !! wikitext
22627 foo
22628 <references />
22629 !! html/parsoid
22630 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22631 !! end
22632
22633 #### ----------------------------------------------------------------
22634 #### Parsoid-only testing of Parsoid's impl of LST
22635 #### Not implemented yet, see
22636 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22637 #### ----------------------------------------------------------------
22638
22639 !! test
22640 LST Sections: 1. Simple section start and end
22641 !! options
22642 parsoid={ "suppressErrors": true }
22643 !! wikitext
22644 <section begin="2011-05-16" />
22645 <section end="2014-04-10 (MW 1.23wmf22)" />
22646 !! html/parsoid
22647 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22648 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22649 !! end
22650
22651 #--------- Test stripping of empty nodes in template content ----------
22652 !!test
22653 Empty LI and TR nodes should be stripped from template content
22654 !!wikitext
22655 {{EmptyLITest}}
22656 {{EmptyTRTest}}
22657 !!html/parsoid
22658 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22659 <li>a</li>
22660 <li>b</li>
22661 </ul>
22662 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22663 <tbody>
22664 <tr>
22665 <td>foo</td>
22666 </tr>
22667 <tr>
22668 <td>bar</td>
22669 </tr>
22670 </tbody>
22671 </table>
22672 !!end
22673
22674 !!test
22675 Empty LI and TR nodes should not be stripped from top-level content
22676 !!wikitext
22677 * a
22678 *
22679 * b
22680 {|
22681 |-
22682 |-
22683 |foo
22684 |}
22685 !!html/parsoid
22686 <ul>
22687 <li> a</li>
22688 <li></li>
22689 <li> b</li>
22690 </ul>
22691 <table>
22692 <tbody>
22693 <tr></tr>
22694 <tr>
22695 <td>foo</td>
22696 </tr>
22697 </tbody>
22698 </table>
22699 !!end
22700
22701 !!test
22702 Empty TR nodes should not be stripped if they have any attributes set
22703 !!wikitext
22704 {{EmptyTRWithHTMLAttrTest}}
22705 !!html/parsoid
22706 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22707 <tr align="center"></tr>
22708 <tr><td>foo</td></tr>
22709 <tr align="center"></tr>
22710 <tr><td>bar</td></tr>
22711 </table>
22712 !!end
22713
22714 #### ----------------------------------------------------------------
22715 #### The following section of tests are primarily to test
22716 #### wikitext escaping capabilities of Parsoid. Given that
22717 #### escaping can be done any number of ways, the wikitext (input)
22718 #### is always adjusted to reflect how Parsoid adds nowiki
22719 #### escape tags.
22720 ####
22721 #### We are marking several tests as parsoid-only since the
22722 #### HTML in the result section is different from what the
22723 #### PHP parser generates for it.
22724 #### ----------------------------------------------------------------
22725
22726
22727 #### --------------- Headings ---------------
22728 #### 0. Unnested
22729 #### 1. Nested inside html <h1>=foo=</h1>
22730 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22731 #### 3. Nested inside html with wikitext split by html tags
22732 #### 4. No escape needed
22733 #### 5. Empty headings <h1></h1>
22734 #### 6. Heading chars in SOL context
22735 #### ----------------------------------------
22736 !! test
22737 Headings: 0. Unnested
22738 !! options
22739 parsoid=html2wt
22740 !! html/parsoid
22741 <p>=foo=</p>
22742
22743 <p> =foo=
22744 <!--cmt-->
22745 =foo=</p>
22746
22747 <p>=foo<i>a</i>=</p>
22748 !! wikitext
22749 <nowiki>=foo=</nowiki>
22750
22751 <nowiki> </nowiki>=foo=
22752 <!--cmt-->
22753 <nowiki>=foo=</nowiki>
22754
22755 =foo''a''<nowiki>=</nowiki>
22756 !!end
22757
22758 # New headings and existing headings are handled differently
22759 !! test
22760 Headings: 1. Nested inside html
22761 !! options
22762 parsoid=html2wt
22763 !! html/parsoid
22764 <h1>=foo=</h1>
22765 <h2>=foo=</h2>
22766 <h3>=foo=</h3>
22767
22768 <h1 data-parsoid=''>=foo=</h1>
22769 <h2 data-parsoid=''>=foo=</h2>
22770 <h3 data-parsoid=''>=foo=</h3>
22771 <h4 data-parsoid=''>=foo=</h4>
22772 <h5 data-parsoid=''>=foo=</h5>
22773 <h6 data-parsoid=''>=foo=</h6>
22774 !! wikitext
22775 = =foo= =
22776
22777 == =foo= ==
22778
22779 === =foo= ===
22780
22781 =<nowiki>=foo=</nowiki>=
22782 ==<nowiki>=foo=</nowiki>==
22783 ===<nowiki>=foo=</nowiki>===
22784 ====<nowiki>=foo=</nowiki>====
22785 =====<nowiki>=foo=</nowiki>=====
22786 ======<nowiki>=foo=</nowiki>======
22787
22788 !!end
22789
22790 !! test
22791 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22792 !! options
22793 parsoid=html2wt
22794 !! html/parsoid
22795 <h1>foo</h1>*bar
22796 <h1>foo</h1>=bar
22797 <h1>foo</h1>=bar=
22798 !! wikitext
22799 = foo =
22800 <nowiki>*</nowiki>bar
22801
22802 = foo =
22803 =bar
22804
22805 = foo =
22806 <nowiki>=bar=</nowiki>
22807 !!end
22808
22809 !! test
22810 Headings: 3. Nested inside html with wikitext split by html tags
22811 !! options
22812 parsoid=html2wt
22813 !! html/parsoid
22814 <h1>=<b>bold</b>foo=</h1>
22815 !! wikitext
22816 = ='''bold'''foo= =
22817 !!end
22818
22819 !! test
22820 Headings: 4a. No escaping needed (testing just h1 and h2)
22821 !! options
22822 parsoid=html2wt
22823 !! html/parsoid
22824 <h1>=foo</h1>
22825 <h1>foo=</h1>
22826 <h1> =foo= </h1>
22827 <h1>=foo= bar</h1>
22828 <h2>=foo</h2>
22829 <h2>foo=</h2>
22830 <h1>=</h1>
22831 <h1><i>=</i>foo=</h1>
22832 !! wikitext
22833 = =foo =
22834
22835 = foo= =
22836
22837 = =foo= =
22838
22839 = =foo= bar =
22840
22841 == =foo ==
22842
22843 == foo= ==
22844
22845 = = =
22846
22847 = ''=''foo= =
22848 !!end
22849
22850 !! test
22851 Headings: 4b. No escaping needed (inside p-tags)
22852 !! options
22853 parsoid=html2wt
22854 !! html/parsoid
22855 <p>===
22856 =foo= x
22857 =foo= <s></s>
22858 </p>
22859 !! wikitext
22860 ===
22861 =foo= x
22862 =foo= <s></s>
22863 !!end
22864
22865 !! test
22866 Headings: 5. Empty headings
22867 !! options
22868 parsoid=html2wt
22869 !! html/parsoid
22870 <h1 data-parsoid='{}'></h1>
22871
22872 <h2 data-parsoid='{}'></h2>
22873
22874 <h3 data-parsoid='{}'></h3>
22875
22876 <h4 data-parsoid='{}'></h4>
22877
22878 <h5 data-parsoid='{}'></h5>
22879
22880 <h6 data-parsoid='{}'></h6>
22881 !! wikitext
22882 =<nowiki/>=
22883
22884 ==<nowiki/>==
22885
22886 ===<nowiki/>===
22887
22888 ====<nowiki/>====
22889
22890 =====<nowiki/>=====
22891
22892 ======<nowiki/>======
22893 !!end
22894
22895 !! test
22896 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22897 !! options
22898 parsoid=html2wt
22899 !! html/parsoid
22900 <p>=a=</p>
22901
22902 <p>=a=</p>
22903
22904 <p>=a=</p>
22905 !! wikitext
22906 <nowiki>=a=</nowiki>
22907
22908 <nowiki>=a=</nowiki>
22909
22910 <nowiki>=a=</nowiki>
22911 !!end
22912
22913 !! test
22914 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22915 !! options
22916 parsoid=html2wt
22917 !! html/parsoid
22918 <p>=a=
22919 b</p>
22920
22921 <p>=a=
22922 b</p>
22923
22924 <p>=a=
22925 b</p>
22926 !! wikitext
22927 <nowiki>=a=</nowiki>
22928 b
22929
22930 <nowiki>=a=</nowiki>
22931 b
22932
22933 <nowiki>=a=</nowiki>
22934 b
22935 !!end
22936
22937 !! test
22938 Headings: 6c. Heading chars in SOL context (leading newline break)
22939 !! options
22940 parsoid=html2wt
22941 !! html/parsoid
22942 <p>a
22943 =b=</p>
22944 !! wikitext
22945 a
22946 <nowiki>=b=</nowiki>
22947 !!end
22948
22949 !! test
22950 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22951 !! options
22952 parsoid=html2wt
22953 !! html/parsoid
22954 <!--c0--><p>=a=</p>
22955
22956 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22957 !! wikitext
22958 <!--c0--><nowiki>=a=</nowiki>
22959
22960 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22961 !!end
22962
22963 !! test
22964 Headings: 6d. Heading chars in SOL context (No escaping needed)
22965 !! options
22966 parsoid=html2wt
22967 !! html/parsoid
22968 =a=<div>b</div>
22969 !! wikitext
22970 =a=<div>b</div>
22971 !!end
22972
22973 !! test
22974 Headings: 7. Insert a newline between new content and headings
22975 !! options
22976 parsoid=html2wt
22977 !! html/parsoid
22978 <h2>NEW</h2>
22979 <p>new</p>
22980 <h2 data-parsoid='{}'>A</h2>
22981 <p data-parsoid='{}'>a</p>
22982 !! wikitext
22983 == NEW ==
22984 new
22985
22986 ==A==
22987 a
22988
22989 !! end
22990
22991 #### --------------- Lists ---------------
22992 #### 0. Outside nests (*foo, etc.)
22993 #### 1. Nested inside html <ul><li>*foo</li></ul>
22994 #### 2. Inside definition lists
22995 #### 3. Only bullets at start should be escaped
22996 #### 4. No escapes needed
22997 #### 5. No unnecessary escapes
22998 #### 6. Escape bullets in SOL position
22999 #### 7. Escape bullets in a multi-line context
23000 #### ----------------------------------------
23001
23002 !! test
23003 Lists: 0. Outside nests
23004 !! options
23005 parsoid=html2wt
23006 !! html/parsoid
23007 <p>*foo</p>
23008
23009 <p>#foo</p>
23010
23011 <p>;Foo:bar</p>
23012 !! wikitext
23013 <nowiki>*</nowiki>foo
23014
23015 <nowiki>#</nowiki>foo
23016
23017 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23018 !!end
23019
23020 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23021 ## to test wikitext escaping, and insignificant whitespace diffs
23022 ## cause PHP parser tests to barf
23023 !! test
23024 Lists: 1. Nested inside html (No unnecessary escapes)
23025 !! options
23026 parsoid=html2wt
23027 !! html/parsoid
23028 <ul>
23029 <li>*foo</li>
23030 <li>#foo</li>
23031 <li>:foo</li>
23032 <li>;foo</li>
23033 <li data-parsoid='{}'>*foo</li>
23034 <li data-parsoid='{}'>#foo</li>
23035 <li data-parsoid='{}'>:foo</li>
23036 <li data-parsoid='{}'>;foo</li>
23037 </ul>
23038
23039 <ol>
23040 <li>*foo</li>
23041 <li>#foo</li>
23042 <li>:foo</li>
23043 <li>;foo</li>
23044 <li data-parsoid='{}'>*foo</li>
23045 <li data-parsoid='{}'>#foo</li>
23046 <li data-parsoid='{}'>:foo</li>
23047 <li data-parsoid='{}'>;foo</li>
23048 </ol>
23049 !! wikitext
23050 * *foo
23051 * #foo
23052 * :foo
23053 * ;foo
23054 *<nowiki>*foo</nowiki>
23055 *<nowiki>#foo</nowiki>
23056 *<nowiki>:foo</nowiki>
23057 *<nowiki>;foo</nowiki>
23058
23059 # *foo
23060 # #foo
23061 # :foo
23062 # ;foo
23063 #<nowiki>*foo</nowiki>
23064 #<nowiki>#foo</nowiki>
23065 #<nowiki>:foo</nowiki>
23066 #<nowiki>;foo</nowiki>
23067 !!end
23068
23069 !! test
23070 Lists: 2. Inside definition lists
23071 !! options
23072 parsoid=html2wt
23073 !! html/parsoid
23074 <dl><dt>;foo</dt></dl>
23075 <dl><dt>:foo</dt></dl>
23076 <dl><dt>:foo</dt>
23077 <dd>bar</dd></dl>
23078 <dl><dd>:foo</dd></dl>
23079 !! wikitext
23080 ; ;foo
23081
23082 ; <nowiki>:foo</nowiki>
23083
23084 ; <nowiki>:foo</nowiki>
23085 : bar
23086
23087 : :foo
23088 !!end
23089
23090 !! test
23091 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23092 !! options
23093 parsoid=html2wt
23094 !! html/parsoid
23095 <ul>
23096 <li>*foo*bar</li>
23097 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23098 </ul>
23099 !! wikitext
23100 * *foo*bar
23101 *<nowiki>*foo</nowiki>''it''*bar
23102 !!end
23103
23104 !! test
23105 Lists: 4. No escapes needed
23106 !! options
23107 parsoid=html2wt
23108 !! html/parsoid
23109 <ul>
23110 <li>foo*bar
23111 </li>
23112 </ul>
23113 <ul>
23114 <li><i>foo</i>*bar
23115 </li>
23116 </ul>
23117 <ul>
23118 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23119 </li>
23120 </ul>
23121 <ul>
23122 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23123 </li>
23124 </ul>
23125 !! wikitext
23126 *foo*bar
23127
23128 *''foo''*bar
23129
23130 *[[Foo]]: bar
23131
23132 *[[Foo]]*bar
23133 !!end
23134
23135 !! test
23136 Lists: 5. No unnecessary escapes
23137 !! options
23138 parsoid=html2wt
23139 !! html/parsoid
23140 <ul><li> bar <span>[[foo]]</span></li></ul>
23141 <ul><li> =bar <span>[[foo]]</span></li></ul>
23142 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23143 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23144 <ul><li> =bar <span>foo]]</span>=</li></ul>
23145 <ul><li> <s></s>: a</li></ul>
23146 <ul><li> <i>* foo</i></li></ul>
23147
23148 !! wikitext
23149 * bar <span><nowiki>[[foo]]</nowiki></span>
23150
23151 * =bar <span><nowiki>[[foo]]</nowiki></span>
23152
23153 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23154
23155 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23156
23157 * =bar <span>foo]]</span>=
23158
23159 * <s></s>: a
23160
23161 * ''* foo''
23162 !!end
23163
23164 !! test
23165 Lists: 6. Escape bullets in SOL position
23166 !! options
23167 parsoid=html2wt
23168 !! html/parsoid
23169 <p><!--cmt-->*foo</p>
23170 !! wikitext
23171 <!--cmt--><nowiki>*</nowiki>foo
23172 !!end
23173
23174 !! test
23175 Lists: 7. Escape bullets in a multi-line context
23176 !! options
23177 parsoid=html2wt
23178 !! html/parsoid
23179 <p>a
23180 *b
23181 </p>
23182 !! wikitext
23183 a
23184 <nowiki>*</nowiki>b
23185 !!end
23186
23187 !! test
23188 Lists: 8. Escape colons only if not present in tags
23189 !! options
23190 parsoid=html2wt
23191 !! html/parsoid
23192 <dl><dt>a:b<i>c:d</i></dt></dl>
23193 !! wikitext
23194 ; <nowiki>a:b</nowiki>''c:d''
23195 !! end
23196
23197 #### --------------- HRs ---------------
23198 #### 1. Single line
23199 #### -----------------------------------
23200
23201 !! test
23202 HRs: 1. Single line
23203 !! options
23204 parsoid=html2wt
23205 !! html/parsoid
23206 <hr />----
23207 <hr />=foo=
23208 <hr />*foo
23209 !! wikitext
23210 ----<nowiki>----</nowiki>
23211 ----=foo=
23212 ----*foo
23213 !! end
23214
23215 #### --------------- Tables ---------------
23216 #### 1a. Simple example
23217 #### 1b. No escaping needed (!foo)
23218 #### 1c. No escaping needed (|foo)
23219 #### 1d. No escaping needed (|}foo)
23220 ####
23221 #### 2a. Nested in td (<td>foo|bar</td>)
23222 #### 2b. Nested in td (<td>foo||bar</td>)
23223 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23224 ####
23225 #### 3a. Nested in th (<th>foo!bar</th>)
23226 #### 3b. Nested in th (<th>foo!!bar</th>)
23227 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23228 ####
23229 #### 4a. Escape -
23230 #### 4b. Escape +
23231 #### 4c. No escaping needed
23232 #### --------------------------------------
23233
23234 !! test
23235 Tables: 1a. Simple example
23236 !! options
23237 parsoid=html2wt
23238 !! html/parsoid
23239 <p>{|
23240 |}
23241 </p>
23242 !! wikitext
23243 <nowiki>{|</nowiki>
23244 |}
23245 !! end
23246
23247 !! test
23248 Tables: 1b. No escaping needed
23249 !! options
23250 parsoid=html2wt
23251 !! html/parsoid
23252 <p>!foo
23253 </p>
23254 !! wikitext
23255 !foo
23256 !! end
23257
23258 !! test
23259 Tables: 1c. No escaping needed
23260 !! options
23261 parsoid=html2wt
23262 !! html/parsoid
23263 <p>|foo
23264 </p>
23265 !! wikitext
23266 |foo
23267 !! end
23268
23269 !! test
23270 Tables: 1d. No escaping needed
23271 !! options
23272 parsoid=html2wt
23273 !! html/parsoid
23274 <p>|}foo
23275 </p>
23276 !! wikitext
23277 |}foo
23278 !! end
23279
23280 !! test
23281 Tables: 2a. Nested in td
23282 !! options
23283 parsoid=html2wt
23284 !! html/parsoid
23285 <table><tbody><tr>
23286 <td>foo|bar</td></tr>
23287 <tr><td>x<div>a|b</div></td>
23288 </tbody></table>
23289 !! wikitext
23290 {|
23291 |<nowiki>foo|bar</nowiki>
23292 |-
23293 |x<div><nowiki>a|b</nowiki></div>
23294 |}
23295 !! html/php+tidy
23296 <table>
23297 <tr>
23298 <td>foo|bar</td>
23299 </tr>
23300 <tr>
23301 <td>x
23302 <div>a|b</div>
23303 </td>
23304 </tr>
23305 </table>
23306 !! end
23307
23308 !! test
23309 Tables: 2b. Nested in td
23310 !! options
23311 parsoid=html2wt
23312 !! html/parsoid
23313 <table><tbody><tr>
23314 <td>foo||bar</td>
23315 <td>a<i>b||c</i></td>
23316 <td>a<i><div>b||c</div></i></td>
23317 </tr></tbody></table>
23318 !! wikitext
23319 {|
23320 |<nowiki>foo||bar</nowiki>
23321 |a''<nowiki>b||c</nowiki>''
23322 |a''<div><nowiki>b||c</nowiki></div>''
23323 |}
23324 !! html/php
23325 <table>
23326 <tr>
23327 <td>foo||bar
23328 </td>
23329 <td>a<i>b||c</i>
23330 </td>
23331 <td>a<i><div>b||c</div></i>
23332 </td></tr></table>
23333
23334 !! end
23335
23336 !! test
23337 Tables: 2c. Nested in td -- no escaping needed
23338 !! options
23339 parsoid=html2wt
23340 !! html/*
23341 <table>
23342 <tr>
23343 <td>foo!!bar
23344 </td></tr></table>
23345
23346 !! wikitext
23347 {|
23348 |foo!!bar
23349 |}
23350 !! end
23351
23352 !! test
23353 Tables: 3a. Nested in th
23354 !! options
23355 parsoid=html2wt
23356 !! html/*
23357 <table>
23358 <tr>
23359 <th>foo!bar
23360 </th></tr></table>
23361
23362 !! wikitext
23363 {|
23364 !foo!bar
23365 |}
23366 !! end
23367
23368 !! test
23369 Tables: 3b. Nested in th
23370 !! options
23371 parsoid=html2wt
23372 !! html/parsoid
23373 <table><tbody>
23374 <tr><th>foo!!bar</th>
23375 <th><i>foo|bar</i></th>
23376 <th><i>foo!!bar</i></th>
23377 <th><i><span>foo!!bar</span></i></th>
23378 </tr></tbody></table>
23379 !! wikitext
23380 {|
23381 !<nowiki>foo!!bar</nowiki>
23382 !''<nowiki>foo|bar</nowiki>''
23383 !''<nowiki>foo!!bar</nowiki>''
23384 !''<span><nowiki>foo!!bar</nowiki></span>''
23385 |}
23386 !! html/php
23387 <table>
23388 <tr>
23389 <th>foo!!bar
23390 </th>
23391 <th><i>foo|bar</i>
23392 </th>
23393 <th><i>foo!!bar</i>
23394 </th>
23395 <th><i><span>foo!!bar</span></i>
23396 </th></tr></table>
23397
23398 !! end
23399
23400 !! test
23401 Tables: 3c. Nested in th
23402 !! options
23403 parsoid=html2wt
23404 !! html/parsoid
23405 <table><tbody>
23406 <tr><th>foo||bar</th>
23407 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23408 </tr></tbody></table>
23409 !! wikitext
23410 {|
23411 !<nowiki>foo||bar</nowiki>
23412 !<nowiki>foo||bar</nowiki>
23413 |}
23414 !! html/php
23415 <table>
23416 <tr>
23417 <th>foo||bar
23418 </th>
23419 <th>foo||bar
23420 </th></tr></table>
23421
23422 !! end
23423
23424 !! test
23425 Tables: 4a. Escape -
23426 !! options
23427 parsoid=html2wt
23428 !! html/*
23429 <table>
23430 <tr>
23431 <th>-bar
23432 </th></tr>
23433 <tr>
23434 <td>-bar
23435 </td></tr></table>
23436
23437 !! wikitext
23438 {|
23439 !-bar
23440 |-
23441 |<nowiki>-bar</nowiki>
23442 |}
23443 !! end
23444
23445 !! test
23446 Tables: 4b. Escape +
23447 !! options
23448 parsoid=html2wt
23449 !! html/*
23450 <table>
23451 <tr>
23452 <th>+bar
23453 </th></tr>
23454 <tr>
23455 <td>+bar
23456 </td></tr></table>
23457
23458 !! wikitext
23459 {|
23460 !+bar
23461 |-
23462 |<nowiki>+bar</nowiki>
23463 |}
23464 !! end
23465
23466 !! test
23467 Tables: 4c. No escaping needed
23468 !! options
23469 parsoid=html2wt
23470 !! html/parsoid
23471 <table><tbody>
23472 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23473 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23474 <tr><td>foo
23475 <p>bar|baz
23476 +bar
23477 -bar</p></td></tr>
23478 <tr><td>x
23479 <div>a|b</div></td>
23480 </tbody></table>
23481 !! wikitext
23482 {|
23483 |foo-bar
23484 |foo+bar
23485 |-
23486 |''foo''-bar
23487 |''foo''+bar
23488 |-
23489 |foo
23490 bar|baz
23491 +bar
23492 -bar
23493 |-
23494 |x
23495 <div>a|b</div>
23496 |}
23497 !! html/php
23498 <table>
23499 <tr>
23500 <td>foo-bar
23501 </td>
23502 <td>foo+bar
23503 </td></tr>
23504 <tr>
23505 <td><i>foo</i>-bar
23506 </td>
23507 <td><i>foo</i>+bar
23508 </td></tr>
23509 <tr>
23510 <td>foo
23511 <p>bar|baz
23512 +bar
23513 -bar
23514 </p>
23515 </td></tr>
23516 <tr>
23517 <td>x
23518 <div>a|b</div>
23519 </td></tr></table>
23520
23521 !! end
23522
23523 !! test
23524 Tables: 4d. No escaping needed
23525 !! options
23526 parsoid=html2wt
23527 !! html/parsoid
23528 <table>
23529 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23530 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23531 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23532 </tbody></table>
23533 !! wikitext
23534 {|
23535 |[[Foo]]-bar
23536 ||+1
23537 ||-2
23538 |}
23539 !! html/php
23540 <table>
23541 <tr>
23542 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23543 </td>
23544 <td>+1
23545 </td>
23546 <td>-2
23547 </td></tr></table>
23548
23549 !! end
23550
23551 !! test
23552 T97430: Don't emit empty nowiki pairs around marker meta tags
23553 !! options
23554 parsoid=html2wt
23555 !! html/parsoid
23556 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23557 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23558 !! wikitext
23559 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23560 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23561 !! end
23562
23563 !! test
23564 Unclosed xmlish element in table line shouldn't eat end delimiters
23565 !! options
23566 parsoid=html2wt
23567 !! html/parsoid
23568 <table>
23569 <tbody><tr><td> &lt;foo</td>
23570 <td> bar></td></tr>
23571 </tbody></table>
23572 !! wikitext
23573 {|
23574 | <foo
23575 | bar>
23576 |}
23577 !! html/php
23578 <table>
23579 <tr>
23580 <td> &lt;foo
23581 </td>
23582 <td> bar&gt;
23583 </td></tr></table>
23584
23585 !! end
23586
23587 #### --------------- Links ----------------
23588 #### 1. Quote marks in link text
23589 #### 2. Wikilinks: Escapes needed
23590 #### 3. Wikilinks: No escapes needed
23591 #### 4. Extlinks: Escapes needed
23592 #### 5. Extlinks: No escapes needed
23593 #### --------------------------------------
23594 !! test
23595 Links 1. WikiLinks: No escapes needed
23596 !! options
23597 parsoid=html2wt
23598 !! html/parsoid
23599 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23600 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23601 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23602 !! wikitext
23603 [[Foo|Foo''boo'']]
23604 [[Foo|[Foobar]]]
23605 [[Foo|x [Foobar] x]]
23606 !! html/php
23607 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23608 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23609 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23610 </p>
23611 !! end
23612
23613 !! test
23614 Links 2. WikiLinks: Escapes needed
23615 !! options
23616 parsoid=html2wt
23617 !! html/parsoid
23618 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23619 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23620 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23621 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23622 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23623 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23624 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23625 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23626 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23627 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23628 !! wikitext
23629 [[Foo|<nowiki>Foobar]</nowiki>]]
23630 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23631 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23632 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23633 [[Foo|<nowiki>|Bar</nowiki>]]
23634 [[Foo|<nowiki>]]bar</nowiki>]]
23635 [[Foo|<nowiki>[[bar</nowiki>]]
23636 [[Foo|<nowiki>x [[ y</nowiki>]]
23637 [[Foo|<nowiki>x ]] y</nowiki>]]
23638 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23639 !! html/php
23640 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23641 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23642 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23643 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23644 <a href="/wiki/Foo" title="Foo">|Bar</a>
23645 <a href="/wiki/Foo" title="Foo">]]bar</a>
23646 <a href="/wiki/Foo" title="Foo">[[bar</a>
23647 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23648 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23649 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23650 </p>
23651 !! end
23652
23653 !! test
23654 Links 3. WikiLinks: No escapes needed
23655 !! options
23656 parsoid=html2wt
23657 !! html/parsoid
23658 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23659 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23660 !! wikitext
23661 [[Foo|[Foobar]]
23662 [[Foo|foo|bar]]
23663 !! html/php
23664 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23665 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23666 </p>
23667 !! end
23668
23669 !! test
23670 Links 4. ExtLinks: Escapes needed
23671 !! options
23672 parsoid=html2wt
23673 !! html/parsoid
23674 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23675 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23676 <p>[http://google.com]</p>
23677 <p>[http://google.com google]</p>
23678 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23679 <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>
23680 !! wikitext
23681 [http://google.com <nowiki>[google]</nowiki>]
23682 [http://google.com <nowiki>google]</nowiki>]
23683
23684 <nowiki>[http://google.com]</nowiki>
23685
23686 <nowiki>[http://google.com google]</nowiki>
23687
23688 [http://google.com<nowiki>]</nowiki>
23689
23690 [{{echo|http://google.com}}<nowiki>]</nowiki>
23691 !! html/php
23692 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23693 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23694 </p><p>[http://google.com]
23695 </p><p>[http://google.com google]
23696 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23697 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23698 </p>
23699 !! end
23700
23701 !! test
23702 Links 5. ExtLinks: No escapes needed
23703 !! options
23704 parsoid=html2wt
23705 !! html/parsoid
23706 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23707 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23708 !! wikitext
23709 [http://google.com [google]
23710
23711 [[http://google.com]]
23712 !! html/php
23713 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23714 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23715 </p>
23716 !! end
23717
23718 !! test
23719 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23720 !! options
23721 parsoid=html2wt
23722 !! html/parsoid
23723 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23724 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23725 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23726 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23727 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23728 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23729 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23730 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23731 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23732 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23733 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23734 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23735 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23736 </p>
23737 !! wikitext
23738 x<nowiki/>http://example.com<nowiki/>y
23739 http://example.com<nowiki/>?x
23740 http://example.com<nowiki/>&x
23741 http://example.com<nowiki/>'x
23742 http://example.com<nowiki/>,x
23743 http://example.com<nowiki/>.x
23744 http://example.com<nowiki/>;x
23745 http://example.com<nowiki/>:x
23746 http://example.com<nowiki/>;x
23747 http://example.com<nowiki/>!x
23748 http://example.com<nowiki/>=x
23749 http://example.com<nowiki/>(x)
23750 http://example.com(x<nowiki/>)
23751 !! end
23752
23753 !! test
23754 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23755 !! options
23756 parsoid=html2wt
23757 !! html/parsoid
23758 <p>x
23759 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23760 y
23761 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23762 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23763 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23764 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23765 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23766 </p>
23767 !! wikitext
23768 x
23769 http://example.com
23770 y
23771 "http://example.com"
23772 (http://example.com)
23773 (http://example.com) foo
23774 http://example.com,
23775 http://example.com, foo
23776 !! html/php
23777 <p>x
23778 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23779 y
23780 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23781 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23782 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23783 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23784 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23785 </p>
23786 !! end
23787
23788 !! test
23789 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23790 !! options
23791 parsoid=html2wt
23792 !! html/parsoid
23793 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23794 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23795 !! wikitext
23796 http://example.com.,;:!?\
23797 -http://example.com:
23798 !! html/php
23799 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23800 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23801 </p>
23802 !! end
23803
23804 !! test
23805 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23806 !! options
23807 parsoid=html2wt
23808 !! html/parsoid
23809 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23810 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23811 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23812 !! wikitext
23813 RFC 123<nowiki/>4
23814 RFC 123<nowiki/>y
23815 X<nowiki/>RFC 123<nowiki/>y
23816 !! end
23817
23818 !! test
23819 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23820 !! options
23821 parsoid=html2wt
23822 !! html/parsoid
23823 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23824 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23825 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23826 </p>
23827 !! wikitext
23828 RFC 123?foo
23829 RFC 123&foo
23830 -RFC 123-
23831 !! html/php
23832 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23833 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23834 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23835 </p>
23836 !! end
23837
23838 !! test
23839 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23840 !! options
23841 parsoid=html2wt
23842 !! html/parsoid
23843 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23844 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23845 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23846 !! wikitext
23847 PMID 123<nowiki/>4
23848 PMID 123<nowiki/>y
23849 X<nowiki/>PMID 123<nowiki/>y
23850 !! end
23851
23852 !! test
23853 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23854 !! options
23855 parsoid=html2wt
23856 !! html/parsoid
23857 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23858 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23859 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23860 </p>
23861 !! wikitext
23862 PMID 123?foo
23863 PMID 123&foo
23864 -PMID 123-
23865 !! html/php
23866 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23867 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23868 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23869 </p>
23870 !! end
23871
23872 !! test
23873 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23874 !! options
23875 parsoid=html2wt
23876 !! html/parsoid
23877 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23878 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23879 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23880 </p>
23881 !! wikitext
23882 ISBN 1234567890<nowiki/>1
23883 ISBN 1234567890<nowiki/>x
23884 a<nowiki/>ISBN 1234567890<nowiki/>b
23885 !! end
23886
23887 !! test
23888 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23889 !! options
23890 parsoid=html2wt
23891 !! html/parsoid
23892 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23893 !! wikitext
23894 -ISBN 1234567890's
23895 !! html/php
23896 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23897 </p>
23898 !! end
23899
23900 !! test
23901 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23902 !! options
23903 parsoid=html2wt
23904 !! html/*
23905 <p>this is not a link: http://example.com
23906 </p>
23907 !! wikitext
23908 this is not a link: <nowiki>http://example.com</nowiki>
23909 !! end
23910
23911 !! test
23912 Links 15. Link trails can't become link prefixes.
23913 !! options
23914 language=is
23915 parsoid=html2wt
23916 !! html/parsoid
23917 <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>
23918 !! wikitext
23919 [[Söfnuður]]-[[00]]
23920 !! html/php
23921 <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>
23922 </p>
23923 !! end
23924
23925 #### --------------- Quotes ---------------
23926 #### 1. Quotes inside <b> and <i>
23927 #### 2. Link fragments separated by <i> and <b> tags
23928 #### 3. Link fragments inside <i> and <b>
23929 #### 4. No escaping needed
23930 #### --------------------------------------
23931 !! test
23932 1a. Quotes inside <b> and <i>
23933 !! options
23934 parsoid=html2wt
23935 !! html/*
23936 <p><i>'foo'</i>
23937 <i>''foo''</i>
23938 <i>'''foo'''</i>
23939 <i>foo</i>'s
23940 <b>'foo'</b>
23941 <b>''foo''</b>
23942 <b>'''foo'''</b>
23943 <b>foo'<i>bar'</i>baz</b>
23944 <b>foo</b>'s
23945 '<i>foo</i>
23946 <i>foo</i>'
23947 <i>foo'</i>'
23948 '<i>foo</i>'
23949 '<b>foo</b>
23950 <b>foo</b>'
23951 '<b>foo</b>'
23952 <i>fools'<span> errand</span></i>
23953 <i><span>fool</span>'s errand</i>
23954 '<i>foo</i> bar '<i>baz</i>
23955 a|!*#-:;+-~[]{}b'<i>x</i>
23956 </p>
23957 !! wikitext
23958 ''<nowiki/>'foo'''
23959 ''<nowiki>''foo''</nowiki>''
23960 ''<nowiki>'''foo'''</nowiki>''
23961 ''foo''<nowiki/>'s
23962 '''<nowiki/>'foo''''
23963 '''<nowiki>''foo''</nowiki>'''
23964 '''<nowiki>'''foo'''</nowiki>'''
23965 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23966 '''foo'''<nowiki/>'s
23967 '''foo''
23968 ''foo''<nowiki/>'
23969 ''foo'''<nowiki/>'
23970 '''foo''<nowiki/>'
23971 ''''foo'''
23972 '''foo'''<nowiki/>'
23973 ''''foo'''<nowiki/>'
23974 ''fools'<span> errand</span>''
23975 ''<span>fool</span>'s errand''
23976 '<nowiki/>''foo'' bar '''baz''
23977 a|!*#-:;+-~[]{}b'''x''
23978 !! end
23979
23980 !! test
23981 1b. Quotes inside <b> and <i> with other tags on same line
23982 !! options
23983 parsoid=html2wt
23984 !! html/parsoid
23985 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23986 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23987 <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>
23988 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23989 '<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>
23990 '<i>foo</i> <div title="name">test</div>
23991 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23992 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23993 <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>
23994 </ol>
23995 !! wikitext
23996 '''a'' foo ''[[bar]]''
23997 ''a''' foo ''[[bar]]''
23998 ''a''' foo '''{{echo|[[bar]]}}'''
23999 [[foo]] x'''[[bar]]''
24000 '''foo'' <ref>test</ref>
24001 '''foo'' <div title="name">test</div>
24002 '''foo'' and <br> bar
24003 <references />
24004 !! end
24005
24006 !! test
24007 2. Link fragments separated by <i> and <b> tags
24008 !! options
24009 parsoid=html2wt
24010 !! html/parsoid
24011 <p>[[<i>foo</i>hello]]</p>
24012 <p>[[<b>foo</b>hello]]</p>
24013 !! wikitext
24014 [[''foo''<nowiki>hello]]</nowiki>
24015
24016 [['''foo'''<nowiki>hello]]</nowiki>
24017 !! end
24018
24019 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24020 # this is one of the shortcomings of this format
24021 !! test
24022 3. Link fragments inside <i> and <b>
24023 !! options
24024 parsoid=html2wt
24025 !! html/parsoid
24026 <p><i>[[foo</i>]]</p>
24027 <p><b>[[foo</b>]]</p>
24028 !! wikitext
24029 ''[[foo''<nowiki>]]</nowiki>
24030
24031 '''[[foo'''<nowiki>]]</nowiki>
24032 !! end
24033
24034 !! test
24035 4. No escaping needed
24036 !! options
24037 options=html2wt
24038 !! html/parsoid
24039 <p>'<span><i>bar</i></span>'
24040 '<span><b>bar</b></span>'
24041 'a:b'foo
24042 </p>
24043 !! wikitext
24044 '<span>''bar''</span>'
24045 '<span>'''bar'''</span>'
24046 'a:b'foo
24047 !! end
24048
24049 #### ----------- Paragraphs ---------------
24050 #### 1. No unnecessary escapes
24051 #### --------------------------------------
24052
24053 !! test
24054 1. No unnecessary escapes
24055 !! options
24056 parsoid=html2wt
24057 !! html/parsoid
24058 <p>bar <span>[[foo]]</span>
24059 </p><p>=bar <span>[[foo]]</span>
24060 </p><p>[[bar <span>[[foo]]</span>
24061 </p><p>]]bar <span>[[foo]]</span>
24062 </p><p>=bar <span>foo]]</span>=
24063 </p>
24064 !! wikitext
24065 bar <span><nowiki>[[foo]]</nowiki></span>
24066
24067 =bar <span><nowiki>[[foo]]</nowiki></span>
24068
24069 [[bar <span><nowiki>[[foo]]</nowiki></span>
24070
24071 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24072
24073 =bar <span>foo]]</span><nowiki>=</nowiki>
24074 !!end
24075
24076 #### ----------------------- PRE --------------------------
24077 #### 1. Leading whitespace in SOL context should be escaped
24078 #### ------------------------------------------------------
24079 !! test
24080 1. Leading whitespace in SOL context should be escaped
24081 !! options
24082 parsoid=html2wt
24083 !! html/parsoid
24084 <p> a</p>
24085
24086 <p> a</p>
24087
24088 <p> a(tab)</p>
24089
24090 <p> a
24091 <!--cmt-->
24092 a</p>
24093
24094 <p>a
24095 b</p>
24096
24097 <p>a
24098 b</p>
24099
24100 <p>a
24101 b</p>
24102 !! wikitext
24103 <nowiki> </nowiki>a
24104
24105 <nowiki> </nowiki> a
24106
24107 a(tab)
24108
24109 <nowiki> </nowiki> a
24110 <!--cmt-->
24111 <nowiki> </nowiki>a
24112
24113 a
24114 <nowiki> </nowiki>b
24115
24116 a
24117 b
24118
24119 a
24120 b
24121 !! html/php
24122 <p> a
24123 </p><p> a
24124 </p><p> a(tab)
24125 </p><p> a
24126 a
24127 </p><p>a
24128 b
24129 </p><p>a
24130 b
24131 </p><p>a
24132 b
24133 </p>
24134 !! end
24135
24136 !! test
24137 2. Leading whitespace in non-indent-pre contexts should not be escaped
24138 !! options
24139 parsoid=html2wt
24140 !! html/parsoid
24141 <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>
24142 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24143 <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>
24144 b</span></li>
24145 </ol>
24146 !! wikitext
24147 foo <ref>''a''
24148 b</ref>
24149 <references />
24150 !! end
24151
24152 !! test
24153 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24154 !! options
24155 parsoid=html2wt
24156 !! html/parsoid
24157 <blockquote>
24158 <p>
24159 a
24160 <span>b</span>
24161 c</p>
24162 </blockquote>
24163 !! wikitext
24164 <blockquote>
24165 a
24166 <span>b</span>
24167 c
24168 </blockquote>
24169 !! end
24170
24171 !! test
24172 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24173 !! options
24174 options=html2wt
24175 !! html/parsoid
24176 <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>
24177 !! wikitext
24178 [[File:Foobar.jpg|thumb|caption]]
24179 !! end
24180
24181 !! test
24182 5. Nowiki escaping should account for indent-pres
24183 !! options
24184 parsoid=html2wt
24185 !! html/parsoid
24186 <pre>==foo==</pre>
24187 !! wikitext
24188 ==foo==
24189 !! end
24190
24191 !!test
24192 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24193 !! options
24194 parsoid=html2wt
24195 !! html/parsoid
24196 <pre>
24197 * foo
24198 * bar
24199 </pre>
24200 !! wikitext
24201 * foo
24202 * bar
24203 !! end
24204
24205 #### --------------- Behavior Switches --------------------
24206
24207 !! test
24208 1. Valid behavior switches should be escaped
24209 !! options
24210 parsoid=html2wt
24211 !! html/parsoid
24212 __TOC__
24213 <i>__TOC__</i>
24214 !! wikitext
24215 <nowiki>__TOC__</nowiki>
24216 ''<nowiki>__TOC__</nowiki>''
24217 !! end
24218
24219 !! test
24220 2. Invalid behavior switches should not be escaped
24221 !! options
24222 parsoid=html2wt
24223 !! html/parsoid
24224 __TOO__
24225 __|__
24226 !! wikitext
24227 __TOO__
24228 __|__
24229 !! end
24230
24231 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24232 !! test
24233 Behavior switches should be SOL-transparent
24234 !! options
24235 parsoid=html2wt
24236 !! html/parsoid
24237 <meta property="mw:PageProp/toc" />
24238
24239 <!-- this one's bogus -->
24240 <pre>__TOO__</pre>
24241
24242 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24243
24244 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24245 !! wikitext
24246 __TOC__
24247
24248 <!-- this one's bogus -->
24249 __TOO__
24250
24251 __TOC__ foo
24252
24253 __TOC__
24254 bar
24255 !! end
24256
24257 #### --------------- HTML tags ---------------
24258 #### 1. a tags
24259 #### 2. other tags
24260 #### 3. multi-line html tag
24261 #### 4. extension tags
24262 #### -----------------------------------------
24263 !! test
24264 1. a tags
24265 !! options
24266 parsoid=html2wt
24267 !! html/parsoid
24268 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24269 !! wikitext
24270 <a href="http://google.com">google</a>
24271 !! end
24272
24273 !! test
24274 2. other tags
24275 !! options
24276 parsoid=html2wt
24277 !! html/parsoid
24278 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24279 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24280 <li> &lt;td&gt;</li></ul>
24281
24282 !! wikitext
24283 * <nowiki><div>foo</div></nowiki>
24284 * <nowiki><div style="color:red">foo</div></nowiki>
24285 * <nowiki><td></nowiki>
24286 !! end
24287
24288 !! test
24289 3. multi-line html tag
24290 !! options
24291 parsoid=html2wt
24292 !! html/parsoid
24293 <p>&lt;div
24294 &gt;foo&lt;/div
24295 &gt;
24296 </p>
24297 !! wikitext
24298 <nowiki><div
24299 >foo</div
24300 ></nowiki>
24301 !! end
24302
24303 !! test
24304 4. extension tags
24305 !! options
24306 parsoid=html2wt
24307 !! html/parsoid
24308 <p>&lt;ref&gt;foo&lt;/ref&gt;
24309 </p><p>&lt;ref&gt;bar
24310 </p><p>baz&lt;/ref&gt;
24311 </p>
24312 !! wikitext
24313 <nowiki><ref>foo</ref></nowiki>
24314
24315 <nowiki><ref>bar</nowiki>
24316
24317 baz<nowiki></ref></nowiki>
24318 !! end
24319
24320 #### --------------- Others ---------------
24321 !! test
24322 Escaping nowikis
24323 !! options
24324 parsoid=html2wt
24325 !! html/parsoid
24326 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24327 </p>
24328 !! wikitext
24329 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24330 !! end
24331
24332 ## The quote-char in the input is necessary for triggering the bug
24333 !! test
24334 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24335 !! options
24336 parsoid=html2wt
24337 !! html/parsoid
24338 <p>foo's bar :</p>
24339 !! wikitext
24340 foo's bar :
24341 !! end
24342
24343 #----------- End of wikitext escaping tests --------------
24344
24345 !! test
24346
24347 Tag-like HTML structures are passed through as text
24348 !! wikitext
24349 <x y>
24350
24351 <x.y>
24352
24353 <x-y>
24354
24355 1>2
24356
24357 x<y
24358
24359 a>b
24360
24361 1<d e>f
24362 !! html
24363 <p>&lt;x y&gt;
24364 </p><p>&lt;x.y&gt;
24365 </p><p>&lt;x-y&gt;
24366 </p><p>1&gt;2
24367 </p><p>x&lt;y
24368 </p><p>a&gt;b
24369 </p><p>1&lt;d e&gt;f
24370 </p>
24371 !! end
24372
24373 !! test
24374 HTML tag with necessary entities in attributes
24375 !! wikitext
24376 <span title="&amp;amp;">foo</span>
24377 !! html
24378 <p><span title="&amp;amp;">foo</span>
24379 </p>
24380 !! end
24381
24382 !! test
24383 HTML tag with 'unnecessary' entity encoding in attributes
24384 !! wikitext
24385 <span title="&amp;">foo</span>
24386 !! html
24387 <p><span title="&amp;">foo</span>
24388 </p>
24389 !! end
24390
24391 !! test
24392 HTML tag with broken attribute value quoting
24393 !! options
24394 parsoid=wt2html,html2html
24395 !! wikitext
24396 <span title="Hello world>Foo</span>
24397 !! html/php
24398 <p><span title="Hello world">Foo</span>
24399 </p>
24400 !! html/parsoid
24401 <p><span title="Hello world">Foo</span></p>
24402 !! end
24403
24404 !! test
24405 Self-closed tag with broken attribute value quoting
24406 !! options
24407 parsoid=wt2html,html2html
24408 !! wikitext
24409 <div title="Hello world />Foo
24410 !! html/php+tidy
24411 <div title="Hello world"></div>
24412 <p>Foo</p>
24413 !! html/parsoid
24414 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24415 !! end
24416
24417 !! test
24418 Table with broken attribute value quoting
24419 !! options
24420 parsoid=wt2html,html2html
24421 !! wikitext
24422 {|
24423 | title="Hello world|Foo
24424 |}
24425 !! html/php
24426 <table>
24427 <tr>
24428 <td title="Hello world">Foo
24429 </td></tr></table>
24430
24431 !! html/parsoid
24432 <table>
24433 <tr>
24434 <td title="Hello world">Foo
24435 </td></tr></table>
24436
24437 !! end
24438
24439 !! test
24440 Table with broken attribute value quoting on consecutive lines
24441 !! options
24442 parsoid=wt2html,html2html
24443 !! wikitext
24444 {|
24445 | title="Hello world|Foo
24446 | style="color:red|Bar
24447 |}
24448 !! html/php
24449 <table>
24450 <tr>
24451 <td title="Hello world">Foo
24452 </td>
24453 <td style="color:red">Bar
24454 </td></tr></table>
24455
24456 !! html/parsoid
24457 <table><tbody>
24458 <tr>
24459 <td title="Hello world">Foo
24460 </td><td style="color: red">Bar
24461 </td></tr></tbody></table>
24462
24463 !! end
24464
24465 !!test
24466 Accept empty td cell attribute
24467 !! wikitext
24468 {|
24469 | align="center" | foo || |
24470 |}
24471 !! html
24472 <table>
24473 <tr>
24474 <td align="center"> foo </td>
24475 <td>
24476 </td></tr></table>
24477
24478 !!end
24479
24480 !!test
24481 Non-empty attributes in th-cells
24482 !! wikitext
24483 {|
24484 ! Foo !! style="color: red" | Bar
24485 |}
24486 !! html
24487 <table>
24488 <tr>
24489 <th> Foo </th>
24490 <th style="color: red"> Bar
24491 </th></tr></table>
24492
24493 !!end
24494
24495 !!test
24496 Accept empty attributes in th-cells
24497 !! wikitext
24498 {|
24499 !| foo !!| bar
24500 |}
24501 !! html
24502 <table>
24503 <tr>
24504 <th> foo </th>
24505 <th> bar
24506 </th></tr></table>
24507
24508 !!end
24509
24510 !!test
24511 Empty table rows go away
24512 !! wikitext
24513 {|
24514 | Hello
24515 | there
24516 |- class="foo"
24517 |-
24518 |}
24519 !! html
24520 <table>
24521 <tr>
24522 <td> Hello
24523 </td>
24524 <td> there
24525 </td></tr>
24526
24527 </table>
24528
24529 !! end
24530
24531 ###
24532 ### Parsoid-centric tests for testing RTing of inter-element separators
24533 ### Edge cases not tested by existing parser tests and specific to
24534 ### Parsoid-specific serialization strategies.
24535 ###
24536
24537 !!test
24538 RT-ed inter-element separators should be valid separators
24539 !! wikitext
24540 {|
24541 |- [[foo]]
24542 |}
24543 !! html/php
24544 <table>
24545
24546 </table>
24547
24548 !! html/parsoid
24549 <table>
24550 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24551 </tbody></table>
24552 !!end
24553
24554 # Parsoid-only since PHP parser relies on Tidy for correct output
24555 !!test
24556 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24557 !!options
24558 parsoid
24559 !! wikitext
24560 {|
24561 |<small>foo
24562 bar
24563 |}
24564
24565 {|
24566 |<small>foo<small>
24567 |}
24568 !! html
24569 <table>
24570 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24571 <p>bar</p></small></td></tr>
24572 </tbody></table>
24573
24574 <table>
24575 <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>
24576 </tbody></table>
24577 !!end
24578
24579 # Note that the "style" attribute is really a template parameter here.
24580 # The = would have to be {{=}} if you wanted the literal.
24581 !!test
24582 Empty TD followed by TD with tpl-generated attribute
24583 !! wikitext
24584 {|
24585 |-
24586 |
24587 |{{echo|style='color:red'}}|foo
24588 |}
24589 !! html
24590 <table>
24591
24592 <tr>
24593 <td>
24594 </td>
24595 <td>foo
24596 </td></tr></table>
24597
24598 !!end
24599
24600 !!test
24601 Indented table with an empty td
24602 !! wikitext
24603 {|
24604 |-
24605 |
24606 |foo
24607 |}
24608 !! html
24609 <table>
24610
24611 <tr>
24612 <td>
24613 </td>
24614 <td>foo
24615 </td></tr></table>
24616
24617 !!end
24618
24619 ## We have some newline diffs RT-ing this edge case
24620 ## and it is not important enough -- we seem to be emitting
24621 ## at most 2 newlines after a </tr> and this is unrelated to
24622 ## the issue from T85627 that this is testing.
24623 !!test
24624 Indented table with blank lines in between (T85627)
24625 !! options
24626 parsoid=wt2html
24627 !! wikitext
24628 {|
24629 |foo
24630
24631
24632 |}
24633 !! html
24634 <table>
24635
24636 <tr>
24637 <td>foo
24638 </td></tr></table>
24639
24640 !!end
24641
24642 !!test
24643 Indented block & table
24644 !! wikitext
24645 <div>foo</div>
24646 {|
24647 |foo
24648 |}
24649 !! html/php
24650 <div>foo</div>
24651 <table>
24652 <tr>
24653 <td>foo
24654 </td></tr></table>
24655
24656 !! html/parsoid
24657 <div data-parsoid='{"stx":"html"}'>foo</div>
24658 <table><tbody>
24659 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24660 </tbody></table>
24661 !!end
24662
24663 !! test
24664 Indent and comment before table row
24665 !! wikitext
24666 {|
24667 <!--hi-->|-
24668 | there
24669 |}
24670 !! html/php
24671 <table>
24672
24673 <tr>
24674 <td> there
24675 </td></tr></table>
24676
24677 !! html/parsoid
24678 <table>
24679 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24680 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24681 </tbody></table>
24682 !! end
24683
24684 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24685 !!test
24686 Empty TR followed by a template-generated TR
24687 !!options
24688 parsoid
24689 !! wikitext
24690 {|
24691 |-
24692 {{echo|<tr><td>foo</td></tr>}}
24693 |}
24694 !! html
24695 <table>
24696 <tbody>
24697 <tr></tr>
24698 <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}}]}'>
24699 <td>foo</td></tr>
24700 </tbody></table>
24701 !!end
24702
24703 ## PHP and parsoid output differ for this, and since this is primarily
24704 ## for testing Parsoid's serializer, marking this Parsoid only
24705 !!test
24706 Empty TR followed by mixed-ws-comment line should RT correctly
24707 !!options
24708 parsoid
24709 !! wikitext
24710 {|
24711 |-
24712 <!--c-->
24713 |-
24714 <!--c--> <!--d-->
24715 |}
24716 !! html
24717 <table>
24718 <tbody>
24719 <tr></tr>
24720 <!--c-->
24721 <tr>
24722 <!--c--> </tr><!--d-->
24723 </tbody></table>
24724
24725 !!end
24726
24727 !!test
24728 Multi-line image caption generated by templates with/without trailing newlines
24729 !! wikitext
24730 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24731 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24732 !! html/parsoid
24733 <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>
24734 <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>
24735 !!end
24736
24737 !! test
24738 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24739 !! options
24740 parsoid=html2wt
24741 !! html/parsoid
24742 <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>
24743
24744 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24745 !! wikitext
24746 <includeonly>foo</includeonly>
24747 new para
24748
24749 [[Category:Foo]]
24750
24751 = new heading =
24752 !! end
24753
24754 ## PHP emits broken html for this, and since this is primarily
24755 ## a Parsoid serializer test, marking this Parsoid only
24756 !!test
24757 Improperly nested inline or quotes tags with whitespace in between
24758 !! wikitext
24759 <span> <s>x</span> </s>
24760 ''' ''x''' ''
24761 !! html/parsoid
24762 <p><span> <s>x</s></span><s> </s>
24763 <b> <i>x</i></b><i> </i>
24764 </p>
24765 !!end
24766
24767 !!test
24768 Encapsulate protected attributes from wt
24769 !! wikitext
24770 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24771 !! html/parsoid
24772 <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>
24773 </body>
24774 !!end
24775
24776 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24777 ## Having nested or stray pre tags results in the attempt to add duplicates,
24778 ## causing an assertion fail. This test tries to prevent that situation.
24779 !!test
24780 Ensure ParagraphWrapper can deal with stray closing pre tags
24781 !!options
24782 parsoid=wt2html
24783 !! wikitext
24784 plain text</pre>
24785 !! html/parsoid
24786 plain text
24787 !!end
24788
24789 !!test
24790 1. Ensure fostered text content is wrapped in element nodes
24791 !!options
24792 parsoid=wt2html
24793 !! wikitext
24794 <table>hi</table><table>ho</table>
24795 !! html/parsoid
24796 <p>hi</p>
24797 <table></table>
24798 <p>ho</p>
24799 <table></table>
24800 !!end
24801
24802 !!test
24803 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24804 !!options
24805 parsoid=wt2html,wt2wt
24806 !! wikitext
24807 <table>
24808 <tr> || ||
24809 <td> a
24810 </table>
24811 !! html/parsoid
24812 <p> || ||
24813 </p><table>
24814 <tbody><tr><td> a</td></tr>
24815 </tbody></table>
24816 !!end
24817
24818 !!test
24819 Encapsulation properly handles null DSR information from foster box
24820 !!options
24821 parsoid=wt2html,wt2wt
24822 !! wikitext
24823 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24824 !! html/parsoid
24825 <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>
24826 !!end
24827
24828 !!test
24829 1. Encapsulate foster-parented transclusion content
24830 !!options
24831 parsoid=wt2wt,wt2html
24832 !! wikitext
24833 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24834 !! html/parsoid
24835 <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>
24836 <tbody>
24837 <tr>
24838 <td>bar</td>
24839 </tr>
24840 </tbody>
24841 </table>
24842 !!end
24843
24844 !!test
24845 2. Encapsulate foster-parented transclusion content
24846 !!options
24847 parsoid=wt2wt,wt2html
24848 !! wikitext
24849 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24850 !! html/parsoid
24851 <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>
24852 <table>
24853 <tbody>
24854 <tr>
24855 <td>bar</td>
24856 </tr>
24857 </tbody>
24858 </table>
24859 !!end
24860
24861 !!test
24862 3. Encapsulate foster-parented transclusion content
24863 !!options
24864 parsoid=wt2wt,wt2html
24865 !! wikitext
24866 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24867 !! html/parsoid
24868 <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;]}">
24869 <p>foo</p>
24870 </div>
24871 <table>
24872 <tbody>
24873 <tr>
24874 <td>bar</td>
24875 </tr>
24876 </tbody>
24877 </table>
24878 !!end
24879
24880 !!test
24881 4. Encapsulate foster-parented transclusion content
24882 !!options
24883 parsoid=wt2wt,wt2html
24884 !! wikitext
24885 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24886 !! html/parsoid
24887 <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;]}">
24888 <p>foo</p>
24889 </div>
24890 <table>
24891 <tbody>
24892 <tr>
24893 <td>bar</td>
24894 </tr>
24895 </tbody>
24896 </table>
24897 !!end
24898
24899 !!test
24900 5. Encapsulate foster-parented transclusion content
24901 !!options
24902 parsoid=wt2wt,wt2html
24903 !! wikitext
24904 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24905 !! html/parsoid
24906 <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>
24907 <table>
24908 <tbody>
24909 <tr>
24910 <td>
24911 <div>
24912 <p>foo</p>
24913 </div>
24914 </td>
24915 </tr>
24916 </tbody>
24917 </table>
24918 !!end
24919
24920 !!test
24921 6. Encapsulate foster-parented transclusion content
24922 !!options
24923 parsoid=wt2wt,wt2html
24924 !! wikitext
24925 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24926 !! html/parsoid
24927 <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>
24928 <table>
24929 <tbody>
24930 <tr>
24931 <td>
24932 <div>
24933 <p>foo</p>
24934 </div>
24935 </td>
24936 </tr>
24937 </tbody>
24938 </table>
24939 <p>ok</p>
24940 !!end
24941
24942 !!test
24943 7. Encapsulate foster-parented transclusion content
24944 !!options
24945 parsoid=wt2wt,wt2html
24946 !! wikitext
24947 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24948 !! html/parsoid
24949 <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>
24950 <table>
24951 <tbody>
24952 <tr>
24953 <td>bar</td>
24954 </tr>
24955 </tbody>
24956 </table>
24957 !!end
24958
24959 # Note that the wt is broken on purpose: the = should be {{=}} if you
24960 # don't want it to be a template parameter key.
24961 !!test
24962 8. Encapsulate foster-parented transclusion content
24963 !!options
24964 parsoid=wt2wt,wt2html
24965 !! wikitext
24966 {{echo|a
24967 }}{|{{echo|style='color:red'}}
24968 |-
24969 |b
24970 |}
24971 !! html/parsoid
24972 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24973 <span> </span>
24974 <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>
24975 <table>
24976 <tbody>
24977 <tr>
24978 <td>b</td>
24979 </tr>
24980 </tbody>
24981 </table>
24982 !!end
24983
24984 !!test
24985 9. Encapsulate foster-parented transclusion content
24986 !!options
24987 parsoid=wt2wt,wt2html
24988 !! wikitext
24989 <table>{{echo|hi</table>hello}}
24990 !! html/parsoid
24991 <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>
24992 !!end
24993
24994 !!test
24995 Table in fosterable position
24996 !!options
24997 parsoid=wt2html
24998 !! wikitext
24999 {{OpenTable}}
25000 <div>
25001 {|
25002 |}
25003 </div>
25004 |}
25005 !! html/parsoid
25006 <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">
25007 </span>
25008 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25009
25010 <table>
25011 </table>
25012 !!end
25013
25014 # Parsoid only for bug 64747
25015 !! test
25016 Properly encapsulate empty-content transclusions in fosterable positions
25017 !! wikitext
25018 <table>
25019 {{#if:|
25020 <td>foo</td>
25021 }}
25022 </table>
25023 !! html/parsoid
25024 <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"}]]}'>
25025
25026 </table>
25027 !! end
25028
25029 !! test
25030 Always encapsulate foster box when template range is expanded to table
25031 !! options
25032 parsoid=wt2wt
25033 !! wikitext
25034 {|
25035 hello
25036 {{OpenTable}}
25037 |}
25038 !! html/parsoid
25039
25040 !! end
25041
25042 !! test
25043 T115289: Unclosed table
25044 !! wikitext
25045 {{echo|<table>}}<!--c-->[[Category:Two]]
25046 !! html/parsoid
25047 <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>
25048 !! end
25049
25050 !! test
25051 T115289: Don't migrate newlines out of tables with fostered content
25052 !! wikitext
25053 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25054 !! html/parsoid
25055 <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>
25056 !! end
25057
25058 !! test
25059 T73074: More fostering fun
25060 !! wikitext
25061 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25062 !! html/parsoid
25063 <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>
25064 !! end
25065
25066 !!test
25067 Support <object> element with .data attribute
25068 !!options
25069 parsoid=html2wt
25070 !! html/parsoid
25071 <object data="test.swf"></object>
25072 !! wikitext
25073 <object data="test.swf"></object>
25074 !!end
25075
25076 !! test
25077 Don't block XML namespace declaration
25078 !! wikitext
25079 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25080 !! html/php
25081 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25082 </p>
25083 !! html/parsoid
25084 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25085 !! end
25086
25087 # -----------------------------------------------------------------
25088 # The following section of tests are primarily to spec requirements
25089 # around Parsoid's serialization (old, new, edited content)
25090 #
25091 # All these tests are marked Parsoid html2wt and html2html only
25092 # ----------------------------------------------------------------
25093
25094 !! test
25095 Ignore rel attribute in a-tags during serialization to url-links
25096 !! options
25097 parsoid=html2wt
25098 !! html/parsoid
25099 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25100 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25101 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25102 !! wikitext
25103 http://en.wikipedia.org/wiki/Foobar
25104 http://en.wikipedia.org/wiki/Foobar
25105 http://en.wikipedia.org/wiki/Foobar
25106 !! end
25107
25108 # 'mi' is a localinterwiki prefix as well as a language
25109 !! test
25110 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25111 !! options
25112 parsoid=html2wt
25113 !! html/parsoid
25114 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25115 !! wikitext
25116 [[Foo]]
25117 !! end
25118
25119 # See T93839
25120 !! test
25121 New wikilinks should be serialized properly
25122 !! options
25123 parsoid=html2wt
25124 !! html/parsoid
25125 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25126 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25127 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25128 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25129 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25130 !! wikitext
25131 [[Foo]]
25132 [[Foo]]
25133 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25134 http://en.wikipedia.org/wiki/Foo
25135 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25136 !! end
25137
25138 !! test
25139 New wiki links (href variations)
25140 !! options
25141 parsoid=html2wt
25142 !! html/parsoid
25143 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25144 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25145 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25146 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25147 !! wikitext
25148 [[Foo_bar]]
25149 [[Foo_bar]]
25150 [[Foo_bar]]
25151 [[Toxine bactérienne]]
25152 !! end
25153
25154 !! test
25155 New wiki links (content string variations)
25156 !! options
25157 parsoid=html2wt
25158 !! html/parsoid
25159 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25160 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25161 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25162 !! wikitext
25163 [[Foo_bar]]
25164 [[Foo bar]]
25165 [[Foo_bar|./Foo_bar]]
25166 !! end
25167
25168 !! test
25169 New category links (href variations)
25170 !! options
25171 parsoid=html2wt
25172 !! html/parsoid
25173 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25174 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25175 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25176 !! wikitext
25177 [[Category:Toxine bactérienne]]
25178 [[Category:Toxine bactérienne]]
25179 [[Category:Toxine bactérienne]]
25180 !! end
25181
25182 !! test
25183 New sol transparent links don't need indent-pre nowiki protection
25184 !! options
25185 parsoid=html2wt
25186 language=de
25187 !! html/parsoid
25188 <link rel="mw:PageProp/redirect" href="./Main_Page">
25189 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25190 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25191 !! wikitext
25192 #WEITERLEITUNG [[Main Page]]
25193 <!-- this is good --> [[Category:Good]]
25194 <!-- this is great --> [[Kategorie:Great]]
25195 !! end
25196
25197 !! test
25198 New interlanguage links (href variations)
25199 !! options
25200 parsoid=html2wt
25201 !! html/parsoid
25202 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25203 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25204 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25205 !! wikitext
25206 [[es:Toxine bactérienne]]
25207 [[es:Toxine_bactérienne]]
25208 [[es:Toxine_bactérienne]]
25209 !! end
25210
25211 !! test
25212 Image: Modifying size of an image (1)
25213 !! options
25214 parsoid={
25215 "modes": ["wt2wt"],
25216 "changes": [
25217 ["img[height]", "attr", "height", "22"],
25218 ["img[width]", "attr", "width", "200"]
25219 ]
25220 }
25221 !! wikitext
25222 [[Image:Foobar.jpg|230x230px]]
25223 !! wikitext/edited
25224 [[Image:Foobar.jpg|200x200px]]
25225 !!end
25226
25227 !! test
25228 Image: Modifying size of an image (2)
25229 !! options
25230 parsoid={
25231 "modes": ["wt2wt"],
25232 "changes": [
25233 ["img[height]", "attr", "height", "100"],
25234 ["img[width]", "attr", "width", "500"]
25235 ]
25236 }
25237 !! wikitext
25238 [[Image:Foobar.jpg|230x230px]]
25239 !! wikitext/edited
25240 [[Image:Foobar.jpg|500x500px]]
25241 !!end
25242
25243 # Change in size is ignored so long as class='mw-default-size'
25244 !! test
25245 Image: Modifying size of an image (3)
25246 !! options
25247 parsoid={
25248 "modes": ["wt2wt"],
25249 "changes": [
25250 ["figure[class]", "removeClass", "mw-default-size"],
25251 ["figure img", "attr", "height", "19"],
25252 ["figure img", "attr", "width", "170"]
25253 ]
25254 }
25255 !! wikitext
25256 [[Image:Foobar.jpg|thumb]]
25257 !! wikitext/edited
25258 [[Image:Foobar.jpg|thumb|170x170px]]
25259 !!end
25260
25261 !! test
25262 Image: Modifying alignment of an image (bug 48665)
25263 !! options
25264 parsoid={
25265 "modes": ["wt2wt"],
25266 "changes": [
25267 ["figure[class]", "removeClass", "mw-halign-right"],
25268 ["figure[class]", "addClass", "mw-halign-left"]
25269 ]
25270 }
25271 !! wikitext
25272 [[Image:Foobar.jpg|thumb|caption|right]]
25273 !! wikitext/edited
25274 [[Image:Foobar.jpg|thumb|caption|left]]
25275 !! end
25276
25277 !! test
25278 Image: Modifying mw-default-size of an frameless image (bug 62805)
25279 !! options
25280 parsoid={
25281 "modes": ["wt2wt"],
25282 "changes": [
25283 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25284 ]
25285 }
25286 !! wikitext
25287 [[Image:Foobar.jpg|frameless|right]]
25288 !! wikitext/edited
25289 [[Image:Foobar.jpg|frameless|right|220x220px]]
25290 !! end
25291
25292 !! test
25293 Image: Modifying valign of an image (bug 49221)
25294 !! options
25295 parsoid={
25296 "modes": ["wt2wt"],
25297 "changes": [
25298 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25299 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25300 ]
25301 }
25302 !! wikitext
25303 [[File:Foobar.jpg|20px|middle]]
25304 !! wikitext/edited
25305 [[File:Foobar.jpg|20px|text-top]]
25306 !! end
25307
25308 !! test
25309 Image: Modifying alt attribute of an image (bug 56400)
25310 !! options
25311 parsoid={
25312 "modes": ["wt2wt"],
25313 "changes": [
25314 ["img[alt]", "attr", "alt", "some alternate edited text"]
25315 ]
25316 }
25317 !! wikitext
25318 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25319 !! wikitext/edited
25320 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25321 !!end
25322
25323 !! test
25324 Image: Modifying caption of an image
25325 !! options
25326 parsoid={
25327 "modes": ["wt2wt"],
25328 "changes": [
25329 ["figcaption", "text", "new caption"]
25330 ]
25331 }
25332 !! wikitext
25333 [[Image:Foobar.jpg|thumb|original caption]]
25334 !! wikitext/edited
25335 [[Image:Foobar.jpg|thumb|new caption]]
25336 !!end
25337
25338 !! test
25339 Image: empty alt attribute (bug 48924)
25340 !! options
25341 parsoid
25342 !! wikitext
25343 [[File:Foobar.jpg|thumb|alt=|bar]]
25344 !! html
25345 <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>
25346 !! end
25347
25348 !! test
25349 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25350 !! options
25351 parsoid=html2wt
25352 language=ar
25353 disabled
25354 !! html/parsoid
25355 <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>
25356 !! wikitext
25357 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25358 !! end
25359
25360 !! test
25361 Image: Block level image should have \n before and after
25362 !! wikitext
25363 123
25364 [[File:Foobar.jpg|right|thumb|150x150px]]
25365 456
25366 !! html/parsoid
25367 <p>123</p>
25368 <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>
25369 <p>456</p>
25370 !!end
25371
25372 !! test
25373 Image: New block level image should have \n before and after (existing content)
25374 !! wikitext
25375 123
25376 [[File:Foobar.jpg|right|thumb|150x150px]]
25377 456
25378 !! html/parsoid
25379 <p>123</p>
25380 <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>
25381 <p>456</p>
25382 !!end
25383
25384 !! test
25385 Image: upright option (parsoid)
25386 !! wikitext
25387 [[File:Foobar.jpg|thumb|upright|caption]]
25388 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25389 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25390 !! html/parsoid
25391 <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>
25392 <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>
25393 <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>
25394 !!end
25395
25396 !! test
25397 Image: upright option is ignored on inline and frame images (parsoid)
25398 !! wikitext
25399 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25400 !! html/parsoid
25401 <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>
25402 !!end
25403
25404 !! test
25405 Image: from basic HTML (1)
25406 !! options
25407 parsoid=html2wt
25408 !! html/parsoid
25409 <span typeof="mw:Image">
25410 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25411 </span>
25412 !! wikitext
25413 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25414 !! end
25415
25416 !! test
25417 Image: from basic HTML (2)
25418 !! options
25419 parsoid=html2wt
25420 !! html/parsoid
25421 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25422 !! wikitext
25423 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25424 !! end
25425
25426 !! test
25427 Image: from basic HTML (3)
25428 !! options
25429 parsoid=html2wt
25430 !! html/parsoid
25431 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25432 !! wikitext
25433 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25434 !! end
25435
25436 !! test
25437 Image: from basic HTML (4)
25438 !! options
25439 parsoid=html2wt
25440 !! html/parsoid
25441 <img src="./File:Foobar.jpg">
25442 !! wikitext
25443 [[File:Foobar.jpg|link=]]
25444 !! end
25445
25446 !! test
25447 Image: Invalid title as link
25448 !! wikitext
25449 [[File:Foobar.jpg|link=<]]
25450 !! html/php
25451 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
25452 </p>
25453 !! html/parsoid
25454 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&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>
25455 !! end
25456
25457 !! test
25458 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25459 !! options
25460 parsoid=html2wt
25461 !! html/parsoid
25462 <ul>
25463 <li><p>foo</p></li>
25464 </ul>
25465 !! wikitext
25466 * foo
25467 !! end
25468
25469 !! test
25470 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25471 !! options
25472 parsoid=html2wt
25473 !! html/parsoid
25474 <ul> <li>foo</li></ul>
25475 !! wikitext
25476 * foo
25477 !! end
25478
25479 !! test
25480 Don't strip leading whitespace when handling indent-pre suppressing tags
25481 !! options
25482 parsoid=html2wt
25483 !! html/parsoid
25484 <table>
25485 <tr><td> indented row</td></tr>
25486 </table>
25487 <blockquote><p>
25488 <b>This is very bold of you!</b>
25489 </p>
25490 <table><tr><td>
25491 indented cell (no pre-wrapping!)
25492 </td></tr></table>
25493 </blockquote>
25494 <p>foo</p>
25495 <div>bar</div>
25496 !! wikitext
25497 {|
25498 | indented row
25499 |}
25500 <blockquote>
25501 '''This is very bold of you!'''
25502
25503 {|
25504 |
25505 indented cell (no pre-wrapping!)
25506 |}
25507 </blockquote>
25508 foo
25509 <div>bar</div>
25510 !! end
25511
25512 !! test
25513 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25514 !! options
25515 parsoid=html2wt
25516 !! html/parsoid
25517 <p>foo</p>
25518 <span>bar</span>
25519
25520 <span>foo2
25521 </span>bar2
25522
25523 <div>foo</div>
25524 <span>bar</span>
25525
25526 <div>
25527 <span>foo</span>
25528 </div>
25529 !! wikitext
25530 foo
25531
25532 <span>bar</span>
25533
25534 <span>foo2
25535 <nowiki> </nowiki></span>bar2
25536
25537 <div>foo</div>
25538 <nowiki> </nowiki><span>bar</span>
25539
25540 <div>
25541 <nowiki> </nowiki><span>foo</span>
25542 </div>
25543 !! end
25544
25545 !! test
25546 Lists: Dont insert newlines in a serialized list item.
25547 !! options
25548 parsoid=html2wt
25549 !! html/parsoid
25550 <ul><li>a<br>b</li><li>c</li></ul>
25551 !! wikitext
25552 * a<br>b
25553 * c
25554 !! end
25555
25556 !! test
25557 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25558 !! options
25559 parsoid={
25560 "modes": ["html2wt"],
25561 "scrubWikitext": false
25562 }
25563 !! html/parsoid
25564 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25565 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25566
25567 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25568 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25569
25570 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25571
25572 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25573 !! wikitext
25574 == hello there [[Category:A1]] ==
25575
25576 == [[Category:A2]] hi pal ==
25577
25578 == <!--foo--> [[Category:A3]] how goes it ==
25579
25580 == it goes well [[Category:A4]] <!--bar--> ==
25581
25582 ==howdy [[Category:A5]]==
25583
25584 == __TOC__ ok ==
25585 !! end
25586
25587 !! test
25588 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25589 !! options
25590 parsoid={
25591 "modes": ["html2wt"],
25592 "scrubWikitext": true
25593 }
25594 !! html/parsoid
25595 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25596 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25597
25598 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25599 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25600
25601 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25602 !! wikitext
25603 == hello there ==
25604 [[Category:A1]]
25605 [[Category:A2]]
25606
25607 == hi pal ==
25608
25609 <!--foo--> [[Category:A3]]
25610
25611 == how goes it ==
25612
25613 == it goes well ==
25614 [[Category:A4]] <!--bar-->
25615
25616 __TOC__
25617
25618 == ok ==
25619 !! end
25620
25621 !! test
25622 Headings: Don't hoist metas that come from templates
25623 !! options
25624 parsoid={
25625 "modes": ["html2wt"],
25626 "scrubWikitext": true
25627 }
25628 !! html/parsoid
25629 <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>
25630 !! wikitext
25631 == {{echo|foo [[Category:Foo]]}} ==
25632 !! end
25633
25634 !! test
25635 Headings: Category in ref isn't hoisted
25636 !! options
25637 parsoid={
25638 "modes": ["html2wt"],
25639 "scrubWikitext": true
25640 }
25641 !! html/parsoid
25642 <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>
25643
25644 <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>
25645 !! wikitext
25646 == foo <ref>bar
25647 [[Category:Baz]] </ref> ==
25648
25649 <references />
25650 !! end
25651
25652 !! test
25653 Parsoid: Serialize positional parameters with = in them as named parameter
25654 !! options
25655 parsoid=html2wt
25656 !! html/parsoid
25657 <p about="#mwt1" typeof="mw:Transclusion"
25658 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25659
25660 <p about="#mwt1" typeof="mw:Transclusion"
25661 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25662
25663 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25664 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25665 <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>
25666 !! wikitext
25667 {{echo|1=f=oo}}
25668
25669 {{echo|1=f=oo|2=bar}}
25670
25671 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25672 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25673 {{echo|<nowiki>f=oo</nowiki>|bar}}
25674 !! end
25675
25676 !! test
25677 Parsoid: Serialize positional parameters with = in extlink as named parameter
25678 !! options
25679 parsoid=html2wt
25680 !! html/parsoid
25681 <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>
25682 !! wikitext
25683 {{echo|1=http://stuff?is=ok}}
25684 !! end
25685
25686 !! test
25687 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25688 !! options
25689 parsoid=html2wt
25690 !! html/parsoid
25691 <div>a<p>b</p></div>
25692 <div>a
25693 <p>b</p></div>
25694 <div>
25695 a
25696 <p>b</p></div>
25697 !! wikitext
25698 <div>a
25699 b
25700 </div>
25701 <div>a
25702 b
25703 </div>
25704 <div>
25705 a
25706
25707 b
25708 </div>
25709 !! end
25710
25711 !! test
25712 Substrings resembling wikitext in hrefs should not get nowiki escapes
25713 !! options
25714 parsoid=html2wt
25715 !! html/parsoid
25716 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25717 !! wikitext
25718 [[Foo''bar''baz]]
25719 !! end
25720
25721 !! test
25722 Enforce single-line context in the serializer
25723 !! options
25724 parsoid=html2wt
25725 !! html/parsoid
25726 <h2>testing
25727 123</h2>
25728
25729 <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">
25730 </span><span about="#mwt1">you</span> </h2>
25731
25732 <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>
25733
25734 <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
25735 there</span></li></ol>
25736
25737 <ul><li>asd
25738 sdf</li></ul>
25739
25740 <ul><li>foo
25741 bar
25742 baz</li>
25743 <li>foo <b>bar</b>
25744 baz</li></ul>
25745
25746 <dl><dt>hi
25747 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25748 ho</dd></dl>
25749
25750 <dl><dd> <table>
25751 <tbody><tr><td> ha
25752 ha
25753 ha</td></tr>
25754 </tbody></table></dd></dl>
25755 !! wikitext
25756 == testing 123 ==
25757
25758 == hi {{bogus|there
25759 you}} ==
25760
25761 == foo <ref>hello
25762 there</ref> ==
25763
25764 <references />
25765
25766 * asd sdf
25767
25768 * foo bar baz
25769 * foo '''bar''' baz
25770
25771 ; hi ho : hi ho
25772
25773 : {|
25774 | ha
25775 ha
25776 ha
25777 |}
25778 !! end
25779
25780 !! test
25781 Serialize new placeholder space without spans
25782 !! options
25783 parsoid=html2wt
25784 !! html/parsoid
25785 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25786
25787 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25788
25789 <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>
25790 !! wikitext
25791 foo : bar
25792
25793 foo : bar
25794
25795 <ref>foo : bar</ref>ok
25796 !! end
25797
25798
25799 #-----------------------
25800 # Tag minimization tests
25801 #-----------------------
25802
25803 !! test
25804 1. I/B quote minimization: wikitext-only tags should be combined
25805 !! options
25806 parsoid=html2wt
25807 !! html/parsoid
25808 <p><i>A</i><i>B</i></p>
25809 <p><b>A</b><b>B</b></p>
25810 <p><i>A</i><b><i>B</i></b></p>
25811 <p><b>A</b><i><b>B</b></i></p>
25812 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25813 <p><i><b>A</b></i><i><b>B</b></i></p>
25814 <p><i><b>A</b></i><b><i>B</i></b></p>
25815 <p><b><i>A</i></b><i><b>B</b></i></p>
25816 !! wikitext
25817 ''AB''
25818
25819 '''AB'''
25820
25821 ''A'''B'''''
25822
25823 '''A''B'''''
25824
25825 '''A''BC''D'''
25826
25827 '''''AB'''''
25828
25829 '''''AB'''''
25830
25831 '''''AB'''''
25832 !! end
25833
25834 !! test
25835 2. I/B quote minimization: wikitext and html tags should not be combined
25836 !! options
25837 parsoid=html2wt
25838 !! html/parsoid
25839 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25840 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25841 !! wikitext
25842 ''A''<i>B</i>
25843
25844 ''A''<nowiki/>'''<i>B</i>'''
25845 !! end
25846
25847 !! test
25848 3. I/B quote minimization: templated content stops minimization
25849 !! options
25850 parsoid=html2wt
25851 !! html/parsoid
25852 <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>
25853 <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>
25854 !! wikitext
25855 ''A''{{echo|''B''}}
25856
25857 ''A''{{echo|'''''B'''''}}
25858 !! end
25859
25860 !! test
25861 4. I/B quote minimization: new content should be mimimized with adjacent old content
25862 !! options
25863 parsoid=html2wt
25864 !! html/parsoid
25865 <p><i>A</i><i>B</i></p>
25866 <p><b>A</b><b>B</b></p>
25867 <p><i>A</i><b><i>B</i></b></p>
25868 !! wikitext
25869 ''AB''
25870
25871 '''AB'''
25872
25873 ''A'''B'''''
25874 !! end
25875
25876 !! test
25877 5a. Merge adjacent quote nodes if they've been edited
25878 !! options
25879 parsoid={
25880 "modes": ["wt2wt", "selser"],
25881 "changes": [
25882 ["p", "contents", "remove", ":contains('b')"]
25883 ]
25884 }
25885 !! wikitext
25886 ''a''b''c''
25887 !! wikitext/edited
25888 ''ac''
25889 !! end
25890
25891 !! test
25892 5b. Merge adjacent quote nodes if they've been edited
25893 !! options
25894 parsoid={
25895 "modes": ["wt2wt", "selser"],
25896 "changes": [
25897 ["#x", "remove"]
25898 ]
25899 }
25900 !! wikitext
25901 ''a''<span id="x">b</span>''c''
25902 !! wikitext/edited
25903 ''ac''
25904 !! end
25905
25906 !! test
25907 1. Merge adjacent link nodes as long as at least one element is new
25908 !! options
25909 parsoid={
25910 "modes": ["html2wt"],
25911 "scrubWikitext": true
25912 }
25913 !! html/parsoid
25914 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25915 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25916 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25917 !! wikitext
25918 [[Football]]
25919 [[Football]]
25920 [[Football|Foot]][[Football|ball]]
25921 !! end
25922
25923 !! test
25924 2. Merge adjacent link nodes and enable additional normalizations
25925 !! options
25926 parsoid={
25927 "modes": ["html2wt"],
25928 "scrubWikitext": true
25929 }
25930 !! html/parsoid
25931 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25932 !! wikitext
25933 [[Football|''Football'']]
25934 !! end
25935
25936 !! test
25937 3. Don't merge adjacent link nodes if scrubWikitext is false
25938 !! options
25939 parsoid={
25940 "modes": ["html2wt"],
25941 "scrubWikitext": false
25942 }
25943 !! html/parsoid
25944 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25945 !! wikitext
25946 [[Football|Foot]][[Football|ball]]
25947 !! end
25948
25949 #------------------------------
25950 # End of tag minimization tests
25951 #------------------------------
25952
25953 !!test
25954 Bug 54262: New entities
25955 !! options
25956 parsoid=html2wt
25957 !! html/parsoid
25958 <span typeof="mw:Entity">&nbsp;</span>
25959 !! wikitext
25960 &nbsp;
25961 !! end
25962
25963 ## Note that there is no wikitext output for 'unknownproperty' ##
25964 ## Unknown magic words are silently dropped ##
25965
25966 !! test
25967 Magic words
25968 !! options
25969 parsoid=html2wt
25970 !! html/parsoid
25971 <meta property='mw:PageProp/toc' />
25972 <meta property='mw:PageProp/notoc' />
25973 <meta property='mw:PageProp/forcetoc' />
25974 <meta property='mw:PageProp/index' />
25975 <meta property='mw:PageProp/noindex' />
25976 <meta property='mw:PageProp/nogallery' />
25977 <meta property='mw:PageProp/noeditsection' />
25978 <meta property='mw:PageProp/notitleconvert' />
25979 <meta property='mw:PageProp/nocontentconvert' />
25980 <meta property='mw:PageProp/unknownproperty' />
25981 !! wikitext
25982 __TOC__
25983 __NOTOC__
25984 __FORCETOC__
25985 __INDEX__
25986 __NOINDEX__
25987 __NOGALLERY__
25988 __NOEDITSECTION__
25989 __NOTITLECONVERT__
25990 __NOCONTENTCONVERT__
25991 !! end
25992
25993 !! test
25994 Consecutive <pre>s should not get merged
25995 !! options
25996 parsoid=html2wt,html2html
25997 !! html/parsoid
25998 <pre>a</pre><pre>b</pre>
25999
26000 <pre>c
26001 </pre><pre>
26002 d</pre>
26003
26004 <pre>e
26005
26006 </pre><pre>
26007
26008 f</pre>
26009 !! wikitext
26010 a
26011
26012 b
26013
26014 c
26015
26016 d
26017
26018 e
26019
26020
26021
26022 f
26023 !! end
26024
26025 !! test
26026 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26027 !! options
26028 parsoid=html2wt
26029 !! html/parsoid
26030 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26031 !! wikitext
26032 [[Special:BookSources/1234567890|ISBN 1234567895]]
26033 !! end
26034
26035 !! test
26036 Edited RFC links not serializable as RFC links should serialize as extlinks
26037 !! options
26038 parsoid=html2wt
26039 !! html/parsoid
26040 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26041 !! wikitext
26042 [//tools.ietf.org/html/rfc123 New RFC]
26043 !! end
26044
26045 !! test
26046 Edited PMID links not serializable as PMID links should serialize as extlinks
26047 !! options
26048 parsoid=html2wt
26049 !! html/parsoid
26050 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26051 !! wikitext
26052 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26053 !! end
26054
26055 !! test
26056 WTS of autolinks with trailing/surrounding context
26057 !! options
26058 parsoid=html2wt
26059 !! html/parsoid
26060 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26061 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26062 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26063 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26064 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26065 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26066 !! wikitext
26067 http://cscott.net'''foo'''
26068
26069 http://cscott.net<b>foo</b>
26070
26071 '''http://cscott.net'''
26072
26073 '''http://cscott.net '''
26074
26075 '''http://cscott.net<nowiki/>x'''
26076
26077 http://cscott.net<nowiki/>x
26078 !! end
26079
26080 !! test
26081 WTS of autolinks with nowikis (round-trip)
26082 !! wikitext
26083 x<nowiki/>http://cscott.net<nowiki/>x
26084 !! html/parsoid
26085 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26086 !! end
26087
26088 # this is the "easy" test because it leaves in place all the
26089 # data-parsoid information indicating this is an autolink
26090 !! test
26091 WTS of autolinks with escapes (editing)
26092 !! options
26093 parsoid={
26094 "modes": ["wt2wt"],
26095 "changes": [
26096 [ "meta", "remove" ]
26097 ]
26098 }
26099 !! wikitext
26100 x<nowiki/>http://cscott.net<nowiki/>x
26101 !! wikitext/edited
26102 x<nowiki/>http://cscott.net<nowiki/>x
26103 !! end
26104
26105 !! test
26106 WTS of edited autolink-like text (T103364)
26107 !! options
26108 parsoid={
26109 "modes": ["wt2wt"],
26110 "changes": [
26111 [ "span[typeof]", "removeAttr", "typeof" ]
26112 ]
26113 }
26114 !! wikitext
26115 Not a link: <nowiki>http://example.com</nowiki>.
26116 !! wikitext/edited
26117 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26118 !! end
26119
26120 !! test
26121 WTS of newly-authored autolink-like text (T103364)
26122 !! options
26123 parsoid=html2wt
26124 !! html/parsoid
26125 <p>http://example.com is not a link.</p>
26126 !! wikitext
26127 <nowiki>http://example.com</nowiki> is not a link.
26128 !! end
26129
26130 !! test
26131 WTS of autolink-like text after an autolink (T108563)
26132 !! options
26133 parsoid=html2wt
26134 !! html/parsoid
26135 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26136 !! wikitext
26137 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26138 !! end
26139
26140 !! test
26141 Magic links inside links (not autolinked)
26142 !! wikitext
26143 [[Foo|http://example.com]]
26144 [[Foo|RFC 1234]]
26145 [[Foo|PMID 1234]]
26146 [[Foo|ISBN 123456789x]]
26147
26148 [http://foo.com http://example.com]
26149 [http://foo.com RFC 1234]
26150 [http://foo.com PMID 1234]
26151 [http://foo.com ISBN 123456789x]
26152 !! html+tidy
26153 <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>
26154 <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>
26155 !! html/parsoid
26156 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26157 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26158 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26159 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26160
26161 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26162 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26163 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26164 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26165 !! end
26166
26167 !! test
26168 Magic links inside image captions (autolinked)
26169 !! wikitext
26170 [[File:Foobar.jpg|thumb|http://example.com]]
26171 [[File:Foobar.jpg|thumb|RFC 1234]]
26172 [[File:Foobar.jpg|thumb|PMID 1234]]
26173 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26174 !! html+tidy
26175 <div class="thumb tright">
26176 <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>
26177 <div class="thumbcaption">
26178 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26179 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26180 </div>
26181 </div>
26182 <div class="thumb tright">
26183 <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>
26184 <div class="thumbcaption">
26185 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26186 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26187 </div>
26188 </div>
26189 <div class="thumb tright">
26190 <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>
26191 <div class="thumbcaption">
26192 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26193 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26194 </div>
26195 </div>
26196 <div class="thumb tright">
26197 <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>
26198 <div class="thumbcaption">
26199 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26200 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26201 </div>
26202 </div>
26203 !! html/parsoid
26204 <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>
26205 <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>
26206 <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>
26207 <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>
26208 !! end
26209
26210 !! test
26211 WTS of magic word text (T109371)
26212 !! options
26213 parsoid=html2wt
26214 !! html/parsoid
26215 <p>RFC 1234</p>
26216 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26217 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26218 !! wikitext
26219 <nowiki>RFC 1234</nowiki>
26220
26221 [http://foo.com RFC 1234]
26222
26223 [[Foo|RFC 1234]]
26224 !! end
26225
26226 !! test
26227 Edited Redirect link should emit a non-piped wikitext link
26228 !! options
26229 parsoid=html2wt
26230 !! html/parsoid
26231 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26232 !! wikitext
26233 #REDIRECT [[Bar]]
26234 !! end
26235
26236 !! test
26237 T75121: Infer extension name from typeOf if data-mw is not present
26238 !! options
26239 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26240 !! html/parsoid
26241 <div typeOf="mw:Extension/foo"></div>
26242 !! wikitext
26243 <foo />
26244 !! end
26245
26246 # Note that the <p> wrapping isn't present in PHP parser output
26247 # The important thing for this test is that P-wrapping doesn't
26248 # interfere with the <nowiki> protection for leading - in <td>
26249 # (which isn't necessary for <th>).
26250 !! test
26251 T88318: p-wrapped dash in table.
26252 !! options
26253 parsoid=html2wt,wt2wt
26254 !! html/parsoid
26255 <table><tbody>
26256 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26257 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26258 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26259 </tbody></table>
26260 !! wikitext
26261 {|
26262 !-
26263 !-
26264 |-
26265 |<nowiki>-</nowiki>
26266 |<nowiki>- </nowiki>
26267 |-
26268 |<small>-</small>
26269 |<br>
26270 -
26271 |<br>
26272 -
26273 |}
26274 !! html/php+tidy
26275 <table>
26276 <tr>
26277 <th>-</th>
26278 <th>-</th>
26279 </tr>
26280 <tr>
26281 <td>-</td>
26282 <td>-</td>
26283 </tr>
26284 <tr>
26285 <td><small>-</small></td>
26286 <td><br />
26287 <p>-</p>
26288 </td>
26289 <td><br />
26290 <p>-</p>
26291 </td>
26292 </tr>
26293 </table>
26294 !! end
26295
26296 !! test
26297 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26298 !! options
26299 parsoid=html2wt
26300 !! html/parsoid
26301 <table id='mwAb'>
26302 <td id='mwAc'>foo</td>
26303 <td id='serialize-this'>bar</td>
26304 </table>
26305 !! wikitext
26306 {|
26307 |foo
26308 | id="serialize-this" |bar
26309 |}
26310 !! end
26311
26312 !! test
26313 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26314 !! options
26315 parsoid=html2wt
26316 !! html/parsoid
26317 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26318 !! wikitext
26319 <div id="hello">ok</div>
26320 !! end
26321
26322 !! test
26323 WTS change modes
26324 !! options
26325 parsoid={
26326 "modes": ["wt2wt"],
26327 "changes": [
26328 [ "#xyz", "before", "<b>before</b> stuff " ],
26329 [ "#xyz", "after", " stuff <i>after</i>" ],
26330 [ "#xyz", "html", "x <b>y</b> z" ]
26331 ]
26332 }
26333 !! wikitext
26334 <span id="xyz">hello</span>
26335 !! wikitext/edited
26336 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26337 !! end
26338
26339 !! test
26340 Never serialize a-tag as html, regardless of what data-parsoid has to say
26341 !! options
26342 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26343 !! html/parsoid
26344 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26345 !! wikitext
26346 [[Foo]]
26347 !! end
26348
26349 ## SSS FIXME: This is broken output nevertheless.
26350 ## What might be a reasonable non-broken output for this?
26351 ## This is an edge case unlikely to be seen in production
26352 ## that I am not wasting more time on this right now.
26353 !! test
26354 Never serialize a-tag as html, no matter what attributes it has
26355 !! options
26356 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26357 !! html/parsoid
26358 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26359 !! wikitext
26360 [http://boo.org http://boohoo.org]
26361 !! end
26362
26363 # Misnested is an indication that selser can reuse the source but these have
26364 # shown to sneak through on occasion. See T101768.
26365 # The original wikitext here is: [http://test.com [[one]] two three]
26366 !! test
26367 Strip span tags added to mark misnested links
26368 !! options
26369 parsoid=html2wt
26370 !! html/parsoid
26371 <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>
26372 !! wikitext
26373 [http://test.com][[one]] two three
26374 !! end
26375
26376 !! test
26377 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26378 !! options
26379 parsoid=html2wt
26380 !! html/parsoid
26381 <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|}"]}'>
26382 <tbody><tr><td>d
26383 </td></tr>
26384 </tbody></table>
26385 !! wikitext
26386 {{echo|a}}
26387 {|{{echo|c
26388 {{!}}d
26389 }}
26390 |}
26391 !! end
26392
26393 ## This test verifies the presence and computation of this attribute indirectly
26394 ## by making an edit and ensuring that the serialization is correct (which it would be
26395 ## only if firstWikitextNode is properly set).
26396 !! test
26397 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26398 !! options
26399 parsoid= {
26400 "modes": ["wt2wt"],
26401 "changes": [
26402 [ "div#x", "remove" ],
26403 [ "div", "before", "<div>new</div>" ]
26404 ]
26405 }
26406 !! wikitext
26407 <div id="x">foo</div>
26408 {|
26409 {{echo|<div>boo</div>
26410 {{!}}b}}
26411 |c
26412 |}
26413 !! wikitext/edited
26414
26415 <div>new</div>
26416 {|
26417 {{echo|<div>boo</div>
26418 {{!}}b}}
26419 |c
26420 |}
26421 !! end
26422
26423 # --------------------------------------------
26424 # Tests spec'ing wikitext serialization norms |
26425 # --------------------------------------------
26426
26427 !! test
26428 1. Categories should always be serialized on their own line
26429 !! options
26430 parsoid=html2wt
26431 !! html/parsoid
26432 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26433 !! wikitext
26434 foo
26435 [[Category:Foo]]
26436 bar
26437 !! end
26438
26439 !! test
26440 2. Categories that are part of templates should not introduce a line break
26441 !! wikitext
26442 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26443 !! html/parsoid
26444 <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>
26445 !! end
26446
26447 # Careful while editing these next 2 tests. There are \u200f characters
26448 # before and after the <link> tags in the HTML and following some
26449 # of the categories in wikitext
26450 # Do not remove these characters in edits.
26451 #
26452 # As part of the serialization, these bidi characters will get stripped.
26453 !! test
26454 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26455 !! options
26456 parsoid={
26457 "modes": ["html2wt"],
26458 "scrubWikitext": true
26459 }
26460 !! html/parsoid
26461 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26462 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26463 !! wikitext
26464 [[קטגוריה:טקסים]]
26465 [[קטגוריה: שיטות משפט]]
26466 !! end
26467
26468 !! test
26469 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26470 !! options
26471 parsoid={
26472 "modes": ["html2wt"],
26473 "scrubWikitext": true
26474 }
26475 !! html/parsoid
26476 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26477 !! wikitext
26478 [[קטגוריה:טקסים]]
26479 ‏y
26480 !! end
26481
26482 !! test
26483 Lists: Add space after bullets
26484 !! options
26485 parsoid=html2wt
26486 !! html/parsoid
26487 <ul>
26488 <li>foo</li>
26489 <li> bar</li>
26490 <li><span> baz</span></li>
26491 </ul>
26492 !! wikitext
26493 * foo
26494 * bar
26495 * <span> baz</span>
26496 !! end
26497
26498 !! test
26499 1. Headings: Add space before/after == (T53744)
26500 !! options
26501 parsoid=html2wt
26502 !! html/parsoid
26503 <h2>foo</h2>
26504 <h2> bar</h2>
26505 <h2>baz </h2>
26506 <h2><span> baz</span></h2>
26507 !! wikitext
26508 == foo ==
26509
26510 == bar ==
26511
26512 == baz ==
26513
26514 == <span> baz</span> ==
26515 !! end
26516
26517 !! test
26518 2. Headings: Add space before/after == even after hoisted content
26519 !! options
26520 parsoid={
26521 "modes": ["html2wt"],
26522 "scrubWikitext": true
26523 }
26524 !! html/parsoid
26525 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26526 !! wikitext
26527 [[Category:A2]]
26528
26529 == ok ==
26530 !! end
26531
26532 !! test
26533 1. Headings: suppress newly created empty headings
26534 !! options
26535 parsoid={
26536 "modes": ["html2wt"],
26537 "scrubWikitext": true
26538 }
26539 !! html/parsoid
26540 <h2></h2>
26541 !! wikitext
26542 !! end
26543
26544 !! test
26545 2. Headings: don't suppress empty headings if scrubWikitext is false
26546 !! options
26547 parsoid=html2wt
26548 !! html/parsoid
26549 <h2></h2>
26550 !! wikitext
26551 ==<nowiki/>==
26552 !! end
26553
26554 !! test
26555 3. Headings: suppress empty headings on edits
26556 !! options
26557 parsoid={
26558 "modes": ["selser"],
26559 "scrubWikitext": true,
26560 "changes": [
26561 [ "#x", "remove"]
26562 ]
26563 }
26564 !! wikitext
26565 ==<span id="x">foo</span>==
26566 !! wikitext/edited
26567 !! end
26568
26569 !! test
26570 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26571 !! options
26572 parsoid={
26573 "modes": ["html2wt"],
26574 "scrubWikitext": true
26575 }
26576 !! html/parsoid
26577 <h2>foo<br/>bar</h2>
26578 <h2>foo <span><br/>bar</span> baz</h2>
26579 !! wikitext
26580 == foo bar ==
26581
26582 == foo <span> bar</span> baz ==
26583 !! end
26584
26585 !! test
26586 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26587 !! options
26588 parsoid={
26589 "modes": ["html2wt"],
26590 "scrubWikitext": false
26591 }
26592 !! html/parsoid
26593 <h2>foo<br/>bar</h2>
26594 !! wikitext
26595 == foo<br> bar ==
26596 !! end
26597
26598 !! test
26599 1. WT Quote Tags: suppress newly created empty style tags
26600 !! options
26601 parsoid={
26602 "modes": ["html2wt"],
26603 "scrubWikitext": true
26604 }
26605 !! html/parsoid
26606 <i></i><b></b>
26607 !! wikitext
26608 !! end
26609
26610 !! test
26611 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26612 !! options
26613 parsoid=html2wt
26614 !! html/parsoid
26615 <i></i><b></b>
26616 !! wikitext
26617 ''<nowiki/>'''''<nowiki/>'''
26618 !! end
26619
26620 !! test
26621 3. WT Quote Tags: suppress empty style tags on edits
26622 !! options
26623 parsoid={
26624 "modes": ["selser"],
26625 "scrubWikitext": true,
26626 "changes": [
26627 [ "#x", "remove"]
26628 ]
26629 }
26630 !! wikitext
26631 '''<span id="x">foo</span>'''
26632 !! wikitext/edited
26633 !! end
26634
26635 !! test
26636 1. Anchors: suppress newly created empty anchors
26637 !! options
26638 parsoid={
26639 "modes": ["html2wt"],
26640 "scrubWikitext": true
26641 }
26642 !! html/parsoid
26643 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26644 !! wikitext
26645 !! end
26646
26647 !! test
26648 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26649 !! options
26650 parsoid={
26651 "modes": ["html2wt"],
26652 "scrubWikitext": false
26653 }
26654 !! html/parsoid
26655 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26656 !! wikitext
26657 [[Test|<nowiki/>]]
26658 !! end
26659
26660 !! test
26661 3. Anchors: suppress empty anchors on edits
26662 !! options
26663 parsoid={
26664 "modes": ["selser"],
26665 "scrubWikitext": true,
26666 "changes": [
26667 [ "#x", "remove"]
26668 ]
26669 }
26670 !! wikitext
26671 [[Test|<span id="x">foo</span>]]
26672 !! wikitext/edited
26673 !! end
26674
26675 !! test
26676 3a. Anchors: do not suppress numbered extlinks
26677 !! options
26678 parsoid={
26679 "modes": ["wt2wt"],
26680 "scrubWikitext": true
26681 }
26682 !! wikitext
26683 [http://foo.com]
26684 !! html/parsoid
26685 <a rel="mw:ExtLink" href="http://foo.com"></a>
26686 !! end
26687
26688 !! test
26689 3b. Anchors: do not suppress numbered extlinks
26690 !! options
26691 parsoid={
26692 "modes": ["wt2wt"],
26693 "scrubWikitext": true,
26694 "changes": [
26695 [ "#x", "remove"]
26696 ]
26697 }
26698 !! wikitext
26699 [http://foo.com <span id="x">foo</span>]
26700 !! wikitext/edited
26701 [http://foo.com]
26702 !! end
26703
26704 !!test
26705 Normalizations should be restricted to edited content
26706 !!options
26707 parsoid={
26708 "modes": ["selser"],
26709 "scrubWikitext": true,
26710 "changes": [
26711 [ "h1", "before", "<i></i>"]
26712 ]
26713 }
26714 !!wikitext
26715 a
26716 = =
26717 b
26718 !!wikitext/edited
26719 a
26720 = =
26721 b
26722 !!end
26723
26724 !! test
26725 1. Multiple normalizations (html2wt)
26726 !! options
26727 parsoid={
26728 "modes": ["html2wt"],
26729 "scrubWikitext": true
26730 }
26731 !! html
26732 <h2><i></i></h2>
26733 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26734 </a><b><i></i></b>x</p>
26735 !! wikitext
26736
26737 [[foo]]
26738 x
26739
26740 !! end
26741
26742 !! test
26743 2. Multiple normalizations (selser)
26744 !! options
26745 parsoid={
26746 "modes": ["selser"],
26747 "scrubWikitext": true,
26748 "changes": [
26749 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26750 ]
26751 }
26752 !! wikitext
26753 <span id="x">foo</span>
26754 !! wikitext/edited
26755 <span id="x">foo</span>
26756
26757 x
26758 !! end
26759
26760 !! test
26761 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26762 !! options
26763 parsoid={
26764 "modes": ["html2wt"],
26765 "scrubWikitext": true
26766 }
26767 !! html/parsoid
26768 <p> hi</p>
26769 <p> hello</p>
26770 !! wikitext
26771 hi
26772
26773 hello
26774 !! end
26775
26776 !! test
26777 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26778 !! options
26779 parsoid=html2wt
26780 !! html/parsoid
26781 <p> hi</p>
26782 <p> hello</p>
26783 !! wikitext
26784 <nowiki> </nowiki>hi
26785
26786 <nowiki> </nowiki> hello
26787 !! end
26788
26789 !! test
26790 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26791 !! options
26792 parsoid={
26793 "modes": ["html2wt"],
26794 "scrubWikitext": true
26795 }
26796 !! html/parsoid
26797 <p>Foo
26798 bar
26799 baz</p>
26800
26801 <table><tr><td>Foo
26802 bar
26803 baz bang</td></tr></table>
26804
26805 <p><!--boo--> foo
26806 bar</p>
26807
26808 <p> foo
26809 bar<span>boo</span></p>
26810 !! wikitext
26811 Foo
26812 bar
26813 baz
26814
26815 {|
26816 |Foo
26817 bar
26818 baz bang
26819 |}
26820
26821 <!--boo-->foo
26822 bar
26823
26824 foo
26825 bar<span>boo</span>
26826 !! end
26827
26828 !! test
26829 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26830 !! options
26831 parsoid={
26832 "modes": ["selser"],
26833 "scrubWikitext": true,
26834 "changes": [
26835 [ "p", "html", " a\n b" ]
26836 ]
26837 }
26838 !! wikitext
26839 xyz
26840 !! wikitext/edited
26841 a
26842 b
26843 !! end
26844
26845 !! test
26846 1. New links that end in spaces
26847 !! options
26848 parsoid={
26849 "modes": ["html2wt"],
26850 "scrubWikitext": false
26851 }
26852 !! html/parsoid
26853 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26854 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26855 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26856 !! wikitext
26857 [[Berlin ]]<nowiki/>is the capital of Germany.
26858
26859 [[Foo ]]'''bar'''
26860
26861 [[Boston ]] is a city.
26862 !! end
26863
26864 !! test
26865 2. New links that end in spaces
26866 !! options
26867 parsoid={
26868 "modes": ["html2wt"],
26869 "scrubWikitext": true
26870 }
26871 !! html/parsoid
26872 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26873 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26874 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26875 !! wikitext
26876 [[Berlin]] is the capital of Germany.
26877
26878 [[Foo]] '''bar'''
26879
26880 [[Boston]] is a city.
26881 !! end
26882
26883 !! test
26884 1. Table cells with escapable prefixes
26885 !! options
26886 parsoid={
26887 "modes": ["html2wt"],
26888 "scrubWikitext": false
26889 }
26890 !! html
26891 <table>
26892 <tr><td>a</td></tr>
26893 <tr><td>-</td></tr>
26894 <tr><td>+</td></tr>
26895 </table>
26896 !! wikitext
26897 {|
26898 |a
26899 |-
26900 |<nowiki>-</nowiki>
26901 |-
26902 |<nowiki>+</nowiki>
26903 |}
26904 !! end
26905
26906 !! test
26907 2. Table cells with escapable prefixes
26908 !! options
26909 parsoid={
26910 "modes": ["html2wt"],
26911 "scrubWikitext": true
26912 }
26913 !! html
26914 <table>
26915 <tr><td>a</td></tr>
26916 <tr><td>-</td></tr>
26917 <tr><td>+</td></tr>
26918 </table>
26919 !! wikitext
26920 {|
26921 |a
26922 |-
26923 | -
26924 |-
26925 | +
26926 |}
26927 !! end
26928
26929 !! test
26930 3a. Table cells with escapable prefixes after edits
26931 !! options
26932 parsoid={
26933 "modes": ["selser"],
26934 "scrubWikitext": true,
26935 "changes": [
26936 [ "table tbody tr:first-child td:first-child", "remove"]
26937 ]
26938 }
26939 !! wikitext
26940 {|
26941 |a||-
26942 |}
26943 !! wikitext/edited
26944 {|
26945 | -
26946 |}
26947 !! end
26948
26949 !! test
26950 3b. Table cells with escapable prefixes after edits
26951 !! options
26952 parsoid={
26953 "modes": ["selser"],
26954 "scrubWikitext": true,
26955 "changes": [
26956 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26957 [ "#x", "remove" ]
26958 ]
26959 }
26960 !! wikitext
26961 {|
26962 |pqr
26963 |<span id="x">foo</span>+
26964 |}
26965 !! wikitext/edited
26966 {|
26967 | -
26968 | +
26969 |}
26970 !! end
26971
26972 # FIXME: This test will fail because
26973 # normalization doesn't realize that the id attribute
26974 # will eliminate the escapable scenario
26975 !! test
26976 4a. Table cells without escapable prefixes after edits
26977 !! options
26978 parsoid={
26979 "modes": ["selser"],
26980 "scrubWikitext": true,
26981 "changes": [
26982 [ "#x", "html", "-" ]
26983 ]
26984 }
26985 !! wikitext
26986 {|
26987 | id="x" |abcd
26988 |}
26989 !! wikitext/edited
26990 {|
26991 | id="x" |-
26992 |}
26993 !! end
26994
26995 ## This tests normalizer's ability to discriminate between
26996 ## cells having identical content.
26997 !! test
26998 4b. Table cells without escapable prefixes after edits
26999 !! options
27000 parsoid={
27001 "modes": ["selser"],
27002 "scrubWikitext": true,
27003 "changes": [
27004 [ "td", "html", "-" ]
27005 ]
27006 }
27007 !! wikitext
27008 {|
27009 |a||b
27010 |}
27011 !! wikitext/edited
27012 {|
27013 | -||-
27014 |}
27015 !! end
27016
27017 ## This tests normalizer's ability to not be tripped by
27018 ## comments (and whitespace)
27019 !! test
27020 4c. Table cells without escapable prefixes after edits
27021 !! options
27022 parsoid={
27023 "modes": ["selser"],
27024 "scrubWikitext": true,
27025 "changes": [
27026 [ "table tbody tr td:first-child", "remove" ]
27027 ]
27028 }
27029 !! wikitext
27030 {|
27031 |-
27032 <!--foo--> |a||-
27033 |}
27034 !! wikitext/edited
27035 {|
27036 |-
27037 <!--foo--> | -
27038 |}
27039 !! end
27040
27041 ## This tests normalizer's ability to handle HTML cells
27042 !! test
27043 4d. Table cells without escapable prefixes after edits
27044 !! options
27045 parsoid={
27046 "modes": ["selser"],
27047 "scrubWikitext": true,
27048 "changes": [
27049 [ "td", "html", "-" ]
27050 ]
27051 }
27052 !! wikitext
27053 <table>
27054 <tr><td>a</td></tr>
27055 </table>
27056 !! wikitext/edited
27057 <table>
27058 <tr><td>-</td></tr>
27059 </table>
27060 !! end
27061
27062 ## T111151 Remove font elements without attributes
27063 !! test
27064 5a. font tags without attributes should be dropped in scrubWikitext mode
27065 !! options
27066 parsoid={
27067 "modes": ["html2wt"],
27068 "scrubWikitext": true
27069 }
27070 !! html
27071 <font>foo</font>
27072 <font><font>bar</font></font>
27073 <font class="x">boo</font>
27074 !! wikitext
27075 foo
27076 bar
27077 <font class="x">boo</font>
27078 !! end
27079
27080 !! test
27081 5b. font tags should not be dropped without scrubWikitext being enabled
27082 !! options
27083 parsoid={
27084 "modes": ["html2wt"],
27085 "scrubWikitext": false
27086 }
27087 !! html
27088 <font>foo</font>
27089 !! wikitext
27090 <font>foo</font>
27091 !! end
27092
27093 !! test
27094 Escape nowiki DOM elements
27095 !! options
27096 parsoid=html2wt
27097 !! html/parsoid
27098 <nowiki><i>foo</i></nowiki>
27099 !! wikitext
27100 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27101 !! end
27102
27103 # This is meant to be an interim fix while we go about figuring out
27104 # how to not introduce these trailing <nowiki/>s in the first place.
27105 !! test
27106 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27107 !! options
27108 parsoid=html2wt
27109 !! html/parsoid
27110 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27111 y</p>
27112 <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>
27113 <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>
27114 !! wikitext
27115 x
27116 y
27117
27118 {{echo|
27119 1 = <nowiki/>}}
27120
27121 {{echo|
27122 1 = <nowiki/>
27123 }}
27124 !! end
27125
27126 # ---------------------------------------------------
27127 # End of tests spec'ing wikitext serialization norms |
27128 # ---------------------------------------------------
27129
27130 # T104032
27131 !! test
27132 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27133 !! options
27134 parsoid=html2wt
27135 !! html/parsoid
27136 a<p>b</p>
27137 <b>c</b><p>d</p>
27138 <table><tr>
27139 <td>a<p>b</p></td>
27140 <td><b>c</b><p>d</p></td>
27141 </tr></table>
27142 !! wikitext
27143 a
27144
27145 b
27146
27147 '''c'''
27148
27149 d
27150 {|
27151 |a
27152 b
27153 |'''c'''
27154 d
27155 |}
27156 !! end
27157
27158 # -----------------------------------------------------------------
27159 # End of section for Parsoid-only html2wt tests for serialization
27160 # of new content
27161 # -----------------------------------------------------------------
27162
27163 # -----------------------------------------------------------------
27164 # The following section of tests are primarily to spec behavior of
27165 # the selective serializer. All these tests have manual selser
27166 # changes. The automated selser changes for all tests handle the
27167 # wide variation of changes, but these tests here capture specs
27168 # deterministically.
27169 # ----------------------------------------------------------------
27170
27171 ## T90517
27172 !! test
27173 Selser: New comments should not be lost
27174 !! options
27175 parsoid={
27176 "modes": ["selser"],
27177 "changes": [
27178 [ "#a", "after", "<!--c1-->" ],
27179 [ "#b", "before", "<!--c2-->" ]
27180 ]
27181 }
27182 !! wikitext
27183 <span id="a">a</span>
27184
27185 <span id="b">b</span>
27186 !! wikitext/edited
27187 <span id="a">a</span><!--c1-->
27188
27189 <!--c2--><span id="b">b</span>
27190 !! end
27191
27192 ## T89383
27193 !! test
27194 Selser: Check for validity of DSR before using it
27195 !! options
27196 parsoid={
27197 "modes": ["selser"],
27198 "changes": [
27199 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27200 ]
27201 }
27202 !! wikitext
27203 <span id="a">a</span>
27204 !! wikitext/edited
27205 {{DISPLAYTITLE:foo}}
27206 <span id="a">a</span>
27207 !! end
27208
27209 !! test
27210 1. DOMDiff: Changes to <ref> content should be looked up using id
27211 !! options
27212 parsoid={
27213 "modes": ["selser"],
27214 "changes": [
27215 ["#X", "after", "bar"],
27216 ["#Y", "after", "baz"]
27217 ]
27218 }
27219 !! wikitext
27220 X <ref><span id="X">foo</span></ref>
27221 Y <ref name="a" />
27222 <references>
27223 <ref name="a"><span id="Y">foo</span></ref>
27224 </references>
27225 !! wikitext/edited
27226 X <ref><span id="X">foo</span>bar</ref>
27227 Y <ref name="a" />
27228 <references>
27229 <ref name="a"><span id="Y">foo</span>baz</ref>
27230 </references>
27231 !! end
27232
27233 !! test
27234 2. DOMDiff: Changes to <ref> content should be looked up using id
27235 !! options
27236 parsoid={
27237 "modes": ["selser"],
27238 "changes": [
27239 ["#Z", "after", "bar"]
27240 ]
27241 }
27242 !! wikitext
27243 A <ref>foo bar for a</ref>
27244 B <ref group="X" name="b" />
27245
27246 <references />
27247
27248 <references group="X">
27249 <ref name="b"><span id="Z">foo</span></ref>
27250 </references>
27251 !! wikitext/edited
27252 A <ref>foo bar for a</ref>
27253 B <ref group="X" name="b" />
27254
27255 <references />
27256
27257 <references group="X">
27258 <ref name="b"><span id="Z">foo</span>bar</ref>
27259 </references>
27260 !! end
27261
27262 !! test
27263 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27264 !! options
27265 parsoid={
27266 "modes": ["selser"],
27267 "changes": [
27268 [ "div:first-child", "text", "bar" ]
27269 ]
27270 }
27271 !! wikitext
27272 <div style="{{1x|color:red;}}%">foo</div>
27273 !! wikitext/edited
27274 <div style="{{1x|color:red;}}%">bar</div>
27275 !! end
27276
27277 !! test
27278 Empty LI (T49673)
27279 !! wikitext
27280 * a
27281 *
27282 *
27283 * b
27284 !! html/php+tidy
27285 <ul>
27286 <li>a</li>
27287 <li class="mw-empty-elt"></li>
27288 <li class="mw-empty-elt"></li>
27289 <li>b</li>
27290 </ul>
27291 !! end
27292
27293 !! test
27294 Thumbnail output
27295 !! wikitext
27296 [[File:Thumb.png|thumb]]
27297 !! html/php+tidy
27298 <div class="thumb tright">
27299 <div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>
27300 <div class="thumbcaption">
27301 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27302 </div>
27303 </div>
27304 </div>
27305 !! end
27306
27307 !! test
27308 unclosed internal link XSS (T137264)
27309 !! wikitext
27310 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27311 !! html/php
27312 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27313 </p>
27314 !! html/parsoid
27315 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27316 !! end