SECURITY: XSS in unclosed internal links
[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 3a. Indent-Pre and block tags (single-line html)
3060 !! wikitext
3061 a <p> foo </p>
3062 b <div> foo </div>
3063 c <blockquote> foo </blockquote>
3064 <span> foo </span>
3065 !! html
3066 a <p> foo </p>
3067 b <div> foo </div>
3068 c <blockquote> foo </blockquote>
3069 <pre><span> foo </span>
3070 </pre>
3071 !! html/parsoid
3072 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3073 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3074 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3075 <pre><span> foo </span>
3076 </pre>
3077 !! html+tidy
3078 <p>a</p>
3079 <p>foo</p>
3080 <p>b</p>
3081 <div>foo</div>
3082 <p>c</p>
3083 <blockquote>
3084 <p>foo</p>
3085 </blockquote>
3086 <pre>
3087 <span> foo </span>
3088 </pre>
3089 !! end
3090
3091 !!test
3092 3b. Indent-Pre and block tags (multi-line html)
3093 !! wikitext
3094 a <span>foo</span>
3095 b <div> foo </div>
3096 !! html
3097 <pre>a <span>foo</span>
3098 </pre>
3099 b <div> foo </div>
3100
3101 !! html/parsoid
3102 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3103 b <div data-parsoid='{"stx":"html"}'> foo </div>
3104 !! html+tidy
3105 <pre>
3106 a <span>foo</span>
3107 </pre>
3108 <p>b</p>
3109 <div>foo</div>
3110 !!end
3111
3112 !!test
3113 3c. Indent-Pre and block tags (pre-content on separate line)
3114 !! wikitext
3115 <p>
3116 foo
3117 </p>
3118
3119 <div>
3120 foo
3121 </div>
3122
3123 <center>
3124 foo
3125 </center>
3126
3127 <blockquote>
3128 foo
3129 </blockquote>
3130
3131 <blockquote>
3132 <pre>
3133 foo
3134 </pre>
3135 </blockquote>
3136
3137 <table><tr><td>
3138 foo
3139 </td></tr></table>
3140
3141 <ul><li>
3142 foo
3143 </li></ul>
3144
3145 !! html
3146 <p>
3147 foo
3148 </p>
3149 <div>
3150 <pre>foo
3151 </pre>
3152 </div>
3153 <center>
3154 <pre>foo
3155 </pre>
3156 </center>
3157 <blockquote>
3158 <p> foo
3159 </p>
3160 </blockquote>
3161 <blockquote>
3162 <pre>
3163 foo
3164 </pre>
3165 </blockquote>
3166 <table><tr><td>
3167 <pre>foo
3168 </pre>
3169 </td></tr></table>
3170 <ul><li>
3171 foo
3172 </li></ul>
3173
3174 !!end
3175
3176 !!test
3177 4. Indent-Pre and extension tags
3178 !! wikitext
3179 a <gallery>
3180 File:foobar.jpg
3181 </gallery>
3182 !! html
3183 a <ul class="gallery mw-gallery-traditional">
3184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3185 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3186 <div class="gallerytext">
3187 </div>
3188 </div></li>
3189 </ul>
3190
3191 !! html+tidy
3192 <p>a</p>
3193 <ul class="gallery mw-gallery-traditional">
3194 <li class="gallerybox" style="width: 155px">
3195 <div style="width: 155px">
3196 <div class="thumb" style="width: 150px;">
3197 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3198 </div>
3199 <div class="gallerytext"></div>
3200 </div>
3201 </li>
3202 </ul>
3203 !!end
3204
3205 !! test
3206 Table wikitext syntax outside wiki-tables
3207 !! wikitext
3208 a
3209 ! not a table heading
3210 |- not a table row
3211 | not a table cell
3212 | class="foo bar" | baz
3213 b
3214 |}
3215 |-
3216 c
3217 !! html
3218 <p>a
3219 ! not a table heading
3220 |- not a table row
3221 | not a table cell
3222 | class="foo bar" | baz
3223 b
3224 |}
3225 |-
3226 c
3227 </p>
3228 !! end
3229
3230 !!test
3231 Render paragraphs when indent-pre is suppressed in blocklevels
3232 !! wikitext
3233 <blockquote>
3234 foo
3235
3236 bar
3237 </blockquote>
3238 !! html
3239 <blockquote>
3240 <p> foo
3241 </p><p> bar
3242 </p>
3243 </blockquote>
3244
3245 !!end
3246
3247 !!test
3248 4. Multiple spaces at start-of-line
3249 !! wikitext
3250 <p> foo </p>
3251 foo
3252 {|
3253 |foo
3254 |}
3255 !! html
3256 <p> foo </p>
3257 <pre> foo
3258 </pre>
3259 <table>
3260 <tr>
3261 <td>foo
3262 </td></tr></table>
3263
3264 !!end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5a. White-space in indent-pre
3269 !! wikitext
3270 a<br />
3271
3272 b
3273 !! html
3274 <pre>a<br />
3275
3276 b
3277 </pre>
3278 !! end
3279
3280 ## NOTE: the leading white-space chars on empty line are significant
3281 !! test
3282 5b. White-space in indent-pre
3283 !! wikitext
3284 a
3285
3286 b
3287
3288
3289 c
3290 !! html
3291 <pre>a
3292
3293 b
3294
3295
3296 c
3297 </pre>
3298 !! end
3299
3300 !! test
3301 5c. White-space in indent-pre
3302 !! wikitext
3303 ''a''
3304 ''b''
3305 ''c''
3306 !! html
3307 <pre><i>a</i>
3308 <i>b</i>
3309 <i>c</i>
3310 </pre>
3311 !! end
3312
3313 !! test
3314 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3315 !! wikitext
3316 a
3317
3318 <!-- continue -->
3319 b
3320
3321 c
3322
3323 d
3324 !! html
3325 <pre>a
3326
3327 b
3328 </pre>
3329 <pre>c
3330
3331 </pre>
3332 <p>d
3333 </p>
3334 !! end
3335
3336 !! test
3337 7a. Indent-pre and category links
3338 !! options
3339 parsoid=wt2html,wt2wt
3340 !! wikitext
3341 [[Category:foo]] <!-- No pre-wrapping -->
3342 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3343 !! html/php+tidy
3344 !! html/parsoid
3345 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3346 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3347 !! end
3348
3349 ## We used to, but no longer wt2wt this test since the default serializer
3350 ## will normalize all categories to serialize on their own line.
3351 ## This wikitext usage is going to be fairly uncommon in production and
3352 ## selser will take care of preserving formatting in those scenarios.
3353 !! test
3354 7b. Indent-pre and category links
3355 !! options
3356 parsoid=wt2html
3357 !! wikitext
3358 [[Category:foo]] a
3359 [[Category:foo]] {{echo|b}}
3360 !! html/parsoid
3361 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3362 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3363 !! end
3364
3365 !! test
3366 Indent-Pre: Newlines in comments shouldn't affect sol state
3367 !! wikitext
3368 a <!--
3369 foo
3370 --> b
3371 !! html/php+tidy
3372 <p>a b</p>
3373 !! html/parsoid
3374 <p>a <!--
3375 foo
3376 --> b</p>
3377 !! end
3378
3379 ###
3380 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3381 ###
3382
3383 !!test
3384 HTML-pre: 1. embedded newlines
3385 !! wikitext
3386 <pre>foo</pre>
3387
3388 <pre>
3389 foo
3390 </pre>
3391
3392 <pre>
3393
3394 foo
3395 </pre>
3396
3397 <pre>
3398
3399
3400 foo
3401 </pre>
3402 !! html/php+tidy
3403 <pre>
3404 foo
3405 </pre>
3406 <pre>
3407 foo
3408 </pre>
3409 <pre>
3410
3411 foo
3412 </pre>
3413 <pre>
3414
3415
3416 foo
3417 </pre>
3418 !! html/parsoid
3419 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3420
3421 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3422 foo
3423 </pre>
3424
3425 <pre data-parsoid='{"stx":"html"}'>
3426
3427 foo
3428 </pre>
3429
3430 <pre data-parsoid='{"stx":"html"}'>
3431
3432
3433 foo
3434 </pre>
3435 !!end
3436
3437 !! test
3438 HTML-pre: big spaces
3439 !! wikitext
3440 <pre>
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 haha
3451
3452
3453
3454
3455 </pre>
3456 !! html/php+tidy
3457 <pre>
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 haha
3468
3469
3470
3471
3472 </pre>
3473 !! html/parsoid
3474 <pre data-parsoid='{"stx":"html"}'>
3475
3476
3477
3478
3479 haha
3480
3481
3482
3483
3484 haha
3485
3486
3487
3488
3489 </pre>
3490 !! end
3491
3492 !!test
3493 HTML-pre: 2: indented text
3494 !! wikitext
3495 <pre>
3496 foo
3497 </pre>
3498 !! html
3499 <pre>
3500 foo
3501 </pre>
3502
3503 !!end
3504
3505 !!test
3506 HTML-pre: 3: other wikitext
3507 !! wikitext
3508 <pre>
3509 * foo
3510 # bar
3511 = no-h =
3512 '' no-italic ''
3513 [[ NoLink ]]
3514 </pre>
3515 !! html/php
3516 <pre>
3517 * foo
3518 # bar
3519 = no-h =
3520 '' no-italic ''
3521 [[ NoLink ]]
3522 </pre>
3523
3524 !! html/parsoid
3525 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3526 # bar
3527 = no-h =
3528 '' no-italic ''
3529 [[ NoLink ]]
3530 </pre>
3531 !!end
3532
3533 ###
3534 ### Definition lists
3535 ###
3536 !! test
3537 Simple definition
3538 !! wikitext
3539 ; name : Definition
3540 !! html
3541 <dl><dt> name&#160;</dt>
3542 <dd> Definition</dd></dl>
3543
3544 !! end
3545
3546 !! test
3547 Definition list for indentation only
3548 !! wikitext
3549 : Indented text
3550 !! html
3551 <dl><dd> Indented text</dd></dl>
3552
3553 !! end
3554
3555 !! test
3556 Definition list with no space
3557 !! wikitext
3558 ;name:Definition
3559 !! html
3560 <dl><dt>name</dt>
3561 <dd>Definition</dd></dl>
3562
3563 !!end
3564
3565 !! test
3566 Definition list with URL link
3567 !! wikitext
3568 ; http://example.com/ : definition
3569 !! html
3570 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3571 <dd> definition</dd></dl>
3572
3573 !! end
3574
3575 !! test
3576 Definition list with bracketed URL link
3577 !! wikitext
3578 ;[http://www.example.com/ Example]:Something about it
3579 !! html
3580 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3581 <dd>Something about it</dd></dl>
3582
3583 !! end
3584
3585 !! test
3586 Definition list with wikilink containing colon
3587 !! wikitext
3588 ; [[Help:FAQ]]: The least-read page on Wikipedia
3589 !! html
3590 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3591 <dd> The least-read page on Wikipedia</dd></dl>
3592
3593 !! end
3594
3595 # At Brion's and JeLuF's insistence... :)
3596 !! test
3597 Definition list with news link containing colon
3598 !! wikitext
3599 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3600 !! html/php
3601 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3602 <dd> This isn't even a real newsgroup!</dd></dl>
3603
3604 !! html/parsoid
3605 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3606 !! end
3607
3608 !! test
3609 Malformed definition list with colon
3610 !! wikitext
3611 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3612 !! html
3613 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3614
3615 !! end
3616
3617 !! test
3618 Definition lists: colon in external link text
3619 !! wikitext
3620 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3621 !! html
3622 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3623 <dd> OK, I made that up</dd></dl>
3624
3625 !! end
3626
3627 !! test
3628 Definition lists: colon in HTML attribute
3629 !! wikitext
3630 ;<b style="display: inline">bold</b>
3631 !! html
3632 <dl><dt><b style="display: inline">bold</b></dt></dl>
3633
3634 !! end
3635
3636 !! test
3637 Definition lists: self-closed tag
3638 !! wikitext
3639 ;one<br/>two : two-line fun
3640 !! html
3641 <dl><dt>one<br />two&#160;</dt>
3642 <dd> two-line fun</dd></dl>
3643
3644 !! end
3645
3646 !! test
3647 Bug 11748: Literal closing tags
3648 !! wikitext
3649 <dl>
3650 <dt>test 1</dt>
3651 <dd>test test test test test</dd>
3652 <dt>test 2</dt>
3653 <dd>test test test test test</dd>
3654 </dl>
3655 !! html
3656 <dl>
3657 <dt>test 1</dt>
3658 <dd>test test test test test</dd>
3659 <dt>test 2</dt>
3660 <dd>test test test test test</dd>
3661 </dl>
3662
3663 !! end
3664
3665 !! test
3666 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3667 !! wikitext
3668 <ul><li>
3669 ; term : description
3670 * unordered
3671 </li></ul>
3672 !! html
3673 <ul><li>
3674 <dl><dt> term&#160;</dt>
3675 <dd> description</dd></dl>
3676 <ul><li> unordered</li></ul>
3677 </li></ul>
3678
3679 !! end
3680
3681 !! test
3682
3683 Definition list with empty definition and following paragraph
3684 !! wikitext
3685 ; term:
3686 Paragraph text
3687 !! html
3688 <dl><dt> term</dt>
3689 <dd></dd></dl>
3690 <p>Paragraph text
3691 </p>
3692 !! end
3693
3694 !! test
3695 Nested definition lists using html syntax
3696 !! wikitext
3697 <dl><dt>x</dt>
3698 <dd>a</dd>
3699 <dd>b</dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: No nesting: Multiple dd's
3705 !! wikitext
3706 ;x
3707 :a
3708 :b
3709 !! html
3710 <dl><dt>x</dt>
3711 <dd>a</dd>
3712 <dd>b</dd></dl>
3713
3714 !! end
3715
3716 !! test
3717 Definition Lists: Indentation: Regular
3718 !! wikitext
3719 :i1
3720 ::i2
3721 :::i3
3722 !! html
3723 <dl><dd>i1
3724 <dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Missing 1st level
3731 !! wikitext
3732 ::i2
3733 :::i3
3734 !! html
3735 <dl><dd><dl><dd>i2
3736 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3737
3738 !! end
3739
3740 !! test
3741 Definition Lists: Indentation: Multi-level indent
3742 !! wikitext
3743 :::i3
3744 !! html
3745 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3746
3747 !! end
3748
3749 !! test
3750 Definition Lists: Hacky use to indent tables
3751 !! wikitext
3752 ::{|
3753 |foo
3754 |bar
3755 |}
3756 this text
3757 should be left alone
3758 !! html
3759 <dl><dd><dl><dd><table>
3760 <tr>
3761 <td>foo
3762 </td>
3763 <td>bar
3764 </td></tr></table></dd></dl></dd></dl>
3765 <p>this text
3766 should be left alone
3767 </p>
3768 !! end
3769
3770 !! test
3771 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3772 !! wikitext
3773 <!-- foo -->
3774 ::{|
3775 |foo
3776 |bar
3777 |}<!-- bar -->
3778 this text
3779 should be left alone
3780 !! html/parsoid
3781 <!-- foo -->
3782 <dl><dd><dl><dd><table><tr>
3783 <td>foo</td>
3784 <td>bar</td>
3785 </tr></table><!-- bar --></dd></dl></dd></dl>
3786 <p>this text
3787 should be left alone</p>
3788 !! end
3789
3790 !! test
3791 Definition Lists: Hacky use to indent tables, with comment before table
3792 !! wikitext
3793 ::<!-- foo -->{|
3794 |foo
3795 |}
3796 !! html/parsoid
3797 <dl><dd><dl><dd><!-- foo --><table><tr>
3798 <td>foo</td>
3799 </tr></table></dd></dl></dd></dl>
3800 !! end
3801
3802 # The trailing whitespace in this test is to catch a regression in
3803 # Parsoid after T54473.
3804 !! test
3805 Definition Lists: Hacky use to indent tables (WS-insensitive)
3806 !! wikitext
3807 : {|
3808 |a
3809 |}
3810 !! html/php
3811 <dl><dd><table>
3812 <tr>
3813 <td>a
3814 </td></tr></table></dd></dl>
3815
3816 !! html/parsoid
3817 <dl><dd> <table>
3818 <tbody><tr><td>a</td></tr>
3819 </tbody></table> </dd></dl>
3820 !! end
3821
3822 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3823 ## as an empty dt item. It also ignores all but the last ";" when followed
3824 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3825 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3826 ## ";"s.
3827 ##
3828 ## Ex: ";;t2 ::d2" is transformed into:
3829 ##
3830 ## <dl>
3831 ## <dt>t2 </dt>
3832 ## <dd>
3833 ## <dl>
3834 ## <dt></dt>
3835 ## <dd>d2</dd>
3836 ## </dl>
3837 ## </dd>
3838 ## </dl>
3839 ##
3840 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3841 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3842 ##
3843 ## <dl>
3844 ## <dt>
3845 ## <dl>
3846 ## <dt>t2 </dt>
3847 ## <dd>:d2</dd>
3848 ## </dl>
3849 ## </dt>
3850 ## </dl>
3851 ##
3852 ## All Parsoid only definition list tests have this difference.
3853 ##
3854 ## See also: https://phabricator.wikimedia.org/T8569
3855 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3856
3857 !! test
3858 Table / list interaction: indented table with lists in table contents
3859 !! wikitext
3860 :{|
3861 |-
3862 | a
3863 * b
3864 |-
3865 | c
3866 * d
3867 |}
3868 !! html
3869 <dl><dd><table>
3870
3871 <tr>
3872 <td> a
3873 <ul><li> b</li></ul>
3874 </td></tr>
3875 <tr>
3876 <td> c
3877 <ul><li> d</li></ul>
3878 </td></tr></table></dd></dl>
3879
3880 !! end
3881
3882 !!test
3883 Table / list interaction: lists nested in tables nested in indented lists
3884 !! wikitext
3885 :{|
3886 |
3887 :a
3888 :b
3889 |
3890 *c
3891 *d
3892 |}
3893
3894 *e
3895 *f
3896 !! html
3897 <dl><dd><table>
3898 <tr>
3899 <td>
3900 <dl><dd>a</dd>
3901 <dd>b</dd></dl>
3902 </td>
3903 <td>
3904 <ul><li>c</li>
3905 <li>d</li></ul>
3906 </td></tr></table></dd></dl>
3907 <ul><li>e</li>
3908 <li>f</li></ul>
3909
3910 !!end
3911
3912 !! test
3913 Definition Lists: Nesting: Multi-level (Parsoid only)
3914 !! options
3915 parsoid
3916 !! wikitext
3917 ;t1 :d1
3918 ;;t2 ::d2
3919 ;;;t3 :::d3
3920 !! html
3921 <dl>
3922 <dt>t1 </dt>
3923 <dd>d1</dd>
3924 <dt>
3925 <dl>
3926 <dt>t2 </dt>
3927 <dd>:d2</dd>
3928 <dt>
3929 <dl>
3930 <dt>t3 </dt>
3931 <dd>::d3</dd>
3932 </dl>
3933 </dt>
3934 </dl>
3935 </dt>
3936 </dl>
3937
3938
3939 !! end
3940
3941
3942 !! test
3943 Definition Lists: Nesting: Test 2 (Parsoid only)
3944 !! wikitext
3945 ;t1
3946 ::d2
3947 !! html/php+tidy
3948 <dl>
3949 <dt>t1</dt>
3950 <dd>
3951 <dl>
3952 <dd>d2</dd>
3953 </dl>
3954 </dd>
3955 </dl>
3956 !! html/parsoid
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965
3966 !! end
3967
3968
3969 !! test
3970 Definition Lists: Nesting: Test 3 (Parsoid only)
3971 !! wikitext
3972 :;t1
3973 ::::d2
3974 !! html/php+tidy
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dt>t1</dt>
3979 <dd>
3980 <dl>
3981 <dd>
3982 <dl>
3983 <dd>d2</dd>
3984 </dl>
3985 </dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 </dd>
3990 </dl>
3991 !! html/parsoid
3992 <dl>
3993 <dd>
3994 <dl>
3995 <dt>t1</dt>
3996 <dd>
3997 <dl>
3998 <dd>
3999 <dl>
4000 <dd>d2</dd>
4001 </dl>
4002 </dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 </dd>
4007 </dl>
4008
4009 !! end
4010
4011
4012 !! test
4013 Definition Lists: Nesting: Test 4
4014 !! wikitext
4015 ::;t3
4016 :::d3
4017 !! html
4018 <dl><dd><dl><dd><dl><dt>t3</dt>
4019 <dd>d3</dd></dl></dd></dl></dd></dl>
4020
4021 !! end
4022
4023
4024 ## The Parsoid team believes the following three test exposes a
4025 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4026 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4027 ## It also exposes a "misfeature" in tidy, which doesn't like
4028 ## <dl> tags with a single <dt> child; it converts the <dt> into
4029 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4030 !! test
4031 Definition Lists: Mixed Lists: Test 1
4032 !! wikitext
4033 :;* foo
4034 ::* bar
4035 :; baz
4036 !! html/php
4037 <dl><dd><dl><dt><ul><li> foo</li>
4038 <li> bar</li></ul></dt></dl>
4039 <dl><dt> baz</dt></dl></dd></dl>
4040
4041 !! html/php+tidy
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dd>
4046 <ul>
4047 <li>foo</li>
4048 <li>bar</li>
4049 </ul>
4050 </dd>
4051 </dl>
4052 <dl>
4053 <dt>baz</dt>
4054 </dl>
4055 </dd>
4056 </dl>
4057 !! html/parsoid
4058 <dl>
4059 <dd><dl>
4060 <dt><ul>
4061 <li> foo
4062 </li>
4063 </ul></dt>
4064 <dd><ul>
4065 <li> bar
4066 </li>
4067 </ul></dd>
4068 <dt> baz</dt>
4069 </dl></dd>
4070 </dl>
4071 !! end
4072
4073 !! test
4074 Definition Lists: Mixed Lists: Test 2
4075 !! wikitext
4076 *: d1
4077 *: d2
4078 !! html
4079 <ul><li><dl><dd> d1</dd>
4080 <dd> d2</dd></dl></li></ul>
4081
4082 !! end
4083
4084
4085 !! test
4086 Definition Lists: Mixed Lists: Test 3
4087 !! wikitext
4088 *::: d1
4089 *::: d2
4090 !! html
4091 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4092 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 4
4099 !! wikitext
4100 *;d1 :d2
4101 *;d3 :d4
4102 !! html
4103 <ul><li><dl><dt>d1&#160;</dt>
4104 <dd>d2</dd>
4105 <dt>d3&#160;</dt>
4106 <dd>d4</dd></dl></li></ul>
4107
4108 !! end
4109
4110
4111 !! test
4112 Definition Lists: Mixed Lists: Test 5
4113 !! wikitext
4114 *:d1
4115 *:: d2
4116 !! html
4117 <ul><li><dl><dd>d1
4118 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4119
4120 !! end
4121
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 6
4125 !! wikitext
4126 #*:d1
4127 #*::: d3
4128 !! html
4129 <ol><li><ul><li><dl><dd>d1
4130 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 7
4137 !! wikitext
4138 :* d1
4139 :* d2
4140 !! html
4141 <dl><dd><ul><li> d1</li>
4142 <li> d2</li></ul></dd></dl>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 8
4149 !! wikitext
4150 :* d1
4151 ::* d2
4152 !! html
4153 <dl><dd><ul><li> d1</li></ul>
4154 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 9
4161 !! wikitext
4162 *;foo :bar
4163 !! html
4164 <ul><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ul>
4166
4167 !! end
4168
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 10
4172 !! wikitext
4173 *#;foo :bar
4174 !! html
4175 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4176 <dd>bar</dd></dl></li></ol></li></ul>
4177
4178 !! end
4179
4180 # The Parsoid team disagrees with the PHP parser's seemingly-random
4181 # rules regarding dd/dt on the next two tests. Parsoid is more
4182 # consistent, and recognizes the shared nesting and keeps the
4183 # still-open tags around until the nesting is complete.
4184 # (And tidy again converts <dt> to <dd> before 'bar'.)
4185
4186 !! test
4187 Definition Lists: Mixed Lists: Test 11
4188 !! wikitext
4189 *#*#;*;;foo :bar
4190 *#*#;boo :baz
4191 !! html/php
4192 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4193 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4194 <dl><dt>boo&#160;</dt>
4195 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4196
4197 !! html/php+tidy
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>foo&#160;</dt>
4208 <dd>
4209 <ul>
4210 <li>
4211 <dl>
4212 <dd>
4213 <dl>
4214 <dt>bar</dt>
4215 </dl>
4216 </dd>
4217 </dl>
4218 </li>
4219 </ul>
4220 </dd>
4221 </dl>
4222 <dl>
4223 <dt>boo&#160;</dt>
4224 <dd>baz</dd>
4225 </dl>
4226 </li>
4227 </ol>
4228 </li>
4229 </ul>
4230 </li>
4231 </ol>
4232 </li>
4233 </ul>
4234 !! html/parsoid
4235 <ul>
4236 <li>
4237 <ol>
4238 <li>
4239 <ul>
4240 <li>
4241 <ol>
4242 <li>
4243 <dl>
4244 <dt>
4245 <ul>
4246 <li>
4247 <dl>
4248 <dt>
4249 <dl>
4250 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4251 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4252 </dl></dt>
4253 </dl></li>
4254 </ul></dt>
4255 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4256 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4257 </dl></li>
4258 </ol></li>
4259 </ul></li>
4260 </ol></li>
4261 </ul>
4262 !! end
4263
4264
4265 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4266 # From whitelist:
4267 # * The test is wrong, there are two colons where there should be :;
4268 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4269 !! test
4270 Definition Lists: Weird Ones: Test 1
4271 !! wikitext
4272 *#;*::;; foo : bar (who uses this?)
4273 !! html/php
4274 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4275 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4276
4277 !! html/php+tidy
4278 <ul>
4279 <li>
4280 <ol>
4281 <li>
4282 <dl>
4283 <dt>foo&#160;</dt>
4284 <dd>
4285 <ul>
4286 <li>
4287 <dl>
4288 <dd>
4289 <dl>
4290 <dd>
4291 <dl>
4292 <dd>
4293 <dl>
4294 <dt>bar (who uses this?)</dt>
4295 </dl>
4296 </dd>
4297 </dl>
4298 </dd>
4299 </dl>
4300 </dd>
4301 </dl>
4302 </li>
4303 </ul>
4304 </dd>
4305 </dl>
4306 </li>
4307 </ol>
4308 </li>
4309 </ul>
4310 !! html/parsoid
4311 <ul>
4312 <li>
4313 <ol>
4314 <li>
4315 <dl>
4316 <dt>
4317 <ul>
4318 <li>
4319 <dl>
4320 <dd>
4321 <dl>
4322 <dd>
4323 <dl>
4324 <dt>
4325 <dl>
4326 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4327 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4328 </dl></dt>
4329 </dl></dd>
4330 </dl></dd>
4331 </dl></li>
4332 </ul></dt>
4333 </dl></li>
4334 </ol></li>
4335 </ul>
4336 !! end
4337
4338 !! test
4339 Definition Lists: colons occurring in tags
4340 !! wikitext
4341 ;a:b
4342 ;'''a:b'''
4343 ;<i>a:b</i>
4344 ;<span>a:b</span>
4345 ;<div>a:b</div>
4346 ;<div>a
4347 :b</div>
4348 ;{{echo|a:b}}
4349 ;{{echo|''a:b''}}
4350 ;;;''a:b''
4351 !! html+tidy
4352 <dl>
4353 <dt>a</dt>
4354 <dd>b</dd>
4355 <dt><b>a:b</b></dt>
4356 <dt><i>a:b</i></dt>
4357 <dt><span>a:b</span></dt>
4358 <dd>
4359 <div>a:b</div>
4360 </dd>
4361 <dd>
4362 <div>a
4363 <dl>
4364 <dd>b</dd>
4365 </dl>
4366 </div>
4367 </dd>
4368 <dt>a</dt>
4369 <dd>b</dd>
4370 <dt><i>a:b</i></dt>
4371 </dl>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dd>
4376 <dl>
4377 <dt><i>a:b</i></dt>
4378 </dl>
4379 </dd>
4380 </dl>
4381 </dd>
4382 </dl>
4383 !! html/parsoid
4384 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4385 <dt><b>a:b</b></dt>
4386 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4387 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4388 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4389 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4390 <dd>b</dd>
4391 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4392 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4393 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4394 !! end
4395
4396 !! test
4397 Definition Lists: colons and tables 1
4398 !! wikitext
4399 :{|
4400 | x
4401 |}
4402 :{|
4403 | y
4404 |}
4405 !! html
4406 <dl><dd><table>
4407 <tr>
4408 <td> x
4409 </td></tr></table></dd></dl>
4410 <dl><dd><table>
4411 <tr>
4412 <td> y
4413 </td></tr></table></dd></dl>
4414
4415 !! end
4416
4417 # Parsoid's output (as documented below) differs from php's in this case.
4418 # This is probably a bug. If we fixup parsoid to match php's output, the
4419 # above test should pass and the below test case can be removed. It is
4420 # unclear which output is more desirable.
4421
4422 !! test
4423 Definition Lists: colons and tables 2
4424 !! wikitext
4425 :{|
4426 | x
4427 |}
4428 :{|
4429 | y
4430 |}
4431 !! html/parsoid
4432 <dl><dd><table>
4433 <tr>
4434 <td> x
4435 </td></tr></table></dd>
4436 <dd><table>
4437 <tr>
4438 <td> y
4439 </td></tr></table></dd></dl>
4440 !! end
4441
4442 !! test
4443 Definition Lists: template interaction
4444 !! wikitext
4445 ::{{definition_list}}
4446
4447 :one
4448 ::{{definition_list}}
4449 :::two
4450 :::three
4451 ::four
4452 !! html/parsoid
4453 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4454 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4455
4456 <dl><dd data-parsoid='{}'>one
4457 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4458 </span><dd about="#mwt2">two
4459 <dl><dd>two</dd>
4460 <dd>three</dd></dl></dd>
4461 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4462 !! end
4463
4464
4465 ###
4466 ### External links
4467 ###
4468 !! test
4469 External links: non-bracketed
4470 !! wikitext
4471 Non-bracketed: http://example.com
4472 !! html
4473 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4474 </p>
4475 !! end
4476
4477 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4478 !! test
4479 External links: numbered
4480 !! wikitext
4481 Numbered: [http://example.com]
4482 Numbered: [http://example.net]
4483 Numbered: [http://example.com]
4484 !! html/php
4485 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4486 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4487 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4488 </p>
4489 !! html/parsoid
4490 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4491 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4492 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4493 !!end
4494
4495 !! test
4496 External links: specified text
4497 !! wikitext
4498 Specified text: [http://example.com link]
4499 !! html
4500 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4501 </p>
4502 !!end
4503
4504 !! test
4505 External links: trail
4506 !! wikitext
4507 Linktrails should not work for external links: [http://example.com link]s
4508 !! html
4509 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4510 </p>
4511 !! end
4512
4513 !! test
4514 External links: dollar sign in URL
4515 !! wikitext
4516 http://example.com/1$2345
4517 !! html
4518 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4519 </p>
4520 !! end
4521
4522 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4523 !! test
4524 External links: dollar sign in URL (autonumber)
4525 !! wikitext
4526 [http://example.com/1$2345]
4527 !! html/php
4528 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4529 </p>
4530 !! html/parsoid
4531 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4532 !!end
4533
4534 !! test
4535 External links: open square bracket forbidden in URL (bug 4377)
4536 !! options
4537 parsoid=wt2html,wt2wt,html2html
4538 !! wikitext
4539 http://example.com/1[2345
4540 !! html/php
4541 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4542 </p>
4543 !! html/parsoid
4544 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4545 !! end
4546
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 !! options
4550 parsoid=wt2html,html2html
4551 !! wikitext
4552 [http://example.com/1[2345]
4553 !! html/php
4554 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4555 </p>
4556 !! html/parsoid
4557 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4558 !!end
4559
4560 # parsoid adds a space before the link name
4561 !! test
4562 External links: open square bracket forbidden in URL (named) (bug 4377)
4563 Parsoid variant.
4564 !! wikitext
4565 [http://example.com/1 [2345]
4566 !! html
4567 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4568 </p>
4569 !!end
4570
4571 !! test
4572 External links: nowiki in URL link text (bug 6230)
4573 !! wikitext
4574 [http://example.com/ <nowiki>''example site''</nowiki>]
4575 !! html
4576 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4577 </p>
4578 !! end
4579
4580 !! test
4581 External links: newline forbidden in text (bug 6230 regression check)
4582 !! wikitext
4583 [http://example.com/ first
4584 second]
4585 !! html
4586 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4587 second]
4588 </p>
4589 !!end
4590
4591 !! test
4592 External links: Pipe char between url and text
4593 !! wikitext
4594 [http://example.com | link]
4595 !! html
4596 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4597 </p>
4598 !!end
4599
4600 !! test
4601 External links: protocol-relative URL in brackets
4602 !! wikitext
4603 [//example.com/ Test]
4604 !! html
4605 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4606 </p>
4607 !! end
4608
4609 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4610 !! test
4611 External links: protocol-relative URL in brackets without text
4612 !! wikitext
4613 [//example.com]
4614 !! html/php
4615 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4616 </p>
4617 !! html/parsoid
4618 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4619 !! end
4620
4621 !! test
4622 External links: protocol-relative URL in free text is left alone
4623 !! wikitext
4624 //example.com/Foo
4625 !! html
4626 <p>//example.com/Foo
4627 </p>
4628 !!end
4629
4630 !! test
4631 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4632 !! wikitext
4633 foo//example.com/Foo
4634 !! html
4635 <p>foo//example.com/Foo
4636 </p>
4637 !! end
4638
4639 !! test
4640 External links: with no contents
4641 !! wikitext
4642 [http://en.wikipedia.org/wiki/Foo]
4643
4644 [[wikipedia:Foo|Bar]]
4645
4646 [[wikipedia:Foo|<span>Bar</span>]]
4647 !! html/php
4648 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4649 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4650 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4651 </p>
4652 !! html/parsoid
4653 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4654 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4655 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4656 !! end
4657
4658 !! test
4659 External links: Free with trailing punctuation
4660 !! wikitext
4661 http://example.com,
4662 http://example.com;
4663 http://example.com\
4664 http://example.com.
4665 http://example.com:
4666 http://example.com!
4667 http://example.com?
4668 http://example.com)
4669 http://example.com/url_with_(brackets)
4670 (http://example.com/url_without_brackets)
4671 http://example.com/url_with_entity&amp;
4672 http://example.com/url_with_entity&#x26;
4673 http://example.com/url_with_entity&#038;
4674 http://example.com/url_with_entity&nbsp;
4675 http://example.com/url_with_entity&#xA0;
4676 http://example.com/url_with_entity&#160;
4677 http://example.com/url_with_entity&lt;
4678 http://example.com/url_with_entity&#x3C;
4679 http://example.com/url_with_entity&#60;
4680 !! html/php
4681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4682 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4684 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4685 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4686 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4687 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4688 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4690 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4691 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4692 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4694 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4695 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4697 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4698 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4699 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4700 </p>
4701 !! html/parsoid
4702 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4703 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4704 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4705 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4706 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4707 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4708 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4709 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4710 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4711 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4712 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4713 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4714 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4715 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4716 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4717 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4718 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4719 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4720 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4721 !! end
4722
4723 !! test
4724 External links: tricky Parsoid html2html case
4725 !! options
4726 parsoid=wt2html,wt2wt,html2html
4727 !! wikitext
4728 http://example.com/url_with_entity&amp;amp;
4729 !! html/php
4730 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4734 !! end
4735
4736 !! test
4737 External links: Free with trailing quotes (T113666)
4738 !! wikitext
4739 '''News:''' Stuff here
4740
4741 news:'a'b''c''d e
4742 !! html/php
4743 <p><b>News:</b> Stuff here
4744 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4745 </p>
4746 !! html/parsoid
4747 <p><b>News:</b> Stuff here</p>
4748 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4749 !! end
4750
4751 !! test
4752 External links: Lone protocols are never linked (T105697)
4753 !! wikitext
4754 http://
4755 http://;
4756 (http://)
4757 bitcoin:
4758 bitcoin:;
4759 (bitcoin:)
4760 !! html
4761 <p>http://
4762 http://;
4763 (http://)
4764 bitcoin:
4765 bitcoin:;
4766 (bitcoin:)
4767 </p>
4768 !! end
4769
4770 !! test
4771 External links: No preceding word characters allowed (bug 65278)
4772 !! wikitext
4773 NOPEhttp://example.com
4774 N0http://example.com
4775 ok:http://example.com
4776 ok-http://example.com
4777 !! html
4778 <p>NOPEhttp://example.com
4779 N0http://example.com
4780 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4781 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4782 </p>
4783 !! end
4784
4785 !! test
4786 External links: nofollow domain exception
4787 !! wikitext
4788 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4789 !! html
4790 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4791 </p>
4792 !!end
4793
4794 !! test
4795 External image
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4800 </p>
4801 !! end
4802
4803 !! test
4804 External image from https
4805 !! wikitext
4806 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4807 !! html
4808 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External image (when not allowed)
4814 !! options
4815 wgAllowExternalImages=0
4816 !! wikitext
4817 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4818 !! html
4819 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4820 </p>
4821 !! end
4822
4823 !! test
4824 Link to non-http image, no img tag
4825 !! wikitext
4826 Link to non-http image, no img tag: ftp://example.com/test.jpg
4827 !! html
4828 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: terminating separator
4834 !! wikitext
4835 Terminating separator: http://example.com/thing,
4836 !! html
4837 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4838 </p>
4839 !! end
4840
4841 !! test
4842 External links: intervening separator
4843 !! wikitext
4844 Intervening separator: http://example.com/1,2,3
4845 !! html
4846 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4847 </p>
4848 !! end
4849
4850 !! test
4851 External links: old bug with URL in query
4852 !! wikitext
4853 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4854 !! html
4855 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4856 </p>
4857 !! end
4858
4859 !! test
4860 External links: old URL-in-URL bug, mixed protocols
4861 !! wikitext
4862 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4863 !! html
4864 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4865 </p>
4866 !!end
4867
4868 !! test
4869 External links: URL in text
4870 !! wikitext
4871 URL in text: [http://example.com http://example.com]
4872 !! html
4873 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: Clickable images
4879 !! wikitext
4880 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4881 !! html/php
4882 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4883 </p>
4884 !! html/parsoid
4885 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4886 !! end
4887
4888 !! test
4889 External links: raw ampersand
4890 !! wikitext
4891 Old &amp; use: http://x&y
4892 !! html
4893 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4894 </p>
4895 !! end
4896
4897 !! test
4898 External links: encoded ampersand
4899 !! wikitext
4900 Old &amp; use: http://x&amp;y
4901 !! html/php
4902 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4903 </p>
4904 !! html/parsoid
4905 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4906 !! end
4907
4908 !! test
4909 External links: encoded equals (bug 6102)
4910 !! wikitext
4911 http://example.com/?foo&#61;bar
4912 !! html/php
4913 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4914 </p>
4915 !! html/parsoid
4916 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4917 !! end
4918
4919 ##
4920 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4921 ## does it number them. As discussed in bug 53505, we can identify
4922 ## autonumbered links via CSS.
4923 ##
4924
4925 !! test
4926 External links: [raw ampersand]
4927 !! wikitext
4928 Old &amp; use: [http://x&y]
4929 !! html/php
4930 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4931 </p>
4932 !! html/parsoid
4933 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4934 !! end
4935
4936 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4937 # mode will return the [raw ampersand] wikitext
4938 !! test
4939 External links: [encoded ampersand]
4940 !! options
4941 parsoid=wt2html,wt2wt,html2html
4942 !! wikitext
4943 Old &amp; use: [http://x&amp;y]
4944 !! html/php
4945 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4946 </p>
4947 !! html/parsoid
4948 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4949 !! end
4950
4951 !! test
4952 External links: [raw equals]
4953 !! wikitext
4954 [http://example.com/?foo=bar]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4960 !! end
4961
4962 # note that parsoid html is identical to [raw equals] case; so html2wt
4963 # mode will return the [raw equals] wikitext
4964 !! test
4965 External links: [encoded equals] (bug 6102)
4966 !! options
4967 parsoid=wt2html,wt2wt,html2html
4968 !! wikitext
4969 [http://example.com/?foo&#61;bar]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4975 !! end
4976
4977 # xxx parsoid strips the IDN character, so the round-trip tests will
4978 # obviously fail and are disabled. --cscott
4979 !! test
4980 External links: [IDN ignored character reference in hostname; strip it right off]
4981 !! options
4982 parsoid=wt2html,wt2wt,html2html
4983 !! wikitext
4984 [http://e&zwnj;xample.com/]
4985 !! html/php
4986 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4990 !! end
4991
4992 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4993 # Where an external link could easily circumvent the sanitization of the text of
4994 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4995 # test demands a higher standard. That's a bit strange.
4996 #
4997 # Example:
4998 #
4999 # http://e‌xample.com -> [http://example.com|http://example.com]
5000 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5001 #
5002 # The first example is sanitized, but the second is not. Any security benefits
5003 # from this production are trivial to circumvent. Either remove this test and
5004 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5005 # the test accordingly.
5006 #
5007 # All our love,
5008 # The Parsoid team.
5009 # xxx parsoid strips the IDN character, so the round-trip tests will
5010 # obviously fail and are disabled. --cscott
5011 !! test
5012 External links: IDN ignored character reference in hostname; strip it right off
5013 !! options
5014 parsoid=wt2html,html2html
5015 !! wikitext
5016 http://e&zwnj;xample.com/
5017 !! html/php
5018 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5019 </p>
5020 !! html/parsoid
5021 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5022 !! end
5023
5024 !! test
5025 External links: www.jpeg.org (bug 554)
5026 !! wikitext
5027 http://www.jpeg.org
5028 !! html
5029 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5030 </p>
5031 !! end
5032
5033 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5034 !! test
5035 External links: URL within URL (original bug 2)
5036 !! wikitext
5037 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5038 !! html/php
5039 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5040 </p>
5041 !! html/parsoid
5042 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5043 !! end
5044
5045 !! test
5046 BUG 361: URL inside bracketed URL
5047 !! wikitext
5048 [http://www.example.com/foo http://www.example.com/bar]
5049 !! html
5050 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5051 </p>
5052 !! end
5053
5054 !! test
5055 BUG 361: URL within URL, not bracketed
5056 !! wikitext
5057 http://www.example.com/foo?=http://www.example.com/bar
5058 !! html
5059 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5060 </p>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in URL-tail
5065 !! wikitext
5066 http://www.example.com/<hello>
5067 !! html
5068 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in URL-tail
5074 !! wikitext
5075 http://www.example.com/<b>html</b>
5076 !! html/php
5077 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5078 </p>
5079 !! html/parsoid
5080 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5081 !! end
5082
5083 !! test
5084 BUG 289: ">"-token in bracketed URL
5085 !! wikitext
5086 [http://www.example.com/<hello> stuff]
5087 !! html
5088 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5089 </p>
5090 !!end
5091
5092 !! test
5093 BUG 289: literal ">"-token in bracketed URL
5094 !! wikitext
5095 [http://www.example.com/<b>html</b> stuff]
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5098 </p>
5099 !!end
5100
5101 !! test
5102 BUG 289: literal double quote at end of URL
5103 !! wikitext
5104 http://www.example.com/"hello"
5105 !! html
5106 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5107 </p>
5108 !!end
5109
5110 !! test
5111 BUG 289: literal double quote in bracketed URL
5112 !! wikitext
5113 [http://www.example.com/"hello" stuff]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5116 </p>
5117 !!end
5118
5119 !! test
5120 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5121 !! wikitext
5122 [http://www.example.com test]
5123 !! html
5124 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 External links: link text with spaces
5130 !! wikitext
5131 [http://www.example.com a b c]
5132 [http://www.example.com ''a'' ''b'']
5133 !! html
5134 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5135 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5136 </p>
5137 !! end
5138
5139 !! test
5140 External links: wiki links within external link (Bug 3695)
5141 !! options
5142 parsoid=wt2html,html2html
5143 !! wikitext
5144 [http://example.com [[wikilink]] embedded in ext link]
5145 !! html/php
5146 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5147 </p>
5148 !! html/parsoid
5149 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5150 !! end
5151
5152 !! test
5153 BUG 787: Links with one slash after the url protocol are invalid
5154 !! wikitext
5155 http:/example.com
5156
5157 [http:/example.com title]
5158 !! html
5159 <p>http:/example.com
5160 </p><p>[http:/example.com title]
5161 </p>
5162 !! end
5163
5164 !! test
5165 Bracketed external links with template-generated invalid target
5166 !! wikitext
5167 [{{echo|http:/example.com}} title]
5168 !! html
5169 <p>[http:/example.com title]
5170 </p>
5171 !! end
5172
5173 !! test
5174 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5175 !! wikitext
5176 ''[http://example.com text'']
5177 [http://example.com '''text]'''
5178 ''Something [http://example.com in italic'']
5179 ''Something [http://example.com mixed''''', even bold]'''
5180 '''''Now [http://example.com both''''']
5181 !! html
5182 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5183 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5184 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5185 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5186 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5187 </p>
5188 !! end
5189
5190
5191 !! test
5192 Bug 4781: %26 in URL
5193 !! wikitext
5194 http://www.example.com/?title=AT%26T
5195 !! html/php
5196 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5200 !! end
5201
5202 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5203 # % is actually legal in HTML5. Any change in output would need testing though.
5204 !! test
5205 Bug 4781, 5267: %25 in URL
5206 !! wikitext
5207 http://www.example.com/?title=100%25_Bran
5208 !! html/php
5209 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %28, %29 in URL
5217 !! wikitext
5218 http://www.example.com/?title=Ben-Hur_%281959_film%29
5219 !! html/php
5220 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5224 !! end
5225
5226
5227 !! test
5228 Bug 4781: %26 in autonumber URL
5229 !! wikitext
5230 [http://www.example.com/?title=AT%26T]
5231 !! html/php
5232 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5233 </p>
5234 !! html/parsoid
5235 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5236 !! end
5237
5238 !! test
5239 Bug 4781, 5267: %26 in autonumber URL
5240 !! wikitext
5241 [http://www.example.com/?title=100%25_Bran]
5242 !! html/php
5243 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %28, %29 in autonumber URL
5251 !! wikitext
5252 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5253 !! html/php
5254 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5255 </p>
5256 !! html/parsoid
5257 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5258 !! end
5259
5260
5261 !! test
5262 Bug 4781: %26 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=AT%26T link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %25 in bracketed URL
5274 !! wikitext
5275 [http://www.example.com/?title=100%25_Bran link]
5276 !! html
5277 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5278 </p>
5279 !! end
5280
5281 !! test
5282 Bug 4781, 5267: %28, %29 in bracketed URL
5283 !! wikitext
5284 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5285 !! html/php
5286 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5287 </p>
5288 !! html/parsoid
5289 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5290 !! end
5291
5292 !! test
5293 External link containing a period in the anchor. (bug 63947)
5294 !! wikitext
5295 [//foo.org/bar#baz. bang]
5296
5297 [//foo.org/bar. bang]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5300 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5304 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5305 !! end
5306
5307 !! test
5308 External link containing a single quote. (bug 63947)
5309 !! wikitext
5310 [//foo.org/bar'baz]
5311
5312 [//foo.org/bar'baz bang]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5315 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5316 </p>
5317 !! html/parsoid
5318 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5319 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5320 !! end
5321
5322 !! test
5323 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5324 !! wikitext
5325 Some [http://example.com/ pretty ''italics'' and stuff]!
5326 !! html
5327 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5328 </p>
5329 !! end
5330
5331 !! test
5332 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5333 !! wikitext
5334 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5335 !! html
5336 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5337 </p>
5338 !! end
5339
5340 !! test
5341 External link containing double-single-quotes with no space separating the url from text in italics
5342 !! wikitext
5343 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5344 !! html/php
5345 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5346 </p>
5347 !! html/php+tidy
5348 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5349 !! html/parsoid
5350 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5351 !! end
5352
5353 !! test
5354 External link with comments in link text
5355 !! wikitext
5356 [http://www.google.com Google <!-- comment -->]
5357 !! html/php
5358 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5359 </p>
5360 !! html/parsoid
5361 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5362 !! end
5363
5364 !! test
5365 External link to bare IPv4 address
5366 !! wikitext
5367 [http://192.168.0.1 Link]
5368 !! html/php
5369 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5370 </p>
5371 !! html/parsoid
5372 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5373 !! end
5374
5375 !! test
5376 URL-encoding in URL functions (single parameter)
5377 !! wikitext
5378 {{localurl:Some page|amp=&}}
5379 !! html
5380 <p>/index.php?title=Some_page&amp;amp=&amp;
5381 </p>
5382 !! end
5383
5384 !! test
5385 URL-encoding in URL functions (multiple parameters)
5386 !! wikitext
5387 {{localurl:Some page|q=?&amp=&}}
5388 !! html
5389 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5390 </p>
5391 !! end
5392
5393 !! test
5394 Brackets in urls
5395 !! wikitext
5396 http://example.com/index.php?foozoid%5B%5D=bar
5397
5398 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5399 !! html/php
5400 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5401 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5405
5406 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5407 !! end
5408
5409 !! test
5410 IPv6 urls, autolink format (T23261)
5411 !! wikitext
5412 http://[2404:130:0:1000::187:2]/index.php
5413
5414 Examples from RFC 2373, section 2.2:
5415 * http://[1080::8:800:200C:417A]/unicast
5416 * http://[FF01::101]/multicast
5417 * http://[::1]/loopback
5418 * http://[::]/unspecified
5419 * http://[::13.1.68.3]/ipv4compat
5420 * http://[::FFFF:129.144.52.38]/ipv4compat
5421
5422 Examples from RFC 2732, section 2:
5423 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5424 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5425 * http://[3ffe:2a00:100:7031::1]
5426 * http://[1080::8:800:200C:417A]/foo
5427 * http://[::192.9.5.5]/ipng
5428 * http://[::FFFF:129.144.52.38]:80/index.html
5429 * http://[2010:836B:4179::836B:4179]
5430
5431 !! html/php
5432 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5433 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5434 </p>
5435 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5442 </p>
5443 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5444 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5445 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5449 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450
5451 !! html/parsoid
5452 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5453
5454 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5455 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5461
5462 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5463 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5465 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5467 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5468 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5469 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5470 !! end
5471
5472 !! test
5473 IPv6 urls, bracketed format (T23261)
5474 !! wikitext
5475 [http://[2404:130:0:1000::187:2]/index.php test]
5476
5477 Examples from RFC 2373, section 2.2:
5478 * [http://[1080::8:800:200C:417A] unicast]
5479 * [http://[FF01::101] multicast]
5480 * [http://[::1]/ loopback]
5481 * [http://[::] unspecified]
5482 * [http://[::13.1.68.3] ipv4compat]
5483 * [http://[::FFFF:129.144.52.38] ipv4compat]
5484
5485 Examples from RFC 2732, section 2:
5486 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5487 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5488 * [http://[3ffe:2a00:100:7031::1] 3]
5489 * [http://[1080::8:800:200C:417A]/foo 4]
5490 * [http://[::192.9.5.5]/ipng 5]
5491 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5492 * [http://[2010:836B:4179::836B:4179] 7]
5493
5494 !! html/php
5495 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5496 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5497 </p>
5498 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5505 </p>
5506 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5516
5517 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5518 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5524
5525 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5526 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5528 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5529 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5530 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5531 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5532 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5533 !! end
5534
5535 !! test
5536 Non-extlinks in brackets
5537 !! wikitext
5538 [foo]
5539 [foo bar]
5540 [foo ''bar'']
5541 [fool's] errand
5542 [fool's errand]
5543 [{{echo|foo}}]
5544 [{{echo|foo}} bar]
5545 [{{echo|foo}} ''bar'']
5546 [{{echo|foo}}l's] errand
5547 [{{echo|foo}}l's errand]
5548 [url={{echo|foo}}]
5549 [url=http://example.com]
5550 [http:// bare protocols don't count]
5551 !! html/php
5552 <p>[foo]
5553 [foo bar]
5554 [foo <i>bar</i>]
5555 [fool's] errand
5556 [fool's errand]
5557 [foo]
5558 [foo bar]
5559 [foo <i>bar</i>]
5560 [fool's] errand
5561 [fool's errand]
5562 [url=foo]
5563 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5564 [http:// bare protocols don't count]
5565 </p>
5566 !! html/parsoid
5567 <p>[foo]
5568 [foo bar]
5569 [foo <i>bar</i>]
5570 [fool's] errand
5571 [fool's errand]
5572 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5573 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5574 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5575 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5576 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5577 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5578 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5579 [http:// bare protocols don't count]</p>
5580 !! end
5581
5582 !! test
5583 Percent encoding in external links
5584 !! wikitext
5585 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5586 !! html/php
5587 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5588 </p>
5589 !! html/parsoid
5590 <p><a rel="mw:ExtLink"
5591 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5592 !! end
5593
5594 !! test
5595 Use url link syntax for links where the content is equal the link target
5596 !! wikitext
5597 http://example.com
5598 !! html/php
5599 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5600 </p>
5601 !! html/parsoid
5602 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5603 !! end
5604
5605 !! test
5606 Parenthesis in external links, especially URL links
5607 !! wikitext
5608 http://example.com)
5609
5610 http://example.com/test)
5611
5612 http://example.com/(test)
5613
5614 http://example.com/((test)
5615
5616 (http://example.com/(test))
5617
5618 (http://example.com/(test)))))
5619
5620 http://example.com/a)b
5621
5622 [http://example.com) foo]
5623 !! html/php
5624 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5625 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5626 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5627 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5628 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5630 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5631 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5632 </p>
5633 !! html/parsoid
5634 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5635 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5636 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5637 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5638 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5639 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5640 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5641 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5642 !! end
5643
5644 !! test
5645 Parenthesis in external links, w/ transclusion or comment
5646 !! wikitext
5647 (http://example.com/{{echo|hi}})
5648
5649 (http://example.com<!-- hi -->)
5650 !! html/php
5651 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5652 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5653 </p>
5654 !! html/parsoid
5655 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5656
5657 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5658 !! end
5659
5660 !! test
5661 Serialize <a> tags with invalid link targets as plain text
5662 !! options
5663 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5664 !! html/parsoid
5665 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5666 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5667 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5668 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5669 !! wikitext
5670 text
5671 <nowiki>*</nowiki>text
5672 <nowiki>[[foo]]</nowiki>
5673 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5674 !! end
5675
5676 !! test
5677 mw:ExtLink -vs- mw:WikiLink (T94723)
5678 !! options
5679 parsoid=html2wt
5680 !! html/parsoid
5681 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5682 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5683 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5684 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5685 <p>
5686 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5687 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5688 </p>
5689 !! wikitext
5690 [[Foo|Bar]]
5691 [[Foo|Bar]]
5692 [[wikipedia:Foo|Bar]]
5693 [[wikipedia:Foo|Bar]]
5694
5695 [[wikipedia:European_Robin|European Robin]]
5696 [[wikipedia:European_Robin|European Robin]]
5697 !! end
5698
5699 !! test
5700 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5701 !! options
5702 parsoid=wt2wt
5703 !! wikitext
5704 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5705 !! html/parsoid
5706 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5707 !! end
5708
5709
5710 ###
5711 ### Quotes
5712 ###
5713
5714 !! test
5715 Quotes
5716 !! wikitext
5717 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5718
5719 Normal text. '''''Bold italic text.''''' Normal text.
5720 !! html
5721 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5722 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5723 </p>
5724 !! end
5725
5726
5727 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5728 # parser strips. The wikitext contains just the first half of the bold
5729 # quote pair.
5730 !! test
5731 Unclosed and unmatched quotes
5732 !! wikitext
5733 '''''Bold italic text '''with bold deactivated''' in between.'''''
5734
5735 '''''Bold italic text ''with italic deactivated'' in between.'''''
5736
5737 '''Bold text..
5738
5739 ..spanning two paragraphs (should not work).'''
5740
5741 '''Bold tag left open
5742
5743 ''Italic tag left open
5744
5745 Normal text.
5746
5747 <!-- Unmatching number of opening, closing tags: -->
5748 '''This year''''s election ''should'' beat '''last year''''s.
5749
5750 ''Tom'''s car is bigger than ''Susan'''s.
5751
5752 Plain ''italic'''s plain
5753 !! html/php
5754 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5755 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5756 </p><p><b>Bold text..</b>
5757 </p><p>..spanning two paragraphs (should not work).
5758 </p><p><b>Bold tag left open</b>
5759 </p><p><i>Italic tag left open</i>
5760 </p><p>Normal text.
5761 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5762 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5763 </p><p>Plain <i>italic'</i>s plain
5764 </p>
5765 !! html/parsoid
5766 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5767 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5768 </p><p><b>Bold text..</b>
5769 </p><p>..spanning two paragraphs (should not work).<b></b>
5770 </p><p><b>Bold tag left open</b>
5771 </p><p><i>Italic tag left open</i>
5772 </p><p>Normal text.
5773 </p>
5774 <!-- Unmatching number of opening, closing tags: -->
5775 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5776 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5777 </p><p>Plain <i>italic'</i>s plain
5778 </p>
5779 !! end
5780
5781 ###
5782 ### Tables
5783 ###
5784 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5785 ###
5786
5787 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5788 # is the bare minimum required by the spec, see:
5789 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5790 # Parsoid team replies: empty table tags are legal in HTML5
5791 !! test
5792 A table with no data.
5793 !! options
5794 parsoid=wt2html
5795 !! wikitext
5796 {||}
5797 !! html/php
5798
5799 !! html/parsoid
5800 <table></table>
5801
5802 !! end
5803
5804 !! test
5805 A table with stray table end tags on start tag line (wt2html)
5806 !! options
5807 parsoid=wt2html
5808 !! wikitext
5809 {|style="color: red;"|}
5810
5811 {|style="color: red;" |}
5812 |foo
5813 |}
5814
5815 {|style="color: red;"|} id="foo"
5816 |foo
5817 |}
5818
5819 {|style="color: red;" |} id="foo"
5820 |foo
5821 |}
5822 !! html
5823 <table style="color: red;"></table>
5824
5825 <table style="color: red;">
5826 <tbody><tr>
5827 <td>foo</td>
5828 </tr></tbody>
5829 </table>
5830
5831 <table style="color: red;" id="foo">
5832 <tbody><tr>
5833 <td>foo</td>
5834 </tr></tbody>
5835 </table>
5836
5837 <table style="color: red;" id="foo">
5838 <tbody><tr>
5839 <td>foo</td>
5840 </tr></tbody>
5841 </table>
5842
5843 !! end
5844
5845 !! test
5846 A table with no data (take 2)
5847 !! wikitext
5848 {|
5849 |}
5850 !! html/parsoid
5851 <table></table>
5852 !! end
5853
5854 # A table with nothing but a caption is invalid XHTML, we might want to render
5855 # this as <p>caption</p>
5856 # Parsoid team replies: table with only a caption is legal in HTML5
5857 !! test
5858 A table with nothing but a caption
5859 !! wikitext
5860 {|
5861 |+ caption
5862 |}
5863 !! html/php
5864 <table>
5865 <caption> caption
5866 </caption><tr><td></td></tr></table>
5867
5868 !! html/parsoid
5869 <table><caption> caption</caption></table>
5870 !! end
5871
5872 !! test
5873 A table with caption with default-spaced attributes and a table row
5874 !! wikitext
5875 {|
5876 |+ style="color: red;" | caption1
5877 |-
5878 | foo
5879 |}
5880 !! html
5881 <table>
5882 <caption style="color: red;"> caption1
5883 </caption>
5884 <tr>
5885 <td> foo
5886 </td></tr></table>
5887
5888 !! end
5889
5890 !! test
5891 A table with captions with non-default spaced attributes and a table row
5892 !! wikitext
5893 {|
5894 |+style="color: red;"|caption2
5895 |+ style="color: red;"| caption3
5896 |-
5897 | foo
5898 |}
5899 !! html
5900 <table>
5901 <caption style="color: red;">caption2
5902 </caption>
5903 <caption style="color: red;"> caption3
5904 </caption>
5905 <tr>
5906 <td> foo
5907 </td></tr></table>
5908
5909 !! end
5910
5911 !! test
5912 Table td-cell syntax variations
5913 !! wikitext
5914 {|
5915 | foo bar foo | baz
5916 | foo bar foo || baz
5917 | style='color:red;' | baz
5918 | style='color:red;' || baz
5919 |}
5920 !! html
5921 <table>
5922 <tr>
5923 <td> baz
5924 </td>
5925 <td> foo bar foo </td>
5926 <td> baz
5927 </td>
5928 <td style="color:red;"> baz
5929 </td>
5930 <td> style='color:red;' </td>
5931 <td> baz
5932 </td></tr></table>
5933
5934 !! end
5935
5936 !! test
5937 Simple table
5938 !! wikitext
5939 {|
5940 | 1 || 2
5941 |-
5942 | 3 || 4
5943 |}
5944 !! html
5945 <table>
5946 <tr>
5947 <td> 1 </td>
5948 <td> 2
5949 </td></tr>
5950 <tr>
5951 <td> 3 </td>
5952 <td> 4
5953 </td></tr></table>
5954
5955 !! end
5956
5957 !! test
5958 Simple table but with multiple dashes for row wikitext
5959 !! wikitext
5960 {|
5961 | foo
5962 |-----
5963 | bar
5964 |}
5965 !! html
5966 <table>
5967 <tr>
5968 <td> foo
5969 </td></tr>
5970 <tr>
5971 <td> bar
5972 </td></tr></table>
5973
5974 !! end
5975
5976 !! test
5977 Multiplication table
5978 !! wikitext
5979 {| border="1" cellpadding="2"
5980 |+Multiplication table
5981 |-
5982 ! &times; !! 1 !! 2 !! 3
5983 |-
5984 ! 1
5985 | 1 || 2 || 3
5986 |-
5987 ! 2
5988 | 2 || 4 || 6
5989 |-
5990 ! 3
5991 | 3 || 6 || 9
5992 |-
5993 ! 4
5994 | 4 || 8 || 12
5995 |-
5996 ! 5
5997 | 5 || 10 || 15
5998 |}
5999 !! html
6000 <table border="1" cellpadding="2">
6001 <caption>Multiplication table
6002 </caption>
6003 <tr>
6004 <th> &#215; </th>
6005 <th> 1 </th>
6006 <th> 2 </th>
6007 <th> 3
6008 </th></tr>
6009 <tr>
6010 <th> 1
6011 </th>
6012 <td> 1 </td>
6013 <td> 2 </td>
6014 <td> 3
6015 </td></tr>
6016 <tr>
6017 <th> 2
6018 </th>
6019 <td> 2 </td>
6020 <td> 4 </td>
6021 <td> 6
6022 </td></tr>
6023 <tr>
6024 <th> 3
6025 </th>
6026 <td> 3 </td>
6027 <td> 6 </td>
6028 <td> 9
6029 </td></tr>
6030 <tr>
6031 <th> 4
6032 </th>
6033 <td> 4 </td>
6034 <td> 8 </td>
6035 <td> 12
6036 </td></tr>
6037 <tr>
6038 <th> 5
6039 </th>
6040 <td> 5 </td>
6041 <td> 10 </td>
6042 <td> 15
6043 </td></tr></table>
6044
6045 !! end
6046
6047 !! test
6048 Accept "||" in table headings
6049 !! wikitext
6050 {|
6051 !h1 || h2
6052 |}
6053 !! html
6054 <table>
6055 <tr>
6056 <th>h1 </th>
6057 <th> h2
6058 </th></tr></table>
6059
6060 !! end
6061
6062 !! test
6063 Accept "!!" in table data
6064 !! wikitext
6065 {|
6066 | Foo!! ||
6067 |}
6068 !! html
6069 <table>
6070 <tr>
6071 <td> Foo!! </td>
6072 <td>
6073 </td></tr></table>
6074
6075 !! html/parsoid
6076 <table>
6077 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6078 </tbody></table>
6079 !! end
6080
6081 !! test
6082 Accept "||" in indented table headings
6083 !! wikitext
6084 :{|
6085 !h1 || h2
6086 |}
6087 !! html
6088 <dl><dd><table>
6089 <tr>
6090 <th>h1 </th>
6091 <th> h2
6092 </th></tr></table></dd></dl>
6093
6094 !! end
6095
6096 !! test
6097 Accept "!!" in templates
6098 !! wikitext
6099 {|
6100 !a {{echo|b!!c}}
6101 |}
6102 !! html/php
6103 <table>
6104 <tr>
6105 <th>a b</th>
6106 <th>c
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6112 !! end
6113
6114 !! test
6115 Accept "!!" in table headings after newline
6116 !! wikitext
6117 {|
6118 !a
6119 b!!c
6120 |}
6121 !! html/php
6122 <table>
6123 <tr>
6124 <th>a
6125 <p>b!!c
6126 </p>
6127 </th></tr></table>
6128
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a
6132 <p>b!!c</p></th></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept "!!" in table data of mixed wikitext / html syntax
6138 !! wikitext
6139 {|
6140 !a
6141 <tr><td>b!!c</td></tr>
6142 |}
6143 !! html+tidy
6144 <table>
6145 <tr>
6146 <th>a</th>
6147 </tr>
6148 <tr>
6149 <td>b!!c</td>
6150 </tr>
6151 </table>
6152 !! html/parsoid
6153 <table>
6154 <tbody><tr><th>a</th></tr>
6155 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6156 </tbody></table>
6157 !! end
6158
6159 !! test
6160 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6161 !! wikitext
6162 {|
6163 !| h1
6164 || a
6165 |}
6166 !! html
6167 <table>
6168 <tr>
6169 <th> h1
6170 </th>
6171 <td> a
6172 </td></tr></table>
6173
6174 !! end
6175
6176 !!test
6177 Accept "| !" at start of line in tables (ignore !-attribute)
6178 !! wikitext
6179 {|
6180 |-
6181 | !style="color:red" | bar
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td> bar
6188 </td></tr></table>
6189
6190 !!end
6191
6192 !!test
6193 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6194 !! wikitext
6195 {|
6196 |-
6197 |style='color:red;'|+1
6198 |style='color:blue;'|-1
6199 |-
6200 | 1 || 2 || 3
6201 | 1 ||+2 ||-3
6202 |-
6203 | +1
6204 | -1
6205 |}
6206 !! html
6207 <table>
6208
6209 <tr>
6210 <td style="color:red;">+1
6211 </td>
6212 <td style="color:blue;">-1
6213 </td></tr>
6214 <tr>
6215 <td> 1 </td>
6216 <td> 2 </td>
6217 <td> 3
6218 </td>
6219 <td> 1 </td>
6220 <td>+2 </td>
6221 <td>-3
6222 </td></tr>
6223 <tr>
6224 <td> +1
6225 </td>
6226 <td> -1
6227 </td></tr></table>
6228
6229 !!end
6230
6231 !! test
6232 Table rowspan
6233 !! wikitext
6234 {| border=1
6235 | Cell 1, row 1
6236 |rowspan=2| Cell 2, row 1 (and 2)
6237 | Cell 3, row 1
6238 |-
6239 | Cell 1, row 2
6240 | Cell 3, row 2
6241 |}
6242 !! html
6243 <table border="1">
6244 <tr>
6245 <td> Cell 1, row 1
6246 </td>
6247 <td rowspan="2"> Cell 2, row 1 (and 2)
6248 </td>
6249 <td> Cell 3, row 1
6250 </td></tr>
6251 <tr>
6252 <td> Cell 1, row 2
6253 </td>
6254 <td> Cell 3, row 2
6255 </td></tr></table>
6256
6257 !! end
6258
6259 !! test
6260 Nested table
6261 !! wikitext
6262 {| border=1
6263 | &alpha;
6264 |
6265 {| bgcolor=#ABCDEF border=2
6266 |nested
6267 |-
6268 |table
6269 |}
6270 |the original table again
6271 |}
6272 !! html
6273 <table border="1">
6274 <tr>
6275 <td> &#945;
6276 </td>
6277 <td>
6278 <table bgcolor="#ABCDEF" border="2">
6279 <tr>
6280 <td>nested
6281 </td></tr>
6282 <tr>
6283 <td>table
6284 </td></tr></table>
6285 </td>
6286 <td>the original table again
6287 </td></tr></table>
6288
6289 !! end
6290
6291 !! test
6292 Invalid attributes in table cell (bug 1830)
6293 !! wikitext
6294 {|
6295 |Cell:|broken
6296 |}
6297 !! html
6298 <table>
6299 <tr>
6300 <td>broken
6301 </td></tr></table>
6302
6303 !! end
6304
6305 !! test
6306 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6307 !! wikitext
6308 {|
6309 | title="foo" |bar
6310 | title="foo<nowiki>|</nowiki>" |bar
6311 | title="foo<nowiki>|</nowiki>" bar
6312 |}
6313 !! html/php
6314 <table>
6315 <tr>
6316 <td title="foo">bar
6317 </td>
6318 <td title="foo&#124;">bar
6319 </td>
6320 <td> title="foo|" bar
6321 </td></tr></table>
6322
6323 !! html/parsoid
6324 <table>
6325 <tbody><tr><td title="foo">bar</td>
6326 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6327 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6328 </tbody></table>
6329 !! end
6330
6331 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6332 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6333 # *2wt modes will fail.
6334 !! test
6335 Table security: embedded pipes
6336 !! options
6337 parsoid=wt2html,html2html
6338 !! wikitext
6339 {|
6340 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6341 !! html/php
6342 <table>
6343 <tr>
6344 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6345 <td>]" onmouseover="alert(document.cookie)"&gt;test
6346 </td>
6347 </tr>
6348 </table>
6349
6350 !! html/parsoid
6351 <table><tbody>
6352 <tr>
6353 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6354 !! end
6355
6356 !! test
6357 Element attributes with double ! should not be broken up by <th>
6358 !! wikitext
6359 {|
6360 ! hi <div class="!!">ha</div> ho
6361 |}
6362 !! html/php
6363 <table>
6364 <tr>
6365 <th> hi <div class="!!">ha</div> ho
6366 </th></tr></table>
6367
6368 !! html/parsoid
6369 <table>
6370 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6371 </tbody></table>
6372 !! end
6373
6374 !! test
6375 ! and || in element attributes should not be parsed as <th>/<td>
6376 !! wikitext
6377 {|
6378 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6379 |}
6380 !! html/php
6381 <table>
6382 <tr>
6383 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6384 </td></tr></table>
6385
6386 !! html/parsoid
6387 <table>
6388 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6389 </tbody></table>
6390 !! end
6391
6392 # FIXME: The output seems broken. Filed as T110268.
6393 !! test
6394 ! and || in td attributes should not be parsed as <th>/<td>
6395 !! options
6396 parsoid=wt2html
6397 !! wikitext
6398 {|
6399 | style="color: red !important;" data-contrived="put this here ||" | foo
6400 |}
6401 !! html/php
6402 <table>
6403 <tr>
6404 <td> style="color: red !important;" data-contrived="put this here </td>
6405 <td> foo
6406 </td></tr></table>
6407
6408 !! html/parsoid
6409 <table>
6410 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6411 </tbody></table>
6412 !! end
6413
6414 !! test
6415 Break on | in element attribute in template
6416 !! options
6417 parsoid=wt2html,html2html
6418 !! wikitext
6419 {{echo|1=<div class="hi|ho">ha</div>}}
6420 !! html/php
6421 <p>ho"&gt;ha&lt;/div&gt;
6422 </p>
6423 !! html/parsoid
6424 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6425 !! end
6426
6427 !! test
6428 Indented table markup mixed with indented pre content (proposed in bug 6200)
6429 !! wikitext
6430 <table>
6431 <tr>
6432 <td>
6433 Text that should be rendered preformatted
6434 </td>
6435 </tr>
6436 </table>
6437 !! html
6438 <table>
6439 <tr>
6440 <td>
6441 <pre>Text that should be rendered preformatted
6442 </pre>
6443 </td>
6444 </tr>
6445 </table>
6446
6447 !! end
6448
6449 !! test
6450 1. Template-generated table cell attributes and cell content
6451 !! wikitext
6452 {|
6453 |{{table_attribs}}
6454 | {{table_attribs}}
6455 || {{table_attribs_5}}
6456 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6457 |align=center {{table_attribs}}
6458 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td style="color:red;">Foo
6464 </td>
6465 <td style="color:red;">Foo
6466 </td>
6467 <td> style="color:red;"</td>
6468 <td>Bar
6469 </td>
6470 <td style="color:red;">Foo
6471 </td>
6472 <td align="center" style="color:red;">Foo
6473 </td>
6474 <td align="center" style="color:red;">Foo
6475 </td></tr></table>
6476
6477 !! end
6478
6479 !! test
6480 2. Template-generated table cell attributes and cell content
6481 !! wikitext
6482 {|
6483 |{{table_attribs_2}}
6484 |}
6485 !! html/php
6486 <table>
6487 <tr>
6488 <td style="color:red;">Foo
6489 </td>
6490 <td>Bar</td>
6491 <td>Baz
6492 </td></tr></table>
6493
6494 !! html/parsoid
6495 <table>
6496 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6497 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 3. Template-generated table cell attributes and cell content
6503 !! wikitext
6504 {|
6505 !align=center {{table_header_cells}}
6506 |-
6507 |align=center {{table_cells}}
6508 |}
6509 !! html/php
6510 <table>
6511 <tr>
6512 <th align="center" style="color:red;">Foo</th>
6513 <th style="color:red;"><i>Bar</i></th>
6514 <th style="color:brown;"><i>Foo</i> and Baz
6515 </th></tr>
6516 <tr>
6517 <td align="center" style="color:red;">Foo</td>
6518 <td style="color:red;"><i>Bar</i></td>
6519 <td style="color:brown;"><i>Foo</i> and Baz
6520 </td></tr></table>
6521
6522 !! html/parsoid
6523 <table>
6524 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6525 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6526 </tbody></table>
6527 !! end
6528
6529 !! test
6530 4. Template-generated table cell attributes and cell content inside a templated table
6531 !! wikitext
6532 {{tbl-start}}
6533 !align=center {{table_header_cells}}
6534 |-
6535 |align=center {{table_cells}}
6536 {{tbl-end}}
6537 !! html/php
6538 <table>
6539 <tr>
6540 <th align="center" style="color:red;">Foo</th>
6541 <th style="color:red;"><i>Bar</i></th>
6542 <th style="color:brown;"><i>Foo</i> and Baz
6543 </th></tr>
6544 <tr>
6545 <td align="center" style="color:red;">Foo</td>
6546 <td style="color:red;"><i>Bar</i></td>
6547 <td style="color:brown;"><i>Foo</i> and Baz
6548 </td></tr></table>
6549
6550 !! html/parsoid
6551 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6552 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6553 <tr>
6554 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6555 </tbody></table>
6556 !! end
6557
6558 ## Edge case fix to prevent future regressions
6559 !! test
6560 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6561 !! wikitext
6562 {|
6563 |{{table_attribs_7}}
6564 |}
6565 <references />
6566 !! html/parsoid
6567 <table>
6568 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6569 </tbody></table>
6570 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6571 !! end
6572
6573 !! test
6574 Table with row followed by newlines and table heading
6575 !! options
6576 parsoid=wt2html,html2html
6577 !! wikitext
6578 {|
6579 |-
6580
6581 ! foo
6582 |}
6583 !! html/*
6584 <table>
6585
6586
6587 <tr>
6588 <th> foo
6589 </th></tr></table>
6590
6591 !! end
6592
6593 !! test
6594 Table with empty line following the start tag
6595 !! options
6596 parsoid=wt2html,html2html
6597 !! wikitext
6598 {|
6599
6600 |-
6601 | foo
6602 |}
6603 !! html/*
6604 <table>
6605
6606
6607 <tr>
6608 <td> foo
6609 </td></tr></table>
6610
6611 !! end
6612
6613 !! test
6614 Table attributes with empty value
6615 !! options
6616 parsoid=wt2html,html2html
6617 !! wikitext
6618 {|
6619 | style=| hello
6620 |}
6621 !! html/php
6622 <table>
6623 <tr>
6624 <td style=""> hello
6625 </td></tr></table>
6626
6627 !! html/parsoid
6628 <table>
6629 <tbody><tr><td style=""> hello</td></tr>
6630 </tbody></table>
6631 !! end
6632
6633 !! test
6634 Wikitext table with a lot of comments
6635 !! wikitext
6636 {|
6637 <!-- c0 -->
6638 | foo
6639 <!-- c1 -->
6640 |-<!-- c2 -->
6641 <!-- c3 -->
6642 |<!-- c4 -->
6643 <!-- c5 -->
6644 |}
6645 !! html
6646 <table>
6647 <tr>
6648 <td> foo
6649 </td></tr>
6650 <tr>
6651 <td>
6652 </td></tr></table>
6653
6654 !! end
6655
6656 !! test
6657 Wikitext table comments represented in parsoid dom
6658 !! wikitext
6659 {|<!--c1--><!--c2-->
6660 |-<!--c3-->
6661 | x
6662 |}
6663 !! html/php+tidy
6664 <table>
6665 <tr>
6666 <td>x</td>
6667 </tr>
6668 </table>
6669 !! html/parsoid
6670 <table><!--c1--><!--c2-->
6671 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6672 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6673 </tbody></table>
6674 !! end
6675
6676 !! test
6677 Wikitext table with double-line table cell
6678 !! wikitext
6679 {|
6680 |a
6681 b
6682 |}
6683 !! html
6684 <table>
6685 <tr>
6686 <td>a
6687 <p>b
6688 </p>
6689 </td></tr></table>
6690
6691 !! end
6692
6693 !! test
6694 Table cell with a single comment
6695 !! wikitext
6696 {|
6697 | <!-- c1 -->
6698 | a
6699 |}
6700 !! html
6701 <table>
6702 <tr>
6703 <td>
6704 </td>
6705 <td> a
6706 </td></tr></table>
6707
6708 !! end
6709
6710 !! test
6711 Table-cell after a comment-only-empty-line
6712 !! wikitext
6713 {|
6714 |a
6715 <!--c1-->
6716 <!--c2-->| b
6717 |}
6718 !! html
6719 <table>
6720 <tr>
6721 <td>a
6722 </td>
6723 <td> b
6724 </td></tr></table>
6725
6726 !! html/parsoid
6727 <table>
6728 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6729 <!--c1-->
6730 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6731 </tbody></table>
6732
6733 !! end
6734
6735 !! test
6736 Build table with {{!}}
6737 !! wikitext
6738 {{{!}} class="wikitable"
6739 ! header
6740 ! second header
6741 {{!}}- style="color:red;"
6742 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6743 {{!}}}
6744 !! html
6745 <table class="wikitable">
6746 <tr>
6747 <th> header
6748 </th>
6749 <th> second header
6750 </th></tr>
6751 <tr style="color:red;">
6752 <td> data </td>
6753 <td style="color:red;"> second data
6754 </td></tr></table>
6755
6756 !! end
6757
6758 !! test
6759 Build table with pipe as data
6760 !! wikitext
6761 {| class="wikitable"
6762 ! header
6763 ! second header
6764 |- style="color:red;"
6765 | data || style="color:red;" | second data
6766 |-
6767 | style="color:red;" | data with | || style="color:red;" | second data with |
6768 |-
6769 || data with | ||| second data with |
6770 |}
6771 !! html
6772 <table class="wikitable">
6773 <tr>
6774 <th> header
6775 </th>
6776 <th> second header
6777 </th></tr>
6778 <tr style="color:red;">
6779 <td> data </td>
6780 <td style="color:red;"> second data
6781 </td></tr>
6782 <tr>
6783 <td style="color:red;"> data with | </td>
6784 <td style="color:red;"> second data with |
6785 </td></tr>
6786 <tr>
6787 <td> data with | </td>
6788 <td> second data with |
6789 </td></tr></table>
6790
6791 !! end
6792
6793 !! test
6794 Build table with wikilink
6795 !! wikitext
6796 {| class="wikitable"
6797 ! header || second header
6798 |- style="color:red;"
6799 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6800 |-
6801 | data || second data [[Main Page|link|text with pipe]]
6802 |}
6803 !! html
6804 <table class="wikitable">
6805 <tr>
6806 <th> header </th>
6807 <th> second header
6808 </th></tr>
6809 <tr style="color:red;">
6810 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6811 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6812 </td></tr>
6813 <tr>
6814 <td> data </td>
6815 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6816 </td></tr></table>
6817
6818 !! end
6819
6820 # The expected HTML structure in this test is debatable. The PHP parser does
6821 # not parse this kind of table at all. The main focus for Parsoid is on
6822 # round-tripping, so this output is ok for now. TODO: revisit!
6823 !! test
6824 Wikitext table with html-syntax row
6825 !! wikitext
6826 {|
6827 |-
6828 <td>foo</td>
6829 |}
6830 !! html/parsoid
6831 <table>
6832 <tbody>
6833 <tr>
6834 <td>foo</td></tr></tbody></table>
6835 !! end
6836
6837 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6838 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6839 ## PHP parser, which tidy then compounds by fostering the content
6840 ## entirely out of the table. Parsoid recognizes the table context
6841 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6842 ## depends on PHP's treatment of broken table markup!
6843 !! test
6844 Implicit <td> after a |-
6845 !! options
6846 parsoid=wt2html,html2html
6847 !! wikitext
6848 {|
6849 |-
6850 a
6851 |}
6852 !! html/php
6853 <table>
6854
6855 a
6856 </table>
6857
6858 !! html/php+tidy
6859 <p>a</p>
6860 !! html/parsoid
6861 <table>
6862 <tr><td>a</td></tr>
6863 </table>
6864 !! end
6865
6866 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6867 !! test
6868 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6869 !! options
6870 parsoid=wt2html,html2html
6871 !! wikitext
6872 {|
6873 |-
6874 |
6875 a
6876 |-
6877 b
6878 |}
6879 !! html/php
6880 <table>
6881
6882 <tr>
6883 <td>
6884 <pre>a
6885 </pre>
6886 </td></tr>
6887 b
6888 </table>
6889
6890 !! html/php+tidy
6891 <p>b</p>
6892 <table>
6893 <tr>
6894 <td>
6895 <pre>
6896 a
6897 </pre></td>
6898 </tr>
6899 </table>
6900 !! html/parsoid
6901 <table>
6902 <tbody>
6903 <tr><td><pre>a</pre></td></tr>
6904 <tr><td> b</td></tr>
6905 </tbody>
6906 </table>
6907 !! end
6908
6909 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6910 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6911 !! test
6912 Lists should be recognized in an implicit <td> context
6913 !! options
6914 parsoid=wt2html,html2html
6915 !! wikitext
6916 {|
6917 |-
6918 *a
6919 |}
6920 !! html/php
6921 <table>
6922
6923 <ul><li>a</li></ul>
6924 </table>
6925
6926 !! html/php+tidy
6927 <ul>
6928 <li>a</li>
6929 </ul>
6930 !! html/parsoid
6931 <table>
6932 <tr>
6933 <td><ul>
6934 <li>a</li>
6935 </ul></td>
6936 </tr>
6937 </table>
6938 !! end
6939
6940 !! test
6941 Table cells not properly parsed in an implicit-td context
6942 !! wikitext
6943 {|
6944 |-
6945 {{table_attribs_4}} || a || b
6946 |}
6947 !! html/php+tidy
6948 <table>
6949 <tr>
6950 <td style="background-color:#DC241f;" width="10px"></td>
6951 <td>a</td>
6952 <td>b</td>
6953 </tr>
6954 </table>
6955 !! html/parsoid
6956 <table>
6957 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6958 <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>
6959 </tbody></table>
6960 !! end
6961
6962 !! test
6963 Parsoid: Round-trip tables directly followed by content (bug 51219)
6964 !! options
6965 parsoid=wt2html,wt2wt
6966 !! wikitext
6967 {|
6968 |foo
6969 |} bar
6970
6971 {|
6972 |baz
6973 |}<b>quux</b>
6974 !! html+tidy
6975 <table>
6976 <tr>
6977 <td>foo</td>
6978 </tr>
6979 </table>
6980 <p>bar</p>
6981 <table>
6982 <tr>
6983 <td>baz</td>
6984 </tr>
6985 </table>
6986 <p><b>quux</b></p>
6987 !! end
6988
6989 !! test
6990 Parsoid: Default to a newline after tables in new content (bug 51219)
6991 !! options
6992 parsoid=html2wt
6993 !! html/parsoid
6994 <table><tbody>
6995 <tr><td>foo</td></tr></tbody></table> bar
6996 <table><tbody>
6997 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6998 !! wikitext
6999 {|
7000 |foo
7001 |}
7002 <nowiki> </nowiki>bar
7003 {|
7004 |baz
7005 |}
7006 '''quux'''
7007 !! end
7008
7009 !! test
7010 Parsoid: newline inducing block nodes don't suppress <nowiki>
7011 !! options
7012 parsoid=html2wt
7013 !! html/parsoid
7014 a<h1>foo</h1>
7015 !! wikitext
7016 <nowiki> </nowiki>a
7017
7018 = foo =
7019 !! end
7020
7021 !! test
7022 Parsoid: Row-syntax table headings followed by comment & table cells
7023 !! options
7024 parsoid=wt2html,wt2wt
7025 !! wikitext
7026 {|
7027 ! foo || bar
7028 <!-- foo --> || baz || quux
7029 |}
7030 !! html/php
7031 <table>
7032 <tr>
7033 <th> foo </th>
7034 <th> bar
7035 </th>
7036 <td> baz </td>
7037 <td> quux
7038 </td></tr></table>
7039
7040 !! html/parsoid
7041 <table>
7042 <tbody><tr><th> foo </th><th> bar
7043 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7044 </tbody></table>
7045 !! end
7046
7047 !!test
7048 Parsoid: Recover better from broken table attributes
7049 !!options
7050 parsoid=wt2html
7051 !!wikitext
7052 {| class="foo
7053 | class="bar" |
7054 foo
7055 |}
7056 !!html/php+tidy
7057 <table class="foo">
7058 <tr>
7059 <td class="bar">
7060 <p>foo</p>
7061 </td>
7062 </tr>
7063 </table>
7064 !!html/parsoid
7065 <table class="foo">
7066 <tr>
7067 <td class="bar">
7068 <p>foo</p></td></tr>
7069 </tbody></table>
7070 !!end
7071
7072 !! test
7073 Tables: Digest broken attributes on table and tr tag
7074 !! options
7075 parsoid=wt2html
7076 !! wikitext
7077 {| || |} ++
7078 |- || || ++ --
7079 |- > [
7080 |}
7081 !! html
7082 <table>
7083 <tbody>
7084 <tr></tr>
7085 <tr></tr>
7086 </tbody></table>
7087 !! end
7088
7089 # T137406: Whitespace in the HTML
7090 !! test
7091 1. Generate correct wikitext for tables with thead/tbody/tfoot
7092 !! options
7093 parsoid=html2wt
7094 !! html/parsoid
7095 <table>
7096 <caption>Test</caption>
7097 <thead>
7098 <tr>
7099 <th>Month</th>
7100 <th>Savings</th>
7101 </tr>
7102 </thead>
7103 <tbody>
7104 <tr>
7105 <td>January</td>
7106 <td>$100</td>
7107 </tr>
7108 <tr>
7109 <td>February</td>
7110 <td>$80</td>
7111 </tr>
7112 </tbody>
7113 <tfoot>
7114 <tr>
7115 <td>Sum</td>
7116 <td>$180</td>
7117 </tr>
7118 </tfoot>
7119 </table>
7120 !! wikitext
7121 {|
7122 |+Test
7123 !Month
7124 !Savings
7125 |-
7126 |January
7127 |$100
7128 |-
7129 |February
7130 |$80
7131 |-
7132 |Sum
7133 |$180
7134 |}
7135 !! html/php+tidy
7136 <table>
7137 <caption>Test</caption>
7138 <tr>
7139 <th>Month</th>
7140 <th>Savings</th>
7141 </tr>
7142 <tr>
7143 <td>January</td>
7144 <td>$100</td>
7145 </tr>
7146 <tr>
7147 <td>February</td>
7148 <td>$80</td>
7149 </tr>
7150 <tr>
7151 <td>Sum</td>
7152 <td>$180</td>
7153 </tr>
7154 </table>
7155 !! end
7156
7157 # T137406: No whitespace in the HTML
7158 !! test
7159 2. Generate correct wikitext for tables with thead/tbody/tfoot
7160 !! options
7161 parsoid=html2wt
7162 !! html/parsoid
7163 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7164 !! wikitext
7165 {|
7166 !heading
7167 |-
7168 |foo
7169 |}
7170 !! end
7171
7172 !! test
7173 Testing serialization after deletion in references
7174 !! options
7175 parsoid={
7176 "modes": ["wt2wt"],
7177 "changes": [
7178 ["#x", "remove"]
7179 ]
7180 }
7181 !! wikitext
7182 hi <ref><div id="x">ho</div></ref>
7183
7184 <references />
7185 !! wikitext/edited
7186 hi <ref></ref>
7187
7188 <references />
7189 !! end
7190
7191 !!test
7192 Testing serialization after deletion of table cells
7193 !!options
7194 parsoid={
7195 "modes": ["wt2wt", "selser"],
7196 "changes": [
7197 ["#x", "remove"]
7198 ]
7199 }
7200 !!wikitext
7201 {|
7202 !h1 !!h2 !!h3
7203 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7204 |}
7205 !! wikitext/edited
7206 {|
7207 !h1 !!h2 !!h3
7208 |c2 |||c3
7209 |}
7210 !!end
7211
7212 !! test
7213 Testing selser after addition of new row before first row (T125419)
7214 !! options
7215 parsoid={
7216 "modes": ["wt2wt", "selser"],
7217 "changes": [
7218 [ "tr", "before", "<tr><td>X</td></tr>" ]
7219 ]
7220 }
7221 !! wikitext
7222 {|
7223 |a
7224 |}
7225 !! wikitext/edited
7226 {|
7227 |X
7228 |-
7229 |a
7230 |}
7231 !! end
7232
7233 !! test
7234 Serialize new table rows in a HTML table using HTML tags
7235 !! options
7236 parsoid={
7237 "modes": ["wt2wt", "selser"],
7238 "changes": [
7239 [ "tr", "before", "<tr><td>X</td></tr>" ]
7240 ]
7241 }
7242 !! wikitext
7243 <table><tr><td>a</td></tr></table>
7244 !! wikitext/edited
7245 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7246 !! end
7247
7248 !! test
7249 Serialize new table cells in a HTML row using HTML tags
7250 !! options
7251 parsoid={
7252 "modes": ["wt2wt", "selser"],
7253 "changes": [
7254 [ "td", "before", "<td>X</td>" ]
7255 ]
7256 }
7257 !! wikitext
7258 <table><tr><td>a</td></tr></table>
7259 !! wikitext/edited
7260 <table><tr><td>X</td><td>a</td></tr></table>
7261 !! end
7262
7263 !! test
7264 Wikitext tables can be nested inside HTML tables
7265 !! options
7266 parsoid=html2wt
7267 !! html
7268 <table data-parsoid='{"stx":"html"}'>
7269 <tr><td>
7270 <table>
7271 <tr><td>foo</td></tr>
7272 </table>
7273 </td></tr>
7274 </table>
7275 !! wikitext
7276 <table>
7277 <tr><td>
7278 {|
7279 |foo
7280 |}
7281 </td></tr>
7282 </table>
7283 !! end
7284
7285 !! test
7286 Serialize wikitext list items as HTML list items when embedded in a HTML list
7287 !! options
7288 parsoid=html2wt
7289 !! html
7290 <ul data-parsoid='{"stx": "html"}'>
7291 <li data-parsoid='{}'>a</li>
7292 <li>b</li>
7293 </ul>
7294 !! wikitext
7295 <ul>
7296 <li>a</li>
7297 <li>b</li>
7298 </ul>
7299 !! end
7300
7301 # SSS FIXME: Is this actually a good thing given the
7302 # odd nested list output that is generated by MW?
7303 # <ul><li>foo<ul>..</ul></li></ul> instead of
7304 # <ul><li>foo</li><ul>..</ul></ul>
7305 !! test
7306 Wikitext lists can be nested inside HTML lists
7307 !! options
7308 parsoid=html2wt
7309 !! html
7310 <ul data-parsoid='{"stx": "html"}'>
7311 <li data-parsoid='{"stx": "html"}'>a
7312 <ul><li>b</li></ul>
7313 </li>
7314 </ul>
7315
7316 <ul data-parsoid='{"stx": "html"}'>
7317 <li>x
7318 <ul><li>y</li></ul>
7319 </li>
7320 </ul>
7321 !! wikitext
7322 <ul>
7323 <li>a
7324 * b
7325 </li>
7326 </ul>
7327
7328 <ul>
7329 <li>x
7330 * y
7331 </li>
7332 </ul>
7333 !! end
7334
7335 ###
7336 ### Internal links
7337 ###
7338 !! test
7339 Plain link, capitalized
7340 !! wikitext
7341 [[Main Page]]
7342 !! html
7343 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7344 </p>
7345 !! end
7346
7347 !! test
7348 Plain link, uncapitalized
7349 !! wikitext
7350 [[main Page]]
7351 !! html
7352 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7353 </p>
7354 !! end
7355
7356 !! test
7357 Piped link
7358 !! wikitext
7359 [[Main Page|The Main Page]]
7360 !! html
7361 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7362 </p>
7363 !! end
7364
7365 !! test
7366 Piped link with comment in link text
7367 !! wikitext
7368 [[Main Page|The Main<!--front--> Page]]
7369 !! html
7370 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7371 </p>
7372 !! end
7373
7374 !! test
7375 Piped link with multiple pipe characters in link text
7376 !! wikitext
7377 [[Main Page||The|Main|Page|]]
7378 !! html/php
7379 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7380 </p>
7381 !! html/parsoid
7382 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7383 !! end
7384
7385 !! test
7386 Piped link with no link text
7387 !! wikitext
7388 [[Thomas Bek (bishop of St David's)|]]
7389 !! html/php
7390 <p>[[Thomas Bek (bishop of St David's)|]]
7391 </p>
7392 !! html/parsoid
7393 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7394 !! end
7395
7396 !! test
7397 Broken link
7398 !! wikitext
7399 [[Zigzagzogzagzig]]
7400 !! html
7401 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7402 </p>
7403 !! end
7404
7405 !! test
7406 Broken link with fragment
7407 !! wikitext
7408 [[Zigzagzogzagzig#zug]]
7409 !! html
7410 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7411 </p>
7412 !! end
7413
7414 !! test
7415 Special page link with fragment
7416 !! wikitext
7417 [[Special:Version#anchor]]
7418 !! html
7419 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7420 </p>
7421 !! end
7422
7423 !! test
7424 Nonexistent special page link with fragment
7425 !! wikitext
7426 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7427 !! html
7428 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7429 </p>
7430 !! end
7431
7432 !! test
7433 Link with prefix
7434 !! wikitext
7435 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7436 !! html
7437 <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>
7438 </p>
7439 !! end
7440
7441 !! test
7442 Link with suffix
7443 !! wikitext
7444 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7445 !! html
7446 <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>!!!
7447 </p>
7448 !! end
7449
7450 !! article
7451 prefixed article
7452 !! text
7453 Some text
7454 !! endarticle
7455
7456 !! test
7457 Bug 43661: Piped links with identical prefixes
7458 !! wikitext
7459 [[prefixed article|prefixed articles with spaces]]
7460
7461 [[prefixed article|prefixed articlesaoeu]]
7462
7463 [[Main Page|Main Page test]]
7464 !! html
7465 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7466 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7467 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7468 </p>
7469 !! end
7470
7471
7472 !! test
7473 Link with HTML entity in suffix / tail
7474 !! wikitext
7475 [[Main Page]]&quot;, [[Main Page]]&#97;
7476 !! html/php
7477 <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;
7478 </p>
7479 !! html/parsoid
7480 <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>
7481 !! end
7482
7483 !! test
7484 Link with 3 brackets
7485 !! wikitext
7486 [[[Main Page]]]
7487 Foo [[[Main Page]]]
7488 !! html
7489 <p>[[[Main Page]]]
7490 Foo [[[Main Page]]]
7491 </p>
7492 !! end
7493
7494 !! test
7495 Link with 4 brackets
7496 !! wikitext
7497 [[[[Main Page]]]]
7498 !! html
7499 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7500 </p>
7501 !! end
7502
7503 !! test
7504 Piped link with 3 brackets
7505 !! wikitext
7506 [[[main page|the main page]]]
7507 !! html
7508 <p>[[[main page|the main page]]]
7509 </p>
7510 !! end
7511
7512 !! test
7513 Piped link with extlink-like text
7514 !! wikitext
7515 [[Main Page|[bar]]]
7516 [[Main Page|This is a [bar]]]
7517 !! html/php
7518 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7519 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7520 </p>
7521 !! html/parsoid
7522 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7523 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7524 !! end
7525
7526 !! test
7527 Link with multiple pipes
7528 !! wikitext
7529 [[Main Page|The|Main|Page]]
7530 !! html
7531 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7532 </p>
7533 !! end
7534
7535 # Note that parsoid does not munge anchor text; all non-space
7536 # characters are valid in HTML5 ids.
7537 !! test
7538 Anchor containing a #. (bug 63430)
7539 !! wikitext
7540 [[Main Page#And#Link]]
7541 !! html/php
7542 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7543 </p>
7544 !! html/parsoid
7545 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7546 !! end
7547
7548 !! test
7549 Link to namespaces
7550 !! wikitext
7551 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7552 !! html
7553 <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>
7554 </p>
7555 !! end
7556
7557 !! test
7558 Link with space in namespace
7559 !! wikitext
7560 [[User talk:Foo bar]]
7561 !! html
7562 <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>
7563 </p>
7564 !! end
7565
7566 !! article
7567 MemoryAlpha:AlphaTest
7568 !! text
7569 This is an article in the MemoryAlpha namespace
7570 (which shadows the memoryalpha interwiki link).
7571 !! endarticle
7572
7573 !! test
7574 Namespace takes precedence over interwiki link (bug 51680)
7575 !! wikitext
7576 [[MemoryAlpha:AlphaTest]]
7577 !! html
7578 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7579 </p>
7580 !! end
7581
7582 # The previous test doesn't work correctly in html2*, due to not recognizing the
7583 # link as an internal one. This one checks for the correct behavior.
7584 !! test
7585 Link to namespace preferred over interwiki with correct rel attribute
7586 !! options
7587 parsoid=html2wt,html2html
7588 !! html/parsoid
7589 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7590 !! wikitext
7591 [[MemoryAlpha:AlphaTest]]
7592 !! end
7593
7594 !! test
7595 Piped link to namespace
7596 !! wikitext
7597 [[Meta:Disclaimers|The disclaimers]]
7598 !! html
7599 <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>
7600 </p>
7601 !! end
7602
7603 !! test
7604 Link containing }
7605 !! wikitext
7606 [[Usually caused by a typo (oops}]]
7607 !! html
7608 <p>[[Usually caused by a typo (oops}]]
7609 </p>
7610 !! end
7611
7612 !! article
7613 7% Solution
7614 !! text
7615 Just a test of an article title containing a percent.
7616 !! endarticle
7617
7618 !! test
7619 Link containing % (not as a hex sequence)
7620 !! wikitext
7621 [[7% Solution]]
7622 !! html/php
7623 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7624 </p>
7625 !! html/parsoid
7626 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7627 !! end
7628
7629 # note that the parsoid HTML is identical to the previous test output,
7630 # so the previous test ensures that the html2wt mode will generate the
7631 # "not as a hex sequence" wikitext.
7632 !! test
7633 Link containing % as a single hex sequence interpreted to char
7634 !! options
7635 parsoid=wt2wt,wt2html,html2html
7636 !! wikitext
7637 [[7%25 Solution]]
7638 !! html/php
7639 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7640 </p>
7641 !! html/parsoid
7642 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7643 !!end
7644
7645 !! test
7646 Link containing % as a double hex sequence interpreted to hex sequence
7647 !! wikitext
7648 [[7%2525 Solution]]
7649 !! html
7650 <p>[[7%2525 Solution]]
7651 </p>
7652 !!end
7653
7654 # note that parsoid does not munge anchor text; all non-space
7655 # characters are valid in HTML5 anchors.
7656 !! test
7657 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7658 Example for such a section: == < ==
7659 !! wikitext
7660 [[%23%3c]][[%23%3e]]
7661 !! html/php
7662 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7663 </p>
7664 !! html/parsoid
7665 <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>
7666 !! end
7667
7668 !! test
7669 Link containing "<#" and ">#" as a hex sequences
7670 !! wikitext
7671 [[%3c%23]][[%3e%23]]
7672 !! html
7673 <p>[[%3c%23]][[%3e%23]]
7674 </p>
7675 !! end
7676
7677 !! test
7678 Link containing an equals sign
7679 !! wikitext
7680 [[Special:BookSources/isbn=4-00-026157-6]]
7681 !! html/php
7682 <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>
7683 </p>
7684 !! html/parsoid
7685 <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>
7686 !! end
7687
7688 !! article
7689 Foo~bar
7690 !! text
7691 Just a test of an article title containing a tilde.
7692 !! endarticle
7693
7694 # note that links containing signatures, like [[Foo~~~~]], are
7695 # massaged by the pre-save transform (PST) and so the tildes are never
7696 # seen by the parser.
7697 !! test
7698 Link containing a tilde
7699 !! wikitext
7700 [[Foo~bar]]
7701 !! html/php
7702 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7703 </p>
7704 !! html/parsoid
7705 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7706 !! end
7707
7708 !! test
7709 Link containing double-single-quotes '' (bug 4598)
7710 !! wikitext
7711 [[Lista d''e paise d''o munno]]
7712 !! html/php
7713 <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>
7714 </p>
7715 !! html/parsoid
7716 <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>
7717 !! end
7718
7719 !! test
7720 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7721 !! wikitext
7722 Some [[Link|pretty ''italics'' and stuff]]!
7723 !! html/php
7724 <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>!
7725 </p>
7726 !! html/parsoid
7727 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7728 !! end
7729
7730 !! test
7731 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7732 !! wikitext
7733 ''Some [[Link|pretty ''italics'' and stuff]]!''
7734 !! html
7735 <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>
7736 </p>
7737 !! end
7738
7739 !! test
7740 Link with double quotes in title part (literal) and alternate part (interpreted)
7741 !! wikitext
7742 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7743
7744 [[''Pentecoste'']]
7745
7746 [[''Pentecoste''|Pentecoste]]
7747
7748 [[''Pentecoste''|''Pentecoste'']]
7749 !! html/php
7750 <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>
7751 </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>
7752 </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>
7753 </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>
7754 </p>
7755 !! html/parsoid
7756 <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>
7757 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7758 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7759 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7760 !! end
7761
7762 !! test
7763 Broken image links with HTML captions (bug 39700)
7764 !! wikitext
7765 [[File:Nonexistent|<script></script>]]
7766 [[File:Nonexistent|100x100px|<script></script>]]
7767 [[File:Nonexistent|&lt;]]
7768 [[File:Nonexistent|a<i>b</i>c]]
7769 !! html/php
7770 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7771 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7772 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7773 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7774 </p>
7775 !! html/parsoid
7776 <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>
7777 <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>
7778 <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>
7779 <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>
7780 !! end
7781
7782 !! test
7783 Plain link to URL
7784 !! wikitext
7785 [[http://www.example.com]]
7786 !! html/php
7787 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7788 </p>
7789 !! html/parsoid
7790 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7791 !! end
7792
7793 !! test
7794 Plain link to URL with link text
7795 !! wikitext
7796 [[http://www.example.com Link text]]
7797 !! html
7798 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7799 </p>
7800 !! end
7801
7802 !! test
7803 Plain link to protocol-relative URL
7804 !! wikitext
7805 [[//www.example.com]]
7806 !! html/php
7807 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7808 </p>
7809 !! html/parsoid
7810 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7811 !! end
7812
7813 !! test
7814 Plain link to protocol-relative URL with link text
7815 !! wikitext
7816 [[//www.example.com Link text]]
7817 !! html
7818 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7819 </p>
7820 !! end
7821
7822 !! test
7823 Plain link to page with question mark in title
7824 !! wikitext
7825 [[A?b]]
7826
7827 [[A?b|Baz]]
7828 !! html
7829 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7830 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7831 </p>
7832 !! end
7833
7834
7835 # I'm fairly sure the expected result here is wrong.
7836 # We want these to be URL links, not pseudo-pages with URLs for titles....
7837 # However the current output is also pretty screwy.
7838 #
7839 # ----
7840 # I'm changing it to match the current output--it arguably makes more
7841 # sense in the light of the test above. Old expected result was:
7842 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7843 #</p>
7844 # But I think this test is bordering on "garbage in, garbage out" anyway.
7845 # -- wtm
7846 !! test
7847 Piped link to URL
7848 !! wikitext
7849 Piped link to URL: [[http://www.example.com|an example URL]]
7850 !! html/php
7851 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7852 </p>
7853 !! html/parsoid
7854 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7855 !! end
7856
7857 !! test
7858 BUG 2: [[page|http://url/]] should link to page, not http://url/
7859 !! wikitext
7860 [[Main Page|http://url/]]
7861 !! html/php
7862 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7863 </p>
7864 !! html/parsoid
7865 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7866 !! end
7867
7868 # Parsoid does not mark self-links, by design.
7869 !! test
7870 BUG 337: Escaped self-links should be bold
7871 !! options
7872 title=[[Bug462]]
7873 !! wikitext
7874 [[Bu&#103;462]] [[Bug462]]
7875 !! html/php
7876 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7877 </p>
7878 !! html/php+tidy
7879 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7880 !! html/parsoid
7881 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7882 !! end
7883
7884 !! test
7885 Self-link to section should not be bold
7886 !! options
7887 title=[[Main Page]]
7888 !! wikitext
7889 [[Main Page#section]]
7890 !! html
7891 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7892 </p>
7893 !! end
7894
7895 !! article
7896 00
7897 !! text
7898 This is 00.
7899 !! endarticle
7900
7901 !!test
7902 Self-link to numeric title
7903 !!options
7904 title=[[0]]
7905 !! wikitext
7906 [[0]]
7907 !! html
7908 <p><strong class="selflink">0</strong>
7909 </p>
7910 !!end
7911
7912 !!test
7913 Link to numeric-equivalent title
7914 !!options
7915 title=[[0]]
7916 !! wikitext
7917 [[00]]
7918 !! html
7919 <p><a href="/wiki/00" title="00">00</a>
7920 </p>
7921 !!end
7922
7923 !! test
7924 <nowiki> inside a link
7925 !! wikitext
7926 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7927 !! html
7928 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7929 </p>
7930 !! end
7931
7932 !! test
7933 Non-breaking spaces in title
7934 !! wikitext
7935 [[&nbsp; Main &nbsp; Page &nbsp;]]
7936 !! html
7937 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7938 </p>
7939 !!end
7940
7941 !! test
7942 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7943 !! options
7944 language=ca
7945 !! wikitext
7946 '''[[Main Page]]'''
7947 !! html
7948 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7949 </p>
7950 !! end
7951
7952 !! test
7953 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7954 !! options
7955 language=ca
7956 !! wikitext
7957 ''[[Main Page]]''
7958 !! html
7959 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7960 </p>
7961 !! end
7962
7963 !! test
7964 Internal link with en linktrail: no apostrophes (bug 27473)
7965 !! options
7966 language=en
7967 !! wikitext
7968 [[Something]]'nice
7969 !! html
7970 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7971 </p>
7972 !! end
7973
7974 !! test
7975 Internal link with ca linktrail with apostrophes (bug 27473)
7976 !! options
7977 language=ca
7978 !! wikitext
7979 [[Something]]'nice
7980 !! html
7981 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7982 </p>
7983 !! end
7984
7985 !! test
7986 Internal link with kaa linktrail with apostrophes (bug 27473)
7987 !! options
7988 language=kaa
7989 !! wikitext
7990 [[Something]]'nice
7991 !! html
7992 <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>
7993 </p>
7994 !! end
7995
7996 !! test
7997 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7998 !! wikitext
7999 [[User:Foo/Test/63636:Bar|Test]]
8000 !! html/php
8001 <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>
8002 </p>
8003 !! html/parsoid
8004 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8005 !! end
8006
8007 !! test
8008 Purely hash wikilink
8009 !! options
8010 title=[[User:test/123]]
8011 !! wikitext
8012 [[#a|b]]
8013 !! html/php
8014 <p><a href="#a">b</a>
8015 </p>
8016 !! html/parsoid
8017 <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>
8018 !! end
8019
8020 !! test
8021 1. Interaction of linktrail and template encapsulation
8022 !! options
8023 parsoid
8024 !! wikitext
8025 {{echo|[[Foo]]}}l
8026 !! html
8027 <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>
8028 !! end
8029
8030 !! test
8031 2. Interaction of linktrail and template encapsulation
8032 !! options
8033 parsoid
8034 !! wikitext
8035 {{echo|Some [[Fool]]}}s
8036 !! html
8037 <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>
8038 !! end
8039
8040 !! test
8041 3. Interaction of linktrail and template encapsulation
8042 !! options
8043 parsoid
8044 !! wikitext
8045 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8046 !! html
8047 <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>
8048 !! end
8049
8050 !! article
8051 Söfnuður
8052 !! text
8053 Test.
8054 !! endarticle
8055
8056 !! test
8057 Internal link with is link prefix
8058 !! options
8059 language=is
8060 !! wikitext
8061 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8062 !! html
8063 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8064 </p>
8065 !! end
8066
8067 !! article
8068 Mótmælendatrú
8069 !! text
8070 Test.
8071 !! endarticle
8072
8073 !! test
8074 Internal link with is link trail and link prefix
8075 !! options
8076 language=is
8077 !! wikitext
8078 [[mótmælendatrú|xxx]]ar
8079 [[mótmælendatrú]]ar
8080 mótmælenda[[söfnuður]]
8081 mótmælenda[[söfnuður|söfnuðir]]
8082 mótmælenda[[söfnuður|söfnuðir]]xxx
8083 !! html
8084 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8085 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8086 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8087 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8088 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8089 </p>
8090 !! end
8091
8092 !! test
8093 Parsoid link trail escaping
8094 !! options
8095 parsoid=html2wt,html2html
8096 !! html/parsoid
8097 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8098 !! wikitext
8099 [[apple]]<nowiki/>s
8100 !! end
8101
8102 !! test
8103 Parsoid link prefix escaping
8104 !! options
8105 language=is
8106 parsoid=html2wt,html2html
8107 !! html/parsoid
8108 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8109 !! wikitext
8110 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8111 !! end
8112
8113 !! test
8114 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8115 !! wikitext
8116 [[Foo| bar]]
8117
8118 [[Foo| ''bar'']]
8119
8120 [http://wp.org foo]
8121
8122 [http://wp.org ''foo'']
8123 !! html
8124 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8125 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8126 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8127 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8128 </p>
8129 !! end
8130
8131 !! test
8132 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8133 !! options
8134 parsoid
8135 !! wikitext
8136 [[Foo|{{echo|a}} b {{echo|c}}]]
8137 !! html
8138 <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>
8139 !! end
8140
8141 !! test
8142 Link with angle bracket after anchor
8143 !! wikitext
8144 [[Foo#<bar>]]
8145 !! html/php
8146 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8147 </p>
8148 !! html/parsoid
8149 <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>
8150 !! end
8151
8152 ###
8153 ### Interwiki links (see maintenance/interwiki.sql)
8154 ###
8155
8156 !! test
8157 Inline interwiki link
8158 !! options
8159 parsoid=wt2html,wt2wt,html2html
8160 !! wikitext
8161 [[MeatBall:SoftSecurity]]
8162 !! html/php
8163 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8164 </p>
8165 !! html/parsoid
8166 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8167 !! end
8168
8169 !! test
8170 Inline interwiki link with empty title (bug 2372)
8171 !! options
8172 parsoid=wt2html,wt2wt,html2html
8173 !! wikitext
8174 [[MeatBall:]]
8175 !! html/php
8176 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8177 </p>
8178 !! html/parsoid
8179 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8180 !! end
8181
8182 !! test
8183 Interwiki link encoding conversion (bug 1636)
8184 !! wikitext
8185 *[[Wikipedia:ro:Olteni&#0355;a]]
8186 *[[Wikipedia:ro:Olteni&#355;a]]
8187 !! html
8188 <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>
8189 <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>
8190
8191 !! html+tidy
8192 <ul>
8193 <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>
8194 <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>
8195 </ul>
8196 !! end
8197
8198 !! test
8199 Interwiki link with fragment (bug 2130)
8200 !! wikitext
8201 [[MeatBall:SoftSecurity#foo]]
8202 !! html
8203 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8204 </p>
8205 !! end
8206
8207 # Ideally the wikipedia: prefix here should be proto-relative too
8208 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8209 # define the 'en' prefix, and originally the test used 'wikipedia',
8210 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8211 # article.
8212 !! test
8213 Different interwiki prefixes mapping to the same URL
8214 !! wikitext
8215 [[:en:Foo]]
8216
8217 [[:en:Foo|Foo]]
8218
8219 [[wikipedia:Foo]]
8220
8221 [[:wikipedia:Foo|Foo]]
8222
8223 [[wikipedia:en:Foo]]
8224
8225 [[:wikipedia:en:Foo]]
8226
8227 [[ wikiPEdia :Foo]]
8228 !! html/parsoid
8229 <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>
8230
8231 <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>
8232
8233 <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>
8234
8235 <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>
8236
8237 <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>
8238
8239 <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>
8240
8241 <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>
8242 !! end
8243
8244 !! test
8245 Interwiki links that cannot be represented in wiki syntax
8246 !! wikitext
8247 [[meatball:ok]]
8248 [[meatball:ok#foo|ok with fragment]]
8249 [[meatball:ok_as_well?|ok ending with ? mark]]
8250 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8251 [http://de.wikipedia.org/wiki/#foo is just fragment]
8252
8253 !! html/php
8254 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8255 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8256 <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>
8257 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8258 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8259 </p>
8260 !! html/parsoid
8261 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8262 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8263 <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>
8264 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8265 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8266 !! end
8267
8268 !! test
8269 Interwiki links: trail
8270 !! wikitext
8271 [[wikipedia:Foo|Ba]]r
8272 !! html/php
8273 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8274 </p>
8275 !! html/parsoid
8276 <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>
8277 !! end
8278
8279 !! test
8280 Local interwiki link
8281 !! options
8282 parsoid=wt2html,wt2wt,html2html
8283 !! wikitext
8284 [[local:Template:Foo]]
8285 !! html/php
8286 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8287 </p>
8288 !! html/parsoid
8289 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8290 !! end
8291
8292 # Parsoid does not mark self-links, by design.
8293 !! test
8294 Local interwiki link: self-link to current page
8295 !! options
8296 title=[[Main Page]]
8297 parsoid=wt2html,wt2wt,html2html
8298 !! wikitext
8299 [[local:Main Page]]
8300 !! html/php
8301 <p><strong class="selflink">local:Main Page</strong>
8302 </p>
8303 !! html/parsoid
8304 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8305 !! end
8306
8307 !! test
8308 Local interwiki link: prefix only (bug 64167)
8309 !! options
8310 parsoid=wt2html,wt2wt,html2html
8311 !! wikitext
8312 [[local:]]
8313 !! html/php
8314 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8315 </p>
8316 !! html/parsoid
8317 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8318 !! end
8319
8320 !! test
8321 Local interwiki link: with additional interwiki prefix (bug 61357)
8322 !! options
8323 parsoid=wt2html,wt2wt,html2html
8324 !! wikitext
8325 [[local:meatball:Hello]]
8326 !! html/php
8327 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8328 </p>
8329 !! html/parsoid
8330 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8331 !! end
8332
8333 !! test
8334 Multiple local interwiki link prefixes
8335 !! wikitext
8336 [[local:local:local:local:mi:local:Foo]]
8337 !! options
8338 parsoid=wt2html,wt2wt,html2html
8339 !! html/php
8340 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8341 </p>
8342 !! html/parsoid
8343 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8344 !! end
8345
8346 ###
8347 ### Interlanguage links
8348 ### Language links (so that searching for '### language' matches..)
8349 ###
8350
8351 !! test
8352 Interlanguage link
8353 !! wikitext
8354 Blah blah blah
8355 [[zh:Chinese]]
8356 !! html/php
8357 <p>Blah blah blah
8358 </p>
8359 !! html/parsoid
8360 <p>Blah blah blah</p>
8361 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8362 !! end
8363
8364 ## parsoid html2wt will lose the space variations
8365 !! test
8366 Interlanguage link with spacing
8367 !! options
8368 parsoid=wt2html,wt2wt,html2html
8369 !! wikitext
8370 Blah blah blah
8371 [[ zh : Chinese ]]
8372 !! html/php
8373 <p>Blah blah blah
8374 </p>
8375 !! html/parsoid
8376 <p>Blah blah blah</p>
8377 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8378 !! end
8379
8380 !! test
8381 Double interlanguage link
8382 !! wikitext
8383 Blah blah blah
8384 [[es:Spanish]]
8385 [[zh:Chinese]]
8386 !! html/php
8387 <p>Blah blah blah
8388 </p>
8389 !! html/parsoid
8390 <p>Blah blah blah</p>
8391 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8392 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8393 !! end
8394
8395 ## parsoid html2wt will lose the space variations
8396 !! test
8397 Interlanguage link variations
8398 !! options
8399 parsoid=wt2html,wt2wt,html2html
8400 !! wikitext
8401 Blah blah blah
8402 [[ es :Spanish]]
8403 [[ ZH :Chinese]]
8404 [[es:Foo_bar]]
8405 !! html/php
8406 <p>Blah blah blah
8407 </p>
8408 !! html/parsoid
8409 <p>Blah blah blah</p>
8410 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8411 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8412 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8413 !! end
8414
8415 ## parsoid html2wt will normalize the space to _
8416 !! test
8417 Space and question mark encoding in interlanguage links (T95473)
8418 !! options
8419 parsoid=wt2html,wt2wt,html2html
8420 !! wikitext
8421 Blah blah blah
8422 [[es:Foo bar?]]
8423 !! html/php
8424 <p>Blah blah blah
8425 </p>
8426 !! html/parsoid
8427 <p>Blah blah blah</p>
8428 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8429 !! end
8430
8431 !! test
8432 Interlanguage link, with prefix links
8433 !! options
8434 language=ln
8435 !! wikitext
8436 Blah blah blah
8437 [[zh:Chinese]]
8438 !! html/php
8439 <p>Blah blah blah
8440 </p>
8441 !! html/parsoid
8442 <p>Blah blah blah</p>
8443 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8444 !! end
8445
8446 !! test
8447 Double interlanguage link, with prefix links (bug 8897)
8448 !! options
8449 language=ln
8450 !! wikitext
8451 Blah blah blah
8452 [[es:Spanish]]
8453 [[zh:Chinese]]
8454 !! html/php
8455 <p>Blah blah blah
8456 </p>
8457 !! html/parsoid
8458 <p>Blah blah blah</p>
8459 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8460 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8461 !! end
8462
8463 !! test
8464 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8465 !! wikitext
8466 Blah blah blah
8467 [[mul:Article]]
8468 !! html/php
8469 <p>Blah blah blah
8470 </p>
8471 !! html/parsoid
8472 <p>Blah blah blah</p>
8473 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8474 !! end
8475
8476 ## PHP parser tests script needs an update
8477 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8478 !! test
8479 Language links render as inline links if $wgInterwikiMagic=false
8480 !! options
8481 wgInterwikiMagic=false
8482 parsoid=wt2html,wt2wt,html2html
8483 !! wikitext
8484 Blah blah blah
8485 [[zh:Chinese]]
8486 !! html/parsoid
8487 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8488 !! end
8489
8490 ## PHP parser tests script needs an update
8491 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8492 !! test
8493 Language links render as inline links in the Talk namespace
8494 !! options
8495 title=Talk:Foo
8496 parsoid=wt2html,wt2wt,html2html
8497 !! wikitext
8498 Blah blah blah
8499 [[zh:Chinese]]
8500 !! html/parsoid
8501 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8502 !! end
8503
8504 !! test
8505 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8506 !! options
8507 language=ln
8508 !! wikitext
8509 [[WW&nbsp;II]]
8510 !! html
8511 <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>
8512 </p>
8513 !! end
8514
8515 !! test
8516 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8517 !! options
8518 parsoid=html2wt
8519 !! html/parsoid
8520 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8521 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8522 !! wikitext
8523 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8524
8525 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8526 !! end
8527
8528 !! test
8529 Parsoid: handle constructor well
8530 !! wikitext
8531 [[constructor]]
8532
8533 [[constructor:foo]]
8534 !! html/php
8535 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8536 </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>
8537 </p>
8538 !! html/parsoid
8539 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
8540
8541 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
8542 !! end
8543
8544 !! article
8545 ko:
8546 !! text
8547 Test.
8548 !! endarticle
8549
8550 # Note that `ko` isn't a known interlanguage prefix
8551 !! test
8552 Parsoid: recognize interlanguage links without a target page
8553 !! options
8554 ill
8555 !! wikitext
8556 [[es:]]
8557
8558 [[ko:]]
8559 !! html/php
8560 es:
8561 !! html/parsoid
8562 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8563
8564 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8565 !! end
8566
8567 # Note that `ko` isn't a known interwiki prefix
8568 !! test
8569 Parsoid: recognize interwiki links without a target page
8570 !! options
8571 parsoid=wt2html,wt2wt,html2html
8572 !! wikitext
8573 [[:es:]]
8574
8575 [[:ko:]]
8576 !! html/php
8577 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8578 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8579 </p>
8580 !! html/parsoid
8581 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8582 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8583 !! end
8584
8585 !! test
8586 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8587 !! wikitext
8588 [[mi:Foo]]
8589 !! html/php
8590 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8591 </p>
8592 !! html/parsoid
8593 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8594 !! end
8595
8596 !! test
8597 Interlanguage link with preceding local interwiki link (bug 68085)
8598 !! options
8599 parsoid=wt2html,wt2wt,html2html
8600 !! wikitext
8601 Blah blah blah
8602 [[local:es:Spanish]]
8603 !! html/php
8604 <p>Blah blah blah
8605 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8606 </p>
8607 !! html/parsoid
8608 <p>Blah blah blah
8609 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8610 !! end
8611
8612 !! test
8613 Looks like an interlanguage link, but is actually a local interwiki
8614 !! options
8615 parsoid=wt2html,wt2wt,html2html
8616 !! wikitext
8617 Blah blah blah
8618 [[mi:Template:Foo]]
8619 !! html/php
8620 <p>Blah blah blah
8621 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8622 </p>
8623 !! html/parsoid
8624 <p>Blah blah blah
8625 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8626 !! end
8627
8628 ###
8629 ### Redirects, Parsoid-only
8630 ###
8631
8632 !! test
8633 1. Simple redirect to page
8634 !! wikitext
8635 #REDIRECT [[Main Page]]
8636 !! html/parsoid
8637 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8638 !! end
8639
8640 !! test
8641 2. Other redirect variants
8642 !! wikitext
8643 #REDIRECT [[Main_Page]]
8644 !! html/parsoid
8645 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8646 !! end
8647
8648 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8649 # This tests the Parsoid bail-out code.
8650 !! test
8651 3. Other redirect variants
8652 !! wikitext
8653 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8654 !! html/parsoid
8655 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8656 !! end
8657
8658 !! test
8659 4. Redirect to a templated destination
8660 !! wikitext
8661 #REDIRECT [[{{echo|Foo}}bar]]
8662 !! html/parsoid
8663 <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"}]]}'/>
8664 !! end
8665
8666 !! test
8667 Empty redirect
8668 !! options
8669 parsoid=wt2html,wt2wt
8670 !! wikitext
8671 #REDIRECT [[]]
8672 !! html/parsoid
8673 <ol>
8674 <li>REDIRECT [[]]</li></ol>
8675 !! end
8676
8677 !! test
8678 Optional colon in #REDIRECT
8679 !! options
8680 # the colon is archaic syntax. we support it for wt2html, but we
8681 # don't care that it roundtrips back to the modern syntax.
8682 parsoid=wt2html,html2html
8683 !! wikitext
8684 #REDIRECT:[[Main Page]]
8685 !! html/parsoid
8686 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8687 !! end
8688
8689 !! test
8690 Whitespace in #REDIRECT with optional colon
8691 !! options
8692 # the colon and gratuitous whitespace is archaic syntax. we support
8693 # it for wt2html, but we don't care that it roundtrips back to the
8694 # modern syntax (without extra whitespace)
8695 parsoid=wt2html,html2html
8696 !! wikitext
8697
8698 #REDIRECT
8699 :
8700 [[Main Page]]
8701 !! html/parsoid
8702 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8703 !! end
8704
8705 !! test
8706 Piped link in #REDIRECT
8707 !! options
8708 # content after piped link is ignored. we support this syntax,
8709 # but don't care that the piped link is lost when we roundtrip this.
8710 parsoid=wt2html
8711 !! wikitext
8712 #REDIRECT [[Main Page|bar]]
8713 !! html/parsoid
8714 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8715 !! end
8716
8717 !! test
8718 Redirect to category (T104502)
8719 !! options
8720 parsoid=wt2html,wt2wt
8721 !! wikitext
8722 #REDIRECT [[Category:Foo]]
8723 !! html/parsoid
8724 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8725 !! end
8726
8727 !! test
8728 Redirect to category with URL encoding (T104502)
8729 !! options
8730 parsoid=wt2html
8731 !! wikitext
8732 #REDIRECT [[Category%3AFoo]]
8733 !! html/parsoid
8734 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8735 !! end
8736
8737 !! test
8738 Redirect to category page
8739 !! wikitext
8740 #REDIRECT [[:Category:Foo]]
8741 !! html/parsoid
8742 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8743 !! end
8744
8745 !! test
8746 Redirect to image page (1)
8747 !! wikitext
8748 #REDIRECT [[File:Wiki.png]]
8749 !! html/parsoid
8750 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8751 !! end
8752
8753 !! test
8754 Redirect to image page (2)
8755 !! wikitext
8756 #REDIRECT [[Image:Wiki.png]]
8757 !! html/parsoid
8758 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8759 !! end
8760
8761 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8762 # Next test confirms this.
8763 !! test
8764 Redirect to language (1) (T104918)
8765 !! options
8766 parsoid=wt2html,wt2wt,html2html
8767 !! wikitext
8768 #REDIRECT [[en:File:Wiki.png]]
8769 !! html/parsoid
8770 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8771 !! end
8772
8773 !! test
8774 Redirect to language (2) (T104918)
8775 !! wikitext
8776 #REDIRECT [[:en:File:Wiki.png]]
8777 !! html/parsoid
8778 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8779 !! end
8780
8781 !! test
8782 Redirect to interwiki (T104918)
8783 !! wikitext
8784 #REDIRECT [[meatball:File:Wiki.png]]
8785 !! html/parsoid
8786 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8787 !! end
8788
8789 !! test
8790 Non-English #REDIRECT
8791 !! options
8792 language=is
8793 !! wikitext
8794 #TILVÍSUN [[Main Page]]
8795 !! html/parsoid
8796 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8797 !! end
8798
8799 !! test
8800 Redirect syntax under text isn't considered a redirect
8801 !! wikitext
8802 some text
8803 #redirect [[Main Page]]
8804 !! html/parsoid
8805 <p>some text</p>
8806 <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>
8807 !! end
8808
8809 # FIXME: Should hoist the redirect to the top of the page and ensure there
8810 # is only one.
8811 !! test
8812 New redirect
8813 !! options
8814 parsoid=html2wt
8815 !! html/parsoid
8816 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8817 !! wikitext
8818 Foo
8819 #REDIRECT [[Foo]]
8820 !! end
8821
8822 ##
8823 ## XHTML tidiness
8824 ###
8825
8826 !! test
8827 <br> to <br />
8828 !! wikitext
8829 1<br>2<br />3
8830 !! html
8831 <p>1<br />2<br />3
8832 </p>
8833 !! end
8834
8835 !! test
8836 Broken br tag sanitization
8837 !! wikitext
8838 </br>
8839 !! html/php
8840 <p>&lt;/br&gt;
8841 </p>
8842 !! end
8843
8844 # TODO: Fix html2html mode (bug 51055)!
8845 !! test
8846 Parsoid: Broken br tag recognition
8847 !! options
8848 parsoid=wt2html
8849 !! wikitext
8850 </br>
8851
8852 <br/ >
8853 !! html+tidy
8854 <p><br /></p>
8855 <p><br /></p>
8856 !! end
8857
8858 !! test
8859 Incorrecly removing closing slashes from correctly formed XHTML
8860 !! wikitext
8861 <br style="clear:both;" />
8862 !! html
8863 <p><br style="clear:both;" />
8864 </p>
8865 !! end
8866
8867 !! test
8868 Failing to transform badly formed HTML into correct XHTML
8869 !! wikitext
8870 <br style="clear: left;">
8871 <br style="clear: right;">
8872 <br style="clear: both;">
8873 !! html
8874 <p><br style="clear: left;" />
8875 <br style="clear: right;" />
8876 <br style="clear: both;" />
8877 </p>
8878 !!end
8879
8880 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8881 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8882 !! test
8883 Handling html with a div self-closing tag
8884 !! wikitext
8885 <div title />
8886 <div title/>
8887 <div title/ >
8888 <div title=bar />
8889 <div title=bar/>
8890 <div title=bar/ >
8891 !! html/php
8892 <p>&lt;div title /&gt;
8893 &lt;div title/&gt;
8894 </p>
8895 <div>
8896 <p>&lt;div title=bar /&gt;
8897 &lt;div title=bar/&gt;
8898 </p>
8899 <div title="bar/"></div>
8900 </div>
8901
8902 !! html/parsoid
8903 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8904 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8905 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8906 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8907 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8908 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8909 !! end
8910
8911 !! test
8912 Handling html with a br self-closing tag
8913 !! wikitext
8914 <br title />
8915 <br title/>
8916 <br title/ >
8917 <br title=bar />
8918 <br title=bar/>
8919 <br title=bar/ >
8920 !! html/php
8921 <p><br title="" />
8922 <br title="" />
8923 <br />
8924 <br title="bar" />
8925 <br title="bar" />
8926 <br title="bar/" />
8927 </p>
8928 !! html/parsoid
8929 <p><br title="" />
8930 <br title="" />
8931 <br title="" />
8932 <br title="bar" />
8933 <br title="bar" />
8934 <br title="bar/" />
8935 </p>
8936 !! end
8937
8938 !! test
8939 Horizontal ruler (should it add that extra space?)
8940 !! wikitext
8941 <hr>
8942 <hr >
8943 foo <hr
8944 > bar
8945 !! html+tidy
8946 <hr />
8947 <hr />
8948 <p>foo</p>
8949 <hr />
8950 <p>bar</p>
8951 !! end
8952
8953 !! test
8954 Horizontal ruler -- 4+ dashes render hr
8955 !! wikitext
8956 ----
8957 !! html
8958 <hr />
8959
8960 !! end
8961
8962 !! test
8963 Horizontal ruler -- eats additional dashes on the same line
8964 !! wikitext
8965 ---------
8966 !! html
8967 <hr />
8968
8969 !! end
8970
8971 !! test
8972 Horizontal ruler -- does not collapse dashes on consecutive lines
8973 !! wikitext
8974 ----
8975 ----
8976 !! html
8977 <hr />
8978 <hr />
8979
8980 !! end
8981
8982 !! test
8983 Horizontal ruler -- <4 dashes render as plain text
8984 !! wikitext
8985 ---
8986 !! html
8987 <p>---
8988 </p>
8989 !! end
8990
8991 !! test
8992 Horizontal ruler -- Supports content following dashes on same line
8993 !! wikitext
8994 ---- Foo
8995 !! html
8996 <hr /> Foo
8997
8998 !! html+tidy
8999 <hr />
9000 <p>Foo</p>
9001 !! end
9002
9003 ###
9004 ### Block-level elements
9005 ###
9006 !! test
9007 Common list
9008 !! wikitext
9009 *Common list
9010 * item 2
9011 *item 3
9012 !! html
9013 <ul><li>Common list</li>
9014 <li> item 2</li>
9015 <li>item 3</li></ul>
9016
9017 !! end
9018
9019 !! test
9020 Numbered list
9021 !! wikitext
9022 #Numbered list
9023 #item 2
9024 # item 3
9025 !! html
9026 <ol><li>Numbered list</li>
9027 <li>item 2</li>
9028 <li> item 3</li></ol>
9029
9030 !! end
9031
9032 !! test
9033 Mixed list
9034 !! wikitext
9035 *Mixed list
9036 *# with numbers
9037 ** and bullets
9038 *# and numbers
9039 *bullets again
9040 **bullet level 2
9041 ***bullet level 3
9042 ***#Number on level 4
9043 **bullet level 2
9044 **#Number on level 3
9045 **#Number on level 3
9046 *#number level 2
9047 *Level 1
9048 *** Level 3
9049 #** Level 3, but ordered
9050 !! html
9051 <ul><li>Mixed list
9052 <ol><li> with numbers</li></ol>
9053 <ul><li> and bullets</li></ul>
9054 <ol><li> and numbers</li></ol></li>
9055 <li>bullets again
9056 <ul><li>bullet level 2
9057 <ul><li>bullet level 3
9058 <ol><li>Number on level 4</li></ol></li></ul></li>
9059 <li>bullet level 2
9060 <ol><li>Number on level 3</li>
9061 <li>Number on level 3</li></ol></li></ul>
9062 <ol><li>number level 2</li></ol></li>
9063 <li>Level 1
9064 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9065 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9066
9067 !! end
9068
9069 !! test
9070 1. Nested mixed wikitext and html list
9071 !! wikitext
9072 * hi
9073 * <ul><li>ho</li></ul>
9074 * hi
9075 ** ho
9076 !! html/php
9077 <ul><li> hi</li>
9078 <li> <ul><li>ho</li></ul></li>
9079 <li> hi
9080 <ul><li> ho</li></ul></li></ul>
9081
9082 !! html/parsoid
9083 <ul><li> hi</li>
9084 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9085 <li> hi
9086 <ul><li> ho</li></ul></li></ul>
9087 !! end
9088
9089 !! test
9090 2. Nested mixed wikitext and html list (incompatible)
9091 !! wikitext
9092 ; hi
9093 : {{echo|<li>ho</li>}}
9094 !! html/php
9095 <dl><dt> hi</dt>
9096 <dd> <li>ho</li></dd></dl>
9097
9098 !! html/parsoid
9099 <dl><dt> hi</dt>
9100 <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>
9101 !! end
9102
9103 !! test
9104 Nested lists 1
9105 !! wikitext
9106 *foo
9107 **bar
9108 !! html
9109 <ul><li>foo
9110 <ul><li>bar</li></ul></li></ul>
9111
9112 !! end
9113
9114 !! test
9115 Nested lists 2
9116 !! wikitext
9117 **foo
9118 *bar
9119 !! html
9120 <ul><li><ul><li>foo</li></ul></li>
9121 <li>bar</li></ul>
9122
9123 !! end
9124
9125 !! test
9126 Nested lists 3 (first element empty)
9127 !! wikitext
9128 *
9129 **bar
9130 !! html
9131 <ul><li>
9132 <ul><li>bar</li></ul></li></ul>
9133
9134 !! end
9135
9136 !! test
9137 Nested lists 4 (first element empty)
9138 !! wikitext
9139 **
9140 *bar
9141 !! html
9142 <ul><li><ul><li></li></ul></li>
9143 <li>bar</li></ul>
9144
9145 !! end
9146
9147 !! test
9148 Nested lists 5 (both elements empty)
9149 !! wikitext
9150 **
9151 *
9152 !! html
9153 <ul><li><ul><li></li></ul></li>
9154 <li></li></ul>
9155
9156 !! end
9157
9158 !! test
9159 Nested lists 6 (both elements empty)
9160 !! wikitext
9161 *
9162 **
9163 !! html
9164 <ul><li>
9165 <ul><li></li></ul></li></ul>
9166
9167 !! end
9168
9169 !! test
9170 Nested lists 7 (skip initial nesting levels)
9171 !! wikitext
9172 *** foo
9173 !! html
9174 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9175
9176 !! end
9177
9178 !! test
9179 Nested lists 8 (multiple nesting transitions)
9180 !! wikitext
9181 * foo
9182 *** bar
9183 ** baz
9184 * boo
9185 !! html
9186 <ul><li> foo
9187 <ul><li><ul><li> bar</li></ul></li>
9188 <li> baz</li></ul></li>
9189 <li> boo</li></ul>
9190
9191 !! end
9192
9193 !! test
9194 Nested lists 9 (extension interaction)
9195 !! options
9196 parsoid
9197 !! wikitext
9198 *<references />
9199 !! html/parsoid
9200 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9201 !! end
9202
9203 !! test
9204 1. Lists with start-of-line-transparent tokens before bullets: Comments
9205 !! wikitext
9206 *foo
9207 *<!--cmt-->bar
9208 <!--cmt-->*baz
9209 !! html
9210 <ul><li>foo</li>
9211 <li>bar</li>
9212 <li>baz</li></ul>
9213
9214 !! end
9215
9216 !! test
9217 2. Lists with start-of-line-transparent tokens before bullets: Template close
9218 !! wikitext
9219 *foo {{echo|bar
9220 }}*baz
9221 !! html
9222 <ul><li>foo bar</li>
9223 <li>baz</li></ul>
9224
9225 !! end
9226
9227 !! test
9228 List items are not parsed correctly following a <pre> block (bug 785)
9229 !! wikitext
9230 * <pre>foo</pre>
9231 * <pre>bar</pre>
9232 * zar
9233 !! html/php
9234 <ul><li> <pre>foo</pre></li>
9235 <li> <pre>bar</pre></li>
9236 <li> zar</li></ul>
9237
9238 !! html/parsoid
9239 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9240 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9241 <li> zar</li></ul>
9242 !! end
9243
9244 !! test
9245 List items from template
9246 !! wikitext
9247
9248 {{inner list}}
9249 * item 2
9250
9251 * item 0
9252 {{inner list}}
9253 * item 2
9254
9255 * item 0
9256 * notSOL{{inner list}}
9257 * item 2
9258 !! html
9259 <ul><li> item 1</li>
9260 <li> item 2</li></ul>
9261 <ul><li> item 0</li>
9262 <li> item 1</li>
9263 <li> item 2</li></ul>
9264 <ul><li> item 0</li>
9265 <li> notSOL</li>
9266 <li> item 1</li>
9267 <li> item 2</li></ul>
9268
9269 !! end
9270
9271 !! test
9272 List interrupted by empty line or heading
9273 !! wikitext
9274 * foo
9275
9276 ** bar
9277 == A heading ==
9278 * Another list item
9279 !! html
9280 <ul><li> foo</li></ul>
9281 <ul><li><ul><li> bar</li></ul></li></ul>
9282 <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>
9283 <ul><li> Another list item</li></ul>
9284
9285 !!end
9286
9287 !!test
9288 Multiple list tags generated by templates
9289 !! wikitext
9290 {{echo|<li>}}a
9291 {{echo|<li>}}b
9292 {{echo|<li>}}c
9293 !! html
9294 <li>a
9295 <li>b
9296 <li>c</li>
9297 </li>
9298 </li>
9299
9300 !! html+tidy
9301 <ul>
9302 <li>a</li>
9303 <li>b</li>
9304 <li>c</li>
9305 </ul>
9306 !!end
9307
9308 !!test
9309 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9310 !! wikitext
9311 *a
9312 <!--This line will NOT split the list-->
9313 *b
9314 <!--This line will NOT split the list either-->
9315 *c
9316 <!--foo--> <!----> <!--This line NOT split the list either-->
9317 *d
9318 !! html
9319 <ul><li>a</li>
9320 <li>b</li>
9321 <li>c</li>
9322 <li>d</li></ul>
9323
9324 !!end
9325
9326 !!test
9327 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9328 !! wikitext
9329 *a
9330 <!--This line will NOT split the list-->
9331 *b
9332 <!--This line will NOT split the list either-->
9333 *c
9334 <!--foo--> <!----> <!--This line NOT split the list
9335 either-->
9336 *d
9337 !! html
9338 <ul><li>a</li>
9339 <li>b</li>
9340 <li>c</li>
9341 <li>d</li></ul>
9342
9343 !!end
9344
9345 !!test
9346 Test the li-hack
9347 (The PHP parser relies on Tidy for the hack)
9348 !!options
9349 parsoid=wt2html,wt2wt
9350 !! wikitext
9351 * foo
9352 * <li>li-hack
9353 * {{echo|<li>templated li-hack}}
9354 * <!--foo--> <li> unsupported li-hack with preceding comments
9355
9356 <ul>
9357 <li><li>not a li-hack
9358 </li>
9359 </ul>
9360 !! html+tidy
9361 <ul>
9362 <li>foo</li>
9363 <li>li-hack</li>
9364 <li>templated li-hack</li>
9365 <li>unsupported li-hack with preceding comments</li>
9366 </ul>
9367 <ul>
9368 <li>not a li-hack</li>
9369 </ul>
9370 !!end
9371
9372 !! test
9373 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9374 !! options
9375 parsoid
9376 !! wikitext
9377 # foo
9378 ## bar
9379 * foo
9380 ** bar
9381 : foo
9382 :: bar
9383 !! html
9384 <ol>
9385 <li> foo<ol>
9386 <li> bar</li>
9387 </ol></li>
9388 </ol><ul>
9389 <li> foo<ul>
9390 <li> bar</li>
9391 </ul></li>
9392 </ul><dl>
9393 <dd> foo<dl>
9394 <dd> bar</dd>
9395 </dl></dd>
9396 </dl>
9397 !! end
9398
9399 !! test
9400 Parsoid: Test of whitespace serialization with Templated bullets
9401 !! options
9402 parsoid
9403 !! wikitext
9404 * {{bullet}}
9405 !! html
9406 <ul>
9407 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9408 </ul>
9409 !! end
9410
9411 # ------------------------------------------------------------------------
9412 # The next set of tests are about Parsoid's ability to handle badly nested
9413 # tags (parse, minimize scope of fixup, and roundtrip back)
9414 # ------------------------------------------------------------------------
9415
9416 !! test
9417 Unbalanced closing block tags break a list
9418 (php parser relies on Tidy to fix up)
9419 !! wikitext
9420 <div>
9421 *a</div><div>
9422 *b</div>
9423 !! html+tidy
9424 <div>
9425 <ul>
9426 <li>a</li>
9427 </ul>
9428 </div>
9429 <div>
9430 <ul>
9431 <li>b</li>
9432 </ul>
9433 </div>
9434 !! end
9435
9436 # Parsoid fails this test, but it might be tricky to support properly.
9437 # See bug 68395.
9438 !! test
9439 Unbalanced closing non-block tags don't break a list
9440 (php parser relies on Tidy to fix up)
9441 !! wikitext
9442 <span>
9443 *a</span><span>
9444 *b</span>
9445 !! html/php+tidy
9446 <ul>
9447 <li><span>a</span></li>
9448 <li><span>b</span></li>
9449 </ul>
9450 !! html/parsoid
9451 <span>
9452 <ul>
9453 <li>a<span></span>
9454 </li>
9455 <li>b
9456 </li>
9457 </ul>
9458 </span>
9459 !! end
9460
9461 !! test
9462 Unclosed formatting tags that straddle lists are closed and reopened
9463 (php parser relies on Tidy to fix up)
9464 !! options
9465 parsoid=wt2html,wt2wt,html2html
9466 !! wikitext
9467 # <s> a
9468 # b </s>
9469 !! html/php+tidy
9470 <ol>
9471 <li><s>a</s></li>
9472 <li><s>b</s></li>
9473 </ol>
9474 !! html/parsoid
9475 <ol><li> <s> a</s></li>
9476 <li><s> b </s></li></ol>
9477 !! end
9478
9479 # See bug 68395.
9480 !!test
9481 1. List embedded in a formatting tag
9482 !! wikitext
9483 <small>
9484 * foo
9485 </small>
9486 !! html/php+tidy
9487 <ul>
9488 <li><small>foo</small></li>
9489 </ul>
9490 !! html/parsoid
9491 <small>
9492 <ul>
9493 <li> foo</li>
9494 </ul>
9495 </small>
9496 !!end
9497
9498 ## Ugly Parsoid output here
9499 ## Not sure what the right output is.
9500 !!test
9501 2. List embedded in a formatting tag
9502 !! wikitext
9503 <small>
9504 *a
9505 *b</small>
9506 !! html/php+tidy
9507 <ul>
9508 <li><small>a</small></li>
9509 <li><small>b</small></li>
9510 </ul>
9511 !! html/parsoid
9512 <small></small>
9513 <ul><small>
9514 <li>a</li>
9515 </small>
9516 <li><small>b</small></li>
9517 </ul>
9518 !!end
9519
9520 # Ugly Parsoid and PHP parser output here
9521 # Not sure if we want to make this a test!
9522 #
9523 ## !!test
9524 ## 3. Unclosed formatting tags in list elements
9525 ## !! wikitext
9526 ## *<small>a
9527 ## *<small>b
9528 ## !! html/php+tidy
9529 ## <ul>
9530 ## <li><small>a</small></li>
9531 ## <li><small><small>b</small></small></li>
9532 ## </ul>
9533 ## !! html/parsoid
9534 ## <ul>
9535 ## <li><small>a</small></li>
9536 ## <small>
9537 ## <li><small>b</small></li>
9538 ## </small></ul>
9539 ## !!end
9540
9541 # This is a bug in the PHP parser + tidy combination.
9542 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9543 # and then fostered out of the table by tidy.)
9544 # We believe the Parsoid output to be correct.
9545 !! test
9546 Table with missing opening <tr> tag
9547 !! options
9548 parsoid=wt2html,wt2wt
9549 !! wikitext
9550 <table>
9551 <td>foo</td>
9552 </tr>
9553 </table>
9554 !! html+tidy
9555 <table>
9556 <tr>
9557 <td>foo</td>
9558 </tr>
9559 </table>
9560 !! end
9561
9562 ###
9563 ### Magic Words
9564 ###
9565
9566 # Note that the current date is hard-coded as
9567 # 1970-01-01T00:02:03Z (a Thursday)
9568 # when running parser tests. The timezone is also fixed to GMT, so
9569 # local date will be identical to current date.
9570
9571 !! test
9572 Magic Word: {{CURRENTDAY}}
9573 !! wikitext
9574 {{CURRENTDAY}}
9575 !! html
9576 <p>1
9577 </p>
9578 !! end
9579
9580 !! test
9581 Magic Word: {{CURRENTDAY2}}
9582 !! wikitext
9583 {{CURRENTDAY2}}
9584 !! html
9585 <p>01
9586 </p>
9587 !! end
9588
9589 !! test
9590 Magic Word: {{CURRENTDAYNAME}}
9591 !! wikitext
9592 {{CURRENTDAYNAME}}
9593 !! html
9594 <p>Thursday
9595 </p>
9596 !! end
9597
9598 !! test
9599 Magic Word: {{CURRENTDOW}}
9600 !! wikitext
9601 {{CURRENTDOW}}
9602 !! html
9603 <p>4
9604 </p>
9605 !! end
9606
9607 !! test
9608 Magic Word: {{CURRENTMONTH}}
9609 !! wikitext
9610 {{CURRENTMONTH}}
9611 !! html
9612 <p>01
9613 </p>
9614 !! end
9615
9616 !! test
9617 Magic Word: {{CURRENTMONTH1}}
9618 !! wikitext
9619 {{CURRENTMONTH1}}
9620 !! html
9621 <p>1
9622 </p>
9623 !! end
9624
9625 !! test
9626 Magic Word: {{CURRENTMONTHABBREV}}
9627 !! wikitext
9628 {{CURRENTMONTHABBREV}}
9629 !! html
9630 <p>Jan
9631 </p>
9632 !! end
9633
9634 !! test
9635 Magic Word: {{CURRENTMONTHNAME}}
9636 !! wikitext
9637 {{CURRENTMONTHNAME}}
9638 !! html
9639 <p>January
9640 </p>
9641 !! end
9642
9643 !! test
9644 Magic Word: {{CURRENTMONTHNAMEGEN}}
9645 !! wikitext
9646 {{CURRENTMONTHNAMEGEN}}
9647 !! html
9648 <p>January
9649 </p>
9650 !! end
9651
9652 !! test
9653 Magic Word: {{CURRENTTIME}}
9654 !! wikitext
9655 {{CURRENTTIME}}
9656 !! html
9657 <p>00:02
9658 </p>
9659 !! end
9660
9661 !! test
9662 Magic Word: {{CURRENTHOUR}}
9663 !! wikitext
9664 {{CURRENTHOUR}}
9665 !! html
9666 <p>00
9667 </p>
9668 !! end
9669
9670 !! test
9671 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9672 !! wikitext
9673 {{CURRENTWEEK}}
9674 !! html
9675 <p>1
9676 </p>
9677 !! end
9678
9679 !! test
9680 Magic Word: {{CURRENTYEAR}}
9681 !! wikitext
9682 {{CURRENTYEAR}}
9683 !! html
9684 <p>1970
9685 </p>
9686 !! end
9687
9688 !! test
9689 Magic Word: {{CURRENTTIMESTAMP}}
9690 !! wikitext
9691 {{CURRENTTIMESTAMP}}
9692 !! html
9693 <p>19700101000203
9694 </p>
9695 !! end
9696
9697 !! test
9698 Magic Words LOCAL (UTC)
9699 !! wikitext
9700 * {{LOCALMONTH}}
9701 * {{LOCALMONTH1}}
9702 * {{LOCALMONTHNAME}}
9703 * {{LOCALMONTHNAMEGEN}}
9704 * {{LOCALMONTHABBREV}}
9705 * {{LOCALDAY}}
9706 * {{LOCALDAY2}}
9707 * {{LOCALDAYNAME}}
9708 * {{LOCALYEAR}}
9709 * {{LOCALTIME}}
9710 * {{LOCALHOUR}}
9711 * {{LOCALWEEK}}
9712 * {{LOCALDOW}}
9713 * {{LOCALTIMESTAMP}}
9714 !! html
9715 <ul><li> 01</li>
9716 <li> 1</li>
9717 <li> January</li>
9718 <li> January</li>
9719 <li> Jan</li>
9720 <li> 1</li>
9721 <li> 01</li>
9722 <li> Thursday</li>
9723 <li> 1970</li>
9724 <li> 00:02</li>
9725 <li> 00</li>
9726 <li> 1</li>
9727 <li> 4</li>
9728 <li> 19700101000203</li></ul>
9729
9730 !! end
9731
9732 !! test
9733 Magic Word: {{FULLPAGENAME}}
9734 !! options
9735 title=[[User:Ævar Arnfjörð Bjarmason]]
9736 !! wikitext
9737 {{FULLPAGENAME}}
9738 !! html
9739 <p>User:Ævar Arnfjörð Bjarmason
9740 </p>
9741 !! end
9742
9743 !! test
9744 Magic Word: {{FULLPAGENAMEE}}
9745 !! options
9746 title=[[User:Ævar Arnfjörð Bjarmason]]
9747 !! wikitext
9748 {{FULLPAGENAMEE}}
9749 !! html
9750 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9751 </p>
9752 !! end
9753
9754 !! test
9755 Magic Word: {{TALKSPACE}}
9756 !! options
9757 title=[[User:Ævar Arnfjörð Bjarmason]]
9758 !! wikitext
9759 {{TALKSPACE}}
9760 !! html
9761 <p>User talk
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{TALKSPACE}}, same namespace
9767 !! options
9768 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9769 !! wikitext
9770 {{TALKSPACE}}
9771 !! html
9772 <p>User talk
9773 </p>
9774 !! end
9775
9776 !! test
9777 Magic Word: {{TALKSPACE}}, main namespace
9778 !! options
9779 title=[[Parser Test]]
9780 !! wikitext
9781 {{TALKSPACE}}
9782 !! html
9783 <p>Talk
9784 </p>
9785 !! end
9786
9787 !! test
9788 Magic Word: {{TALKSPACEE}}
9789 !! options
9790 title=[[User:Ævar Arnfjörð Bjarmason]]
9791 !! wikitext
9792 {{TALKSPACEE}}
9793 !! html
9794 <p>User_talk
9795 </p>
9796 !! end
9797
9798 !! test
9799 Magic Word: {{SUBJECTSPACE}}
9800 !! options
9801 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9802 !! wikitext
9803 {{SUBJECTSPACE}}
9804 !! html
9805 <p>User
9806 </p>
9807 !! end
9808
9809 !! test
9810 Magic Word: {{SUBJECTSPACE}}, same namespace
9811 !! options
9812 title=[[User:Ævar Arnfjörð Bjarmason]]
9813 !! wikitext
9814 {{SUBJECTSPACE}}
9815 !! html
9816 <p>User
9817 </p>
9818 !! end
9819
9820 !! test
9821 Magic Word: {{SUBJECTSPACE}}, main namespace
9822 !! options
9823 title=[[Parser Test]]
9824 !! wikitext
9825 {{SUBJECTSPACE}}
9826 !! html
9827
9828 !! end
9829
9830 !! test
9831 Magic Word: {{SUBJECTSPACEE}}
9832 !! options
9833 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9834 !! wikitext
9835 {{SUBJECTSPACEE}}
9836 !! html
9837 <p>User
9838 </p>
9839 !! end
9840
9841 !! test
9842 Magic Word: {{NAMESPACE}}
9843 !! options
9844 title=[[User:Ævar Arnfjörð Bjarmason]]
9845 !! wikitext
9846 {{NAMESPACE}}
9847 !! html
9848 <p>User
9849 </p>
9850 !! end
9851
9852 !! test
9853 Magic Word: {{NAMESPACEE}}
9854 !! options
9855 title=[[User:Ævar Arnfjörð Bjarmason]]
9856 !! wikitext
9857 {{NAMESPACEE}}
9858 !! html
9859 <p>User
9860 </p>
9861 !! end
9862
9863 !! test
9864 Magic Word: {{NAMESPACENUMBER}}
9865 !! options
9866 title=[[User:Ævar Arnfjörð Bjarmason]]
9867 !! wikitext
9868 {{NAMESPACENUMBER}}
9869 !! html
9870 <p>2
9871 </p>
9872 !! end
9873
9874 !! test
9875 Magic Word: {{SUBPAGENAME}}
9876 !! options
9877 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9878 !! wikitext
9879 {{SUBPAGENAME}}
9880 !! html
9881 <p>sub ö
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic Word: {{SUBPAGENAMEE}}
9887 !! options
9888 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9889 !! wikitext
9890 {{SUBPAGENAMEE}}
9891 !! html
9892 <p>sub_%C3%B6
9893 </p>
9894 !! end
9895
9896 !! test
9897 Magic Word: {{ROOTPAGENAME}}
9898 !! options
9899 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9900 !! wikitext
9901 {{ROOTPAGENAME}}
9902 !! html
9903 <p>Ævar Arnfjörð Bjarmason
9904 </p>
9905 !! end
9906
9907 !! test
9908 Magic Word: {{ROOTPAGENAMEE}}
9909 !! options
9910 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9911 !! wikitext
9912 {{ROOTPAGENAMEE}}
9913 !! html
9914 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9915 </p>
9916 !! end
9917
9918 !! test
9919 Magic Word: {{BASEPAGENAME}}
9920 !! options
9921 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9922 !! wikitext
9923 {{BASEPAGENAME}}
9924 !! html
9925 <p>Ævar Arnfjörð Bjarmason
9926 </p>
9927 !! end
9928
9929 !! test
9930 Magic Word: {{BASEPAGENAMEE}}
9931 !! options
9932 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9933 !! wikitext
9934 {{BASEPAGENAMEE}}
9935 !! html
9936 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9937 </p>
9938 !! end
9939
9940 !! test
9941 Magic Word: {{TALKPAGENAME}}
9942 !! options
9943 title=[[User:Ævar Arnfjörð Bjarmason]]
9944 !! wikitext
9945 {{TALKPAGENAME}}
9946 !! html
9947 <p>User talk:Ævar Arnfjörð Bjarmason
9948 </p>
9949 !! end
9950
9951 !! test
9952 Magic Word: {{TALKPAGENAMEE}}
9953 !! options
9954 title=[[User:Ævar Arnfjörð Bjarmason]]
9955 !! wikitext
9956 {{TALKPAGENAMEE}}
9957 !! html
9958 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9959 </p>
9960 !! end
9961
9962 !! test
9963 Magic Word: {{SUBJECTPAGENAME}}
9964 !! options
9965 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9966 !! wikitext
9967 {{SUBJECTPAGENAME}}
9968 !! html
9969 <p>User:Ævar Arnfjörð Bjarmason
9970 </p>
9971 !! end
9972
9973 !! test
9974 Magic Word: {{SUBJECTPAGENAMEE}}
9975 !! options
9976 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9977 !! wikitext
9978 {{SUBJECTPAGENAMEE}}
9979 !! html
9980 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9981 </p>
9982 !! end
9983
9984 !! test
9985 Magic Word: {{NUMBEROFFILES}}
9986 !! wikitext
9987 {{NUMBEROFFILES}}
9988 !! html
9989 <p>7
9990 </p>
9991 !! end
9992
9993 !! test
9994 Magic Word: {{PAGENAME}}
9995 !! options
9996 title=[[User:Ævar Arnfjörð Bjarmason]]
9997 !! wikitext
9998 {{PAGENAME}}
9999 !! html
10000 <p>Ævar Arnfjörð Bjarmason
10001 </p>
10002 !! end
10003
10004 !! test
10005 Magic Word: {{PAGENAME}} with metacharacters
10006 !! options
10007 title=[['foo & bar = baz']]
10008 !! wikitext
10009 ''{{PAGENAME}}''
10010 !! html/php
10011 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10012 </p>
10013 !! html+tidy
10014 <p><i>'foo &amp; bar = baz'</i></p>
10015 !! end
10016
10017 !! test
10018 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10019 !! options
10020 title=[[*RFC 1234 http://example.com/]]
10021 !! wikitext
10022 {{PAGENAME}}
10023 !! html/php
10024 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10025 </p>
10026 !! html+tidy
10027 <p>*RFC 1234 http://example.com/</p>
10028 !! end
10029
10030 !! test
10031 Magic Word: {{PAGENAMEE}}
10032 !! options
10033 title=[[User:Ævar Arnfjörð Bjarmason]]
10034 !! wikitext
10035 {{PAGENAMEE}}
10036 !! html
10037 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10038 </p>
10039 !! end
10040
10041 !! test
10042 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10043 !! options
10044 title=[[*RFC 1234 http://example.com/]]
10045 !! wikitext
10046 {{PAGENAMEE}}
10047 !! html/php
10048 <p>&#42;RFC_1234_http&#58;//example.com/
10049 </p>
10050 !! html+tidy
10051 <p>*RFC_1234_http://example.com/</p>
10052 !! end
10053
10054 !! test
10055 Magic Word: {{REVISIONID}}
10056 !! wikitext
10057 {{REVISIONID}}
10058 !! html
10059 <p>1337
10060 </p>
10061 !! end
10062
10063 !! test
10064 Magic Word: {{SCRIPTPATH}}
10065 !! wikitext
10066 {{SCRIPTPATH}}
10067 !! html
10068
10069 !! end
10070
10071 !! test
10072 Magic Word: {{STYLEPATH}}
10073 !! wikitext
10074 {{STYLEPATH}}
10075 !! html
10076 <p>/skins
10077 </p>
10078 !! end
10079
10080 !! test
10081 Magic Word: {{SERVER}}
10082 !! wikitext
10083 {{SERVER}}
10084 !! html
10085 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10086 </p>
10087 !! end
10088
10089 !! test
10090 Magic Word: {{SERVERNAME}}
10091 !! wikitext
10092 {{SERVERNAME}}
10093 !! html
10094 <p>example.org
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{SITENAME}}
10100 !! wikitext
10101 {{SITENAME}}
10102 !! html
10103 <p>MediaWiki
10104 </p>
10105 !! end
10106
10107 !! test
10108 Case-sensitive magic words, when cased differently, should just be template transclusions
10109 !! wikitext
10110 {{CurrentMonth}}
10111 {{currentday}}
10112 {{cURreNTweEK}}
10113 {{currentHour}}
10114 !! html
10115 <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>
10116 <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>
10117 <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>
10118 <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>
10119 </p>
10120 !! end
10121
10122 !! test
10123 Case-insensitive magic words should still work with weird casing.
10124 !! wikitext
10125 {{sErVeRNaMe}}
10126 {{LCFirst:AOEU}}
10127 {{ucFIRST:aoeu}}
10128 {{SERver}}
10129 !! html
10130 <p>example.org
10131 aOEU
10132 Aoeu
10133 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10134 </p>
10135 !! end
10136
10137 # From plwiki:PLOS_ONE
10138 !! test
10139 Parsoid: Page property magic word with magic word contents
10140 !! wikitext
10141 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10142 !! html/parsoid
10143 <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>"}]]}'/>
10144 !! end
10145
10146 !! test
10147 Parsoid: Template-generated DISPLAYTITLE
10148 !! wikitext
10149 {{{{echo|DISPLAYTITLE}}:Foo}}
10150 !! html/parsoid
10151 <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}}]}'/>
10152 !! end
10153
10154 !! test
10155 Namespace 1 {{ns:1}}
10156 !! wikitext
10157 {{ns:1}}
10158 !! html
10159 <p>Talk
10160 </p>
10161 !! end
10162
10163 !! test
10164 Namespace 1 {{ns:01}}
10165 !! wikitext
10166 {{ns:01}}
10167 !! html
10168 <p>Talk
10169 </p>
10170 !! end
10171
10172 !! test
10173 Namespace 0 {{ns:0}} (bug 4783)
10174 !! wikitext
10175 {{ns:0}}
10176 !! html
10177
10178 !! end
10179
10180 !! test
10181 Namespace 0 {{ns:00}} (bug 4783)
10182 !! wikitext
10183 {{ns:00}}
10184 !! html
10185
10186 !! end
10187
10188 !! test
10189 Namespace -1 {{ns:-1}}
10190 !! wikitext
10191 {{ns:-1}}
10192 !! html
10193 <p>Special
10194 </p>
10195 !! end
10196
10197 !! test
10198 Namespace User {{ns:User}}
10199 !! wikitext
10200 {{ns:User}}
10201 !! html
10202 <p>User
10203 </p>
10204 !! end
10205
10206 !! test
10207 Namespace User talk {{ns:User_talk}}
10208 !! wikitext
10209 {{ns:User_talk}}
10210 !! html
10211 <p>User talk
10212 </p>
10213 !! end
10214
10215 !! test
10216 Namespace User talk {{ns:uSeR tAlK}}
10217 !! wikitext
10218 {{ns:uSeR tAlK}}
10219 !! html
10220 <p>User talk
10221 </p>
10222 !! end
10223
10224 !! test
10225 Namespace File {{ns:File}}
10226 !! wikitext
10227 {{ns:File}}
10228 !! html
10229 <p>File
10230 </p>
10231 !! end
10232
10233 !! test
10234 Namespace File {{ns:Image}}
10235 !! wikitext
10236 {{ns:Image}}
10237 !! html
10238 <p>File
10239 </p>
10240 !! end
10241
10242 !! test
10243 Namespace (lang=de) Benutzer {{ns:User}}
10244 !! options
10245 language=de
10246 !! wikitext
10247 {{ns:User}}
10248 !! html
10249 <p>Benutzer
10250 </p>
10251 !! end
10252
10253 !! test
10254 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10255 !! options
10256 language=de
10257 !! wikitext
10258 {{ns:3}}
10259 !! html
10260 <p>Benutzer Diskussion
10261 </p>
10262 !! end
10263
10264
10265 !! test
10266 Urlencode
10267 !! wikitext
10268 {{urlencode:hi world?!}}
10269 {{urlencode:hi world?!|WIKI}}
10270 {{urlencode:hi world?!|PATH}}
10271 {{urlencode:hi world?!|QUERY}}
10272 !! html
10273 <p>hi+world%3F%21
10274 hi_world%3F!
10275 hi%20world%3F%21
10276 hi+world%3F%21
10277 </p>
10278 !! end
10279
10280 !! test
10281 Magic Word: prioritize type info over data-parsoid
10282 !! options
10283 parsoid=html2wt
10284 !! html/parsoid
10285 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10286 !! wikitext
10287 __FORCETOC__
10288 !! end
10289
10290 !! test
10291 Magic Word: serialize on separate line (parsoid)
10292 !! options
10293 parsoid=wt2wt,html2wt
10294 !! wikitext
10295 foo
10296 __NOTOC__
10297 bar
10298 !! html/parsoid
10299 foo<meta property="mw:PageProp/notoc"/>bar
10300 !! end
10301
10302 !! test
10303 Magic Word: rt non-english wikis
10304 !! options
10305 parsoid=wt2wt
10306 language=de
10307 !! wikitext
10308 __NOEDITSECTION__
10309 !! html/parsoid
10310 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10311 !! end
10312
10313 !!test
10314 __proto__ is treated as normal wikitext (T105997)
10315 !!wikitext
10316 __proto__
10317 !!html
10318 <p>__proto__
10319 </p>
10320 !!end
10321
10322 ###
10323 ### Magic links
10324 ###
10325 !! test
10326 Magic links: internal link to RFC (bug 479)
10327 !! wikitext
10328 [[RFC 123]]
10329 !! html/php
10330 <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>
10331 </p>
10332 !! html/parsoid
10333 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10334 !! end
10335
10336 !! test
10337 Magic links: RFC (bug 479)
10338 !! wikitext
10339 RFC 822
10340 !! html/php
10341 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10342 </p>
10343 !! html/parsoid
10344 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10345 !! end
10346
10347 !! test
10348 Magic links: RFC (bug 65278)
10349 !! wikitext
10350 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10351 !! html/php
10352 <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.
10353 </p>
10354 !! html/parsoid
10355 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10356 !! end
10357
10358 !! test
10359 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10360 !! wikitext
10361 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10362 RFC
10363 822
10364 !! html/php
10365 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10366 RFC
10367 822
10368 </p>
10369 !! html/parsoid
10370 <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>
10371 RFC
10372 822</p>
10373 !! end
10374
10375 !! test
10376 Magic links: ISBN (bug 1937)
10377 !! wikitext
10378 ISBN 0-306-40615-2
10379 !! html/php
10380 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10381 </p>
10382 !! html/parsoid
10383 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10384 !! end
10385
10386 !! test
10387 Magic links: ISBN (bug 65278)
10388 !! wikitext
10389 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10390 !! html/php
10391 <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.
10392 </p>
10393 !! html/parsoid
10394 <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>
10395 !! end
10396
10397 !! test
10398 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10399 !! wikitext
10400 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10401 ISBN
10402 9780316098113
10403 ISBN 978
10404 0316098113
10405 !! html/php
10406 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10407 ISBN
10408 9780316098113
10409 ISBN 978
10410 0316098113
10411 </p>
10412 !! html/parsoid
10413 <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>
10414 ISBN
10415 9780316098113
10416 ISBN 978
10417 0316098113</p>
10418 !! end
10419
10420 !! test
10421 Magic links: PMID incorrectly converts space to underscore
10422 !! wikitext
10423 PMID 1234
10424 !! html/php
10425 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10426 </p>
10427 !! html/parsoid
10428 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10429 !! end
10430
10431 !! test
10432 Magic links: PMID (bug 65278)
10433 !! wikitext
10434 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10435 !! html/php
10436 <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.
10437 </p>
10438 !! html/parsoid
10439 <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>
10440 !! end
10441
10442 !! test
10443 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10444 !! wikitext
10445 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10446 PMID
10447 1234
10448 !! html/php
10449 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10450 PMID
10451 1234
10452 </p>
10453 !! html/parsoid
10454 <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>
10455 PMID
10456 1234</p>
10457 !! end
10458
10459 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10460 # since these are ExtLinkText, not MagicLinkText
10461 !! test
10462 Magic links: use appropriate serialization for "almost" magic links.
10463 !! wikitext
10464 X[[Special:BookSources/0978739256|foo]]
10465
10466 X[//tools.ietf.org/html/rfc1234 foo]
10467 !! html/php
10468 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10469 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10470 </p>
10471 !! html/parsoid
10472 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10473 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10474 !! end
10475
10476 ###
10477 ### Templates
10478 ####
10479
10480 !! test
10481 Nonexistent template
10482 !! wikitext
10483 {{thistemplatedoesnotexist}}
10484 !! html
10485 <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>
10486 </p>
10487 !! end
10488
10489 !! test
10490 Template with invalid target containing tags
10491 !! wikitext
10492 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10493 !! html
10494 <p>{{a<b>b</b>|foo|a=b|a = b}}
10495 </p>
10496 !! end
10497
10498 !! test
10499 Template with invalid target containing unclosed tag
10500 !! wikitext
10501 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10502 !! html
10503 <p>{{a<b>|foo|a=b|a = b}}</b>
10504 </p>
10505 !! end
10506
10507 !! test
10508 Template with invalid target containing wikilink
10509 !! wikitext
10510 {{[[Main Page]]}}
10511 !! html/php
10512 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10513 </p>
10514 !! html/parsoid
10515 <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>
10516 !! end
10517
10518 !! test
10519 Template with just whitespace in it, bug #68421
10520 !! wikitext
10521 {{echo|{{ }}}}
10522 !! html/parsoid
10523 <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>
10524 !! end
10525
10526 !! article
10527 Template:test
10528 !! text
10529 This is a test template
10530 !! endarticle
10531
10532 !! test
10533 Simple template
10534 !! wikitext
10535 {{test}}
10536 !! html
10537 <p>This is a test template
10538 </p>
10539 !! end
10540
10541 !! test
10542 Template with explicit namespace
10543 !! wikitext
10544 {{Template:test}}
10545 !! html
10546 <p>This is a test template
10547 </p>
10548 !! end
10549
10550
10551 !! article
10552 Template:paramtest
10553 !! text
10554 This is a test template with parameter {{{param}}}
10555 !! endarticle
10556
10557 !! test
10558 Template parameter
10559 !! wikitext
10560 {{paramtest|param=foo}}
10561 !! html
10562 <p>This is a test template with parameter foo
10563 </p>
10564 !! end
10565
10566 !! article
10567 Template:paramtestnum
10568 !! text
10569 [[{{{1}}}|{{{2}}}]]
10570 !! endarticle
10571
10572 !! test
10573 Template unnamed parameter
10574 !! wikitext
10575 {{paramtestnum|Main Page|the main page}}
10576 !! html
10577 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10578 </p>
10579 !! end
10580
10581 !! article
10582 Template:templatesimple
10583 !! text
10584 (test)
10585 !! endarticle
10586
10587 !! article
10588 Template:templateredirect
10589 !! text
10590 #redirect [[Template:templatesimple]]
10591 !! endarticle
10592
10593 !! article
10594 Template:templateasargtestnum
10595 !! text
10596 {{{{{1}}}}}
10597 !! endarticle
10598
10599 !! article
10600 Template:templateasargtest
10601 !! text
10602 {{template{{{templ}}}}}
10603 !! endarticle
10604
10605 !! article
10606 Template:templateasargtest2
10607 !! text
10608 {{{{{templ}}}}}
10609 !! endarticle
10610
10611 !! test
10612 Template with template name as unnamed argument
10613 !! wikitext
10614 {{templateasargtestnum|templatesimple}}
10615 !! html
10616 <p>(test)
10617 </p>
10618 !! end
10619
10620 !! test
10621 Template with template name as argument
10622 !! wikitext
10623 {{templateasargtest|templ=simple}}
10624 !! html
10625 <p>(test)
10626 </p>
10627 !! end
10628
10629 !! test
10630 Template with template name as argument (2)
10631 !! wikitext
10632 {{templateasargtest2|templ=templatesimple}}
10633 !! html
10634 <p>(test)
10635 </p>
10636 !! end
10637
10638 !! article
10639 Template:templateasargtestdefault
10640 !! text
10641 {{{{{templ|templatesimple}}}}}
10642 !! endarticle
10643
10644 !! article
10645 Template:templa
10646 !! text
10647 '''templ'''
10648 !! endarticle
10649
10650 !! test
10651 Template with default value
10652 !! wikitext
10653 {{templateasargtestdefault}}
10654 !! html
10655 <p>(test)
10656 </p>
10657 !! end
10658
10659 !! test
10660 Template with default value (value set)
10661 !! wikitext
10662 {{templateasargtestdefault|templ=templa}}
10663 !! html
10664 <p><b>templ</b>
10665 </p>
10666 !! end
10667
10668 !! test
10669 Template redirect
10670 !! wikitext
10671 {{templateredirect}}
10672 !! html/php
10673 <p>(test)
10674 </p>
10675 !! html/parsoid
10676 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10677 !! end
10678
10679 !! test
10680 Template with argument in separate line
10681 !! wikitext
10682 {{ templateasargtest |
10683 templ = simple }}
10684 !! html
10685 <p>(test)
10686 </p>
10687 !! end
10688
10689 !! test
10690 Template with complex template as argument
10691 !! wikitext
10692 {{paramtest|
10693 param ={{ templateasargtest |
10694 templ = simple }}}}
10695 !! html
10696 <p>This is a test template with parameter (test)
10697 </p>
10698 !! end
10699
10700 !! test
10701 Template with thumb image (with link in description)
10702 !! wikitext
10703 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10704 !! html/php
10705 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>
10706
10707 !! html+tidy
10708 <p>This is a test template with parameter</p>
10709 <div class="thumb tright">
10710 <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>
10711 <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>
10712 </div>
10713 </div>
10714 !! html/parsoid
10715 <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>
10716 !! end
10717
10718 !! article
10719 Template:complextemplate
10720 !! text
10721 {{{1}}} {{paramtest|
10722 param ={{{param}}}}}
10723 !! endarticle
10724
10725 !! test
10726 Template with complex arguments
10727 !! wikitext
10728 {{complextemplate|
10729 param ={{ templateasargtest |
10730 templ = simple }}|[[Template:complextemplate|link]]}}
10731 !! html
10732 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10733 </p>
10734 !! end
10735
10736 !! test
10737 BUG 553: link with two variables in a piped link
10738 !! wikitext
10739 {|
10740 |[[{{{1}}}|{{{2}}}]]
10741 |}
10742 !! html/php
10743 <table>
10744 <tr>
10745 <td>[[{{{1}}}|{{{2}}}]]
10746 </td></tr></table>
10747
10748 !! html/parsoid
10749 <table>
10750 <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>
10751 !! end
10752
10753 # See: T2553
10754 !! test
10755 Abort table cell attribute parsing on wikilink
10756 !! wikitext
10757 {|
10758 | testing [[one|two]] | three || four
10759 | testing one two | three || four
10760 | testing="[[one|two]]" | three || four
10761 |}
10762 !! html/php
10763 <table>
10764 <tr>
10765 <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>
10766 <td> four
10767 </td>
10768 <td> three </td>
10769 <td> four
10770 </td>
10771 <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>
10772 <td> four
10773 </td></tr></table>
10774
10775 !! html/parsoid
10776 <table>
10777 <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>
10778 <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>
10779 <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>
10780 </tbody></table>
10781 !! end
10782
10783 !! test
10784 Don't abort table cell attribute parsing if wikilink is found in template arg
10785 !! wikitext
10786 {|
10787 | Test {{#tag:ref|One two "[[three]]" four}}
10788 |}
10789 !! html/parsoid
10790 <table>
10791 <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>
10792 </tbody></table>
10793 !! end
10794
10795 !! test
10796 Magic variable as template parameter
10797 !! wikitext
10798 {{paramtest|param={{SITENAME}}}}
10799 !! html
10800 <p>This is a test template with parameter MediaWiki
10801 </p>
10802 !! end
10803
10804 !! article
10805 Template:linktest
10806 !! text
10807 [[{{{param}}}|link]]
10808 !! endarticle
10809
10810 !! test
10811 Template parameter as link source
10812 !! wikitext
10813 {{linktest|param=Main Page}}
10814 !! html
10815 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10816 </p>
10817 !! end
10818
10819 !!article
10820 Template:paramtest2
10821 !! text
10822 including another template, {{paramtest|param={{{arg}}}}}
10823 !! endarticle
10824
10825 !! test
10826 Template passing argument to another template
10827 !! wikitext
10828 {{paramtest2|arg='hmm'}}
10829 !! html
10830 <p>including another template, This is a test template with parameter 'hmm'
10831 </p>
10832 !! end
10833
10834 !! article
10835 Template:Linktest2
10836 !! text
10837 Main Page
10838 !! endarticle
10839
10840 !! test
10841 Template as link source
10842 !! wikitext
10843 [[{{linktest2}}]]
10844
10845 [[{{linktest2}}|Main Page]]
10846
10847 [[{{linktest2}}]]Page
10848 !! html
10849 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10850 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10851 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10852 </p>
10853 !! end
10854
10855
10856 !! article
10857 Template:loop1
10858 !! text
10859 {{loop2}}
10860 !! endarticle
10861
10862 !! article
10863 Template:loop2
10864 !! text
10865 {{loop1}}
10866 !! endarticle
10867
10868 !! test
10869 Template infinite loop
10870 !! wikitext
10871 {{loop1}}
10872 !! html
10873 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10874 </p>
10875 !! end
10876
10877 !! test
10878 Template from main namespace
10879 !! wikitext
10880 {{:Main Page}}
10881 !! html
10882 <p>blah blah
10883 </p>
10884 !! end
10885
10886 !! article
10887 Template:table
10888 !! text
10889 {|
10890 | 1 || 2
10891 |-
10892 | 3 || 4
10893 |}
10894 !! endarticle
10895
10896 !! test
10897 BUG 529: Template with table, not included at beginning of line
10898 !! wikitext
10899 foo {{table}}
10900 !! html
10901 <p>foo
10902 </p>
10903 <table>
10904 <tr>
10905 <td> 1 </td>
10906 <td> 2
10907 </td></tr>
10908 <tr>
10909 <td> 3 </td>
10910 <td> 4
10911 </td></tr></table>
10912
10913 !! end
10914
10915 !! test
10916 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10917 !! wikitext
10918 foo
10919 {{table}}
10920 !! html
10921 <p>foo
10922 </p>
10923 <table>
10924 <tr>
10925 <td> 1 </td>
10926 <td> 2
10927 </td></tr>
10928 <tr>
10929 <td> 3 </td>
10930 <td> 4
10931 </td></tr></table>
10932
10933 !! end
10934
10935 !! test
10936 BUG 41: Template parameters shown as broken links
10937 !! wikitext
10938 {{{parameter}}}
10939 !! html
10940 <p>{{{parameter}}}
10941 </p>
10942 !! end
10943
10944 !! test
10945 Template with targets containing wikilinks
10946 !! wikitext
10947 {{[[foo]]}}
10948
10949 {{[[{{echo|foo}}]]}}
10950
10951 {{{{echo|[[foo}}]]}}
10952 !! html
10953 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10954 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10955 </p><p>{{[[foo}}]]
10956 </p>
10957 !! end
10958
10959 !! article
10960 Template:''
10961 !! text
10962 bar
10963 !! endarticle
10964
10965 !! test
10966 Templates: Double quotes as template target
10967 !! wikitext
10968 foo {{''}} baz
10969 !! html/php
10970 <p>foo bar baz
10971 </p>
10972 !! html/parsoid
10973 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10974 </p>
10975 !! end
10976
10977 ## This test is about making sure Parsoid's data-mw is well formed in the
10978 ## face of multiple templates with intersecting and overlapping ranges. The
10979 ## wikitext itself is wretched.
10980 !! test
10981 Templates with intersecting and overlapping ranges
10982 !! wikitext
10983 {|{{echo|
10984 <p>ha</p>}}
10985 {|{{echo|
10986 <p>ho</p>}}
10987 {{echo|{{!}}hi}}
10988 |}
10989 !! html/php+tidy
10990 <p>ha</p>
10991 <p>ho</p>
10992 <table>
10993 <tr>
10994 <td></td>
10995 </tr>
10996 <tr>
10997 <td>hi</td>
10998 </tr>
10999 </table>
11000 <table>
11001 <tr>
11002 <td></td>
11003 </tr>
11004 </table>
11005 !! html/parsoid
11006 <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":""}]]}'>
11007
11008 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11009
11010 <tbody><tr><td>hi</td></tr>
11011 </tbody></table>
11012 !! end
11013
11014 !! article
11015 Template:MSGNW test
11016 !! text
11017 ''None'' of '''this''' should be
11018 * interpreted
11019 but rather passed unmodified
11020 {{test}}
11021 <gallery>
11022 File:Foobar.jpg
11023 </gallery>
11024 <!-- comment -->
11025 !! endarticle
11026
11027 # hmm, fix this or just deprecate msgnw and document its behavior?
11028 !! test
11029 msgnw keyword
11030 !! wikitext
11031 {{msgnw:MSGNW test}}
11032 !! html/php
11033 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11034 &#42; interpreted
11035 &#32;but rather passed unmodified
11036 &#123;&#123;test&#125;&#125;
11037 &#60;gallery&#62;
11038 File:Foobar.jpg
11039 &#60;/gallery&#62;
11040 &#60;!-- comment --&#62;
11041 </p>
11042 !! end
11043
11044 !! test
11045 int keyword
11046 !! wikitext
11047 {{int:youhavenewmessages|lots of money|not!}}
11048 !! html
11049 <p>You have lots of money (not!).
11050 </p>
11051 !! end
11052
11053 !! test
11054 int keyword - non-existing message
11055 !! wikitext
11056 {{int:var}}
11057 !! html
11058 <p>⧼var⧽
11059 </p>
11060 !! end
11061
11062 !! article
11063 Template:Includes
11064 !! text
11065 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11066 !! endarticle
11067
11068 !! test
11069 <includeonly> and <noinclude> being included
11070 !! wikitext
11071 {{Includes}}
11072 !! html
11073 <p>Foobar
11074 </p>
11075 !! end
11076
11077 !! article
11078 Template:Includes2
11079 !! text
11080 <onlyinclude>Foo</onlyinclude>bar
11081 !! endarticle
11082
11083 !! test
11084 <onlyinclude> being included
11085 !! wikitext
11086 {{Includes2}}
11087 !! html
11088 <p>Foo
11089 </p>
11090 !! end
11091
11092
11093 !! article
11094 Template:Includes3
11095 !! text
11096 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11097 !! endarticle
11098
11099 !! test
11100 <onlyinclude> and <includeonly> being included
11101 !! wikitext
11102 {{Includes3}}
11103 !! html
11104 <p>Foo
11105 </p>
11106 !! end
11107
11108 !! test
11109 <includeonly> and <noinclude> on a page
11110 !! wikitext
11111 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11112 !! html
11113 <p>Foozar
11114 </p>
11115 !! end
11116
11117 !! test
11118 Un-closed <noinclude>
11119 !! wikitext
11120 <noinclude>
11121 !! html
11122 !! end
11123
11124 !! test
11125 <onlyinclude> on a page
11126 !! wikitext
11127 <onlyinclude>Foo</onlyinclude>bar
11128 !! html
11129 <p>Foobar
11130 </p>
11131 !! end
11132
11133 !! test
11134 Un-closed <onlyinclude>
11135 !! wikitext
11136 <onlyinclude>
11137 !! html
11138 !! end
11139
11140 !!test
11141 Self-closed noinclude, includeonly, onlyinclude tags
11142 !! wikitext
11143 <noinclude />
11144 <includeonly />
11145 <onlyinclude />
11146 !! html
11147 <p><br />
11148 </p>
11149 !!end
11150
11151 !!test
11152 Unbalanced includeonly and noinclude tags
11153 !! wikitext
11154 {|
11155 |a</noinclude>
11156 |b</noinclude></noinclude>
11157 |c</noinclude></includeonly>
11158 |d</includeonly></includeonly>
11159 |}
11160 !! html
11161 <table>
11162 <tr>
11163 <td>a
11164 </td>
11165 <td>b
11166 </td>
11167 <td>c&lt;/includeonly&gt;
11168 </td>
11169 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11170 </td></tr></table>
11171
11172 !!end
11173
11174 !! article
11175 Template:Includeonly section
11176 !! text
11177 <includeonly>
11178 ==Includeonly section==
11179 </includeonly>
11180 ==Section T-1==
11181 !!endarticle
11182
11183 !! test
11184 Bug 6563: Edit link generation for section shown by <includeonly>
11185 !! wikitext
11186 {{includeonly section}}
11187 !! html
11188 <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>
11189 <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>
11190
11191 !! end
11192
11193 # Uses same input as the contents of [[Template:Includeonly section]]
11194 !! test
11195 Bug 6563: Section extraction for section shown by <includeonly>
11196 !! options
11197 section=T-2
11198 !! wikitext
11199 <includeonly>
11200 ==Includeonly section==
11201 </includeonly>
11202 ==Section T-2==
11203 !! html
11204 ==Section T-2==
11205 !! end
11206
11207 !! test
11208 Bug 6563: Edit link generation for section suppressed by <includeonly>
11209 !! wikitext
11210 <includeonly>
11211 ==Includeonly section==
11212 </includeonly>
11213 ==Section 1==
11214 !! html
11215 <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>
11216
11217 !! end
11218
11219 !! test
11220 Bug 6563: Section extraction for section suppressed by <includeonly>
11221 !! options
11222 section=1
11223 !! wikitext
11224 <includeonly>
11225 ==Includeonly section==
11226 </includeonly>
11227 ==Section 1==
11228 !! html
11229 ==Section 1==
11230 !! end
11231
11232 !! test
11233 Un-closed <includeonly>
11234 !! wikitext
11235 <includeonly>
11236 !! html/php
11237 !! html/parsoid
11238 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11239 !! end
11240
11241 ## We used to, but no longer wt2wt this test since the default serializer
11242 ## will normalize the include directives to serialize on their own line.
11243 ## Selser will take care of preserving formatting in scenarios where they
11244 ## intermingled with other wikitext.
11245 !! test
11246 Includes and comments at SOL
11247 !! options
11248 parsoid=wt2html,html2html
11249 !! wikitext
11250 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11251
11252 <noinclude>
11253 some
11254 </noinclude>* stuff
11255 * here
11256
11257 <includeonly>can have stuff</includeonly>=== here ===
11258
11259 !! html/php
11260 <h2><span class="mw-headline" id="hu">hu</span></h2>
11261 <p>some
11262 </p>
11263 <ul><li> stuff</li>
11264 <li> here</li></ul>
11265 <h3><span class="mw-headline" id="here">here</span></h3>
11266
11267 !! html/parsoid
11268 <!-- 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>
11269
11270 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11271 <p>some</p>
11272 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11273 <li> here</li></ul>
11274
11275 <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>
11276
11277 !! end
11278
11279 # TODO: test with DOM fragment reuse!
11280 !! test
11281 Parsoid: DOM fragment reuse
11282 !! options
11283 parsoid=wt2wt,wt2html
11284 !! wikitext
11285 a{{echo|b<table></table>c}}d
11286
11287 a{{echo|b
11288 <table></table>
11289 c}}d
11290
11291 {{echo|a
11292
11293 <table></table>
11294
11295 b}}
11296 !! html
11297 <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>
11298
11299 <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">
11300 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11301 </span><p about="#mwt2">cd</p>
11302
11303 <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">
11304
11305 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11306
11307 </span><p about="#mwt3">b</p>
11308 !! end
11309
11310 !! test
11311 Parsoid: Merge double tds (T52603)
11312 !! options
11313 parsoid
11314 !! wikitext
11315 {|
11316 |{{echo|{{!}} foo}}
11317 |}
11318 !! html
11319 <table><tbody>
11320 <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>
11321 </tbody></table>
11322 !! end
11323
11324 !! test
11325 Parsoid: Merge double tds in nested transclusion content (T52603)
11326 !! options
11327 parsoid
11328 !! wikitext
11329 {{echo|<div>}}
11330 {|
11331 |{{echo|{{!}} foo}}
11332 |}
11333 {{echo|</div>}}
11334 !! html
11335 <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}}]}'>
11336 <table><tbody>
11337 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11338 </tbody></table>
11339 </div>
11340 !! end
11341
11342 ###
11343 ### <includeonly> and <noinclude> in attributes
11344 ###
11345 !!test
11346 0. includeonly around the entire attribute
11347 !! wikitext
11348 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11349 !! html
11350 <p><span id="v2">bar</span>
11351 </p>
11352 !!end
11353
11354 !!test
11355 1. includeonly in html attr key
11356 !! wikitext
11357 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11358 !! html
11359 <p><span id="foo">bar</span>
11360 </p>
11361 !!end
11362
11363 !!test
11364 2. includeonly in html attr value
11365 !! wikitext
11366 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11367 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11368 !! html
11369 <p><span id="v1">bar</span>
11370 <span id="v1">bar</span>
11371 </p>
11372 !!end
11373
11374 !!test
11375 3. includeonly in part of an attr value
11376 !! wikitext
11377 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11378 !! html
11379 <p><span style="color:red;">bar</span>
11380 </p>
11381 !!end
11382
11383 !!test
11384 4. includeonly in table attributes
11385 !! wikitext
11386 {|
11387 |- <noinclude>
11388 |-
11389 |a
11390 </noinclude>
11391 |- <includeonly>
11392 |-
11393 |b
11394 </includeonly>
11395 |}
11396 !! html
11397 <table>
11398
11399
11400 <tr>
11401 <td>a
11402 </td></tr>
11403 </table>
11404
11405 !!end
11406
11407 ###
11408 ### Token Stream Patcher tests
11409 ###
11410 ### These tests won't always pass wt2wt and other modes because
11411 ### on serialization, the table will be output on a new line.
11412 ### For now, we are blacklisting them, and using this to test selser.
11413 ###
11414
11415 !!test
11416 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11417 !!options
11418 parsoid=wt2html,wt2wt
11419 !!wikitext
11420 {{echo|}}{| width = '100%'
11421 |foo
11422 |}
11423 !!html/parsoid
11424 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11425 <tbody><tr><td>foo</td></tr>
11426 </tbody></table>
11427 !!end
11428
11429 ## We used to, but no longer wt2wt this test since the default serializer
11430 ## will normalize the include directives to serialize on their own line.
11431 ## Selser will take care of preserving formatting in scenarios where they
11432 ## intermingled with other wikitext.
11433 !!test
11434 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11435 !!options
11436 parsoid=wt2html
11437 !!wikitext
11438 <includeonly>a</includeonly>{| {{{b}}}
11439 |c
11440 |}
11441 !!html/parsoid
11442 <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":""}]]}'>
11443 <tbody><tr><td>c</td></tr>
11444 </tbody></table>
11445 !!end
11446
11447 ###
11448 ### Testing parsing of templates where a template arg
11449 ### has the same name as the template itself.
11450 ###
11451
11452 !! article
11453 Template:quote
11454 !! text
11455 {{{quote|{{{1}}}}}}
11456 !! endarticle
11457
11458 !!test
11459 Templates: Template Name/Arg clash: 1. Use of positional param
11460 !! wikitext
11461 {{quote|foo}}
11462 !! html
11463 <p>foo
11464 </p>
11465 !!end
11466
11467 !!test
11468 Templates: Template Name/Arg clash: 2. Use of named param
11469 !! wikitext
11470 {{quote|quote=foo}}
11471 !! html
11472 <p>foo
11473 </p>
11474 !!end
11475
11476 !!test
11477 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11478 !! wikitext
11479 {{quote|quote}}
11480 !! html
11481 <p>quote
11482 </p>
11483 !!end
11484
11485 ###
11486 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11487 ###
11488
11489 !!test
11490 Templates: 1. Simple use
11491 !! wikitext
11492 {{echo|Foo}}
11493 !! html
11494 <p>Foo
11495 </p>
11496 !!end
11497
11498 !!test
11499 Templates: 2. Inside a block tag
11500 !! wikitext
11501 <div>{{echo|Foo}}</div>
11502 <blockquote>{{echo|Foo}}</blockquote>
11503 !! html
11504 <div>Foo</div>
11505 <blockquote>Foo</blockquote>
11506
11507 !! html+tidy
11508 <div>Foo</div>
11509 <blockquote>
11510 <p>Foo</p>
11511 </blockquote>
11512 !!end
11513
11514 !!test
11515 Templates: P-wrapping: 1a. Templates on consecutive lines
11516 !! wikitext
11517 {{echo|Foo}}
11518 {{echo|bar}}
11519 !! html
11520 <p>Foo
11521 bar
11522 </p>
11523 !!end
11524
11525 !!test
11526 Templates: P-wrapping: 1b. Templates on consecutive lines
11527 !! wikitext
11528 Foo
11529
11530 {{echo|bar}}
11531 {{echo|baz}}
11532 !! html
11533 <p>Foo
11534 </p><p>bar
11535 baz
11536 </p>
11537 !!end
11538
11539 !!test
11540 Templates: P-wrapping: 1c. Templates on consecutive lines
11541 !! wikitext
11542 {{echo|Foo}}
11543 {{echo|bar}} <div>baz</div>
11544 !! html
11545 <p>Foo
11546 </p>
11547 bar <div>baz</div>
11548
11549 !! html+tidy
11550 <p>Foo</p>
11551 <p>bar</p>
11552 <div>baz</div>
11553 !! end
11554
11555 !!test
11556 Templates: P-wrapping: 1d. Template preceded by comment-only line
11557 !!options
11558 parsoid
11559 !! wikitext
11560 <!-- foo -->
11561 {{echo|Bar}}
11562 !! html
11563 <!-- foo -->
11564
11565 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11566 !!end
11567
11568 !!test
11569 Templates: Inline Text: 1. Multiple template uses
11570 !! wikitext
11571 {{echo|Foo}}bar{{echo|baz}}
11572 !! html
11573 <p>Foobarbaz
11574 </p>
11575 !!end
11576
11577 !!test
11578 Templates: Inline Text: 2. Back-to-back template uses
11579 !! wikitext
11580 {{echo|Foo}}{{echo|bar}}
11581 !! html
11582 <p>Foobar
11583 </p>
11584 !!end
11585
11586 !!test
11587 Templates: Block Tags: 1. Multiple template uses
11588 !! wikitext
11589 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11590 !! html
11591 <div>Foo</div><div>bar</div><div>baz</div>
11592
11593 !!end
11594
11595 !!test
11596 Templates: Block Tags: 2. Back-to-back template uses
11597 !! wikitext
11598 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11599 !! html
11600 <div>Foo</div><div>bar</div>
11601
11602 !!end
11603
11604 # This is an edge case relating to paragraph wrapping.
11605 !!test
11606 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11607 !! wikitext
11608 {{echo|a
11609 b</p>}}
11610 !! html/parsoid
11611 <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
11612 b</p>
11613 !!end
11614
11615 !!test
11616 Templates: Links: 1. Simple example
11617 !! wikitext
11618 {{echo|[[Foo|bar]]}}
11619 !! html
11620 <p><a href="/wiki/Foo" title="Foo">bar</a>
11621 </p>
11622 !!end
11623
11624 !!test
11625 Templates: Links: 2. Generation of link href
11626 !! wikitext
11627 [[{{echo|Foo}}|bar]]
11628 !! html
11629 <p><a href="/wiki/Foo" title="Foo">bar</a>
11630 </p>
11631 !!end
11632
11633 !!test
11634 Templates: Links: 3. Generation of part of a link href
11635 !! wikitext
11636 [[Fo{{echo|o}}|bar]]
11637
11638 [[Foo{{echo|bar}}]]
11639
11640 [[Foo{{echo|bar}}baz]]
11641
11642 [[Foo{{echo|bar}}|bar]]
11643
11644 [[:Foo{{echo|bar}}]]
11645
11646 [[:Foo{{echo|bar}}|bar]]
11647 !! html
11648 <p><a href="/wiki/Foo" title="Foo">bar</a>
11649 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11650 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11651 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11652 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11653 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11654 </p>
11655 !!end
11656
11657 !!test
11658 Templates: Links: 4. Multiple templates generating link href
11659 !! wikitext
11660 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11661 !! html
11662 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11663 </p>
11664 !!end
11665
11666 !!test
11667 Templates: Links: 5. Generation of link text
11668 !! wikitext
11669 [[Foo|{{echo|bar}}]]
11670 !! html
11671 <p><a href="/wiki/Foo" title="Foo">bar</a>
11672 </p>
11673 !!end
11674
11675 !!test
11676 Templates: Links: 5. Nested templates (only outermost template should be marked)
11677 !! wikitext
11678 {{echo|[[{{echo|Foo}}|bar]]}}
11679 !! html
11680 <p><a href="/wiki/Foo" title="Foo">bar</a>
11681 </p>
11682 !!end
11683
11684 !!test
11685 Templates: HTML Tag: 1. Generation of HTML attr. key
11686 !! wikitext
11687 <div {{echo|style}}="color:red;">foo</div>
11688 !! html
11689 <div style="color:red;">foo</div>
11690
11691 !!end
11692
11693 !!test
11694 Templates: HTML Tag: 2. Generation of HTML attr. value
11695 !! wikitext
11696 <div style={{echo|'color:red;'}}>foo</div>
11697 !! html
11698 <div style="color:red;">foo</div>
11699
11700 !!end
11701
11702 !!test
11703 Templates: HTML Tag: 3. Generation of HTML attr key and value
11704 !! wikitext
11705 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11706 !! html
11707 <div style="color:red;">foo</div>
11708
11709 !!end
11710
11711 !!test
11712 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11713 !! wikitext
11714 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11715 !! html
11716 <div title="This is a long title with just one piece templated">foo</div>
11717
11718 !!end
11719
11720 !!test
11721 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11722 !! wikitext
11723 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11724 !! html
11725 <div title="This is a long title with just one piece templated">foo</div>
11726
11727 !!end
11728
11729 !!test
11730 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11731 !! wikitext
11732 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11733 !! html
11734 <div title="This is a long title with just one piece templated">foo</div>
11735
11736 !!end
11737
11738 # SSS FIXME: While it is great we added support for all this,
11739 # do we want to make this part of the spec? Maybe we want to
11740 # deprecate this kind of usage in the future?
11741 !!test
11742 Templates: HTML Tag: 7. Generation of partial attribute key string
11743 !! wikitext
11744 <div st{{echo|yle}}="color:red;">foo</div>
11745 !! html
11746 <div style="color:red;">foo</div>
11747
11748 !!end
11749
11750 !! test
11751 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11752 !! wikitext
11753 <div {{echo|1=id="v1"}}>bar</div>
11754 !! html
11755 <div id="v1">bar</div>
11756
11757 !!end
11758
11759 !! test
11760 Templates: HTML Tag: 9. Multiple template-generated attributes
11761 !! wikitext
11762 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11763 !! html
11764 <div id="v1" title="foo">bar</div>
11765
11766 !!end
11767
11768 !! test
11769 Templates: Support for templates generating attributes and content
11770 !! wikitext
11771 {| {{mixed_attr_content_template}}
11772 |-
11773 |bar
11774 |}
11775 !! html/php
11776 <table style="color:red;" title="T48811">
11777
11778 <tr>
11779 <td>foo
11780 </td></tr>
11781 <tr>
11782 <td>bar
11783 </td></tr></table>
11784
11785 !! html/parsoid
11786 <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|}"]}'>
11787 <tbody><tr>
11788 <td>foo</td></tr>
11789 <tr>
11790 <td>bar</td></tr>
11791 </tbody></table>
11792 !!end
11793
11794 !! test
11795 1. Entities and nowikis inside templated attributes should be handled correctly
11796 !! wikitext
11797 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11798 !! html/php
11799 <div style="background:#f9f9f9;">foo</div>
11800
11801 !! html/parsoid
11802 <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>
11803 !! end
11804
11805 !! test
11806 2. Entities and nowikis inside templated attributes should be handled correctly
11807 !! wikitext
11808 {|
11809 |{{table_attribs_3}}
11810 |}
11811 !! html/php
11812 <table>
11813 <tr>
11814 <td style="background:#f9f9f9;">Foo
11815 </td></tr></table>
11816
11817 !! html/parsoid
11818 <table>
11819 <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>
11820 </tbody></table>
11821 !! end
11822
11823 !! test
11824 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11825 !! wikitext
11826 {{tbl-start}}
11827 |{{table_attribs_3}}
11828 {{tbl-end}}
11829 !! html/php
11830 <table>
11831 <tr>
11832 <td style="background:#f9f9f9;">Foo
11833 </td></tr></table>
11834
11835 !! html/parsoid
11836 <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}}]}'>
11837 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11838 </tbody></table>
11839 !! end
11840
11841 # T107622
11842 !! test
11843 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11844 !! wikitext
11845 {|
11846 | {{table_attribs_6}} hi
11847 |}
11848 !! html/php
11849 <table>
11850 <tr>
11851 <td style="background: red;"> hi
11852 </td></tr></table>
11853
11854 !! html/parsoid
11855 <table>
11856 <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>
11857 </tbody></table>
11858 !! end
11859
11860 !!test
11861 Templates: HTML Tables: 1. Generating start of a HTML table
11862 !! wikitext
11863 {{echo|<table><tr><td>foo</td>}}</tr></table>
11864 !! html
11865 <table><tr><td>foo</td></tr></table>
11866
11867 !!end
11868
11869 !!test
11870 Templates: HTML Tables: 2a. Generating middle of a HTML table
11871 !! wikitext
11872 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11873 !! html
11874 <table><tr><td>foo</td></tr></table>
11875
11876 !!end
11877
11878 !!test
11879 Templates: HTML Tables: 2b. Generating middle of a HTML table
11880 !! wikitext
11881 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11882 !! html
11883 <table><tr><td>foo</td></tr></table>
11884
11885 !!end
11886
11887 !!test
11888 Templates: HTML Tables: 3. Generating end of a HTML table
11889 !! wikitext
11890 <table><tr>{{echo|<td>foo</td></tr></table>}}
11891 !! html
11892 <table><tr><td>foo</td></tr></table>
11893
11894 !!end
11895
11896 !!test
11897 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11898 !! wikitext
11899 {{echo|<table>}}<tr><td>foo</td></tr></table>
11900 !! html
11901 <table><tr><td>foo</td></tr></table>
11902
11903 !!end
11904
11905 !!test
11906 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11907 !! wikitext
11908 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11909 !! html
11910 <table><tr><td>foo</td></tr></table>
11911
11912 !!end
11913
11914 !!test
11915 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11916 !! wikitext
11917 <table><tr>{{echo|<td>}}foo</td></tr></table>
11918 !! html
11919 <table><tr><td>foo</td></tr></table>
11920
11921 !!end
11922
11923 !!test
11924 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11925 !! wikitext
11926 <table><tr><td>foo{{echo|</td>}}</tr></table>
11927 !! html
11928 <table><tr><td>foo</td></tr></table>
11929
11930 !!end
11931
11932 !!test
11933 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11934 !! wikitext
11935 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11936 !! html
11937 <table><tr><td>foo</td></tr></table>
11938
11939 !!end
11940
11941 !!test
11942 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11943 !! wikitext
11944 <table><tr><td>foo</td></tr>{{echo|</table>}}
11945 !! html
11946 <table><tr><td>foo</td></tr></table>
11947
11948 !!end
11949
11950 !!test
11951 Templates: HTML Tables: 5. Proper fostering of categories from inside
11952 !!options
11953 parsoid=wt2html,wt2wt
11954 !! wikitext
11955 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11956 <!--Two categories (Bug 50330)-->
11957 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11958 !! html
11959 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11960 <!--Two categories (Bug 50330)-->
11961 <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>
11962 !!end
11963
11964 !!test
11965 Templates: Wiki Tables: 1a. Fostering of entire template content
11966 !! wikitext
11967 {|
11968 {{echo|a}}
11969 |}
11970 !! html
11971 <table>
11972 a
11973 <tr><td></td></tr></table>
11974
11975 !! html+tidy
11976 <p>a</p>
11977 <table>
11978 <tr>
11979 <td></td>
11980 </tr>
11981 </table>
11982 !! end
11983
11984 !!test
11985 Templates: Wiki Tables: 1b. Fostering of entire template content
11986 !! wikitext
11987 {|
11988 {{echo|<div>}}
11989 foo
11990 {{echo|</div>}}
11991 |}
11992 !! html
11993 <table>
11994 <div>
11995 <p>foo
11996 </p>
11997 </div>
11998 <tr><td></td></tr></table>
11999
12000 !! html+tidy
12001 <div>
12002 <p>foo</p>
12003 </div>
12004 <table>
12005 <tr>
12006 <td></td>
12007 </tr>
12008 </table>
12009 !! end
12010
12011 !!test
12012 Templates: Wiki Tables: 2. Fostering of partial template content
12013 !! wikitext
12014 {|
12015 {{echo|a
12016 <div>b</div>}}
12017 |}
12018 !! html
12019 <table>
12020 a
12021 <div>b</div>
12022 <tr><td></td></tr></table>
12023
12024 !! html+tidy
12025 <p>a</p>
12026 <div>b</div>
12027 <table>
12028 <tr>
12029 <td></td>
12030 </tr>
12031 </table>
12032 !! end
12033
12034 !!test
12035 Templates: Wiki Tables: 3. td-content via multiple templates
12036 !! wikitext
12037 {|
12038 {{echo|{{pipe}}a}}{{echo|b}}
12039 |}
12040 !! html
12041 <table>
12042 <tr>
12043 <td>ab
12044 </td></tr></table>
12045
12046 !!end
12047
12048 !!test
12049 Templates: Wiki Tables: 4. Templated tags, no content
12050 !! wikitext
12051 {{tbl-start}}
12052 {{tbl-end}}
12053 !! html
12054 <table>
12055 <tr><td></td></tr></table>
12056
12057 !!end
12058
12059 !!test
12060 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12061 !! wikitext
12062 {{tbl-start}}
12063 |foo
12064 {{tbl-end}}
12065 !! html
12066 <table>
12067 <tr>
12068 <td>foo
12069 </td></tr></table>
12070
12071 !!end
12072
12073 !!test
12074 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12075 !! wikitext
12076 {{tbl-start}}
12077 {{!}}foo
12078 {{tbl-end}}
12079 !! html
12080 <table>
12081 <tr>
12082 <td>foo
12083 </td></tr></table>
12084
12085 !!end
12086
12087 ## This test case is very specific to Parsoid's internals
12088 ## and is hence only tested for Parsoid's code. Parsoid uses
12089 ## a <meta> marker tag for <ref> tags and they are expanded
12090 ## much later. We are verifying that this <meta> tag usage
12091 ## doesn't prevent foster parenting.
12092 !!test
12093 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12094 !!wikitext
12095 {{PartialTable}}<ref>foo</ref>
12096 |}
12097
12098 <references />
12099 !!html/parsoid
12100 <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">
12101 <tbody>
12102 </tbody></table>
12103
12104 <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>
12105 !!end
12106
12107 !! test
12108 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12109 !! wikitext
12110 {{echo|
12111 {{{!}}
12112 {{!}}-}}
12113 <onlyinclude>
12114 |foo
12115 </onlyinclude>
12116 {{!}}}
12117 !! html/parsoid
12118 <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{{!}}}"]}'>
12119 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12120 <tbody><tr>
12121
12122 <td>foo
12123 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12124 </tbody></table>
12125 !! end
12126
12127 !!test
12128 Templates: Lists: Multi-line list-items via templates
12129 !! wikitext
12130 *{{echo|a {{nonexistent|
12131 unused}}}}
12132 *{{echo|b {{nonexistent|
12133 unused}}}}
12134 !! html
12135 <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>
12136 <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>
12137
12138 !!end
12139
12140 !!test
12141 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12142 !! wikitext
12143 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12144 !! html
12145 <p><i>ab</i>c<i>d</i>e
12146 </p>
12147 !!end
12148
12149 !!test
12150 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12151 (PHP parser generates misnested html)
12152 !! wikitext
12153 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12154 !! html/parsoid
12155 <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>
12156 !!end
12157
12158 !!test
12159 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12160 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12161 !! options
12162 parsoid=wt2html,wt2wt
12163 !! wikitext
12164 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12165 !! html
12166 <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>
12167 <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>
12168 <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>
12169 !!end
12170
12171 !!test
12172 Templates: Ugly nesting: 4. Divs opened/closed across templates
12173 !! wikitext
12174 a<div>b{{echo|c</div>d}}e
12175 !! html
12176 a<div>bc</div>de
12177
12178 !! html+tidy
12179 <p>a</p>
12180 <div>bc</div>
12181 <p>de</p>
12182 !! end
12183
12184 !!test
12185 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12186 (Parsoid-centric)
12187 !! options
12188 parsoid
12189 !! wikitext
12190 {|
12191 |{{echo|foo</table>}}
12192 |bar
12193 |}
12194 !! html
12195 <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|}"]}'>
12196
12197 <tbody>
12198 <tr>
12199 <td>foo</td></tr></tbody></table><span about="#mwt1">
12200 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12201 |}</span>
12202 !!end
12203
12204 !!test
12205 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12206 (Parsoid-centric)
12207 !! options
12208 parsoid
12209 !! wikitext
12210 <table>
12211 <tr>
12212 <td>
12213 <table>
12214 <tr>
12215 <td>1. {{echo|foo </table>}}</td>
12216 <td> bar </td>
12217 <td>2. {{echo|baz </table>}}</td>
12218 </tr>
12219 <tr>
12220 <td>abc</td>
12221 </tr>
12222 </table>
12223 </td>
12224 </tr>
12225 <tr>
12226 <td>xyz</td>
12227 </tr>
12228 </table>
12229 !! html
12230 <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>"]}'>
12231 <tbody><tr>
12232 <td>
12233 <table>
12234 <tbody><tr>
12235 <td>1. foo </td></tr></tbody></table></td>
12236 <td> bar </td>
12237 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12238 </span><span about="#mwt2">
12239 </span><span about="#mwt2">
12240 </span><span about="#mwt2">abc</span><span about="#mwt2">
12241 </span><span about="#mwt2">
12242 </span><span about="#mwt2">
12243 </span><span about="#mwt2">
12244 </span><span about="#mwt2">
12245 </span><span about="#mwt2">
12246 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12247 </span><span about="#mwt2">
12248 </span>
12249 !!end
12250
12251 !! test
12252 Templates: Ugly templates: 3. newline-only template parameter
12253 !! wikitext
12254 foo {{echo|
12255 }}
12256 !! html
12257 <p>foo
12258 </p>
12259 !! end
12260
12261 # This looks like a bug: a single newline triggers p/br for some reason.
12262 !! test
12263 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12264 !! wikitext
12265 {{echo|
12266 }}
12267 !! html
12268 <p><br />
12269 </p>
12270 !! end
12271
12272 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12273 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12274 !! test
12275 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12276 !! wikitext
12277 {{echo|<table>}}
12278 {{echo|<div>foo}}
12279 {{echo|</table>}}
12280 !! html/parsoid
12281 <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
12282 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12283 </table>
12284 !! end
12285
12286 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12287 # that are "identical" and generate nesting cycles in the algorithm
12288 !! test
12289 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12290 !! wikitext
12291 {{echo|<table><tr><td><table>}}
12292 {{echo|<div>}}
12293 {{echo|</div>}}
12294 !! html/parsoid
12295 <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"}'>
12296 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12297 </table></td></tr></tbody></table>
12298 !! end
12299
12300 !! test
12301 Templates: Parameters substituted at the top-level
12302 !! wikitext
12303 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12304 !! html/php
12305 <p><i>who</i> me? <b>never!</b>
12306 </p>
12307 !! html/parsoid
12308 <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>
12309 !! end
12310
12311 !!test
12312 Parser Functions: 1. Simple example
12313 !! wikitext
12314 {{uc:foo}}
12315 !! html
12316 <p>FOO
12317 </p>
12318 !!end
12319
12320 !!test
12321 Parser Functions: 2. Nested use (only outermost should be marked up)
12322 !! wikitext
12323 {{uc:{{lc:FOO}}}}
12324 !! html
12325 <p>FOO
12326 </p>
12327 !!end
12328
12329 ###
12330 ### Pre-save transform tests
12331 ###
12332 !! test
12333 pre-save transform: subst:
12334 !! options
12335 pst
12336 !! wikitext
12337 {{subst:test}}
12338 !! html/php
12339 This is a test template
12340 !! end
12341
12342 !! test
12343 pre-save transform: normal template
12344 !! options
12345 pst
12346 !! wikitext
12347 {{test}}
12348 !! html/php
12349 {{test}}
12350 !! end
12351
12352 !! test
12353 pre-save transform: nonexistent template
12354 !! options
12355 pst
12356 !! wikitext
12357 {{thistemplatedoesnotexist}}
12358 !! html/php
12359 {{thistemplatedoesnotexist}}
12360 !! end
12361
12362 !! test
12363 pre-save transform: subst magic variables
12364 !! options
12365 pst
12366 !! wikitext
12367 {{subst:SITENAME}}
12368 !! html/php
12369 MediaWiki
12370 !! end
12371
12372 # This is bug 89, which I fixed. -- wtm
12373 !! test
12374 pre-save transform: subst: templates with parameters
12375 !! options
12376 pst
12377 !! wikitext
12378 {{subst:paramtest|param="something else"}}
12379 !! html/php
12380 This is a test template with parameter "something else"
12381 !! end
12382
12383 !! article
12384 Template:nowikitest
12385 !! text
12386 <nowiki>'''not wiki'''</nowiki>
12387 !! endarticle
12388
12389 !! test
12390 pre-save transform: nowiki in subst (bug 1188)
12391 !! options
12392 pst
12393 !! wikitext
12394 {{subst:nowikitest}}
12395 !! html/php
12396 <nowiki>'''not wiki'''</nowiki>
12397 !! end
12398
12399 !! article
12400 Template:commenttest
12401 !! text
12402 This template has <!-- a comment --> in it.
12403 !! endarticle
12404
12405 !! test
12406 pre-save transform: comment in subst (bug 1936)
12407 !! options
12408 pst
12409 !! wikitext
12410 {{subst:commenttest}}
12411 !! html/php
12412 This template has <!-- a comment --> in it.
12413 !! end
12414
12415 !! test
12416 pre-save transform: unclosed tag
12417 !! options
12418 pst
12419 !! wikitext
12420 <nowiki>'''not wiki'''
12421 !! html/php
12422 <nowiki>'''not wiki'''
12423 !! end
12424
12425 !! test
12426 pre-save transform: mixed tag case
12427 !! options
12428 pst
12429 !! wikitext
12430 <NOwiki>'''not wiki'''</noWIKI>
12431 !! html/php
12432 <NOwiki>'''not wiki'''</noWIKI>
12433 !! end
12434
12435 !! test
12436 pre-save transform: unclosed comment in <nowiki>
12437 !! options
12438 pst
12439 !! wikitext
12440 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12441 !! html/php
12442 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12443 !!end
12444
12445 # Leading @ in this template definition works around a limitation
12446 # in parsoid's parserTests which otherwise strips the <span> from the
12447 # result (confusing it for a template wrapper)
12448 !! article
12449 Template:dangerous
12450 !!text
12451 @<span onmouseover="alert('crap')">Oh no</span>
12452 !!endarticle
12453
12454 !!test
12455 (confirming safety of fix for subst bug 1936)
12456 !! wikitext
12457 {{Template:dangerous}}
12458 !! html
12459 <p>@<span>Oh no</span>
12460 </p>
12461 !! end
12462
12463 !! test
12464 pre-save transform: comment containing gallery (bug 5024)
12465 !! options
12466 pst
12467 !! wikitext
12468 <!-- <gallery>data</gallery> -->
12469 !! html/php
12470 <!-- <gallery>data</gallery> -->
12471 !!end
12472
12473 !! test
12474 pre-save transform: comment containing extension
12475 !! options
12476 pst
12477 !! wikitext
12478 <!-- <tag>data</tag> -->
12479 !! html/php
12480 <!-- <tag>data</tag> -->
12481 !!end
12482
12483 !! test
12484 pre-save transform: comment containing nowiki
12485 !! options
12486 pst
12487 !! wikitext
12488 <!-- <nowiki>data</nowiki> -->
12489 !! html/php
12490 <!-- <nowiki>data</nowiki> -->
12491 !!end
12492
12493 !! test
12494 pre-save transform: <noinclude> in subst (bug 3298)
12495 !! options
12496 pst
12497 !! wikitext
12498 {{subst:Includes}}
12499 !! html/php
12500 Foobar
12501 !! end
12502
12503 !! test
12504 pre-save transform: <onlyinclude> in subst (bug 3298)
12505 !! options
12506 pst
12507 !! wikitext
12508 {{subst:Includes2}}
12509 !! html/php
12510 Foo
12511 !! end
12512
12513 !! article
12514 Template:SubstTest
12515 !!text
12516 {{<includeonly>subst:</includeonly>Includes}}
12517 !! endarticle
12518
12519 !! article
12520 Template:SafeSubstTest
12521 !! text
12522 {{<includeonly>safesubst:</includeonly>Includes}}
12523 !! endarticle
12524
12525 !! test
12526 bug 22297: safesubst: works during PST
12527 !! options
12528 pst
12529 !! wikitext
12530 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12531 !! html/php
12532 FoobarFoobar
12533 !! end
12534
12535 !! test
12536 bug 22297: safesubst: works during normal parse
12537 !! wikitext
12538 {{SafeSubstTest}}
12539 !! html
12540 <p>Foobar
12541 </p>
12542 !! end
12543
12544 !! test
12545 subst: does not work during normal parse
12546 !! wikitext
12547 {{SubstTest}}
12548 !! html
12549 <p>{{subst:Includes}}
12550 </p>
12551 !! end
12552
12553 !! test
12554 pre-save transform: context links ("pipe trick")
12555 !! options
12556 pst
12557 !! wikitext
12558 [[Article (context)|]]
12559 [[Bar:Article|]]
12560 [[:Bar:Article|]]
12561 [[Bar:Article (context)|]]
12562 [[:Bar:Article (context)|]]
12563 [[|Article]]
12564 [[|Article (context)]]
12565 [[Bar:X (Y) Z|]]
12566 [[:Bar:X (Y) Z|]]
12567 !! html/php
12568 [[Article (context)|Article]]
12569 [[Bar:Article|Article]]
12570 [[:Bar:Article|Article]]
12571 [[Bar:Article (context)|Article]]
12572 [[:Bar:Article (context)|Article]]
12573 [[Article]]
12574 [[Article (context)]]
12575 [[Bar:X (Y) Z|X (Y) Z]]
12576 [[:Bar:X (Y) Z|X (Y) Z]]
12577 !! end
12578
12579 !! test
12580 pre-save transform: context links ("pipe trick") with interwiki prefix
12581 !! options
12582 pst
12583 !! wikitext
12584 [[interwiki:Article|]]
12585 [[:interwiki:Article|]]
12586 [[interwiki:Bar:Article|]]
12587 [[:interwiki:Bar:Article|]]
12588 !! html/php
12589 [[interwiki:Article|Article]]
12590 [[:interwiki:Article|Article]]
12591 [[interwiki:Bar:Article|Bar:Article]]
12592 [[:interwiki:Bar:Article|Bar:Article]]
12593 !! end
12594
12595 !! test
12596 pre-save transform: context links ("pipe trick") with parens in title
12597 !! options
12598 pst title=[[Somearticle (context)]]
12599 !! wikitext
12600 [[|Article]]
12601 !! html/php
12602 [[Article (context)|Article]]
12603 !! end
12604
12605 !! test
12606 pre-save transform: context links ("pipe trick") with comma in title
12607 !! options
12608 pst title=[[Someplace, Somewhere]]
12609 !! wikitext
12610 [[|Otherplace]]
12611 [[Otherplace, Elsewhere|]]
12612 [[Otherplace, Elsewhere, Anywhere|]]
12613 !! html/php
12614 [[Otherplace, Somewhere|Otherplace]]
12615 [[Otherplace, Elsewhere|Otherplace]]
12616 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12617 !! end
12618
12619 !! test
12620 pre-save transform: context links ("pipe trick") with parens and comma
12621 !! options
12622 pst title=[[Someplace (IGNORED), Somewhere]]
12623 !! wikitext
12624 [[|Otherplace]]
12625 [[Otherplace (place), Elsewhere|]]
12626 !! html/php
12627 [[Otherplace, Somewhere|Otherplace]]
12628 [[Otherplace (place), Elsewhere|Otherplace]]
12629 !! end
12630
12631 !! test
12632 pre-save transform: context links ("pipe trick") with comma and parens
12633 !! options
12634 pst title=[[Who, me? (context)]]
12635 !! wikitext
12636 [[|Yes, you.]]
12637 [[Me, Myself, and I (1937 song)|]]
12638 !! html/php
12639 [[Yes, you. (context)|Yes, you.]]
12640 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12641 !! end
12642
12643 !! test
12644 pre-save transform: context links ("pipe trick") with namespace
12645 !! options
12646 pst title=[[Ns:Somearticle]]
12647 !! wikitext
12648 [[|Article]]
12649 !! html/php
12650 [[Ns:Article|Article]]
12651 !! end
12652
12653 !! test
12654 pre-save transform: context links ("pipe trick") with namespace and parens
12655 !! options
12656 pst title=[[Ns:Somearticle (context)]]
12657 !! wikitext
12658 [[|Article]]
12659 !! html/php
12660 [[Ns:Article (context)|Article]]
12661 !! end
12662
12663 !! test
12664 pre-save transform: context links ("pipe trick") with namespace and comma
12665 !! options
12666 pst title=[[Ns:Somearticle, Context, Whatever]]
12667 !! wikitext
12668 [[|Article]]
12669 !! html/php
12670 [[Ns:Article, Context, Whatever|Article]]
12671 !! end
12672
12673 !! test
12674 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12675 !! options
12676 pst title=[[Ns:Somearticle, Context (context)]]
12677 !! wikitext
12678 [[|Article]]
12679 !! html/php
12680 [[Ns:Article (context)|Article]]
12681 !! end
12682
12683 !! test
12684 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12685 !! options
12686 pst title=[[Ns:Somearticle (IGNORED), Context]]
12687 !! wikitext
12688 [[|Article]]
12689 !! html/php
12690 [[Ns:Article, Context|Article]]
12691 !! end
12692
12693 !! test
12694 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12695 !! options
12696 pst
12697 !! wikitext
12698 [[Article(context)|]]
12699 [[Bar:Article(context)|]]
12700 [[:Bar:Article(context)|]]
12701 [[|Article(context)]]
12702 [[Bar:X(Y)Z|]]
12703 [[:Bar:X(Y)Z|]]
12704 !! html/php
12705 [[Article(context)|Article]]
12706 [[Bar:Article(context)|Article]]
12707 [[:Bar:Article(context)|Article]]
12708 [[Article(context)]]
12709 [[Bar:X(Y)Z|X(Y)Z]]
12710 [[:Bar:X(Y)Z|X(Y)Z]]
12711 !! end
12712
12713 !! test
12714 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12715 !! options
12716 pst
12717 !! wikitext
12718 [[Article (context)|]]
12719 [[Bar:Article (context)|]]
12720 [[:Bar:Article (context)|]]
12721 [[|Article (context)]]
12722 [[Bar:X (Y) Z|]]
12723 [[:Bar:X (Y) Z|]]
12724 !! html/php
12725 [[Article (context)|Article]]
12726 [[Bar:Article (context)|Article]]
12727 [[:Bar:Article (context)|Article]]
12728 [[Article (context)]]
12729 [[Bar:X (Y) Z|X (Y) Z]]
12730 [[:Bar:X (Y) Z|X (Y) Z]]
12731 !! end
12732
12733 !! test
12734 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12735 !! options
12736 pst
12737 !! wikitext
12738 [[Article(context)|]]
12739 [[Bar:Article(context)|]]
12740 [[:Bar:Article(context)|]]
12741 [[|Article(context)]]
12742 [[Bar:X(Y)Z|]]
12743 [[:Bar:X(Y)Z|]]
12744 !! html/php
12745 [[Article(context)|Article]]
12746 [[Bar:Article(context)|Article]]
12747 [[:Bar:Article(context)|Article]]
12748 [[Article(context)]]
12749 [[Bar:X(Y)Z|X(Y)Z]]
12750 [[:Bar:X(Y)Z|X(Y)Z]]
12751 !! end
12752
12753 !! test
12754 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12755 !! options
12756 pst
12757 !! wikitext
12758 [[Article (context), context|]]
12759 [[Article (context),context|]]
12760 [[Bar:Article (context), context|]]
12761 [[Bar:Article (context),context|]]
12762 [[:Bar:Article (context), context|]]
12763 [[:Bar:Article (context),context|]]
12764 !! html/php
12765 [[Article (context), context|Article]]
12766 [[Article (context),context|Article]]
12767 [[Bar:Article (context), context|Article]]
12768 [[Bar:Article (context),context|Article]]
12769 [[:Bar:Article (context), context|Article]]
12770 [[:Bar:Article (context),context|Article]]
12771 !! end
12772
12773 !! test
12774 pre-save transform: trim trailing empty lines
12775 !! options
12776 pst
12777 !! wikitext
12778 Empty lines are trimmed
12779
12780
12781
12782
12783 !! html/php
12784 Empty lines are trimmed
12785 !! end
12786
12787 !! test
12788 pre-save transform: Signature expansion
12789 !! options
12790 pst
12791 !! wikitext
12792 * ~~~
12793 * <noinclude>~~~</noinclude>
12794 * <includeonly>~~~</includeonly>
12795 * <onlyinclude>~~~</onlyinclude>
12796 !! html/php
12797 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12798 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12799 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12800 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12801 !! end
12802
12803
12804 !! test
12805 pre-save transform: Signature expansion in nowiki tags (bug 93)
12806 !! options
12807 pst disabled
12808 !! wikitext
12809 Shall not expand:
12810
12811 <nowiki>~~~~</nowiki>
12812
12813 <includeonly><nowiki>~~~~</nowiki></includeonly>
12814
12815 <noinclude><nowiki>~~~~</nowiki></noinclude>
12816
12817 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12818
12819 {{subst:Foo}} shall be converted to FOO
12820
12821 As well as inside noinclude/onlyinclude
12822 <noinclude>{{subst:Foo}}</noinclude>
12823 <onlyinclude>{{subst:Foo}}</onlyinclude>
12824
12825 But not inside includeonly
12826 <includeonly>{{subst:Foo}}</includeonly>
12827 !! html/php
12828 Shall not expand:
12829
12830 <nowiki>~~~~</nowiki>
12831
12832 <includeonly><nowiki>~~~~</nowiki></includeonly>
12833
12834 <noinclude><nowiki>~~~~</nowiki></noinclude>
12835
12836 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12837
12838 FOO shall be converted to FOO
12839
12840 As well as inside noinclude/onlyinclude
12841 <noinclude>FOO</noinclude>
12842 <onlyinclude>FOO</onlyinclude>
12843
12844 But not inside includeonly
12845 <includeonly>{{subst:Foo}}</includeonly>
12846 !! end
12847
12848 !! test
12849 Parsoid: Recognize nowiki with trailing space in tags
12850 !! options
12851 parsoid=wt2html
12852 !! wikitext
12853 <nowiki ><div>[[foo]]</nowiki >
12854
12855 a<nowiki / >b
12856
12857 c<nowiki />d
12858
12859 e<nowiki/ >f
12860 !! html
12861 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12862 <p>ab</p>
12863 <p>cd</p>
12864 <p>ef</p>
12865 !! end
12866
12867 !! test
12868 Parsoid: Recognize nowiki with odd capitalization
12869 !! options
12870 parsoid=wt2html
12871 !! wikitext
12872 <noWikI ><div>[[foo]]</Nowiki >
12873 !! html
12874 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12875 !! end
12876
12877
12878 !! test
12879 Parsoid: Escape nowiki with trailing space in tags
12880 !! options
12881 parsoid=html2wt
12882 !! html/parsoid
12883 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12884 <p>a&lt;nowiki /&gt;b</p>
12885 <p>c&lt;nowiki/ &gt;d</p>
12886 !! wikitext
12887 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12888
12889 a&lt;nowiki /&gt;b
12890
12891 c&lt;nowiki/ &gt;d
12892 !! end
12893
12894 !! test
12895 Parsoid: Escape weird noWikI capitalizations
12896 !! options
12897 parsoid=html2wt
12898 !! html/parsoid
12899 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12900 !! wikitext
12901 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12902 !! end
12903
12904 ###
12905 ### Message transform tests
12906 ###
12907 !! test
12908 message transform: magic variables
12909 !! options
12910 msg
12911 !! wikitext
12912 {{SITENAME}}
12913 !! html
12914 MediaWiki
12915 !! end
12916
12917 !! test
12918 message transform: should not transform wiki markup
12919 !! options
12920 msg
12921 !! wikitext
12922 ''test''
12923 !! html
12924 ''test''
12925 !! end
12926
12927 !! test
12928 message transform: <noinclude> in transcluded template (bug 4926)
12929 !! options
12930 msg
12931 !! wikitext
12932 {{Includes}}
12933 !! html
12934 Foobar
12935 !! end
12936
12937 !! test
12938 message transform: <onlyinclude> in transcluded template (bug 4926)
12939 !! options
12940 msg
12941 !! wikitext
12942 {{Includes2}}
12943 !! html
12944 Foo
12945 !! end
12946
12947 !! test
12948 {{#special:}} page name, known
12949 !! options
12950 msg
12951 !! wikitext
12952 {{#special:Recentchanges}}
12953 !! html
12954 Special:RecentChanges
12955 !! end
12956
12957 !! test
12958 {{#special:}} page name with subpage, known
12959 !! options
12960 msg
12961 !! wikitext
12962 {{#special:Recentchanges/param}}
12963 !! html
12964 Special:RecentChanges/param
12965 !! end
12966
12967 !! test
12968 {{#special:}} page name, unknown
12969 !! options
12970 msg
12971 !! wikitext
12972 {{#special:foobar nonexistent}}
12973 !! html
12974 Special:Foobar nonexistent
12975 !! end
12976
12977 !! test
12978 {{#speciale:}} page name, known
12979 !! options
12980 msg
12981 !! wikitext
12982 {{#speciale:Recentchanges}}
12983 !! html
12984 Special:RecentChanges
12985 !! end
12986
12987 !! test
12988 {{#speciale:}} page name with subpage, known
12989 !! options
12990 msg
12991 !! wikitext
12992 {{#speciale:Recentchanges/param}}
12993 !! html
12994 Special:RecentChanges/param
12995 !! end
12996
12997 !! test
12998 {{#speciale:}} page name, unknown
12999 !! options
13000 msg
13001 !! wikitext
13002 {{#speciale:foobar nonexistent}}
13003 !! html
13004 Special:Foobar_nonexistent
13005 !! end
13006
13007 ###
13008 ### Images
13009 ###
13010 ### For Parsoid-specific tests, see
13011 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13012
13013 !! test
13014 Simple image
13015 !! options
13016 parsoid=wt2html,wt2wt,html2html
13017 !! wikitext
13018 [[Image:foobar.jpg]]
13019 !! html/php
13020 <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>
13021 </p>
13022 !! html/parsoid
13023 <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>
13024 !! end
13025
13026 !! test
13027 Simple image (using File: namespace, now canonical)
13028 !! wikitext
13029 [[File:Foobar.jpg]]
13030 !! html/php
13031 <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>
13032 </p>
13033 !! html/parsoid
13034 <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>
13035 !! end
13036
13037 !! test
13038 Right-aligned image
13039 !! wikitext
13040 [[File:Foobar.jpg|right]]
13041 !! html/php
13042 <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>
13043
13044 !! html/parsoid
13045 <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>
13046 !! end
13047
13048 !! test
13049 Image with caption
13050 !! wikitext
13051 [[File:Foobar.jpg|right|Caption text]]
13052 !! html/php
13053 <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>
13054
13055 !! html/parsoid
13056 <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>
13057 !! end
13058
13059 !! test
13060 Image with caption, bug 53312 #1
13061 !! wikitext
13062 [[File:Foobar.jpg|right|Caption page stuff]]
13063 !! html/php
13064 <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>
13065
13066 !! html/parsoid
13067 <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>
13068 !! end
13069
13070 !! test
13071 Image with caption, bug 53312 #2
13072 !! wikitext
13073 [[File:Foobar.jpg|right|Caption page=]]
13074 !! html/php
13075 <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>
13076
13077 !! html/parsoid
13078 <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>
13079 !! end
13080
13081 !! test
13082 Image with caption, bug 53312 #3
13083 !! wikitext
13084 [[File:Foobar.jpg|right|Caption page=stuff]]
13085 !! html/php
13086 <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>
13087
13088 !! html/parsoid
13089 <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>
13090 !! end
13091
13092 !! test
13093 Allow empty links in image captions (Bug 60753)
13094 !! options
13095 thumbsize=220
13096 !! wikitext
13097 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13098 [[]]
13099 [[Link2]]
13100 ]]
13101 !! html/php
13102 <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>
13103
13104 !! html/parsoid
13105 <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>
13106 [[]]
13107 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13108 </figcaption></figure>
13109 !! end
13110
13111 !! test
13112 Titles in unlinked images (T23454)
13113 !! wikitext
13114 [[File:Foobar.jpg|link=|stuff]]
13115 !! html/php
13116 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13117 </p>
13118 !! end
13119
13120 !! test
13121 Link with empty target
13122 !! wikitext
13123 [[]]
13124 !! html
13125 <p>[[]]
13126 </p>
13127 !! end
13128
13129 !! test
13130 Image with link trail
13131 !! wikitext
13132 Linktrails should not work for images: [[File:Foobar.jpg]]s
13133 !! html/php
13134 <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
13135 </p>
13136 !! html/parsoid
13137 <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>
13138 !! end
13139
13140 !! test
13141 Image with empty attribute
13142 !! options
13143 parsoid=wt2html,wt2wt,html2html
13144 !! wikitext
13145 [[File:Foobar.jpg|right||Caption text]]
13146 !! html/php
13147 <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>
13148
13149 !! html/parsoid
13150 <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>
13151 !! end
13152
13153 !! test
13154 1. Block image with individual attributes from templates
13155 !! wikitext
13156 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13157 !! html/php
13158 <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>
13159
13160 !! html/parsoid
13161 <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>
13162 !! end
13163
13164 !! test
13165 2. Block Image with individual attributes from templates
13166 !! wikitext
13167 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13168 !! html/php
13169 <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>
13170
13171 !! html/parsoid
13172 <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>
13173 !! end
13174
13175 !! test
13176 3. Inline image with individual attributes from templates
13177 !! wikitext
13178 [[File:Foobar.jpg|{{echo|50px}}]]
13179 !! html/php
13180 <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>
13181 </p>
13182 !! html/parsoid
13183 <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>
13184 !! end
13185
13186 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13187 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13188 !! test
13189 Image with multiple attributes from the same template
13190 !! wikitext
13191 [[File:Foobar.jpg|{{image_attribs}}]]
13192 !! html/php
13193 <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>
13194
13195 !! html/parsoid
13196 <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>
13197 !! end
13198
13199 !! test
13200 Image with link tails
13201 !! options
13202 thumbsize=220
13203 !! wikitext
13204 123[[File:Foobar.jpg]]456
13205 123[[File:Foobar.jpg|right]]456
13206 123[[File:Foobar.jpg|thumb]]456
13207 !! html/php
13208 <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
13209 </p>
13210 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
13211 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
13212
13213 !! html/php+tidy
13214 <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>
13215 <p>123</p>
13216 <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>
13217 <p>456 123</p>
13218 <div class="thumb tright">
13219 <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>
13220 <div class="thumbcaption">
13221 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13222 </div>
13223 </div>
13224 </div>
13225 <p>456</p>
13226 !! html/parsoid
13227 <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>
13228 <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>
13229 <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>
13230 !! end
13231
13232 !! test
13233 Image with multiple captions -- only last one is accepted
13234 !! wikitext
13235 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13236 !! html/php
13237 <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>
13238
13239 !! html/parsoid
13240 <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>
13241 !! end
13242
13243 !! test
13244 Image with multiple widths -- use last
13245 !! wikitext
13246 [[File:Foobar.jpg|200px|300px|caption]]
13247 !! html/php
13248 <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>
13249 </p>
13250 !! html/parsoid
13251 <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>
13252 !! end
13253
13254 !! test
13255 Image with multiple alignments -- use first (bug 48664)
13256 !! options
13257 thumbsize=220
13258 !! wikitext
13259 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13260
13261 [[File:Foobar.jpg|middle|text-top|caption]]
13262 !! html/php
13263 <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>
13264 <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>
13265 </p>
13266 !! html/parsoid
13267 <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>
13268 <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>
13269 !! end
13270
13271 !! test
13272 Image with width attribute at different positions
13273 !! wikitext
13274 [[File:Foobar.jpg|200px|right|Caption]]
13275 [[File:Foobar.jpg|right|200px|Caption]]
13276 [[File:Foobar.jpg|right|Caption|200px]]
13277 !! html/php
13278 <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>
13279 <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>
13280 <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>
13281
13282 !! html/parsoid
13283 <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>
13284 <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>
13285 <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>
13286 !! end
13287
13288 # a sad bit of backward-compatibility
13289 !! test
13290 Image with size specified with pxpx (bug 13500, 51628)
13291 !! options
13292 parsoid=wt2html,wt2wt,html2html
13293 !! wikitext
13294 [[File:Foobar.jpg|20pxpx]]
13295 [[File:Foobar.jpg|200x20pxpx]]
13296 !! html/php
13297 <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>
13298 <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>
13299 </p>
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 !! test
13305 Image with link parameter, wiki target
13306 !! wikitext
13307 [[File:Foobar.jpg|link=Main Page]]
13308 !! html/php
13309 <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>
13310 </p>
13311 !! html/parsoid
13312 <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>
13313 !! end
13314
13315 # parsoid bug 49293 (part 1)
13316 !! test
13317 Image with link parameter, URL target
13318 !! wikitext
13319 [[File:Foobar.jpg|link=http://example.com/]]
13320 !! html/php
13321 <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>
13322 </p>
13323 !! html/parsoid
13324 <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>
13325 !! end
13326
13327 # parsoid bug 49293 (part 2)
13328 !! test
13329 Image with link parameter, protocol-less URL target
13330 !! wikitext
13331 [[File:Foobar.jpg|link=//example.com/]]
13332 !! html/php
13333 <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>
13334 </p>
13335 !! html/parsoid
13336 <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>
13337 !! end
13338
13339 !! test
13340 Escaping non-block captions (T107435)
13341 !! options
13342 parsoid={
13343 "modes": ["wt2wt"],
13344 "changes": [
13345 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13346 ]
13347 }
13348 !! wikitext
13349 [[Image:Foobar.jpg|caption]]
13350 !! wikitext/edited
13351 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13352 !! end
13353
13354 # wgExternalLinkTarget not supported by Parsoid
13355 !! test
13356 Image with link parameter, wgExternalLinkTarget
13357 !! wikitext
13358 [[Image:foobar.jpg|link=http://example.com/]]
13359 !! config
13360 wgExternalLinkTarget='foobar'
13361 !! html/php
13362 <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>
13363 </p>
13364 !! end
13365
13366 !! test
13367 Image with link parameter, wgNoFollowLinks set to false
13368 !! wikitext
13369 [[Image:foobar.jpg|link=http://example.com/]]
13370 !! config
13371 wgNoFollowLinks=false
13372 !! html
13373 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13374 </p>
13375 !! end
13376
13377 !! test
13378 Image with link parameter, wgNoFollowDomainExceptions
13379 !! wikitext
13380 [[Image:foobar.jpg|link=http://example.com/]]
13381 !! config
13382 wgNoFollowDomainExceptions='example.com'
13383 !! html
13384 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13385 </p>
13386 !! end
13387
13388 # wgExternalLinkTarget not supported by Parsoid
13389 !! test
13390 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13391 !! wikitext
13392 [[Image:foobar.jpg|link=http://example.com/|Title]]
13393 !! config
13394 wgExternalLinkTarget='foobar'
13395 !! html/php
13396 <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>
13397 </p>
13398 !! end
13399
13400 !! test
13401 Image with empty link parameter
13402 !! wikitext
13403 [[File:Foobar.jpg|link=]]
13404 !! html/php
13405 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13406 </p>
13407 !! html/parsoid
13408 <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>
13409 !! end
13410
13411 !! test
13412 Image with link parameter (wiki target) and unnamed parameter
13413 !! wikitext
13414 [[File:Foobar.jpg|link=Main_Page|Title]]
13415 !! html/php
13416 <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>
13417 </p>
13418 !! html/parsoid
13419 <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>
13420 !! end
13421
13422 !! test
13423 Image with link parameter (URL target) and unnamed parameter
13424 !! wikitext
13425 [[File:Foobar.jpg|link=http://example.com/|Title]]
13426 !! html/php
13427 <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>
13428 </p>
13429 !! html/parsoid
13430 <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>
13431 !! end
13432
13433 !! test
13434 Thumbnail image with link parameter
13435 !! options
13436 thumbsize=220
13437 parsoid=wt2html,wt2wt,html2html
13438 !! wikitext
13439 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13440 !! html/php
13441 <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>
13442
13443 !! html/parsoid
13444 <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>
13445 !! end
13446
13447 !! test
13448 Manually-specified thumbnail image
13449 !! options
13450 thumbsize=220
13451 !! wikitext
13452 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13453 !! html/php
13454 <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>
13455
13456 !! html/parsoid
13457 <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>
13458 !! end
13459
13460 !! test
13461 Manually-specified thumbnail image with explicit link to wiki page
13462 !! options
13463 thumbsize=220
13464 parsoid=wt2html,wt2wt,html2html
13465 !! wikitext
13466 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13467 !! html/php
13468 <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>
13469
13470 !! html/parsoid
13471 <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>
13472 !! end
13473
13474 !! test
13475 Manually-specified thumbnail image with explicit link to url
13476 !! options
13477 thumbsize=220
13478 parsoid=wt2html,wt2wt,html2html
13479 !! wikitext
13480 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13481 !! html/php
13482 <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>
13483
13484 !! html/parsoid
13485 <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>
13486 !! end
13487
13488 !! test
13489 Manually-specified thumbnail image with explicit no link
13490 !! options
13491 thumbsize=220
13492 parsoid=wt2html,wt2wt,html2html
13493 !! wikitext
13494 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13495 !! html/php
13496 <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>
13497
13498 !! html/parsoid
13499 <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>
13500 !! end
13501
13502 !! test
13503 Manually-specified thumbnail image with explicit link and alt text
13504 !! options
13505 thumbsize=220
13506 parsoid=wt2html,wt2wt,html2html
13507 !! wikitext
13508 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13509 !! html/php
13510 <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>
13511
13512 !! html/parsoid
13513 <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>
13514 !! end
13515
13516 !! test
13517 Image with frame and link
13518 !! options
13519 parsoid=wt2html,wt2wt,html2html
13520 !! wikitext
13521 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13522 !! html/php
13523 <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>
13524
13525 !! html/parsoid
13526 <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>
13527 !! end
13528
13529 !! test
13530 Image with frame and link and explicit alt
13531 !! options
13532 parsoid=wt2html,wt2wt,html2html
13533 !! wikitext
13534 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13535 !! html/php
13536 <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>
13537
13538 !! html/parsoid
13539 <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>
13540 !! end
13541
13542 !! test
13543 Image with wiki markup in implicit alt
13544 !! wikitext
13545 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13546
13547 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13548 !! html/php
13549 <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>
13550 </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>
13551 </p>
13552 !! html/parsoid
13553 <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>
13554
13555 <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>
13556 !! end
13557
13558 !! test
13559 Alt image option should handle most kinds of wikitext without barfing
13560 !! wikitext
13561 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13562 !! html/php
13563 <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>
13564
13565 !! html/parsoid
13566 <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>
13567 !! end
13568
13569 ###################
13570 # Conflicting image format options.
13571 # First option specified should 'win'.
13572 # All three cases in each test should be identical.
13573
13574 !! test
13575 Image with 'frameless' first.
13576 !! options
13577 parsoid=wt2html,wt2wt,html2html
13578 !! wikitext
13579 [[File:Foobar.jpg|frameless|caption]]
13580
13581 [[File:Foobar.jpg|frameless|frame|caption]]
13582
13583 [[File:Foobar.jpg|frameless|thumb|caption]]
13584 !! html/php
13585 <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>
13586 </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>
13587 </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>
13588 </p>
13589 !! html/parsoid
13590 <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>
13591 <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>
13592 <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>
13593 !! end
13594
13595 !! test
13596 Image with 'frame' first.
13597 !! options
13598 parsoid=wt2html,wt2wt,html2html
13599 !! wikitext
13600 [[File:Foobar.jpg|frame|caption]]
13601 [[File:Foobar.jpg|frame|frameless|caption]]
13602 [[File:Foobar.jpg|frame|thumb|caption]]
13603 !! html/php
13604 <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>
13605 <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>
13606 <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>
13607
13608 !! html/parsoid
13609 <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>
13610 <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>
13611 <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>
13612 !! end
13613
13614 !! test
13615 Image with 'thumb' first.
13616 !! options
13617 parsoid=wt2html,wt2wt,html2html
13618 !! wikitext
13619 [[File:Foobar.jpg|thumb|caption]]
13620 [[File:Foobar.jpg|thumb|frameless|caption]]
13621 [[File:Foobar.jpg|thumb|frame|caption]]
13622 !! html/php
13623 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13624 <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>
13625 <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>
13626
13627 !! html/parsoid
13628 <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>
13629 <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>
13630 <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>
13631 !! end
13632
13633 ###################
13634 # Image sizing.
13635 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13636 # and https://phabricator.wikimedia.org/T64258
13637 # Foobar has actual size of 1941x220
13638 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13639 # a scalable format.
13640 # 2. Framed images always ignore size options; always render at default size.
13641 # 3. "Unspecified format" and border are the only types which can be
13642 # enlarged.
13643
13644 !! test
13645 Image: "unspecified format" and border enlarge
13646 !! options
13647 parsoid=wt2html,wt2wt,html2html
13648 !! wikitext
13649 [[File:Foobar.jpg|2000px]]
13650
13651 [[File:Foobar.jpg|border|2000px]]
13652 !! html/php
13653 <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>
13654 </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>
13655 </p>
13656 !! html/parsoid
13657 <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>
13658 <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>
13659 !! end
13660
13661 !! test
13662 Image: "unspecified format" and border reduce
13663 !! options
13664 parsoid=wt2html,wt2wt,html2html
13665 !! wikitext
13666 [[File:Foobar.jpg|1000px]]
13667
13668 [[File:Foobar.jpg|border|1000px]]
13669 !! html/php
13670 <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>
13671 </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>
13672 </p>
13673 !! html/parsoid
13674 <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>
13675 <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>
13676 !! end
13677
13678 !! test
13679 Image: thumbs reduce
13680 !! options
13681 parsoid=wt2html,wt2wt,html2html
13682 !! wikitext
13683 [[File:Foobar.jpg|thumb|50px]]
13684 !! html/php
13685 <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>
13686
13687 !! html/parsoid
13688 <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>
13689 !! end
13690
13691 !! test
13692 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13693 !! options
13694 parsoid=wt2html,wt2wt,html2html
13695 !! wikitext
13696 [[File:Foobar.jpg|thumb|2000px]]
13697
13698 [[File:Foobar.svg|thumb|2000px]]
13699 !! html/php
13700 <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>
13701 <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>
13702
13703 !! html/parsoid
13704 <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>
13705 <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>
13706 !! end
13707
13708 !! test
13709 Image: frameless can reduce in size
13710 !! options
13711 parsoid=wt2html,wt2wt,html2html
13712 !! wikitext
13713 [[File:Foobar.jpg|frameless|50px]]
13714 !! html/php
13715 <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>
13716 </p>
13717 !! html/parsoid
13718 <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>
13719 !! end
13720
13721 !! test
13722 Image: bitmap frameless can't be enlarged past original size, but vector can
13723 !! options
13724 parsoid=wt2html,wt2wt,html2html
13725 !! wikitext
13726 [[File:Foobar.jpg|frameless|2000px]]
13727
13728 [[File:Foobar.svg|frameless|2000px]]
13729 !! html/php
13730 <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>
13731 </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>
13732 </p>
13733 !! html/parsoid
13734 <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>
13735 <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>
13736 !! end
13737
13738 !! test
13739 Image: framed images are always unscaled.
13740 !! options
13741 parsoid=wt2html,wt2wt,html2html
13742 !! wikitext
13743 [[File:Foobar.jpg|frame]]
13744
13745 [[File:Foobar.jpg|frame|50px]]
13746
13747 [[File:Foobar.jpg|frame|50x50px]]
13748
13749 [[File:Foobar.jpg|frame|2000px]]
13750 !! html/php
13751 <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>
13752 <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>
13753 <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>
13754 <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>
13755
13756 !! html/parsoid
13757 <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>
13758 <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>
13759 <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>
13760 <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>
13761 !! end
13762
13763 ###################
13764
13765 !! test
13766 Link to image page- image page normally doesn't exists, hence edit link
13767 Add test with existing image page
13768 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13769 !! wikitext
13770 [[:Image:test]]
13771 !! html
13772 <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>
13773 </p>
13774 !! end
13775
13776 !! test
13777 bug 18784 Link to non-existent image page with caption should use caption as link text
13778 !! wikitext
13779 [[:Image:test|caption]]
13780 !! html
13781 <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>
13782 </p>
13783 !! end
13784
13785 !! test
13786 Frameless image caption with a free URL
13787 !! wikitext
13788 [[File:Foobar.jpg|http://example.com]]
13789 !! html/php
13790 <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>
13791 </p>
13792 !! html/parsoid
13793 <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>
13794 !! end
13795
13796 !! test
13797 Thumbnail image caption with a free URL
13798 !! options
13799 thumbsize=220
13800 !! wikitext
13801 [[File:Foobar.jpg|thumb|http://example.com]]
13802 !! html/php
13803 <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>
13804
13805 !! html/parsoid
13806 <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>
13807 !! end
13808
13809 !! test
13810 Thumbnail image caption with a free URL and explicit alt
13811 !! options
13812 thumbsize=220
13813 parsoid=wt2html,wt2wt,html2html
13814 !! wikitext
13815 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13816 !! html/php
13817 <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>
13818
13819 !! html/parsoid
13820 <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>
13821 !! end
13822
13823 !! test
13824 SVG thumbnails with no language set
13825 !! options
13826 !! wikitext
13827 [[File:Foobar.svg|thumb|caption]]
13828 !! html/php
13829 <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>
13830
13831 !! html/parsoid
13832 <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>
13833 !! end
13834
13835 !! test
13836 SVG thumbnails with language de
13837 !! options
13838 parsoid=wt2html,wt2wt,html2html
13839 !! wikitext
13840 [[File:Foobar.svg|thumb|caption|lang=de]]
13841 !! html/php
13842 <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>
13843
13844 !! html/parsoid
13845 <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>
13846 !! end
13847
13848 !! test
13849 SVG thumbnails with invalid language code
13850 !! options
13851 parsoid=wt2html,wt2wt,html2html
13852 !! wikitext
13853 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13854 !! html/php
13855 <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>
13856
13857 !! html/parsoid
13858 <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>
13859 !! end
13860
13861 !! test
13862 BUG 1887: A ISBN with a thumbnail
13863 !! wikitext
13864 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13865 !! html/php
13866 <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>
13867
13868 !! html/parsoid
13869 <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>
13870 !! end
13871
13872 !! test
13873 BUG 1887: A RFC with a thumbnail
13874 !! wikitext
13875 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13876 !! html/php
13877 <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>
13878
13879 !! html/parsoid
13880 <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>
13881 !! end
13882
13883 !! test
13884 BUG 1887: A mailto link with a thumbnail
13885 !! wikitext
13886 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13887 !! html/php
13888 <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>
13889
13890 !! html/parsoid
13891 <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>
13892 !! end
13893
13894 # Pending resolution to bug 368
13895 !! test
13896 BUG 648: Frameless image caption with a link
13897 !! wikitext
13898 [[File:Foobar.jpg|text with a [[link]] in it]]
13899 !! html/php
13900 <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>
13901 </p>
13902 !! html/parsoid
13903 <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>
13904 !! end
13905
13906 !! test
13907 BUG 648: Frameless image caption with a link (suffix)
13908 !! wikitext
13909 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13910 !! html/php
13911 <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>
13912 </p>
13913 !! html/parsoid
13914 <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>
13915 !! end
13916
13917 !! test
13918 BUG 648: Frameless image caption with an interwiki link
13919 !! wikitext
13920 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13921 !! html/php
13922 <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>
13923 </p>
13924 !! html/parsoid
13925 <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>
13926 !! end
13927
13928 !! test
13929 BUG 648: Frameless image caption with a piped interwiki link
13930 !! wikitext
13931 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13932 !! html/php
13933 <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>
13934 </p>
13935 !! html/parsoid
13936 <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>
13937 !! end
13938
13939 !! test
13940 T107474: Frameless image caption with <nowiki>
13941 !! wikitext
13942 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13943 !! html/parsoid
13944 <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>
13945 !! end
13946
13947 !! test
13948 Escape HTML special chars in image alt text
13949 !! wikitext
13950 [[File:Foobar.jpg|& < > "]]
13951 !! html/php
13952 <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>
13953 </p>
13954 !! html/parsoid
13955 <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>
13956 !! end
13957
13958 !! test
13959 BUG 499: Alt text should have &#1234;, not &amp;1234;
13960 !! wikitext
13961 [[File:Foobar.jpg|&#9792;]]
13962 !! html/php
13963 <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>
13964 </p>
13965 !! html/parsoid
13966 <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>
13967 !! end
13968
13969 !! test
13970 Broken image caption with link
13971 !! options
13972 parsoid=wt2html,wt2wt,html2html
13973 !! wikitext
13974 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13975 !! html/php
13976 <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.
13977 </p>
13978 !! html/parsoid
13979 <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>
13980 !! end
13981
13982 !! test
13983 Image caption containing another image
13984 !! wikitext
13985 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13986 !! html/php
13987 <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>
13988
13989 !! html/parsoid
13990 <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>
13991 !! end
13992
13993 !! test
13994 Image: caption containing a newline
13995 !! wikitext
13996 [[File:Foobar.jpg|This
13997 *is some text]]
13998 !! html/php
13999 <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>
14000 </p>
14001 !! html/parsoid
14002 <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>
14003 !!end
14004
14005 !!test
14006 Image: caption containing leading space
14007 (The leading space should not trigger nowiki escaping in wt2wt mode)
14008 !! wikitext
14009 [[File:Foobar.jpg|thumb| bar]]
14010 !! html/php
14011 <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>
14012
14013 !! html/parsoid
14014 <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>
14015 !!end
14016
14017 !! test
14018 Image: caption containing a table
14019 !! options
14020 parsoid=wt2html,wt2wt,html2html
14021 !! wikitext
14022 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14023 {|
14024 ! Foo !! Bar
14025 |-
14026 | Foo1 || Bar1
14027 |}
14028 and some more text.]]
14029 !! html/php
14030 <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>
14031
14032 !! html/parsoid
14033 <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
14034 <table>
14035 <tbody>
14036 <tr><th>Foo </th><th>Bar</th></tr>
14037 <tr>
14038 <td>Foo1 </td>
14039 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14040 !! end
14041
14042 !! test
14043 Bug 3090: External links other than http: in image captions
14044 !! wikitext
14045 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14046 !! html/php
14047 <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>
14048
14049 !! html/parsoid
14050 <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>
14051 !! end
14052
14053 !! test
14054 Custom class
14055 !! options
14056 parsoid=wt2html,wt2wt,html2html
14057 !! wikitext
14058 [[Image:foobar.jpg|a|class=b]]
14059 !! html/php
14060 <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>
14061 </p>
14062 !! html/parsoid
14063 <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>
14064 !! end
14065
14066 !! test
14067 Localized image handling (1).
14068 !! options
14069 parsoid=wt2html,wt2wt,html2html
14070 language=es
14071 !! wikitext
14072 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14073 !! html/php
14074 <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>
14075
14076 !! html/parsoid
14077 <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>
14078 !! end
14079
14080 !! test
14081 Localized image handling (2).
14082 !! options
14083 thumbsize=220
14084 parsoid=wt2html,wt2wt,html2html
14085 language=es
14086 !! wikitext
14087 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14088 !! html/php
14089 <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>
14090
14091 !! html/parsoid
14092 <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>
14093 !! end
14094
14095 !! test
14096 Localized image handling (3).
14097 !! options
14098 language=fa
14099 parsoid=html2wt
14100 !! html/parsoid
14101 <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>
14102 !! wikitext
14103 [[File:Foobar.jpg|بندانگشتی]]
14104 !! end
14105
14106 !! test
14107 "border", "frameless" and "class" attributes on an image.
14108 !! options
14109 thumbsize=220
14110 parsoid=wt2html,wt2wt,html2html
14111 !! wikitext
14112 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14113 !! html/php
14114 <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>
14115 </p>
14116 !! html/parsoid
14117 <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>
14118 !! end
14119
14120 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14121 !! test
14122 Invalid image attributes (bug 62500)
14123 !! options
14124 thumbsize=220
14125 parsoid=wt2html,wt2wt,html2html
14126 !! wikitext
14127 [[File:Foobar.jpg|thumb|float|left|caption]]
14128
14129 [[File:Foobar.jpg|thumb|righ|caption]]
14130
14131 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14132 !! html/php
14133 <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>
14134 <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>
14135 <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>
14136
14137 !! html/parsoid
14138 <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>
14139 <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>
14140 <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>
14141 !! end
14142
14143 !! article
14144 File:Barfoo.jpg
14145 !! text
14146 #REDIRECT [[File:Barfoo.jpg]]
14147 !! endarticle
14148
14149 # FIXME: Parsoid should run this test -- but we'd need to teach the
14150 # mockAPI about the redirected Barfoo.jpg image.
14151 !! test
14152 Redirected image
14153 !! wikitext
14154 [[Image:Barfoo.jpg]]
14155 !! html/php
14156 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14157 </p>
14158 !! end
14159
14160 !! test
14161 Missing image with uploads disabled
14162 !! options
14163 wgEnableUploads=0
14164 !! wikitext
14165 [[File:Foobaz.jpg]]
14166 !! html/php
14167 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14168 </p>
14169 !! html/parsoid
14170 <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>
14171 !! end
14172
14173 # Parsoid-specific testing for images
14174 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14175 # Currently imperfect due to a flaw in the Parsoid testrunner
14176 # Work in progress
14177 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14178 # image tests.
14179
14180 !! test
14181 Parsoid-specific image handling - simple image with size and middle alignment
14182 !! wikitext
14183 [[File:Foobar.jpg|middle|50px]]
14184 !! html/parsoid
14185 <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>
14186 !! end
14187
14188 !! test
14189 Parsoid-specific image handling - simple image with size, middle alignment,
14190 non-standard namespace alias
14191 !! options
14192 parsoid=wt2wt,wt2html,html2html
14193 !! wikitext
14194 [[Image:Foobar.jpg|middle|50px]]
14195 !! html/parsoid
14196 <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>
14197 !! end
14198
14199 !! test
14200 Parsoid-specific image handling - simple image with size and middle alignment
14201 (existing content)
14202 !! wikitext
14203 [[File:Foobar.jpg|50px|middle]]
14204 !! html/parsoid
14205 <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>
14206 !! end
14207
14208 !! test
14209 Parsoid-specific image handling - simple image with size and middle alignment
14210 and non-standard namespace name
14211 !! options
14212 parsoid=wt2html,wt2wt,html2html
14213 !! wikitext
14214 [[Image:Foobar.jpg|50px|middle]]
14215 !! html/parsoid
14216 <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>
14217 !! end
14218
14219 !! test
14220 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14221 !! wikitext
14222 [[File:Foobar.jpg|500x10px|baseline|caption]]
14223 !! html/parsoid
14224 <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>
14225 !! end
14226
14227 !! test
14228 Parsoid-specific image handling - simple image with border and size spec
14229 !! wikitext
14230 [[File:Foobar.jpg|50px|border|caption]]
14231 !! html/parsoid
14232 <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>
14233 !! end
14234
14235 !! test
14236 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14237 !! wikitext
14238 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14239 !! html/parsoid
14240 <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>
14241 !! end
14242
14243 !! test
14244 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14245 (existing content)
14246 !! wikitext
14247 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14248 !! html/parsoid
14249 <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>
14250 !! end
14251
14252 !! test
14253 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14254 !! wikitext
14255 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14256 !! html/parsoid
14257 <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>
14258 !! end
14259
14260 !! test
14261 Parsoid-specific image handling - thumbnail with specific size, halign,
14262 valign, and caption (existing content)
14263 !! wikitext
14264 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14265 !! html/parsoid
14266 <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>
14267 !! end
14268
14269 !! test
14270 Parsoid-specific image handling - framed image with specific size and caption
14271 (size is ignored)
14272 !! options
14273 parsoid=wt2html,wt2wt,html2html
14274 !! wikitext
14275 [[File:Foobar.jpg|frame|500x50px|caption]]
14276 !! html/parsoid
14277 <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>
14278 !! end
14279
14280 !! test
14281 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14282 (size is ignored)
14283 !! options
14284 parsoid=wt2html,wt2wt,html2html
14285 !! wikitext
14286 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14287 !! html/parsoid
14288 <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>
14289 !! end
14290
14291 !! test
14292 Parsoid-specific image handling - frameless image with specific size, border, and caption
14293 !! wikitext
14294 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14295 !! html/parsoid
14296 <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>
14297 !! end
14298
14299 !! test
14300 Parsoid-specific image handling - simple image with a formatted caption
14301 !! wikitext
14302 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14303 !! html/parsoid
14304 <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>
14305 !! end
14306
14307 !! test
14308 Parsoid-specific image handling - caption with a template in it
14309 !! wikitext
14310 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14311 !! html/parsoid
14312 <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>
14313 !! end
14314
14315 !! test
14316 Parsoid-specific image handling - caption with unbalanced tags in it
14317 !! options
14318 parsoid=wt2html,wt2wt,html2html
14319 !! wikitext
14320 foo
14321 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14322 bar
14323 !! html/parsoid
14324 <p>foo</p>
14325 <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>
14326 <p>bar</p>
14327 !! end
14328
14329 !! test
14330 Parsoid-specific image handling - empty caption (1)
14331 !! options
14332 parsoid=wt2html,wt2wt
14333 !! wikitext
14334 [[File:Foobar.jpg|thumb|]]
14335 !! html/parsoid
14336 <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>
14337 !! end
14338
14339 # empty captions don't get serialized unless we're in the "round trip" case
14340 !! test
14341 Parsoid-specific image handling - empty caption (2)
14342 !! options
14343 parsoid=html2wt
14344 !! html/parsoid
14345 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14346 <a href="./File:Foobar.jpg">
14347 <img resource="./File:Foobar.jpg"
14348 src="//example.com/images/3/3a/Foobar.jpg"
14349 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14350 height="25" width="220"/>
14351 </a>
14352 <figcaption></figcaption>
14353 </figure>
14354 !! wikitext
14355 [[File:Foobar.jpg|thumb]]
14356 !! end
14357
14358 !! test
14359 Parsoid-specific image handling - whitespace caption
14360 !! wikitext
14361 [[File:Foobar.jpg|thumb| ]]
14362 !! html/parsoid
14363 <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>
14364 !! end
14365
14366 !! test
14367 Parsoid-specific image handling - lang option
14368 !! wikitext
14369 foo
14370 [[File:Foobar.svg|lang=de|caption]]
14371 bar
14372 !! html/parsoid
14373 <p>foo
14374 <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>
14375 bar</p>
14376 !! end
14377
14378 ## Edge case bugs in Parsoid from T93580
14379 !! test
14380 T93580: 1. Templated <ref> inside block images
14381 !! wikitext
14382 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14383
14384 <references />
14385 !! html/parsoid
14386 <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>
14387
14388 <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>
14389 !! end
14390
14391 !! test
14392 T93580: 2. <ref> inside inline images
14393 !! wikitext
14394 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14395
14396 <references />
14397 !! html/parsoid
14398 <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>
14399
14400 <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>
14401 !! end
14402
14403 !! test
14404 T93580: 3. Templated <ref> inside inline images
14405 !! wikitext
14406 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14407
14408 <references />
14409 !! html/parsoid
14410 <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>
14411
14412 <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>
14413 !! end
14414
14415 ###
14416 ### Subpages
14417 ###
14418 !! article
14419 Subpage test/subpage
14420 !! text
14421 foo
14422 !! endarticle
14423
14424 !! test
14425 Subpage link
14426 !! options
14427 subpage title=[[Subpage test]]
14428 !! wikitext
14429 [[/subpage]]
14430 !! html
14431 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14432 </p>
14433 !! end
14434
14435 !! test
14436 Subpage noslash link
14437 !! options
14438 subpage title=[[Subpage test]]
14439 !! wikitext
14440 [[/subpage/]]
14441 !! html
14442 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14443 </p>
14444 !! end
14445
14446 !! article
14447 Subpage test/1/2/subpage
14448 !! text
14449 blah
14450 !! endarticle
14451
14452 !! test
14453 Relative subpage noslash link
14454 !! options
14455 parsoid=wt2wt,wt2html,html2html
14456 subpage title=[[Subpage test/1/2/3/4]]
14457 !! wikitext
14458 [[../../subpage/]]
14459
14460 [[../../subpage]]
14461 !! html/php
14462 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14463 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14464 </p>
14465 !! html/parsoid
14466 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14467 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14468 !! end
14469
14470 !! test
14471 Parsoid: dot-slash prefixed wikilinks
14472 !! wikitext
14473 [[./foo]]
14474
14475 [[././bar]]
14476
14477 [[././baz/]]
14478 !! html/php
14479 <p>[[./foo]]
14480 </p><p>[[././bar]]
14481 </p><p>[[././baz/]]
14482 </p>
14483 !! html/parsoid
14484 <p>[[./foo]]
14485 </p><p>[[././bar]]
14486 </p><p>[[././baz/]]
14487 </p>
14488 !! end
14489
14490 !! test
14491 Render invalid page names as plain text (bug 51090)
14492 !! wikitext
14493 [[./../foo|bar]]
14494 [[foo�|bar]]
14495 [[foo/.|bar]]
14496 [[foo/..|bar]]
14497 [[foo~~~bar]]
14498 [[foo>bar]]
14499 [[foo[bar]]
14500 [[.]]
14501 [[..]]
14502 [[foo././bar]]
14503
14504 [[{{echo|./../foo}}|bar]]
14505 [[{{echo|foo/.}}|bar]]
14506 [[{{echo|foo/..}}|bar]]
14507 [[{{echo|foo~~~~bar}}]]
14508 [[{{echo|foo>bar}}]]
14509 [[{{echo|foo././bar}}]]
14510 [[{{echo|foo{bar}}]]
14511 [[{{echo|foo}bar}}]]
14512 [[{{echo|foo[bar}}]]
14513 [[{{echo|foo]bar}}]]
14514 [[{{echo|foo<bar}}]]
14515 !!html/php
14516 <p>[[./../foo|bar]]
14517 [[foo�|bar]]
14518 [[foo/.|bar]]
14519 [[foo/..|bar]]
14520 [[foo~~~bar]]
14521 [[foo&gt;bar]]
14522 [[foo[bar]]
14523 [[.]]
14524 [[..]]
14525 [[foo././bar]]
14526 </p><p>[[./../foo|bar]]
14527 [[foo/.|bar]]
14528 [[foo/..|bar]]
14529 [[foo~~~~bar]]
14530 [[foo&gt;bar]]
14531 [[foo././bar]]
14532 [[foo{bar]]
14533 [[foo}bar]]
14534 [[foo[bar]]
14535 [[foo]bar]]
14536 [[foo&lt;bar]]
14537 </p>
14538 !!html/parsoid
14539 <p>[[./../foo|bar]]
14540 [[foo�|bar]]
14541 [[foo/.|bar]]
14542 [[foo/..|bar]]
14543 [[foo~~~bar]]
14544 [[foo>bar]]
14545 [[foo[bar]]
14546 [[.]]
14547 [[..]]
14548 [[foo././bar]]</p>
14549
14550 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14551 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14552 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14553 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14554 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14555 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14556 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14557 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14558 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14559 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14560 [[<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>
14561 !!end
14562
14563 !! test
14564 Disabled subpages
14565 !! wikitext
14566 [[/subpage]]
14567 !! html
14568 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14569 </p>
14570 !! end
14571
14572 !! test
14573 BUG 561: {{/Subpage}}
14574 !! options
14575 subpage title=[[Page]]
14576 !! wikitext
14577 {{/Subpage}}
14578 !! html
14579 <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>
14580 </p>
14581 !! end
14582
14583 ###
14584 ### Categories
14585 ###
14586 !! article
14587 Category:MediaWiki User's Guide
14588 !! text
14589 blah
14590 !! endarticle
14591
14592 !! test
14593 Link to category
14594 !! wikitext
14595 [[:Category:MediaWiki User's Guide]]
14596 !! html
14597 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14598 </p>
14599 !! end
14600
14601 !! test
14602 Simple category
14603 !! options
14604 cat
14605 !! wikitext
14606 [[Category:MediaWiki User's Guide]]
14607 !! html
14608 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14609 !! end
14610
14611 !! test
14612 PAGESINCATEGORY invalid title fatal (r33546 fix)
14613 !! wikitext
14614 {{PAGESINCATEGORY:<bogus>}}
14615 !! html
14616 <p>0
14617 </p>
14618 !! end
14619
14620 !! test
14621 Category with different sort key
14622 !! options
14623 cat
14624 !! wikitext
14625 [[Category:MediaWiki User's Guide|Foo]]
14626 !! html
14627 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14628 !! end
14629
14630 !! test
14631 Category with identical sort key
14632 !! options
14633 cat
14634 !! wikitext
14635 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14636 !! html
14637 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14638 !! end
14639
14640 !! test
14641 Category with empty sort key
14642 !! options
14643 cat
14644 pst
14645 !! wikitext
14646 [[Category:MediaWiki User's Guide|]]
14647 !! html/php
14648 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14649 !! end
14650
14651 !! test
14652 Category with empty sort key and parentheses
14653 !! options
14654 cat
14655 pst
14656 !! wikitext
14657 [[Category:Foo (bar)|]]
14658 !! html/php
14659 [[Category:Foo (bar)|Foo]]
14660 !! end
14661
14662 ## We used to, but no longer wt2wt this test since the default serializer
14663 ## will normalize all categories to serialize on their own line.
14664 ## This wikitext usage is going to be fairly uncommon in production and
14665 ## selser will take care of preserving formatting in those scenarios.
14666 !! test
14667 Category with link tail
14668 !! options
14669 cat
14670 pst
14671 parsoid=wt2html
14672 !! wikitext
14673 123[[Category:Foo]]456
14674 !! html/php
14675 123[[Category:Foo]]456
14676 !! html/parsoid
14677 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14678 !! end
14679
14680 !! test
14681 Category with template
14682 !! options
14683 cat
14684 pst
14685 !! wikitext
14686 [[Category:{{echo|Foo}}]]
14687 !! html/php
14688 [[Category:{{echo|Foo}}]]
14689 !! end
14690
14691 !! test
14692 Category with template in sort key
14693 !! options
14694 cat
14695 pst
14696 !! wikitext
14697 [[Category:Foo|{{echo|Bar}}]]
14698 !! html/php
14699 [[Category:Foo|{{echo|Bar}}]]
14700 !! end
14701
14702 !! test
14703 Category with template in sort key and title
14704 !! options
14705 cat
14706 pst
14707 !! wikitext
14708 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14709 !! html/php
14710 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14711 !! end
14712
14713 ## We used to, but no longer wt2wt this test since the default serializer
14714 ## will normalize all categories to serialize on their own line.
14715 ## This wikitext usage is going to be fairly uncommon in production and
14716 ## selser will take care of preserving formatting in those scenarios.
14717 !! test
14718 Category / paragraph interactions
14719 !! options
14720 parsoid=wt2html
14721 !! wikitext
14722 Foo [[Category:Baz]] Bar
14723
14724 Foo [[Category:Baz]]
14725 Bar
14726
14727 Foo
14728 [[Category:Baz]]
14729 Bar
14730
14731 Foo
14732 [[Category:Baz]] Bar
14733
14734 Foo
14735 [[Category:Baz]]
14736 [[Category:Baz]]
14737 [[Category:Baz]]
14738 Bar
14739
14740 [[Category:Baz]]
14741 [[Category:Baz]]
14742 [[Category:Baz]]
14743
14744 [[Category:Baz]]
14745 {{echo|[[Category:Baz]]}}
14746 [[Category:Baz]]
14747 !! html/php
14748 <p>Foo Bar
14749 </p><p>Foo
14750 Bar
14751 </p><p>Foo
14752 Bar
14753 </p><p>Foo Bar
14754 </p><p>Foo
14755 Bar
14756 </p>
14757 !! html/parsoid
14758 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14759 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14760 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14761 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14762 <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>
14763 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14764 !! end
14765
14766 ## We used to, but no longer wt2wt this test since the default serializer
14767 ## will normalize all categories to serialize on their own line.
14768 ## This wikitext usage is going to be fairly uncommon in production and
14769 ## selser will take care of preserving formatting in those scenarios.
14770 ##
14771 ## The whitespace on the empty line is part of the test. Please do not delete
14772 !! test
14773 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14774 !! options
14775 parsoid=wt2html
14776 !! wikitext
14777 This
14778
14779 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14780
14781 {{echo|[[Category:Foo]] and so should this!}}
14782 !! html/php
14783 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14784 </p>
14785 !! html/parsoid
14786 <p>This
14787
14788 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14789
14790 <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>
14791 !! end
14792
14793 ## Parsoid will not try to wt2wt this while preserving newlines because
14794 ## it suppresses excess newlines within list items -- and we don't want to
14795 ## introduce a special case just for categories, which is, in reality somewhat
14796 ## odd behavior -- categories are unlikely to be used in list items like this
14797 ## in top-level pages and are only likely to show up in template-generated
14798 ## list items where this RT-ing is a non-issue.
14799 ##
14800 ## The whitespace on the empty line is part of the test. Please do not delete
14801 !! test
14802 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14803 !! options
14804 parsoid=wt2html
14805 !! wikitext
14806 * This
14807
14808 [[Category:Foo]] and this should be part of the same list item
14809 * So should this
14810
14811 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14812 !! html
14813 <ul><li>This and this should be part of the same list item</li>
14814 <li>So should this and this should be part of the same list item</li></ul>
14815 !! html/parsoid
14816 <ul>
14817 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14818 <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>
14819 </ul>
14820 !! end
14821
14822 ## Newlines and categories that follow the last item of a list
14823 ## are treated differently because this (list followed by categories)
14824 ## is an extremely common pattern on wikis.
14825 !! test
14826 3. Categories and newlines: newline suppression for last list item should RT properly
14827 !! wikitext
14828 * a
14829 * b
14830
14831 [[Category:Foo]]
14832
14833 [[Category:Bar]]
14834 [[Category:Baz]]
14835 !! html/parsoid
14836 <ul><li> a</li>
14837 <li> b</li></ul>
14838
14839 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14840
14841 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14842 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14843 !! end
14844
14845 !! test
14846 4. Categories and newlines: newline suppression for last list item should RT properly
14847 !! wikitext
14848 * a
14849 **** b
14850
14851 [[Category:Foo]]
14852 !! html/parsoid
14853 <ul><li> a
14854 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14855
14856 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14857 !! end
14858
14859 ## only wt2html for this to make sure the algo only applies to the rightmost path
14860 !! test
14861 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14862 !! options
14863 parsoid=wt2html
14864 !! wikitext
14865 * a
14866 ** b
14867 [[Category:Foo]]
14868 * c
14869 ** d
14870 [[Category:Foo]]
14871 !! html/parsoid
14872 <ul><li> a
14873 <ul><li> b
14874 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14875 <li> c
14876 <ul><li> d</li></ul></li></ul>
14877 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14878 !! end
14879
14880 ## We used to, but no longer wt2wt this test since the default serializer
14881 ## will normalize all categories to serialize on their own line.
14882 ## This wikitext usage is going to be fairly uncommon in production and
14883 ## selser will take care of preserving formatting in those scenarios.
14884 !! test
14885 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14886 !! options
14887 parsoid=wt2html
14888 !! wikitext
14889 * a [[Category:Foo]]
14890 !! html/parsoid
14891 <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>
14892 !! end
14893
14894 # This test also demonstrates because of newline+category tunneling
14895 # through the list hander, template wrapping doesn't expand to the
14896 # containing list when the list item swallows the category.
14897 !! test
14898 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14899 !! wikitext
14900 * {{echo|a
14901 [[Category:Foo]]}}
14902 !! html/parsoid
14903 <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
14904 </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>
14905 !! end
14906
14907 !! test
14908 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14909 !! wikitext
14910 * a
14911
14912 {{echo|[[Category:Foo]]
14913 [[Category:Bar]]}}
14914 [[Category:Baz]]
14915 !! html/parsoid
14916 <ul><li> a</li></ul>
14917
14918 <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">
14919 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14920 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14921 !! end
14922
14923 !! test
14924 Parsoid: Serialize link to category page with colon escape
14925 !! options
14926 parsoid
14927 !! wikitext
14928
14929 [[:Category:Foo]]
14930 [[:Category:Foo|Bar]]
14931 !! html
14932 <p>
14933 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14934 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14935 </p>
14936 !! end
14937
14938 # We used to, but no longer wt2wt this test since the default serializer
14939 # will normalize all categories to serialize on their own line.
14940 # This wikitext usage is going to be fairly uncommon in production and
14941 # selser will take care of preventing whitespace insertion if this
14942 # occurs in an article.
14943 #
14944 # html2html disabled for the same reason (whitespace insertion between
14945 # x and y).
14946 #
14947 # html2wt disabled because it localizes the "Category" namespace.
14948 !! test
14949 Link prefix/suffixes aren't applied to category links
14950 !! options
14951 parsoid=wt2html
14952 language=is
14953 !! wikitext
14954 x[[Category:Foo]]y
14955 !! html/php
14956 <p>xy
14957 </p>
14958 !! html/parsoid
14959 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14960 !! end
14961
14962 !! test
14963 Parsoid: Serialize link to file page with colon escape
14964 !! options
14965 parsoid
14966 !! wikitext
14967
14968 [[:File:Foo.png]]
14969 [[:File:Foo.png|Bar]]
14970 !! html
14971 <p>
14972 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14973 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14974 </p>
14975 !! end
14976
14977 !! test
14978 Parsoid: Serialize a genuine category link without colon escape
14979 !! options
14980 parsoid
14981 !! wikitext
14982 [[Category:Foo]]
14983 [[Category:Foo|Bar]]
14984 !! html
14985 <link rel="mw:PageProp/Category" href="./Category:Foo">
14986 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14987 !! end
14988
14989 !! test
14990 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14991 !! options
14992 parsoid=html2wt
14993 !! html/parsoid
14994 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14995 !! wikitext
14996 [[Category:Toxine bactérienne]]
14997 !! end
14998
14999 !! test
15000 Parsoid: Defaultsort
15001 !! wikitext
15002 {{DEFAULTSORT:Foo}}
15003 !! html/parsoid
15004 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15005 !! end
15006
15007 !! test
15008 Parsoid: Defaultsort (template-generated)
15009 !! wikitext
15010 {{{{echo|DEFAULTSORT}}:Foo}}
15011 !! html/parsoid
15012 <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}}]}'/>
15013 !! end
15014
15015 ###
15016 ### Inter-language links
15017 ###
15018 !! test
15019 Interlanguage links
15020 !! options
15021 ill
15022 !! wikitext
15023 [[es:Alimento]]
15024 [[fr:Nourriture]]
15025 [[zh:食品]]
15026 !! html/php
15027 es:Alimento fr:Nourriture zh:食品
15028 !! html/parsoid
15029 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15030 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15031 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15032 !! end
15033
15034 !! test
15035 Duplicate interlanguage links (bug 24502)
15036 !! options
15037 ill
15038 !! wikitext
15039 [[es:1]]
15040 [[es:2]]
15041 [[fr:1]]
15042 [[fr:2]]
15043 !! html/php
15044 es:1 fr:1
15045 !! html/parsoid
15046 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15047 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15048 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15049 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15050 !! end
15051
15052 ###
15053 ### Sections
15054 ###
15055 !! test
15056 Basic section headings
15057 !! wikitext
15058 == Headline 1 ==
15059 Some text
15060
15061 ==Headline 2==
15062 More
15063 ===Smaller headline===
15064 Blah blah
15065 !! html
15066 <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>
15067 <p>Some text
15068 </p>
15069 <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>
15070 <p>More
15071 </p>
15072 <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>
15073 <p>Blah blah
15074 </p>
15075 !! end
15076
15077 !! test
15078 Section headings with TOC
15079 !! wikitext
15080 == Headline 1 ==
15081 === Subheadline 1 ===
15082 ===== Skipping a level =====
15083 ====== Skipping a level ======
15084
15085 == Headline 2 ==
15086 Some text
15087 ===Another headline===
15088 !! html
15089 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15090 <ul>
15091 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15092 <ul>
15093 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15094 <ul>
15095 <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>
15096 <ul>
15097 <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>
15098 </ul>
15099 </li>
15100 </ul>
15101 </li>
15102 </ul>
15103 </li>
15104 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15105 <ul>
15106 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15107 </ul>
15108 </li>
15109 </ul>
15110 </div>
15111
15112 <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>
15113 <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>
15114 <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>
15115 <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>
15116 <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>
15117 <p>Some text
15118 </p>
15119 <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>
15120
15121 !! end
15122
15123 !! test
15124 TOC anchors don't collide
15125 !! wikitext
15126 __FORCETOC__
15127 == Headline 2 ==
15128 == Headline ==
15129 == Headline 2 ==
15130 == Headline ==
15131 !! html/php
15132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15133 <ul>
15134 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15135 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15136 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15137 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15138 </ul>
15139 </div>
15140
15141 <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>
15142 <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>
15143 <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>
15144 <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>
15145
15146 !! end
15147
15148 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15149 !! test
15150 Handling of sections up to level 6 and beyond
15151 !! wikitext
15152 = Level 1 Heading=
15153 == Level 2 Heading==
15154 === Level 3 Heading===
15155 ==== Level 4 Heading====
15156 ===== Level 5 Heading=====
15157 ====== Level 6 Heading======
15158 ======= Level 7 Heading=======
15159 ======== Level 8 Heading========
15160 ========= Level 9 Heading=========
15161 ========== Level 10 Heading==========
15162 !! html
15163 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15164 <ul>
15165 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15166 <ul>
15167 <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>
15168 <ul>
15169 <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>
15170 <ul>
15171 <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>
15172 <ul>
15173 <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>
15174 <ul>
15175 <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>
15176 <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>
15177 <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>
15178 <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>
15179 <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>
15180 </ul>
15181 </li>
15182 </ul>
15183 </li>
15184 </ul>
15185 </li>
15186 </ul>
15187 </li>
15188 </ul>
15189 </li>
15190 </ul>
15191 </div>
15192
15193 <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>
15194 <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>
15195 <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>
15196 <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>
15197 <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>
15198 <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>
15199 <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>
15200 <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>
15201 <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>
15202 <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>
15203
15204 !! end
15205
15206 !! test
15207 TOC regression (T11764)
15208 !! wikitext
15209 == title 1 ==
15210 === title 1.1 ===
15211 ==== title 1.1.1 ====
15212 === title 1.2 ===
15213 == title 2 ==
15214 === title 2.1 ===
15215 !! html
15216 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15217 <ul>
15218 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15219 <ul>
15220 <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>
15221 <ul>
15222 <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>
15223 </ul>
15224 </li>
15225 <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>
15226 </ul>
15227 </li>
15228 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15229 <ul>
15230 <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>
15231 </ul>
15232 </li>
15233 </ul>
15234 </div>
15235
15236 <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>
15237 <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>
15238 <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>
15239 <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>
15240 <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>
15241 <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>
15242
15243 !! end
15244
15245 !! test
15246 TOC for heading containing <span id="..."></span> (T96153)
15247 !! wikitext
15248 __FORCETOC__
15249 ==<span id="old-anchor"></span>New title==
15250 !! html/php
15251 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15252 <ul>
15253 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15254 </ul>
15255 </div>
15256
15257 <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>
15258
15259 !! end
15260
15261 !! test
15262 TOC with wgMaxTocLevel=3 (bug 6204)
15263 !! options
15264 wgMaxTocLevel=3
15265 !! wikitext
15266 == title 1 ==
15267 === title 1.1 ===
15268 ==== title 1.1.1 ====
15269 === title 1.2 ===
15270 == title 2 ==
15271 === title 2.1 ===
15272 !! html
15273 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15274 <ul>
15275 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15276 <ul>
15277 <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>
15278 <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>
15279 </ul>
15280 </li>
15281 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15282 <ul>
15283 <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>
15284 </ul>
15285 </li>
15286 </ul>
15287 </div>
15288
15289 <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>
15290 <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>
15291 <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>
15292 <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>
15293 <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>
15294 <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>
15295
15296 !! end
15297
15298 !! test
15299 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15300 !! options
15301 wgMaxTocLevel=3
15302 !! wikitext
15303 ==Section 1==
15304 ===Section 1.1===
15305 ====Section 1.1.1====
15306 ====Section 1.1.1.1====
15307 ==Section 2==
15308 !! html
15309 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15310 <ul>
15311 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15312 <ul>
15313 <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>
15314 </ul>
15315 </li>
15316 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15317 </ul>
15318 </div>
15319
15320 <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>
15321 <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>
15322 <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>
15323 <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>
15324 <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>
15325
15326 !! end
15327
15328
15329 !! test
15330 Resolving duplicate section names
15331 !! wikitext
15332 == Foo bar ==
15333 == Foo bar ==
15334 !! html
15335 <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>
15336 <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>
15337
15338 !! end
15339
15340 !! test
15341 Resolving duplicate section names with differing case (bug 10721)
15342 !! wikitext
15343 == Foo bar ==
15344 == Foo Bar ==
15345 !! html
15346 <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>
15347 <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>
15348
15349 !! end
15350
15351 !! article
15352 Template:sections
15353 !! text
15354 ===Section 1===
15355 ==Section 2==
15356 !! endarticle
15357
15358 !! test
15359 Template with sections, __NOTOC__
15360 !! wikitext
15361 __NOTOC__
15362 ==Section 0==
15363 {{sections}}
15364 ==Section 4==
15365 !! html
15366 <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>
15367 <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>
15368 <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>
15369 <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>
15370
15371 !! end
15372
15373 !! test
15374 __NOEDITSECTION__ keyword
15375 !! wikitext
15376 __NOEDITSECTION__
15377 ==Section 1==
15378 ==Section 2==
15379 !! html
15380 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15381 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15382
15383 !! end
15384
15385 !! test
15386 Link inside a section heading
15387 !! wikitext
15388 ==Section with a [[Main Page|link]] in it==
15389 !! html
15390 <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>
15391
15392 !! end
15393
15394 !! test
15395 TOC regression (T14077)
15396 !! wikitext
15397 __TOC__
15398 == title 1 ==
15399 === title 1.1 ===
15400 == title 2 ==
15401 !! html
15402 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15403 <ul>
15404 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15405 <ul>
15406 <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>
15407 </ul>
15408 </li>
15409 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15410 </ul>
15411 </div>
15412
15413 <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>
15414 <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>
15415 <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>
15416
15417 !! end
15418
15419 !! test
15420 BUG 1219 URL next to image (good)
15421 !! wikitext
15422 http://example.com [[File:Foobar.jpg]]
15423 !! html/php
15424 <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>
15425 </p>
15426 !! html/parsoid
15427 <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>
15428 !!end
15429
15430 !! test
15431 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15432 !! wikitext
15433 ===
15434 The line above must have a trailing space!
15435 === <!--
15436 --> <!-- -->
15437 But just in case it doesn't...
15438 !! html
15439 <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>
15440 <p>The line above must have a trailing space!
15441 </p>
15442 <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>
15443 <p>But just in case it doesn't...
15444 </p>
15445 !! end
15446
15447 !! test
15448 Header with special characters (bug 25462)
15449 !! wikitext
15450 The tooltips shall not show entities to the user (ie. be double escaped)
15451
15452 == text > text ==
15453 section 1
15454
15455 == text < text ==
15456 section 2
15457
15458 == text & text ==
15459 section 3
15460
15461 == text ' text ==
15462 section 4
15463
15464 == text " text ==
15465 section 5
15466 !! html
15467 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15468 </p>
15469 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15470 <ul>
15471 <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>
15472 <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>
15473 <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>
15474 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15475 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15476 </ul>
15477 </div>
15478
15479 <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>
15480 <p>section 1
15481 </p>
15482 <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>
15483 <p>section 2
15484 </p>
15485 <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>
15486 <p>section 3
15487 </p>
15488 <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>
15489 <p>section 4
15490 </p>
15491 <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>
15492 <p>section 5
15493 </p>
15494 !! end
15495
15496 !! test
15497 Header with space, plus and underscore as entity
15498 !! wikitext
15499 Id should not contain + for spaces
15500
15501 == Space between Text ==
15502 section 1
15503
15504 == Space-Entity&#32;between&#32;Text ==
15505 section 2
15506
15507 == Plus+between+Text ==
15508 section 3
15509
15510 == Plus-Entity&#43;between&#43;Text ==
15511 section 4
15512
15513 == Underscore_between_Text ==
15514 section 5
15515
15516 == Underscore-Entity&#95;between&#95;Text ==
15517 section 6
15518
15519 [[#Space between Text]]
15520 [[#Space-Entity&#32;between&#32;Text]]
15521 [[#Plus+between+Text]]
15522 [[#Plus-Entity&#43;between&#43;Text]]
15523 [[#Underscore_between_Text]]
15524 [[#Underscore-Entity&#95;between&#95;Text]]
15525 !! html
15526 <p>Id should not contain + for spaces
15527 </p>
15528 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15529 <ul>
15530 <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>
15531 <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>
15532 <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>
15533 <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>
15534 <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>
15535 <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>
15536 </ul>
15537 </div>
15538
15539 <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>
15540 <p>section 1
15541 </p>
15542 <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>
15543 <p>section 2
15544 </p>
15545 <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>
15546 <p>section 3
15547 </p>
15548 <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>
15549 <p>section 4
15550 </p>
15551 <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>
15552 <p>section 5
15553 </p>
15554 <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>
15555 <p>section 6
15556 </p><p><a href="#Space_between_Text">#Space between Text</a>
15557 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15558 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15559 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15560 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15561 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15562 </p>
15563 !! end
15564
15565 !! test
15566 Headers with excess '=' characters
15567 (Are similar tests necessary beyond the 1st level?)
15568 !! wikitext
15569 =foo==
15570 ==foo=
15571 =''italic'' heading==
15572 ==''italic'' heading=
15573 !! html
15574 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15575 <ul>
15576 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15577 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15578 <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>
15579 <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>
15580 </ul>
15581 </div>
15582
15583 <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>
15584 <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>
15585 <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>
15586 <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>
15587
15588 !! end
15589
15590 !! test
15591 HTML headers vs TOC (bug 23393)
15592 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15593 !! wikitext
15594 <h1>Header 1</h1>
15595 == Header 1.1 ==
15596 == Header 1.2 ==
15597
15598 <h1>Header 2
15599 </h1>
15600 == Header 2.1 ==
15601 == Header 2.2 ==
15602 __NOEDITSECTION__
15603 !! html
15604 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15605 <ul>
15606 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15607 <ul>
15608 <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>
15609 <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>
15610 </ul>
15611 </li>
15612 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15613 <ul>
15614 <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>
15615 <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>
15616 </ul>
15617 </li>
15618 </ul>
15619 </div>
15620
15621 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15622 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15623 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15624 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15625 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15626 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15627
15628 !! end
15629
15630 !! test
15631 Single-line or multiline-comments can follow headings
15632 !! options
15633 parsoid=wt2html,wt2wt
15634 !! wikitext
15635 ==foo==<!---->
15636 ==bar==<!--c1-->
15637 ==baz==<!--
15638 c2
15639 c3-->
15640 !! html
15641 <h2><span class="mw-headline" id="foo">foo</span></h2>
15642 <h2><span class="mw-headline" id="bar">bar</span></h2>
15643 <h2><span class="mw-headline" id="baz">baz</span></h2>
15644
15645 !! end
15646
15647 !! test
15648 BUG 1219 URL next to image (broken)
15649 !! wikitext
15650 http://example.com[[File:Foobar.jpg]]
15651 !! html/php
15652 <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>
15653 </p>
15654 !! html/parsoid
15655 <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>
15656 !!end
15657
15658 !! test
15659 Bug 1186 news: in the middle of text
15660 !! wikitext
15661 http://en.wikinews.org/wiki/Wikinews:Workplace
15662 !! html
15663 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15664 </p>
15665 !!end
15666
15667
15668 !! test
15669 Namespaced link must have a title
15670 !! wikitext
15671 [[Project:]]
15672 !! html
15673 <p>[[Project:]]
15674 </p>
15675 !!end
15676
15677 !! test
15678 Namespaced link must have a title (bad fragment version)
15679 !! wikitext
15680 [[Project:#fragment]]
15681 !! html
15682 <p>[[Project:#fragment]]
15683 </p>
15684 !!end
15685
15686
15687 ###
15688 ### HTML tags and HTML attributes
15689 ###
15690
15691 !! test
15692 div with no attributes
15693 !! wikitext
15694 <div>HTML rocks</div>
15695 !! html
15696 <div>HTML rocks</div>
15697
15698 !! end
15699
15700 !! test
15701 div with double-quoted attribute
15702 !! wikitext
15703 <div id="rock">HTML rocks</div>
15704 !! html
15705 <div id="rock">HTML rocks</div>
15706
15707 !! end
15708
15709 !! test
15710 div with single-quoted attribute
15711 !! wikitext
15712 <div id='rock'>HTML rocks</div>
15713 !! html
15714 <div id="rock">HTML rocks</div>
15715
15716 !! end
15717
15718 !! test
15719 div with unquoted attribute
15720 !! wikitext
15721 <div id=rock>HTML rocks</div>
15722 !! html
15723 <div id="rock">HTML rocks</div>
15724
15725 !! end
15726
15727 !! test
15728 div with illegal double attributes
15729 !! wikitext
15730 <div id="a" id="b">HTML rocks</div>
15731 !! html
15732 <div id="b">HTML rocks</div>
15733
15734 !!end
15735
15736 !! test
15737 div with empty attribute value, space before equals
15738 !! options
15739 parsoid=wt2html,html2html
15740 !! wikitext
15741 <div class =>HTML rocks</div>
15742 !! html/php
15743 <div class="">HTML rocks</div>
15744
15745 !! html/parsoid
15746 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15747 !! end
15748
15749 !! test
15750 div with multiple empty attribute values
15751 !! options
15752 parsoid=wt2html,html2html
15753 !! wikitext
15754 <div id= title=>HTML rocks</div>
15755 !! html/php
15756 <div id="title.3D">HTML rocks</div>
15757
15758 !! html/parsoid
15759 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15760 !! end
15761
15762 !! test
15763 table with multiple empty attribute values
15764 !! options
15765 parsoid=wt2html,html2html
15766 !! wikitext
15767 {| title= id=
15768 | hi
15769 |}
15770 !! html/php
15771 <table title="id=">
15772 <tr>
15773 <td> hi
15774 </td></tr></table>
15775
15776 !! html/parsoid
15777 <table title="id=">
15778 <tbody><tr><td> hi</td></tr>
15779 </tbody></table>
15780 !! end
15781
15782 !! test
15783 div with braces in attribute value
15784 !! wikitext
15785 <div title="{}">Foo</div>
15786 !! html/php
15787 <div title="&#123;}">Foo</div>
15788
15789 !! html/parsoid
15790 <div title="{}">Foo</div>
15791 !! end
15792
15793 !! test
15794 div with empty attribute value, no space before equals
15795 !! options
15796 parsoid=wt2html,html2html
15797 !! wikitext
15798 <div class=>HTML rocks</div>
15799 !! html/php
15800 <div class="">HTML rocks</div>
15801
15802 !! html/parsoid
15803 <div class="">HTML rocks</div>
15804 !! end
15805
15806 !! test
15807 HTML multiple attributes correction
15808 !! wikitext
15809 <p class="error" class="awesome">Awesome!</p>
15810 !! html
15811 <p class="awesome">Awesome!</p>
15812
15813 !!end
15814
15815 !! test
15816 Table multiple attributes correction
15817 !! wikitext
15818 {|
15819 !+ class="error" class="awesome"| status
15820 |}
15821 !! html
15822 <table>
15823 <tr>
15824 <th class="awesome"> status
15825 </th></tr></table>
15826
15827 !!end
15828
15829 !! test
15830 DIV IN UPPERCASE
15831 !! wikitext
15832 <DIV ID="x">HTML ROCKS</DIV>
15833 !! html
15834 <div id="x">HTML ROCKS</div>
15835
15836 !!end
15837
15838 !! test
15839 Non-ASCII pseudo-tags are rendered as text
15840 !! wikitext
15841 <khyô>
15842 !! html
15843 <p>&lt;khyô&gt;
15844 </p>
15845 !! end
15846
15847 !! test
15848 Pseudo-tag with URL 'name' renders as url link
15849 !! wikitext
15850 <http://example.com/>
15851 !! html
15852 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15853 </p>
15854 !! end
15855
15856 !! test
15857 text with amp in the middle of nowhere
15858 !! wikitext
15859 Remember AT&T?
15860 !! html
15861 <p>Remember AT&amp;T?
15862 </p>
15863 !! end
15864
15865 !! test
15866 text with character entity: eacute
15867 !! wikitext
15868 I always thought &eacute; was a cute letter.
15869 !! html
15870 <p>I always thought &#233; was a cute letter.
15871 </p>
15872 !! html+tidy
15873 <p>I always thought é was a cute letter.</p>
15874 !! end
15875
15876 !! test
15877 text with entity-escaped character entity-like string: eacute
15878 !! wikitext
15879 I always thought &amp;eacute; was a cute letter.
15880 !! html
15881 <p>I always thought &amp;eacute; was a cute letter.
15882 </p>
15883 !! end
15884
15885 !! test
15886 text with undefined character entity: xacute
15887 !! wikitext
15888 I always thought &xacute; was a cute letter.
15889 !! html
15890 <p>I always thought &amp;xacute; was a cute letter.
15891 </p>
15892 !! end
15893
15894 !! test
15895 HTML5 tags
15896 !! wikitext
15897 <data value="5">five</data>
15898 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15899 <mark>This highlighted text</mark>
15900 !! html
15901 <p><data value="5">five</data>
15902 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15903 <mark>This highlighted text</mark>
15904 </p>
15905 !! end
15906
15907 !! test
15908 HTML tag with leading space is parsed as text
15909 !! wikitext
15910 < div>foo< /div>
15911 !! html
15912 <p>&lt; div&gt;foo&lt; /div&gt;
15913 </p>
15914 !! end
15915
15916 ###
15917 ### Nesting tests (see bug 41545, 50604, 51081)
15918 ###
15919
15920 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15921 # Note that html2wt is considerably more difficult if we use <b> in
15922 # the test case, instead of <big>
15923 !! test
15924 Ensure that HTML adoption agency algorithm is properly implemented.
15925 !! wikitext
15926 <big>X<big>Y</big>Z</big>
15927 !! html
15928 <p><big>X<big>Y</big>Z</big>
15929 </p>
15930 !! end
15931
15932 # This was bug 41545 in the PHP parser.
15933 # Note that tidy doesn't handle this correctly.
15934 !! test
15935 Nesting of <kbd>
15936 !! wikitext
15937 <kbd>X<kbd>Y</kbd>Z</kbd>
15938 !! html
15939 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15940 </p>
15941 !! end
15942
15943 # The following cases were bug 51081 in the PHP parser.
15944 # Note that there are some other nestable tags (b, i, etc) which are
15945 # not covered; see bug 51081 for discussion.
15946
15947 # Note that tidy doesn't handle this correctly.
15948 !! test
15949 Nesting of <em>
15950 !! wikitext
15951 <em>X<em>Y</em>Z</em>
15952 !! html
15953 <p><em>X<em>Y</em>Z</em>
15954 </p>
15955 !! end
15956
15957 # Note that tidy doesn't handle this correctly.
15958 !! test
15959 Nesting of <strong>
15960 !! wikitext
15961 <strong>X<strong>Y</strong>Z</strong>
15962 !! html
15963 <p><strong>X<strong>Y</strong>Z</strong>
15964 </p>
15965 !! end
15966
15967 !! test
15968 Nesting of <q>
15969 !! wikitext
15970 <q>X<q>Y</q>Z</q>
15971 !! html+tidy
15972 <p><q>X<q>Y</q>Z</q></p>
15973 !! end
15974
15975 # Note that tidy doesn't handle this correctly.
15976 !! test
15977 Nesting of <ruby>
15978 !! wikitext
15979 <ruby>X<ruby>Y</ruby>Z</ruby>
15980 !! html
15981 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15982 </p>
15983 !! end
15984
15985 # Note that tidy doesn't handle this correctly.
15986 !! test
15987 Nesting of <bdo>
15988 !! wikitext
15989 <bdo>X<bdo>Y</bdo>Z</bdo>
15990 !! html
15991 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15992 </p>
15993 !! end
15994
15995
15996 ###
15997 ### Media links
15998 ###
15999
16000 !! test
16001 Media link
16002 !! wikitext
16003 [[Media:Foobar.jpg]]
16004 !! html
16005 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16006 </p>
16007 !! end
16008
16009 !! test
16010 Media link with text
16011 !! wikitext
16012 [[Media:Foobar.jpg|A neat file to look at]]
16013 !! html
16014 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16015 </p>
16016 !! end
16017
16018 # FIXME: this is still bad HTML tag nesting
16019 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16020 !! test
16021 Media link with nasty text
16022 !! wikitext
16023 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16024 !! html
16025 <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>
16026
16027 !! html+tidy
16028 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16029 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16030 !! end
16031
16032 !! test
16033 Media link to nonexistent file (bug 1702)
16034 !! wikitext
16035 [[Media:No such.jpg]]
16036 !! html
16037 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16038 </p>
16039 !! end
16040
16041 !! test
16042 Image link to nonexistent file (bug 1850 - good)
16043 !! wikitext
16044 [[File:No_such.jpg]]
16045 !! html/php
16046 <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>
16047 </p>
16048 !! html/parsoid
16049 <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>
16050 !! end
16051
16052 !! test
16053 :Image link to nonexistent file (bug 1850 - bad)
16054 !! wikitext
16055 [[:Image:No such.jpg]]
16056 !! html/php
16057 <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>
16058 </p>
16059 !! html/parsoid
16060 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16061 !! end
16062
16063
16064
16065 !! test
16066 Character reference normalization in link text (bug 1938)
16067 !! wikitext
16068 [[Main Page|this&that]]
16069 !! html
16070 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16071 </p>
16072 !!end
16073
16074 !! article
16075 אַ
16076 !! text
16077 Test for unicode normalization
16078
16079 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16080 !! endarticle
16081
16082 !! test
16083 (bug 19451) Links should refer to the normalized form.
16084 !! wikitext
16085 [[&#xFB2E;]]
16086 [[&#x5d0;&#x5b7;]]
16087 [[&#x5d0;ַ]]
16088 [[א&#x5b7;]]
16089 [[אַ]]
16090 !! html
16091 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16092 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16093 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16094 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16095 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16096 </p>
16097 !! end
16098
16099 !! test
16100 Empty attribute crash test (bug 2067)
16101 !! wikitext
16102 <font color="">foo</font>
16103 !! html
16104 <p><font color="">foo</font>
16105 </p>
16106 !! end
16107
16108 !! test
16109 Empty attribute crash test single-quotes (bug 2067)
16110 !! wikitext
16111 <font color=''>foo</font>
16112 !! html
16113 <p><font color="">foo</font>
16114 </p>
16115 !! end
16116
16117 !! test
16118 Attribute test: equals, then nothing
16119 !! options
16120 parsoid=wt2html,html2html
16121 !! wikitext
16122 <font color=>foo</font>
16123 !! html/php
16124 <p><font color="">foo</font>
16125 </p>
16126 !! html/parsoid
16127 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16128 !! end
16129
16130 !! test
16131 Attribute test: unquoted value
16132 !! options
16133 parsoid=wt2html,html2html
16134 !! wikitext
16135 <font color=x>foo</font>
16136 !! html/php
16137 <p><font color="x">foo</font>
16138 </p>
16139 !! html/parsoid
16140 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16141 !! end
16142
16143 !! test
16144 Attribute test: unquoted but illegal value (hash)
16145 !! wikitext
16146 <font color=#x>foo</font>
16147 !! html
16148 <p><font color="#x">foo</font>
16149 </p>
16150 !! end
16151
16152 # Parsoid does not serialize to empty attribute syntax,
16153 # so wt2wt and html2wt cases are skipped
16154 !! test
16155 Attribute test: no value (T54330)
16156 !! options
16157 parsoid=wt2html,html2html
16158 !! wikitext
16159 <font color>foo</font>
16160 !! html/php
16161 <p><font color="">foo</font>
16162 </p>
16163 !! html/parsoid
16164 <p><font color="">foo</font></p>
16165 !! end
16166
16167 !! test
16168 Bug 2095: link with three closing brackets
16169 !! wikitext
16170 [[Main Page]]]
16171 !! html/php
16172 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16173 </p>
16174 !! html/parsoid
16175 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16176 !! end
16177
16178 !! test
16179 Bug 2095: link with pipe and three closing brackets
16180 !! wikitext
16181 [[Main Page|link]]]
16182 !! html/php
16183 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16184 </p>
16185 !! html/parsoid
16186 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16187 !! end
16188
16189 !! test
16190 Bug 2095: link with pipe and three closing brackets, version 2
16191 !! wikitext
16192 [[Main Page|[http://example.com/]]]
16193 !! html/php
16194 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16195 </p>
16196 !! html/parsoid
16197 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16198 !! end
16199
16200
16201 ###
16202 ### Safety
16203 ###
16204
16205 !! article
16206 Template:Dangerous attribute
16207 !! text
16208 " onmouseover="alert(document.cookie)
16209 !! endarticle
16210
16211 !! article
16212 Template:Dangerous style attribute
16213 !! text
16214 border-size: expression(alert(document.cookie))
16215 !! endarticle
16216
16217 !! article
16218 Template:Div style
16219 !! text
16220 <div style="float: right; {{{1}}}">Magic div</div>
16221 !! endarticle
16222
16223 !! test
16224 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16225 !! wikitext
16226 <div title="{{test}}"></div>
16227 !! html
16228 <div title="This is a test template"></div>
16229
16230 !! end
16231
16232 # Parsoid has enough context to handle this case
16233 !! test
16234 Bug 2304: HTML attribute safety (dangerous template; 2309)
16235 !! wikitext
16236 <div title="{{dangerous attribute}}"></div>
16237 !! html/php
16238 <div title=""></div>
16239
16240 !! html/parsoid
16241 <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>
16242 !! end
16243
16244 !! test
16245 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16246 !! wikitext
16247 <div style="{{dangerous style attribute}}"></div>
16248 !! html
16249 <div style="/* insecure input */"></div>
16250
16251 !! end
16252
16253 !! test
16254 Bug 2304: HTML attribute safety (safe parameter; 2309)
16255 !! wikitext
16256 {{div style|width: 200px}}
16257 !! html
16258 <div style="float: right; width: 200px">Magic div</div>
16259
16260 !! end
16261
16262 !! test
16263 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16264 !! wikitext
16265 {{div style|width: expression(alert(document.cookie))}}
16266 !! html
16267 <div style="/* insecure input */">Magic div</div>
16268
16269 !! end
16270
16271 !! test
16272 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16273 !! wikitext
16274 {{div style|"><script>alert(document.cookie)</script>}}
16275 !! html
16276 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16277
16278 !! end
16279
16280 !! test
16281 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16282 !! wikitext
16283 {{div style|" ><script>alert(document.cookie)</script>}}
16284 !! html
16285 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16286
16287 !! end
16288
16289 !! test
16290 Bug 2304: HTML attribute safety (link)
16291 !! wikitext
16292 <div title="[[Main Page]]"></div>
16293 !! html
16294 <div title="&#91;&#91;Main Page]]"></div>
16295
16296 !! end
16297
16298 !! test
16299 Bug 2304: HTML attribute safety (italics)
16300 !! wikitext
16301 <div title="''foobar''"></div>
16302 !! html
16303 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16304
16305 !! end
16306
16307 !! test
16308 Bug 2304: HTML attribute safety (bold)
16309 !! wikitext
16310 <div title="'''foobar'''"></div>
16311 !! html
16312 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16313
16314 !! end
16315
16316
16317 !! test
16318 Bug 2304: HTML attribute safety (ISBN)
16319 !! wikitext
16320 <div title="ISBN 1234567890"></div>
16321 !! html
16322 <div title="&#73;SBN 1234567890"></div>
16323
16324 !! end
16325
16326 !! test
16327 Bug 2304: HTML attribute safety (RFC)
16328 !! wikitext
16329 <div title="RFC 1234"></div>
16330 !! html
16331 <div title="&#82;FC 1234"></div>
16332
16333 !! end
16334
16335 !! test
16336 Bug 2304: HTML attribute safety (PMID)
16337 !! wikitext
16338 <div title="PMID 1234567890"></div>
16339 !! html
16340 <div title="&#80;MID 1234567890"></div>
16341
16342 !! end
16343
16344 !! test
16345 Bug 2304: HTML attribute safety (web link)
16346 !! wikitext
16347 <div title="http://example.com/"></div>
16348 !! html
16349 <div title="http&#58;//example.com/"></div>
16350
16351 !! end
16352
16353 !! test
16354 Bug 2304: HTML attribute safety (named web link)
16355 !! wikitext
16356 <div title="[http://example.com/ link]"></div>
16357 !! html
16358 <div title="&#91;http&#58;//example.com/ link]"></div>
16359
16360 !! end
16361
16362 !! test
16363 Bug 3244: HTML attribute safety (extension; safe)
16364 !! wikitext
16365 <div style="<nowiki>background:blue</nowiki>"></div>
16366 !! html
16367 <div style="background:blue"></div>
16368
16369 !! end
16370
16371 !! test
16372 Bug 3244: HTML attribute safety (extension; unsafe)
16373 !! wikitext
16374 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16375 !! html
16376 <div style="/* insecure input */"></div>
16377
16378 !! end
16379
16380 # More MSIE fun discovered by Tom Gilder
16381
16382 !! test
16383 MSIE CSS safety test: spurious slash
16384 !! wikitext
16385 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16386 !! html
16387 <div style="/* insecure input */">evil</div>
16388
16389 !! end
16390
16391 !! test
16392 MSIE CSS safety test: hex code
16393 !! wikitext
16394 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16395 !! html
16396 <div style="/* insecure input */">evil</div>
16397
16398 !! end
16399
16400 !! test
16401 MSIE CSS safety test: comment in url
16402 !! wikitext
16403 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16404 !! html
16405 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16406
16407 !! end
16408
16409 !! test
16410 MSIE CSS safety test: comment in expression
16411 !! wikitext
16412 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16413 !! html
16414 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16415
16416 !! end
16417
16418 !! test
16419 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16420 !! wikitext
16421 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16422 !! html
16423 <p style="/* invalid control char */">A</p>
16424
16425 !! end
16426
16427 !! test
16428 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16429 !! wikitext
16430 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16431 <div style="top:EXPRESSION(alert())">B</div>
16432 !! html
16433 <p style="/* insecure input */">A</p>
16434 <div style="/* insecure input */">B</div>
16435
16436 !! end
16437
16438 !! test
16439 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16440 !! wikitext
16441 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16442 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16443 !! html
16444 <div style="/* insecure input */">A</div>
16445 <p style="/* insecure input */">B</p>
16446
16447 !! end
16448
16449 !! test
16450 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16451 !! wikitext
16452 <div style="background-image:url⁽javascript:alert())">A</div>
16453 <div style="background-image:url₍javascript:alert())">B</div>
16454 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16455 !! html
16456 <div style="/* insecure input */">A</div>
16457 <div style="/* insecure input */">B</div>
16458 <p style="/* insecure input */">C</p>
16459
16460 !! end
16461
16462 # FIXME: Parsoid fails to sanitize this! See T58846.
16463 !! test
16464 Opera -o-link CSS
16465 !! wikitext
16466 <div
16467 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;"
16468 style="-o-link:attr(title);-o-link-source:current">X</div>
16469 !! html
16470 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16471
16472 !! end
16473
16474 !! test
16475 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16476 !! wikitext
16477 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16478 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16479 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16480 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16481 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16482 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16483 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16484 !! html
16485 <p style="/* insecure input */">A</p>
16486 <p style="/* insecure input */">B</p>
16487 <p style="/* insecure input */">C</p>
16488 <p style="/* insecure input */">D</p>
16489 <p style="/* insecure input */">E</p>
16490 <p style="/* insecure input */">F</p>
16491 <p style="/* insecure input */">G</p>
16492
16493 !! end
16494
16495 !! test
16496 Table attribute legitimate extension
16497 !! wikitext
16498 {|
16499 !+ style="<nowiki>color:blue</nowiki>"| status
16500 |}
16501 !! html
16502 <table>
16503 <tr>
16504 <th style="color:blue"> status
16505 </th></tr></table>
16506
16507 !!end
16508
16509 !! test
16510 Table attribute safety
16511 !! wikitext
16512 {|
16513 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16514 |}
16515 !! html
16516 <table>
16517 <tr>
16518 <th style="/* insecure input */"> status
16519 </th></tr></table>
16520
16521 !! end
16522
16523 !! test
16524 CSS line continuation 1
16525 !! wikitext
16526 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16527 !! html
16528 <div style="/* insecure input */"></div>
16529
16530 !! end
16531
16532 !! test
16533 CSS line continuation 2
16534 !! wikitext
16535 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16536 !! html
16537 <div style="/* invalid control char */"></div>
16538
16539 !! end
16540
16541 !! article
16542 Template:Identity
16543 !! text
16544 {{{1}}}
16545 !! endarticle
16546
16547 !! test
16548 Expansion of multi-line templates in attribute values (bug 6255)
16549 !! wikitext
16550 <div style="background: {{identity|#00FF00}}">-</div>
16551 !! html
16552 <div style="background: #00FF00">-</div>
16553
16554 !! end
16555
16556
16557 !! test
16558 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16559 !! wikitext
16560 <div style="background:
16561 #00FF00">-</div>
16562 !! html/php
16563 <div style="background: #00FF00">-</div>
16564
16565 !! html/parsoid
16566 <div style="background:
16567 #00FF00">-</div>
16568 !! end
16569
16570 !! test
16571 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16572 !! wikitext
16573 <div style="background: &#10;#00FF00">-</div>
16574 !! html
16575 <div style="background: &#10;#00FF00">-</div>
16576
16577 !! end
16578
16579 !! test
16580 evil <math>-wiki-tags without Extension:Math enabled
16581 !! wikitext
16582 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16583 !! html+tidy
16584 <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>
16585 !! end
16586
16587 ###
16588 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16589 ###
16590 !! test
16591 Parser hook: empty input
16592 !! wikitext
16593 <tag></tag>
16594 !! html/php
16595 <pre>
16596 ''
16597 array (
16598 )
16599 </pre>
16600
16601 !! html/parsoid
16602 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16603 !! end
16604
16605 ## Don't expect parsoid to rt this form.
16606 !! test
16607 Parser hook: empty input using terminated empty elements
16608 !! options
16609 parsoid=wt2html,html2html
16610 !! wikitext
16611 <tag/>
16612 !! html/php
16613 <pre>
16614 NULL
16615 array (
16616 )
16617 </pre>
16618
16619 !! html/parsoid
16620 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16621 !! end
16622
16623 !! test
16624 Parser hook: empty input using terminated empty elements (space before)
16625 !! wikitext
16626 <tag />
16627 !! html/php
16628 <pre>
16629 NULL
16630 array (
16631 )
16632 </pre>
16633
16634 !! html/parsoid
16635 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16636 !! end
16637
16638 !! test
16639 Parser hook: basic input
16640 !! wikitext
16641 <tag>input</tag>
16642 !! html/php
16643 <pre>
16644 'input'
16645 array (
16646 )
16647 </pre>
16648
16649 !! html/parsoid
16650 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16651 !! end
16652
16653 ## Don't expect parsoid to rt this form.
16654 !! test
16655 Parser hook: case insensitive
16656 !! options
16657 parsoid=wt2html,html2html
16658 !! wikitext
16659 <TAG>input</TAG>
16660 !! html/php
16661 <pre>
16662 'input'
16663 array (
16664 )
16665 </pre>
16666
16667 !! html/parsoid
16668 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16669 !! end
16670
16671 ## Don't expect parsoid to rt this form.
16672 !! test
16673 Parser hook: case insensitive, redux
16674 !! options
16675 parsoid=wt2html,html2html
16676 !! wikitext
16677 <TaG>input</TAg>
16678 !! html/php
16679 <pre>
16680 'input'
16681 array (
16682 )
16683 </pre>
16684
16685 !! html/parsoid
16686 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16687 !! end
16688
16689 !! test
16690 Parser hook: nested tags
16691 !! wikitext
16692 <tag><tag></tag></tag>
16693 !! html/php
16694 <pre>
16695 '<tag>'
16696 array (
16697 )
16698 </pre>&lt;/tag&gt;
16699
16700 !! html/parsoid
16701 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16702 !! end
16703
16704 !! test
16705 Parser hook: basic arguments
16706 !! wikitext
16707 <tag width="200" height="100" depth="50" square=""></tag>
16708 !! html/php
16709 <pre>
16710 ''
16711 array (
16712 'width' => '200',
16713 'height' => '100',
16714 'depth' => '50',
16715 'square' => '',
16716 )
16717 </pre>
16718
16719 !! html/parsoid
16720 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16721 !! end
16722
16723 ## Don't expect parsoid to rt this form.
16724 !! test
16725 Parser hook: basic arguments, variations
16726 !! options
16727 parsoid=wt2html,html2html
16728 !! wikitext
16729 <tag width=200 height = "100" depth = '50' square></tag>
16730 !! html/php
16731 <pre>
16732 ''
16733 array (
16734 'width' => '200',
16735 'height' => '100',
16736 'depth' => '50',
16737 'square' => '',
16738 )
16739 </pre>
16740
16741 !! html/parsoid
16742 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16743 !! end
16744
16745 !! test
16746 Parser hook: argument containing a forward slash (bug 5344)
16747 !! wikitext
16748 <tag filename="/tmp/bla"></tag>
16749 !! html/php
16750 <pre>
16751 ''
16752 array (
16753 'filename' => '/tmp/bla',
16754 )
16755 </pre>
16756
16757 !! html/parsoid
16758 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16759 !! end
16760
16761 ## Don't expect parsoid to rt this form.
16762 !! test
16763 Parser hook: empty input using terminated empty elements (bug 2374)
16764 !! options
16765 parsoid=wt2html,html2html
16766 !! wikitext
16767 <tag foo=bar/>text
16768 !! html/php
16769 <pre>
16770 NULL
16771 array (
16772 'foo' => 'bar',
16773 )
16774 </pre>text
16775
16776 !! html/parsoid
16777 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16778 !! end
16779
16780 ## </tag> should be output literally since there is no matching tag that begins it
16781 ## Don't expect parsoid to rt this form.
16782 !! test
16783 Parser hook: basic arguments using terminated empty elements (bug 2374)
16784 !! options
16785 parsoid=wt2html
16786 !! wikitext
16787 <tag width=200 height = "100" depth = '50' square/>
16788 other stuff
16789 </tag>
16790 !! html/php
16791 <pre>
16792 NULL
16793 array (
16794 'width' => '200',
16795 'height' => '100',
16796 'depth' => '50',
16797 'square' => '',
16798 )
16799 </pre>
16800 <p>other stuff
16801 &lt;/tag&gt;
16802 </p>
16803 !! html/parsoid
16804 <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
16805 &lt;/tag></p>
16806 !! end
16807
16808 ## Don't expect parsoid to rt this form.
16809 !! test
16810 Parser hook: Don't allow unclosed extension tags
16811 !! options
16812 parsoid=wt2html
16813 !! wikitext
16814 test <tag>123
16815
16816 this is a '''test'''
16817 !! html/php
16818 <p>test &lt;tag&gt;123
16819 </p><p>this is a <b>test</b>
16820 </p>
16821 !! html/parsoid
16822 <p>test &lt;tag>123</p>
16823
16824 <p>this is a <b>test</b></p>
16825 !! end
16826
16827 ###
16828 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16829 ###
16830
16831 !! test
16832 Parser hook: static parser hook not inside a comment
16833 !! wikitext
16834 <statictag>hello, world</statictag>
16835
16836 <statictag action="flush" />
16837 !! html/php
16838 <p><br />
16839 hello, world
16840 </p>
16841 !! html/parsoid
16842 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16843 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16844 !! end
16845
16846 !! test
16847 Parser hook: static parser hook inside a comment
16848 !! wikitext
16849 <!-- <statictag>hello, world</statictag> -->
16850 <statictag action="flush" />
16851 !! html/php
16852 <p><br />
16853 </p>
16854 !! html/parsoid
16855 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16856 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16857 !! end
16858
16859 # Nested template calls; this case was broken by Parser.php rev 1.506,
16860 # since reverted.
16861
16862 !! article
16863 Template:One-parameter
16864 !! text
16865 (My parameter is: {{{1}}})
16866 !! endarticle
16867
16868 !! article
16869 Template:Map-one-parameter
16870 !! text
16871 {{{{{1}}}|{{{2}}}}}
16872 !! endarticle
16873
16874 !! test
16875 Nested template calls
16876 !! wikitext
16877 {{Map-one-parameter|One-parameter|param}}
16878 !! html
16879 <p>(My parameter is: param)
16880 </p>
16881 !! end
16882
16883
16884 ###
16885 ### Sanitizer
16886 ###
16887
16888 # HTML+Tidy effectively strips out the empty tags completely
16889 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16890 # which Tidy would have done for the PHP parser had there been content inside it.
16891 !! test
16892 Sanitizer: Closing of open tags
16893 !! wikitext
16894 <s></s><table></table>
16895 !! html
16896 <s></s><table></table>
16897
16898 !! html/parsoid
16899 <p><s></s></p><table></table>
16900 !! end
16901
16902 !! test
16903 Sanitizer: Closing of open but not closed tags
16904 !! wikitext
16905 <s>foo
16906 !! html
16907 <p><s>foo</s>
16908 </p>
16909 !! end
16910
16911 !! test
16912 Sanitizer: Closing of closed but not open tags
16913 !! options
16914 parsoid=wt2html
16915 !! wikitext
16916 </s>
16917 !! html/php+tidy
16918 !! html/parsoid
16919 !! end
16920
16921 !! test
16922 Sanitizer: Closing of closed but not open table tags
16923 !! options
16924 parsoid=wt2html
16925 !! wikitext
16926 Table not started</td></tr></table>
16927 !! html/php+tidy
16928 <p>Table not started</p>
16929 !! html/parsoid
16930 <p>Table not started</p>
16931 !! end
16932
16933 !! test
16934 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16935 !! wikitext
16936 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16937 !! html
16938 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16939 </p>
16940 !! end
16941
16942 # In HTML5, the restrictions are that id must contain at least one character,
16943 # and must not contain any space characters.
16944 !! test
16945 Sanitizer: Validating the contents of the id attribute (bug 4515)
16946 !! options
16947 disabled
16948 !! wikitext
16949 <br id="" /><br id="a space" />
16950 !! html
16951 Something ...
16952 !! end
16953
16954 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16955 !! test
16956 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16957 !! options
16958 disabled
16959 !! wikitext
16960 <br id="foo" /><br id="foo" />
16961 !! html
16962 Something need to be done. foo-2 ?
16963 !! end
16964
16965 !! test
16966 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16967 !! wikitext
16968 <div itemscope>
16969 <meta itemprop="hello" content="world">
16970 <meta http-equiv="refresh" content="5">
16971 <meta itemprop="hello" http-equiv="refresh" content="5">
16972 <link itemprop="hello" href="{{SERVER}}">
16973 <link rel="stylesheet" href="{{SERVER}}">
16974 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16975 </div>
16976 !! html
16977 <div itemscope="">
16978 <p> <meta itemprop="hello" content="world" />
16979 &lt;meta http-equiv="refresh" content="5"&gt;
16980 <meta itemprop="hello" content="5" />
16981 </p>
16982 <link itemprop="hello" href="http&#58;//example.org" />
16983 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16984 <link itemprop="hello" href="http&#58;//example.org" />
16985 </div>
16986
16987 !! end
16988
16989 !! test
16990 Language converter: output gets cut off unexpectedly (bug 5757)
16991 !! options
16992 language=zh
16993 !! wikitext
16994 this bit is safe: }-
16995
16996 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16997
16998 then we get cut off here: }-
16999
17000 all additional text is vanished
17001 !! html
17002 <p>this bit is safe: }-
17003 </p><p>but if we add a conversion instance: xxx
17004 </p><p>then we get cut off here: }-
17005 </p><p>all additional text is vanished
17006 </p>
17007 !! end
17008
17009 !! test
17010 Self closed html pairs (bug 5487)
17011 !! options
17012 !! wikitext
17013 <center><font id="bug" />Centered text</center>
17014 <div><font id="bug2" />In div text</div>
17015 !! html
17016 <center>&lt;font id="bug" /&gt;Centered text</center>
17017 <div>&lt;font id="bug2" /&gt;In div text</div>
17018
17019 !! end
17020
17021 #
17022 #
17023 #
17024
17025 !! test
17026 Punctuation: nbsp before exclamation
17027 !! wikitext
17028 C'est grave !
17029 !! html
17030 <p>C'est grave&#160;!
17031 </p>
17032 !! end
17033
17034 !! test
17035 Punctuation: CSS !important (bug 11874)
17036 !! wikitext
17037 <div style="width:50% !important">important</div>
17038 !! html
17039 <div style="width:50% !important">important</div>
17040
17041 !!end
17042
17043 !! test
17044 Punctuation: CSS ! important (bug 11874; with space after)
17045 !! wikitext
17046 <div style="width:50% ! important">important</div>
17047 !! html
17048 <div style="width:50% ! important">important</div>
17049
17050 !!end
17051
17052 !! test
17053 HTML bullet list, closed tags (bug 5497)
17054 !! wikitext
17055 <ul>
17056 <li>One</li>
17057 <li>Two</li>
17058 </ul>
17059 !! html/php
17060 <ul>
17061 <li>One</li>
17062 <li>Two</li>
17063 </ul>
17064
17065 !! html/parsoid
17066 <ul data-parsoid='{"stx":"html"}'>
17067 <li data-parsoid='{"stx":"html"}'>One</li>
17068 <li data-parsoid='{"stx":"html"}'>Two</li>
17069 </ul>
17070
17071 !! end
17072
17073 !! test
17074 HTML bullet list, unclosed tags (bug 5497)
17075 !! wikitext
17076 <ul>
17077 <li>One
17078 <li>Two
17079 </ul>
17080 !! html/php+tidy
17081 <ul>
17082 <li>One</li>
17083 <li>Two</li>
17084 </ul>
17085 !! html/parsoid
17086 <ul data-parsoid='{"stx":"html"}'>
17087 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17088 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17089 </ul>
17090
17091 !! end
17092
17093 !! test
17094 HTML ordered list, closed tags (bug 5497)
17095 !! wikitext
17096 <ol>
17097 <li>One</li>
17098 <li>Two</li>
17099 </ol>
17100 !! html/php
17101 <ol>
17102 <li>One</li>
17103 <li>Two</li>
17104 </ol>
17105
17106 !! html/parsoid
17107 <ol data-parsoid='{"stx":"html"}'>
17108 <li data-parsoid='{"stx":"html"}'>One</li>
17109 <li data-parsoid='{"stx":"html"}'>Two</li>
17110 </ol>
17111
17112 !! end
17113
17114 !! test
17115 HTML ordered list, unclosed tags (bug 5497)
17116 !! options
17117 !! wikitext
17118 <ol>
17119 <li>One
17120 <li>Two
17121 </ol>
17122 !! html/php+tidy
17123 <ol>
17124 <li>One</li>
17125 <li>Two</li>
17126 </ol>
17127 !! html/parsoid
17128 <ol data-parsoid='{"stx":"html"}'>
17129 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17130 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17131 </ol>
17132
17133 !! end
17134
17135 !! test
17136 HTML nested bullet list, closed tags (bug 5497)
17137 !! wikitext
17138 <ul>
17139 <li>One</li>
17140 <li>Two:
17141 <ul>
17142 <li>Sub-one</li>
17143 <li>Sub-two</li>
17144 </ul>
17145 </li>
17146 </ul>
17147 !! html/php
17148 <ul>
17149 <li>One</li>
17150 <li>Two:
17151 <ul>
17152 <li>Sub-one</li>
17153 <li>Sub-two</li>
17154 </ul>
17155 </li>
17156 </ul>
17157
17158 !! html/parsoid
17159 <ul data-parsoid='{"stx":"html"}'>
17160 <li data-parsoid='{"stx":"html"}'>One</li>
17161 <li data-parsoid='{"stx":"html"}'>Two:
17162 <ul data-parsoid='{"stx":"html"}'>
17163 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17164 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17165 </ul>
17166 </li>
17167 </ul>
17168 !! end
17169
17170 !! test
17171 HTML nested bullet list, open tags (bug 5497)
17172 !! wikitext
17173 <ul>
17174 <li>One
17175 <li>Two:
17176 <ul>
17177 <li>Sub-one
17178 <li>Sub-two
17179 </ul>
17180 </ul>
17181 !! html/php+tidy
17182 <ul>
17183 <li>One</li>
17184 <li>Two:
17185 <ul>
17186 <li>Sub-one</li>
17187 <li>Sub-two</li>
17188 </ul>
17189 </li>
17190 </ul>
17191 !! html/parsoid
17192 <ul>
17193 <li>One
17194 </li>
17195 <li>Two:
17196 <ul>
17197 <li>Sub-one
17198 </li>
17199 <li>Sub-two
17200 </li>
17201 </ul>
17202 </li>
17203 </ul>
17204
17205 !! end
17206
17207 !! test
17208 HTML nested ordered list, closed tags (bug 5497)
17209 !! wikitext
17210 <ol>
17211 <li>One</li>
17212 <li>Two:
17213 <ol>
17214 <li>Sub-one</li>
17215 <li>Sub-two</li>
17216 </ol>
17217 </li>
17218 </ol>
17219 !! html
17220 <ol>
17221 <li>One</li>
17222 <li>Two:
17223 <ol>
17224 <li>Sub-one</li>
17225 <li>Sub-two</li>
17226 </ol>
17227 </li>
17228 </ol>
17229
17230 !! end
17231
17232 !! test
17233 HTML nested ordered list, open tags (bug 5497)
17234 !! wikitext
17235 <ol>
17236 <li>One
17237 <li>Two:
17238 <ol>
17239 <li>Sub-one
17240 <li>Sub-two
17241 </ol>
17242 </ol>
17243 !! html/php
17244 <ol>
17245 <li>One
17246 <li>Two:
17247 <ol>
17248 <li>Sub-one
17249 <li>Sub-two
17250 </ol>
17251 </ol>
17252
17253 !! html/parsoid
17254 <ol>
17255 <li>One
17256 </li>
17257 <li>Two:
17258 <ol>
17259 <li>Sub-one
17260 </li>
17261 <li>Sub-two
17262 </li>
17263 </ol>
17264 </li>
17265 </ol>
17266
17267 !! end
17268
17269 !! test
17270 HTML ordered list item with parameters oddity
17271 !! wikitext
17272 <ol><li id="fragment">One</li>
17273 </ol>
17274 !! html
17275 <ol><li id="fragment">One</li>
17276 </ol>
17277
17278 !! end
17279
17280 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17281 !!test
17282 bug 5918: autonumbering
17283 !! wikitext
17284 [http://first/] [http://second] [ftp://ftp]
17285
17286 ftp://inlineftp
17287
17288 [mailto:enclosed@mail.tld With target]
17289
17290 [mailto:enclosed@mail.tld]
17291
17292 mailto:inline@mail.tld
17293 !! html/php
17294 <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>
17295 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17296 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17297 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17298 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17299 </p>
17300 !! html/parsoid
17301 <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>
17302 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17303 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17304 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17305 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17306 !! end
17307
17308
17309 #
17310 # Security and HTML correctness
17311 # From Nick Jenkins' fuzz testing
17312 #
17313
17314 !! test
17315 Fuzz testing: Parser13
17316 !! wikitext
17317 {|
17318 | http://a|
17319 !! html
17320 <table>
17321 <tr>
17322 <td>
17323 </td>
17324 </tr>
17325 </table>
17326
17327 !! end
17328
17329 !! test
17330 Fuzz testing: Parser14
17331 !! wikitext
17332 == onmouseover= ==
17333 http://__TOC__
17334 !! html
17335 <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>
17336 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17337 <ul>
17338 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17339 </ul>
17340 </div>
17341
17342
17343 !! html+tidy
17344 <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>
17345 <p>http://</p>
17346 <div id="toc" class="toc">
17347 <div id="toctitle">
17348 <h2>Contents</h2>
17349 </div>
17350 <ul>
17351 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17352 </ul>
17353 </div>
17354 <p></p>
17355 !! end
17356
17357 !! test
17358 Fuzz testing: Parser14-table
17359 !! options
17360 parsoid=wt2html,html2html
17361 !! wikitext
17362 ==a==
17363 {| STYLE=__TOC__
17364 !! html
17365 <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>
17366 <table style="&#95;_TOC&#95;_">
17367 <tr><td></td></tr>
17368 </table>
17369
17370 !! html+tidy
17371 <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>
17372 <table style="__TOC__">
17373 <tr>
17374 <td></td>
17375 </tr>
17376 </table>
17377 !! html/parsoid
17378 <h2>a</h2>
17379 <table style="__TOC__"></table>
17380 !! end
17381
17382 # Known to produce bogus xml (extra </td>)
17383 !! test
17384 Fuzz testing: Parser16
17385 !! wikitext
17386 {|
17387 !https://||||||
17388 !! html
17389 <table>
17390 <tr>
17391 <th>https://</th>
17392 <th></th>
17393 <th></th>
17394 <th>
17395 </td>
17396 </tr>
17397 </table>
17398
17399 !! html+tidy
17400 <table>
17401 <tr>
17402 <th>https://</th>
17403 <th></th>
17404 <th></th>
17405 <th></th>
17406 </tr>
17407 </table>
17408 !! end
17409
17410 !! test
17411 Fuzz testing: Parser21
17412 !! wikitext
17413 {|
17414 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17415 |
17416 !! html
17417 <table>
17418 <tr>
17419 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17420 </th>
17421 <td>
17422 </td>
17423 </tr>
17424 </table>
17425
17426 !! end
17427
17428 !! test
17429 Fuzz testing: Parser22
17430 !! wikitext
17431 http://===r:::https://b
17432
17433 {|
17434 !! html
17435 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17436 </p>
17437 <table>
17438 <tr><td></td></tr>
17439 </table>
17440
17441 !! end
17442
17443 # Known to produce bad XML for now
17444 !! test
17445 Fuzz testing: Parser24
17446 !! wikitext
17447 {|
17448 {{{|
17449 <u CLASS=
17450 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17451 <br style="onmouseover='alert(document.cookie);' " />
17452
17453 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17454 |
17455 !! html
17456 <table>
17457 {{{|
17458 <u class="&#124;">}}}} &gt;
17459 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17460
17461 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17462 <tr>
17463 <td></u>
17464 </td>
17465 </tr>
17466 </table>
17467
17468 !! end
17469
17470 # Note: the current result listed for this is not what the original one was,
17471 # but the original bug was JavaScript injection, which is fixed in any case.
17472 # It's not clear that the original result listed was any more correct than the
17473 # current one. Original result:
17474 # <p>{{{|
17475 # </p>
17476 # <li class="&#124;&#124;">
17477 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17478 !!test
17479 Fuzz testing: Parser25 (bug 6055)
17480 !! wikitext
17481 {{{
17482 |
17483 <LI CLASS=||
17484 >
17485 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17486 !! html
17487 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17488 </p>
17489 !! end
17490
17491 !!test
17492 Fuzz testing: URL adjacent extension (with space, clean)
17493 !! wikitext
17494 http://example.com <nowiki>junk</nowiki>
17495 !! html/php
17496 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17497 </p>
17498 !! html/parsoid
17499 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17500 !! end
17501
17502 !!test
17503 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17504 !! wikitext
17505 http://example.com<nowiki>junk</nowiki>
17506 !! html/php
17507 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17508 </p>
17509 !! html/parsoid
17510 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17511 !! end
17512
17513 !!test
17514 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17515 !! wikitext
17516 http://example.com<pre>junk</pre>
17517 !! html/php
17518 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17519
17520 !! html/php+tidy
17521 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17522 <pre>
17523 junk
17524 </pre>
17525 !! html/parsoid
17526 <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>
17527 !!end
17528
17529 !!test
17530 Fuzz testing: image with bogus manual thumbnail
17531 !! wikitext
17532 [[Image:foobar.jpg|thumbnail= ]]
17533 !! html/php
17534 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17535
17536 !! html/parsoid
17537 <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>
17538 !!end
17539
17540 !! test
17541 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17542 !! wikitext
17543 <pre dir="&#10;"></pre>
17544 !! html
17545 <pre dir="&#10;"></pre>
17546
17547 !! end
17548
17549 !! test
17550 Parsing optional HTML elements (Bug 6171)
17551 !! options
17552 !! wikitext
17553 <table>
17554 <tr>
17555 <td> Some tabular data</td>
17556 <td> More tabular data ...
17557 <td> And yet som tabular data</td>
17558 </tr>
17559 </table>
17560 !! html
17561 <table>
17562 <tr>
17563 <td> Some tabular data</td>
17564 <td> More tabular data ...
17565 </td><td> And yet som tabular data</td>
17566 </tr>
17567 </table>
17568
17569 !! end
17570
17571 !! test
17572 Correct handling of <td>, <tr> (Bug 6171)
17573 !! options
17574 !! wikitext
17575 <table>
17576 <tr>
17577 <td> Some tabular data</td>
17578 <td> More tabular data ...</td>
17579 <td> And yet som tabular data</td>
17580 </tr>
17581 </table>
17582 !! html
17583 <table>
17584 <tr>
17585 <td> Some tabular data</td>
17586 <td> More tabular data ...</td>
17587 <td> And yet som tabular data</td>
17588 </tr>
17589 </table>
17590
17591 !! end
17592
17593
17594 !! test
17595 Parsing crashing regression (fr:JavaScript)
17596 !! wikitext
17597 </body></x>
17598 !! html
17599 <p>&lt;/body&gt;&lt;/x&gt;
17600 </p>
17601 !! end
17602
17603 !! test
17604 Inline wiki vs wiki block nesting
17605 !! wikitext
17606 '''Bold paragraph
17607
17608 New wiki paragraph
17609 !! html
17610 <p><b>Bold paragraph</b>
17611 </p><p>New wiki paragraph
17612 </p>
17613 !! end
17614
17615 # FIXME: The current php output is documented
17616 # and desired output is the parsoid target.
17617 !! test
17618 Inline HTML vs wiki block nesting
17619 !! wikitext
17620 <b>Bold paragraph
17621
17622 New wiki paragraph
17623 !! html/php
17624 <p><b>Bold paragraph
17625 </p><p>New wiki paragraph</b>
17626 </p>
17627 !! html/parsoid
17628 <p><b>Bold paragraph</b>
17629 </p><p>New wiki paragraph
17630 </p>
17631 !! end
17632
17633 # Original result was this:
17634 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17635 # </p>
17636 # While that might be marginally more intuitive, maybe, the six-apostrophe
17637 # construct is clearly pathological and the result stated here (which is what
17638 # the parser actually does) is about as reasonable as anything.
17639 !!test
17640 Mixing markup for italics and bold
17641 !! options
17642 !! wikitext
17643 '''bold''''''bold''bolditalics'''''
17644 !! html
17645 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17646 </p>
17647 !! end
17648
17649
17650 !! article
17651 Xyzzyx
17652 !! text
17653 Article for special page transclusion test
17654 !! endarticle
17655
17656 !! test
17657 Special page transclusion
17658 !! options
17659 !! wikitext
17660 {{Special:Prefixindex/Xyzzyx}}
17661 !! html
17662 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17663 </ul>
17664
17665 !! end
17666
17667 !! test
17668 Special page transclusion twice (bug 5021)
17669 !! options
17670 !! wikitext
17671 {{Special:Prefixindex/Xyzzyx}}
17672 {{Special:Prefixindex/Xyzzyx}}
17673 !! html
17674 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17675 </ul>
17676 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17677 </ul>
17678
17679 !! end
17680
17681 !! test
17682 Transclusion of default MediaWiki message
17683 !! wikitext
17684 {{MediaWiki:Mainpage}}
17685 !! html
17686 <p>Main Page
17687 </p>
17688 !! end
17689
17690 !! test
17691 Transclusion of nonexistent MediaWiki message
17692 !! wikitext
17693 {{MediaWiki:Mainpagexxx}}
17694 !! html
17695 <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>
17696 </p>
17697 !! end
17698
17699 !! test
17700 Transclusion of MediaWiki message with underscore
17701 !! wikitext
17702 {{MediaWiki:history_short}}
17703 !! html
17704 <p>History
17705 </p>
17706 !! end
17707
17708 !! test
17709 Transclusion of MediaWiki message with space
17710 !! wikitext
17711 {{MediaWiki:history short}}
17712 !! html
17713 <p>History
17714 </p>
17715 !! end
17716
17717 !! test
17718 Invalid header with following text
17719 !! wikitext
17720 = x = y
17721 !! html
17722 <p>= x = y
17723 </p>
17724 !! end
17725
17726
17727 !! test
17728 Section extraction test (section 0)
17729 !! options
17730 section=0
17731 !! wikitext
17732 start
17733 ==a==
17734 ===aa===
17735 ====aaa====
17736 ==b==
17737 ===ba===
17738 ===bb===
17739 ====bba====
17740 ===bc===
17741 ==c==
17742 ===ca===
17743 !! html/php
17744 start
17745 !! end
17746
17747 !! test
17748 Section extraction test (section 1)
17749 !! options
17750 section=1
17751 !! wikitext
17752 start
17753 ==a==
17754 ===aa===
17755 ====aaa====
17756 ==b==
17757 ===ba===
17758 ===bb===
17759 ====bba====
17760 ===bc===
17761 ==c==
17762 ===ca===
17763 !! html/php
17764 ==a==
17765 ===aa===
17766 ====aaa====
17767 !! end
17768
17769 !! test
17770 Section extraction test (section 2)
17771 !! options
17772 section=2
17773 !! wikitext
17774 start
17775 ==a==
17776 ===aa===
17777 ====aaa====
17778 ==b==
17779 ===ba===
17780 ===bb===
17781 ====bba====
17782 ===bc===
17783 ==c==
17784 ===ca===
17785 !! html/php
17786 ===aa===
17787 ====aaa====
17788 !! end
17789
17790 !! test
17791 Section extraction test (section 3)
17792 !! options
17793 section=3
17794 !! wikitext
17795 start
17796 ==a==
17797 ===aa===
17798 ====aaa====
17799 ==b==
17800 ===ba===
17801 ===bb===
17802 ====bba====
17803 ===bc===
17804 ==c==
17805 ===ca===
17806 !! html/php
17807 ====aaa====
17808 !! end
17809
17810 !! test
17811 Section extraction test (section 4)
17812 !! options
17813 section=4
17814 !! wikitext
17815 start
17816 ==a==
17817 ===aa===
17818 ====aaa====
17819 ==b==
17820 ===ba===
17821 ===bb===
17822 ====bba====
17823 ===bc===
17824 ==c==
17825 ===ca===
17826 !! html/php
17827 ==b==
17828 ===ba===
17829 ===bb===
17830 ====bba====
17831 ===bc===
17832 !! end
17833
17834 !! test
17835 Section extraction test (section 5)
17836 !! options
17837 section=5
17838 !! wikitext
17839 start
17840 ==a==
17841 ===aa===
17842 ====aaa====
17843 ==b==
17844 ===ba===
17845 ===bb===
17846 ====bba====
17847 ===bc===
17848 ==c==
17849 ===ca===
17850 !! html/php
17851 ===ba===
17852 !! end
17853
17854 !! test
17855 Section extraction test (section 6)
17856 !! options
17857 section=6
17858 !! wikitext
17859 start
17860 ==a==
17861 ===aa===
17862 ====aaa====
17863 ==b==
17864 ===ba===
17865 ===bb===
17866 ====bba====
17867 ===bc===
17868 ==c==
17869 ===ca===
17870 !! html/php
17871 ===bb===
17872 ====bba====
17873 !! end
17874
17875 !! test
17876 Section extraction test (section 7)
17877 !! options
17878 section=7
17879 !! wikitext
17880 start
17881 ==a==
17882 ===aa===
17883 ====aaa====
17884 ==b==
17885 ===ba===
17886 ===bb===
17887 ====bba====
17888 ===bc===
17889 ==c==
17890 ===ca===
17891 !! html/php
17892 ====bba====
17893 !! end
17894
17895 !! test
17896 Section extraction test (section 8)
17897 !! options
17898 section=8
17899 !! wikitext
17900 start
17901 ==a==
17902 ===aa===
17903 ====aaa====
17904 ==b==
17905 ===ba===
17906 ===bb===
17907 ====bba====
17908 ===bc===
17909 ==c==
17910 ===ca===
17911 !! html/php
17912 ===bc===
17913 !! end
17914
17915 !! test
17916 Section extraction test (section 9)
17917 !! options
17918 section=9
17919 !! wikitext
17920 start
17921 ==a==
17922 ===aa===
17923 ====aaa====
17924 ==b==
17925 ===ba===
17926 ===bb===
17927 ====bba====
17928 ===bc===
17929 ==c==
17930 ===ca===
17931 !! html/php
17932 ==c==
17933 ===ca===
17934 !! end
17935
17936 !! test
17937 Section extraction test (section 10)
17938 !! options
17939 section=10
17940 !! wikitext
17941 start
17942 ==a==
17943 ===aa===
17944 ====aaa====
17945 ==b==
17946 ===ba===
17947 ===bb===
17948 ====bba====
17949 ===bc===
17950 ==c==
17951 ===ca===
17952 !! html/php
17953 ===ca===
17954 !! end
17955
17956 !! test
17957 Section extraction test (nonexistent section 11)
17958 !! options
17959 section=11
17960 !! wikitext
17961 start
17962 ==a==
17963 ===aa===
17964 ====aaa====
17965 ==b==
17966 ===ba===
17967 ===bb===
17968 ====bba====
17969 ===bc===
17970 ==c==
17971 ===ca===
17972 !! html/php
17973 !! end
17974
17975 !! test
17976 Section extraction test with bogus heading (section 1)
17977 !! options
17978 section=1
17979 !! wikitext
17980 ==a==
17981 ==bogus== not a legal section
17982 ==b==
17983 !! html/php
17984 ==a==
17985 ==bogus== not a legal section
17986 !! end
17987
17988 !! test
17989 Section extraction test with bogus heading (section 2)
17990 !! options
17991 section=2
17992 !! wikitext
17993 ==a==
17994 ==bogus== not a legal section
17995 ==b==
17996 !! html/php
17997 ==b==
17998 !! end
17999
18000 !! test
18001 Section extraction test with comment after heading (section 1)
18002 !! options
18003 section=1
18004 !! wikitext
18005 ==a==
18006 ==b== <!-- -->
18007 ==c==
18008 !! html/php
18009 ==a==
18010 !! end
18011
18012 !! test
18013 Section extraction test with comment after heading (section 2)
18014 !! options
18015 section=2
18016 !! wikitext
18017 ==a==
18018 ==b== <!-- -->
18019 ==c==
18020 !! html/php
18021 ==b== <!-- -->
18022 !! end
18023
18024 !! test
18025 Section extraction test with bogus <nowiki> heading (section 1)
18026 !! options
18027 section=1
18028 !! wikitext
18029 ==a==
18030 ==bogus== <nowiki>not a legal section</nowiki>
18031 ==b==
18032 !! html/php
18033 ==a==
18034 ==bogus== <nowiki>not a legal section</nowiki>
18035 !! end
18036
18037 !! test
18038 Section extraction test with bogus <nowiki> heading (section 2)
18039 !! options
18040 section=2
18041 !! wikitext
18042 ==a==
18043 ==bogus== <nowiki>not a legal section</nowiki>
18044 ==b==
18045 !! html/php
18046 ==b==
18047 !! end
18048
18049 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18050 # instead of respecting commented sections
18051 !! test
18052 Section extraction prefixed by comment (section 1)
18053 !! options
18054 section=1
18055 !! wikitext
18056 <!-- -->==sec1==
18057 ==sec2==
18058 !! html/php
18059 ==sec2==
18060 !!end
18061
18062 !! test
18063 Section extraction prefixed by comment (section 2)
18064 !! options
18065 section=2
18066 !! wikitext
18067 <!-- -->==sec1==
18068 ==sec2==
18069 !! html/php
18070
18071 !!end
18072
18073 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18074 # instead of respecting HTML-style headings
18075 !! test
18076 Section extraction, mixed wiki and html (section 1)
18077 !! options
18078 section=1
18079 !! wikitext
18080 <h2>unmarked</h2>
18081 unmarked
18082 ==1==
18083 one
18084 ==2==
18085 two
18086 !! html/php
18087 ==1==
18088 one
18089 !! end
18090
18091 !! test
18092 Section extraction, mixed wiki and html (section 2)
18093 !! options
18094 section=2
18095 !! wikitext
18096 <h2>unmarked</h2>
18097 unmarked
18098 ==1==
18099 one
18100 ==2==
18101 two
18102 !! html/php
18103 ==2==
18104 two
18105 !! end
18106
18107
18108 # Formerly testing for bug 3342
18109 !! test
18110 Section extraction, heading surrounded by <noinclude>
18111 !! options
18112 section=1
18113 !! wikitext
18114 <noinclude>==unmarked==</noinclude>
18115 ==marked==
18116 !! html/php
18117 ==marked==
18118 !!end
18119
18120 # Test behavior of bug 19910
18121 !! test
18122 Sectiion with all-equals
18123 !! options
18124 section=2
18125 !! wikitext
18126 ===
18127 The line above must have a trailing space
18128 === <!--
18129 --> <!-- -->
18130 But just in case it doesn't...
18131 !! html/php
18132 === <!--
18133 --> <!-- -->
18134 But just in case it doesn't...
18135 !! end
18136
18137 !! test
18138 Section replacement test (section 0)
18139 !! options
18140 replace=0,"xxx"
18141 !! wikitext
18142 start
18143 ==a==
18144 ===aa===
18145 ====aaa====
18146 ==b==
18147 ===ba===
18148 ===bb===
18149 ====bba====
18150 ===bc===
18151 ==c==
18152 ===ca===
18153 !! html/php
18154 xxx
18155
18156 ==a==
18157 ===aa===
18158 ====aaa====
18159 ==b==
18160 ===ba===
18161 ===bb===
18162 ====bba====
18163 ===bc===
18164 ==c==
18165 ===ca===
18166 !! end
18167
18168 !! test
18169 Section replacement test (section 1)
18170 !! options
18171 replace=1,"xxx"
18172 !! wikitext
18173 start
18174 ==a==
18175 ===aa===
18176 ====aaa====
18177 ==b==
18178 ===ba===
18179 ===bb===
18180 ====bba====
18181 ===bc===
18182 ==c==
18183 ===ca===
18184 !! html/php
18185 start
18186 xxx
18187
18188 ==b==
18189 ===ba===
18190 ===bb===
18191 ====bba====
18192 ===bc===
18193 ==c==
18194 ===ca===
18195 !! end
18196
18197 !! test
18198 Section replacement test (section 2)
18199 !! options
18200 replace=2,"xxx"
18201 !! wikitext
18202 start
18203 ==a==
18204 ===aa===
18205 ====aaa====
18206 ==b==
18207 ===ba===
18208 ===bb===
18209 ====bba====
18210 ===bc===
18211 ==c==
18212 ===ca===
18213 !! html/php
18214 start
18215 ==a==
18216 xxx
18217
18218 ==b==
18219 ===ba===
18220 ===bb===
18221 ====bba====
18222 ===bc===
18223 ==c==
18224 ===ca===
18225 !! end
18226
18227 !! test
18228 Section replacement test (section 3)
18229 !! options
18230 replace=3,"xxx"
18231 !! wikitext
18232 start
18233 ==a==
18234 ===aa===
18235 ====aaa====
18236 ==b==
18237 ===ba===
18238 ===bb===
18239 ====bba====
18240 ===bc===
18241 ==c==
18242 ===ca===
18243 !! html/php
18244 start
18245 ==a==
18246 ===aa===
18247 xxx
18248
18249 ==b==
18250 ===ba===
18251 ===bb===
18252 ====bba====
18253 ===bc===
18254 ==c==
18255 ===ca===
18256 !! end
18257
18258 !! test
18259 Section replacement test (section 4)
18260 !! options
18261 replace=4,"xxx"
18262 !! wikitext
18263 start
18264 ==a==
18265 ===aa===
18266 ====aaa====
18267 ==b==
18268 ===ba===
18269 ===bb===
18270 ====bba====
18271 ===bc===
18272 ==c==
18273 ===ca===
18274 !! html/php
18275 start
18276 ==a==
18277 ===aa===
18278 ====aaa====
18279 xxx
18280
18281 ==c==
18282 ===ca===
18283 !! end
18284
18285 !! test
18286 Section replacement test (section 5)
18287 !! options
18288 replace=5,"xxx"
18289 !! wikitext
18290 start
18291 ==a==
18292 ===aa===
18293 ====aaa====
18294 ==b==
18295 ===ba===
18296 ===bb===
18297 ====bba====
18298 ===bc===
18299 ==c==
18300 ===ca===
18301 !! html/php
18302 start
18303 ==a==
18304 ===aa===
18305 ====aaa====
18306 ==b==
18307 xxx
18308
18309 ===bb===
18310 ====bba====
18311 ===bc===
18312 ==c==
18313 ===ca===
18314 !! end
18315
18316 !! test
18317 Section replacement test (section 6)
18318 !! options
18319 replace=6,"xxx"
18320 !! wikitext
18321 start
18322 ==a==
18323 ===aa===
18324 ====aaa====
18325 ==b==
18326 ===ba===
18327 ===bb===
18328 ====bba====
18329 ===bc===
18330 ==c==
18331 ===ca===
18332 !! html/php
18333 start
18334 ==a==
18335 ===aa===
18336 ====aaa====
18337 ==b==
18338 ===ba===
18339 xxx
18340
18341 ===bc===
18342 ==c==
18343 ===ca===
18344 !! end
18345
18346 !! test
18347 Section replacement test (section 7)
18348 !! options
18349 replace=7,"xxx"
18350 !! wikitext
18351 start
18352 ==a==
18353 ===aa===
18354 ====aaa====
18355 ==b==
18356 ===ba===
18357 ===bb===
18358 ====bba====
18359 ===bc===
18360 ==c==
18361 ===ca===
18362 !! html/php
18363 start
18364 ==a==
18365 ===aa===
18366 ====aaa====
18367 ==b==
18368 ===ba===
18369 ===bb===
18370 xxx
18371
18372 ===bc===
18373 ==c==
18374 ===ca===
18375 !! end
18376
18377 !! test
18378 Section replacement test (section 8)
18379 !! options
18380 replace=8,"xxx"
18381 !! wikitext
18382 start
18383 ==a==
18384 ===aa===
18385 ====aaa====
18386 ==b==
18387 ===ba===
18388 ===bb===
18389 ====bba====
18390 ===bc===
18391 ==c==
18392 ===ca===
18393 !! html/php
18394 start
18395 ==a==
18396 ===aa===
18397 ====aaa====
18398 ==b==
18399 ===ba===
18400 ===bb===
18401 ====bba====
18402 xxx
18403
18404 ==c==
18405 ===ca===
18406 !!end
18407
18408 !! test
18409 Section replacement test (section 9)
18410 !! options
18411 replace=9,"xxx"
18412 !! wikitext
18413 start
18414 ==a==
18415 ===aa===
18416 ====aaa====
18417 ==b==
18418 ===ba===
18419 ===bb===
18420 ====bba====
18421 ===bc===
18422 ==c==
18423 ===ca===
18424 !! html/php
18425 start
18426 ==a==
18427 ===aa===
18428 ====aaa====
18429 ==b==
18430 ===ba===
18431 ===bb===
18432 ====bba====
18433 ===bc===
18434 xxx
18435 !! end
18436
18437 !! test
18438 Section replacement test (section 10)
18439 !! options
18440 replace=10,"xxx"
18441 !! wikitext
18442 start
18443 ==a==
18444 ===aa===
18445 ====aaa====
18446 ==b==
18447 ===ba===
18448 ===bb===
18449 ====bba====
18450 ===bc===
18451 ==c==
18452 ===ca===
18453 !! html/php
18454 start
18455 ==a==
18456 ===aa===
18457 ====aaa====
18458 ==b==
18459 ===ba===
18460 ===bb===
18461 ====bba====
18462 ===bc===
18463 ==c==
18464 xxx
18465 !! end
18466
18467 !! test
18468 Section replacement test with initial whitespace (bug 13728)
18469 !! options
18470 replace=2,"xxx"
18471 !! wikitext
18472 Preformatted initial line
18473 ==a==
18474 ===a===
18475 !! html/php
18476 Preformatted initial line
18477 ==a==
18478 xxx
18479 !! end
18480
18481
18482 !! test
18483 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18484 !! options
18485 section=1
18486 !! wikitext
18487 ==a==
18488 a
18489 !! html/php
18490 ==a==
18491 a
18492 !! end
18493
18494 !! test
18495 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18496 !! options
18497 section=1
18498 !! wikitext
18499 ==a==
18500 a
18501 !! html/php
18502 ==a==
18503 a
18504 !! end
18505
18506
18507 !! test
18508 Section extraction, <pre> around bogus header (bug 10309)
18509 !! options
18510 section=2
18511 !! wikitext
18512 == Section One ==
18513 <pre>
18514 =======
18515 </pre>
18516
18517 == Section Two ==
18518 stuff
18519 !! html/php
18520 == Section Two ==
18521 stuff
18522 !! end
18523
18524 !! test
18525 Section replacement, <pre> around bogus header (bug 10309)
18526 !! options
18527 replace=2,"xxx"
18528 !! wikitext
18529 == Section One ==
18530 <pre>
18531 =======
18532 </pre>
18533
18534 == Section Two ==
18535 stuff
18536 !! html/php
18537 == Section One ==
18538 <pre>
18539 =======
18540 </pre>
18541
18542 xxx
18543 !! end
18544
18545
18546 !! test
18547 Handling of &#x0A; in URLs
18548 !! wikitext
18549 ** irc://&#x0A;a
18550 !! html/php
18551 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18552
18553 !! html/parsoid
18554 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18555 a">irc://
18556 a</a></li></ul></li></ul>
18557 !! end
18558
18559 !! test
18560 Handling of %0A in URLs
18561 !! wikitext
18562 ** irc://%0Aa
18563 !! html/php
18564 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18565
18566 !! html/parsoid
18567 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18568 !! end
18569
18570
18571 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18572 !! test
18573 5 quotes, code coverage +1 line
18574 !! options
18575 parsoid=wt2html
18576 !! wikitext
18577 '''''
18578 !! html/php
18579 !! html/parsoid
18580 <p><b><i></i></b></p>
18581 !! end
18582
18583 # same html as previous, but wikitext adjusted to match parsoid html2wt
18584 # note that wt2html and html2html will put the <i> before the <b>
18585 !! test
18586 5 quotes, code coverage +1 line w/ nowiki (1)
18587 !! options
18588 parsoid=wt2wt,html2wt
18589 !! wikitext
18590 '''''<nowiki/>'''''
18591 !! html/php
18592 <p><i></i>
18593 </p>
18594 !! html/parsoid
18595 <p><b><i></i></b></p>
18596 !! end
18597
18598 # same as previous, just swapping the <i> and <b>
18599 !! test
18600 5 quotes, code coverage +1 line w/ nowiki (2)
18601 !! wikitext
18602 '''''<nowiki/>'''''
18603 !! html/php
18604 <p><i></i>
18605 </p>
18606 !! html/parsoid
18607 <p><i><b></b></i></p>
18608 !! end
18609
18610 !! test
18611 Special:Search page linking.
18612 !! wikitext
18613 {{Special:search}}
18614 !! html
18615 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18616 </p>
18617 !! end
18618
18619 !! test
18620 {{!}} is a magic word
18621 !! wikitext
18622 {{!}} is a magic word there and {{!}} is still a magic word here
18623 | is not a magic word here but {{!}} is still a magic word here
18624 !! html/php
18625 <p>| is a magic word there and | is still a magic word here
18626 | is not a magic word here but | is still a magic word here
18627 </p>
18628 !! html/parsoid
18629 <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
18630 | 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>
18631
18632 !! end
18633
18634 !! test
18635 Say the magic word
18636 !! options
18637 title=[[Parser test]]
18638 !! wikitext
18639 * {{PAGENAME}}
18640 * {{PAGENAMEE}}
18641 * {{FULLPAGENAME}}
18642 * {{FULLPAGENAMEE}}
18643 * {{BASEPAGENAME}}
18644 * {{BASEPAGENAMEE}}
18645 * {{SUBPAGENAME}}
18646 * {{SUBPAGENAMEE}}
18647 * {{ROOTPAGENAME}}
18648 * {{ROOTPAGENAMEE}}
18649 * {{TALKPAGENAME}}
18650 * {{TALKPAGENAMEE}}
18651 * {{SUBJECTPAGENAME}}
18652 * {{SUBJECTPAGENAMEE}}
18653 * {{NAMESPACEE}}
18654 * {{NAMESPACE}}
18655 * {{NAMESPACENUMBER}}
18656 * {{TALKSPACE}}
18657 * {{TALKSPACEE}}
18658 * {{SUBJECTSPACE}}
18659 * {{SUBJECTSPACEE}}
18660 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18661 !! html
18662 <ul><li> Parser test</li>
18663 <li> Parser_test</li>
18664 <li> Parser test</li>
18665 <li> Parser_test</li>
18666 <li> Parser test</li>
18667 <li> Parser_test</li>
18668 <li> Parser test</li>
18669 <li> Parser_test</li>
18670 <li> Parser test</li>
18671 <li> Parser_test</li>
18672 <li> Talk:Parser test</li>
18673 <li> Talk:Parser_test</li>
18674 <li> Parser test</li>
18675 <li> Parser_test</li>
18676 <li> </li>
18677 <li> </li>
18678 <li> 0</li>
18679 <li> Talk</li>
18680 <li> Talk</li>
18681 <li> </li>
18682 <li> </li>
18683 <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>
18684
18685 !! end
18686 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18687
18688 !! test
18689 Gallery
18690 !! wikitext
18691 <gallery>
18692 image1.png |
18693 image2.gif|||||
18694
18695 image3|
18696 image4 |300px| centre
18697 image5.svg| http://///////
18698 [[x|xx]]]]
18699 * image6
18700 </gallery>
18701 !! html
18702 <ul class="gallery mw-gallery-traditional">
18703 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18704 <div class="thumb" style="height: 150px;">Image1.png</div>
18705 <div class="gallerytext">
18706 </div>
18707 </div></li>
18708 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18709 <div class="thumb" style="height: 150px;">Image2.gif</div>
18710 <div class="gallerytext">
18711 </div>
18712 </div></li>
18713 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18714 <div class="thumb" style="height: 150px;">Image3</div>
18715 <div class="gallerytext">
18716 </div>
18717 </div></li>
18718 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18719 <div class="thumb" style="height: 150px;">Image4</div>
18720 <div class="gallerytext">
18721 <pre>centre
18722 </pre>
18723 </div>
18724 </div></li>
18725 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18726 <div class="thumb" style="height: 150px;">Image5.svg</div>
18727 <div class="gallerytext">
18728 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18729 </p>
18730 </div>
18731 </div></li>
18732 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18733 <div class="thumb" style="height: 150px;">* image6</div>
18734 <div class="gallerytext">
18735 </div>
18736 </div></li>
18737 </ul>
18738
18739 !! end
18740
18741 !! test
18742 Gallery (with options)
18743 !! wikitext
18744 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18745 File:Nonexistent.jpg|caption
18746 File:Nonexistent.jpg
18747 image:foobar.jpg|some '''caption''' [[Main Page]]
18748 image:foobar.jpg
18749 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18750 </gallery>
18751 !! html
18752 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18753 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18754 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18755 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18756 <div class="gallerytext">
18757 <p>caption
18758 </p>
18759 </div>
18760 </div></li>
18761 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18762 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18763 <div class="gallerytext">
18764 </div>
18765 </div></li>
18766 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18767 <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>
18768 <div class="gallerytext">
18769 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18770 </p>
18771 </div>
18772 </div></li>
18773 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18774 <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>
18775 <div class="gallerytext">
18776 </div>
18777 </div></li>
18778 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18779 <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>
18780 <div class="gallerytext">
18781 <p>blabla.
18782 </p>
18783 </div>
18784 </div></li>
18785 </ul>
18786
18787 !! end
18788
18789 !! test
18790 Gallery with link that has fragment
18791 !! wikitext
18792 <gallery>
18793 image:foobar.jpg|link=Main_Page
18794 image:foobar.jpg|link=Main_Page#section
18795 image:foobar.jpg|link=Main Page#section|caption
18796 </gallery>
18797 !! html
18798 <ul class="gallery mw-gallery-traditional">
18799 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18800 <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>
18801 <div class="gallerytext">
18802 </div>
18803 </div></li>
18804 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18805 <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>
18806 <div class="gallerytext">
18807 </div>
18808 </div></li>
18809 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18810 <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>
18811 <div class="gallerytext">
18812 <p>caption
18813 </p>
18814 </div>
18815 </div></li>
18816 </ul>
18817
18818 !! end
18819
18820 !! test
18821 Gallery with wikitext inside caption
18822 !! wikitext
18823 <gallery>
18824 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18825 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18826 </gallery>
18827 !! html
18828 <ul class="gallery mw-gallery-traditional">
18829 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18830 <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>
18831 <div class="gallerytext">
18832 <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>
18833 </p>
18834 </div>
18835 </div></li>
18836 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18837 <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>
18838 <div class="gallerytext">
18839 <p>This is a test template
18840 </p>
18841 </div>
18842 </div></li>
18843 </ul>
18844
18845 !! end
18846
18847 !! test
18848 gallery (with showfilename option)
18849 !! wikitext
18850 <gallery showfilename>
18851 File:Nonexistent.jpg|caption
18852 File:Nonexistent.jpg
18853 image:foobar.jpg|some '''caption''' [[Main Page]]
18854 File:Foobar.jpg
18855 </gallery>
18856 !! html
18857 <ul class="gallery mw-gallery-traditional">
18858 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18859 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18860 <div class="gallerytext">
18861 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18862 caption
18863 </p>
18864 </div>
18865 </div></li>
18866 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18867 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18868 <div class="gallerytext">
18869 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18870 </p>
18871 </div>
18872 </div></li>
18873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18874 <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>
18875 <div class="gallerytext">
18876 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
18877 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18878 </p>
18879 </div>
18880 </div></li>
18881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18882 <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>
18883 <div class="gallerytext">
18884 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
18885 </p>
18886 </div>
18887 </div></li>
18888 </ul>
18889
18890 !! end
18891
18892 !! test
18893 Gallery (with namespace-less filenames)
18894 !! wikitext
18895 <gallery>
18896 File:Nonexistent.jpg
18897 Nonexistent.jpg
18898 image:foobar.jpg
18899 foobar.jpg
18900 </gallery>
18901 !! html
18902 <ul class="gallery mw-gallery-traditional">
18903 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18904 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18905 <div class="gallerytext">
18906 </div>
18907 </div></li>
18908 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18909 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18910 <div class="gallerytext">
18911 </div>
18912 </div></li>
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/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>
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/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>
18920 <div class="gallerytext">
18921 </div>
18922 </div></li>
18923 </ul>
18924
18925 !! end
18926
18927 !! test
18928 HTML Hex character encoding (spells the word "JavaScript")
18929 !! options
18930 parsoid=wt2html,wt2wt,html2html
18931 !! wikitext
18932 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18933 !! html/php
18934 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18935 </p>
18936 !! html/php+tidy
18937 <p>JavaScript</p>
18938 !! html/parsoid
18939 <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>
18940 !! end
18941
18942 !! test
18943 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18944 !! wikitext
18945 &#xsee;&#XSEE;
18946 !! html/php
18947 <p>&amp;#xsee;&amp;#XSEE;
18948 </p>
18949 !! html/parsoid
18950 <p>&amp;#xsee;&amp;#XSEE;</p>
18951 !! end
18952
18953 !! test
18954 HTML Hex character encoding mixed case
18955 !! options
18956 parsoid=wt2html,wt2wt,html2html
18957 !! wikitext
18958 &#xEE;&#Xee;
18959 !! html/php
18960 <p>&#xee;&#xee;
18961 </p>
18962 !! html/php+tidy
18963 <p>îî</p>
18964 !! html/parsoid
18965 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18966 !! end
18967
18968 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18969 # Note that U+000C (form feed) is not a valid XML character, so
18970 # it is banned even though allowed in HTML5.
18971 !! test
18972 Illegal character references (T106578)
18973 !! wikitext
18974 ; Null: &#00;
18975 ; FF: &#xC;
18976 ; CR: &#xD;
18977 ; Control (low): &#8;
18978 ; Control (high): &#x7F; &#x9F;
18979 ; Surrogate: &#xD83D;&#xDCA9;
18980 ; This is an okay astral character: &#x1F4A9;
18981 !! html+tidy
18982 <dl>
18983 <dt>Null</dt>
18984 <dd>&amp;#00;</dd>
18985 <dt>FF</dt>
18986 <dd>&amp;#xC;</dd>
18987 <dt>CR</dt>
18988 <dd>&amp;#xD;</dd>
18989 <dt>Control (low)</dt>
18990 <dd>&amp;#8;</dd>
18991 <dt>Control (high)</dt>
18992 <dd>&amp;#x7F; &amp;#x9F;</dd>
18993 <dt>Surrogate</dt>
18994 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18995 <dt>This is an okay astral character</dt>
18996 <dd>💩</dd>
18997 </dl>
18998 !! end
18999
19000 !! test
19001 __FORCETOC__ override
19002 !! wikitext
19003 __NEWSECTIONLINK__
19004 __FORCETOC__
19005 !! html/php
19006 <p><br />
19007 </p>
19008 !! end
19009
19010 !! test
19011 ISBN code coverage
19012 !! wikitext
19013 ISBN 978-0-1234-56&#x20;789
19014 !! html
19015 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19016 </p>
19017 !! html+tidy
19018 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19019 !! html/parsoid
19020 <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>
19021 !! end
19022
19023 !! test
19024 ISBN followed by 5 spaces
19025 !! wikitext
19026 ISBN
19027 !! html
19028 <p>ISBN
19029 </p>
19030 !! end
19031
19032 !! test
19033 Double ISBN
19034 !! wikitext
19035 ISBN ISBN 1234567890
19036 !! html/php
19037 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19038 </p>
19039 !! html/parsoid
19040 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19041 !! end
19042
19043 # Uppercase X and lowercase x as well
19044 !! test
19045 ISBN with an X
19046 !! wikitext
19047 ISBN 3-462-04561-X
19048 ISBN 3-462-04561-x
19049 ISBN 080442957X
19050 ISBN 080442957x
19051 ISBN 978080442957X
19052 ISBN 978080442957x
19053 !! html/php
19054 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19055 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19056 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19057 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19058 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19059 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19060 </p>
19061 !! html/parsoid
19062 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19063 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19064 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19065 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19066 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19067 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19068 !! end
19069
19070 !! test
19071 ISBN with empty prefix (parsoid test)
19072 !! wikitext
19073 ISBN 1234567890
19074 !! html/php
19075 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19076 </p>
19077 !! html/parsoid
19078 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19079 !! end
19080
19081 !! test
19082 Bug 22905: <abbr> followed by ISBN followed by </a>
19083 !! wikitext
19084 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19085 !! html/php
19086 <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>
19087 </p>
19088 !! html/parsoid
19089 <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>
19090 !! end
19091
19092 !! test
19093 Double RFC
19094 !! wikitext
19095 RFC RFC 1234
19096 !! html
19097 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19098 </p>
19099 !! end
19100
19101 !! test
19102 Double RFC with a wiki link
19103 !! wikitext
19104 RFC [[RFC 1234]]
19105 !! html
19106 <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>
19107 </p>
19108 !! end
19109
19110 !! test
19111 RFC code coverage
19112 !! wikitext
19113 RFC 983&#x20;987
19114 !! html
19115 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19116 </p>
19117 !! html+tidy
19118 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19119 !! end
19120
19121 !! test
19122 Centre-aligned image
19123 !! wikitext
19124 [[Image:foobar.jpg|centre]]
19125 !! html
19126 <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>
19127
19128 !!end
19129
19130 !! test
19131 None-aligned image
19132 !! wikitext
19133 [[Image:foobar.jpg|none]]
19134 !! html
19135 <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>
19136
19137 !!end
19138
19139 !! test
19140 Width + Height sized image (using px) (height is ignored)
19141 !! wikitext
19142 [[Image:foobar.jpg|640x480px]]
19143 !! html
19144 <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>
19145 </p>
19146 !!end
19147
19148 !! test
19149 Width-sized image (using px, no following whitespace)
19150 !! wikitext
19151 [[Image:foobar.jpg|640px]]
19152 !! html
19153 <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>
19154 </p>
19155 !!end
19156
19157 !! test
19158 Width-sized image (using px, with following whitespace - test regression from r39467)
19159 !! wikitext
19160 [[Image:foobar.jpg|640px ]]
19161 !! html
19162 <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>
19163 </p>
19164 !!end
19165
19166 !! test
19167 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19168 !! wikitext
19169 [[Image:foobar.jpg| 640px]]
19170 !! html
19171 <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>
19172 </p>
19173 !!end
19174
19175 !! test
19176 Image with page parameter
19177 !! options
19178 djvu
19179 !! wikitext
19180 [[File:LoremIpsum.djvu|page=2]]
19181 !! html/php
19182 <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>
19183 </p>
19184 !! html/parsoid
19185 <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>
19186 !! end
19187
19188 !! test
19189 Another italics / bold test
19190 !! wikitext
19191 ''' ''x'
19192 !! html
19193 <pre>'<i> </i>x'
19194 </pre>
19195 !!end
19196
19197 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19198 !! test
19199 dt/dd/dl test
19200 !! wikitext
19201 :;;;::
19202 !! html/php
19203 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19204
19205 !! html/parsoid
19206 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19207
19208 !!end
19209
19210
19211 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19212 !! test
19213 Images with the "|" character in the comment
19214 !! wikitext
19215 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19216 !! html/php
19217 <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>
19218
19219 !! html/parsoid
19220 <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>
19221 !! end
19222
19223 !! test
19224 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19225 !! wikitext
19226 <html><script>alert(1);</script></html>
19227 !! html
19228 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19229 </p>
19230 !! end
19231
19232 !! test
19233 HTML with raw HTML ($wgRawHtml==true)
19234 !! options
19235 wgRawHtml=1
19236 !! wikitext
19237 <html><script>alert(1);</script></html>
19238 !! html
19239 <p><script>alert(1);</script>
19240 </p>
19241 !! end
19242
19243 !! test
19244 Parents of subpages, one level up
19245 !! options
19246 subpage title=[[Subpage test/L1/L2/L3]]
19247 !! wikitext
19248 [[../|L2]]
19249 !! html
19250 <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>
19251 </p>
19252 !! end
19253
19254
19255 !! test
19256 Parents of subpages, one level up, not named
19257 !! options
19258 subpage title=[[Subpage test/L1/L2/L3]]
19259 !! wikitext
19260 [[../]]
19261 !! html
19262 <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>
19263 </p>
19264 !! end
19265
19266
19267
19268 !! test
19269 Parents of subpages, two levels up
19270 !! options
19271 subpage title=[[Subpage test/L1/L2/L3]]
19272 !! wikitext
19273 [[../../|L1]]2
19274
19275 [[../../|L1]]l
19276 !! html
19277 <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
19278 </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>
19279 </p>
19280 !! end
19281
19282 !! test
19283 Parents of subpages, two levels up, without trailing slash or name.
19284 !! options
19285 subpage title=[[Subpage test/L1/L2/L3]]
19286 !! wikitext
19287 [[../..]]
19288 !! html
19289 <p>[[../..]]
19290 </p>
19291 !! end
19292
19293 !! test
19294 Parents of subpages, two levels up, with lots of extra trailing slashes.
19295 !! options
19296 subpage title=[[Subpage test/L1/L2/L3]]
19297 !! wikitext
19298 [[../../////]]
19299 !! html
19300 <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>
19301 </p>
19302 !! end
19303
19304 !! article
19305 Subpage test/L1/L2/L3Sibling
19306 !! text
19307 Sibling article
19308 !! endarticle
19309
19310 !! test
19311 Transclusion of a sibling page (one level up)
19312 !! options
19313 subpage title=[[Subpage test/L1/L2/L3]]
19314 !! wikitext
19315 {{../L3Sibling}}
19316 !! html
19317 <p>Sibling article
19318 </p>
19319 !! end
19320
19321 !! test
19322 Transclusion of a child page
19323 !! options
19324 subpage title=[[Subpage test/L1/L2]]
19325 !! wikitext
19326 {{/L3Sibling}}
19327 !! html
19328 <p>Sibling article
19329 </p>
19330 !! end
19331
19332 !! test
19333 Non-transclusion because of too many up levels
19334 !! options
19335 subpage title=[[Subpage test/L1/L2/L3]]
19336 !! wikitext
19337 {{../../../../More than parent}}
19338 !! html
19339 <p>{{../../../../More than parent}}
19340 </p>
19341 !! end
19342
19343 !! test
19344 Definition list code coverage
19345 !! wikitext
19346 ; title : def
19347 ; title : def
19348 ;title: def
19349 !! html/php
19350 <dl><dt> title &#160;</dt>
19351 <dd> def</dd>
19352 <dt> title&#160;</dt>
19353 <dd> def</dd>
19354 <dt>title</dt>
19355 <dd> def</dd></dl>
19356
19357 !! html/parsoid
19358 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19359 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19360 <dt>title</dt><dd> def</dd></dl>
19361 !! end
19362
19363 !! test
19364 Don't fall for the self-closing div
19365 !! wikitext
19366 <div>hello world</div/>
19367 !! html
19368 <div>hello world</div>
19369
19370 !! end
19371
19372 !! test
19373 MSGNW magic word
19374 !! wikitext
19375 {{MSGNW:msg}}
19376 !! html/php
19377 <p>&#91;&#91;:Template:Msg&#93;&#93;
19378 </p>
19379 !! end
19380
19381 !! test
19382 RAW magic word
19383 !! wikitext
19384 {{RAW:QUERTY}}
19385 !! html
19386 <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>
19387 </p>
19388 !! end
19389
19390 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19391 !! test
19392 Always escape literal '>' in output, not just after '<'
19393 !! wikitext
19394 ><>
19395 !! html
19396 <p>&gt;&lt;&gt;
19397 </p>
19398 !! end
19399
19400 !! test
19401 Template caching
19402 !! wikitext
19403 {{Test}}
19404 {{Test}}
19405 !! html
19406 <p>This is a test template
19407 This is a test template
19408 </p>
19409 !! end
19410
19411
19412 !! article
19413 MediaWiki:Fake
19414 !! text
19415 ==header==
19416 !! endarticle
19417
19418 !! test
19419 Inclusion of !userCanEdit() content
19420 !! wikitext
19421 {{MediaWiki:Fake}}
19422 !! html
19423 <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>
19424
19425 !! end
19426
19427
19428 !! test
19429 Out-of-order TOC heading levels
19430 !! wikitext
19431 ==2==
19432 ======6======
19433 ===3===
19434 =1=
19435 =====5=====
19436 ==2==
19437 !! html
19438 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19439 <ul>
19440 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19441 <ul>
19442 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19443 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19444 </ul>
19445 </li>
19446 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19447 <ul>
19448 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19449 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19450 </ul>
19451 </li>
19452 </ul>
19453 </div>
19454
19455 <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>
19456 <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>
19457 <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>
19458 <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>
19459 <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>
19460 <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>
19461
19462 !! end
19463
19464
19465 !! test
19466 ISBN with a dummy number
19467 !! wikitext
19468 ISBN ---
19469 !! html
19470 <p>ISBN ---
19471 </p>
19472 !! end
19473
19474
19475 !! test
19476 ISBN with space-delimited number
19477 !! wikitext
19478 ISBN 92 9017 032 8
19479 !! html
19480 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19481 </p>
19482 !! end
19483
19484
19485 !! test
19486 ISBN with multiple spaces, no number
19487 !! wikitext
19488 ISBN foo
19489 !! html
19490 <p>ISBN foo
19491 </p>
19492 !! end
19493
19494
19495 !! test
19496 ISBN length
19497 !! wikitext
19498 ISBN 123456789
19499
19500 ISBN 1234567890
19501
19502 ISBN 12345678901
19503 !! html
19504 <p>ISBN 123456789
19505 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19506 </p><p>ISBN 12345678901
19507 </p>
19508 !! end
19509
19510
19511 !! test
19512 ISBN with trailing year (bug 8110)
19513 !! wikitext
19514 ISBN 1-234-56789-0 - 2006
19515
19516 ISBN 1 234 56789 0 - 2006
19517 !! html
19518 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19519 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19520 </p>
19521 !! end
19522
19523
19524 !! test
19525 anchorencode
19526 !! wikitext
19527 {{anchorencode:foo bar©#%n}}
19528 !! html
19529 <p>foo_bar.C2.A9.23.25n
19530 </p>
19531 !! end
19532
19533 !! test
19534 anchorencode trims spaces
19535 !! wikitext
19536 {{anchorencode: __pretty__please__}}
19537 !! html
19538 <p>pretty_please
19539 </p>
19540 !! end
19541
19542 !! test
19543 anchorencode deals with links
19544 !! wikitext
19545 {{anchorencode: [[hello|world]] [[hi]]}}
19546 !! html
19547 <p>world_hi
19548 </p>
19549 !! end
19550
19551 !! test
19552 anchorencode deals with templates
19553 !! wikitext
19554 {{anchorencode: {{Foo}} }}
19555 !! html
19556 <p>FOO
19557 </p>
19558 !! end
19559
19560 !! test
19561 anchorencode encodes like the TOC generator: (bug 18431)
19562 !! wikitext
19563 === _ +:.3A%3A&&amp;]] ===
19564 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19565 __NOEDITSECTION__
19566 !! html
19567 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19568 <p>.2B:.3A.253A.26.26.5D.5D
19569 </p>
19570 !! end
19571
19572 !! test
19573 Bug 6200: blockquotes and paragraph formatting
19574 !! wikitext
19575 <blockquote>
19576 foo
19577 </blockquote>
19578
19579 bar
19580
19581 baz
19582 !! html
19583 <blockquote>
19584 <p>foo
19585 </p>
19586 </blockquote>
19587 <p>bar
19588 </p>
19589 <pre>baz
19590 </pre>
19591 !! end
19592
19593 !! test
19594 Bug 8293: Use of center tag ruins paragraph formatting
19595 !! wikitext
19596 <center>
19597 foo
19598 </center>
19599
19600 bar
19601
19602 baz
19603 !! html
19604 <center>
19605 <p>foo
19606 </p>
19607 </center>
19608 <p>bar
19609 </p>
19610 <pre>baz
19611 </pre>
19612 !! end
19613
19614 !!test
19615 Parsing of overlapping (improperly nested) inline html tags
19616 !! wikitext
19617 <span><s>x</span></s>
19618 !! html/php
19619 <p><span><s>x&lt;/span&gt;</s></span>
19620 </p>
19621 !! html/parsoid
19622 <p><span><s>x</s></span>
19623 </p>
19624 !!end
19625
19626 ###
19627 ### Language variants related tests
19628 ###
19629 !! test
19630 Self-link in language variants
19631 !! options
19632 title=[[Dunav]] language=sr
19633 !! wikitext
19634 Both [[Dunav]] and [[Дунав]] are names for this river.
19635 !! html
19636 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19637 </p>
19638 !!end
19639
19640 !! article
19641 Дуна
19642 !! text
19643 content
19644 !! endarticle
19645
19646 !! test
19647 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19648 !! options
19649 title=[[Duna]] language=sr
19650 !! wikitext
19651 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19652 !! html
19653 <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.
19654 </p>
19655 !! end
19656
19657 !! test
19658 Link to a section of a variant of this title shouldn't be parsed as self-link
19659 !! options
19660 title=[[Duna]] language=sr
19661 !! wikitext
19662 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19663 !! html
19664 <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.
19665 </p>
19666 !! end
19667
19668 !! test
19669 Link to pages in language variants
19670 !! options
19671 language=sr
19672 !! wikitext
19673 Main Page can be written as [[Маин Паге]]
19674 !! html
19675 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19676 </p>
19677 !!end
19678
19679
19680 !! test
19681 Multiple links to pages in language variants
19682 !! options
19683 language=sr
19684 !! wikitext
19685 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19686 !! html
19687 <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>.
19688 </p>
19689 !!end
19690
19691
19692 !! test
19693 Simple template in language variants
19694 !! options
19695 language=sr
19696 !! wikitext
19697 {{тест}}
19698 !! html
19699 <p>This is a test template
19700 </p>
19701 !! end
19702
19703
19704 !! test
19705 Template with explicit namespace in language variants
19706 !! options
19707 language=sr
19708 !! wikitext
19709 {{Template:тест}}
19710 !! html
19711 <p>This is a test template
19712 </p>
19713 !! end
19714
19715
19716 !! test
19717 Basic test for template parameter in language variants
19718 !! options
19719 language=sr
19720 !! wikitext
19721 {{парамтест|param=foo}}
19722 !! html
19723 <p>This is a test template with parameter foo
19724 </p>
19725 !! end
19726
19727
19728 !! test
19729 Simple category in language variants
19730 !! options
19731 language=sr cat
19732 !! wikitext
19733 [[Category:МедиаWики Усер'с Гуиде]]
19734 !! html
19735 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
19736 !! end
19737
19738
19739 !! article
19740 Category:分类
19741 !! text
19742 blah
19743 !! endarticle
19744
19745 !! article
19746 Category:分類
19747 !! text
19748 blah
19749 !! endarticle
19750
19751 ## We used to, but no longer wt2wt this test since the default serializer
19752 ## will normalize all categories to serialize on their own line.
19753 ## This wikitext usage is going to be fairly uncommon in production and
19754 ## selser will take care of preserving formatting in those scenarios.
19755 !! test
19756 Don't convert blue categorylinks to another variant (bug 33210)
19757 !! options
19758 cat
19759 language=zh
19760 parsoid=wt2html
19761 !! wikitext
19762 [[A]][[Category:分类]]
19763 !! html/php
19764 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19765 !! html/parsoid
19766 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19767 <link rel="mw:PageProp/Category" href="Category:分类"/>
19768 !! end
19769
19770 !! test
19771 Stripping -{}- tags (language variants)
19772 !! options
19773 language=sr
19774 !! wikitext
19775 Latin proverb: -{Ne nuntium necare}-
19776 !! html
19777 <p>Latin proverb: Ne nuntium necare
19778 </p>
19779 !! end
19780
19781
19782 !! test
19783 Prevent conversion with -{}- tags (language variants)
19784 !! options
19785 language=sr variant=sr-ec
19786 !! wikitext
19787 Latinski: -{Ne nuntium necare}-
19788 !! html
19789 <p>Латински: Ne nuntium necare
19790 </p>
19791 !! end
19792
19793
19794 !! test
19795 Prevent conversion of text with -{}- tags (language variants)
19796 !! options
19797 language=sr variant=sr-ec
19798 !! wikitext
19799 Latinski: -{Ne nuntium necare}-
19800 !! html
19801 <p>Латински: Ne nuntium necare
19802 </p>
19803 !! end
19804
19805
19806 !! test
19807 Prevent conversion of links with -{}- tags (language variants)
19808 !! options
19809 language=sr variant=sr-ec
19810 !! wikitext
19811 -{[[Main Page]]}-
19812 !! html
19813 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19814 </p>
19815 !! end
19816
19817
19818 !! test
19819 -{}- tags within headlines (within html for parserConvert())
19820 !! options
19821 language=sr variant=sr-ec
19822 !! wikitext
19823 == -{Naslov}- ==
19824 !! html
19825 <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>
19826
19827 !! end
19828
19829
19830 !! test
19831 Explicit definition of language variant alternatives
19832 !! options
19833 language=zh variant=zh-tw
19834 !! wikitext
19835 -{zh:China;zh-tw:Taiwan}-, not China
19836 !! html
19837 <p>Taiwan, not China
19838 </p>
19839 !! end
19840
19841
19842 !! test
19843 Conversion around HTML tags
19844 !! options
19845 language=sr variant=sr-ec
19846 !! wikitext
19847 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19848 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19849 !! html
19850 <p>
19851 <span title="ЛаCтин">ски</span>
19852 </p>
19853 !! end
19854
19855
19856 !! test
19857 Explicit session-wise language variant mapping (A flag and - flag)
19858 !! options
19859 language=zh variant=zh-tw
19860 !! wikitext
19861 Taiwan is not China.
19862 But -{A|zh:China;zh-tw:Taiwan}- is China,
19863 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19864 and -{China}- is China.
19865 !! html
19866 <p>Taiwan is not China.
19867 But Taiwan is Taiwan,
19868 (This should be stripped!)
19869 and China is China.
19870 </p>
19871 !! end
19872
19873 !! test
19874 Explicit session-wise language variant mapping (H flag for hide)
19875 !! options
19876 language=zh variant=zh-tw
19877 !! wikitext
19878 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19879 Taiwan is China.
19880 !! html
19881 <p>(This should be stripped!)
19882 Taiwan is Taiwan.
19883 </p>
19884 !! end
19885
19886 !! test
19887 Adding explicit conversion rule for title (T flag)
19888 !! options
19889 language=zh variant=zh-tw showtitle
19890 !! wikitext
19891 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19892 !! html
19893 Taiwan
19894 <p>Should be stripped!
19895 </p>
19896 !! end
19897
19898 !! test
19899 Testing that changing the language variant here in the tests actually works
19900 !! options
19901 language=zh variant=zh showtitle
19902 !! wikitext
19903 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19904 !! html
19905 China
19906 <p>Should be stripped!
19907 </p>
19908 !! end
19909
19910 !! test
19911 Recursive conversion of alt and title attrs shouldn't clear converter state
19912 !! options
19913 language=zh variant=zh-cn showtitle
19914 !! wikitext
19915 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19916 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19917 !! html
19918 China
19919 <p>
19920 Should be stripped<span title="Exclamation">!</span>
19921 </p>
19922 !! end
19923
19924 !! test
19925 Bug 24072: more test on conversion rule for title
19926 !! options
19927 language=zh variant=zh-tw showtitle
19928 !! wikitext
19929 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19930 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19931 !! html
19932 Taiwan
19933 <p>This should be stripped!
19934 This won't take interferes with the title rule.
19935 </p>
19936 !! end
19937
19938 !! test
19939 Partly disable title conversion if variant == main language code
19940 !! options
19941 language=zh variant=zh title=[[ZH]] showtitle
19942 !! wikitext
19943 -{T|zh-cn:CN;zh-tw:TW}-
19944 !! html
19945 ZH
19946 <p>
19947 </p>
19948 !! end
19949
19950 !! test
19951 Partly disable title conversion if variant == main language code, more
19952 !! options
19953 language=zh variant=zh title=[[ZH]] showtitle
19954 !! wikitext
19955 -{T|TW}-
19956 !! html
19957 ZH
19958 <p>
19959 </p>
19960 !! end
19961
19962 !! test
19963 Raw output of variant escape tags (R flag)
19964 !! options
19965 language=zh variant=zh-tw
19966 !! wikitext
19967 Raw: -{R|zh:China;zh-tw:Taiwan}-
19968 !! html
19969 <p>Raw: zh:China;zh-tw:Taiwan
19970 </p>
19971 !! end
19972
19973 !! test
19974 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19975 !! options
19976 language=zh variant=zh-cn
19977 !! input
19978 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19979 !! result
19980 <p>0
19981 </p>
19982 !! end
19983
19984 !! test
19985 Conversion rules from [numeric-only string] to [something else] (T48634)
19986 !! options
19987 language=zh variant=zh-cn
19988 !! input
19989 -{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
19990 !! result
19991 <p>D12345EE12345
19992 </p>
19993 !! end
19994
19995 !! test
19996 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19997 !! options
19998 language=zh variant=zh-cn
19999 !! input
20000 -{H|zh-cn:foo;zh-tw:;}-foobar
20001 !! result
20002 <p>foobar
20003 </p>
20004 !! end
20005
20006 !! test
20007 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20008 !! options
20009 language=zh variant=zh-cn
20010 !! input
20011 -{H|=>zh-cn:foo;}-foobar
20012 !! result
20013 <p>foobar
20014 </p>
20015 !! end
20016
20017 !! test
20018 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20019 !! options
20020 language=zh variant=zh-cn
20021 !! input
20022 -{H|}-foobar
20023 !! result
20024 <p>foobar
20025 </p>
20026 !! end
20027
20028 !! test
20029 Nested using of manual convert syntax
20030 !! options
20031 language=zh variant=zh-hk
20032 !! wikitext
20033 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20034 !! html
20035 <p>Nested: Hello Hong Kong!
20036 </p>
20037 !! end
20038
20039 !! test
20040 Proper conversion of text in external links
20041 !! options
20042 language=sr variant=sr-ec
20043 !! wikitext
20044 http://www.google.com
20045 gopher://www.google.com
20046 [http://www.google.com http://www.google.com]
20047 [gopher://www.google.com gopher://www.google.com]
20048 [https://www.google.com irc://www.google.com]
20049 [ftp://www.google.com www.google.com/ftp://dir]
20050 [//www.google.com www.google.com]
20051 !! html
20052 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20053 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20054 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20055 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20056 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20057 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20058 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20059 </p>
20060 !! end
20061
20062 !! test
20063 Do not convert roman numbers to language variants
20064 !! options
20065 language=sr variant=sr-ec
20066 !! wikitext
20067 Fridrih IV je car.
20068 !! html
20069 <p>Фридрих IV је цар.
20070 </p>
20071 !! end
20072
20073 !! test
20074 Unclosed language converter markup "-{"
20075 !! options
20076 language=sr
20077 !! wikitext
20078 -{T|hello
20079 !! html
20080 <p>-{T|hello
20081 </p>
20082 !! end
20083
20084 !! test
20085 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20086 !! options
20087 language=sr
20088 !! wikitext
20089 -{R|=&gt;}-
20090 !! html
20091 <p>=&gt;
20092 </p>
20093 !!end
20094
20095 !! test
20096 Don't break link parsing if language converter markup is in the caption.
20097 !! options
20098 language=sr variant=sr-ec
20099 !! wikitext
20100 [[Main Page|-{R|main page}-]]
20101 !! html
20102 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20103 </p>
20104 !! end
20105
20106 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20107 !! test
20108 Don't break image parsing if language converter markup is in the caption.
20109 !! options
20110 language=sr
20111 !! wikitext
20112 [[File:Foobar.jpg|-{R|caption}-]]
20113 !! html/parsoid
20114 <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>
20115 </p>
20116 !! end
20117
20118 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20119 !! test
20120 Don't break list handling if language converter markup is in the item.
20121 !! options
20122 language=zh variant=zh-cn
20123 !! wikitext
20124 ;-{zh-cn:AAA;zh-tw:BBB}-
20125 !! html/php
20126 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20127
20128 !! html/parsoid
20129 <dl><dt>AAA
20130 </dt></dl>
20131 !! end
20132
20133 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20134 !! test
20135 Don't break table handling if language converter markup is in the cell.
20136 !! options
20137 language=sr variant=sr-ec
20138 !! wikitext
20139 {|
20140 |-
20141 | -{R|B}-
20142 |}
20143 !! html/php
20144 <table>
20145
20146 <tr>
20147 <td>Б}-
20148 </td></tr></table>
20149
20150 !! html/parsoid
20151 <table>
20152
20153 <tr>
20154 <td> B
20155 </td></tr></table>
20156
20157 !! end
20158
20159 !! test
20160 Bug 529: Uncovered bullet
20161 !! wikitext
20162 * Foo {{bullet}}
20163 !! html
20164 <ul><li> Foo </li>
20165 <li> Bar</li></ul>
20166
20167 !! end
20168
20169 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20170 # Templates in Wikipedia rely on this behavior, as tidy has always been
20171 # enabled there. These tests are normally run *without* tidy, so specify the
20172 # full output here.
20173 # To test realistic parsing behavior, apply a tidy-like transformation to both
20174 # the expected output and your parser's output.
20175 !! test
20176 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20177 !! wikitext
20178 ******* Foo {{bullet}}
20179 !! html
20180 <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>
20181 <li> Bar</li></ul>
20182
20183 !! end
20184
20185 !! test
20186 Bug 529: Uncovered table already at line-start
20187 !! wikitext
20188 x
20189
20190 {{table}}
20191 y
20192 !! html
20193 <p>x
20194 </p>
20195 <table>
20196 <tr>
20197 <td> 1 </td>
20198 <td> 2
20199 </td></tr>
20200 <tr>
20201 <td> 3 </td>
20202 <td> 4
20203 </td></tr></table>
20204 <p>y
20205 </p>
20206 !! end
20207
20208 !! test
20209 Bug 529: Uncovered bullet in parser function result
20210 !! wikitext
20211 * Foo {{lc:{{bullet}} }}
20212 !! html
20213 <ul><li> Foo </li>
20214 <li> bar</li></ul>
20215
20216 !! end
20217
20218 !! test
20219 Bug 5678: Double-parsed template argument
20220 !! wikitext
20221 {{lc:{{{1}}}|hello}}
20222 !! html
20223 <p>{{{1}}}
20224 </p>
20225 !! end
20226
20227 !! test
20228 Bug 5678: Double-parsed template invocation
20229 !! wikitext
20230 {{lc:{{paramtest {{!}} param = hello }} }}
20231 !! html
20232 <p>{{paramtest | param = hello }}
20233 </p>
20234 !! end
20235
20236 !! test
20237 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20238 !! options
20239 language=cs
20240 title=[[Main Page]]
20241 !! wikitext
20242 {{PRVNÍVELKÉ:ěščř}}
20243 {{prvnívelké:ěščř}}
20244 {{PRVNÍMALÉ:ěščř}}
20245 {{prvnímalé:ěščř}}
20246 {{MALÁ:ěščř}}
20247 {{malá:ěščř}}
20248 {{VELKÁ:ěščř}}
20249 {{velká:ěščř}}
20250 !! html
20251 <p>Ěščř
20252 Ěščř
20253 ěščř
20254 ěščř
20255 ěščř
20256 ěščř
20257 ĚŠČŘ
20258 ĚŠČŘ
20259 </p>
20260 !! end
20261
20262 !! test
20263 Morwen/13: Unclosed link followed by heading
20264 !! wikitext
20265 [[link
20266 ==heading==
20267 !! html
20268 <p>[[link
20269 </p>
20270 <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>
20271
20272 !! end
20273
20274 !! test
20275 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20276 !! wikitext
20277 {{foo|
20278 =heading=
20279 !! html
20280 <p>{{foo|
20281 </p>
20282 <h1><span class="mw-headline" id="heading">heading</span></h1>
20283
20284 !! end
20285
20286 !! test
20287 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20288 !! wikitext
20289 {{foo|
20290 ==heading==
20291 !! html
20292 <p>{{foo|
20293 </p>
20294 <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>
20295
20296 !! end
20297
20298 !! test
20299 Tildes in comments
20300 !! options
20301 pst
20302 !! wikitext
20303 <!-- ~~~~ -->
20304 !! html/php
20305 <!-- ~~~~ -->
20306 !! end
20307
20308 !! test
20309 Paragraphs inside divs (no extra line breaks)
20310 !! wikitext
20311 <div>Line one
20312
20313 Line two</div>
20314 !! html
20315 <div>Line one
20316 Line two</div>
20317
20318 !! end
20319
20320 !! test
20321 Paragraphs inside divs (extra line break on open)
20322 !! wikitext
20323 <div>
20324 Line one
20325
20326 Line two</div>
20327 !! html
20328 <div>
20329 <p>Line one
20330 </p>
20331 Line two</div>
20332
20333 !! end
20334
20335 !! test
20336 Paragraphs inside divs (extra line break on close)
20337 !! wikitext
20338 <div>Line one
20339
20340 Line two
20341 </div>
20342 !! html
20343 <div>Line one
20344 <p>Line two
20345 </p>
20346 </div>
20347
20348 !! end
20349
20350 !! test
20351 Paragraphs inside divs (extra line break on open and close)
20352 !! wikitext
20353 <div>
20354 Line one
20355
20356 Line two
20357 </div>
20358 !! html
20359 <div>
20360 <p>Line one
20361 </p><p>Line two
20362 </p>
20363 </div>
20364
20365 !! end
20366
20367 !! test
20368 Nesting tags, paragraphs on lines which begin with <div>
20369 !! wikitext
20370 <div></div><strong>A
20371 B</strong>
20372 !! html/php+tidy
20373 <p><strong>A</strong></p>
20374 <p><strong>B</strong></p>
20375 !! html/parsoid
20376 <div></div>
20377 <p><strong>A
20378 B</strong>
20379 </p>
20380 !! end
20381
20382 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20383 !! test
20384 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20385 !! wikitext
20386 <blockquote>Line one
20387
20388 Line two</blockquote>
20389 !! html
20390 <blockquote>Line one
20391 Line two</blockquote>
20392
20393 !! html+tidy
20394 <blockquote>
20395 <p>Line one Line two</p>
20396 </blockquote>
20397 !! end
20398
20399 !! test
20400 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20401 !! wikitext
20402 <blockquote>
20403 Line one
20404
20405 Line two</blockquote>
20406 !! html
20407 <blockquote>
20408 <p>Line one
20409 </p>
20410 Line two</blockquote>
20411
20412 !! html+tidy
20413 <blockquote>
20414 <p>Line one</p>
20415 Line two</blockquote>
20416 !! end
20417
20418 !! test
20419 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20420 !! wikitext
20421 <blockquote>Line one
20422
20423 Line two
20424 </blockquote>
20425 !! html
20426 <blockquote>Line one
20427 <p>Line two
20428 </p>
20429 </blockquote>
20430
20431 !! html+tidy
20432 <blockquote>
20433 <p>Line one</p>
20434 <p>Line two</p>
20435 </blockquote>
20436 !! end
20437
20438 !! test
20439 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20440 !! wikitext
20441 <blockquote>
20442 Line one
20443
20444 Line two
20445 </blockquote>
20446 !! html
20447 <blockquote>
20448 <p>Line one
20449 </p><p>Line two
20450 </p>
20451 </blockquote>
20452
20453 !! html+tidy
20454 <blockquote>
20455 <p>Line one</p>
20456 <p>Line two</p>
20457 </blockquote>
20458 !! end
20459
20460 !! test
20461 Paragraphs inside blockquotes/divs (no extra line breaks)
20462 !! wikitext
20463 <blockquote><div>Line one
20464
20465 Line two</div></blockquote>
20466 !! html
20467 <blockquote><div>Line one
20468 Line two</div></blockquote>
20469
20470 !! end
20471
20472 !! test
20473 Paragraphs inside blockquotes/divs (extra line break on open)
20474 !! wikitext
20475 <blockquote><div>
20476 Line one
20477
20478 Line two</div></blockquote>
20479 !! html
20480 <blockquote><div>
20481 <p>Line one
20482 </p>
20483 Line two</div></blockquote>
20484
20485 !! end
20486
20487 !! test
20488 Paragraphs inside blockquotes/divs (extra line break on close)
20489 !! wikitext
20490 <blockquote><div>Line one
20491
20492 Line two
20493 </div></blockquote>
20494 !! html
20495 <blockquote><div>Line one
20496 <p>Line two
20497 </p>
20498 </div></blockquote>
20499
20500 !! end
20501
20502 !! test
20503 Paragraphs inside blockquotes/divs (extra line break on open and close)
20504 !! wikitext
20505 <blockquote><div>
20506 Line one
20507
20508 Line two
20509 </div></blockquote>
20510 !! html
20511 <blockquote><div>
20512 <p>Line one
20513 </p><p>Line two
20514 </p>
20515 </div></blockquote>
20516
20517 !! end
20518
20519 !! test
20520 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20521 !! options
20522 wgLinkHolderBatchSize=0
20523 !! wikitext
20524 [[meatball:1]]
20525 [[meatball:2]]
20526 [[meatball:3]]
20527 !! html
20528 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20529 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20530 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20531 </p>
20532 !! end
20533
20534 !! test
20535 Free external link invading image caption
20536 !! wikitext
20537 [[Image:Foobar.jpg|thumb|http://x|hello]]
20538 !! html
20539 <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>
20540
20541 !! end
20542
20543 !! test
20544 Bug 15196: localised external link numbers
20545 !! options
20546 language=fa
20547 !! wikitext
20548 [http://en.wikipedia.org/]
20549 !! html/php
20550 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20551 </p>
20552 !! html/parsoid
20553 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20554 !! end
20555
20556 !! test
20557 Multibyte character in padleft
20558 !! wikitext
20559 {{padleft:-Hello|7|Æ}}
20560 !! html
20561 <p>Æ-Hello
20562 </p>
20563 !! end
20564
20565 !! test
20566 Multibyte character in padright
20567 !! wikitext
20568 {{padright:Hello-|7|Æ}}
20569 !! html
20570 <p>Hello-Æ
20571 </p>
20572 !! end
20573
20574 !!test
20575 formatdate parser function
20576 !! wikitext
20577 {{#formatdate:2009-03-24}}
20578 !! html
20579 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20580 </p>
20581 !! end
20582
20583 !!test
20584 formatdate parser function, with default format
20585 !! wikitext
20586 {{#formatdate:2009-03-24|mdy}}
20587 !! html
20588 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20589 </p>
20590 !! end
20591
20592 !! test
20593 Spacing of numbers in formatted dates
20594 !! wikitext
20595 {{#formatdate:January 15}}
20596 !! html
20597 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20598 </p>
20599 !! end
20600
20601 !! test
20602 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
20603 !! options
20604 language=nl title=[[MediaWiki:Common.css]]
20605 !! wikitext
20606 {{#formatdate:2009-03-24|dmy}}
20607 !! html
20608 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20609 </p>
20610 !! end
20611
20612 #
20613 #
20614 #
20615
20616 #
20617 # Edit comments
20618 #
20619
20620 !! test
20621 Edit comment with link
20622 !! options
20623 comment
20624 !! wikitext
20625 I like the [[Main Page]] a lot
20626 !! html/php
20627 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20628 !!end
20629
20630 !! test
20631 Edit comment with link and link text
20632 !! options
20633 comment
20634 !! wikitext
20635 I like the [[Main Page|best pages]] a lot
20636 !! html/php
20637 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20638 !!end
20639
20640 !! test
20641 Edit comment with link and link text with suffix
20642 !! options
20643 comment
20644 !! wikitext
20645 I like the [[Main Page|best page]]s a lot
20646 !! html/php
20647 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20648 !!end
20649
20650 !! test
20651 Edit comment with section link (non-local, eg in history list)
20652 !! options
20653 comment title=[[Main Page]]
20654 !! wikitext
20655 /* External links */ removed bogus entries
20656 !! html/php
20657 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20658 !!end
20659
20660 !! test
20661 Edit comment with section link and text before it (non-local, eg in history list)
20662 !! options
20663 comment title=[[Main Page]]
20664 !! wikitext
20665 pre-comment text /* External links */ removed bogus entries
20666 !! html/php
20667 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>
20668 !!end
20669
20670 !! test
20671 Edit comment with section link (local, eg in diff view)
20672 !! options
20673 comment local title=[[Main Page]]
20674 !! wikitext
20675 /* External links */ removed bogus entries
20676 !! html/php
20677 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20678 !!end
20679
20680 !! test
20681 Edit comment with subpage link (bug 14080)
20682 !! options
20683 comment
20684 subpage
20685 title=[[Subpage test]]
20686 !! wikitext
20687 Poked at a [[/subpage]] here...
20688 !! html/php
20689 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20690 !!end
20691
20692 !! test
20693 Edit comment with subpage link and link text (bug 14080)
20694 !! options
20695 comment
20696 subpage
20697 title=[[Subpage test]]
20698 !! wikitext
20699 Poked at a [[/subpage|neat little page]] here...
20700 !! html/php
20701 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20702 !!end
20703
20704 !! test
20705 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20706 !! options
20707 comment
20708 title=[[Subpage test]]
20709 !! wikitext
20710 Poked at a [[/subpage]] here...
20711 !! html/php
20712 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...
20713 !!end
20714
20715 !! test
20716 Edit comment with bare anchor link (local, as on diff)
20717 !! options
20718 comment
20719 local
20720 title=[[Main Page]]
20721 !! wikitext
20722 [[#section]]
20723 !! html/php
20724 <a href="#section">#section</a>
20725 !! end
20726
20727 !! test
20728 Edit comment with bare anchor link (non-local, as on history)
20729 !! options
20730 comment
20731 title=[[Main Page]]
20732 !! wikitext
20733 [[#section]]
20734 !! html/php
20735 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20736 !! end
20737
20738 !! test
20739 Anchor starting with underscore
20740 !! options
20741 title=[[Foo]]
20742 !! wikitext
20743 [[#_ref|One]]
20744 !! html/php
20745 <p><a href="#_ref">One</a>
20746 </p>
20747 !! html/parsoid
20748 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20749 !! end
20750
20751 !! test
20752 Id starting with underscore
20753 !! wikitext
20754 <div id="_ref"></div>
20755 !! html/*
20756 <div id="_ref"></div>
20757
20758 !! end
20759
20760 !! test
20761 Space normalisation on autocomment (bug 22784)
20762 !! options
20763 comment
20764 title=[[Main Page]]
20765 !! wikitext
20766 /* __hello__world__ */
20767 !! html/php
20768 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20769 !! end
20770
20771 !! test
20772 percent-encoding and + signs in comments (Bug 26410)
20773 !! options
20774 comment
20775 !! wikitext
20776 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20777 !! html/php
20778 <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>
20779 !! end
20780
20781 # Parsoid doesn't support this yet: see bug 73581
20782 # but it *should* omit the 'src' attribute if the image is bad.
20783 # PHP side of tests was disabled in
20784 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20785 # because of issues in the PHP parserTests infrastructure
20786 # (but the output below is indeed what the PHP side emits)
20787 !! test
20788 Bad images - basic functionality
20789 !! wikitext
20790 [[File:Bad.jpg]]
20791 !! DISABLED/html/php
20792 !! html/parsoid
20793 <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>
20794 !! end
20795
20796 !! test
20797 Bad images - bug 16039: text after bad image disappears
20798 !! wikitext
20799 Foo bar
20800 [[File:Bad.jpg]]
20801 Bar foo
20802 !! DISABLED/html/php
20803 <p>Foo bar
20804 </p><p>Bar foo
20805 </p>
20806 !! html/parsoid
20807 <p>Foo bar
20808 <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>
20809 Bar foo</p>
20810 !! end
20811
20812 !! test
20813 Verify that displaytitle works (bug #22501) no displaytitle
20814 !! options
20815 showtitle
20816 !! config
20817 wgAllowDisplayTitle=true
20818 wgRestrictDisplayTitle=false
20819 !! wikitext
20820 this is not the the title
20821 !! html/php
20822 Parser test
20823 <p>this is not the the title
20824 </p>
20825 !! end
20826
20827 !! test
20828 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20829 !! options
20830 showtitle
20831 title=[[Screen]]
20832 !! config
20833 wgAllowDisplayTitle=true
20834 wgRestrictDisplayTitle=false
20835 !! wikitext
20836 this is not the the title
20837 {{DISPLAYTITLE:whatever}}
20838 !! html/php
20839 whatever
20840 <p>this is not the the title
20841 </p>
20842 !! end
20843
20844 !! test
20845 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20846 !! options
20847 showtitle
20848 title=[[Screen]]
20849 !! config
20850 wgAllowDisplayTitle=true
20851 wgRestrictDisplayTitle=true
20852 !! wikitext
20853 this is not the the title
20854 {{DISPLAYTITLE:whatever}}
20855 !! html/php
20856 Screen
20857 <p>this is not the the title
20858 </p>
20859 !! end
20860
20861 !! test
20862 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20863 !! options
20864 showtitle
20865 title=[[Screen]]
20866 !! config
20867 wgAllowDisplayTitle=true
20868 wgRestrictDisplayTitle=true
20869 !! wikitext
20870 this is not the the title
20871 {{DISPLAYTITLE:screen}}
20872 !! html/php
20873 screen
20874 <p>this is not the the title
20875 </p>
20876 !! end
20877
20878 !! test
20879 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20880 !! options
20881 showtitle
20882 title=[[Screen]]
20883 !! config
20884 wgAllowDisplayTitle=false
20885 !! wikitext
20886 this is not the the title
20887 {{DISPLAYTITLE:screen}}
20888 !! html/php
20889 Screen
20890 <p>this is not the the title
20891 <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>
20892 </p>
20893 !! end
20894
20895 !! test
20896 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20897 !! options
20898 showtitle
20899 title=[[Screen]]
20900 !! config
20901 wgAllowDisplayTitle=false
20902 !! wikitext
20903 this is not the the title
20904 !! html/php
20905 Screen
20906 <p>this is not the the title
20907 </p>
20908 !! end
20909
20910 !! test
20911 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20912 !! options
20913 showtitle
20914 title=[[Screen]]
20915 !! config
20916 wgAllowDisplayTitle=true
20917 wgRestrictDisplayTitle=true
20918 !! wikitext
20919 this is not the the title
20920 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20921 !! html/php
20922 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20923 <p>this is not the the title
20924 </p>
20925 !! end
20926
20927 !! test
20928 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20929 !! options
20930 showtitle
20931 title=[[Screen]]
20932 !! config
20933 wgAllowDisplayTitle=true
20934 wgRestrictDisplayTitle=true
20935 !! wikitext
20936 this is not the the title
20937 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20938 !! html/php
20939 <span style="color: red;">s</span>creen
20940 <p>this is not the the title
20941 </p>
20942 !! end
20943
20944 !! test
20945 Page status indicators: Empty name is invalid
20946 !! options
20947 showindicators
20948 !! wikitext
20949 <indicator name=" "></indicator>
20950 <indicator></indicator>
20951 !! html
20952 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20953 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20954 </p>
20955 !! end
20956
20957 !! test
20958 Page status indicators: Weird syntaxes that are okay
20959 !! options
20960 showindicators
20961 !! wikitext
20962 <indicator name="empty" />
20963 <indicator name="name"></indicator>
20964 !! html
20965 empty=
20966 name=
20967 <p><br />
20968 </p>
20969 !! end
20970
20971 !! test
20972 Page status indicators: Torture test
20973 !! options
20974 showindicators
20975 !! wikitext
20976 <indicator name="01">hello world</indicator>
20977 <indicator name="02">[[Main Page]]</indicator>
20978 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20979 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20980 <indicator name="05">* foo
20981 * bar</indicator>
20982 <indicator name="06"><nowiki>foo</nowiki></indicator>
20983 <indicator name="07"> Preformatted</indicator>
20984 <indicator name="08"><div>Broken tag</indicator>
20985 <indicator name="09">{| class=wikitable
20986 | cell
20987 |}</indicator>
20988 <indicator name="10">Two
20989
20990 paragraphs</indicator>
20991 !! html
20992 01=hello world
20993 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20994 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" />
20995 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>
20996 05=<ul><li> foo</li>
20997 <li> bar</li></ul>
20998
20999 06=foo
21000 07=<pre>Preformatted
21001 </pre>
21002 08=<div>Broken tag</div>
21003
21004 09=<table class="wikitable">
21005 <tr>
21006 <td> cell
21007 </td></tr></table>
21008
21009 10=<p>Two
21010 </p><p>paragraphs
21011 </p>
21012 <p><br />
21013 </p><p><br />
21014 </p><p><br />
21015 </p><p><br />
21016 </p><p><br />
21017 </p>
21018 !! end
21019
21020 !! test
21021 preload: check <noinclude> and <includeonly>
21022 !! options
21023 preload
21024 !! wikitext
21025 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21026 !! html/php
21027 Hello kind world.
21028 !! end
21029
21030 !! test
21031 preload: check <onlyinclude>
21032 !! options
21033 preload
21034 !! wikitext
21035 Goodbye <onlyinclude>Hello world</onlyinclude>
21036 !! html/php
21037 Hello world
21038 !! end
21039
21040 !! test
21041 preload: can pass tags through if we want to
21042 !! options
21043 preload
21044 !! wikitext
21045 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21046 !! html/php
21047 <includeonly>Hello world</includeonly>
21048 !! end
21049
21050 !! test
21051 preload: check that it doesn't try to do tricks
21052 !! options
21053 preload
21054 !! wikitext
21055 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21056 !! html/php
21057 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21058 !! end
21059
21060 !! test
21061 Play a bit with r67090 and bug 3158
21062 !! wikitext
21063 <div style="width:50% !important">&nbsp;</div>
21064 <div style="width:50%&nbsp;!important">&nbsp;</div>
21065 <div style="width:50%&#160;!important">&nbsp;</div>
21066 <div style="border : solid;">&nbsp;</div>
21067 !! html/php
21068 <div style="width:50% !important">&#160;</div>
21069 <div style="width:50% !important">&#160;</div>
21070 <div style="width:50% !important">&#160;</div>
21071 <div style="border&#160;: solid;">&#160;</div>
21072
21073 !! html/parsoid
21074 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21075 <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>
21076 <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>
21077 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21078
21079 !! end
21080
21081 !! test
21082 HTML5 data attributes
21083 !! wikitext
21084 <span data-foo="bar">Baz</span>
21085 <p data-abc-def_hij="">Quuz</p>
21086 !! html/php
21087 <p><span data-foo="bar">Baz</span>
21088 </p>
21089 <p data-abc-def_hij="">Quuz</p>
21090
21091 !! html/parsoid
21092 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21093 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21094 !! end
21095
21096 !! test
21097 Strip reserved data attributes
21098 !! wikitext
21099 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21100 !! html/php
21101 <div data-ok="fred">d</div>
21102
21103 !! html/parsoid
21104 <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>
21105 !! end
21106
21107 !! test
21108 percent-encoding and + signs in internal links (Bug 26410)
21109 !! wikitext
21110 [[User:+%]] [[Page+title%]]
21111 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21112 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21113 [[%33%45]] [[%33%45+]]
21114 !! html/php
21115 <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>
21116 <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>
21117 <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>
21118 <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>
21119 </p>
21120 !! html/parsoid
21121 <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>
21122 <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>
21123 <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>
21124 <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>
21125 !! end
21126
21127 !! test
21128 Special characters in embedded file links (bug 27679)
21129 !! wikitext
21130 [[File:Contains & ampersand.jpg]]
21131 [[File:Does not exist.jpg|Title with & ampersand]]
21132 !! html/php
21133 <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>
21134 <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>
21135 </p>
21136 !! html/parsoid
21137 <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>
21138 <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>
21139 !! end
21140
21141 !! test
21142 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21143 !! wikitext
21144 Text&apos;s been normalized?
21145 !! html
21146 <p>Text&#39;s been normalized?
21147 </p>
21148 !! end
21149
21150 !! test
21151 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21152 !! wikitext
21153 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21154 !! html
21155 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21156 </p>
21157 !! end
21158
21159 !! test
21160 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21161 !! wikitext
21162 [http://www.example.org/ ideograms]
21163 !! html
21164 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21165 </p>
21166 !! end
21167
21168 !! test
21169 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21170 !! wikitext
21171 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21172 !! html
21173 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21174 </p>
21175 !! end
21176
21177 !! article
21178 Mediawiki:loop1
21179 !! text
21180 {{Identical|A}}
21181 !! endarticle
21182
21183 !! article
21184 Mediawiki:loop2
21185 !! text
21186 {{Identical|B}}
21187 !! endarticle
21188
21189 !! article
21190 Template:Identical
21191 !! text
21192 {{int:loop1}}
21193 {{int:loop2}}
21194 !! endarticle
21195
21196 !! test
21197 Bug 31098 Template which includes system messages which includes the template
21198 !! wikitext
21199 {{Identical}}
21200 !! html
21201 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21202 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21203 </p>
21204 !! end
21205
21206 !! test
21207 Bug31490 Turkish: ucfirst 'blah'
21208 !! options
21209 language=tr
21210 !! wikitext
21211 {{ucfirst:blah}}
21212 !! html
21213 <p>Blah
21214 </p>
21215 !! end
21216
21217 !! test
21218 Bug31490 Turkish: ucfirst 'ix'
21219 !! options
21220 language=tr
21221 !! wikitext
21222 {{ucfirst:ix}}
21223 !! html
21224 <p>İx
21225 </p>
21226 !! end
21227
21228 !! test
21229 Bug31490 Turkish: lcfirst 'BLAH'
21230 !! options
21231 language=tr
21232 !! wikitext
21233 {{lcfirst:BLAH}}
21234 !! html
21235 <p>bLAH
21236 </p>
21237 !! end
21238
21239 !! test
21240 Bug31490 Turkish: ucfırst (with a dotless i)
21241 !! options
21242 language=tr
21243 !! wikitext
21244 {{ucfırst:blah}}
21245 !! html
21246 <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>
21247 </p>
21248 !! end
21249
21250 !! test
21251 Bug31490 ucfırst (with a dotless i) with English language
21252 !! options
21253 language=en
21254 !! wikitext
21255 {{ucfırst:blah}}
21256 !! html
21257 <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>
21258 </p>
21259 !! end
21260
21261 !! test
21262 Bug 26375: TOC with italics
21263 !! options
21264 title=[[Main Page]]
21265 !! wikitext
21266 __TOC__
21267 == ''Lost'' episodes ==
21268 !! html
21269 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21270 <ul>
21271 <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>
21272 </ul>
21273 </div>
21274
21275 <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>
21276
21277 !! end
21278
21279 !! test
21280 Bug 26375: TOC with bold
21281 !! options
21282 title=[[Main Page]]
21283 !! wikitext
21284 __TOC__
21285 == '''should be bold''' then normal text ==
21286 !! html
21287 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21288 <ul>
21289 <li class="toclevel-1 tocsection-1"><a href="#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>
21290 </ul>
21291 </div>
21292
21293 <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>
21294
21295 !! end
21296
21297 !! test
21298 Bug 33845: Headings become cursive in TOC when they contain an image
21299 !! options
21300 title=[[Main Page]]
21301 !! wikitext
21302 __TOC__
21303 == Image [[Image:foobar.jpg]] ==
21304 !! html
21305 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21306 <ul>
21307 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21308 </ul>
21309 </div>
21310
21311 <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>
21312
21313 !! end
21314
21315 !! test
21316 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21317 !! options
21318 title=[[Main Page]]
21319 !! wikitext
21320 __TOC__
21321 == <blockquote>Quote</blockquote> ==
21322 !! html
21323 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21324 <ul>
21325 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21326 </ul>
21327 </div>
21328
21329 <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>
21330
21331 !! html+tidy
21332 <p></p>
21333 <div id="toc" class="toc">
21334 <div id="toctitle">
21335 <h2>Contents</h2>
21336 </div>
21337 <ul>
21338 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21339 </ul>
21340 </div>
21341 <p></p>
21342 <h2><span class="mw-headline" id="Quote"></span></h2>
21343 <blockquote>
21344 <p><span class="mw-headline" id="Quote">Quote</span></p>
21345 </blockquote>
21346 <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>
21347 !! end
21348
21349 !! test
21350 Unclosed tags in TOC
21351 !! options
21352 title=[[Main Page]]
21353 !! wikitext
21354 __TOC__
21355 == Proof: 2 < 3 ==
21356 <small>Hanc marginis exiguitas non caperet.</small>
21357 QED
21358 !! html
21359 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21360 <ul>
21361 <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>
21362 </ul>
21363 </div>
21364
21365 <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>
21366 <p><small>Hanc marginis exiguitas non caperet.</small>
21367 QED
21368 </p>
21369 !! end
21370
21371 !! test
21372 Multiple tags in TOC
21373 !! wikitext
21374 __TOC__
21375 == <i>Foo</i> <b>Bar</b> ==
21376
21377 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21378 !! html
21379 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21380 <ul>
21381 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
21382 <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>
21383 </ul>
21384 </div>
21385
21386 <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>
21387 <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>
21388
21389 !! html+tidy
21390 <p></p>
21391 <div id="toc" class="toc">
21392 <div id="toctitle">
21393 <h2>Contents</h2>
21394 </div>
21395 <ul>
21396 <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>
21397 <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>
21398 </ul>
21399 </div>
21400 <p></p>
21401 <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>
21402 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21403 <blockquote>
21404 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21405 </blockquote>
21406 <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>
21407 !! end
21408
21409 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21410 # html5 tag parsing.
21411 !! test
21412 Tags with parameters in TOC
21413 !! options
21414 parsoid=wt2html
21415 !! wikitext
21416 __TOC__
21417 == <sup class="in-h2">Hello</sup> ==
21418
21419 == <sup class="a > b">Evilbye</sup> ==
21420 !! html/php
21421 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21422 <ul>
21423 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21424 <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>
21425 </ul>
21426 </div>
21427
21428 <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>
21429 <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>
21430
21431 !! html/parsoid
21432 <meta property="mw:PageProp/toc" />
21433 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21434
21435 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21436 !! end
21437
21438 !! test
21439 span tags with directionality in TOC
21440 !! wikitext
21441 __TOC__
21442 == <span dir="ltr">C++</span> ==
21443
21444 == <span dir="rtl">זבנג!</span> ==
21445
21446 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21447
21448 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21449
21450 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21451 !! html
21452 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21453 <ul>
21454 <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>
21455 <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>
21456 <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>
21457 <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>
21458 <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>
21459 </ul>
21460 </div>
21461
21462 <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>
21463 <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>
21464 <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>
21465 <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>
21466 <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>
21467
21468 !! end
21469
21470 !! test
21471 Bug 72884: bdi element in ToC
21472 !! wikitext
21473 __TOC__
21474 == <bdi>test</bdi> ==
21475 !! html
21476 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21477 <ul>
21478 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21479 </ul>
21480 </div>
21481
21482 <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>
21483
21484 !! end
21485
21486 # Note that the html output does not have the <p></p>, but the
21487 # html+tidy output *does*. This is because the empty <p></p> is
21488 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21489 !! test
21490 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21491 !! wikitext
21492 __TOC__
21493 == x ==
21494 !! html
21495 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21496 <ul>
21497 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21498 </ul>
21499 </div>
21500
21501 <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>
21502
21503 !! html+tidy
21504 <p></p>
21505 <div id="toc" class="toc">
21506 <div id="toctitle">
21507 <h2>Contents</h2>
21508 </div>
21509 <ul>
21510 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21511 </ul>
21512 </div>
21513 <p></p>
21514 <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>
21515 !! end
21516
21517 !! article
21518 MediaWiki:Bug32057
21519 !! text
21520 == {{int:headline_sample}} ==
21521 !! endarticle
21522
21523 !! test
21524 Bug 32057: Title needed when expanding <h> nodes.
21525 !! options
21526 title=[[Main Page]]
21527 !! wikitext
21528 {{int:Bug32057}}
21529 !! html
21530 <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>
21531
21532 !! end
21533
21534 !! test
21535 Strip marker in urlencode
21536 !! wikitext
21537 {{urlencode:x<nowiki/>y}}
21538 {{urlencode:x<nowiki/>y|wiki}}
21539 {{urlencode:x<nowiki/>y|path}}
21540 {{urlencode:x<pre id="one">two</pre>y}}
21541 !! html
21542 <p>xy
21543 xy
21544 xy
21545 xy
21546 </p>
21547 !! end
21548
21549 !! test
21550 Strip marker in lc
21551 !! wikitext
21552 {{lc:x<nowiki/>y}}
21553 !! html
21554 <p>xy
21555 </p>
21556 !! end
21557
21558 !! test
21559 Strip marker in uc
21560 !! wikitext
21561 {{uc:x<nowiki/>y}}
21562 !! html
21563 <p>XY
21564 </p>
21565 !! end
21566
21567 !! test
21568 Strip marker in formatNum
21569 !! wikitext
21570 {{formatnum:1<nowiki/>2}}
21571 {{formatnum:1<nowiki/>2|R}}
21572 !! html
21573 <p>12
21574 12
21575 </p>
21576 !! end
21577
21578 !! test
21579 Check noCommafy in formatNum
21580 !! options
21581 language=be-tarask
21582 !! wikitext
21583 {{formatnum:123456.78}}
21584 {{formatnum:123456.78|NOSEP}}
21585 !! html
21586 <p>123 456,78
21587 123456.78
21588 </p>
21589 !! end
21590
21591 !! test
21592 Wrong option for formatNum (bug 56199)
21593 !! wikitext
21594 {{formatnum:1,234.56|Random}}
21595 {{formatnum:1,234.56|EVERYTHING}}
21596 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21597 !! html
21598 <p>1,234.56
21599 1,234.56
21600 1,234.56
21601 </p>
21602 !! end
21603
21604 !! test
21605 Strip marker in grammar
21606 !! options
21607 language=fi
21608 !! wikitext
21609 {{grammar:elative|foo<nowiki/>bar}}
21610 !! html
21611 <p>foobarista
21612 </p>
21613 !! end
21614
21615 !! test
21616 Strip marker in padleft
21617 !! wikitext
21618 {{padleft:|2|x<nowiki/>y}}
21619 !! html
21620 <p>xy
21621 </p>
21622 !! end
21623
21624 !! test
21625 Strip marker in padright
21626 !! wikitext
21627 {{padright:|2|x<nowiki/>y}}
21628 !! html
21629 <p>xy
21630 </p>
21631 !! end
21632
21633 !! test
21634 Strip marker in anchorencode
21635 !! wikitext
21636 {{anchorencode:x<nowiki/>y}}
21637 !! html
21638 <p>xy
21639 </p>
21640 !! end
21641
21642 !! test
21643 nowiki inside link inside heading (bug 18295)
21644 !! wikitext
21645 ==[[foo|x<nowiki>y</nowiki>z]]==
21646 !! html
21647 <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>
21648
21649 !! end
21650
21651 !! test
21652 new support for bdi element (bug 31817)
21653 !! wikitext
21654 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21655 !! html
21656 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21657
21658 !!end
21659
21660 !! test
21661 Ignore pipe between table row attributes
21662 !! wikitext
21663 {|
21664 | quux
21665 |- id=foo | style='color: red'
21666 | bar
21667 |}
21668 !! html
21669 <table>
21670 <tr>
21671 <td> quux
21672 </td></tr>
21673 <tr id="foo" style="color: red">
21674 <td> bar
21675 </td></tr></table>
21676
21677 !! end
21678
21679 !!test
21680 Gallery override link with WikiLink (bug 34852)
21681 !! wikitext
21682 <gallery>
21683 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21684 </gallery>
21685 !! html
21686 <ul class="gallery mw-gallery-traditional">
21687 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21688 <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>
21689 <div class="gallerytext">
21690 <p>caption
21691 </p>
21692 </div>
21693 </div></li>
21694 </ul>
21695
21696 !! end
21697
21698 !!test
21699 Gallery override link with absolute external link (bug 34852)
21700 !! wikitext
21701 <gallery>
21702 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21703 </gallery>
21704 !! html
21705 <ul class="gallery mw-gallery-traditional">
21706 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21707 <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>
21708 <div class="gallerytext">
21709 <p>caption
21710 </p>
21711 </div>
21712 </div></li>
21713 </ul>
21714
21715 !! end
21716
21717 !!test
21718 Gallery override link with malicious javascript (bug 34852)
21719 !! wikitext
21720 <gallery>
21721 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21722 </gallery>
21723 !! html
21724 <ul class="gallery mw-gallery-traditional">
21725 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21726 <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>
21727 <div class="gallerytext">
21728 <p>caption
21729 </p>
21730 </div>
21731 </div></li>
21732 </ul>
21733
21734 !! end
21735
21736 !!test
21737 Gallery with invalid title as link (bug 43964)
21738 !! wikitext
21739 <gallery>
21740 File:foobar.jpg|link=<
21741 </gallery>
21742 !! html
21743 <ul class="gallery mw-gallery-traditional">
21744 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21745 <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>
21746 <div class="gallerytext">
21747 </div>
21748 </div></li>
21749 </ul>
21750
21751 !! end
21752
21753 !!test
21754 Language parser function
21755 !! wikitext
21756 {{#language:ar}}
21757 !! html
21758 <p>العربية
21759 </p>
21760 !! end
21761
21762 !!test
21763 Padleft and padright as substr
21764 !! wikitext
21765 {{padleft:|3|abcde}}
21766 {{padright:|3|abcde}}
21767 !! html
21768 <p>abc
21769 abc
21770 </p>
21771 !! end
21772
21773 !!test
21774 Special parser function
21775 !! wikitext
21776 {{#special:RandomPage}}
21777 {{#special:BaDtItLe}}
21778 {{#special:Foobar}}
21779 !! html
21780 <p>Special:Random
21781 Special:Badtitle
21782 Special:Foobar
21783 </p>
21784 !! end
21785
21786 !!test
21787 Bug 34939 - Case insensitive link parsing ([HttP://])
21788 !! wikitext
21789 [HttP://MediaWiki.Org/]
21790 !! html/php
21791 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21792 </p>
21793 !! html/parsoid
21794 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21795 !! end
21796
21797 !!test
21798 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21799 !! wikitext
21800 [HttP://MediaWiki.Org/ MediaWiki]
21801 !! html
21802 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21803 </p>
21804 !! end
21805
21806 !!test
21807 Bug 34939 - Case insensitive link parsing (HttP://)
21808 !! wikitext
21809 HttP://MediaWiki.Org/
21810 !! html/php
21811 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21812 </p>
21813 !! html/parsoid
21814 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21815 !! end
21816
21817 !!test
21818 Disable TOC
21819 !! options
21820 notoc
21821 !! wikitext
21822 Lead
21823 == Section 1 ==
21824 == Section 2 ==
21825 == Section 3 ==
21826 == Section 4 ==
21827 == Section 5 ==
21828 !! html
21829 <p>Lead
21830 </p>
21831
21832 <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>
21833 <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>
21834 <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>
21835 <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>
21836 <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>
21837
21838 !! end
21839
21840
21841 ###
21842 ### Parsoid-specific tests
21843 ### Parsoid-PHP parser incompatibilities
21844 ###
21845 !!test
21846 1. SOL-sensitive wikitext tokens as template-args
21847 !!options
21848 parsoid=wt2html,wt2wt
21849 !! wikitext
21850 {{echo|*a}}
21851 {{echo|#a}}
21852 {{echo|:a}}
21853 !! html
21854 <span about="#mwt1" typeof="mw:Transclusion">
21855 </span><ul about="#mwt1"><li>a</li>
21856 </ul>
21857 <span about="#mwt2" typeof="mw:Transclusion">
21858 </span><ol about="#mwt2"><li>a</li>
21859 </ol>
21860 <span about="#mwt3" typeof="mw:Transclusion">
21861 </span><dl about="#mwt3"><dd>a</dd>
21862 </dl>
21863 !!end
21864
21865 #### -----------------------------------------------------------------
21866 #### Parsoid-specific functionality tests
21867 #### -----------------------------------------------------------------
21868
21869 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21870 # We know wt2wt will fail, but we expect selser to pass.
21871 # Due to the nature of our testing, wt2wt and selser tests will enter the
21872 # blacklist and we'll catch selser regressions based on changes to the
21873 # blacklist entries for selser tests.
21874 !! test
21875 1. Bad treebuilder fixup of formatting elt is cleaned up
21876 !! options
21877 parsoid=wt2html,wt2wt
21878 !! wikitext
21879 {|
21880 |
21881 <small>
21882 [[Image:Foobar.jpg|right|Test]]
21883 </small>
21884 |}
21885 !! html/parsoid
21886 <table>
21887 <tbody><tr><td>
21888 <small>
21889 <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>
21890 </small>
21891 </td></tr>
21892 </tbody></table>
21893 !! end
21894
21895 !! test
21896 2. Bad treebuilder fixup of formatting elt is cleaned up
21897 !! options
21898 parsoid=wt2html,wt2wt
21899 !! wikitext
21900 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21901
21902 <small>[[Image:Foobar.jpg|right|300px]]</small>
21903 !! html/parsoid
21904
21905 <p><b>foo</b></p>
21906 <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>
21907 <p><b>bar</b></p>
21908 <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>
21909 !! end
21910
21911 !! test
21912 3. Bad treebuilder fixup of formatting elt is cleaned up
21913 !! options
21914 parsoid=wt2html,wt2wt
21915 !! wikitext
21916 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21917 !! html/parsoid
21918 <p><small><b>foo</b></small></p>
21919 <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>
21920 <p><small><b>bar</b></small></p>
21921 !! end
21922
21923 !! test
21924 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21925 !! options
21926 parsoid=wt2html,wt2wt
21927 !! wikitext
21928 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21929 !! html/parsoid
21930 <p><b><small></small></b></p>
21931 <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>
21932 <p></p>
21933 !! end
21934
21935 #### ----------------------------------------------------------------
21936 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21937 #### tags. Parsoid's output for these tags differs from that of the
21938 #### PHP parser.
21939 #### ----------------------------------------------------------------
21940
21941 !!test
21942 Ref: 1. ref-location should be replaced with an index span
21943 !! wikitext
21944 A <ref>foo</ref>
21945 B <ref name="x">foo</ref>
21946 C <ref name="y" />
21947 <references />
21948 !! html/parsoid
21949 <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>
21950 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>
21951 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>
21952 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21953 <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>
21954 <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>
21955 <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>
21956 </ol>
21957 !!end
21958
21959 !!test
21960 Ref: 2. ref-tags with identical names should all get the same index
21961 !! wikitext
21962 A <ref name="x">foo</ref>
21963 B <ref name="x" />
21964 <references />
21965 !! html/parsoid
21966 <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>
21967 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>
21968 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21969 <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>
21970 </ol>
21971 !!end
21972
21973 !!test
21974 Ref: 3. spaces in ref-names should be ignored
21975 !! wikitext
21976 A <ref name="x">foo</ref>
21977 B <ref name=" x " />
21978 C <ref name= x />
21979 <references />
21980 !! html/parsoid
21981 <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>
21982 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>
21983 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>
21984 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21985 <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>
21986 </ol>
21987 !!end
21988
21989 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21990 !!test
21991 Ref: 4. 'constructor' should be accepted as a valid ref-name
21992 !! wikitext
21993 A <ref name="constructor">foo</ref>
21994 <references />
21995 !! html/parsoid
21996 <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>
21997 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21998 <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>
21999 </ol>
22000 !!end
22001
22002 !!test
22003 Ref: 5. body should accept generic wikitext
22004 !! wikitext
22005 A <ref>
22006 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22007 </ref>
22008
22009 <references />
22010 !! html/parsoid
22011 <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>
22012
22013 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22014 <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>
22015 </span></li>
22016 </ol>
22017 !!end
22018
22019 !!test
22020 Ref: 6. indent-pres should not be output in ref-body
22021 !! wikitext
22022 A <ref>
22023 foo
22024 bar
22025 baz
22026 </ref>
22027
22028 <references />
22029 !! html/parsoid
22030 <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>
22031
22032 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22033 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
22034 bar
22035 baz
22036 </span></li>
22037 </ol>
22038 !!end
22039
22040 !!test
22041 Ref: 7. No p-wrapping in ref-body
22042 !! wikitext
22043 A <ref>
22044 foo
22045
22046 bar
22047
22048
22049 baz
22050
22051
22052
22053 booz
22054 </ref>
22055
22056 <references />
22057 !! html/parsoid
22058 <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>
22059
22060 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22061 <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
22062
22063 bar
22064
22065
22066 baz
22067
22068
22069
22070 booz
22071 </span></li>
22072 </ol>
22073 !!end
22074
22075 !!test
22076 Ref: 8. transclusion wikitext has lower precedence
22077 !! wikitext
22078 A <ref> foo {{echo|</ref> B C}}
22079
22080 <references />
22081 !! html/parsoid
22082 <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>
22083 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22084 <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>
22085 </ol>
22086 !!end
22087
22088 !!test
22089 Ref: 9. unclosed comments should not leak out of ref-body
22090 !! wikitext
22091 A <ref> foo <!--</ref> B C
22092 <references />
22093 !! html/parsoid
22094 <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>
22095 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22096 <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>
22097 </ol>
22098 !!end
22099
22100 !!test
22101 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22102 !! wikitext
22103 A <ref> <b> foo </ref> B C
22104
22105 <references />
22106 !! html/parsoid
22107 <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>
22108
22109
22110 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22111 <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>
22112 </ol>
22113 !!end
22114
22115 !!test
22116 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22117 !! wikitext
22118 A <ref>foo</ref> B
22119 C <ref>bar</ref> D
22120 <references />
22121 !! html/parsoid
22122 <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
22123 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>
22124 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22125 <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>
22126 <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>
22127 </ol>
22128 !!end
22129
22130 !!test
22131 Ref: 12. ref-tags act as trailing newline migration barrier
22132 !! wikitext
22133 <!--the newline at the end of this line moves out of the p tag-->a
22134
22135 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22136 <ref />
22137
22138 c
22139 <references />
22140 !! html/parsoid
22141 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22142
22143
22144 <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>
22145 <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>
22146
22147 <p>c</p>
22148 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22149 <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>
22150 <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>
22151 !!end
22152
22153 !!test
22154 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22155 !! wikitext
22156 <ref>foo</ref> A
22157 <ref>bar
22158 </ref> B
22159 <references />
22160 !! html/parsoid
22161 <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
22162 <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>
22163 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22164 <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>
22165 <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
22166 </span></li>
22167 </ol>
22168 !!end
22169
22170 !!test
22171 Ref: 14. A nested ref-tag should be emitted as plain text
22172 !! wikitext
22173 <ref>foo <ref>bar</ref> baz</ref>
22174
22175 <references />
22176 !! html/parsoid
22177 <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>
22178 </p>
22179 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22180 <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>
22181 </ol>
22182 !!end
22183
22184 !!test
22185 Ref: 15. ref-tags with identical names should get identical indexes
22186 !! wikitext
22187 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22188 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22189
22190 <references />
22191 !! html/parsoid
22192 <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>
22193 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>
22194
22195 <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>
22196 </ol>
22197 !!end
22198
22199 ## We don't bother wt2wt-ing non-standard whitespace
22200 !!test
22201 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22202 !!options
22203 parsoid=wt2html
22204 !! wikitext
22205 A <ref >foo</ref >
22206
22207 <references />
22208 !! html/parsoid
22209 <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>
22210 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22211 <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>
22212 !!end
22213
22214 !!test
22215 Ref: 17. Generate valid HTML5 id/about attributes
22216 !!wikitext
22217 <ref name="a b">foo</ref>
22218
22219 <references />
22220 !!html/parsoid
22221 <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>
22222 </p>
22223
22224 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22225 <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>
22226 </ol>
22227 !!end
22228
22229 !!test
22230 Ref: 18. T58916: Extension attributes should be parsed as plain text
22231 !!wikitext
22232 <ref name="{{echo|a}}">foo</ref>
22233
22234 <references />
22235 !!html/parsoid
22236 <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>
22237 </p>
22238
22239 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22240 <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>
22241 </ol>
22242 !!end
22243
22244 !!test
22245 Ref: 19. ref-tags with identical name encodings should get identical indexes
22246 !! wikitext
22247 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22248
22249 <references />
22250 !! html/parsoid
22251 <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>
22252 </p>
22253 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22254 <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>
22255 </ol>
22256 !!end
22257
22258 !!test
22259 Ref: 20. ref-tags with identical names but different content should keep it
22260 !! wikitext
22261 A <ref name="foo">Foo one</ref>
22262 B <ref name="foo">Foo two</ref>
22263 C <ref name="foo" />
22264
22265 <references />
22266 !! html/parsoid
22267 <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>
22268 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>
22269 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>
22270
22271 <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>
22272 </ol>
22273 !!end
22274
22275 !!test
22276 References: 1. references tag without any refs should be handled properly
22277 !! wikitext
22278 <references />
22279 !! html/parsoid
22280 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22281 !!end
22282
22283 !!test
22284 References: 2. references tag with group only outputs references from that group
22285 !! wikitext
22286 A <ref group="a">foo</ref>
22287 B <ref group="b">bar</ref>
22288 C <ref>baz</ref>
22289
22290 <references group="a" />
22291 <references />
22292 <references group="b" />
22293 !! html/parsoid
22294 <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>
22295 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>
22296 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>
22297
22298 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22299 <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>
22300 </ol>
22301 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22302 <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>
22303 </ol>
22304 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22305 <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>
22306 </ol>
22307 !!end
22308
22309 !!test
22310 References: 3. ref list should be cleared after processing references
22311 !! wikitext
22312 A <ref>foo</ref>
22313
22314 <references />
22315
22316 B <ref>bar</ref>
22317
22318 <references />
22319 !! html/parsoid
22320 <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>
22321
22322 <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>
22323 </ol>
22324
22325 <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>
22326
22327 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22328 <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>
22329 </ol>
22330 !!end
22331
22332 !!test
22333 References: 4. only referenced group should be cleared after processing references
22334 !! wikitext
22335 A <ref group="a">afoo</ref>
22336 B <ref>bfoo</ref>
22337
22338 <references group="a" />
22339
22340 C <ref>cfoo</ref>
22341
22342 <references />
22343 !! html/parsoid
22344 <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>
22345 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>
22346
22347 <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>
22348 </ol>
22349
22350 <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>
22351
22352 <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>
22353 </ol>
22354 !!end
22355
22356 ## Don't expect this to rt since we're dropping content
22357 !! test
22358 References: 5. ref tags in references should be processed while ignoring all other content
22359 !! options
22360 parsoid=wt2html,html2html
22361 !! wikitext
22362 A <ref name="a" />
22363 B <ref name="b">bar</ref>
22364
22365 <references>
22366 <ref name="a">foo</ref>
22367 This should just get lost.
22368 </references>
22369 !! html/parsoid
22370 <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>
22371 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>
22372
22373
22374 <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>
22375 </ol>
22376 !! end
22377
22378 !! test
22379 References: 6. <references /> from a transclusion
22380 !! wikitext
22381 <ref>Foo</ref> {{echo|<references />}}
22382 !! html/parsoid
22383 <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>
22384 </ol>
22385 !! end
22386
22387 !! test
22388 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22389 !! wikitext
22390 A <ref>foo bar for a</ref>
22391 B <ref group="X" name="b" />
22392
22393 <references />
22394
22395 <references group="X">
22396 <ref name="b">foo</ref>
22397 </references>
22398 !! html/parsoid
22399 <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>
22400 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>
22401 </p>
22402
22403 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22404 <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>
22405 </ol>
22406
22407 <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"}}'>
22408 <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>
22409 </ol>
22410 !! end
22411
22412 !! test
22413 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22414 !! wikitext
22415 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22416 <references />
22417 !! html/parsoid
22418 <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>
22419 <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>
22420 </ol>
22421 !!end
22422
22423 # This test only works in wt2html now as the <references /> are always generated
22424 # unless selser is active. Once T72722 is fixed, we should add a changes test
22425 # here to ensure that unrelated changes don't add the new <references />
22426 # when selser is active.
22427 !! test
22428 References: 9. Generate missing references list at the end
22429 !! wikitext
22430 A <ref>foo</ref>
22431 B <ref group="inexistent">bar</ref>
22432 !! html/parsoid
22433 <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>
22434 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22435 <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>
22436 </ol>
22437 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22438 <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>
22439 </ol>
22440 !! end
22441
22442 !! test
22443 References: 10. New <references/> shouldn't be added for unrelated edits.
22444 !! options
22445 parsoid={
22446 "modes": ["selser"],
22447 "changes": [["#x", "remove"]],
22448 "selser": "noauto"
22449 }
22450 !! wikitext
22451 Unrelated text<span id="x"> that's going to disappear</span>.
22452 A <ref>foo</ref>
22453 !! wikitext/edited
22454 Unrelated text.
22455 A <ref>foo</ref>
22456 !!end
22457
22458 !! test
22459 Entities in ref name
22460 !! wikitext
22461 <ref name="test &amp; me">hi</ref>
22462 <references />
22463 !! html/parsoid
22464 <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>
22465 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22466 <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>
22467 </ol>
22468 !! end
22469
22470 ## The output here may look funny, but it's what the php parser will do. The
22471 ## unclosed references tag becomes escaped text, and then a new references
22472 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22473 ## nowiki tags, and the auto-generated references tag is only dropped in
22474 ## rtTestMode.
22475 !! test
22476 Generate references for unclosed references tag
22477 !! options
22478 parsoid=wt2html
22479 !! wikitext
22480 a<ref>foo</ref>
22481
22482 <references>
22483 !! html/parsoid
22484 <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>
22485
22486 <p>&lt;references></p>
22487 <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>
22488 !! end
22489
22490 !! test
22491 New reference serializes on its own line
22492 !! options
22493 parsoid=wt2wt,html2wt
22494 !! wikitext
22495 foo
22496 <references />
22497 !! html/parsoid
22498 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22499 !! end
22500
22501 #### ----------------------------------------------------------------
22502 #### Parsoid-only testing of Parsoid's impl of LST
22503 #### Not implemented yet, see
22504 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22505 #### ----------------------------------------------------------------
22506
22507 !! test
22508 LST Sections: 1. Simple section start and end
22509 !! options
22510 parsoid={ "suppressErrors": true }
22511 !! wikitext
22512 <section begin="2011-05-16" />
22513 <section end="2014-04-10 (MW 1.23wmf22)" />
22514 !! html/parsoid
22515 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22516 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22517 !! end
22518
22519 #--------- Test stripping of empty nodes in template content ----------
22520 !!test
22521 Empty LI and TR nodes should be stripped from template content
22522 !!wikitext
22523 {{EmptyLITest}}
22524 {{EmptyTRTest}}
22525 !!html/parsoid
22526 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22527 <li>a</li>
22528 <li>b</li>
22529 </ul>
22530 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22531 <tbody>
22532 <tr>
22533 <td>foo</td>
22534 </tr>
22535 <tr>
22536 <td>bar</td>
22537 </tr>
22538 </tbody>
22539 </table>
22540 !!end
22541
22542 !!test
22543 Empty LI and TR nodes should not be stripped from top-level content
22544 !!wikitext
22545 * a
22546 *
22547 * b
22548 {|
22549 |-
22550 |-
22551 |foo
22552 |}
22553 !!html/parsoid
22554 <ul>
22555 <li> a</li>
22556 <li></li>
22557 <li> b</li>
22558 </ul>
22559 <table>
22560 <tbody>
22561 <tr></tr>
22562 <tr>
22563 <td>foo</td>
22564 </tr>
22565 </tbody>
22566 </table>
22567 !!end
22568
22569 !!test
22570 Empty TR nodes should not be stripped if they have any attributes set
22571 !!wikitext
22572 {{EmptyTRWithHTMLAttrTest}}
22573 !!html/parsoid
22574 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22575 <tr align="center"></tr>
22576 <tr><td>foo</td></tr>
22577 <tr align="center"></tr>
22578 <tr><td>bar</td></tr>
22579 </table>
22580 !!end
22581
22582 #### ----------------------------------------------------------------
22583 #### The following section of tests are primarily to test
22584 #### wikitext escaping capabilities of Parsoid. Given that
22585 #### escaping can be done any number of ways, the wikitext (input)
22586 #### is always adjusted to reflect how Parsoid adds nowiki
22587 #### escape tags.
22588 ####
22589 #### We are marking several tests as parsoid-only since the
22590 #### HTML in the result section is different from what the
22591 #### PHP parser generates for it.
22592 #### ----------------------------------------------------------------
22593
22594
22595 #### --------------- Headings ---------------
22596 #### 0. Unnested
22597 #### 1. Nested inside html <h1>=foo=</h1>
22598 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22599 #### 3. Nested inside html with wikitext split by html tags
22600 #### 4. No escape needed
22601 #### 5. Empty headings <h1></h1>
22602 #### 6. Heading chars in SOL context
22603 #### ----------------------------------------
22604 !! test
22605 Headings: 0. Unnested
22606 !! options
22607 parsoid=html2wt
22608 !! html/parsoid
22609 <p>=foo=</p>
22610
22611 <p> =foo=
22612 <!--cmt-->
22613 =foo=</p>
22614
22615 <p>=foo<i>a</i>=</p>
22616 !! wikitext
22617 <nowiki>=foo=</nowiki>
22618
22619 <nowiki> </nowiki>=foo=
22620 <!--cmt-->
22621 <nowiki>=foo=</nowiki>
22622
22623 =foo''a''<nowiki>=</nowiki>
22624 !!end
22625
22626 # New headings and existing headings are handled differently
22627 !! test
22628 Headings: 1. Nested inside html
22629 !! options
22630 parsoid=html2wt
22631 !! html/parsoid
22632 <h1>=foo=</h1>
22633 <h2>=foo=</h2>
22634 <h3>=foo=</h3>
22635
22636 <h1 data-parsoid=''>=foo=</h1>
22637 <h2 data-parsoid=''>=foo=</h2>
22638 <h3 data-parsoid=''>=foo=</h3>
22639 <h4 data-parsoid=''>=foo=</h4>
22640 <h5 data-parsoid=''>=foo=</h5>
22641 <h6 data-parsoid=''>=foo=</h6>
22642 !! wikitext
22643 = =foo= =
22644
22645 == =foo= ==
22646
22647 === =foo= ===
22648
22649 =<nowiki>=foo=</nowiki>=
22650 ==<nowiki>=foo=</nowiki>==
22651 ===<nowiki>=foo=</nowiki>===
22652 ====<nowiki>=foo=</nowiki>====
22653 =====<nowiki>=foo=</nowiki>=====
22654 ======<nowiki>=foo=</nowiki>======
22655
22656 !!end
22657
22658 !! test
22659 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22660 !! options
22661 parsoid=html2wt
22662 !! html/parsoid
22663 <h1>foo</h1>*bar
22664 <h1>foo</h1>=bar
22665 <h1>foo</h1>=bar=
22666 !! wikitext
22667 = foo =
22668 <nowiki>*</nowiki>bar
22669
22670 = foo =
22671 =bar
22672
22673 = foo =
22674 <nowiki>=bar=</nowiki>
22675 !!end
22676
22677 !! test
22678 Headings: 3. Nested inside html with wikitext split by html tags
22679 !! options
22680 parsoid=html2wt
22681 !! html/parsoid
22682 <h1>=<b>bold</b>foo=</h1>
22683 !! wikitext
22684 = ='''bold'''foo= =
22685 !!end
22686
22687 !! test
22688 Headings: 4a. No escaping needed (testing just h1 and h2)
22689 !! options
22690 parsoid=html2wt
22691 !! html/parsoid
22692 <h1>=foo</h1>
22693 <h1>foo=</h1>
22694 <h1> =foo= </h1>
22695 <h1>=foo= bar</h1>
22696 <h2>=foo</h2>
22697 <h2>foo=</h2>
22698 <h1>=</h1>
22699 <h1><i>=</i>foo=</h1>
22700 !! wikitext
22701 = =foo =
22702
22703 = foo= =
22704
22705 = =foo= =
22706
22707 = =foo= bar =
22708
22709 == =foo ==
22710
22711 == foo= ==
22712
22713 = = =
22714
22715 = ''=''foo= =
22716 !!end
22717
22718 !! test
22719 Headings: 4b. No escaping needed (inside p-tags)
22720 !! options
22721 parsoid=html2wt
22722 !! html/parsoid
22723 <p>===
22724 =foo= x
22725 =foo= <s></s>
22726 </p>
22727 !! wikitext
22728 ===
22729 =foo= x
22730 =foo= <s></s>
22731 !!end
22732
22733 !! test
22734 Headings: 5. Empty headings
22735 !! options
22736 parsoid=html2wt
22737 !! html/parsoid
22738 <h1 data-parsoid='{}'></h1>
22739
22740 <h2 data-parsoid='{}'></h2>
22741
22742 <h3 data-parsoid='{}'></h3>
22743
22744 <h4 data-parsoid='{}'></h4>
22745
22746 <h5 data-parsoid='{}'></h5>
22747
22748 <h6 data-parsoid='{}'></h6>
22749 !! wikitext
22750 =<nowiki/>=
22751
22752 ==<nowiki/>==
22753
22754 ===<nowiki/>===
22755
22756 ====<nowiki/>====
22757
22758 =====<nowiki/>=====
22759
22760 ======<nowiki/>======
22761 !!end
22762
22763 !! test
22764 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22765 !! options
22766 parsoid=html2wt
22767 !! html/parsoid
22768 <p>=a=</p>
22769
22770 <p>=a=</p>
22771
22772 <p>=a=</p>
22773 !! wikitext
22774 <nowiki>=a=</nowiki>
22775
22776 <nowiki>=a=</nowiki>
22777
22778 <nowiki>=a=</nowiki>
22779 !!end
22780
22781 !! test
22782 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22783 !! options
22784 parsoid=html2wt
22785 !! html/parsoid
22786 <p>=a=
22787 b</p>
22788
22789 <p>=a=
22790 b</p>
22791
22792 <p>=a=
22793 b</p>
22794 !! wikitext
22795 <nowiki>=a=</nowiki>
22796 b
22797
22798 <nowiki>=a=</nowiki>
22799 b
22800
22801 <nowiki>=a=</nowiki>
22802 b
22803 !!end
22804
22805 !! test
22806 Headings: 6c. Heading chars in SOL context (leading newline break)
22807 !! options
22808 parsoid=html2wt
22809 !! html/parsoid
22810 <p>a
22811 =b=</p>
22812 !! wikitext
22813 a
22814 <nowiki>=b=</nowiki>
22815 !!end
22816
22817 !! test
22818 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22819 !! options
22820 parsoid=html2wt
22821 !! html/parsoid
22822 <!--c0--><p>=a=</p>
22823
22824 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22825 !! wikitext
22826 <!--c0--><nowiki>=a=</nowiki>
22827
22828 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22829 !!end
22830
22831 !! test
22832 Headings: 6d. Heading chars in SOL context (No escaping needed)
22833 !! options
22834 parsoid=html2wt
22835 !! html/parsoid
22836 =a=<div>b</div>
22837 !! wikitext
22838 =a=<div>b</div>
22839 !!end
22840
22841 !! test
22842 Headings: 7. Insert a newline between new content and headings
22843 !! options
22844 parsoid=html2wt
22845 !! html/parsoid
22846 <h2>NEW</h2>
22847 <p>new</p>
22848 <h2 data-parsoid='{}'>A</h2>
22849 <p data-parsoid='{}'>a</p>
22850 !! wikitext
22851 == NEW ==
22852 new
22853
22854 ==A==
22855 a
22856
22857 !! end
22858
22859 #### --------------- Lists ---------------
22860 #### 0. Outside nests (*foo, etc.)
22861 #### 1. Nested inside html <ul><li>*foo</li></ul>
22862 #### 2. Inside definition lists
22863 #### 3. Only bullets at start should be escaped
22864 #### 4. No escapes needed
22865 #### 5. No unnecessary escapes
22866 #### 6. Escape bullets in SOL position
22867 #### 7. Escape bullets in a multi-line context
22868 #### ----------------------------------------
22869
22870 !! test
22871 Lists: 0. Outside nests
22872 !! options
22873 parsoid=html2wt
22874 !! html/parsoid
22875 <p>*foo</p>
22876
22877 <p>#foo</p>
22878
22879 <p>;Foo:bar</p>
22880 !! wikitext
22881 <nowiki>*</nowiki>foo
22882
22883 <nowiki>#</nowiki>foo
22884
22885 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22886 !!end
22887
22888 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22889 ## to test wikitext escaping, and insignificant whitespace diffs
22890 ## cause PHP parser tests to barf
22891 !! test
22892 Lists: 1. Nested inside html (No unnecessary escapes)
22893 !! options
22894 parsoid=html2wt
22895 !! html/parsoid
22896 <ul>
22897 <li>*foo</li>
22898 <li>#foo</li>
22899 <li>:foo</li>
22900 <li>;foo</li>
22901 <li data-parsoid='{}'>*foo</li>
22902 <li data-parsoid='{}'>#foo</li>
22903 <li data-parsoid='{}'>:foo</li>
22904 <li data-parsoid='{}'>;foo</li>
22905 </ul>
22906
22907 <ol>
22908 <li>*foo</li>
22909 <li>#foo</li>
22910 <li>:foo</li>
22911 <li>;foo</li>
22912 <li data-parsoid='{}'>*foo</li>
22913 <li data-parsoid='{}'>#foo</li>
22914 <li data-parsoid='{}'>:foo</li>
22915 <li data-parsoid='{}'>;foo</li>
22916 </ol>
22917 !! wikitext
22918 * *foo
22919 * #foo
22920 * :foo
22921 * ;foo
22922 *<nowiki>*foo</nowiki>
22923 *<nowiki>#foo</nowiki>
22924 *<nowiki>:foo</nowiki>
22925 *<nowiki>;foo</nowiki>
22926
22927 # *foo
22928 # #foo
22929 # :foo
22930 # ;foo
22931 #<nowiki>*foo</nowiki>
22932 #<nowiki>#foo</nowiki>
22933 #<nowiki>:foo</nowiki>
22934 #<nowiki>;foo</nowiki>
22935 !!end
22936
22937 !! test
22938 Lists: 2. Inside definition lists
22939 !! options
22940 parsoid=html2wt
22941 !! html/parsoid
22942 <dl><dt>;foo</dt></dl>
22943 <dl><dt>:foo</dt></dl>
22944 <dl><dt>:foo</dt>
22945 <dd>bar</dd></dl>
22946 <dl><dd>:foo</dd></dl>
22947 !! wikitext
22948 ; ;foo
22949
22950 ; <nowiki>:foo</nowiki>
22951
22952 ; <nowiki>:foo</nowiki>
22953 : bar
22954
22955 : :foo
22956 !!end
22957
22958 !! test
22959 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22960 !! options
22961 parsoid=html2wt
22962 !! html/parsoid
22963 <ul>
22964 <li>*foo*bar</li>
22965 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22966 </ul>
22967 !! wikitext
22968 * *foo*bar
22969 *<nowiki>*foo</nowiki>''it''*bar
22970 !!end
22971
22972 !! test
22973 Lists: 4. No escapes needed
22974 !! options
22975 parsoid=html2wt
22976 !! html/parsoid
22977 <ul>
22978 <li>foo*bar
22979 </li>
22980 </ul>
22981 <ul>
22982 <li><i>foo</i>*bar
22983 </li>
22984 </ul>
22985 <ul>
22986 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22987 </li>
22988 </ul>
22989 <ul>
22990 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22991 </li>
22992 </ul>
22993 !! wikitext
22994 *foo*bar
22995
22996 *''foo''*bar
22997
22998 *[[Foo]]: bar
22999
23000 *[[Foo]]*bar
23001 !!end
23002
23003 !! test
23004 Lists: 5. No unnecessary escapes
23005 !! options
23006 parsoid=html2wt
23007 !! html/parsoid
23008 <ul><li> bar <span>[[foo]]</span></li></ul>
23009 <ul><li> =bar <span>[[foo]]</span></li></ul>
23010 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23011 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23012 <ul><li> =bar <span>foo]]</span>=</li></ul>
23013 <ul><li> <s></s>: a</li></ul>
23014 <ul><li> <i>* foo</i></li></ul>
23015
23016 !! wikitext
23017 * bar <span><nowiki>[[foo]]</nowiki></span>
23018
23019 * =bar <span><nowiki>[[foo]]</nowiki></span>
23020
23021 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23022
23023 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23024
23025 * =bar <span>foo]]</span>=
23026
23027 * <s></s>: a
23028
23029 * ''* foo''
23030 !!end
23031
23032 !! test
23033 Lists: 6. Escape bullets in SOL position
23034 !! options
23035 parsoid=html2wt
23036 !! html/parsoid
23037 <p><!--cmt-->*foo</p>
23038 !! wikitext
23039 <!--cmt--><nowiki>*</nowiki>foo
23040 !!end
23041
23042 !! test
23043 Lists: 7. Escape bullets in a multi-line context
23044 !! options
23045 parsoid=html2wt
23046 !! html/parsoid
23047 <p>a
23048 *b
23049 </p>
23050 !! wikitext
23051 a
23052 <nowiki>*</nowiki>b
23053 !!end
23054
23055 !! test
23056 Lists: 8. Escape colons only if not present in tags
23057 !! options
23058 parsoid=html2wt
23059 !! html/parsoid
23060 <dl><dt>a:b<i>c:d</i></dt></dl>
23061 !! wikitext
23062 ; <nowiki>a:b</nowiki>''c:d''
23063 !! end
23064
23065 #### --------------- HRs ---------------
23066 #### 1. Single line
23067 #### -----------------------------------
23068
23069 !! test
23070 HRs: 1. Single line
23071 !! options
23072 parsoid=html2wt
23073 !! html/parsoid
23074 <hr />----
23075 <hr />=foo=
23076 <hr />*foo
23077 !! wikitext
23078 ----<nowiki>----</nowiki>
23079 ----=foo=
23080 ----*foo
23081 !! end
23082
23083 #### --------------- Tables ---------------
23084 #### 1a. Simple example
23085 #### 1b. No escaping needed (!foo)
23086 #### 1c. No escaping needed (|foo)
23087 #### 1d. No escaping needed (|}foo)
23088 ####
23089 #### 2a. Nested in td (<td>foo|bar</td>)
23090 #### 2b. Nested in td (<td>foo||bar</td>)
23091 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23092 ####
23093 #### 3a. Nested in th (<th>foo!bar</th>)
23094 #### 3b. Nested in th (<th>foo!!bar</th>)
23095 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23096 ####
23097 #### 4a. Escape -
23098 #### 4b. Escape +
23099 #### 4c. No escaping needed
23100 #### --------------------------------------
23101
23102 !! test
23103 Tables: 1a. Simple example
23104 !! options
23105 parsoid=html2wt
23106 !! html/parsoid
23107 <p>{|
23108 |}
23109 </p>
23110 !! wikitext
23111 <nowiki>{|</nowiki>
23112 |}
23113 !! end
23114
23115 !! test
23116 Tables: 1b. No escaping needed
23117 !! options
23118 parsoid=html2wt
23119 !! html/parsoid
23120 <p>!foo
23121 </p>
23122 !! wikitext
23123 !foo
23124 !! end
23125
23126 !! test
23127 Tables: 1c. No escaping needed
23128 !! options
23129 parsoid=html2wt
23130 !! html/parsoid
23131 <p>|foo
23132 </p>
23133 !! wikitext
23134 |foo
23135 !! end
23136
23137 !! test
23138 Tables: 1d. No escaping needed
23139 !! options
23140 parsoid=html2wt
23141 !! html/parsoid
23142 <p>|}foo
23143 </p>
23144 !! wikitext
23145 |}foo
23146 !! end
23147
23148 !! test
23149 Tables: 2a. Nested in td
23150 !! options
23151 parsoid=html2wt
23152 !! html/parsoid
23153 <table><tbody><tr>
23154 <td>foo|bar</td></tr>
23155 <tr><td>x<div>a|b</div></td>
23156 </tbody></table>
23157 !! wikitext
23158 {|
23159 |<nowiki>foo|bar</nowiki>
23160 |-
23161 |x<div><nowiki>a|b</nowiki></div>
23162 |}
23163 !! html/php+tidy
23164 <table>
23165 <tr>
23166 <td>foo|bar</td>
23167 </tr>
23168 <tr>
23169 <td>x
23170 <div>a|b</div>
23171 </td>
23172 </tr>
23173 </table>
23174 !! end
23175
23176 !! test
23177 Tables: 2b. Nested in td
23178 !! options
23179 parsoid=html2wt
23180 !! html/parsoid
23181 <table><tbody><tr>
23182 <td>foo||bar</td>
23183 <td>a<i>b||c</i></td>
23184 <td>a<i><div>b||c</div></i></td>
23185 </tr></tbody></table>
23186 !! wikitext
23187 {|
23188 |<nowiki>foo||bar</nowiki>
23189 |a''<nowiki>b||c</nowiki>''
23190 |a''<div><nowiki>b||c</nowiki></div>''
23191 |}
23192 !! html/php
23193 <table>
23194 <tr>
23195 <td>foo||bar
23196 </td>
23197 <td>a<i>b||c</i>
23198 </td>
23199 <td>a<i><div>b||c</div></i>
23200 </td></tr></table>
23201
23202 !! end
23203
23204 !! test
23205 Tables: 2c. Nested in td -- no escaping needed
23206 !! options
23207 parsoid=html2wt
23208 !! html/*
23209 <table>
23210 <tr>
23211 <td>foo!!bar
23212 </td></tr></table>
23213
23214 !! wikitext
23215 {|
23216 |foo!!bar
23217 |}
23218 !! end
23219
23220 !! test
23221 Tables: 3a. Nested in th
23222 !! options
23223 parsoid=html2wt
23224 !! html/*
23225 <table>
23226 <tr>
23227 <th>foo!bar
23228 </th></tr></table>
23229
23230 !! wikitext
23231 {|
23232 !foo!bar
23233 |}
23234 !! end
23235
23236 !! test
23237 Tables: 3b. Nested in th
23238 !! options
23239 parsoid=html2wt
23240 !! html/parsoid
23241 <table><tbody>
23242 <tr><th>foo!!bar</th>
23243 <th><i>foo|bar</i></th>
23244 <th><i>foo!!bar</i></th>
23245 <th><i><span>foo!!bar</span></i></th>
23246 </tr></tbody></table>
23247 !! wikitext
23248 {|
23249 !<nowiki>foo!!bar</nowiki>
23250 !''<nowiki>foo|bar</nowiki>''
23251 !''<nowiki>foo!!bar</nowiki>''
23252 !''<span><nowiki>foo!!bar</nowiki></span>''
23253 |}
23254 !! html/php
23255 <table>
23256 <tr>
23257 <th>foo!!bar
23258 </th>
23259 <th><i>foo|bar</i>
23260 </th>
23261 <th><i>foo!!bar</i>
23262 </th>
23263 <th><i><span>foo!!bar</span></i>
23264 </th></tr></table>
23265
23266 !! end
23267
23268 !! test
23269 Tables: 3c. Nested in th
23270 !! options
23271 parsoid=html2wt
23272 !! html/parsoid
23273 <table><tbody>
23274 <tr><th>foo||bar</th>
23275 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23276 </tr></tbody></table>
23277 !! wikitext
23278 {|
23279 !<nowiki>foo||bar</nowiki>
23280 !<nowiki>foo||bar</nowiki>
23281 |}
23282 !! html/php
23283 <table>
23284 <tr>
23285 <th>foo||bar
23286 </th>
23287 <th>foo||bar
23288 </th></tr></table>
23289
23290 !! end
23291
23292 !! test
23293 Tables: 4a. Escape -
23294 !! options
23295 parsoid=html2wt
23296 !! html/*
23297 <table>
23298 <tr>
23299 <th>-bar
23300 </th></tr>
23301 <tr>
23302 <td>-bar
23303 </td></tr></table>
23304
23305 !! wikitext
23306 {|
23307 !-bar
23308 |-
23309 |<nowiki>-bar</nowiki>
23310 |}
23311 !! end
23312
23313 !! test
23314 Tables: 4b. Escape +
23315 !! options
23316 parsoid=html2wt
23317 !! html/*
23318 <table>
23319 <tr>
23320 <th>+bar
23321 </th></tr>
23322 <tr>
23323 <td>+bar
23324 </td></tr></table>
23325
23326 !! wikitext
23327 {|
23328 !+bar
23329 |-
23330 |<nowiki>+bar</nowiki>
23331 |}
23332 !! end
23333
23334 !! test
23335 Tables: 4c. No escaping needed
23336 !! options
23337 parsoid=html2wt
23338 !! html/parsoid
23339 <table><tbody>
23340 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23341 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23342 <tr><td>foo
23343 <p>bar|baz
23344 +bar
23345 -bar</p></td></tr>
23346 <tr><td>x
23347 <div>a|b</div></td>
23348 </tbody></table>
23349 !! wikitext
23350 {|
23351 |foo-bar
23352 |foo+bar
23353 |-
23354 |''foo''-bar
23355 |''foo''+bar
23356 |-
23357 |foo
23358 bar|baz
23359 +bar
23360 -bar
23361 |-
23362 |x
23363 <div>a|b</div>
23364 |}
23365 !! html/php
23366 <table>
23367 <tr>
23368 <td>foo-bar
23369 </td>
23370 <td>foo+bar
23371 </td></tr>
23372 <tr>
23373 <td><i>foo</i>-bar
23374 </td>
23375 <td><i>foo</i>+bar
23376 </td></tr>
23377 <tr>
23378 <td>foo
23379 <p>bar|baz
23380 +bar
23381 -bar
23382 </p>
23383 </td></tr>
23384 <tr>
23385 <td>x
23386 <div>a|b</div>
23387 </td></tr></table>
23388
23389 !! end
23390
23391 !! test
23392 Tables: 4d. No escaping needed
23393 !! options
23394 parsoid=html2wt
23395 !! html/parsoid
23396 <table>
23397 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23398 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23399 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23400 </tbody></table>
23401 !! wikitext
23402 {|
23403 |[[Foo]]-bar
23404 ||+1
23405 ||-2
23406 |}
23407 !! html/php
23408 <table>
23409 <tr>
23410 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23411 </td>
23412 <td>+1
23413 </td>
23414 <td>-2
23415 </td></tr></table>
23416
23417 !! end
23418
23419 !! test
23420 T97430: Don't emit empty nowiki pairs around marker meta tags
23421 !! options
23422 parsoid=html2wt
23423 !! html/parsoid
23424 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23425 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23426 !! wikitext
23427 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23428 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23429 !! end
23430
23431 !! test
23432 Unclosed xmlish element in table line shouldn't eat end delimiters
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <table>
23437 <tbody><tr><td> &lt;foo</td>
23438 <td> bar></td></tr>
23439 </tbody></table>
23440 !! wikitext
23441 {|
23442 | <foo
23443 | bar>
23444 |}
23445 !! html/php
23446 <table>
23447 <tr>
23448 <td> &lt;foo
23449 </td>
23450 <td> bar&gt;
23451 </td></tr></table>
23452
23453 !! end
23454
23455 #### --------------- Links ----------------
23456 #### 1. Quote marks in link text
23457 #### 2. Wikilinks: Escapes needed
23458 #### 3. Wikilinks: No escapes needed
23459 #### 4. Extlinks: Escapes needed
23460 #### 5. Extlinks: No escapes needed
23461 #### --------------------------------------
23462 !! test
23463 Links 1. WikiLinks: No escapes needed
23464 !! options
23465 parsoid=html2wt
23466 !! html/parsoid
23467 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23468 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23469 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23470 !! wikitext
23471 [[Foo|Foo''boo'']]
23472 [[Foo|[Foobar]]]
23473 [[Foo|x [Foobar] x]]
23474 !! html/php
23475 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23476 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23477 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23478 </p>
23479 !! end
23480
23481 !! test
23482 Links 2. WikiLinks: Escapes needed
23483 !! options
23484 parsoid=html2wt
23485 !! html/parsoid
23486 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23487 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23488 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23489 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23490 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23491 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23492 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23493 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23494 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23495 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23496 !! wikitext
23497 [[Foo|<nowiki>Foobar]</nowiki>]]
23498 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23499 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23500 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23501 [[Foo|<nowiki>|Bar</nowiki>]]
23502 [[Foo|<nowiki>]]bar</nowiki>]]
23503 [[Foo|<nowiki>[[bar</nowiki>]]
23504 [[Foo|<nowiki>x [[ y</nowiki>]]
23505 [[Foo|<nowiki>x ]] y</nowiki>]]
23506 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23507 !! html/php
23508 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23509 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23510 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23511 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23512 <a href="/wiki/Foo" title="Foo">|Bar</a>
23513 <a href="/wiki/Foo" title="Foo">]]bar</a>
23514 <a href="/wiki/Foo" title="Foo">[[bar</a>
23515 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23516 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23517 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23518 </p>
23519 !! end
23520
23521 !! test
23522 Links 3. WikiLinks: No escapes needed
23523 !! options
23524 parsoid=html2wt
23525 !! html/parsoid
23526 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23527 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23528 !! wikitext
23529 [[Foo|[Foobar]]
23530 [[Foo|foo|bar]]
23531 !! html/php
23532 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23533 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23534 </p>
23535 !! end
23536
23537 !! test
23538 Links 4. ExtLinks: Escapes needed
23539 !! options
23540 parsoid=html2wt
23541 !! html/parsoid
23542 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23543 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23544 <p>[http://google.com]</p>
23545 <p>[http://google.com google]</p>
23546 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23547 <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>
23548 !! wikitext
23549 [http://google.com <nowiki>[google]</nowiki>]
23550 [http://google.com <nowiki>google]</nowiki>]
23551
23552 <nowiki>[http://google.com]</nowiki>
23553
23554 <nowiki>[http://google.com google]</nowiki>
23555
23556 [http://google.com<nowiki>]</nowiki>
23557
23558 [{{echo|http://google.com}}<nowiki>]</nowiki>
23559 !! html/php
23560 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23561 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23562 </p><p>[http://google.com]
23563 </p><p>[http://google.com google]
23564 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23565 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23566 </p>
23567 !! end
23568
23569 !! test
23570 Links 5. ExtLinks: No escapes needed
23571 !! options
23572 parsoid=html2wt
23573 !! html/parsoid
23574 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23575 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23576 !! wikitext
23577 [http://google.com [google]
23578
23579 [[http://google.com]]
23580 !! html/php
23581 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23582 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23583 </p>
23584 !! end
23585
23586 !! test
23587 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23588 !! options
23589 parsoid=html2wt
23590 !! html/parsoid
23591 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23592 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23593 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23594 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23595 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23596 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23597 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23598 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23599 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23600 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23601 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23602 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23603 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23604 </p>
23605 !! wikitext
23606 x<nowiki/>http://example.com<nowiki/>y
23607 http://example.com<nowiki/>?x
23608 http://example.com<nowiki/>&x
23609 http://example.com<nowiki/>'x
23610 http://example.com<nowiki/>,x
23611 http://example.com<nowiki/>.x
23612 http://example.com<nowiki/>;x
23613 http://example.com<nowiki/>:x
23614 http://example.com<nowiki/>;x
23615 http://example.com<nowiki/>!x
23616 http://example.com<nowiki/>=x
23617 http://example.com<nowiki/>(x)
23618 http://example.com(x<nowiki/>)
23619 !! end
23620
23621 !! test
23622 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23623 !! options
23624 parsoid=html2wt
23625 !! html/parsoid
23626 <p>x
23627 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23628 y
23629 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23630 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23631 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23632 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23633 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23634 </p>
23635 !! wikitext
23636 x
23637 http://example.com
23638 y
23639 "http://example.com"
23640 (http://example.com)
23641 (http://example.com) foo
23642 http://example.com,
23643 http://example.com, foo
23644 !! html/php
23645 <p>x
23646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23647 y
23648 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23649 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23650 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23651 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23652 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23653 </p>
23654 !! end
23655
23656 !! test
23657 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23658 !! options
23659 parsoid=html2wt
23660 !! html/parsoid
23661 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23662 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23663 !! wikitext
23664 http://example.com.,;:!?\
23665 -http://example.com:
23666 !! html/php
23667 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23668 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23669 </p>
23670 !! end
23671
23672 !! test
23673 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23674 !! options
23675 parsoid=html2wt
23676 !! html/parsoid
23677 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23678 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23679 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23680 !! wikitext
23681 RFC 123<nowiki/>4
23682 RFC 123<nowiki/>y
23683 X<nowiki/>RFC 123<nowiki/>y
23684 !! end
23685
23686 !! test
23687 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23688 !! options
23689 parsoid=html2wt
23690 !! html/parsoid
23691 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23692 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23693 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23694 </p>
23695 !! wikitext
23696 RFC 123?foo
23697 RFC 123&foo
23698 -RFC 123-
23699 !! html/php
23700 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23701 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23702 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23703 </p>
23704 !! end
23705
23706 !! test
23707 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23708 !! options
23709 parsoid=html2wt
23710 !! html/parsoid
23711 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23712 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23713 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23714 !! wikitext
23715 PMID 123<nowiki/>4
23716 PMID 123<nowiki/>y
23717 X<nowiki/>PMID 123<nowiki/>y
23718 !! end
23719
23720 !! test
23721 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23722 !! options
23723 parsoid=html2wt
23724 !! html/parsoid
23725 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23726 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23727 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23728 </p>
23729 !! wikitext
23730 PMID 123?foo
23731 PMID 123&foo
23732 -PMID 123-
23733 !! html/php
23734 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23735 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23736 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23737 </p>
23738 !! end
23739
23740 !! test
23741 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23742 !! options
23743 parsoid=html2wt
23744 !! html/parsoid
23745 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23746 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23747 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23748 </p>
23749 !! wikitext
23750 ISBN 1234567890<nowiki/>1
23751 ISBN 1234567890<nowiki/>x
23752 a<nowiki/>ISBN 1234567890<nowiki/>b
23753 !! end
23754
23755 !! test
23756 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23757 !! options
23758 parsoid=html2wt
23759 !! html/parsoid
23760 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23761 !! wikitext
23762 -ISBN 1234567890's
23763 !! html/php
23764 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23765 </p>
23766 !! end
23767
23768 !! test
23769 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23770 !! options
23771 parsoid=html2wt
23772 !! html/*
23773 <p>this is not a link: http://example.com
23774 </p>
23775 !! wikitext
23776 this is not a link: <nowiki>http://example.com</nowiki>
23777 !! end
23778
23779 !! test
23780 Links 15. Link trails can't become link prefixes.
23781 !! options
23782 language=is
23783 parsoid=html2wt
23784 !! html/parsoid
23785 <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>
23786 !! wikitext
23787 [[Söfnuður]]-[[00]]
23788 !! html/php
23789 <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>
23790 </p>
23791 !! end
23792
23793 #### --------------- Quotes ---------------
23794 #### 1. Quotes inside <b> and <i>
23795 #### 2. Link fragments separated by <i> and <b> tags
23796 #### 3. Link fragments inside <i> and <b>
23797 #### 4. No escaping needed
23798 #### --------------------------------------
23799 !! test
23800 1a. Quotes inside <b> and <i>
23801 !! options
23802 parsoid=html2wt
23803 !! html/*
23804 <p><i>'foo'</i>
23805 <i>''foo''</i>
23806 <i>'''foo'''</i>
23807 <i>foo</i>'s
23808 <b>'foo'</b>
23809 <b>''foo''</b>
23810 <b>'''foo'''</b>
23811 <b>foo'<i>bar'</i>baz</b>
23812 <b>foo</b>'s
23813 '<i>foo</i>
23814 <i>foo</i>'
23815 <i>foo'</i>'
23816 '<i>foo</i>'
23817 '<b>foo</b>
23818 <b>foo</b>'
23819 '<b>foo</b>'
23820 <i>fools'<span> errand</span></i>
23821 <i><span>fool</span>'s errand</i>
23822 '<i>foo</i> bar '<i>baz</i>
23823 a|!*#-:;+-~[]{}b'<i>x</i>
23824 </p>
23825 !! wikitext
23826 ''<nowiki/>'foo'''
23827 ''<nowiki>''foo''</nowiki>''
23828 ''<nowiki>'''foo'''</nowiki>''
23829 ''foo''<nowiki/>'s
23830 '''<nowiki/>'foo''''
23831 '''<nowiki>''foo''</nowiki>'''
23832 '''<nowiki>'''foo'''</nowiki>'''
23833 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23834 '''foo'''<nowiki/>'s
23835 '''foo''
23836 ''foo''<nowiki/>'
23837 ''foo'''<nowiki/>'
23838 '''foo''<nowiki/>'
23839 ''''foo'''
23840 '''foo'''<nowiki/>'
23841 ''''foo'''<nowiki/>'
23842 ''fools'<span> errand</span>''
23843 ''<span>fool</span>'s errand''
23844 '<nowiki/>''foo'' bar '''baz''
23845 a|!*#-:;+-~[]{}b'''x''
23846 !! end
23847
23848 !! test
23849 1b. Quotes inside <b> and <i> with other tags on same line
23850 !! options
23851 parsoid=html2wt
23852 !! html/parsoid
23853 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23854 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23855 <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>
23856 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23857 '<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>
23858 '<i>foo</i> <div title="name">test</div>
23859 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23860 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23861 <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>
23862 </ol>
23863 !! wikitext
23864 '''a'' foo ''[[bar]]''
23865 ''a''' foo ''[[bar]]''
23866 ''a''' foo '''{{echo|[[bar]]}}'''
23867 [[foo]] x'''[[bar]]''
23868 '''foo'' <ref>test</ref>
23869 '''foo'' <div title="name">test</div>
23870 '''foo'' and <br> bar
23871 <references />
23872 !! end
23873
23874 !! test
23875 2. Link fragments separated by <i> and <b> tags
23876 !! options
23877 parsoid=html2wt
23878 !! html/parsoid
23879 <p>[[<i>foo</i>hello]]</p>
23880 <p>[[<b>foo</b>hello]]</p>
23881 !! wikitext
23882 [[''foo''<nowiki>hello]]</nowiki>
23883
23884 [['''foo'''<nowiki>hello]]</nowiki>
23885 !! end
23886
23887 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23888 # this is one of the shortcomings of this format
23889 !! test
23890 3. Link fragments inside <i> and <b>
23891 !! options
23892 parsoid=html2wt
23893 !! html/parsoid
23894 <p><i>[[foo</i>]]</p>
23895 <p><b>[[foo</b>]]</p>
23896 !! wikitext
23897 ''[[foo''<nowiki>]]</nowiki>
23898
23899 '''[[foo'''<nowiki>]]</nowiki>
23900 !! end
23901
23902 !! test
23903 4. No escaping needed
23904 !! options
23905 options=html2wt
23906 !! html/parsoid
23907 <p>'<span><i>bar</i></span>'
23908 '<span><b>bar</b></span>'
23909 'a:b'foo
23910 </p>
23911 !! wikitext
23912 '<span>''bar''</span>'
23913 '<span>'''bar'''</span>'
23914 'a:b'foo
23915 !! end
23916
23917 #### ----------- Paragraphs ---------------
23918 #### 1. No unnecessary escapes
23919 #### --------------------------------------
23920
23921 !! test
23922 1. No unnecessary escapes
23923 !! options
23924 parsoid=html2wt
23925 !! html/parsoid
23926 <p>bar <span>[[foo]]</span>
23927 </p><p>=bar <span>[[foo]]</span>
23928 </p><p>[[bar <span>[[foo]]</span>
23929 </p><p>]]bar <span>[[foo]]</span>
23930 </p><p>=bar <span>foo]]</span>=
23931 </p>
23932 !! wikitext
23933 bar <span><nowiki>[[foo]]</nowiki></span>
23934
23935 =bar <span><nowiki>[[foo]]</nowiki></span>
23936
23937 [[bar <span><nowiki>[[foo]]</nowiki></span>
23938
23939 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23940
23941 =bar <span>foo]]</span><nowiki>=</nowiki>
23942 !!end
23943
23944 #### ----------------------- PRE --------------------------
23945 #### 1. Leading whitespace in SOL context should be escaped
23946 #### ------------------------------------------------------
23947 !! test
23948 1. Leading whitespace in SOL context should be escaped
23949 !! options
23950 parsoid=html2wt
23951 !! html/parsoid
23952 <p> a</p>
23953
23954 <p> a</p>
23955
23956 <p> a(tab)</p>
23957
23958 <p> a
23959 <!--cmt-->
23960 a</p>
23961
23962 <p>a
23963 b</p>
23964
23965 <p>a
23966 b</p>
23967
23968 <p>a
23969 b</p>
23970 !! wikitext
23971 <nowiki> </nowiki>a
23972
23973 <nowiki> </nowiki> a
23974
23975 a(tab)
23976
23977 <nowiki> </nowiki> a
23978 <!--cmt-->
23979 <nowiki> </nowiki>a
23980
23981 a
23982 <nowiki> </nowiki>b
23983
23984 a
23985 b
23986
23987 a
23988 b
23989 !! html/php
23990 <p> a
23991 </p><p> a
23992 </p><p> a(tab)
23993 </p><p> a
23994 a
23995 </p><p>a
23996 b
23997 </p><p>a
23998 b
23999 </p><p>a
24000 b
24001 </p>
24002 !! end
24003
24004 !! test
24005 2. Leading whitespace in non-indent-pre contexts should not be escaped
24006 !! options
24007 parsoid=html2wt
24008 !! html/parsoid
24009 <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>
24010 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24011 <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>
24012 b</span></li>
24013 </ol>
24014 !! wikitext
24015 foo <ref>''a''
24016 b</ref>
24017 <references />
24018 !! end
24019
24020 !! test
24021 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24022 !! options
24023 parsoid=html2wt
24024 !! html/parsoid
24025 <blockquote>
24026 <p>
24027 a
24028 <span>b</span>
24029 c</p>
24030 </blockquote>
24031 !! wikitext
24032 <blockquote>
24033 a
24034 <span>b</span>
24035 c
24036 </blockquote>
24037 !! end
24038
24039 !! test
24040 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24041 !! options
24042 options=html2wt
24043 !! html/parsoid
24044 <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>
24045 !! wikitext
24046 [[File:Foobar.jpg|thumb|caption]]
24047 !! end
24048
24049 !! test
24050 5. Nowiki escaping should account for indent-pres
24051 !! options
24052 parsoid=html2wt
24053 !! html/parsoid
24054 <pre>==foo==</pre>
24055 !! wikitext
24056 ==foo==
24057 !! end
24058
24059 !!test
24060 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24061 !! options
24062 parsoid=html2wt
24063 !! html/parsoid
24064 <pre>
24065 * foo
24066 * bar
24067 </pre>
24068 !! wikitext
24069 * foo
24070 * bar
24071 !! end
24072
24073 #### --------------- Behavior Switches --------------------
24074
24075 !! test
24076 1. Valid behavior switches should be escaped
24077 !! options
24078 parsoid=html2wt
24079 !! html/parsoid
24080 __TOC__
24081 <i>__TOC__</i>
24082 !! wikitext
24083 <nowiki>__TOC__</nowiki>
24084 ''<nowiki>__TOC__</nowiki>''
24085 !! end
24086
24087 !! test
24088 2. Invalid behavior switches should not be escaped
24089 !! options
24090 parsoid=html2wt
24091 !! html/parsoid
24092 __TOO__
24093 __|__
24094 !! wikitext
24095 __TOO__
24096 __|__
24097 !! end
24098
24099 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24100 !! test
24101 Behavior switches should be SOL-transparent
24102 !! options
24103 parsoid=html2wt
24104 !! html/parsoid
24105 <meta property="mw:PageProp/toc" />
24106
24107 <!-- this one's bogus -->
24108 <pre>__TOO__</pre>
24109
24110 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24111
24112 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24113 !! wikitext
24114 __TOC__
24115
24116 <!-- this one's bogus -->
24117 __TOO__
24118
24119 __TOC__ foo
24120
24121 __TOC__
24122 bar
24123 !! end
24124
24125 #### --------------- HTML tags ---------------
24126 #### 1. a tags
24127 #### 2. other tags
24128 #### 3. multi-line html tag
24129 #### 4. extension tags
24130 #### -----------------------------------------
24131 !! test
24132 1. a tags
24133 !! options
24134 parsoid=html2wt
24135 !! html/parsoid
24136 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24137 !! wikitext
24138 <a href="http://google.com">google</a>
24139 !! end
24140
24141 !! test
24142 2. other tags
24143 !! options
24144 parsoid=html2wt
24145 !! html/parsoid
24146 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24147 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24148 <li> &lt;td&gt;</li></ul>
24149
24150 !! wikitext
24151 * <nowiki><div>foo</div></nowiki>
24152 * <nowiki><div style="color:red">foo</div></nowiki>
24153 * <nowiki><td></nowiki>
24154 !! end
24155
24156 !! test
24157 3. multi-line html tag
24158 !! options
24159 parsoid=html2wt
24160 !! html/parsoid
24161 <p>&lt;div
24162 &gt;foo&lt;/div
24163 &gt;
24164 </p>
24165 !! wikitext
24166 <nowiki><div
24167 >foo</div
24168 ></nowiki>
24169 !! end
24170
24171 !! test
24172 4. extension tags
24173 !! options
24174 parsoid=html2wt
24175 !! html/parsoid
24176 <p>&lt;ref&gt;foo&lt;/ref&gt;
24177 </p><p>&lt;ref&gt;bar
24178 </p><p>baz&lt;/ref&gt;
24179 </p>
24180 !! wikitext
24181 <nowiki><ref>foo</ref></nowiki>
24182
24183 <nowiki><ref>bar</nowiki>
24184
24185 baz<nowiki></ref></nowiki>
24186 !! end
24187
24188 #### --------------- Others ---------------
24189 !! test
24190 Escaping nowikis
24191 !! options
24192 parsoid=html2wt
24193 !! html/parsoid
24194 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24195 </p>
24196 !! wikitext
24197 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24198 !! end
24199
24200 ## The quote-char in the input is necessary for triggering the bug
24201 !! test
24202 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24203 !! options
24204 parsoid=html2wt
24205 !! html/parsoid
24206 <p>foo's bar :</p>
24207 !! wikitext
24208 foo's bar :
24209 !! end
24210
24211 #----------- End of wikitext escaping tests --------------
24212
24213 !! test
24214
24215 Tag-like HTML structures are passed through as text
24216 !! wikitext
24217 <x y>
24218
24219 <x.y>
24220
24221 <x-y>
24222
24223 1>2
24224
24225 x<y
24226
24227 a>b
24228
24229 1<d e>f
24230 !! html
24231 <p>&lt;x y&gt;
24232 </p><p>&lt;x.y&gt;
24233 </p><p>&lt;x-y&gt;
24234 </p><p>1&gt;2
24235 </p><p>x&lt;y
24236 </p><p>a&gt;b
24237 </p><p>1&lt;d e&gt;f
24238 </p>
24239 !! end
24240
24241 !! test
24242 HTML tag with necessary entities in attributes
24243 !! wikitext
24244 <span title="&amp;amp;">foo</span>
24245 !! html
24246 <p><span title="&amp;amp;">foo</span>
24247 </p>
24248 !! end
24249
24250 !! test
24251 HTML tag with 'unnecessary' entity encoding in attributes
24252 !! wikitext
24253 <span title="&amp;">foo</span>
24254 !! html
24255 <p><span title="&amp;">foo</span>
24256 </p>
24257 !! end
24258
24259 !! test
24260 HTML tag with broken attribute value quoting
24261 !! options
24262 parsoid=wt2html,html2html
24263 !! wikitext
24264 <span title="Hello world>Foo</span>
24265 !! html/php
24266 <p><span title="Hello world">Foo</span>
24267 </p>
24268 !! html/parsoid
24269 <p><span title="Hello world">Foo</span></p>
24270 !! end
24271
24272 !! test
24273 Self-closed tag with broken attribute value quoting
24274 !! options
24275 parsoid=wt2html,html2html
24276 !! wikitext
24277 <div title="Hello world />Foo
24278 !! html/php+tidy
24279 <div title="Hello world"></div>
24280 <p>Foo</p>
24281 !! html/parsoid
24282 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24283 !! end
24284
24285 !! test
24286 Table with broken attribute value quoting
24287 !! options
24288 parsoid=wt2html,html2html
24289 !! wikitext
24290 {|
24291 | title="Hello world|Foo
24292 |}
24293 !! html/php
24294 <table>
24295 <tr>
24296 <td title="Hello world">Foo
24297 </td></tr></table>
24298
24299 !! html/parsoid
24300 <table>
24301 <tr>
24302 <td title="Hello world">Foo
24303 </td></tr></table>
24304
24305 !! end
24306
24307 !! test
24308 Table with broken attribute value quoting on consecutive lines
24309 !! options
24310 parsoid=wt2html,html2html
24311 !! wikitext
24312 {|
24313 | title="Hello world|Foo
24314 | style="color:red|Bar
24315 |}
24316 !! html/php
24317 <table>
24318 <tr>
24319 <td title="Hello world">Foo
24320 </td>
24321 <td style="color:red">Bar
24322 </td></tr></table>
24323
24324 !! html/parsoid
24325 <table><tbody>
24326 <tr>
24327 <td title="Hello world">Foo
24328 </td><td style="color: red">Bar
24329 </td></tr></tbody></table>
24330
24331 !! end
24332
24333 !!test
24334 Accept empty td cell attribute
24335 !! wikitext
24336 {|
24337 | align="center" | foo || |
24338 |}
24339 !! html
24340 <table>
24341 <tr>
24342 <td align="center"> foo </td>
24343 <td>
24344 </td></tr></table>
24345
24346 !!end
24347
24348 !!test
24349 Non-empty attributes in th-cells
24350 !! wikitext
24351 {|
24352 ! Foo !! style="color: red" | Bar
24353 |}
24354 !! html
24355 <table>
24356 <tr>
24357 <th> Foo </th>
24358 <th style="color: red"> Bar
24359 </th></tr></table>
24360
24361 !!end
24362
24363 !!test
24364 Accept empty attributes in th-cells
24365 !! wikitext
24366 {|
24367 !| foo !!| bar
24368 |}
24369 !! html
24370 <table>
24371 <tr>
24372 <th> foo </th>
24373 <th> bar
24374 </th></tr></table>
24375
24376 !!end
24377
24378 !!test
24379 Empty table rows go away
24380 !! wikitext
24381 {|
24382 | Hello
24383 | there
24384 |- class="foo"
24385 |-
24386 |}
24387 !! html
24388 <table>
24389 <tr>
24390 <td> Hello
24391 </td>
24392 <td> there
24393 </td></tr>
24394
24395 </table>
24396
24397 !! end
24398
24399 ###
24400 ### Parsoid-centric tests for testing RTing of inter-element separators
24401 ### Edge cases not tested by existing parser tests and specific to
24402 ### Parsoid-specific serialization strategies.
24403 ###
24404
24405 !!test
24406 RT-ed inter-element separators should be valid separators
24407 !! wikitext
24408 {|
24409 |- [[foo]]
24410 |}
24411 !! html/php
24412 <table>
24413
24414 </table>
24415
24416 !! html/parsoid
24417 <table>
24418 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24419 </tbody></table>
24420 !!end
24421
24422 # Parsoid-only since PHP parser relies on Tidy for correct output
24423 !!test
24424 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24425 !!options
24426 parsoid
24427 !! wikitext
24428 {|
24429 |<small>foo
24430 bar
24431 |}
24432
24433 {|
24434 |<small>foo<small>
24435 |}
24436 !! html
24437 <table>
24438 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24439 <p>bar</p></small></td></tr>
24440 </tbody></table>
24441
24442 <table>
24443 <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>
24444 </tbody></table>
24445 !!end
24446
24447 # Note that the "style" attribute is really a template parameter here.
24448 # The = would have to be {{=}} if you wanted the literal.
24449 !!test
24450 Empty TD followed by TD with tpl-generated attribute
24451 !! wikitext
24452 {|
24453 |-
24454 |
24455 |{{echo|style='color:red'}}|foo
24456 |}
24457 !! html
24458 <table>
24459
24460 <tr>
24461 <td>
24462 </td>
24463 <td>foo
24464 </td></tr></table>
24465
24466 !!end
24467
24468 !!test
24469 Indented table with an empty td
24470 !! wikitext
24471 {|
24472 |-
24473 |
24474 |foo
24475 |}
24476 !! html
24477 <table>
24478
24479 <tr>
24480 <td>
24481 </td>
24482 <td>foo
24483 </td></tr></table>
24484
24485 !!end
24486
24487 ## We have some newline diffs RT-ing this edge case
24488 ## and it is not important enough -- we seem to be emitting
24489 ## at most 2 newlines after a </tr> and this is unrelated to
24490 ## the issue from T85627 that this is testing.
24491 !!test
24492 Indented table with blank lines in between (T85627)
24493 !! options
24494 parsoid=wt2html
24495 !! wikitext
24496 {|
24497 |foo
24498
24499
24500 |}
24501 !! html
24502 <table>
24503
24504 <tr>
24505 <td>foo
24506 </td></tr></table>
24507
24508 !!end
24509
24510 !!test
24511 Indented block & table
24512 !! wikitext
24513 <div>foo</div>
24514 {|
24515 |foo
24516 |}
24517 !! html/php
24518 <div>foo</div>
24519 <table>
24520 <tr>
24521 <td>foo
24522 </td></tr></table>
24523
24524 !! html/parsoid
24525 <div data-parsoid='{"stx":"html"}'>foo</div>
24526 <table><tbody>
24527 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24528 </tbody></table>
24529 !!end
24530
24531 !! test
24532 Indent and comment before table row
24533 !! wikitext
24534 {|
24535 <!--hi-->|-
24536 | there
24537 |}
24538 !! html/php
24539 <table>
24540
24541 <tr>
24542 <td> there
24543 </td></tr></table>
24544
24545 !! html/parsoid
24546 <table>
24547 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24548 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24549 </tbody></table>
24550 !! end
24551
24552 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24553 !!test
24554 Empty TR followed by a template-generated TR
24555 !!options
24556 parsoid
24557 !! wikitext
24558 {|
24559 |-
24560 {{echo|<tr><td>foo</td></tr>}}
24561 |}
24562 !! html
24563 <table>
24564 <tbody>
24565 <tr></tr>
24566 <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}}]}'>
24567 <td>foo</td></tr>
24568 </tbody></table>
24569 !!end
24570
24571 ## PHP and parsoid output differ for this, and since this is primarily
24572 ## for testing Parsoid's serializer, marking this Parsoid only
24573 !!test
24574 Empty TR followed by mixed-ws-comment line should RT correctly
24575 !!options
24576 parsoid
24577 !! wikitext
24578 {|
24579 |-
24580 <!--c-->
24581 |-
24582 <!--c--> <!--d-->
24583 |}
24584 !! html
24585 <table>
24586 <tbody>
24587 <tr></tr>
24588 <!--c-->
24589 <tr>
24590 <!--c--> </tr><!--d-->
24591 </tbody></table>
24592
24593 !!end
24594
24595 !!test
24596 Multi-line image caption generated by templates with/without trailing newlines
24597 !! wikitext
24598 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24599 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24600 !! html/parsoid
24601 <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>
24602 <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>
24603 !!end
24604
24605 !! test
24606 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24607 !! options
24608 parsoid=html2wt
24609 !! html/parsoid
24610 <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>
24611
24612 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24613 !! wikitext
24614 <includeonly>foo</includeonly>
24615 new para
24616
24617 [[Category:Foo]]
24618
24619 = new heading =
24620 !! end
24621
24622 ## PHP emits broken html for this, and since this is primarily
24623 ## a Parsoid serializer test, marking this Parsoid only
24624 !!test
24625 Improperly nested inline or quotes tags with whitespace in between
24626 !! wikitext
24627 <span> <s>x</span> </s>
24628 ''' ''x''' ''
24629 !! html/parsoid
24630 <p><span> <s>x</s></span><s> </s>
24631 <b> <i>x</i></b><i> </i>
24632 </p>
24633 !!end
24634
24635 !!test
24636 Encapsulate protected attributes from wt
24637 !! wikitext
24638 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24639 !! html/parsoid
24640 <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>
24641 </body>
24642 !!end
24643
24644 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24645 ## Having nested or stray pre tags results in the attempt to add duplicates,
24646 ## causing an assertion fail. This test tries to prevent that situation.
24647 !!test
24648 Ensure ParagraphWrapper can deal with stray closing pre tags
24649 !!options
24650 parsoid=wt2html
24651 !! wikitext
24652 plain text</pre>
24653 !! html/parsoid
24654 plain text
24655 !!end
24656
24657 !!test
24658 1. Ensure fostered text content is wrapped in element nodes
24659 !!options
24660 parsoid=wt2html
24661 !! wikitext
24662 <table>hi</table><table>ho</table>
24663 !! html/parsoid
24664 <p>hi</p>
24665 <table></table>
24666 <p>ho</p>
24667 <table></table>
24668 !!end
24669
24670 !!test
24671 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24672 !!options
24673 parsoid=wt2html,wt2wt
24674 !! wikitext
24675 <table>
24676 <tr> || ||
24677 <td> a
24678 </table>
24679 !! html/parsoid
24680 <p> || ||
24681 </p><table>
24682 <tbody><tr><td> a</td></tr>
24683 </tbody></table>
24684 !!end
24685
24686 !!test
24687 Encapsulation properly handles null DSR information from foster box
24688 !!options
24689 parsoid=wt2html,wt2wt
24690 !! wikitext
24691 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24692 !! html/parsoid
24693 <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>
24694 !!end
24695
24696 !!test
24697 1. Encapsulate foster-parented transclusion content
24698 !!options
24699 parsoid=wt2wt,wt2html
24700 !! wikitext
24701 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24702 !! html/parsoid
24703 <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>
24704 <tbody>
24705 <tr>
24706 <td>bar</td>
24707 </tr>
24708 </tbody>
24709 </table>
24710 !!end
24711
24712 !!test
24713 2. Encapsulate foster-parented transclusion content
24714 !!options
24715 parsoid=wt2wt,wt2html
24716 !! wikitext
24717 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24718 !! html/parsoid
24719 <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>
24720 <table>
24721 <tbody>
24722 <tr>
24723 <td>bar</td>
24724 </tr>
24725 </tbody>
24726 </table>
24727 !!end
24728
24729 !!test
24730 3. Encapsulate foster-parented transclusion content
24731 !!options
24732 parsoid=wt2wt,wt2html
24733 !! wikitext
24734 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24735 !! html/parsoid
24736 <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;]}">
24737 <p>foo</p>
24738 </div>
24739 <table>
24740 <tbody>
24741 <tr>
24742 <td>bar</td>
24743 </tr>
24744 </tbody>
24745 </table>
24746 !!end
24747
24748 !!test
24749 4. Encapsulate foster-parented transclusion content
24750 !!options
24751 parsoid=wt2wt,wt2html
24752 !! wikitext
24753 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24754 !! html/parsoid
24755 <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;]}">
24756 <p>foo</p>
24757 </div>
24758 <table>
24759 <tbody>
24760 <tr>
24761 <td>bar</td>
24762 </tr>
24763 </tbody>
24764 </table>
24765 !!end
24766
24767 !!test
24768 5. Encapsulate foster-parented transclusion content
24769 !!options
24770 parsoid=wt2wt,wt2html
24771 !! wikitext
24772 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24773 !! html/parsoid
24774 <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>
24775 <table>
24776 <tbody>
24777 <tr>
24778 <td>
24779 <div>
24780 <p>foo</p>
24781 </div>
24782 </td>
24783 </tr>
24784 </tbody>
24785 </table>
24786 !!end
24787
24788 !!test
24789 6. Encapsulate foster-parented transclusion content
24790 !!options
24791 parsoid=wt2wt,wt2html
24792 !! wikitext
24793 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24794 !! html/parsoid
24795 <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>
24796 <table>
24797 <tbody>
24798 <tr>
24799 <td>
24800 <div>
24801 <p>foo</p>
24802 </div>
24803 </td>
24804 </tr>
24805 </tbody>
24806 </table>
24807 <p>ok</p>
24808 !!end
24809
24810 !!test
24811 7. Encapsulate foster-parented transclusion content
24812 !!options
24813 parsoid=wt2wt,wt2html
24814 !! wikitext
24815 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24816 !! html/parsoid
24817 <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>
24818 <table>
24819 <tbody>
24820 <tr>
24821 <td>bar</td>
24822 </tr>
24823 </tbody>
24824 </table>
24825 !!end
24826
24827 # Note that the wt is broken on purpose: the = should be {{=}} if you
24828 # don't want it to be a template parameter key.
24829 !!test
24830 8. Encapsulate foster-parented transclusion content
24831 !!options
24832 parsoid=wt2wt,wt2html
24833 !! wikitext
24834 {{echo|a
24835 }}{|{{echo|style='color:red'}}
24836 |-
24837 |b
24838 |}
24839 !! html/parsoid
24840 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24841 <span> </span>
24842 <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>
24843 <table>
24844 <tbody>
24845 <tr>
24846 <td>b</td>
24847 </tr>
24848 </tbody>
24849 </table>
24850 !!end
24851
24852 !!test
24853 9. Encapsulate foster-parented transclusion content
24854 !!options
24855 parsoid=wt2wt,wt2html
24856 !! wikitext
24857 <table>{{echo|hi</table>hello}}
24858 !! html/parsoid
24859 <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>
24860 !!end
24861
24862 !!test
24863 Table in fosterable position
24864 !!options
24865 parsoid=wt2html
24866 !! wikitext
24867 {{OpenTable}}
24868 <div>
24869 {|
24870 |}
24871 </div>
24872 |}
24873 !! html/parsoid
24874 <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">
24875 </span>
24876 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24877
24878 <table>
24879 </table>
24880 !!end
24881
24882 # Parsoid only for bug 64747
24883 !! test
24884 Properly encapsulate empty-content transclusions in fosterable positions
24885 !! wikitext
24886 <table>
24887 {{#if:|
24888 <td>foo</td>
24889 }}
24890 </table>
24891 !! html/parsoid
24892 <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"}]]}'>
24893
24894 </table>
24895 !! end
24896
24897 !! test
24898 Always encapsulate foster box when template range is expanded to table
24899 !! options
24900 parsoid=wt2wt
24901 !! wikitext
24902 {|
24903 hello
24904 {{OpenTable}}
24905 |}
24906 !! html/parsoid
24907
24908 !! end
24909
24910 !! test
24911 T115289: Unclosed table
24912 !! wikitext
24913 {{echo|<table>}}<!--c-->[[Category:Two]]
24914 !! html/parsoid
24915 <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>
24916 !! end
24917
24918 !! test
24919 T115289: Don't migrate newlines out of tables with fostered content
24920 !! wikitext
24921 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24922 !! html/parsoid
24923 <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>
24924 !! end
24925
24926 !! test
24927 T73074: More fostering fun
24928 !! wikitext
24929 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24930 !! html/parsoid
24931 <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>
24932 !! end
24933
24934 !!test
24935 Support <object> element with .data attribute
24936 !!options
24937 parsoid=html2wt
24938 !! html/parsoid
24939 <object data="test.swf"></object>
24940 !! wikitext
24941 <object data="test.swf"></object>
24942 !!end
24943
24944 !! test
24945 Don't block XML namespace declaration
24946 !! wikitext
24947 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24948 !! html/php
24949 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24950 </p>
24951 !! html/parsoid
24952 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24953 !! end
24954
24955 # -----------------------------------------------------------------
24956 # The following section of tests are primarily to spec requirements
24957 # around serialization of new/edited content.
24958 #
24959 # All these tests are marked Parsoid html2wt and html2html only
24960 # ----------------------------------------------------------------
24961
24962 # 'mi' is a localinterwiki prefix as well as a language
24963 !! test
24964 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24965 !! options
24966 parsoid=html2wt
24967 !! html/parsoid
24968 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24969 !! wikitext
24970 [[Foo]]
24971 !! end
24972
24973 # See T93839
24974 !! test
24975 New wikilinks should be serialized properly
24976 !! options
24977 parsoid=html2wt
24978 !! html/parsoid
24979 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24980 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24981 !! wikitext
24982 [[Foo]]
24983 [[Foo]]
24984 !! end
24985
24986 !! test
24987 New wiki links (href variations)
24988 !! options
24989 parsoid=html2wt
24990 !! html/parsoid
24991 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24992 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24993 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24994 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24995 !! wikitext
24996 [[Foo_bar]]
24997 [[Foo_bar]]
24998 [[Foo_bar]]
24999 [[Toxine bactérienne]]
25000 !! end
25001
25002 !! test
25003 New wiki links (content string variations)
25004 !! options
25005 parsoid=html2wt
25006 !! html/parsoid
25007 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25008 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25009 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25010 !! wikitext
25011 [[Foo_bar]]
25012 [[Foo bar]]
25013 [[Foo_bar|./Foo_bar]]
25014 !! end
25015
25016 !! test
25017 New category links (href variations)
25018 !! options
25019 parsoid=html2wt
25020 !! html/parsoid
25021 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25022 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25023 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25024 !! wikitext
25025 [[Category:Toxine bactérienne]]
25026 [[Category:Toxine bactérienne]]
25027 [[Category:Toxine bactérienne]]
25028 !! end
25029
25030 !! test
25031 New sol transparent links don't need indent-pre nowiki protection
25032 !! options
25033 parsoid=html2wt
25034 language=de
25035 !! html/parsoid
25036 <link rel="mw:PageProp/redirect" href="./Main_Page">
25037 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25038 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25039 !! wikitext
25040 #WEITERLEITUNG [[Main Page]]
25041 <!-- this is good --> [[Category:Good]]
25042 <!-- this is great --> [[Kategorie:Great]]
25043 !! end
25044
25045 !! test
25046 New interlanguage links (href variations)
25047 !! options
25048 parsoid=html2wt
25049 !! html/parsoid
25050 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25051 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25052 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25053 !! wikitext
25054 [[es:Toxine bactérienne]]
25055 [[es:Toxine_bactérienne]]
25056 [[es:Toxine_bactérienne]]
25057 !! end
25058
25059 !! test
25060 Image: Modifying size of an image (1)
25061 !! options
25062 parsoid={
25063 "modes": ["wt2wt"],
25064 "changes": [
25065 ["img[height]", "attr", "height", "22"],
25066 ["img[width]", "attr", "width", "200"]
25067 ]
25068 }
25069 !! wikitext
25070 [[Image:Foobar.jpg|230x230px]]
25071 !! wikitext/edited
25072 [[Image:Foobar.jpg|200x200px]]
25073 !!end
25074
25075 !! test
25076 Image: Modifying size of an image (2)
25077 !! options
25078 parsoid={
25079 "modes": ["wt2wt"],
25080 "changes": [
25081 ["img[height]", "attr", "height", "100"],
25082 ["img[width]", "attr", "width", "500"]
25083 ]
25084 }
25085 !! wikitext
25086 [[Image:Foobar.jpg|230x230px]]
25087 !! wikitext/edited
25088 [[Image:Foobar.jpg|500x500px]]
25089 !!end
25090
25091 # Change in size is ignored so long as class='mw-default-size'
25092 !! test
25093 Image: Modifying size of an image (3)
25094 !! options
25095 parsoid={
25096 "modes": ["wt2wt"],
25097 "changes": [
25098 ["figure[class]", "removeClass", "mw-default-size"],
25099 ["figure img", "attr", "height", "19"],
25100 ["figure img", "attr", "width", "170"]
25101 ]
25102 }
25103 !! wikitext
25104 [[Image:Foobar.jpg|thumb]]
25105 !! wikitext/edited
25106 [[Image:Foobar.jpg|thumb|170x170px]]
25107 !!end
25108
25109 !! test
25110 Image: Modifying alignment of an image (bug 48665)
25111 !! options
25112 parsoid={
25113 "modes": ["wt2wt"],
25114 "changes": [
25115 ["figure[class]", "removeClass", "mw-halign-right"],
25116 ["figure[class]", "addClass", "mw-halign-left"]
25117 ]
25118 }
25119 !! wikitext
25120 [[Image:Foobar.jpg|thumb|caption|right]]
25121 !! wikitext/edited
25122 [[Image:Foobar.jpg|thumb|caption|left]]
25123 !! end
25124
25125 !! test
25126 Image: Modifying mw-default-size of an frameless image (bug 62805)
25127 !! options
25128 parsoid={
25129 "modes": ["wt2wt"],
25130 "changes": [
25131 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25132 ]
25133 }
25134 !! wikitext
25135 [[Image:Foobar.jpg|frameless|right]]
25136 !! wikitext/edited
25137 [[Image:Foobar.jpg|frameless|right|220x220px]]
25138 !! end
25139
25140 !! test
25141 Image: Modifying valign of an image (bug 49221)
25142 !! options
25143 parsoid={
25144 "modes": ["wt2wt"],
25145 "changes": [
25146 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25147 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25148 ]
25149 }
25150 !! wikitext
25151 [[File:Foobar.jpg|20px|middle]]
25152 !! wikitext/edited
25153 [[File:Foobar.jpg|20px|text-top]]
25154 !! end
25155
25156 !! test
25157 Image: Modifying alt attribute of an image (bug 56400)
25158 !! options
25159 parsoid={
25160 "modes": ["wt2wt"],
25161 "changes": [
25162 ["img[alt]", "attr", "alt", "some alternate edited text"]
25163 ]
25164 }
25165 !! wikitext
25166 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25167 !! wikitext/edited
25168 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25169 !!end
25170
25171 !! test
25172 Image: Modifying caption of an image
25173 !! options
25174 parsoid={
25175 "modes": ["wt2wt"],
25176 "changes": [
25177 ["figcaption", "text", "new caption"]
25178 ]
25179 }
25180 !! wikitext
25181 [[Image:Foobar.jpg|thumb|original caption]]
25182 !! wikitext/edited
25183 [[Image:Foobar.jpg|thumb|new caption]]
25184 !!end
25185
25186 !! test
25187 Image: empty alt attribute (bug 48924)
25188 !! options
25189 parsoid
25190 !! wikitext
25191 [[File:Foobar.jpg|thumb|alt=|bar]]
25192 !! html
25193 <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>
25194 !! end
25195
25196 !! test
25197 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25198 !! options
25199 parsoid=html2wt
25200 language=ar
25201 disabled
25202 !! html/parsoid
25203 <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>
25204 !! wikitext
25205 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25206 !! end
25207
25208 !! test
25209 Image: Block level image should have \n before and after
25210 !! wikitext
25211 123
25212 [[File:Foobar.jpg|right|thumb|150x150px]]
25213 456
25214 !! html/parsoid
25215 <p>123</p>
25216 <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>
25217 <p>456</p>
25218 !!end
25219
25220 !! test
25221 Image: New block level image should have \n before and after (existing content)
25222 !! wikitext
25223 123
25224 [[File:Foobar.jpg|right|thumb|150x150px]]
25225 456
25226 !! html/parsoid
25227 <p>123</p>
25228 <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>
25229 <p>456</p>
25230 !!end
25231
25232 !! test
25233 Image: upright option (parsoid)
25234 !! wikitext
25235 [[File:Foobar.jpg|thumb|upright|caption]]
25236 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25237 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25238 !! html/parsoid
25239 <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>
25240 <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>
25241 <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>
25242 !!end
25243
25244 !! test
25245 Image: upright option is ignored on inline and frame images (parsoid)
25246 !! wikitext
25247 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25248 !! html/parsoid
25249 <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>
25250 !!end
25251
25252 !! test
25253 Image: from basic HTML (1)
25254 !! options
25255 parsoid=html2wt
25256 !! html/parsoid
25257 <span typeof="mw:Image">
25258 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25259 </span>
25260 !! wikitext
25261 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25262 !! end
25263
25264 !! test
25265 Image: from basic HTML (2)
25266 !! options
25267 parsoid=html2wt
25268 !! html/parsoid
25269 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25270 !! wikitext
25271 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25272 !! end
25273
25274 !! test
25275 Image: from basic HTML (3)
25276 !! options
25277 parsoid=html2wt
25278 !! html/parsoid
25279 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25280 !! wikitext
25281 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25282 !! end
25283
25284 !! test
25285 Image: from basic HTML (4)
25286 !! options
25287 parsoid=html2wt
25288 !! html/parsoid
25289 <img src="./File:Foobar.jpg">
25290 !! wikitext
25291 [[File:Foobar.jpg|link=]]
25292 !! end
25293
25294 !! test
25295 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25296 !! options
25297 parsoid=html2wt
25298 !! html/parsoid
25299 <ul>
25300 <li><p>foo</p></li>
25301 </ul>
25302 !! wikitext
25303 * foo
25304 !! end
25305
25306 !! test
25307 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25308 !! options
25309 parsoid=html2wt
25310 !! html/parsoid
25311 <ul> <li>foo</li></ul>
25312 !! wikitext
25313 * foo
25314 !! end
25315
25316 !! test
25317 Don't strip leading whitespace when handling indent-pre suppressing tags
25318 !! options
25319 parsoid=html2wt
25320 !! html/parsoid
25321 <table>
25322 <tr><td> indented row</td></tr>
25323 </table>
25324 <blockquote><p>
25325 <b>This is very bold of you!</b>
25326 </p>
25327 <table><tr><td>
25328 indented cell (no pre-wrapping!)
25329 </td></tr></table>
25330 </blockquote>
25331 <p>foo</p>
25332 <div>bar</div>
25333 !! wikitext
25334 {|
25335 | indented row
25336 |}
25337 <blockquote>
25338 '''This is very bold of you!'''
25339
25340 {|
25341 |
25342 indented cell (no pre-wrapping!)
25343 |}
25344 </blockquote>
25345 foo
25346 <div>bar</div>
25347 !! end
25348
25349 !! test
25350 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25351 !! options
25352 parsoid=html2wt
25353 !! html/parsoid
25354 <p>foo</p>
25355 <span>bar</span>
25356
25357 <span>foo2
25358 </span>bar2
25359
25360 <div>foo</div>
25361 <span>bar</span>
25362
25363 <div>
25364 <span>foo</span>
25365 </div>
25366 !! wikitext
25367 foo
25368
25369 <span>bar</span>
25370
25371 <span>foo2
25372 <nowiki> </nowiki></span>bar2
25373
25374 <div>foo</div>
25375 <nowiki> </nowiki><span>bar</span>
25376
25377 <div>
25378 <nowiki> </nowiki><span>foo</span>
25379 </div>
25380 !! end
25381
25382 !! test
25383 Lists: Dont insert newlines in a serialized list item.
25384 !! options
25385 parsoid=html2wt
25386 !! html/parsoid
25387 <ul><li>a<br>b</li><li>c</li></ul>
25388 !! wikitext
25389 * a<br>b
25390 * c
25391 !! end
25392
25393 !! test
25394 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25395 !! options
25396 parsoid={
25397 "modes": ["html2wt"],
25398 "scrubWikitext": false
25399 }
25400 !! html/parsoid
25401 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25402 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25403
25404 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25405 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25406
25407 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25408
25409 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25410 !! wikitext
25411 == hello there [[Category:A1]] ==
25412
25413 == [[Category:A2]] hi pal ==
25414
25415 == <!--foo--> [[Category:A3]] how goes it ==
25416
25417 == it goes well [[Category:A4]] <!--bar--> ==
25418
25419 ==howdy [[Category:A5]]==
25420
25421 == __TOC__ ok ==
25422 !! end
25423
25424 !! test
25425 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25426 !! options
25427 parsoid={
25428 "modes": ["html2wt"],
25429 "scrubWikitext": true
25430 }
25431 !! html/parsoid
25432 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25433 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25434
25435 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25436 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25437
25438 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25439 !! wikitext
25440 == hello there ==
25441 [[Category:A1]]
25442 [[Category:A2]]
25443
25444 == hi pal ==
25445
25446 <!--foo--> [[Category:A3]]
25447
25448 == how goes it ==
25449
25450 == it goes well ==
25451 [[Category:A4]] <!--bar-->
25452
25453 __TOC__
25454
25455 == ok ==
25456 !! end
25457
25458 !! test
25459 Headings: Don't hoist metas that come from templates
25460 !! options
25461 parsoid={
25462 "modes": ["html2wt"],
25463 "scrubWikitext": true
25464 }
25465 !! html/parsoid
25466 <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>
25467 !! wikitext
25468 == {{echo|foo [[Category:Foo]]}} ==
25469 !! end
25470
25471 !! test
25472 Headings: Category in ref isn't hoisted
25473 !! options
25474 parsoid={
25475 "modes": ["html2wt"],
25476 "scrubWikitext": true
25477 }
25478 !! html/parsoid
25479 <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>
25480
25481 <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>
25482 !! wikitext
25483 == foo <ref>bar
25484 [[Category:Baz]] </ref> ==
25485
25486 <references />
25487 !! end
25488
25489 !! test
25490 Parsoid: Serialize positional parameters with = in them as named parameter
25491 !! options
25492 parsoid=html2wt
25493 !! html/parsoid
25494 <p about="#mwt1" typeof="mw:Transclusion"
25495 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25496
25497 <p about="#mwt1" typeof="mw:Transclusion"
25498 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25499
25500 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25501 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25502 <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>
25503 !! wikitext
25504 {{echo|1=f=oo}}
25505
25506 {{echo|1=f=oo|2=bar}}
25507
25508 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25509 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25510 {{echo|<nowiki>f=oo</nowiki>|bar}}
25511 !! end
25512
25513 !! test
25514 Parsoid: Serialize positional parameters with = in extlink as named parameter
25515 !! options
25516 parsoid=html2wt
25517 !! html/parsoid
25518 <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>
25519 !! wikitext
25520 {{echo|1=http://stuff?is=ok}}
25521 !! end
25522
25523 !! test
25524 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25525 !! options
25526 parsoid=html2wt
25527 !! html/parsoid
25528 <div>a<p>b</p></div>
25529 <div>a
25530 <p>b</p></div>
25531 <div>
25532 a
25533 <p>b</p></div>
25534 !! wikitext
25535 <div>a
25536 b
25537 </div>
25538 <div>a
25539 b
25540 </div>
25541 <div>
25542 a
25543
25544 b
25545 </div>
25546 !! end
25547
25548 !! test
25549 Substrings resembling wikitext in hrefs should not get nowiki escapes
25550 !! options
25551 parsoid=html2wt
25552 !! html/parsoid
25553 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25554 !! wikitext
25555 [[Foo''bar''baz]]
25556 !! end
25557
25558 !! test
25559 Enforce single-line context in the serializer
25560 !! options
25561 parsoid=html2wt
25562 !! html/parsoid
25563 <h2>testing
25564 123</h2>
25565
25566 <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">
25567 </span><span about="#mwt1">you</span> </h2>
25568
25569 <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>
25570
25571 <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
25572 there</span></li></ol>
25573
25574 <ul><li>asd
25575 sdf</li></ul>
25576
25577 <ul><li>foo
25578 bar
25579 baz</li>
25580 <li>foo <b>bar</b>
25581 baz</li></ul>
25582
25583 <dl><dt>hi
25584 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25585 ho</dd></dl>
25586
25587 <dl><dd> <table>
25588 <tbody><tr><td> ha
25589 ha
25590 ha</td></tr>
25591 </tbody></table></dd></dl>
25592 !! wikitext
25593 == testing 123 ==
25594
25595 == hi {{bogus|there
25596 you}} ==
25597
25598 == foo <ref>hello
25599 there</ref> ==
25600
25601 <references />
25602
25603 * asd sdf
25604
25605 * foo bar baz
25606 * foo '''bar''' baz
25607
25608 ; hi ho : hi ho
25609
25610 : {|
25611 | ha
25612 ha
25613 ha
25614 |}
25615 !! end
25616
25617 !! test
25618 Serialize new placeholder space without spans
25619 !! options
25620 parsoid=html2wt
25621 !! html/parsoid
25622 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25623
25624 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25625
25626 <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>
25627 !! wikitext
25628 foo : bar
25629
25630 foo : bar
25631
25632 <ref>foo : bar</ref>ok
25633 !! end
25634
25635
25636 #-----------------------
25637 # Tag minimization tests
25638 #-----------------------
25639
25640 !! test
25641 1. I/B quote minimization: wikitext-only tags should be combined
25642 !! options
25643 parsoid=html2wt
25644 !! html/parsoid
25645 <p><i>A</i><i>B</i></p>
25646 <p><b>A</b><b>B</b></p>
25647 <p><i>A</i><b><i>B</i></b></p>
25648 <p><b>A</b><i><b>B</b></i></p>
25649 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25650 <p><i><b>A</b></i><i><b>B</b></i></p>
25651 <p><i><b>A</b></i><b><i>B</i></b></p>
25652 <p><b><i>A</i></b><i><b>B</b></i></p>
25653 !! wikitext
25654 ''AB''
25655
25656 '''AB'''
25657
25658 ''A'''B'''''
25659
25660 '''A''B'''''
25661
25662 '''A''BC''D'''
25663
25664 '''''AB'''''
25665
25666 '''''AB'''''
25667
25668 '''''AB'''''
25669 !! end
25670
25671 !! test
25672 2. I/B quote minimization: wikitext and html tags should not be combined
25673 !! options
25674 parsoid=html2wt
25675 !! html/parsoid
25676 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25677 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25678 !! wikitext
25679 ''A''<i>B</i>
25680
25681 ''A''<nowiki/>'''<i>B</i>'''
25682 !! end
25683
25684 !! test
25685 3. I/B quote minimization: templated content stops minimization
25686 !! options
25687 parsoid=html2wt
25688 !! html/parsoid
25689 <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>
25690 <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>
25691 !! wikitext
25692 ''A''{{echo|''B''}}
25693
25694 ''A''{{echo|'''''B'''''}}
25695 !! end
25696
25697 !! test
25698 4. I/B quote minimization: new content should be mimimized with adjacent old content
25699 !! options
25700 parsoid=html2wt
25701 !! html/parsoid
25702 <p><i>A</i><i>B</i></p>
25703 <p><b>A</b><b>B</b></p>
25704 <p><i>A</i><b><i>B</i></b></p>
25705 !! wikitext
25706 ''AB''
25707
25708 '''AB'''
25709
25710 ''A'''B'''''
25711 !! end
25712
25713 !! test
25714 5a. Merge adjacent quote nodes if they've been edited
25715 !! options
25716 parsoid={
25717 "modes": ["wt2wt", "selser"],
25718 "changes": [
25719 ["p", "contents", "remove", ":contains('b')"]
25720 ]
25721 }
25722 !! wikitext
25723 ''a''b''c''
25724 !! wikitext/edited
25725 ''ac''
25726 !! end
25727
25728 !! test
25729 5b. Merge adjacent quote nodes if they've been edited
25730 !! options
25731 parsoid={
25732 "modes": ["wt2wt", "selser"],
25733 "changes": [
25734 ["#x", "remove"]
25735 ]
25736 }
25737 !! wikitext
25738 ''a''<span id="x">b</span>''c''
25739 !! wikitext/edited
25740 ''ac''
25741 !! end
25742
25743 !! test
25744 1. Merge adjacent link nodes as long as at least one element is new
25745 !! options
25746 parsoid={
25747 "modes": ["html2wt"],
25748 "scrubWikitext": true
25749 }
25750 !! html/parsoid
25751 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25752 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25753 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25754 !! wikitext
25755 [[Football]]
25756 [[Football]]
25757 [[Football|Foot]][[Football|ball]]
25758 !! end
25759
25760 !! test
25761 2. Merge adjacent link nodes and enable additional normalizations
25762 !! options
25763 parsoid={
25764 "modes": ["html2wt"],
25765 "scrubWikitext": true
25766 }
25767 !! html/parsoid
25768 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25769 !! wikitext
25770 [[Football|''Football'']]
25771 !! end
25772
25773 !! test
25774 3. Don't merge adjacent link nodes if scrubWikitext is false
25775 !! options
25776 parsoid={
25777 "modes": ["html2wt"],
25778 "scrubWikitext": false
25779 }
25780 !! html/parsoid
25781 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25782 !! wikitext
25783 [[Football|Foot]][[Football|ball]]
25784 !! end
25785
25786 #------------------------------
25787 # End of tag minimization tests
25788 #------------------------------
25789
25790 !!test
25791 Bug 54262: New entities
25792 !! options
25793 parsoid=html2wt
25794 !! html/parsoid
25795 <span typeof="mw:Entity">&nbsp;</span>
25796 !! wikitext
25797 &nbsp;
25798 !! end
25799
25800 ## Note that there is no wikitext output for 'unknownproperty' ##
25801 ## Unknown magic words are silently dropped ##
25802
25803 !! test
25804 Magic words
25805 !! options
25806 parsoid=html2wt
25807 !! html/parsoid
25808 <meta property='mw:PageProp/toc' />
25809 <meta property='mw:PageProp/notoc' />
25810 <meta property='mw:PageProp/forcetoc' />
25811 <meta property='mw:PageProp/index' />
25812 <meta property='mw:PageProp/noindex' />
25813 <meta property='mw:PageProp/nogallery' />
25814 <meta property='mw:PageProp/noeditsection' />
25815 <meta property='mw:PageProp/notitleconvert' />
25816 <meta property='mw:PageProp/nocontentconvert' />
25817 <meta property='mw:PageProp/unknownproperty' />
25818 !! wikitext
25819 __TOC__
25820 __NOTOC__
25821 __FORCETOC__
25822 __INDEX__
25823 __NOINDEX__
25824 __NOGALLERY__
25825 __NOEDITSECTION__
25826 __NOTITLECONVERT__
25827 __NOCONTENTCONVERT__
25828 !! end
25829
25830 !! test
25831 Consecutive <pre>s should not get merged
25832 !! options
25833 parsoid=html2wt,html2html
25834 !! html/parsoid
25835 <pre>a</pre><pre>b</pre>
25836
25837 <pre>c
25838 </pre><pre>
25839 d</pre>
25840
25841 <pre>e
25842
25843 </pre><pre>
25844
25845 f</pre>
25846 !! wikitext
25847 a
25848
25849 b
25850
25851 c
25852
25853 d
25854
25855 e
25856
25857
25858
25859 f
25860 !! end
25861
25862 !! test
25863 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25864 !! options
25865 parsoid=html2wt
25866 !! html/parsoid
25867 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25868 !! wikitext
25869 [[Special:BookSources/1234567890|ISBN 1234567895]]
25870 !! end
25871
25872 !! test
25873 Edited RFC links not serializable as RFC links should serialize as extlinks
25874 !! options
25875 parsoid=html2wt
25876 !! html/parsoid
25877 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25878 !! wikitext
25879 [//tools.ietf.org/html/rfc123 New RFC]
25880 !! end
25881
25882 !! test
25883 Edited PMID links not serializable as PMID links should serialize as extlinks
25884 !! options
25885 parsoid=html2wt
25886 !! html/parsoid
25887 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25888 !! wikitext
25889 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25890 !! end
25891
25892 !! test
25893 WTS of autolinks with trailing/surrounding context
25894 !! options
25895 parsoid=html2wt
25896 !! html/parsoid
25897 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25898 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25899 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25900 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25901 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25902 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25903 !! wikitext
25904 http://cscott.net'''foo'''
25905
25906 http://cscott.net<b>foo</b>
25907
25908 '''http://cscott.net'''
25909
25910 '''http://cscott.net '''
25911
25912 '''http://cscott.net<nowiki/>x'''
25913
25914 http://cscott.net<nowiki/>x
25915 !! end
25916
25917 !! test
25918 WTS of autolinks with nowikis (round-trip)
25919 !! wikitext
25920 x<nowiki/>http://cscott.net<nowiki/>x
25921 !! html/parsoid
25922 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25923 !! end
25924
25925 # this is the "easy" test because it leaves in place all the
25926 # data-parsoid information indicating this is an autolink
25927 !! test
25928 WTS of autolinks with escapes (editing)
25929 !! options
25930 parsoid={
25931 "modes": ["wt2wt"],
25932 "changes": [
25933 [ "meta", "remove" ]
25934 ]
25935 }
25936 !! wikitext
25937 x<nowiki/>http://cscott.net<nowiki/>x
25938 !! wikitext/edited
25939 x<nowiki/>http://cscott.net<nowiki/>x
25940 !! end
25941
25942 !! test
25943 WTS of edited autolink-like text (T103364)
25944 !! options
25945 parsoid={
25946 "modes": ["wt2wt"],
25947 "changes": [
25948 [ "span[typeof]", "removeAttr", "typeof" ]
25949 ]
25950 }
25951 !! wikitext
25952 Not a link: <nowiki>http://example.com</nowiki>.
25953 !! wikitext/edited
25954 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25955 !! end
25956
25957 !! test
25958 WTS of newly-authored autolink-like text (T103364)
25959 !! options
25960 parsoid=html2wt
25961 !! html/parsoid
25962 <p>http://example.com is not a link.</p>
25963 !! wikitext
25964 <nowiki>http://example.com</nowiki> is not a link.
25965 !! end
25966
25967 !! test
25968 WTS of autolink-like text after an autolink (T108563)
25969 !! options
25970 parsoid=html2wt
25971 !! html/parsoid
25972 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25973 !! wikitext
25974 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25975 !! end
25976
25977 !! test
25978 Magic links inside links (not autolinked)
25979 !! wikitext
25980 [[Foo|http://example.com]]
25981 [[Foo|RFC 1234]]
25982 [[Foo|PMID 1234]]
25983 [[Foo|ISBN 123456789x]]
25984
25985 [http://foo.com http://example.com]
25986 [http://foo.com RFC 1234]
25987 [http://foo.com PMID 1234]
25988 [http://foo.com ISBN 123456789x]
25989 !! html+tidy
25990 <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>
25991 <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>
25992 !! html/parsoid
25993 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25994 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25995 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25996 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25997
25998 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25999 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26000 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26001 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26002 !! end
26003
26004 !! test
26005 Magic links inside image captions (autolinked)
26006 !! wikitext
26007 [[File:Foobar.jpg|thumb|http://example.com]]
26008 [[File:Foobar.jpg|thumb|RFC 1234]]
26009 [[File:Foobar.jpg|thumb|PMID 1234]]
26010 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26011 !! html+tidy
26012 <div class="thumb tright">
26013 <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>
26014 <div class="thumbcaption">
26015 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26016 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26017 </div>
26018 </div>
26019 <div class="thumb tright">
26020 <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>
26021 <div class="thumbcaption">
26022 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26023 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26024 </div>
26025 </div>
26026 <div class="thumb tright">
26027 <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>
26028 <div class="thumbcaption">
26029 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26030 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26031 </div>
26032 </div>
26033 <div class="thumb tright">
26034 <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>
26035 <div class="thumbcaption">
26036 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26037 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26038 </div>
26039 </div>
26040 !! html/parsoid
26041 <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>
26042 <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>
26043 <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>
26044 <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>
26045 !! end
26046
26047 !! test
26048 WTS of magic word text (T109371)
26049 !! options
26050 parsoid=html2wt
26051 !! html/parsoid
26052 <p>RFC 1234</p>
26053 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26054 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26055 !! wikitext
26056 <nowiki>RFC 1234</nowiki>
26057
26058 [http://foo.com RFC 1234]
26059
26060 [[Foo|RFC 1234]]
26061 !! end
26062
26063 !! test
26064 Edited Redirect link should emit a non-piped wikitext link
26065 !! options
26066 parsoid=html2wt
26067 !! html/parsoid
26068 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26069 !! wikitext
26070 #REDIRECT [[Bar]]
26071 !! end
26072
26073 !! test
26074 T75121: Infer extension name from typeOf if data-mw is not present
26075 !! options
26076 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26077 !! html/parsoid
26078 <div typeOf="mw:Extension/foo"></div>
26079 !! wikitext
26080 <foo />
26081 !! end
26082
26083 # Note that the <p> wrapping isn't present in PHP parser output
26084 # The important thing for this test is that P-wrapping doesn't
26085 # interfere with the <nowiki> protection for leading - in <td>
26086 # (which isn't necessary for <th>).
26087 !! test
26088 T88318: p-wrapped dash in table.
26089 !! options
26090 parsoid=html2wt,wt2wt
26091 !! html/parsoid
26092 <table><tbody>
26093 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26094 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26095 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26096 </tbody></table>
26097 !! wikitext
26098 {|
26099 !-
26100 !-
26101 |-
26102 |<nowiki>-</nowiki>
26103 |<nowiki>- </nowiki>
26104 |-
26105 |<small>-</small>
26106 |<br>
26107 -
26108 |<br>
26109 -
26110 |}
26111 !! html/php+tidy
26112 <table>
26113 <tr>
26114 <th>-</th>
26115 <th>-</th>
26116 </tr>
26117 <tr>
26118 <td>-</td>
26119 <td>-</td>
26120 </tr>
26121 <tr>
26122 <td><small>-</small></td>
26123 <td><br />
26124 <p>-</p>
26125 </td>
26126 <td><br />
26127 <p>-</p>
26128 </td>
26129 </tr>
26130 </table>
26131 !! end
26132
26133 !! test
26134 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26135 !! options
26136 parsoid=html2wt
26137 !! html/parsoid
26138 <table id='mwAb'>
26139 <td id='mwAc'>foo</td>
26140 <td id='serialize-this'>bar</td>
26141 </table>
26142 !! wikitext
26143 {|
26144 |foo
26145 | id="serialize-this" |bar
26146 |}
26147 !! end
26148
26149 !! test
26150 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26151 !! options
26152 parsoid=html2wt
26153 !! html/parsoid
26154 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26155 !! wikitext
26156 <div id="hello">ok</div>
26157 !! end
26158
26159 !! test
26160 WTS change modes
26161 !! options
26162 parsoid={
26163 "modes": ["wt2wt"],
26164 "changes": [
26165 [ "#xyz", "before", "<b>before</b> stuff " ],
26166 [ "#xyz", "after", " stuff <i>after</i>" ],
26167 [ "#xyz", "html", "x <b>y</b> z" ]
26168 ]
26169 }
26170 !! wikitext
26171 <span id="xyz">hello</span>
26172 !! wikitext/edited
26173 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26174 !! end
26175
26176 !! test
26177 Never serialize a-tag as html, regardless of what data-parsoid has to say
26178 !! options
26179 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26180 !! html/parsoid
26181 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26182 !! wikitext
26183 [[Foo]]
26184 !! end
26185
26186 ## SSS FIXME: This is broken output nevertheless.
26187 ## What might be a reasonable non-broken output for this?
26188 ## This is an edge case unlikely to be seen in production
26189 ## that I am not wasting more time on this right now.
26190 !! test
26191 Never serialize a-tag as html, no matter what attributes it has
26192 !! options
26193 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26194 !! html/parsoid
26195 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26196 !! wikitext
26197 [http://boo.org http://boohoo.org]
26198 !! end
26199
26200 # Misnested is an indication that selser can reuse the source but these have
26201 # shown to sneak through on occasion. See T101768.
26202 # The original wikitext here is: [http://test.com [[one]] two three]
26203 !! test
26204 Strip span tags added to mark misnested links
26205 !! options
26206 parsoid=html2wt
26207 !! html/parsoid
26208 <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>
26209 !! wikitext
26210 [http://test.com][[one]] two three
26211 !! end
26212
26213 !! test
26214 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26215 !! options
26216 parsoid=html2wt
26217 !! html/parsoid
26218 <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|}"]}'>
26219 <tbody><tr><td>d
26220 </td></tr>
26221 </tbody></table>
26222 !! wikitext
26223 {{echo|a}}
26224 {|{{echo|c
26225 {{!}}d
26226 }}
26227 |}
26228 !! end
26229
26230 ## This test verifies the presence and computation of this attribute indirectly
26231 ## by making an edit and ensuring that the serialization is correct (which it would be
26232 ## only if firstWikitextNode is properly set).
26233 !! test
26234 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26235 !! options
26236 parsoid= {
26237 "modes": ["wt2wt"],
26238 "changes": [
26239 [ "div#x", "remove" ],
26240 [ "div", "before", "<div>new</div>" ]
26241 ]
26242 }
26243 !! wikitext
26244 <div id="x">foo</div>
26245 {|
26246 {{echo|<div>boo</div>
26247 {{!}}b}}
26248 |c
26249 |}
26250 !! wikitext/edited
26251
26252 <div>new</div>
26253 {|
26254 {{echo|<div>boo</div>
26255 {{!}}b}}
26256 |c
26257 |}
26258 !! end
26259
26260 # --------------------------------------------
26261 # Tests spec'ing wikitext serialization norms |
26262 # --------------------------------------------
26263
26264 !! test
26265 1. Categories should always be serialized on their own line
26266 !! options
26267 parsoid=html2wt
26268 !! html/parsoid
26269 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26270 !! wikitext
26271 foo
26272 [[Category:Foo]]
26273 bar
26274 !! end
26275
26276 !! test
26277 2. Categories that are part of templates should not introduce a line break
26278 !! wikitext
26279 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26280 !! html/parsoid
26281 <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>
26282 !! end
26283
26284 # Careful while editing these next 2 tests. There are \u200f characters
26285 # before and after the <link> tags in the HTML and following some
26286 # of the categories in wikitext
26287 # Do not remove these characters in edits.
26288 #
26289 # As part of the serialization, these bidi characters will get stripped.
26290 !! test
26291 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26292 !! options
26293 parsoid={
26294 "modes": ["html2wt"],
26295 "scrubWikitext": true
26296 }
26297 !! html/parsoid
26298 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26299 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26300 !! wikitext
26301 [[קטגוריה:טקסים]]
26302 [[קטגוריה: שיטות משפט]]
26303 !! end
26304
26305 !! test
26306 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26307 !! options
26308 parsoid={
26309 "modes": ["html2wt"],
26310 "scrubWikitext": true
26311 }
26312 !! html/parsoid
26313 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26314 !! wikitext
26315 [[קטגוריה:טקסים]]
26316 ‏y
26317 !! end
26318
26319 !! test
26320 Lists: Add space after bullets
26321 !! options
26322 parsoid=html2wt
26323 !! html/parsoid
26324 <ul>
26325 <li>foo</li>
26326 <li> bar</li>
26327 <li><span> baz</span></li>
26328 </ul>
26329 !! wikitext
26330 * foo
26331 * bar
26332 * <span> baz</span>
26333 !! end
26334
26335 !! test
26336 1. Headings: Add space before/after == (T53744)
26337 !! options
26338 parsoid=html2wt
26339 !! html/parsoid
26340 <h2>foo</h2>
26341 <h2> bar</h2>
26342 <h2>baz </h2>
26343 <h2><span> baz</span></h2>
26344 !! wikitext
26345 == foo ==
26346
26347 == bar ==
26348
26349 == baz ==
26350
26351 == <span> baz</span> ==
26352 !! end
26353
26354 !! test
26355 2. Headings: Add space before/after == even after hoisted content
26356 !! options
26357 parsoid={
26358 "modes": ["html2wt"],
26359 "scrubWikitext": true
26360 }
26361 !! html/parsoid
26362 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26363 !! wikitext
26364 [[Category:A2]]
26365
26366 == ok ==
26367 !! end
26368
26369 !! test
26370 1. Headings: suppress newly created empty headings
26371 !! options
26372 parsoid={
26373 "modes": ["html2wt"],
26374 "scrubWikitext": true
26375 }
26376 !! html/parsoid
26377 <h2></h2>
26378 !! wikitext
26379 !! end
26380
26381 !! test
26382 2. Headings: don't suppress empty headings if scrubWikitext is false
26383 !! options
26384 parsoid=html2wt
26385 !! html/parsoid
26386 <h2></h2>
26387 !! wikitext
26388 ==<nowiki/>==
26389 !! end
26390
26391 !! test
26392 3. Headings: suppress empty headings on edits
26393 !! options
26394 parsoid={
26395 "modes": ["selser"],
26396 "scrubWikitext": true,
26397 "changes": [
26398 [ "#x", "remove"]
26399 ]
26400 }
26401 !! wikitext
26402 ==<span id="x">foo</span>==
26403 !! wikitext/edited
26404 !! end
26405
26406 !! test
26407 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26408 !! options
26409 parsoid={
26410 "modes": ["html2wt"],
26411 "scrubWikitext": true
26412 }
26413 !! html/parsoid
26414 <h2>foo<br/>bar</h2>
26415 <h2>foo <span><br/>bar</span> baz</h2>
26416 !! wikitext
26417 == foo bar ==
26418
26419 == foo <span> bar</span> baz ==
26420 !! end
26421
26422 !! test
26423 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26424 !! options
26425 parsoid={
26426 "modes": ["html2wt"],
26427 "scrubWikitext": false
26428 }
26429 !! html/parsoid
26430 <h2>foo<br/>bar</h2>
26431 !! wikitext
26432 == foo<br> bar ==
26433 !! end
26434
26435 !! test
26436 1. WT Quote Tags: suppress newly created empty style tags
26437 !! options
26438 parsoid={
26439 "modes": ["html2wt"],
26440 "scrubWikitext": true
26441 }
26442 !! html/parsoid
26443 <i></i><b></b>
26444 !! wikitext
26445 !! end
26446
26447 !! test
26448 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26449 !! options
26450 parsoid=html2wt
26451 !! html/parsoid
26452 <i></i><b></b>
26453 !! wikitext
26454 ''<nowiki/>'''''<nowiki/>'''
26455 !! end
26456
26457 !! test
26458 3. WT Quote Tags: suppress empty style tags on edits
26459 !! options
26460 parsoid={
26461 "modes": ["selser"],
26462 "scrubWikitext": true,
26463 "changes": [
26464 [ "#x", "remove"]
26465 ]
26466 }
26467 !! wikitext
26468 '''<span id="x">foo</span>'''
26469 !! wikitext/edited
26470 !! end
26471
26472 !! test
26473 1. Anchors: suppress newly created empty anchors
26474 !! options
26475 parsoid={
26476 "modes": ["html2wt"],
26477 "scrubWikitext": true
26478 }
26479 !! html/parsoid
26480 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26481 !! wikitext
26482 !! end
26483
26484 !! test
26485 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26486 !! options
26487 parsoid={
26488 "modes": ["html2wt"],
26489 "scrubWikitext": false
26490 }
26491 !! html/parsoid
26492 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26493 !! wikitext
26494 [[Test|<nowiki/>]]
26495 !! end
26496
26497 !! test
26498 3. Anchors: suppress empty anchors on edits
26499 !! options
26500 parsoid={
26501 "modes": ["selser"],
26502 "scrubWikitext": true,
26503 "changes": [
26504 [ "#x", "remove"]
26505 ]
26506 }
26507 !! wikitext
26508 [[Test|<span id="x">foo</span>]]
26509 !! wikitext/edited
26510 !! end
26511
26512 !! test
26513 3a. Anchors: do not suppress numbered extlinks
26514 !! options
26515 parsoid={
26516 "modes": ["wt2wt"],
26517 "scrubWikitext": true
26518 }
26519 !! wikitext
26520 [http://foo.com]
26521 !! html/parsoid
26522 <a rel="mw:ExtLink" href="http://foo.com"></a>
26523 !! end
26524
26525 !! test
26526 3b. Anchors: do not suppress numbered extlinks
26527 !! options
26528 parsoid={
26529 "modes": ["wt2wt"],
26530 "scrubWikitext": true,
26531 "changes": [
26532 [ "#x", "remove"]
26533 ]
26534 }
26535 !! wikitext
26536 [http://foo.com <span id="x">foo</span>]
26537 !! wikitext/edited
26538 [http://foo.com]
26539 !! end
26540
26541 !!test
26542 Normalizations should be restricted to edited content
26543 !!options
26544 parsoid={
26545 "modes": ["selser"],
26546 "scrubWikitext": true,
26547 "changes": [
26548 [ "h1", "before", "<i></i>"]
26549 ]
26550 }
26551 !!wikitext
26552 a
26553 = =
26554 b
26555 !!wikitext/edited
26556 a
26557 = =
26558 b
26559 !!end
26560
26561 !! test
26562 1. Multiple normalizations (html2wt)
26563 !! options
26564 parsoid={
26565 "modes": ["html2wt"],
26566 "scrubWikitext": true
26567 }
26568 !! html
26569 <h2><i></i></h2>
26570 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26571 </a><b><i></i></b>x</p>
26572 !! wikitext
26573
26574 [[foo]]
26575 x
26576
26577 !! end
26578
26579 !! test
26580 2. Multiple normalizations (selser)
26581 !! options
26582 parsoid={
26583 "modes": ["selser"],
26584 "scrubWikitext": true,
26585 "changes": [
26586 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26587 ]
26588 }
26589 !! wikitext
26590 <span id="x">foo</span>
26591 !! wikitext/edited
26592 <span id="x">foo</span>
26593
26594 x
26595 !! end
26596
26597 !! test
26598 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26599 !! options
26600 parsoid={
26601 "modes": ["html2wt"],
26602 "scrubWikitext": true
26603 }
26604 !! html/parsoid
26605 <p> hi</p>
26606 <p> hello</p>
26607 !! wikitext
26608 hi
26609
26610 hello
26611 !! end
26612
26613 !! test
26614 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26615 !! options
26616 parsoid=html2wt
26617 !! html/parsoid
26618 <p> hi</p>
26619 <p> hello</p>
26620 !! wikitext
26621 <nowiki> </nowiki>hi
26622
26623 <nowiki> </nowiki> hello
26624 !! end
26625
26626 !! test
26627 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26628 !! options
26629 parsoid={
26630 "modes": ["html2wt"],
26631 "scrubWikitext": true
26632 }
26633 !! html/parsoid
26634 <p>Foo
26635 bar
26636 baz</p>
26637
26638 <table><tr><td>Foo
26639 bar
26640 baz bang</td></tr></table>
26641
26642 <p><!--boo--> foo
26643 bar</p>
26644
26645 <p> foo
26646 bar<span>boo</span></p>
26647 !! wikitext
26648 Foo
26649 bar
26650 baz
26651
26652 {|
26653 |Foo
26654 bar
26655 baz bang
26656 |}
26657
26658 <!--boo-->foo
26659 bar
26660
26661 foo
26662 bar<span>boo</span>
26663 !! end
26664
26665 !! test
26666 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26667 !! options
26668 parsoid={
26669 "modes": ["selser"],
26670 "scrubWikitext": true,
26671 "changes": [
26672 [ "p", "html", " a\n b" ]
26673 ]
26674 }
26675 !! wikitext
26676 xyz
26677 !! wikitext/edited
26678 a
26679 b
26680 !! end
26681
26682 !! test
26683 1. New links that end in spaces
26684 !! options
26685 parsoid={
26686 "modes": ["html2wt"],
26687 "scrubWikitext": false
26688 }
26689 !! html/parsoid
26690 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26691 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26692 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26693 !! wikitext
26694 [[Berlin ]]<nowiki/>is the capital of Germany.
26695
26696 [[Foo ]]'''bar'''
26697
26698 [[Boston ]] is a city.
26699 !! end
26700
26701 !! test
26702 2. New links that end in spaces
26703 !! options
26704 parsoid={
26705 "modes": ["html2wt"],
26706 "scrubWikitext": true
26707 }
26708 !! html/parsoid
26709 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26710 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26711 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26712 !! wikitext
26713 [[Berlin]] is the capital of Germany.
26714
26715 [[Foo]] '''bar'''
26716
26717 [[Boston]] is a city.
26718 !! end
26719
26720 !! test
26721 1. Table cells with escapable prefixes
26722 !! options
26723 parsoid={
26724 "modes": ["html2wt"],
26725 "scrubWikitext": false
26726 }
26727 !! html
26728 <table>
26729 <tr><td>a</td></tr>
26730 <tr><td>-</td></tr>
26731 <tr><td>+</td></tr>
26732 </table>
26733 !! wikitext
26734 {|
26735 |a
26736 |-
26737 |<nowiki>-</nowiki>
26738 |-
26739 |<nowiki>+</nowiki>
26740 |}
26741 !! end
26742
26743 !! test
26744 2. Table cells with escapable prefixes
26745 !! options
26746 parsoid={
26747 "modes": ["html2wt"],
26748 "scrubWikitext": true
26749 }
26750 !! html
26751 <table>
26752 <tr><td>a</td></tr>
26753 <tr><td>-</td></tr>
26754 <tr><td>+</td></tr>
26755 </table>
26756 !! wikitext
26757 {|
26758 |a
26759 |-
26760 | -
26761 |-
26762 | +
26763 |}
26764 !! end
26765
26766 !! test
26767 3a. Table cells with escapable prefixes after edits
26768 !! options
26769 parsoid={
26770 "modes": ["selser"],
26771 "scrubWikitext": true,
26772 "changes": [
26773 [ "table tbody tr:first-child td:first-child", "remove"]
26774 ]
26775 }
26776 !! wikitext
26777 {|
26778 |a||-
26779 |}
26780 !! wikitext/edited
26781 {|
26782 | -
26783 |}
26784 !! end
26785
26786 !! test
26787 3b. Table cells with escapable prefixes after edits
26788 !! options
26789 parsoid={
26790 "modes": ["selser"],
26791 "scrubWikitext": true,
26792 "changes": [
26793 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26794 [ "#x", "remove" ]
26795 ]
26796 }
26797 !! wikitext
26798 {|
26799 |pqr
26800 |<span id="x">foo</span>+
26801 |}
26802 !! wikitext/edited
26803 {|
26804 | -
26805 | +
26806 |}
26807 !! end
26808
26809 # FIXME: This test will fail because
26810 # normalization doesn't realize that the id attribute
26811 # will eliminate the escapable scenario
26812 !! test
26813 4a. Table cells without escapable prefixes after edits
26814 !! options
26815 parsoid={
26816 "modes": ["selser"],
26817 "scrubWikitext": true,
26818 "changes": [
26819 [ "#x", "html", "-" ]
26820 ]
26821 }
26822 !! wikitext
26823 {|
26824 | id="x" |abcd
26825 |}
26826 !! wikitext/edited
26827 {|
26828 | id="x" |-
26829 |}
26830 !! end
26831
26832 ## This tests normalizer's ability to discriminate between
26833 ## cells having identical content.
26834 !! test
26835 4b. Table cells without escapable prefixes after edits
26836 !! options
26837 parsoid={
26838 "modes": ["selser"],
26839 "scrubWikitext": true,
26840 "changes": [
26841 [ "td", "html", "-" ]
26842 ]
26843 }
26844 !! wikitext
26845 {|
26846 |a||b
26847 |}
26848 !! wikitext/edited
26849 {|
26850 | -||-
26851 |}
26852 !! end
26853
26854 ## This tests normalizer's ability to not be tripped by
26855 ## comments (and whitespace)
26856 !! test
26857 4c. Table cells without escapable prefixes after edits
26858 !! options
26859 parsoid={
26860 "modes": ["selser"],
26861 "scrubWikitext": true,
26862 "changes": [
26863 [ "table tbody tr td:first-child", "remove" ]
26864 ]
26865 }
26866 !! wikitext
26867 {|
26868 |-
26869 <!--foo--> |a||-
26870 |}
26871 !! wikitext/edited
26872 {|
26873 |-
26874 <!--foo--> | -
26875 |}
26876 !! end
26877
26878 ## This tests normalizer's ability to handle HTML cells
26879 !! test
26880 4d. Table cells without escapable prefixes after edits
26881 !! options
26882 parsoid={
26883 "modes": ["selser"],
26884 "scrubWikitext": true,
26885 "changes": [
26886 [ "td", "html", "-" ]
26887 ]
26888 }
26889 !! wikitext
26890 <table>
26891 <tr><td>a</td></tr>
26892 </table>
26893 !! wikitext/edited
26894 <table>
26895 <tr><td>-</td></tr>
26896 </table>
26897 !! end
26898
26899 ## T111151 Remove font elements without attributes
26900 !! test
26901 5a. font tags without attributes should be dropped in scrubWikitext mode
26902 !! options
26903 parsoid={
26904 "modes": ["html2wt"],
26905 "scrubWikitext": true
26906 }
26907 !! html
26908 <font>foo</font>
26909 <font><font>bar</font></font>
26910 <font class="x">boo</font>
26911 !! wikitext
26912 foo
26913 bar
26914 <font class="x">boo</font>
26915 !! end
26916
26917 !! test
26918 5b. font tags should not be dropped without scrubWikitext being enabled
26919 !! options
26920 parsoid={
26921 "modes": ["html2wt"],
26922 "scrubWikitext": false
26923 }
26924 !! html
26925 <font>foo</font>
26926 !! wikitext
26927 <font>foo</font>
26928 !! end
26929
26930 !! test
26931 Escape nowiki DOM elements
26932 !! options
26933 parsoid=html2wt
26934 !! html/parsoid
26935 <nowiki><i>foo</i></nowiki>
26936 !! wikitext
26937 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26938 !! end
26939
26940 # This is meant to be an interim fix while we go about figuring out
26941 # how to not introduce these trailing <nowiki/>s in the first place.
26942 !! test
26943 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26944 !! options
26945 parsoid=html2wt
26946 !! html/parsoid
26947 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26948 y</p>
26949 <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>
26950 <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>
26951 !! wikitext
26952 x
26953 y
26954
26955 {{echo|
26956 1 = <nowiki/>}}
26957
26958 {{echo|
26959 1 = <nowiki/>
26960 }}
26961 !! end
26962
26963 # ---------------------------------------------------
26964 # End of tests spec'ing wikitext serialization norms |
26965 # ---------------------------------------------------
26966
26967 # T104032
26968 !! test
26969 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26970 !! options
26971 parsoid=html2wt
26972 !! html/parsoid
26973 a<p>b</p>
26974 <b>c</b><p>d</p>
26975 <table><tr>
26976 <td>a<p>b</p></td>
26977 <td><b>c</b><p>d</p></td>
26978 </tr></table>
26979 !! wikitext
26980 a
26981
26982 b
26983
26984 '''c'''
26985
26986 d
26987 {|
26988 |a
26989 b
26990 |'''c'''
26991 d
26992 |}
26993 !! end
26994
26995 # -----------------------------------------------------------------
26996 # End of section for Parsoid-only html2wt tests for serialization
26997 # of new content
26998 # -----------------------------------------------------------------
26999
27000 # -----------------------------------------------------------------
27001 # The following section of tests are primarily to spec behavior of
27002 # the selective serializer. All these tests have manual selser
27003 # changes. The automated selser changes for all tests handle the
27004 # wide variation of changes, but these tests here capture specs
27005 # deterministically.
27006 # ----------------------------------------------------------------
27007
27008 ## T90517
27009 !! test
27010 Selser: New comments should not be lost
27011 !! options
27012 parsoid={
27013 "modes": ["selser"],
27014 "changes": [
27015 [ "#a", "after", "<!--c1-->" ],
27016 [ "#b", "before", "<!--c2-->" ]
27017 ]
27018 }
27019 !! wikitext
27020 <span id="a">a</span>
27021
27022 <span id="b">b</span>
27023 !! wikitext/edited
27024 <span id="a">a</span><!--c1-->
27025
27026 <!--c2--><span id="b">b</span>
27027 !! end
27028
27029 ## T89383
27030 !! test
27031 Selser: Check for validity of DSR before using it
27032 !! options
27033 parsoid={
27034 "modes": ["selser"],
27035 "changes": [
27036 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27037 ]
27038 }
27039 !! wikitext
27040 <span id="a">a</span>
27041 !! wikitext/edited
27042 {{DISPLAYTITLE:foo}}
27043 <span id="a">a</span>
27044 !! end
27045
27046 !! test
27047 1. DOMDiff: Changes to <ref> content should be looked up using id
27048 !! options
27049 parsoid={
27050 "modes": ["selser"],
27051 "changes": [
27052 ["#X", "after", "bar"],
27053 ["#Y", "after", "baz"]
27054 ]
27055 }
27056 !! wikitext
27057 X <ref><span id="X">foo</span></ref>
27058 Y <ref name="a" />
27059 <references>
27060 <ref name="a"><span id="Y">foo</span></ref>
27061 </references>
27062 !! wikitext/edited
27063 X <ref><span id="X">foo</span>bar</ref>
27064 Y <ref name="a" />
27065 <references>
27066 <ref name="a"><span id="Y">foo</span>baz</ref>
27067 </references>
27068 !! end
27069
27070 !! test
27071 2. DOMDiff: Changes to <ref> content should be looked up using id
27072 !! options
27073 parsoid={
27074 "modes": ["selser"],
27075 "changes": [
27076 ["#Z", "after", "bar"]
27077 ]
27078 }
27079 !! wikitext
27080 A <ref>foo bar for a</ref>
27081 B <ref group="X" name="b" />
27082
27083 <references />
27084
27085 <references group="X">
27086 <ref name="b"><span id="Z">foo</span></ref>
27087 </references>
27088 !! wikitext/edited
27089 A <ref>foo bar for a</ref>
27090 B <ref group="X" name="b" />
27091
27092 <references />
27093
27094 <references group="X">
27095 <ref name="b"><span id="Z">foo</span>bar</ref>
27096 </references>
27097 !! end
27098
27099 !! test
27100 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27101 !! options
27102 parsoid={
27103 "modes": ["selser"],
27104 "changes": [
27105 [ "div:first-child", "text", "bar" ]
27106 ]
27107 }
27108 !! wikitext
27109 <div style="{{1x|color:red;}}%">foo</div>
27110 !! wikitext/edited
27111 <div style="{{1x|color:red;}}%">bar</div>
27112 !! end
27113
27114 !! test
27115 Empty LI (T49673)
27116 !! wikitext
27117 * a
27118 *
27119 *
27120 * b
27121 !! html/php+tidy
27122 <ul>
27123 <li>a</li>
27124 <li class="mw-empty-elt"></li>
27125 <li class="mw-empty-elt"></li>
27126 <li>b</li>
27127 </ul>
27128 !! end
27129
27130 !! test
27131 Thumbnail output
27132 !! wikitext
27133 [[File:Thumb.png|thumb]]
27134 !! html/php+tidy
27135 <div class="thumb tright">
27136 <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>
27137 <div class="thumbcaption">
27138 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27139 </div>
27140 </div>
27141 </div>
27142 !! end
27143
27144 !! test
27145 unclosed internal link XSS (T137264)
27146 !! wikitext
27147 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27148 !! html
27149 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27150 </p>
27151 !! end