Merge "API: Log non-whitelisted CORS requests with session cookies"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml
39 #
40 # For testing purposes, temporary articles can created:
41 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
42 # where '/' denotes a newline.
43
44 # This is the standard article assumed to exist.
45 !! article
46 Main Page
47 !! text
48 blah blah
49 !! endarticle
50
51 !!article
52 Foo
53 !!text
54 FOO
55 !!endarticle
56
57 !!article
58 Template:Foo
59 !!text
60 FOO
61 !!endarticle
62
63 !! article
64 Template:Blank
65 !! text
66 !! endarticle
67
68 !! article
69 Template:pipe
70 !! text
71 |
72 !! endarticle
73
74 !! article
75 Template:=
76 !! text
77 <nowiki>=</nowiki>
78 !! endarticle
79
80 !!article
81 MediaWiki:bad image list
82 !!text
83 * [[File:Bad.jpg]] except [[Nasty page]]
84 !!endarticle
85
86 !! article
87 Template:inner list
88 !! text
89 * item 1
90 !! endarticle
91
92 !! article
93 Template:tbl-start
94 !! text
95 {|
96 !! endarticle
97
98 !! article
99 Template:tbl-end
100 !! text
101 |}
102 !! endarticle
103
104 !! article
105 Template:echo
106 !! text
107 {{{1}}}
108 !! endarticle
109
110 !! article
111 Template:echo_with_span
112 !! text
113 <span>{{{1}}}</span>
114 !! endarticle
115
116 !! article
117 Template:echo_with_div
118 !! text
119 <div>{{{1}}}</div>
120 !! endarticle
121
122 !! article
123 Template:blank_param
124 !! text
125 {{{1}}}
126 {{{}}}
127 !! endarticle
128
129 !! article
130 Template:table_attribs
131 !! text
132 <noinclude>
133 |</noinclude>style="color:red;"|Foo
134 !! endarticle
135
136 !! article
137 Template:table_attribs_2
138 !! text
139 <noinclude>
140 |</noinclude>style="color:red;"|Foo
141 |Bar||Baz
142 !! endarticle
143
144 !! article
145 Template:table_attribs_3
146 !! text
147 <noinclude>
148 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
149 !! endarticle
150
151 !! article
152 Template:table_attribs_4
153 !! text
154 | style="background-color:#DC241f;" width="10px" |
155 !! endarticle
156
157 !! article
158 Template:table_attribs_5
159 !! text
160 <noinclude>
161 |</noinclude>style="color:red;"||Bar
162 !! endarticle
163
164 !! article
165 Template:table_attribs_6
166 !! text
167 style="background: <nowiki>
168
169
170 red;</nowiki>" |
171 !! endarticle
172
173 !! article
174 Template:table_attribs_7
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
178 !! endarticle
179
180 !! article
181 Template:table_header_cells
182 !! text
183 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
184 !! endarticle
185
186 !! article
187 Template:table_cells
188 !! text
189 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
190 !! endarticle
191
192 !! article
193 Template:PartialTable
194 !! text
195 {|
196 |-
197 !! endarticle
198
199 !! article
200 Template:image_attribs
201 !! text
202 <noinclude>
203 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
204 !! endarticle
205
206 ## See T48811 for details
207 !! article
208 Template:mixed_attr_content_template
209 !! text
210 style="color:red;" title="T48811"
211 |-
212 |foo
213 !! endarticle
214
215 !! article
216 Template:definition_list
217 !! text
218 one
219 ::two
220 !! endarticle
221
222 !! article
223 A?b
224 !! text
225 Weirdo titles!
226 !! endarticle
227
228 !!article
229 Template:Bullet
230 !!text
231 * Bar
232 !!endarticle
233
234 !!article
235 Template:OpenTable
236 !!text
237 {|
238 !!endarticle
239
240 !!article
241 Template:EmptyLITest
242 !!text
243 *a
244 *
245 *
246 *b
247 !!endarticle
248
249 !!article
250 Template:EmptyTRTest
251 !!text
252 {|
253 |-
254 |-
255 |foo
256 |-
257 |-
258 |bar
259 |}
260 !!endarticle
261
262 !!article
263 Template:EmptyTRWithHTMLAttrTest
264 !!text
265 <table>
266 <tr align="center"></tr>
267 <tr><td>foo</td></tr>
268 <tr align="center"></tr>
269 <tr><td>bar</td></tr>
270 </table>
271 !!endarticle
272
273 ###
274 ### Basic tests
275 ###
276 !! test
277 Blank input
278 !! wikitext
279 !! html
280 !! end
281
282
283 !! test
284 Simple paragraph
285 !! wikitext
286 This is a simple paragraph.
287 !! html
288 <p>This is a simple paragraph.
289 </p>
290 !! end
291
292 !! test
293 Paragraphs with extra newline spacing
294 !! wikitext
295 foo
296
297 bar
298
299
300 baz
301
302
303
304 booz
305 !! html
306 <p>foo
307 </p><p>bar
308 </p><p><br />
309 baz
310 </p><p><br />
311 </p><p>booz
312 </p>
313 !! end
314
315 !! test
316 Paragraphs with newline spacing with comment lines in between
317 !! wikitext
318 ----
319 a
320 <!--foo-->
321 b
322 ----
323 a
324 <!--foo--><!--More than 1 comment, still stripped-->
325 b
326 ----
327 a
328 <!--foo--> <!----> <!-- bar -->
329 b
330 ----
331 a
332 <!--foo-->
333
334 b
335 ----
336 a
337
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo-->
343
344
345 b
346 ----
347 a
348
349
350 <!--foo-->
351 b
352 ----
353 !! html
354 <hr />
355 <p>a
356 b
357 </p>
358 <hr />
359 <p>a
360 b
361 </p>
362 <hr />
363 <p>a
364 b
365 </p>
366 <hr />
367 <p>a
368 </p><p>b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
377 b
378 </p>
379 <hr />
380 <p>a
381 </p><p><br />
382 b
383 </p>
384 <hr />
385
386 !! end
387
388 !! test
389 Paragraphs with newline spacing with non-empty white-space lines in between
390 !! wikitext
391 ----
392 a
393
394 b
395 ----
396 a
397
398
399 b
400 ----
401 !! html
402 <hr />
403 <p>a
404 </p><p>b
405 </p>
406 <hr />
407 <p>a
408 </p><p><br />
409 b
410 </p>
411 <hr />
412
413 !! end
414
415 !! test
416 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
417 !! wikitext
418 ----
419 a
420 <!--foo-->
421 b
422 ----
423 a
424 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
425 b
426 ----
427 a
428
429 <!--foo-->
430 <!--bar-->
431 b
432 ----
433 a
434
435 <!--foo-->
436 <!--bar-->
437
438 b
439 ----
440 !! html
441 <hr />
442 <p>a
443 b
444 </p>
445 <hr />
446 <p>a
447 b
448 </p>
449 <hr />
450 <p>a
451 </p><p>b
452 </p>
453 <hr />
454 <p>a
455 </p><p><br />
456 b
457 </p>
458 <hr />
459
460 !! end
461
462 !! test
463 Extra newlines: More paragraphs with indented comment
464 !! wikitext
465 a
466
467 <!--boo-->
468
469 b
470 !! html
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 !!end
476
477 !! test
478 Extra newlines followed by heading
479 !! wikitext
480 a
481
482
483
484 =b=
485 [[a]]
486
487
488 =b=
489 !! html
490 <p>a
491 </p><p><br />
492 </p>
493 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p><p><br />
496 </p>
497 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
498
499 !! end
500
501 !! test
502 Extra newlines between heading and content are swallowed
503 !! wikitext
504 =b=
505
506
507
508 [[a]]
509 !! html
510 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p>
513 !! end
514
515 !! test
516 Parsing an URL
517 !! wikitext
518 http://fr.wikipedia.org/wiki/🍺
519 <!-- EasterEgg we love beer, better be able be able to link to it -->
520 !! html
521 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
522 </p>
523 !! end
524
525 # Note that the html+tidy output removes the spaces after the <li>,
526 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
527 # This is an issue for all tests with lists. We intentionally do
528 # *not* add html+tidy clauses for these, as we don't want to
529 # document/test the broken behavior. (Parsoid matches the non-tidy
530 # output in these cases.)
531
532 !! test
533 Simple list
534 !! wikitext
535 * Item 1
536 * Item 2
537 !! html
538 <ul><li> Item 1</li>
539 <li> Item 2</li></ul>
540
541 !! end
542
543 !! test
544 Italics and bold
545 !! wikitext
546 * plain
547 * plain''italic''plain
548 * plain''italic''plain''italic''plain
549 * plain'''bold'''plain
550 * plain'''bold'''plain'''bold'''plain
551 * plain''italic''plain'''bold'''plain
552 * plain'''bold'''plain''italic''plain
553 * plain''italic'''bold-italic'''italic''plain
554 * plain'''bold''bold-italic''bold'''plain
555 * plain'''''bold-italic'''italic''plain
556 * plain'''''bold-italic''bold'''plain
557 * plain''italic'''bold-italic'''''plain
558 * plain'''bold''bold-italic'''''plain
559 * plain l'''italic''plain
560 * plain l''''bold''' plain
561 !! html
562 <ul><li> plain</li>
563 <li> plain<i>italic</i>plain</li>
564 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
565 <li> plain<b>bold</b>plain</li>
566 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
567 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
568 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
569 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
570 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
571 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
572 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
573 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
574 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
575 <li> plain l'<i>italic</i>plain</li>
576 <li> plain l'<b>bold</b> plain</li></ul>
577
578 !! end
579
580 # this example taken from the [[simple:Moon]] article (bug 47326)
581 !! test
582 Italics and possessives (1)
583 !! wikitext
584 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
585 !! html
586 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
587 </p>
588 !! end
589
590 # this example taken from [[en:Flaming Pie]] (bug 49926)
591 !! test
592 Italics and possessives (2)
593 !! wikitext
594 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
595 !! html
596 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
597 </p>
598 !! end
599
600 # this example taken from [[en:Dictionary]] (bug 49926)
601 !! test
602 Italics and possessives (3)
603 !! wikitext
604 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
605 !! html
606 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
607 </p>
608 !! end
609
610
611 ###
612 ### 2-quote opening sequence tests
613 ###
614 !! test
615 Italics and bold: 2-quote opening sequence: (2,2)
616 !! wikitext
617 ''foo''
618 !! html
619 <p><i>foo</i>
620 </p>
621 !!end
622
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,3)
625 !! wikitext
626 ''foo'''
627 !! html/*
628 <p><i>foo'</i>
629 </p>
630 !!end
631
632 !! test
633 Italics and bold: 2-quote opening sequence: (2,4)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 ''foo''''
638 !! html/*
639 <p><i>foo''</i>
640 </p>
641 !!end
642
643 # same html as previous, but wikitext adjusted to match parsoid html2wt
644 !! test
645 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
646 !! wikitext
647 ''foo<nowiki>''</nowiki>''
648 !! html
649 <p><i>foo''</i>
650 </p>
651 !! end
652
653 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
654 !! test
655 Italics and bold: 2-quote opening sequence: (2,5)
656 !! options
657 parsoid=wt2html
658 !! wikitext
659 ''foo'''''
660 !! html/php
661 <p><i>foo</i>
662 </p>
663 !! html/parsoid
664 <p><i>foo</i><b></b>
665 </p>
666 !!end
667
668 # same html as previous, but wikitext adjusted to match parsoid html2wt
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
671 !! wikitext
672 ''foo'''''<nowiki/>'''
673 !! html/php
674 <p><i>foo</i>
675 </p>
676 !! html/parsoid
677 <p><i>foo</i><b></b>
678 </p>
679 !! end
680
681
682 ###
683 ### 3-quote opening sequence tests
684 ###
685
686 !! test
687 Italics and bold: 3-quote opening sequence: (3,2)
688 !! wikitext
689 '''foo''
690 !! html/*
691 <p>'<i>foo</i>
692 </p>
693 !!end
694
695 !! test
696 Italics and bold: 3-quote opening sequence: (3,3)
697 !! wikitext
698 '''foo'''
699 !! html
700 <p><b>foo</b>
701 </p>
702 !!end
703
704 !! test
705 Italics and bold: 3-quote opening sequence: (3,4)
706 !! wikitext
707 '''foo''''
708 !! html/*
709 <p><b>foo'</b>
710 </p>
711 !!end
712
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 '''foo'''''
720 !! html/php
721 <p><b>foo</b>
722 </p>
723 !! html/parsoid
724 <p><b>foo</b><i></i>
725 </p>
726 !!end
727
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
731 !! wikitext
732 '''foo'''''<nowiki/>''
733 !! html/php
734 <p><b>foo</b>
735 </p>
736 !! html/parsoid
737 <p><b>foo</b><i></i>
738 </p>
739 !! end
740
741
742 ###
743 ### 4-quote opening sequence tests
744 ###
745
746 !! test
747 Italics and bold: 4-quote opening sequence: (4,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 ''''foo''
752 !! html/*
753 <p>''<i>foo</i>
754 </p>
755 !!end
756
757 # same html as previous, but wikitext adjusted to match parsoid html2wt
758 !! test
759 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
760 !! wikitext
761 <nowiki>''</nowiki>''foo''
762 !! html
763 <p>''<i>foo</i>
764 </p>
765 !! end
766
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,3)
769 !! wikitext
770 ''''foo'''
771 !! html/*
772 <p>'<b>foo</b>
773 </p>
774 !!end
775
776 !! test
777 Italics and bold: 4-quote opening sequence: (4,4)
778 !! options
779 parsoid=wt2html
780 !! wikitext
781 ''''foo''''
782 !! html/*
783 <p>'<b>foo'</b>
784 </p>
785 !!end
786
787 # same html as previous, but wikitext adjusted to match parsoid html2wt
788 !! test
789 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
790 !! wikitext
791 '<nowiki/>'''foo''''
792 !! html
793 <p>'<b>foo'</b>
794 </p>
795 !! end
796
797 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
798 !! test
799 Italics and bold: 4-quote opening sequence: (4,5)
800 !! options
801 parsoid=wt2html
802 !! wikitext
803 ''''foo'''''
804 !! html/php
805 <p>'<b>foo</b>
806 </p>
807 !! html/parsoid
808 <p>'<b>foo</b><i></i>
809 </p>
810 !!end
811
812 # same html as previous, but wikitext adjusted to match parsoid html2wt
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
815 !! wikitext
816 '<nowiki/>'''foo'''''<nowiki/>''
817 !! html/php
818 <p>'<b>foo</b>
819 </p>
820 !! html/parsoid
821 <p>'<b>foo</b><i></i>
822 </p>
823 !! end
824
825
826 ###
827 ### 5-quote opening sequence tests
828 ###
829
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,2)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 '''''foo''
836 !! html/*
837 <p><b><i>foo</i></b>
838 </p>
839 !!end
840
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! wikitext
845 '''''foo'''''
846 !! html/*
847 <p><i><b>foo</b></i>
848 </p>
849 !! end
850
851 !! test
852 Italics and bold: 5-quote opening sequence: (5,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 '''''foo'''
857 !! html/*
858 <p><i><b>foo</b></i>
859 </p>
860 !!end
861
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,3+2)
865 !! wikitext
866 '''''foo'''''
867 !! html
868 <p><i><b>foo</b></i>
869 </p>
870 !! end
871
872 !! test
873 Italics and bold: 5-quote opening sequence: (5,4)
874 !! options
875 parsoid=wt2html
876 !! wikitext
877 '''''foo''''
878 !! html/*
879 <p><i><b>foo'</b></i>
880 </p>
881 !!end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,5)
885 !! wikitext
886 '''''foo'''''
887 !! html
888 <p><i><b>foo</b></i>
889 </p>
890 !!end
891
892 !! test
893 Italics and bold: 5-quote opening sequence: (5,6)
894 !! wikitext
895 '''''foo''''''
896 !! html/*
897 <p><i><b>foo'</b></i>
898 </p>
899 !! end
900
901 ###
902 ### multiple quote sequences in a line
903 ###
904 !! test
905 Italics and bold: multiple quote sequences: (2,4,2)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 ''foo''''bar''
910 !! html/*
911 <p><i>foo'<b>bar</b></i>
912 </p>
913 !!end
914
915
916 # same html as previous, but wikitext adjusted to match parsoid html2wt
917 !! test
918 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
919 !! wikitext
920 ''foo'<nowiki/>'''bar'''''
921 !! html
922 <p><i>foo'<b>bar</b></i>
923 </p>
924 !! end
925
926
927 !! test
928 Italics and bold: multiple quote sequences: (2,4,3)
929 !! options
930 parsoid=wt2html
931 !! wikitext
932 ''foo''''bar'''
933 !! html/*
934 <p><i>foo'<b>bar</b></i>
935 </p>
936 !!end
937
938
939 # same html as previous, but wikitext adjusted to match parsoid html2wt
940 !! test
941 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
942 !! wikitext
943 ''foo'<nowiki/>'''bar'''''
944 !! html
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,4)
952 !! options
953 parsoid=wt2html
954 !! wikitext
955 ''foo''''bar''''
956 !! html/*
957 <p><i>foo'<b>bar'</b></i>
958 </p>
959 !!end
960
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'<nowiki/>'''''
967 !! html
968 <p><i>foo'<b>bar'</b></i>
969 </p>
970 !! end
971
972
973 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
974 !! test
975 Italics and bold: multiple quote sequences: (3,4,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''foo''''bar''
980 !! html/php
981 <p><b>foo'</b>bar
982 </p>
983 !! html/parsoid
984 <p><b>foo'</b>bar<i></i>
985 </p>
986 !!end
987
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
991 !! options
992 parsoid
993 !! wikitext
994 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
995 !! html/php
996 <p><b>foo'</b>bar
997 </p>
998 !! html/parsoid
999 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1000 </p>
1001 !! end
1002
1003
1004 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1005 !! test
1006 Italics and bold: multiple quote sequences: (3,4,3)
1007 !! options
1008 parsoid=wt2html
1009 !! wikitext
1010 '''foo''''bar'''
1011 !! html/php
1012 <p><b>foo'</b>bar
1013 </p>
1014 !! html/parsoid
1015 <p><b>foo'</b>bar<b></b>
1016 </p>
1017 !!end
1018
1019 # same html as previous, but wikitext adjusted to match parsoid html2wt
1020 !! test
1021 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1022 !! wikitext
1023 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1024 !! html/php
1025 <p><b>foo'</b>bar
1026 </p>
1027 !! html/parsoid
1028 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1029 </p>
1030 !! end
1031
1032 ###
1033 ### other quote tests
1034 ###
1035 !! test
1036 Italics and bold: other quote tests: (2,3,5)
1037 !! wikitext
1038 ''this is about '''foo's family'''''
1039 !! html
1040 <p><i>this is about <b>foo's family</b></i>
1041 </p>
1042 !!end
1043
1044
1045 !! test
1046 Italics and bold: other quote tests: (2,(3,3),2)
1047 !! wikitext
1048 ''this is about '''foo's''' family''
1049 !! html
1050 <p><i>this is about <b>foo's</b> family</i>
1051 </p>
1052 !!end
1053
1054
1055 !! test
1056 Italics and bold: other quote tests: (3,2,3,2)
1057 !! options
1058 parsoid=wt2html
1059 !! wikitext
1060 '''this is about ''foo'''s family''
1061 !! html/*
1062 <p><b>this is about <i>foo</i></b><i>s family</i>
1063 </p>
1064 !!end
1065
1066
1067 # same html as previous, but wikitext adjusted to match parsoid html2wt
1068 !! test
1069 Italics and bold: other quote tests: (3,2,3+2+2,2)
1070 !! wikitext
1071 '''this is about ''foo'''''<nowiki/>''s family''
1072 !! html
1073 <p><b>this is about <i>foo</i></b><i>s family</i>
1074 </p>
1075 !! end
1076
1077
1078 !! test
1079 Italics and bold: other quote tests: (3,2,3,3)
1080 !! wikitext
1081 '''this is about ''foo'''s family'''
1082 !! html/*
1083 <p>'<i>this is about </i>foo<b>s family</b>
1084 </p>
1085 !!end
1086
1087
1088 !! test
1089 Italics and bold: other quote tests: (3,(2,2),3)
1090 !! wikitext
1091 '''this is about ''foo's'' family'''
1092 !! html
1093 <p><b>this is about <i>foo's</i> family</b>
1094 </p>
1095 !!end
1096
1097
1098 !! test
1099 Italicized possessive
1100 !! wikitext
1101 The ''[[Main Page]]'''s talk page.
1102 !! html/php
1103 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1104 </p>
1105 !! html/parsoid
1106 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1107 !! end
1108
1109 !! test
1110 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1111 (Requires tidy for PHP parser output to be fixed up)
1112 !! options
1113 parsoid=wt2html,wt2wt
1114 !! wikitext
1115 {|
1116 !''a!!''b
1117 |''a||''b
1118 |}
1119 !! html/php+tidy
1120 <table>
1121 <tr>
1122 <th><i>a</i></th>
1123 <th><i>b</i></th>
1124 <td><i>a</i></td>
1125 <td><i>b</i></td>
1126 </tr>
1127 </table>
1128 !! html/parsoid
1129 <table>
1130 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1131 <td><i>a</i></td><td><i>b</i></td></tr>
1132 </tbody></table>
1133 !! end
1134
1135 ###
1136 ### Non-html5 tags
1137 ###
1138
1139 !! test
1140 Non-html5 tags should be accepted
1141 !! wikitext
1142 <center>''foo''</center>
1143 <big>''foo''</big>
1144 <font>''foo''</font>
1145 <strike>''foo''</strike>
1146 <tt>''foo''</tt>
1147 !! html
1148 <center><i>foo</i></center>
1149 <p><big><i>foo</i></big>
1150 <font><i>foo</i></font>
1151 <strike><i>foo</i></strike>
1152 <tt><i>foo</i></tt>
1153 </p>
1154 !! end
1155
1156 !! test
1157 <wbr> is valid wikitext (bug 52468)
1158 !! wikitext
1159 <wbr>
1160 !! html
1161 <p><wbr />
1162 </p>
1163 !! end
1164
1165 # <strike> is HTML4, <s> is HTML4/5.
1166 !! test
1167 <s> or <strike> for strikethrough
1168 !! wikitext
1169 <strike>strike</strike>
1170
1171 <s>s</s>
1172 !! html
1173 <p><strike>strike</strike>
1174 </p><p><s>s</s>
1175 </p>
1176 !! end
1177
1178 ## a not permitted
1179 ## i,b,br omitted
1180 !! test
1181 Text-level semantic html elements in wikitext
1182 !! wikitext
1183 <em>text</em>
1184 <strong>text</strong>
1185 <small>text</small>
1186 <s>text</s>
1187 <cite>text</cite>
1188 <q>text</q>
1189 <dfn>text</dfn>
1190 <abbr>text</abbr>
1191 <data>text</data>
1192 <time>text</time>
1193 <code>text</code>
1194 <var>text</var>
1195 <samp>text</samp>
1196 <kbd>text</kbd>
1197 <sub>text</sub>
1198 <u>text</u>
1199 <mark>text</mark>
1200 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1201 <bdi>text</bdi>
1202 <bdo>text</bdo>
1203 <span>text</span>
1204 <wbr />
1205 !! html
1206 <p><em>text</em>
1207 <strong>text</strong>
1208 <small>text</small>
1209 <s>text</s>
1210 <cite>text</cite>
1211 <q>text</q>
1212 <dfn>text</dfn>
1213 <abbr>text</abbr>
1214 <data>text</data>
1215 <time>text</time>
1216 <code>text</code>
1217 <var>text</var>
1218 <samp>text</samp>
1219 <kbd>text</kbd>
1220 <sub>text</sub>
1221 <u>text</u>
1222 <mark>text</mark>
1223 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1224 <bdi>text</bdi>
1225 <bdo>text</bdo>
1226 <span>text</span>
1227 <wbr />
1228 </p>
1229 !! end
1230
1231 # test cases taken from
1232 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1233 !! test
1234 Ruby markup (W3C-style)
1235 !! wikitext
1236 ; Mono-ruby for individual base characters
1237 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1238 ; Group ruby
1239 : <ruby>今日<rt>きょう</rt></ruby>
1240 ; Jukugo ruby
1241 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1242 ; Inline ruby
1243 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1244 ; Double-sided ruby
1245 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1246 <ruby>
1247 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1248 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1249 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1250 </ruby>
1251 !! html
1252 <dl><dt> Mono-ruby for individual base characters</dt>
1253 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1254 <dt> Group ruby</dt>
1255 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1256 <dt> Jukugo ruby</dt>
1257 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1258 <dt> Inline ruby</dt>
1259 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1260 <dt> Double-sided ruby</dt>
1261 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1262 <p><ruby>
1263 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1264 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1265 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1266 </ruby>
1267 </p>
1268 !! end
1269
1270 # The next two test different paths in the sanitizer.
1271 !! test
1272 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1273 !! wikitext
1274 <blockquote|>a</blockquote>
1275
1276 <b→> doesn't terminate </b→>
1277
1278 <bä> doesn't terminate </bä>
1279
1280 <boo> doesn't terminate </boo>
1281
1282 <s.foo> doesn't terminate </s.foo>
1283
1284 <sub-ID#1>
1285 !! html
1286 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1287 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1288 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1289 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1290 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1291 </p><p>&lt;sub-ID#1&gt;
1292 </p>
1293 !! end
1294
1295 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1296 # If the non-word-character tag made it through the sanitizer, tidy
1297 # would munge it up.
1298 !! test
1299 Non-word characters don't terminate tag names + tidy
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html+tidy
1313 <p>&lt;blockquote|&gt;a</p>
1314 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1315 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1316 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1317 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1318 <p>&lt;sub-ID#1&gt;</p>
1319 !! end
1320
1321 ###
1322 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1323 ### This checks that HTML5 tags (with non-word characters in the tag
1324 ### name) make it safely through the parser -- the Sanitizer will
1325 ### munge them later, as it should.
1326 ###
1327 !! test
1328 Non-word characters are valid in extension tags (T19663)
1329 !! wikitext
1330 <tåg>tåg</tåg>
1331 !! html/php
1332 <pre>
1333 'tåg'
1334 array (
1335 )
1336 </pre>
1337
1338 !! html/parsoid
1339 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1340 !! end
1341
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1348
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1355
1356 ###
1357 ### Special characters
1358 ###
1359
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1363 |
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1368
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1377
1378 ###
1379 ### <nowiki> test cases
1380 ###
1381
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1392
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1397
1398 sed abit.
1399 sed nullum.
1400
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1405
1406 sed abit.
1407 sed nullum.
1408
1409 :and a colon
1410
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1414
1415 sed abit.
1416 sed nullum.
1417
1418 :and a colon
1419 </span></p>
1420 !! end
1421
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1427
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1430
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1440
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1444
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1447
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1451
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Entities inside template parameters
1463 !! wikitext
1464 {{echo|&ndash;}}
1465 !! html/php+tidy
1466 <p>–</p>
1467 !! html/parsoid
1468 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1469 !! end
1470
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html/parsoid
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1480
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1490
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1504
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1516
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1525 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1530
1531 !! test
1532 T53961: Output correct nowikis in template arguments
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|<nowiki>a }} b</nowiki>}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1548
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1557
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1563 {|
1564 !<nowiki>this needs protection !! here</nowiki>
1565 |}
1566
1567 {|
1568 !this does not need
1569 protection !! here
1570 |}
1571 !! end
1572
1573 ###
1574 ### Comments
1575 ###
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1586
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1599 xyz
1600 </pre>
1601 !! end
1602
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1608 jkl
1609 !! html
1610 <p>asdf
1611 jkl
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620
1621 jkl
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1627
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1634 jkl
1635 !! html
1636 <p>asdf
1637 jkl
1638 </p>
1639 !! end
1640
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment spacing
1652 !! wikitext
1653 a
1654 <!-- foo --> b <!-- bar -->
1655 c
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1670
1671 !! end
1672
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1678
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1689
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1711
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1722
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1736
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1757
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1765
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1774
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1778 a
1779 {{blank}}<!---->
1780 b
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
1789 !! wikitext
1790 a
1791 {{blank}} <!---->
1792 b
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1798
1799 !! test
1800 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html/php
1807 <ul><li>a</li>
1808 <li>b</li></ul>
1809
1810 !! html/parsoid
1811 <!--c1--><ul>
1812 <li>a
1813 </li>
1814 <!--c2--><!--c3--><!--c4-->
1815 <li>b
1816 </li>
1817 </ul>
1818 !! end
1819
1820 ###
1821 ### paragraph wrapping tests
1822 ###
1823 !! test
1824 No block tags
1825 !! wikitext
1826 a
1827
1828 b
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1834
1835 !! test
1836 Block tag on one line (<div>)
1837 !! wikitext
1838 a <div>foo</div>
1839
1840 b
1841 !! html
1842 a <div>foo</div>
1843 <p>b
1844 </p>
1845 !! html+tidy
1846 <p>a</p>
1847 <div>foo</div>
1848 <p>b</p>
1849 !! end
1850
1851 !! test
1852 Block tag on one line (<blockquote>)
1853 !! wikitext
1854 a <blockquote>foo</blockquote>
1855
1856 b
1857 !! html
1858 a <blockquote>foo</blockquote>
1859 <p>b
1860 </p>
1861 !! html+tidy
1862 <p>a</p>
1863 <blockquote>
1864 <p>foo</p>
1865 </blockquote>
1866 <p>b</p>
1867 !! end
1868
1869 !! test
1870 Block tag on both lines (<div>)
1871 !! wikitext
1872 a <div>foo</div>
1873
1874 b <div>foo</div>
1875 !! html
1876 a <div>foo</div>
1877 b <div>foo</div>
1878
1879 !! html+tidy
1880 <p>a</p>
1881 <div>foo</div>
1882 <p>b</p>
1883 <div>foo</div>
1884 !! end
1885
1886 !! test
1887 Block tag on both lines (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b <blockquote>foo</blockquote>
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 b <blockquote>foo</blockquote>
1895
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 <blockquote>
1903 <p>foo</p>
1904 </blockquote>
1905 !! end
1906
1907 !! test
1908 Multiple lines without block tags
1909 !! wikitext
1910 <div>foo</div> a
1911 b
1912 c
1913 d<!--foo--> e
1914 x <div>foo</div> z
1915 !! html
1916 <div>foo</div> a
1917 <p>b
1918 c
1919 d e
1920 </p>
1921 x <div>foo</div> z
1922
1923 !! html+tidy
1924 <div>foo</div>
1925 <p>a</p>
1926 <p>b c d e</p>
1927 <p>x</p>
1928 <div>foo</div>
1929 <p>z</p>
1930 !! end
1931
1932 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1933 # So, we have a separate section for Parsoid. We don't want
1934 # to mimic this stripping behavior in Parsoid. It affects
1935 # editing experience and also requires us to maintain additional
1936 # info for RT-ing.
1937 !! test
1938 Empty lines between lines with block tags
1939 !! wikitext
1940 <div></div>
1941
1942
1943 <div></div>a
1944
1945 b
1946 <div>a</div>b
1947
1948 <div>b</div>d
1949
1950
1951 <div>e</div>
1952 !! html
1953 <div></div>
1954 <p><br />
1955 </p>
1956 <div></div>a
1957 <p>b
1958 </p>
1959 <div>a</div>b
1960 <div>b</div>d
1961 <p><br />
1962 </p>
1963 <div>e</div>
1964
1965 !! html+tidy
1966 <p><br /></p>
1967 <p>a</p>
1968 <p>b</p>
1969 <div>a</div>
1970 <p>b</p>
1971 <div>b</div>
1972 <p>d</p>
1973 <p><br /></p>
1974 <div>e</div>
1975 !! html/parsoid
1976 <div data-parsoid='{"stx":"html"}'></div>
1977
1978 <p><br /></p>
1979 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1980
1981 <p>b</p>
1982 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1983
1984 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1985
1986 <p><br /></p>
1987 <div data-parsoid='{"stx":"html"}'>e</div>
1988 !! end
1989
1990 ## PHP parser emits output which is broken
1991 !! test
1992 Unclosed HTML p-tags should be handled properly
1993 !! wikitext
1994 <div><p>foo</div>
1995 a
1996
1997 b
1998 !! html/php+tidy
1999 <div>
2000 <p>foo</p>
2001 </div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! html/parsoid
2005 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2006 <p>a</p>
2007 <p>b</p>
2008 !! end
2009
2010 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2011 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2012 ## them for now.
2013 !! test
2014 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2015 !! options
2016 parsoid=wt2html
2017 !! wikitext
2018 a [[Category:A1]] [[Category:A2]]
2019 [[Category:A3]]
2020 [[Category:A4]]
2021 !! html/parsoid
2022 <p>a</p>
2023 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2024 !! end
2025
2026 !! test
2027 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2028 !! options
2029 parsoid=wt2html
2030 !! wikitext
2031 [[Category:A1]]a
2032 !! html/parsoid
2033 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2034 !! end
2035
2036 ###
2037 ### Preformatted text
2038 ###
2039 !! test
2040 Preformatted text
2041 !! wikitext
2042 This is some
2043 Preformatted text
2044 With ''italic''
2045 And '''bold'''
2046 And a [[Main Page|link]]
2047 !! html
2048 <pre>This is some
2049 Preformatted text
2050 With <i>italic</i>
2051 And <b>bold</b>
2052 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2053 </pre>
2054 !! end
2055
2056 !! test
2057 Tabs don't trigger preformatted text
2058 !! wikitext
2059 This is not
2060 preformatted text.
2061 This is preformatted text.
2062 So is this.
2063 !! html/php
2064 <p> This is not
2065 preformatted text.
2066 </p>
2067 <pre>This is preformatted text.
2068 So is this.
2069 </pre>
2070 !! html/parsoid
2071 <p> This is not
2072 preformatted text.</p>
2073 <pre>This is preformatted text.
2074 So is this.</pre>
2075 !! end
2076
2077 !! test
2078 Space before tab needs nowiki pre protection
2079 !! options
2080 parsoid=html2wt
2081 !! html/parsoid
2082 <p> a</p>
2083 !! wikitext
2084 <nowiki> </nowiki> a
2085 !! end
2086
2087 !! test
2088 Ident preformatting with inline content
2089 !! wikitext
2090 a
2091 ''b''
2092 !! html
2093 <pre>a
2094 <i>b</i>
2095 </pre>
2096 !! end
2097
2098 !! test
2099 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2100 !! wikitext
2101 <pre><nowiki>
2102 <b>
2103 <cite>
2104 <em>
2105 </nowiki></pre>
2106 !! html
2107 <pre>
2108 &lt;b&gt;
2109 &lt;cite&gt;
2110 &lt;em&gt;
2111 </pre>
2112
2113 !! end
2114
2115 !! test
2116 Regression with preformatted in <center>
2117 !! wikitext
2118 <center>
2119 Blah
2120 </center>
2121 !! html
2122 <center>
2123 <pre>Blah
2124 </pre>
2125 </center>
2126
2127 !! end
2128
2129 !! test
2130 Bug 52763: Preformatted in <blockquote>
2131 !! wikitext
2132 <blockquote>
2133 Blah
2134 {|
2135 |
2136 indented cell (no pre-wrapping!)
2137 |}
2138 </blockquote>
2139 !! html
2140 <blockquote>
2141 <p> Blah
2142 </p>
2143 <table>
2144 <tr>
2145 <td>
2146 <p> indented cell (no pre-wrapping!)
2147 </p>
2148 </td></tr></table>
2149 </blockquote>
2150
2151 !! end
2152
2153 !! test
2154 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2155 !! wikitext
2156 <blockquote>
2157 Foo
2158
2159 Bar
2160 </blockquote>
2161 !! html
2162 <blockquote>
2163 <p>Foo
2164 </p><p>Bar
2165 </p>
2166 </blockquote>
2167
2168 !! end
2169
2170 !! test
2171 Bug 15491: <ins>/<del> in blockquote
2172 !! wikitext
2173 <blockquote>
2174 Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p>Foo <del>bar</del> <ins>baz</ins> quux
2179 </p>
2180 </blockquote>
2181
2182 !! end
2183
2184 # Note that the p-wrapping is newline sensitive, which could be
2185 # considered a bug: tidy will wrap only the 'Foo' in the example
2186 # below in a <p> tag. (see comment 23-25 of bug #6200)
2187 !! test
2188 Bug 15491: <ins>/<del> in blockquote (2)
2189 !! wikitext
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192 !! html
2193 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2194 </blockquote>
2195
2196 !! html+tidy
2197 <blockquote>
2198 <p>Foo</p>
2199 <del>bar</del> <ins>baz</ins> quux</blockquote>
2200 !! end
2201
2202 !! test
2203 <pre> with attributes (bug 3202)
2204 !! wikitext
2205 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2206 !! html
2207 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2208
2209 !! end
2210
2211 !! test
2212 <pre> with width attribute (bug 3202)
2213 !! wikitext
2214 <pre width="8">Narrow screen goodies</pre>
2215 !! html
2216 <pre width="8">Narrow screen goodies</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute (bug 3202)
2222 !! wikitext
2223 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 Entities inside <pre>
2231 !! wikitext
2232 <pre>&lt;</pre>
2233 !! html
2234 <pre>&lt;</pre>
2235
2236 !! end
2237
2238 !! test
2239 <pre> with forbidden attribute values (bug 3202)
2240 !! wikitext
2241 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2242 !! html
2243 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2244
2245 !! end
2246
2247 !! test
2248 <nowiki> inside <pre> (bug 13238)
2249 !! wikitext
2250 <pre>
2251 <nowiki>
2252 </pre>
2253 <pre>
2254 <nowiki></nowiki>
2255 </pre>
2256 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2257 !! html
2258 <pre>
2259 &lt;nowiki&gt;
2260 </pre>
2261 <pre>
2262
2263 </pre>
2264 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2265
2266 !! end
2267
2268 !! test
2269 <nowiki> inside of #tag:pre
2270 !! wikitext
2271 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2272 !! html/php
2273 <pre>Foo &#8594;bar</pre>
2274
2275 !! html/parsoid
2276 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2277 !! end
2278
2279 !! test
2280 <nowiki> and <pre> preference (first one wins)
2281 !! wikitext
2282 <pre>
2283 <nowiki>
2284 </pre>
2285 </nowiki>
2286 </pre>
2287
2288 <nowiki>
2289 <pre>
2290 <nowiki>
2291 </pre>
2292 </nowiki>
2293 </pre>
2294
2295 !! html/php
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <p>&lt;/nowiki&gt;
2300 &lt;/pre&gt;
2301 </p><p>
2302 &lt;pre&gt;
2303 &lt;nowiki&gt;
2304 &lt;/pre&gt;
2305
2306 &lt;/pre&gt;
2307 </p>
2308 !! html/parsoid
2309 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2310 </pre>
2311 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2312 &lt;/pre></p>
2313
2314 <p><span typeof="mw:Nowiki">
2315 &lt;pre>
2316 &lt;nowiki>
2317 &lt;/pre>
2318 </span>
2319 &lt;/pre></p>
2320 !! end
2321
2322 !! test
2323 </pre> inside nowiki
2324 !! wikitext
2325 <nowiki></pre></nowiki>
2326 !! html
2327 <p>&lt;/pre&gt;
2328 </p>
2329 !! end
2330
2331 # Parsoid doesn't strip empty tags, like Tidy does.
2332 !! test
2333 Empty pre; pre inside other HTML tags (bug 54946)
2334 !! options
2335 parsoid=wt2html,wt2wt
2336 !! wikitext
2337 a
2338
2339 <div><pre>
2340 foo
2341 </pre></div>
2342 <pre></pre>
2343 !! html/php
2344 <p>a
2345 </p>
2346 <div><pre>
2347 foo
2348 </pre></div>
2349 <pre></pre>
2350
2351 !! html/php+tidy
2352 <p>a</p>
2353 <div>
2354 <pre>
2355 foo
2356 </pre></div>
2357 !! html/parsoid
2358 <p>a</p>
2359
2360 <div><pre>foo
2361 </pre></div>
2362 <pre></pre>
2363 !! end
2364
2365 !! test
2366 HTML pre followed by indent-pre
2367 !! wikitext
2368 <pre>foo</pre>
2369 bar
2370 !! html
2371 <pre>foo</pre>
2372 <pre>bar
2373 </pre>
2374 !! end
2375
2376 # Note that tidy removes the empty <p> tags from the start and end.
2377 # Parsoid does not, by design.
2378 !!test
2379 Block tag pre
2380 !! wikitext
2381 <p><pre>foo</pre></p>
2382 !! html/php+tidy
2383 <pre>
2384 foo
2385 </pre>
2386 !! html/parsoid
2387 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2388 !!end
2389
2390 !!test
2391 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2392 !! wikitext
2393 {{echo|}}
2394 !! html
2395
2396 !!end
2397
2398 !!test
2399 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2400 !! wikitext
2401 {{echo|
2402 foo}}
2403 !! html
2404 <p>foo
2405 </p>
2406 !!end
2407
2408 !! test
2409 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2410 !! wikitext
2411 {{echo|a
2412 b}}
2413 !! html
2414 <pre>a
2415 </pre>
2416 <p>b
2417 </p>
2418 !!end
2419
2420 !! test
2421 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2422 !! wikitext
2423 {{echo|a
2424 b
2425 c
2426 d
2427 e
2428 }}
2429 !! html
2430 <pre>a
2431 </pre>
2432 <p>b
2433 c
2434 </p>
2435 <pre>d
2436 </pre>
2437 <p>e
2438 </p>
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2443 !! wikitext
2444 {{echo| foo}}
2445
2446 {{echo| foo}}{{echo| bar}}
2447
2448 {{echo| foo}}
2449 {{echo| bar}}
2450
2451 {{echo|<!--cmt--> foo}}
2452
2453 <!--cmt-->{{echo| foo}}
2454
2455 {{echo|{{echo| }}bar}}
2456 !! html
2457 <pre>foo
2458 </pre>
2459 <pre>foo bar
2460 </pre>
2461 <pre>foo
2462 bar
2463 </pre>
2464 <pre>foo
2465 </pre>
2466 <pre>foo
2467 </pre>
2468 <pre>bar
2469 </pre>
2470 !!end
2471
2472 !! test
2473 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2474 !! wikitext
2475 {{echo| }}a
2476
2477 {{echo|
2478 }}a
2479
2480 {{echo|
2481 b}}
2482
2483 {{echo|a
2484 }}b
2485
2486 {{echo|a
2487 }} b
2488 !! html
2489 <pre>a
2490 </pre>
2491 <p><br />
2492 </p>
2493 <pre>a
2494 </pre>
2495 <p><br />
2496 </p>
2497 <pre>b
2498 </pre>
2499 <p>a
2500 </p>
2501 <pre>b
2502 </pre>
2503 <p>a
2504 </p>
2505 <pre>b
2506 </pre>
2507 !!end
2508
2509 !! test
2510 Pres with newline attributes
2511 !! wikitext
2512 <pre class="one
2513 two">hi</pre>
2514 !! html/php
2515 <pre class="one two">hi</pre>
2516
2517 !! html/parsoid
2518 <pre class="one
2519 two" data-parsoid='{"stx":"html"}'>hi</pre>
2520 !! end
2521
2522 !! test
2523 Things that look like <pre> tags aren't treated as such
2524 !! wikitext
2525 Barack Obama <President> of the United States
2526 <President></President>
2527 !! html
2528 <p>Barack Obama &lt;President&gt; of the United States
2529 &lt;President&gt;&lt;/President&gt;
2530 </p>
2531 !! end
2532
2533 !! test
2534 Handle broken pre-like tags (bug 64025)
2535 !! options
2536 parsoid=wt2html
2537 !! wikitext
2538 {{echo|<pre <pre>x</pre>}}
2539
2540 <table><pre </table>
2541 !! html/php
2542 <pre>x</pre>
2543 <table>&lt;pre </table>
2544
2545 !! html/php+tidy
2546 <pre>
2547 x
2548 </pre>
2549 <p>&lt;pre</p>
2550 !! html/parsoid
2551 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2552
2553
2554 <p>&lt;pre </p>
2555
2556 <table></table>
2557 !! end
2558
2559 !! test
2560 Parsoid: handle pre with space after attribute
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 <pre style="width:50%;" >{{echo|foo}}</pre>
2565 !! html/php
2566 <pre style="width:50%;">{{echo|foo}}</pre>
2567
2568 !! html/parsoid
2569 <pre style="width:50%;">{{echo|foo}}</pre>
2570 !! end
2571
2572 # TODO / maybe: fix wt2wt for this
2573 !! test
2574 Parsoid: Don't paragraph-wrap fosterable content
2575 !! options
2576 parsoid=wt2html
2577 !! wikitext
2578 {|
2579 <td></td>
2580 <td></td>
2581
2582
2583
2584 |}
2585 !! html
2586 <table>
2587
2588 <tbody>
2589 <tr>
2590 <td></td>
2591
2592 <td></td></tr>
2593
2594
2595
2596 </tbody></table>
2597 !! end
2598
2599 !! test
2600 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 {|
2605 <td>
2606 <td>
2607 </td>
2608
2609
2610
2611 |}
2612 !! html
2613 <table>
2614
2615 <tbody>
2616 <tr>
2617 <td></td>
2618
2619 <td>
2620 </td></tr>
2621
2622
2623
2624 </tbody></table>
2625 !! end
2626
2627
2628 #--------------------------------------------------------------------
2629 # Transclusion parameter whitespace stripping tests
2630 # Behavior is different for positional and named parameters
2631 #--------------------------------------------------------------------
2632 !! test
2633 Templates: Strip leading and trailing whitespace from named-param values
2634 !! wikitext
2635 {{echo|1= a }}
2636
2637 {{echo|1= {{echo|b}} }}
2638
2639 {{echo| 1 =
2640 c }}
2641
2642 {{echo| 1 =
2643 * d
2644 }}
2645 !! html
2646 <p>a
2647 </p><p>b
2648 </p><p>c
2649 </p>
2650 <ul><li> d</li></ul>
2651
2652 !! end
2653
2654 !! test
2655 Templates: Don't strip whitespace from positional-param values
2656 !! wikitext
2657 {{echo|a }}
2658
2659 {{echo|{{echo|b}} }}
2660
2661 {{echo| c
2662 }}
2663
2664 {{echo| {{echo|d}}
2665 }}
2666
2667 {{echo|
2668 e}}
2669
2670 {{echo|
2671 * f}}
2672
2673 {{echo|
2674 }}g
2675 !! html
2676 <p>a
2677 </p><p>b
2678 </p>
2679 <pre>c
2680 </pre>
2681 <p><br />
2682 </p>
2683 <pre>d
2684 </pre>
2685 <p><br />
2686 </p>
2687 <pre>e
2688 </pre>
2689 <p><br />
2690 </p>
2691 <ul><li> f</li></ul>
2692 <p><br />
2693 </p>
2694 <pre>g
2695 </pre>
2696 !! end
2697
2698 !! test
2699 Templates: Handle empty comment-and-ws-only lines correctly
2700 !! wikitext
2701 {{echo|foo
2702 <!--should be ignored-->
2703 <!--should be ignored as well-->
2704 bar}}
2705 !! html
2706 <p>foo
2707 bar
2708 </p>
2709 !! end
2710
2711 !! test
2712 Templates: Handle comments in the target
2713 !! wikitext
2714 {{echo
2715 <!-- should be ignored -->
2716 |foo}}
2717
2718 {{echo<!-- should be ignored -->
2719 |foo}}
2720
2721 {{echo<!-- should be ignored -->|foo}}
2722
2723 {{<!-- should be ignored -->echo|foo}}
2724 !!html/parsoid
2725 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2726
2727 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2728
2729 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2730
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2732 !!end
2733
2734 !! test
2735 Templates: Handle comments in parameter names (bug 67657)
2736 !! wikitext
2737 {{echo|1
2738 <!-- should be ignored -->
2739 =foo}}
2740
2741 {{echo|
2742 <!-- should be ignored -->
2743 1 = foo}}
2744
2745 {{echo|1<!-- should be ignored -->=foo}}
2746
2747 {{echo|<!-- should be ignored -->1=foo}}
2748 !!html/parsoid
2749 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2750
2751 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2752
2753 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2754
2755 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2756 !!end
2757
2758 !! test
2759 Templates: Other wikitext in parameter names (bug 67657)
2760 !! wikitext
2761 {{echo|''1''=foo}}
2762 !!html/parsoid
2763 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2764 !!html/php
2765 <p>{{{1}}}
2766 </p>
2767 !!end
2768
2769 #--------------------------------------------------------------------
2770 # Transclusion parameter escaping tests
2771 #--------------------------------------------------------------------
2772 !! test
2773 Templates: Parsoid parameter escaping test 1
2774 !! wikitext
2775 {{echo|[foo]|{{echo|[bar]}}}}
2776 !! html/php+tidy
2777 <p>[foo]</p>
2778 !! html/parsoid
2779 <p about="#mwt1" typeof="mw:Transclusion"
2780 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2781 !! end
2782
2783 !! test
2784 Parsoid: Pipes in external links in template parameter
2785 !! wikitext
2786 {{echo|[{{echo|http://example.com}} link]}}
2787 !! html/php+tidy
2788 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2789 !! html/parsoid
2790 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2791 !! end
2792
2793 !! test
2794 Parsoid: pipe in transclusion parameter
2795 !! wikitext
2796 {{echo|http://foo.com/a&#124;b}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2803 !! end
2804
2805 !! test
2806 Parsoid: Pipe in external link target and content in template parameter
2807 !! options
2808 parsoid=html2wt,wt2wt
2809 !! wikitext
2810 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2811 !! html/php+tidy
2812 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2813 !! html/parsoid
2814 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2815 typeof="mw:Transclusion"
2816 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2817 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2818 !! end
2819
2820 !! test
2821 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2822 !! options
2823 parsoid
2824 !! wikitext
2825 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2826 !! html
2827 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main_Page bar]</p>
2828 !! end
2829
2830 !! test
2831 Templates: Don't escape already nowiki-escaped text in template parameters
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|foo<nowiki>|</nowiki>bar}}
2836 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2837 {{echo|<nowiki></nowiki>}}
2838 !! html/php+tidy
2839 <p>foo|bar &lt;div&gt;</p>
2840 !! html/parsoid
2841 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2842 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2843 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2844 </p>
2845 !! end
2846
2847 ## Bug 52824
2848 !! test
2849 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2850 !! options
2851 parsoid=html2wt,wt2wt
2852 !! wikitext
2853 {{echo|{{echo|1=bar}}}}
2854 !! html/php+tidy
2855 <p>bar</p>
2856 !! html/parsoid
2857 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2858 !! end
2859
2860 ## Bug 56733
2861 !! test
2862 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2863 !! wikitext
2864 {{echo|a : b}}
2865 !! html/php+tidy
2866 <p>a&#160;: b</p>
2867 !! html/parsoid
2868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2869 !! end
2870
2871 ## Bug T73412
2872 !! test
2873 Templates: Preserve blank parameter names
2874 !! wikitext
2875 {{echo|=foo}}
2876 !! html/php+tidy
2877 <p>{{{1}}}</p>
2878 !! html/parsoid
2879 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2880 !! end
2881
2882 !! test
2883 Templates: Preserve blank parameter names in other positions
2884 !! wikitext
2885 {{blank_param|bar|=foo}}
2886 !! html/php+tidy
2887 <p>bar foo</p>
2888 !! html/parsoid
2889 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2890 foo</p>
2891 !! end
2892
2893 ###
2894 ### Parsoid-centric tests for testing RT edge cases for pre
2895 ###
2896
2897 !!test
2898 1a. Indent-Pre and Comments
2899 !! wikitext
2900 a
2901 <!--a-->
2902 c
2903 !! html
2904 <pre>a
2905 </pre>
2906 <p>c
2907 </p>
2908 !!end
2909
2910 !!test
2911 1b. Indent-Pre and Comments
2912 !! wikitext
2913 a
2914 <!--a-->
2915 c
2916 !! html
2917 <pre>a
2918 </pre>
2919 <p>c
2920 </p>
2921 !!end
2922
2923 !!test
2924 1c. Indent-Pre and Comments
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--a--> a
2929 !! html
2930 <pre> a
2931 </pre>
2932 <pre> a
2933 </pre>
2934 !!end
2935
2936 !!test
2937 1d. Indent-Pre and Comments
2938 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2939 !! wikitext
2940 <!--a--> a
2941
2942 <!--b-->b
2943 !! html
2944 <pre>a
2945 </pre>
2946 <pre>b
2947 </pre>
2948 !!end
2949
2950 !!test
2951 2a. Indent-Pre and tables
2952 !! wikitext
2953 {|
2954 |-
2955 !h1!!h2
2956 |foo||bar
2957 |}
2958 !! html
2959 <table>
2960
2961 <tr>
2962 <th>h1</th>
2963 <th>h2
2964 </th>
2965 <td>foo</td>
2966 <td>bar
2967 </td></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2b. Indent-Pre and tables
2973 !! wikitext
2974 {|
2975 |-
2976 |foo
2977 |}
2978 !! html
2979 <table>
2980
2981 <tr>
2982 <td>foo
2983 </td></tr></table>
2984
2985 !!end
2986
2987 !!test
2988 2c. Indent-Pre and tables (bug 42252)
2989 !! wikitext
2990 {|
2991 |+ foo
2992 ! | bar
2993 |}
2994 !! html
2995 <table>
2996 <caption> foo
2997 </caption>
2998 <tr>
2999 <th> bar
3000 </th></tr></table>
3001
3002 !!end
3003
3004 !!test
3005 2d. Indent-Pre and tables
3006 !! wikitext
3007 a
3008 {|
3009 | b
3010 |}
3011 !! html/php
3012 <pre>a
3013 </pre>
3014 <table>
3015 <tr>
3016 <td> b
3017 </td></tr></table>
3018
3019 !! html/parsoid
3020 <pre>a</pre>
3021 <table>
3022 <tbody><tr><td> b</td></tr>
3023 </tbody></table>
3024 !!end
3025
3026 !!test
3027 2e. Indent-Pre and table-line syntax
3028 !! wikitext
3029 a
3030 | b
3031 | c
3032 !! html/php
3033 <pre>a
3034 | b
3035 | c
3036 </pre>
3037 !!end
3038
3039 !!test
3040 2f. Indent-pre started by table-line syntax
3041 !! wikitext
3042 a
3043 | b
3044 | c
3045 !! html/php
3046 <p>a
3047 </p>
3048 <pre>| b
3049 | c
3050 </pre>
3051 !! html/parsoid
3052 <p>a</p>
3053 <pre>
3054 | b
3055 | c</pre>
3056 !!end
3057
3058 !!test
3059 3a. Indent-Pre and block tags (single-line html)
3060 !! wikitext
3061 a <p> foo </p>
3062 b <div> foo </div>
3063 c <blockquote> foo </blockquote>
3064 <span> foo </span>
3065 !! html
3066 a <p> foo </p>
3067 b <div> foo </div>
3068 c <blockquote> foo </blockquote>
3069 <pre><span> foo </span>
3070 </pre>
3071 !! html/parsoid
3072 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3073 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3074 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3075 <pre><span> foo </span>
3076 </pre>
3077 !! html+tidy
3078 <p>a</p>
3079 <p>foo</p>
3080 <p>b</p>
3081 <div>foo</div>
3082 <p>c</p>
3083 <blockquote>
3084 <p>foo</p>
3085 </blockquote>
3086 <pre>
3087 <span> foo </span>
3088 </pre>
3089 !! end
3090
3091 !!test
3092 3b. Indent-Pre and block tags (multi-line html)
3093 !! wikitext
3094 a <span>foo</span>
3095 b <div> foo </div>
3096 !! html
3097 <pre>a <span>foo</span>
3098 </pre>
3099 b <div> foo </div>
3100
3101 !! html/parsoid
3102 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3103 b <div data-parsoid='{"stx":"html"}'> foo </div>
3104 !! html+tidy
3105 <pre>
3106 a <span>foo</span>
3107 </pre>
3108 <p>b</p>
3109 <div>foo</div>
3110 !!end
3111
3112 !!test
3113 3c. Indent-Pre and block tags (pre-content on separate line)
3114 !! wikitext
3115 <p>
3116 foo
3117 </p>
3118
3119 <div>
3120 foo
3121 </div>
3122
3123 <center>
3124 foo
3125 </center>
3126
3127 <blockquote>
3128 foo
3129 </blockquote>
3130
3131 <blockquote>
3132 <pre>
3133 foo
3134 </pre>
3135 </blockquote>
3136
3137 <table><tr><td>
3138 foo
3139 </td></tr></table>
3140
3141 <ul><li>
3142 foo
3143 </li></ul>
3144
3145 !! html
3146 <p>
3147 foo
3148 </p>
3149 <div>
3150 <pre>foo
3151 </pre>
3152 </div>
3153 <center>
3154 <pre>foo
3155 </pre>
3156 </center>
3157 <blockquote>
3158 <p> foo
3159 </p>
3160 </blockquote>
3161 <blockquote>
3162 <pre>
3163 foo
3164 </pre>
3165 </blockquote>
3166 <table><tr><td>
3167 <pre>foo
3168 </pre>
3169 </td></tr></table>
3170 <ul><li>
3171 foo
3172 </li></ul>
3173
3174 !!end
3175
3176 !!test
3177 4. Indent-Pre and extension tags
3178 !! wikitext
3179 a <gallery>
3180 File:foobar.jpg
3181 </gallery>
3182 !! html
3183 a <ul class="gallery mw-gallery-traditional">
3184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3185 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3186 <div class="gallerytext">
3187 </div>
3188 </div></li>
3189 </ul>
3190
3191 !! html+tidy
3192 <p>a</p>
3193 <ul class="gallery mw-gallery-traditional">
3194 <li class="gallerybox" style="width: 155px">
3195 <div style="width: 155px">
3196 <div class="thumb" style="width: 150px;">
3197 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3198 </div>
3199 <div class="gallerytext"></div>
3200 </div>
3201 </li>
3202 </ul>
3203 !!end
3204
3205 !! test
3206 Table wikitext syntax outside wiki-tables
3207 !! wikitext
3208 a
3209 ! not a table heading
3210 |- not a table row
3211 | not a table cell
3212 | class="foo bar" | baz
3213 b
3214 |}
3215 |-
3216 c
3217 !! html
3218 <p>a
3219 ! not a table heading
3220 |- not a table row
3221 | not a table cell
3222 | class="foo bar" | baz
3223 b
3224 |}
3225 |-
3226 c
3227 </p>
3228 !! end
3229
3230 !!test
3231 Render paragraphs when indent-pre is suppressed in blocklevels
3232 !! wikitext
3233 <blockquote>
3234 foo
3235
3236 bar
3237 </blockquote>
3238 !! html
3239 <blockquote>
3240 <p> foo
3241 </p><p> bar
3242 </p>
3243 </blockquote>
3244
3245 !!end
3246
3247 !!test
3248 4. Multiple spaces at start-of-line
3249 !! wikitext
3250 <p> foo </p>
3251 foo
3252 {|
3253 |foo
3254 |}
3255 !! html
3256 <p> foo </p>
3257 <pre> foo
3258 </pre>
3259 <table>
3260 <tr>
3261 <td>foo
3262 </td></tr></table>
3263
3264 !!end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5a. White-space in indent-pre
3269 !! wikitext
3270 a<br />
3271
3272 b
3273 !! html
3274 <pre>a<br />
3275
3276 b
3277 </pre>
3278 !! end
3279
3280 ## NOTE: the leading white-space chars on empty line are significant
3281 !! test
3282 5b. White-space in indent-pre
3283 !! wikitext
3284 a
3285
3286 b
3287
3288
3289 c
3290 !! html
3291 <pre>a
3292
3293 b
3294
3295
3296 c
3297 </pre>
3298 !! end
3299
3300 !! test
3301 5c. White-space in indent-pre
3302 !! wikitext
3303 ''a''
3304 ''b''
3305 ''c''
3306 !! html
3307 <pre><i>a</i>
3308 <i>b</i>
3309 <i>c</i>
3310 </pre>
3311 !! end
3312
3313 !! test
3314 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3315 !! wikitext
3316 a
3317
3318 <!-- continue -->
3319 b
3320
3321 c
3322
3323 d
3324 !! html
3325 <pre>a
3326
3327 b
3328 </pre>
3329 <pre>c
3330
3331 </pre>
3332 <p>d
3333 </p>
3334 !! end
3335
3336 !! test
3337 7a. Indent-pre and category links
3338 !! options
3339 parsoid=wt2html,wt2wt
3340 !! wikitext
3341 [[Category:foo]] <!-- No pre-wrapping -->
3342 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3343 !! html/php+tidy
3344 !! html/parsoid
3345 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3346 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3347 !! end
3348
3349 ## We used to, but no longer wt2wt this test since the default serializer
3350 ## will normalize all categories to serialize on their own line.
3351 ## This wikitext usage is going to be fairly uncommon in production and
3352 ## selser will take care of preserving formatting in those scenarios.
3353 !! test
3354 7b. Indent-pre and category links
3355 !! options
3356 parsoid=wt2html
3357 !! wikitext
3358 [[Category:foo]] a
3359 [[Category:foo]] {{echo|b}}
3360 !! html/parsoid
3361 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3362 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3363 !! end
3364
3365 !! test
3366 Indent-Pre: Newlines in comments shouldn't affect sol state
3367 !! wikitext
3368 a <!--
3369 foo
3370 --> b
3371 !! html/php+tidy
3372 <p>a b</p>
3373 !! html/parsoid
3374 <p>a <!--
3375 foo
3376 --> b</p>
3377 !! end
3378
3379 ###
3380 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3381 ###
3382
3383 !!test
3384 HTML-pre: 1. embedded newlines
3385 !! wikitext
3386 <pre>foo</pre>
3387
3388 <pre>
3389 foo
3390 </pre>
3391
3392 <pre>
3393
3394 foo
3395 </pre>
3396
3397 <pre>
3398
3399
3400 foo
3401 </pre>
3402 !! html/php+tidy
3403 <pre>
3404 foo
3405 </pre>
3406 <pre>
3407 foo
3408 </pre>
3409 <pre>
3410
3411 foo
3412 </pre>
3413 <pre>
3414
3415
3416 foo
3417 </pre>
3418 !! html/parsoid
3419 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3420
3421 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3422 foo
3423 </pre>
3424
3425 <pre data-parsoid='{"stx":"html"}'>
3426
3427 foo
3428 </pre>
3429
3430 <pre data-parsoid='{"stx":"html"}'>
3431
3432
3433 foo
3434 </pre>
3435 !!end
3436
3437 !! test
3438 HTML-pre: big spaces
3439 !! wikitext
3440 <pre>
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 haha
3451
3452
3453
3454
3455 </pre>
3456 !! html/php+tidy
3457 <pre>
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 haha
3468
3469
3470
3471
3472 </pre>
3473 !! html/parsoid
3474 <pre data-parsoid='{"stx":"html"}'>
3475
3476
3477
3478
3479 haha
3480
3481
3482
3483
3484 haha
3485
3486
3487
3488
3489 </pre>
3490 !! end
3491
3492 !!test
3493 HTML-pre: 2: indented text
3494 !! wikitext
3495 <pre>
3496 foo
3497 </pre>
3498 !! html
3499 <pre>
3500 foo
3501 </pre>
3502
3503 !!end
3504
3505 !!test
3506 HTML-pre: 3: other wikitext
3507 !! wikitext
3508 <pre>
3509 * foo
3510 # bar
3511 = no-h =
3512 '' no-italic ''
3513 [[ NoLink ]]
3514 </pre>
3515 !! html/php
3516 <pre>
3517 * foo
3518 # bar
3519 = no-h =
3520 '' no-italic ''
3521 [[ NoLink ]]
3522 </pre>
3523
3524 !! html/parsoid
3525 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3526 # bar
3527 = no-h =
3528 '' no-italic ''
3529 [[ NoLink ]]
3530 </pre>
3531 !!end
3532
3533 ###
3534 ### Definition lists
3535 ###
3536 !! test
3537 Simple definition
3538 !! wikitext
3539 ; name : Definition
3540 !! html
3541 <dl><dt> name&#160;</dt>
3542 <dd> Definition</dd></dl>
3543
3544 !! end
3545
3546 !! test
3547 Definition list for indentation only
3548 !! wikitext
3549 : Indented text
3550 !! html
3551 <dl><dd> Indented text</dd></dl>
3552
3553 !! end
3554
3555 !! test
3556 Definition list with no space
3557 !! wikitext
3558 ;name:Definition
3559 !! html
3560 <dl><dt>name</dt>
3561 <dd>Definition</dd></dl>
3562
3563 !!end
3564
3565 !! test
3566 Definition list with URL link
3567 !! wikitext
3568 ; http://example.com/ : definition
3569 !! html
3570 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3571 <dd> definition</dd></dl>
3572
3573 !! end
3574
3575 !! test
3576 Definition list with bracketed URL link
3577 !! wikitext
3578 ;[http://www.example.com/ Example]:Something about it
3579 !! html
3580 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3581 <dd>Something about it</dd></dl>
3582
3583 !! end
3584
3585 !! test
3586 Definition list with wikilink containing colon
3587 !! wikitext
3588 ; [[Help:FAQ]]: The least-read page on Wikipedia
3589 !! html
3590 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3591 <dd> The least-read page on Wikipedia</dd></dl>
3592
3593 !! end
3594
3595 # At Brion's and JeLuF's insistence... :)
3596 !! test
3597 Definition list with news link containing colon
3598 !! wikitext
3599 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3600 !! html/php
3601 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3602 <dd> This isn't even a real newsgroup!</dd></dl>
3603
3604 !! html/parsoid
3605 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3606 !! end
3607
3608 !! test
3609 Malformed definition list with colon
3610 !! wikitext
3611 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3612 !! html
3613 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3614
3615 !! end
3616
3617 !! test
3618 Definition lists: colon in external link text
3619 !! wikitext
3620 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3621 !! html
3622 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3623 <dd> OK, I made that up</dd></dl>
3624
3625 !! end
3626
3627 !! test
3628 Definition lists: colon in HTML attribute
3629 !! wikitext
3630 ;<b style="display: inline">bold</b>
3631 !! html
3632 <dl><dt><b style="display: inline">bold</b></dt></dl>
3633
3634 !! end
3635
3636 !! test
3637 Definition lists: self-closed tag
3638 !! wikitext
3639 ;one<br/>two : two-line fun
3640 !! html
3641 <dl><dt>one<br />two&#160;</dt>
3642 <dd> two-line fun</dd></dl>
3643
3644 !! end
3645
3646 !! test
3647 Bug 11748: Literal closing tags
3648 !! wikitext
3649 <dl>
3650 <dt>test 1</dt>
3651 <dd>test test test test test</dd>
3652 <dt>test 2</dt>
3653 <dd>test test test test test</dd>
3654 </dl>
3655 !! html
3656 <dl>
3657 <dt>test 1</dt>
3658 <dd>test test test test test</dd>
3659 <dt>test 2</dt>
3660 <dd>test test test test test</dd>
3661 </dl>
3662
3663 !! end
3664
3665 !! test
3666 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3667 !! wikitext
3668 <ul><li>
3669 ; term : description
3670 * unordered
3671 </li></ul>
3672 !! html
3673 <ul><li>
3674 <dl><dt> term&#160;</dt>
3675 <dd> description</dd></dl>
3676 <ul><li> unordered</li></ul>
3677 </li></ul>
3678
3679 !! end
3680
3681 !! test
3682
3683 Definition list with empty definition and following paragraph
3684 !! wikitext
3685 ; term:
3686 Paragraph text
3687 !! html
3688 <dl><dt> term</dt>
3689 <dd></dd></dl>
3690 <p>Paragraph text
3691 </p>
3692 !! end
3693
3694 !! test
3695 Nested definition lists using html syntax
3696 !! wikitext
3697 <dl><dt>x</dt>
3698 <dd>a</dd>
3699 <dd>b</dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: No nesting: Multiple dd's
3705 !! wikitext
3706 ;x
3707 :a
3708 :b
3709 !! html
3710 <dl><dt>x</dt>
3711 <dd>a</dd>
3712 <dd>b</dd></dl>
3713
3714 !! end
3715
3716 !! test
3717 Definition Lists: Indentation: Regular
3718 !! wikitext
3719 :i1
3720 ::i2
3721 :::i3
3722 !! html
3723 <dl><dd>i1
3724 <dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Missing 1st level
3731 !! wikitext
3732 ::i2
3733 :::i3
3734 !! html
3735 <dl><dd><dl><dd>i2
3736 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3737
3738 !! end
3739
3740 !! test
3741 Definition Lists: Indentation: Multi-level indent
3742 !! wikitext
3743 :::i3
3744 !! html
3745 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3746
3747 !! end
3748
3749 !! test
3750 Definition Lists: Hacky use to indent tables
3751 !! wikitext
3752 ::{|
3753 |foo
3754 |bar
3755 |}
3756 this text
3757 should be left alone
3758 !! html
3759 <dl><dd><dl><dd><table>
3760 <tr>
3761 <td>foo
3762 </td>
3763 <td>bar
3764 </td></tr></table></dd></dl></dd></dl>
3765 <p>this text
3766 should be left alone
3767 </p>
3768 !! end
3769
3770 !! test
3771 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3772 !! wikitext
3773 <!-- foo -->
3774 ::{|
3775 |foo
3776 |bar
3777 |}<!-- bar -->
3778 this text
3779 should be left alone
3780 !! html/parsoid
3781 <!-- foo -->
3782 <dl><dd><dl><dd><table><tr>
3783 <td>foo</td>
3784 <td>bar</td>
3785 </tr></table><!-- bar --></dd></dl></dd></dl>
3786 <p>this text
3787 should be left alone</p>
3788 !! end
3789
3790 !! test
3791 Definition Lists: Hacky use to indent tables, with comment before table
3792 !! wikitext
3793 ::<!-- foo -->{|
3794 |foo
3795 |}
3796 !! html/parsoid
3797 <dl><dd><dl><dd><!-- foo --><table><tr>
3798 <td>foo</td>
3799 </tr></table></dd></dl></dd></dl>
3800 !! end
3801
3802 # The trailing whitespace in this test is to catch a regression in
3803 # Parsoid after T54473.
3804 !! test
3805 Definition Lists: Hacky use to indent tables (WS-insensitive)
3806 !! wikitext
3807 : {|
3808 |a
3809 |}
3810 !! html/php
3811 <dl><dd><table>
3812 <tr>
3813 <td>a
3814 </td></tr></table></dd></dl>
3815
3816 !! html/parsoid
3817 <dl><dd> <table>
3818 <tbody><tr><td>a</td></tr>
3819 </tbody></table> </dd></dl>
3820 !! end
3821
3822 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3823 ## as an empty dt item. It also ignores all but the last ";" when followed
3824 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3825 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3826 ## ";"s.
3827 ##
3828 ## Ex: ";;t2 ::d2" is transformed into:
3829 ##
3830 ## <dl>
3831 ## <dt>t2 </dt>
3832 ## <dd>
3833 ## <dl>
3834 ## <dt></dt>
3835 ## <dd>d2</dd>
3836 ## </dl>
3837 ## </dd>
3838 ## </dl>
3839 ##
3840 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3841 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3842 ##
3843 ## <dl>
3844 ## <dt>
3845 ## <dl>
3846 ## <dt>t2 </dt>
3847 ## <dd>:d2</dd>
3848 ## </dl>
3849 ## </dt>
3850 ## </dl>
3851 ##
3852 ## All Parsoid only definition list tests have this difference.
3853 ##
3854 ## See also: https://phabricator.wikimedia.org/T8569
3855 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3856
3857 !! test
3858 Table / list interaction: indented table with lists in table contents
3859 !! wikitext
3860 :{|
3861 |-
3862 | a
3863 * b
3864 |-
3865 | c
3866 * d
3867 |}
3868 !! html
3869 <dl><dd><table>
3870
3871 <tr>
3872 <td> a
3873 <ul><li> b</li></ul>
3874 </td></tr>
3875 <tr>
3876 <td> c
3877 <ul><li> d</li></ul>
3878 </td></tr></table></dd></dl>
3879
3880 !! end
3881
3882 !!test
3883 Table / list interaction: lists nested in tables nested in indented lists
3884 !! wikitext
3885 :{|
3886 |
3887 :a
3888 :b
3889 |
3890 *c
3891 *d
3892 |}
3893
3894 *e
3895 *f
3896 !! html
3897 <dl><dd><table>
3898 <tr>
3899 <td>
3900 <dl><dd>a</dd>
3901 <dd>b</dd></dl>
3902 </td>
3903 <td>
3904 <ul><li>c</li>
3905 <li>d</li></ul>
3906 </td></tr></table></dd></dl>
3907 <ul><li>e</li>
3908 <li>f</li></ul>
3909
3910 !!end
3911
3912 !! test
3913 Definition Lists: Nesting: Multi-level (Parsoid only)
3914 !! options
3915 parsoid
3916 !! wikitext
3917 ;t1 :d1
3918 ;;t2 ::d2
3919 ;;;t3 :::d3
3920 !! html
3921 <dl>
3922 <dt>t1 </dt>
3923 <dd>d1</dd>
3924 <dt>
3925 <dl>
3926 <dt>t2 </dt>
3927 <dd>:d2</dd>
3928 <dt>
3929 <dl>
3930 <dt>t3 </dt>
3931 <dd>::d3</dd>
3932 </dl>
3933 </dt>
3934 </dl>
3935 </dt>
3936 </dl>
3937
3938
3939 !! end
3940
3941
3942 !! test
3943 Definition Lists: Nesting: Test 2 (Parsoid only)
3944 !! wikitext
3945 ;t1
3946 ::d2
3947 !! html/php+tidy
3948 <dl>
3949 <dt>t1</dt>
3950 <dd>
3951 <dl>
3952 <dd>d2</dd>
3953 </dl>
3954 </dd>
3955 </dl>
3956 !! html/parsoid
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965
3966 !! end
3967
3968
3969 !! test
3970 Definition Lists: Nesting: Test 3 (Parsoid only)
3971 !! wikitext
3972 :;t1
3973 ::::d2
3974 !! html/php+tidy
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dt>t1</dt>
3979 <dd>
3980 <dl>
3981 <dd>
3982 <dl>
3983 <dd>d2</dd>
3984 </dl>
3985 </dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 </dd>
3990 </dl>
3991 !! html/parsoid
3992 <dl>
3993 <dd>
3994 <dl>
3995 <dt>t1</dt>
3996 <dd>
3997 <dl>
3998 <dd>
3999 <dl>
4000 <dd>d2</dd>
4001 </dl>
4002 </dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 </dd>
4007 </dl>
4008
4009 !! end
4010
4011
4012 !! test
4013 Definition Lists: Nesting: Test 4
4014 !! wikitext
4015 ::;t3
4016 :::d3
4017 !! html
4018 <dl><dd><dl><dd><dl><dt>t3</dt>
4019 <dd>d3</dd></dl></dd></dl></dd></dl>
4020
4021 !! end
4022
4023
4024 ## The Parsoid team believes the following three test exposes a
4025 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4026 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4027 ## It also exposes a "misfeature" in tidy, which doesn't like
4028 ## <dl> tags with a single <dt> child; it converts the <dt> into
4029 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4030 !! test
4031 Definition Lists: Mixed Lists: Test 1
4032 !! wikitext
4033 :;* foo
4034 ::* bar
4035 :; baz
4036 !! html/php
4037 <dl><dd><dl><dt><ul><li> foo</li>
4038 <li> bar</li></ul></dt></dl>
4039 <dl><dt> baz</dt></dl></dd></dl>
4040
4041 !! html/php+tidy
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dd>
4046 <ul>
4047 <li>foo</li>
4048 <li>bar</li>
4049 </ul>
4050 </dd>
4051 </dl>
4052 <dl>
4053 <dt>baz</dt>
4054 </dl>
4055 </dd>
4056 </dl>
4057 !! html/parsoid
4058 <dl>
4059 <dd><dl>
4060 <dt><ul>
4061 <li> foo
4062 </li>
4063 </ul></dt>
4064 <dd><ul>
4065 <li> bar
4066 </li>
4067 </ul></dd>
4068 <dt> baz</dt>
4069 </dl></dd>
4070 </dl>
4071 !! end
4072
4073 !! test
4074 Definition Lists: Mixed Lists: Test 2
4075 !! wikitext
4076 *: d1
4077 *: d2
4078 !! html
4079 <ul><li><dl><dd> d1</dd>
4080 <dd> d2</dd></dl></li></ul>
4081
4082 !! end
4083
4084
4085 !! test
4086 Definition Lists: Mixed Lists: Test 3
4087 !! wikitext
4088 *::: d1
4089 *::: d2
4090 !! html
4091 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4092 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 4
4099 !! wikitext
4100 *;d1 :d2
4101 *;d3 :d4
4102 !! html
4103 <ul><li><dl><dt>d1&#160;</dt>
4104 <dd>d2</dd>
4105 <dt>d3&#160;</dt>
4106 <dd>d4</dd></dl></li></ul>
4107
4108 !! end
4109
4110
4111 !! test
4112 Definition Lists: Mixed Lists: Test 5
4113 !! wikitext
4114 *:d1
4115 *:: d2
4116 !! html
4117 <ul><li><dl><dd>d1
4118 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4119
4120 !! end
4121
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 6
4125 !! wikitext
4126 #*:d1
4127 #*::: d3
4128 !! html
4129 <ol><li><ul><li><dl><dd>d1
4130 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 7
4137 !! wikitext
4138 :* d1
4139 :* d2
4140 !! html
4141 <dl><dd><ul><li> d1</li>
4142 <li> d2</li></ul></dd></dl>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 8
4149 !! wikitext
4150 :* d1
4151 ::* d2
4152 !! html
4153 <dl><dd><ul><li> d1</li></ul>
4154 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 9
4161 !! wikitext
4162 *;foo :bar
4163 !! html
4164 <ul><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ul>
4166
4167 !! end
4168
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 10
4172 !! wikitext
4173 *#;foo :bar
4174 !! html
4175 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4176 <dd>bar</dd></dl></li></ol></li></ul>
4177
4178 !! end
4179
4180 # The Parsoid team disagrees with the PHP parser's seemingly-random
4181 # rules regarding dd/dt on the next two tests. Parsoid is more
4182 # consistent, and recognizes the shared nesting and keeps the
4183 # still-open tags around until the nesting is complete.
4184 # (And tidy again converts <dt> to <dd> before 'bar'.)
4185
4186 !! test
4187 Definition Lists: Mixed Lists: Test 11
4188 !! wikitext
4189 *#*#;*;;foo :bar
4190 *#*#;boo :baz
4191 !! html/php
4192 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4193 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4194 <dl><dt>boo&#160;</dt>
4195 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4196
4197 !! html/php+tidy
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>foo&#160;</dt>
4208 <dd>
4209 <ul>
4210 <li>
4211 <dl>
4212 <dd>
4213 <dl>
4214 <dt>bar</dt>
4215 </dl>
4216 </dd>
4217 </dl>
4218 </li>
4219 </ul>
4220 </dd>
4221 </dl>
4222 <dl>
4223 <dt>boo&#160;</dt>
4224 <dd>baz</dd>
4225 </dl>
4226 </li>
4227 </ol>
4228 </li>
4229 </ul>
4230 </li>
4231 </ol>
4232 </li>
4233 </ul>
4234 !! html/parsoid
4235 <ul>
4236 <li>
4237 <ol>
4238 <li>
4239 <ul>
4240 <li>
4241 <ol>
4242 <li>
4243 <dl>
4244 <dt>
4245 <ul>
4246 <li>
4247 <dl>
4248 <dt>
4249 <dl>
4250 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4251 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4252 </dl></dt>
4253 </dl></li>
4254 </ul></dt>
4255 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4256 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4257 </dl></li>
4258 </ol></li>
4259 </ul></li>
4260 </ol></li>
4261 </ul>
4262 !! end
4263
4264
4265 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4266 # From whitelist:
4267 # * The test is wrong, there are two colons where there should be :;
4268 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4269 !! test
4270 Definition Lists: Weird Ones: Test 1
4271 !! wikitext
4272 *#;*::;; foo : bar (who uses this?)
4273 !! html/php
4274 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4275 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4276
4277 !! html/php+tidy
4278 <ul>
4279 <li>
4280 <ol>
4281 <li>
4282 <dl>
4283 <dt>foo&#160;</dt>
4284 <dd>
4285 <ul>
4286 <li>
4287 <dl>
4288 <dd>
4289 <dl>
4290 <dd>
4291 <dl>
4292 <dd>
4293 <dl>
4294 <dt>bar (who uses this?)</dt>
4295 </dl>
4296 </dd>
4297 </dl>
4298 </dd>
4299 </dl>
4300 </dd>
4301 </dl>
4302 </li>
4303 </ul>
4304 </dd>
4305 </dl>
4306 </li>
4307 </ol>
4308 </li>
4309 </ul>
4310 !! html/parsoid
4311 <ul>
4312 <li>
4313 <ol>
4314 <li>
4315 <dl>
4316 <dt>
4317 <ul>
4318 <li>
4319 <dl>
4320 <dd>
4321 <dl>
4322 <dd>
4323 <dl>
4324 <dt>
4325 <dl>
4326 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4327 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4328 </dl></dt>
4329 </dl></dd>
4330 </dl></dd>
4331 </dl></li>
4332 </ul></dt>
4333 </dl></li>
4334 </ol></li>
4335 </ul>
4336 !! end
4337
4338 !! test
4339 Definition Lists: colons occurring in tags
4340 !! wikitext
4341 ;a:b
4342 ;'''a:b'''
4343 ;<i>a:b</i>
4344 ;<span>a:b</span>
4345 ;<div>a:b</div>
4346 ;<div>a
4347 :b</div>
4348 ;{{echo|a:b}}
4349 ;{{echo|''a:b''}}
4350 ;;;''a:b''
4351 !! html+tidy
4352 <dl>
4353 <dt>a</dt>
4354 <dd>b</dd>
4355 <dt><b>a:b</b></dt>
4356 <dt><i>a:b</i></dt>
4357 <dt><span>a:b</span></dt>
4358 <dd>
4359 <div>a:b</div>
4360 </dd>
4361 <dd>
4362 <div>a
4363 <dl>
4364 <dd>b</dd>
4365 </dl>
4366 </div>
4367 </dd>
4368 <dt>a</dt>
4369 <dd>b</dd>
4370 <dt><i>a:b</i></dt>
4371 </dl>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dd>
4376 <dl>
4377 <dt><i>a:b</i></dt>
4378 </dl>
4379 </dd>
4380 </dl>
4381 </dd>
4382 </dl>
4383 !! html/parsoid
4384 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4385 <dt><b>a:b</b></dt>
4386 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4387 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4388 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4389 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4390 <dd>b</dd>
4391 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4392 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4393 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4394 !! end
4395
4396 !! test
4397 Definition Lists: colons and tables 1
4398 !! wikitext
4399 :{|
4400 | x
4401 |}
4402 :{|
4403 | y
4404 |}
4405 !! html
4406 <dl><dd><table>
4407 <tr>
4408 <td> x
4409 </td></tr></table></dd></dl>
4410 <dl><dd><table>
4411 <tr>
4412 <td> y
4413 </td></tr></table></dd></dl>
4414
4415 !! end
4416
4417 # Parsoid's output (as documented below) differs from php's in this case.
4418 # This is probably a bug. If we fixup parsoid to match php's output, the
4419 # above test should pass and the below test case can be removed. It is
4420 # unclear which output is more desirable.
4421
4422 !! test
4423 Definition Lists: colons and tables 2
4424 !! wikitext
4425 :{|
4426 | x
4427 |}
4428 :{|
4429 | y
4430 |}
4431 !! html/parsoid
4432 <dl><dd><table>
4433 <tr>
4434 <td> x
4435 </td></tr></table></dd>
4436 <dd><table>
4437 <tr>
4438 <td> y
4439 </td></tr></table></dd></dl>
4440 !! end
4441
4442 !! test
4443 Definition Lists: template interaction
4444 !! wikitext
4445 ::{{definition_list}}
4446
4447 :one
4448 ::{{definition_list}}
4449 :::two
4450 :::three
4451 ::four
4452 !! html/parsoid
4453 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4454 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4455
4456 <dl><dd data-parsoid='{}'>one
4457 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4458 </span><dd about="#mwt2">two
4459 <dl><dd>two</dd>
4460 <dd>three</dd></dl></dd>
4461 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4462 !! end
4463
4464
4465 ###
4466 ### External links
4467 ###
4468 !! test
4469 External links: non-bracketed
4470 !! wikitext
4471 Non-bracketed: http://example.com
4472 !! html
4473 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4474 </p>
4475 !! end
4476
4477 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4478 !! test
4479 External links: numbered
4480 !! wikitext
4481 Numbered: [http://example.com]
4482 Numbered: [http://example.net]
4483 Numbered: [http://example.com]
4484 !! html/php
4485 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4486 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4487 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4488 </p>
4489 !! html/parsoid
4490 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4491 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4492 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4493 !!end
4494
4495 !! test
4496 External links: specified text
4497 !! wikitext
4498 Specified text: [http://example.com link]
4499 !! html
4500 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4501 </p>
4502 !!end
4503
4504 !! test
4505 External links: trail
4506 !! wikitext
4507 Linktrails should not work for external links: [http://example.com link]s
4508 !! html
4509 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4510 </p>
4511 !! end
4512
4513 !! test
4514 External links: dollar sign in URL
4515 !! wikitext
4516 http://example.com/1$2345
4517 !! html
4518 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4519 </p>
4520 !! end
4521
4522 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4523 !! test
4524 External links: dollar sign in URL (autonumber)
4525 !! wikitext
4526 [http://example.com/1$2345]
4527 !! html/php
4528 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4529 </p>
4530 !! html/parsoid
4531 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4532 !!end
4533
4534 !! test
4535 External links: open square bracket forbidden in URL (bug 4377)
4536 !! options
4537 parsoid=wt2html,wt2wt,html2html
4538 !! wikitext
4539 http://example.com/1[2345
4540 !! html/php
4541 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4542 </p>
4543 !! html/parsoid
4544 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4545 !! end
4546
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 !! options
4550 parsoid=wt2html,html2html
4551 !! wikitext
4552 [http://example.com/1[2345]
4553 !! html/php
4554 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4555 </p>
4556 !! html/parsoid
4557 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4558 !!end
4559
4560 # parsoid adds a space before the link name
4561 !! test
4562 External links: open square bracket forbidden in URL (named) (bug 4377)
4563 Parsoid variant.
4564 !! wikitext
4565 [http://example.com/1 [2345]
4566 !! html
4567 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4568 </p>
4569 !!end
4570
4571 !! test
4572 External links: nowiki in URL link text (bug 6230)
4573 !! wikitext
4574 [http://example.com/ <nowiki>''example site''</nowiki>]
4575 !! html
4576 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4577 </p>
4578 !! end
4579
4580 !! test
4581 External links: newline forbidden in text (bug 6230 regression check)
4582 !! wikitext
4583 [http://example.com/ first
4584 second]
4585 !! html
4586 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4587 second]
4588 </p>
4589 !!end
4590
4591 !! test
4592 External links: Pipe char between url and text
4593 !! wikitext
4594 [http://example.com | link]
4595 !! html
4596 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4597 </p>
4598 !!end
4599
4600 !! test
4601 External links: protocol-relative URL in brackets
4602 !! wikitext
4603 [//example.com/ Test]
4604 !! html
4605 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4606 </p>
4607 !! end
4608
4609 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4610 !! test
4611 External links: protocol-relative URL in brackets without text
4612 !! wikitext
4613 [//example.com]
4614 !! html/php
4615 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4616 </p>
4617 !! html/parsoid
4618 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4619 !! end
4620
4621 !! test
4622 External links: protocol-relative URL in free text is left alone
4623 !! wikitext
4624 //example.com/Foo
4625 !! html
4626 <p>//example.com/Foo
4627 </p>
4628 !!end
4629
4630 !! test
4631 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4632 !! wikitext
4633 foo//example.com/Foo
4634 !! html
4635 <p>foo//example.com/Foo
4636 </p>
4637 !! end
4638
4639 !! test
4640 External links: with no contents
4641 !! wikitext
4642 [http://en.wikipedia.org/wiki/Foo]
4643
4644 [[wikipedia:Foo|Bar]]
4645
4646 [[wikipedia:Foo|<span>Bar</span>]]
4647 !! html/php
4648 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4649 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4650 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4651 </p>
4652 !! html/parsoid
4653 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4654 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4655 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4656 !! end
4657
4658 !! test
4659 External links: Free with trailing punctuation
4660 !! wikitext
4661 http://example.com,
4662 http://example.com;
4663 http://example.com\
4664 http://example.com.
4665 http://example.com:
4666 http://example.com!
4667 http://example.com?
4668 http://example.com)
4669 http://example.com/url_with_(brackets)
4670 (http://example.com/url_without_brackets)
4671 http://example.com/url_with_entity&amp;
4672 http://example.com/url_with_entity&#x26;
4673 http://example.com/url_with_entity&#038;
4674 http://example.com/url_with_entity&nbsp;
4675 http://example.com/url_with_entity&#xA0;
4676 http://example.com/url_with_entity&#160;
4677 http://example.com/url_with_entity&lt;
4678 http://example.com/url_with_entity&#x3C;
4679 http://example.com/url_with_entity&#60;
4680 !! html/php
4681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4682 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4684 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4685 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4686 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4687 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4688 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4690 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4691 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4692 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4694 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4695 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4697 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4698 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4699 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4700 </p>
4701 !! html/parsoid
4702 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4703 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4704 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4705 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4706 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4707 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4708 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4709 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4710 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4711 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4712 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4713 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4714 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4715 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4716 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4717 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4718 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4719 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4720 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4721 !! end
4722
4723 !! test
4724 External links: tricky Parsoid html2html case
4725 !! options
4726 parsoid=wt2html,wt2wt,html2html
4727 !! wikitext
4728 http://example.com/url_with_entity&amp;amp;
4729 !! html/php
4730 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4734 !! end
4735
4736 !! test
4737 External links: Free with trailing quotes (T113666)
4738 !! wikitext
4739 '''News:''' Stuff here
4740
4741 news:'a'b''c''d e
4742 !! html/php
4743 <p><b>News:</b> Stuff here
4744 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4745 </p>
4746 !! html/parsoid
4747 <p><b>News:</b> Stuff here</p>
4748 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4749 !! end
4750
4751 !! test
4752 External links: Lone protocols are never linked (T105697)
4753 !! wikitext
4754 http://
4755 http://;
4756 (http://)
4757 bitcoin:
4758 bitcoin:;
4759 (bitcoin:)
4760 !! html
4761 <p>http://
4762 http://;
4763 (http://)
4764 bitcoin:
4765 bitcoin:;
4766 (bitcoin:)
4767 </p>
4768 !! end
4769
4770 !! test
4771 External links: No preceding word characters allowed (bug 65278)
4772 !! wikitext
4773 NOPEhttp://example.com
4774 N0http://example.com
4775 ok:http://example.com
4776 ok-http://example.com
4777 !! html
4778 <p>NOPEhttp://example.com
4779 N0http://example.com
4780 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4781 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4782 </p>
4783 !! end
4784
4785 !! test
4786 External links: nofollow domain exception
4787 !! wikitext
4788 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4789 !! html
4790 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4791 </p>
4792 !!end
4793
4794 !! test
4795 External image
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4800 </p>
4801 !! end
4802
4803 !! test
4804 External image from https
4805 !! wikitext
4806 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4807 !! html
4808 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External image (when not allowed)
4814 !! options
4815 wgAllowExternalImages=0
4816 !! wikitext
4817 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4818 !! html
4819 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4820 </p>
4821 !! end
4822
4823 !! test
4824 Link to non-http image, no img tag
4825 !! wikitext
4826 Link to non-http image, no img tag: ftp://example.com/test.jpg
4827 !! html
4828 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: terminating separator
4834 !! wikitext
4835 Terminating separator: http://example.com/thing,
4836 !! html
4837 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4838 </p>
4839 !! end
4840
4841 !! test
4842 External links: intervening separator
4843 !! wikitext
4844 Intervening separator: http://example.com/1,2,3
4845 !! html
4846 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4847 </p>
4848 !! end
4849
4850 !! test
4851 External links: old bug with URL in query
4852 !! wikitext
4853 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4854 !! html
4855 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4856 </p>
4857 !! end
4858
4859 !! test
4860 External links: old URL-in-URL bug, mixed protocols
4861 !! wikitext
4862 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4863 !! html
4864 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4865 </p>
4866 !!end
4867
4868 !! test
4869 External links: URL in text
4870 !! wikitext
4871 URL in text: [http://example.com http://example.com]
4872 !! html
4873 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: Clickable images
4879 !! wikitext
4880 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4881 !! html/php
4882 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4883 </p>
4884 !! html/parsoid
4885 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4886 !! end
4887
4888 !! test
4889 External links: raw ampersand
4890 !! wikitext
4891 Old &amp; use: http://x&y
4892 !! html
4893 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4894 </p>
4895 !! end
4896
4897 !! test
4898 External links: encoded ampersand
4899 !! wikitext
4900 Old &amp; use: http://x&amp;y
4901 !! html/php
4902 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4903 </p>
4904 !! html/parsoid
4905 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4906 !! end
4907
4908 !! test
4909 External links: encoded equals (bug 6102)
4910 !! wikitext
4911 http://example.com/?foo&#61;bar
4912 !! html/php
4913 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4914 </p>
4915 !! html/parsoid
4916 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4917 !! end
4918
4919 ##
4920 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4921 ## does it number them. As discussed in bug 53505, we can identify
4922 ## autonumbered links via CSS.
4923 ##
4924
4925 !! test
4926 External links: [raw ampersand]
4927 !! wikitext
4928 Old &amp; use: [http://x&y]
4929 !! html/php
4930 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4931 </p>
4932 !! html/parsoid
4933 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4934 !! end
4935
4936 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4937 # mode will return the [raw ampersand] wikitext
4938 !! test
4939 External links: [encoded ampersand]
4940 !! options
4941 parsoid=wt2html,wt2wt,html2html
4942 !! wikitext
4943 Old &amp; use: [http://x&amp;y]
4944 !! html/php
4945 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4946 </p>
4947 !! html/parsoid
4948 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4949 !! end
4950
4951 !! test
4952 External links: [raw equals]
4953 !! wikitext
4954 [http://example.com/?foo=bar]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4960 !! end
4961
4962 # note that parsoid html is identical to [raw equals] case; so html2wt
4963 # mode will return the [raw equals] wikitext
4964 !! test
4965 External links: [encoded equals] (bug 6102)
4966 !! options
4967 parsoid=wt2html,wt2wt,html2html
4968 !! wikitext
4969 [http://example.com/?foo&#61;bar]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4975 !! end
4976
4977 # xxx parsoid strips the IDN character, so the round-trip tests will
4978 # obviously fail and are disabled. --cscott
4979 !! test
4980 External links: [IDN ignored character reference in hostname; strip it right off]
4981 !! options
4982 parsoid=wt2html,wt2wt,html2html
4983 !! wikitext
4984 [http://e&zwnj;xample.com/]
4985 !! html/php
4986 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4990 !! end
4991
4992 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4993 # Where an external link could easily circumvent the sanitization of the text of
4994 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4995 # test demands a higher standard. That's a bit strange.
4996 #
4997 # Example:
4998 #
4999 # http://e‌xample.com -> [http://example.com|http://example.com]
5000 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5001 #
5002 # The first example is sanitized, but the second is not. Any security benefits
5003 # from this production are trivial to circumvent. Either remove this test and
5004 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5005 # the test accordingly.
5006 #
5007 # All our love,
5008 # The Parsoid team.
5009 # xxx parsoid strips the IDN character, so the round-trip tests will
5010 # obviously fail and are disabled. --cscott
5011 !! test
5012 External links: IDN ignored character reference in hostname; strip it right off
5013 !! options
5014 parsoid=wt2html,html2html
5015 !! wikitext
5016 http://e&zwnj;xample.com/
5017 !! html/php
5018 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5019 </p>
5020 !! html/parsoid
5021 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5022 !! end
5023
5024 !! test
5025 External links: www.jpeg.org (bug 554)
5026 !! wikitext
5027 http://www.jpeg.org
5028 !! html
5029 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5030 </p>
5031 !! end
5032
5033 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5034 !! test
5035 External links: URL within URL (original bug 2)
5036 !! wikitext
5037 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5038 !! html/php
5039 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5040 </p>
5041 !! html/parsoid
5042 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5043 !! end
5044
5045 !! test
5046 BUG 361: URL inside bracketed URL
5047 !! wikitext
5048 [http://www.example.com/foo http://www.example.com/bar]
5049 !! html
5050 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5051 </p>
5052 !! end
5053
5054 !! test
5055 BUG 361: URL within URL, not bracketed
5056 !! wikitext
5057 http://www.example.com/foo?=http://www.example.com/bar
5058 !! html
5059 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5060 </p>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in URL-tail
5065 !! wikitext
5066 http://www.example.com/<hello>
5067 !! html
5068 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in URL-tail
5074 !! wikitext
5075 http://www.example.com/<b>html</b>
5076 !! html/php
5077 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5078 </p>
5079 !! html/parsoid
5080 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5081 !! end
5082
5083 !! test
5084 BUG 289: ">"-token in bracketed URL
5085 !! wikitext
5086 [http://www.example.com/<hello> stuff]
5087 !! html
5088 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5089 </p>
5090 !!end
5091
5092 !! test
5093 BUG 289: literal ">"-token in bracketed URL
5094 !! wikitext
5095 [http://www.example.com/<b>html</b> stuff]
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5098 </p>
5099 !!end
5100
5101 !! test
5102 BUG 289: literal double quote at end of URL
5103 !! wikitext
5104 http://www.example.com/"hello"
5105 !! html
5106 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5107 </p>
5108 !!end
5109
5110 !! test
5111 BUG 289: literal double quote in bracketed URL
5112 !! wikitext
5113 [http://www.example.com/"hello" stuff]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5116 </p>
5117 !!end
5118
5119 !! test
5120 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5121 !! wikitext
5122 [http://www.example.com test]
5123 !! html
5124 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 External links: link text with spaces
5130 !! wikitext
5131 [http://www.example.com a b c]
5132 [http://www.example.com ''a'' ''b'']
5133 !! html
5134 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5135 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5136 </p>
5137 !! end
5138
5139 !! test
5140 External links: wiki links within external link (Bug 3695)
5141 !! options
5142 parsoid=wt2html,html2html
5143 !! wikitext
5144 [http://example.com [[wikilink]] embedded in ext link]
5145 !! html/php
5146 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5147 </p>
5148 !! html/parsoid
5149 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5150 !! end
5151
5152 !! test
5153 BUG 787: Links with one slash after the url protocol are invalid
5154 !! wikitext
5155 http:/example.com
5156
5157 [http:/example.com title]
5158 !! html
5159 <p>http:/example.com
5160 </p><p>[http:/example.com title]
5161 </p>
5162 !! end
5163
5164 !! test
5165 Bracketed external links with template-generated invalid target
5166 !! wikitext
5167 [{{echo|http:/example.com}} title]
5168 !! html
5169 <p>[http:/example.com title]
5170 </p>
5171 !! end
5172
5173 !! test
5174 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5175 !! wikitext
5176 ''[http://example.com text'']
5177 [http://example.com '''text]'''
5178 ''Something [http://example.com in italic'']
5179 ''Something [http://example.com mixed''''', even bold]'''
5180 '''''Now [http://example.com both''''']
5181 !! html
5182 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5183 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5184 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5185 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5186 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5187 </p>
5188 !! end
5189
5190
5191 !! test
5192 Bug 4781: %26 in URL
5193 !! wikitext
5194 http://www.example.com/?title=AT%26T
5195 !! html/php
5196 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5200 !! end
5201
5202 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5203 # % is actually legal in HTML5. Any change in output would need testing though.
5204 !! test
5205 Bug 4781, 5267: %25 in URL
5206 !! wikitext
5207 http://www.example.com/?title=100%25_Bran
5208 !! html/php
5209 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %28, %29 in URL
5217 !! wikitext
5218 http://www.example.com/?title=Ben-Hur_%281959_film%29
5219 !! html/php
5220 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5224 !! end
5225
5226
5227 !! test
5228 Bug 4781: %26 in autonumber URL
5229 !! wikitext
5230 [http://www.example.com/?title=AT%26T]
5231 !! html/php
5232 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5233 </p>
5234 !! html/parsoid
5235 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5236 !! end
5237
5238 !! test
5239 Bug 4781, 5267: %26 in autonumber URL
5240 !! wikitext
5241 [http://www.example.com/?title=100%25_Bran]
5242 !! html/php
5243 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %28, %29 in autonumber URL
5251 !! wikitext
5252 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5253 !! html/php
5254 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5255 </p>
5256 !! html/parsoid
5257 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5258 !! end
5259
5260
5261 !! test
5262 Bug 4781: %26 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=AT%26T link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %25 in bracketed URL
5274 !! wikitext
5275 [http://www.example.com/?title=100%25_Bran link]
5276 !! html
5277 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5278 </p>
5279 !! end
5280
5281 !! test
5282 Bug 4781, 5267: %28, %29 in bracketed URL
5283 !! wikitext
5284 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5285 !! html/php
5286 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5287 </p>
5288 !! html/parsoid
5289 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5290 !! end
5291
5292 !! test
5293 External link containing a period in the anchor. (bug 63947)
5294 !! wikitext
5295 [//foo.org/bar#baz. bang]
5296
5297 [//foo.org/bar. bang]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5300 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5304 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5305 !! end
5306
5307 !! test
5308 External link containing a single quote. (bug 63947)
5309 !! wikitext
5310 [//foo.org/bar'baz]
5311
5312 [//foo.org/bar'baz bang]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5315 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5316 </p>
5317 !! html/parsoid
5318 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5319 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5320 !! end
5321
5322 !! test
5323 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5324 !! wikitext
5325 Some [http://example.com/ pretty ''italics'' and stuff]!
5326 !! html
5327 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5328 </p>
5329 !! end
5330
5331 !! test
5332 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5333 !! wikitext
5334 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5335 !! html
5336 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5337 </p>
5338 !! end
5339
5340 !! test
5341 External link containing double-single-quotes with no space separating the url from text in italics
5342 !! wikitext
5343 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5344 !! html/php
5345 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5346 </p>
5347 !! html/php+tidy
5348 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5349 !! html/parsoid
5350 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5351 !! end
5352
5353 !! test
5354 External link with comments in link text
5355 !! wikitext
5356 [http://www.google.com Google <!-- comment -->]
5357 !! html/php
5358 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5359 </p>
5360 !! html/parsoid
5361 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5362 !! end
5363
5364 !! test
5365 External link to bare IPv4 address
5366 !! wikitext
5367 [http://192.168.0.1 Link]
5368 !! html/php
5369 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5370 </p>
5371 !! html/parsoid
5372 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5373 !! end
5374
5375 !! test
5376 URL-encoding in URL functions (single parameter)
5377 !! wikitext
5378 {{localurl:Some page|amp=&}}
5379 !! html
5380 <p>/index.php?title=Some_page&amp;amp=&amp;
5381 </p>
5382 !! end
5383
5384 !! test
5385 URL-encoding in URL functions (multiple parameters)
5386 !! wikitext
5387 {{localurl:Some page|q=?&amp=&}}
5388 !! html
5389 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5390 </p>
5391 !! end
5392
5393 !! test
5394 Brackets in urls
5395 !! wikitext
5396 http://example.com/index.php?foozoid%5B%5D=bar
5397
5398 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5399 !! html/php
5400 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5401 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5405
5406 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5407 !! end
5408
5409 !! test
5410 IPv6 urls, autolink format (T23261)
5411 !! wikitext
5412 http://[2404:130:0:1000::187:2]/index.php
5413
5414 Examples from RFC 2373, section 2.2:
5415 * http://[1080::8:800:200C:417A]/unicast
5416 * http://[FF01::101]/multicast
5417 * http://[::1]/loopback
5418 * http://[::]/unspecified
5419 * http://[::13.1.68.3]/ipv4compat
5420 * http://[::FFFF:129.144.52.38]/ipv4compat
5421
5422 Examples from RFC 2732, section 2:
5423 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5424 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5425 * http://[3ffe:2a00:100:7031::1]
5426 * http://[1080::8:800:200C:417A]/foo
5427 * http://[::192.9.5.5]/ipng
5428 * http://[::FFFF:129.144.52.38]:80/index.html
5429 * http://[2010:836B:4179::836B:4179]
5430
5431 !! html/php
5432 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5433 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5434 </p>
5435 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5442 </p>
5443 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5444 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5445 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5449 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450
5451 !! html/parsoid
5452 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5453
5454 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5455 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5461
5462 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5463 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5465 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5467 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5468 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5469 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5470 !! end
5471
5472 !! test
5473 IPv6 urls, bracketed format (T23261)
5474 !! wikitext
5475 [http://[2404:130:0:1000::187:2]/index.php test]
5476
5477 Examples from RFC 2373, section 2.2:
5478 * [http://[1080::8:800:200C:417A] unicast]
5479 * [http://[FF01::101] multicast]
5480 * [http://[::1]/ loopback]
5481 * [http://[::] unspecified]
5482 * [http://[::13.1.68.3] ipv4compat]
5483 * [http://[::FFFF:129.144.52.38] ipv4compat]
5484
5485 Examples from RFC 2732, section 2:
5486 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5487 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5488 * [http://[3ffe:2a00:100:7031::1] 3]
5489 * [http://[1080::8:800:200C:417A]/foo 4]
5490 * [http://[::192.9.5.5]/ipng 5]
5491 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5492 * [http://[2010:836B:4179::836B:4179] 7]
5493
5494 !! html/php
5495 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5496 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5497 </p>
5498 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5505 </p>
5506 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5516
5517 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5518 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5524
5525 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5526 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5528 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5529 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5530 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5531 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5532 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5533 !! end
5534
5535 !! test
5536 Non-extlinks in brackets
5537 !! wikitext
5538 [foo]
5539 [foo bar]
5540 [foo ''bar'']
5541 [fool's] errand
5542 [fool's errand]
5543 [{{echo|foo}}]
5544 [{{echo|foo}} bar]
5545 [{{echo|foo}} ''bar'']
5546 [{{echo|foo}}l's] errand
5547 [{{echo|foo}}l's errand]
5548 [url={{echo|foo}}]
5549 [url=http://example.com]
5550 [http:// bare protocols don't count]
5551 !! html/php
5552 <p>[foo]
5553 [foo bar]
5554 [foo <i>bar</i>]
5555 [fool's] errand
5556 [fool's errand]
5557 [foo]
5558 [foo bar]
5559 [foo <i>bar</i>]
5560 [fool's] errand
5561 [fool's errand]
5562 [url=foo]
5563 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5564 [http:// bare protocols don't count]
5565 </p>
5566 !! html/parsoid
5567 <p>[foo]
5568 [foo bar]
5569 [foo <i>bar</i>]
5570 [fool's] errand
5571 [fool's errand]
5572 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5573 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5574 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5575 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5576 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5577 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5578 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5579 [http:// bare protocols don't count]</p>
5580 !! end
5581
5582 !! test
5583 Percent encoding in external links
5584 !! wikitext
5585 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5586 !! html/php
5587 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5588 </p>
5589 !! html/parsoid
5590 <p><a rel="mw:ExtLink"
5591 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5592 !! end
5593
5594 !! test
5595 Use url link syntax for links where the content is equal the link target
5596 !! wikitext
5597 http://example.com
5598 !! html/php
5599 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5600 </p>
5601 !! html/parsoid
5602 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5603 !! end
5604
5605 !! test
5606 Parenthesis in external links, especially URL links
5607 !! wikitext
5608 http://example.com)
5609
5610 http://example.com/test)
5611
5612 http://example.com/(test)
5613
5614 http://example.com/((test)
5615
5616 (http://example.com/(test))
5617
5618 (http://example.com/(test)))))
5619
5620 http://example.com/a)b
5621
5622 [http://example.com) foo]
5623 !! html/php
5624 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5625 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5626 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5627 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5628 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5630 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5631 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5632 </p>
5633 !! html/parsoid
5634 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5635 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5636 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5637 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5638 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5639 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5640 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5641 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5642 !! end
5643
5644 !! test
5645 Parenthesis in external links, w/ transclusion or comment
5646 !! wikitext
5647 (http://example.com/{{echo|hi}})
5648
5649 (http://example.com<!-- hi -->)
5650 !! html/php
5651 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5652 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5653 </p>
5654 !! html/parsoid
5655 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5656
5657 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5658 !! end
5659
5660 !! test
5661 Serialize <a> tags with invalid link targets as plain text
5662 !! options
5663 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5664 !! html/parsoid
5665 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5666 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5667 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5668 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5669 !! wikitext
5670 text
5671 <nowiki>*</nowiki>text
5672 <nowiki>[[foo]]</nowiki>
5673 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5674 !! end
5675
5676 !! test
5677 mw:ExtLink -vs- mw:WikiLink (T94723)
5678 !! options
5679 parsoid=html2wt
5680 !! html/parsoid
5681 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5682 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5683 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5684 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5685 <p>
5686 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5687 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5688 </p>
5689 !! wikitext
5690 [[Foo|Bar]]
5691 [[Foo|Bar]]
5692 [[wikipedia:Foo|Bar]]
5693 [[wikipedia:Foo|Bar]]
5694
5695 [[wikipedia:European_Robin|European Robin]]
5696 [[wikipedia:European_Robin|European Robin]]
5697 !! end
5698
5699 !! test
5700 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5701 !! options
5702 parsoid=wt2wt
5703 !! wikitext
5704 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5705 !! html/parsoid
5706 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5707 !! end
5708
5709
5710 ###
5711 ### Quotes
5712 ###
5713
5714 !! test
5715 Quotes
5716 !! wikitext
5717 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5718
5719 Normal text. '''''Bold italic text.''''' Normal text.
5720 !! html
5721 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5722 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5723 </p>
5724 !! end
5725
5726
5727 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5728 # parser strips. The wikitext contains just the first half of the bold
5729 # quote pair.
5730 !! test
5731 Unclosed and unmatched quotes
5732 !! wikitext
5733 '''''Bold italic text '''with bold deactivated''' in between.'''''
5734
5735 '''''Bold italic text ''with italic deactivated'' in between.'''''
5736
5737 '''Bold text..
5738
5739 ..spanning two paragraphs (should not work).'''
5740
5741 '''Bold tag left open
5742
5743 ''Italic tag left open
5744
5745 Normal text.
5746
5747 <!-- Unmatching number of opening, closing tags: -->
5748 '''This year''''s election ''should'' beat '''last year''''s.
5749
5750 ''Tom'''s car is bigger than ''Susan'''s.
5751
5752 Plain ''italic'''s plain
5753 !! html/php
5754 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5755 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5756 </p><p><b>Bold text..</b>
5757 </p><p>..spanning two paragraphs (should not work).
5758 </p><p><b>Bold tag left open</b>
5759 </p><p><i>Italic tag left open</i>
5760 </p><p>Normal text.
5761 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5762 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5763 </p><p>Plain <i>italic'</i>s plain
5764 </p>
5765 !! html/parsoid
5766 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5767 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5768 </p><p><b>Bold text..</b>
5769 </p><p>..spanning two paragraphs (should not work).<b></b>
5770 </p><p><b>Bold tag left open</b>
5771 </p><p><i>Italic tag left open</i>
5772 </p><p>Normal text.
5773 </p>
5774 <!-- Unmatching number of opening, closing tags: -->
5775 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5776 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5777 </p><p>Plain <i>italic'</i>s plain
5778 </p>
5779 !! end
5780
5781 ###
5782 ### Tables
5783 ###
5784 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5785 ###
5786
5787 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5788 # is the bare minimum required by the spec, see:
5789 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5790 # Parsoid team replies: empty table tags are legal in HTML5
5791 !! test
5792 A table with no data.
5793 !! options
5794 parsoid=wt2html
5795 !! wikitext
5796 {||}
5797 !! html/php
5798
5799 !! html/parsoid
5800 <table></table>
5801
5802 !! end
5803
5804 !! test
5805 A table with stray table end tags on start tag line (wt2html)
5806 !! options
5807 parsoid=wt2html
5808 !! wikitext
5809 {|style="color: red;"|}
5810
5811 {|style="color: red;" |}
5812 |foo
5813 |}
5814
5815 {|style="color: red;"|} id="foo"
5816 |foo
5817 |}
5818
5819 {|style="color: red;" |} id="foo"
5820 |foo
5821 |}
5822 !! html
5823 <table style="color: red;"></table>
5824
5825 <table style="color: red;">
5826 <tbody><tr>
5827 <td>foo</td>
5828 </tr></tbody>
5829 </table>
5830
5831 <table style="color: red;" id="foo">
5832 <tbody><tr>
5833 <td>foo</td>
5834 </tr></tbody>
5835 </table>
5836
5837 <table style="color: red;" id="foo">
5838 <tbody><tr>
5839 <td>foo</td>
5840 </tr></tbody>
5841 </table>
5842
5843 !! end
5844
5845 !! test
5846 A table with no data (take 2)
5847 !! wikitext
5848 {|
5849 |}
5850 !! html/parsoid
5851 <table></table>
5852 !! end
5853
5854 # A table with nothing but a caption is invalid XHTML, we might want to render
5855 # this as <p>caption</p>
5856 # Parsoid team replies: table with only a caption is legal in HTML5
5857 !! test
5858 A table with nothing but a caption
5859 !! wikitext
5860 {|
5861 |+ caption
5862 |}
5863 !! html/php
5864 <table>
5865 <caption> caption
5866 </caption><tr><td></td></tr></table>
5867
5868 !! html/parsoid
5869 <table><caption> caption</caption></table>
5870 !! end
5871
5872 !! test
5873 A table with caption with default-spaced attributes and a table row
5874 !! wikitext
5875 {|
5876 |+ style="color: red;" | caption1
5877 |-
5878 | foo
5879 |}
5880 !! html
5881 <table>
5882 <caption style="color: red;"> caption1
5883 </caption>
5884 <tr>
5885 <td> foo
5886 </td></tr></table>
5887
5888 !! end
5889
5890 !! test
5891 A table with captions with non-default spaced attributes and a table row
5892 !! wikitext
5893 {|
5894 |+style="color: red;"|caption2
5895 |+ style="color: red;"| caption3
5896 |-
5897 | foo
5898 |}
5899 !! html
5900 <table>
5901 <caption style="color: red;">caption2
5902 </caption>
5903 <caption style="color: red;"> caption3
5904 </caption>
5905 <tr>
5906 <td> foo
5907 </td></tr></table>
5908
5909 !! end
5910
5911 !! test
5912 Table td-cell syntax variations
5913 !! wikitext
5914 {|
5915 | foo bar foo | baz
5916 | foo bar foo || baz
5917 | style='color:red;' | baz
5918 | style='color:red;' || baz
5919 |}
5920 !! html
5921 <table>
5922 <tr>
5923 <td> baz
5924 </td>
5925 <td> foo bar foo </td>
5926 <td> baz
5927 </td>
5928 <td style="color:red;"> baz
5929 </td>
5930 <td> style='color:red;' </td>
5931 <td> baz
5932 </td></tr></table>
5933
5934 !! end
5935
5936 !! test
5937 Simple table
5938 !! wikitext
5939 {|
5940 | 1 || 2
5941 |-
5942 | 3 || 4
5943 |}
5944 !! html
5945 <table>
5946 <tr>
5947 <td> 1 </td>
5948 <td> 2
5949 </td></tr>
5950 <tr>
5951 <td> 3 </td>
5952 <td> 4
5953 </td></tr></table>
5954
5955 !! end
5956
5957 !! test
5958 Simple table but with multiple dashes for row wikitext
5959 !! wikitext
5960 {|
5961 | foo
5962 |-----
5963 | bar
5964 |}
5965 !! html
5966 <table>
5967 <tr>
5968 <td> foo
5969 </td></tr>
5970 <tr>
5971 <td> bar
5972 </td></tr></table>
5973
5974 !! end
5975
5976 !! test
5977 Multiplication table
5978 !! wikitext
5979 {| border="1" cellpadding="2"
5980 |+Multiplication table
5981 |-
5982 ! &times; !! 1 !! 2 !! 3
5983 |-
5984 ! 1
5985 | 1 || 2 || 3
5986 |-
5987 ! 2
5988 | 2 || 4 || 6
5989 |-
5990 ! 3
5991 | 3 || 6 || 9
5992 |-
5993 ! 4
5994 | 4 || 8 || 12
5995 |-
5996 ! 5
5997 | 5 || 10 || 15
5998 |}
5999 !! html
6000 <table border="1" cellpadding="2">
6001 <caption>Multiplication table
6002 </caption>
6003 <tr>
6004 <th> &#215; </th>
6005 <th> 1 </th>
6006 <th> 2 </th>
6007 <th> 3
6008 </th></tr>
6009 <tr>
6010 <th> 1
6011 </th>
6012 <td> 1 </td>
6013 <td> 2 </td>
6014 <td> 3
6015 </td></tr>
6016 <tr>
6017 <th> 2
6018 </th>
6019 <td> 2 </td>
6020 <td> 4 </td>
6021 <td> 6
6022 </td></tr>
6023 <tr>
6024 <th> 3
6025 </th>
6026 <td> 3 </td>
6027 <td> 6 </td>
6028 <td> 9
6029 </td></tr>
6030 <tr>
6031 <th> 4
6032 </th>
6033 <td> 4 </td>
6034 <td> 8 </td>
6035 <td> 12
6036 </td></tr>
6037 <tr>
6038 <th> 5
6039 </th>
6040 <td> 5 </td>
6041 <td> 10 </td>
6042 <td> 15
6043 </td></tr></table>
6044
6045 !! end
6046
6047 !! test
6048 Accept "||" in table headings
6049 !! wikitext
6050 {|
6051 !h1 || h2
6052 |}
6053 !! html
6054 <table>
6055 <tr>
6056 <th>h1 </th>
6057 <th> h2
6058 </th></tr></table>
6059
6060 !! end
6061
6062 !! test
6063 Accept "!!" in table data
6064 !! wikitext
6065 {|
6066 | Foo!! ||
6067 |}
6068 !! html
6069 <table>
6070 <tr>
6071 <td> Foo!! </td>
6072 <td>
6073 </td></tr></table>
6074
6075 !! html/parsoid
6076 <table>
6077 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6078 </tbody></table>
6079 !! end
6080
6081 !! test
6082 Accept "||" in indented table headings
6083 !! wikitext
6084 :{|
6085 !h1 || h2
6086 |}
6087 !! html
6088 <dl><dd><table>
6089 <tr>
6090 <th>h1 </th>
6091 <th> h2
6092 </th></tr></table></dd></dl>
6093
6094 !! end
6095
6096 !! test
6097 Accept "!!" in templates
6098 !! wikitext
6099 {|
6100 !a {{echo|b!!c}}
6101 |}
6102 !! html/php
6103 <table>
6104 <tr>
6105 <th>a b</th>
6106 <th>c
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6112 !! end
6113
6114 !! test
6115 Accept "!!" in table headings after newline
6116 !! wikitext
6117 {|
6118 !a
6119 b!!c
6120 |}
6121 !! html/php
6122 <table>
6123 <tr>
6124 <th>a
6125 <p>b!!c
6126 </p>
6127 </th></tr></table>
6128
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a
6132 <p>b!!c</p></th></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept "!!" in table data of mixed wikitext / html syntax
6138 !! wikitext
6139 {|
6140 !a
6141 <tr><td>b!!c</td></tr>
6142 |}
6143 !! html+tidy
6144 <table>
6145 <tr>
6146 <th>a</th>
6147 </tr>
6148 <tr>
6149 <td>b!!c</td>
6150 </tr>
6151 </table>
6152 !! html/parsoid
6153 <table>
6154 <tbody><tr><th>a</th></tr>
6155 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6156 </tbody></table>
6157 !! end
6158
6159 !! test
6160 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6161 !! wikitext
6162 {|
6163 !| h1
6164 || a
6165 |}
6166 !! html
6167 <table>
6168 <tr>
6169 <th> h1
6170 </th>
6171 <td> a
6172 </td></tr></table>
6173
6174 !! end
6175
6176 !!test
6177 Accept "| !" at start of line in tables (ignore !-attribute)
6178 !! wikitext
6179 {|
6180 |-
6181 | !style="color:red" | bar
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td> bar
6188 </td></tr></table>
6189
6190 !!end
6191
6192 !!test
6193 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6194 !! wikitext
6195 {|
6196 |-
6197 |style='color:red;'|+1
6198 |style='color:blue;'|-1
6199 |-
6200 | 1 || 2 || 3
6201 | 1 ||+2 ||-3
6202 |-
6203 | +1
6204 | -1
6205 |}
6206 !! html
6207 <table>
6208
6209 <tr>
6210 <td style="color:red;">+1
6211 </td>
6212 <td style="color:blue;">-1
6213 </td></tr>
6214 <tr>
6215 <td> 1 </td>
6216 <td> 2 </td>
6217 <td> 3
6218 </td>
6219 <td> 1 </td>
6220 <td>+2 </td>
6221 <td>-3
6222 </td></tr>
6223 <tr>
6224 <td> +1
6225 </td>
6226 <td> -1
6227 </td></tr></table>
6228
6229 !!end
6230
6231 !! test
6232 Table rowspan
6233 !! wikitext
6234 {| border=1
6235 | Cell 1, row 1
6236 |rowspan=2| Cell 2, row 1 (and 2)
6237 | Cell 3, row 1
6238 |-
6239 | Cell 1, row 2
6240 | Cell 3, row 2
6241 |}
6242 !! html
6243 <table border="1">
6244 <tr>
6245 <td> Cell 1, row 1
6246 </td>
6247 <td rowspan="2"> Cell 2, row 1 (and 2)
6248 </td>
6249 <td> Cell 3, row 1
6250 </td></tr>
6251 <tr>
6252 <td> Cell 1, row 2
6253 </td>
6254 <td> Cell 3, row 2
6255 </td></tr></table>
6256
6257 !! end
6258
6259 !! test
6260 Nested table
6261 !! wikitext
6262 {| border=1
6263 | &alpha;
6264 |
6265 {| bgcolor=#ABCDEF border=2
6266 |nested
6267 |-
6268 |table
6269 |}
6270 |the original table again
6271 |}
6272 !! html
6273 <table border="1">
6274 <tr>
6275 <td> &#945;
6276 </td>
6277 <td>
6278 <table bgcolor="#ABCDEF" border="2">
6279 <tr>
6280 <td>nested
6281 </td></tr>
6282 <tr>
6283 <td>table
6284 </td></tr></table>
6285 </td>
6286 <td>the original table again
6287 </td></tr></table>
6288
6289 !! end
6290
6291 !! test
6292 Invalid attributes in table cell (bug 1830)
6293 !! wikitext
6294 {|
6295 |Cell:|broken
6296 |}
6297 !! html
6298 <table>
6299 <tr>
6300 <td>broken
6301 </td></tr></table>
6302
6303 !! end
6304
6305 !! test
6306 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6307 !! wikitext
6308 {|
6309 | title="foo" |bar
6310 | title="foo<nowiki>|</nowiki>" |bar
6311 | title="foo<nowiki>|</nowiki>" bar
6312 |}
6313 !! html/php
6314 <table>
6315 <tr>
6316 <td title="foo">bar
6317 </td>
6318 <td title="foo&#124;">bar
6319 </td>
6320 <td> title="foo|" bar
6321 </td></tr></table>
6322
6323 !! html/parsoid
6324 <table>
6325 <tbody><tr><td title="foo">bar</td>
6326 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6327 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6328 </tbody></table>
6329 !! end
6330
6331 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6332 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6333 # *2wt modes will fail.
6334 !! test
6335 Table security: embedded pipes
6336 !! options
6337 parsoid=wt2html,html2html
6338 !! wikitext
6339 {|
6340 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6341 !! html/php
6342 <table>
6343 <tr>
6344 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6345 <td>]" onmouseover="alert(document.cookie)"&gt;test
6346 </td>
6347 </tr>
6348 </table>
6349
6350 !! html/parsoid
6351 <table><tbody>
6352 <tr>
6353 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6354 !! end
6355
6356 !! test
6357 Element attributes with double ! should not be broken up by <th>
6358 !! wikitext
6359 {|
6360 ! hi <div class="!!">ha</div> ho
6361 |}
6362 !! html/php
6363 <table>
6364 <tr>
6365 <th> hi <div class="!!">ha</div> ho
6366 </th></tr></table>
6367
6368 !! html/parsoid
6369 <table>
6370 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6371 </tbody></table>
6372 !! end
6373
6374 !! test
6375 ! and || in element attributes should not be parsed as <th>/<td>
6376 !! wikitext
6377 {|
6378 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6379 |}
6380 !! html/php
6381 <table>
6382 <tr>
6383 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6384 </td></tr></table>
6385
6386 !! html/parsoid
6387 <table>
6388 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6389 </tbody></table>
6390 !! end
6391
6392 # FIXME: The output seems broken. Filed as T110268.
6393 !! test
6394 ! and || in td attributes should not be parsed as <th>/<td>
6395 !! options
6396 parsoid=wt2html
6397 !! wikitext
6398 {|
6399 | style="color: red !important;" data-contrived="put this here ||" | foo
6400 |}
6401 !! html/php
6402 <table>
6403 <tr>
6404 <td> style="color: red !important;" data-contrived="put this here </td>
6405 <td> foo
6406 </td></tr></table>
6407
6408 !! html/parsoid
6409 <table>
6410 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6411 </tbody></table>
6412 !! end
6413
6414 !! test
6415 Break on | in element attribute in template
6416 !! options
6417 parsoid=wt2html,html2html
6418 !! wikitext
6419 {{echo|1=<div class="hi|ho">ha</div>}}
6420 !! html/php
6421 <p>ho"&gt;ha&lt;/div&gt;
6422 </p>
6423 !! html/parsoid
6424 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6425 !! end
6426
6427 !! test
6428 Indented table markup mixed with indented pre content (proposed in bug 6200)
6429 !! wikitext
6430 <table>
6431 <tr>
6432 <td>
6433 Text that should be rendered preformatted
6434 </td>
6435 </tr>
6436 </table>
6437 !! html
6438 <table>
6439 <tr>
6440 <td>
6441 <pre>Text that should be rendered preformatted
6442 </pre>
6443 </td>
6444 </tr>
6445 </table>
6446
6447 !! end
6448
6449 !! test
6450 1. Template-generated table cell attributes and cell content
6451 !! wikitext
6452 {|
6453 |{{table_attribs}}
6454 | {{table_attribs}}
6455 || {{table_attribs_5}}
6456 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6457 |align=center {{table_attribs}}
6458 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td style="color:red;">Foo
6464 </td>
6465 <td style="color:red;">Foo
6466 </td>
6467 <td> style="color:red;"</td>
6468 <td>Bar
6469 </td>
6470 <td style="color:red;">Foo
6471 </td>
6472 <td align="center" style="color:red;">Foo
6473 </td>
6474 <td align="center" style="color:red;">Foo
6475 </td></tr></table>
6476
6477 !! end
6478
6479 !! test
6480 2. Template-generated table cell attributes and cell content
6481 !! wikitext
6482 {|
6483 |{{table_attribs_2}}
6484 |}
6485 !! html/php
6486 <table>
6487 <tr>
6488 <td style="color:red;">Foo
6489 </td>
6490 <td>Bar</td>
6491 <td>Baz
6492 </td></tr></table>
6493
6494 !! html/parsoid
6495 <table>
6496 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6497 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 3. Template-generated table cell attributes and cell content
6503 !! wikitext
6504 {|
6505 !align=center {{table_header_cells}}
6506 |-
6507 |align=center {{table_cells}}
6508 |}
6509 !! html/php
6510 <table>
6511 <tr>
6512 <th align="center" style="color:red;">Foo</th>
6513 <th style="color:red;"><i>Bar</i></th>
6514 <th style="color:brown;"><i>Foo</i> and Baz
6515 </th></tr>
6516 <tr>
6517 <td align="center" style="color:red;">Foo</td>
6518 <td style="color:red;"><i>Bar</i></td>
6519 <td style="color:brown;"><i>Foo</i> and Baz
6520 </td></tr></table>
6521
6522 !! html/parsoid
6523 <table>
6524 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6525 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6526 </tbody></table>
6527 !! end
6528
6529 !! test
6530 4. Template-generated table cell attributes and cell content inside a templated table
6531 !! wikitext
6532 {{tbl-start}}
6533 !align=center {{table_header_cells}}
6534 |-
6535 |align=center {{table_cells}}
6536 {{tbl-end}}
6537 !! html/php
6538 <table>
6539 <tr>
6540 <th align="center" style="color:red;">Foo</th>
6541 <th style="color:red;"><i>Bar</i></th>
6542 <th style="color:brown;"><i>Foo</i> and Baz
6543 </th></tr>
6544 <tr>
6545 <td align="center" style="color:red;">Foo</td>
6546 <td style="color:red;"><i>Bar</i></td>
6547 <td style="color:brown;"><i>Foo</i> and Baz
6548 </td></tr></table>
6549
6550 !! html/parsoid
6551 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6552 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6553 <tr>
6554 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6555 </tbody></table>
6556 !! end
6557
6558 ## Edge case fix to prevent future regressions
6559 !! test
6560 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6561 !! wikitext
6562 {|
6563 |{{table_attribs_7}}
6564 |}
6565 <references />
6566 !! html/parsoid
6567 <table>
6568 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6569 </tbody></table>
6570 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6571 !! end
6572
6573 !! test
6574 Table with row followed by newlines and table heading
6575 !! 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 !! test
8365 Interlanguage link with spacing
8366 !! options
8367 parsoid=wt2html,wt2wt,html2html
8368 !! wikitext
8369 Blah blah blah
8370 [[ zh : Chinese ]]
8371 !! html/php
8372 <p>Blah blah blah
8373 </p>
8374 !! html/parsoid
8375 <p>Blah blah blah</p>
8376 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8377 !! end
8378
8379 !! test
8380 Double interlanguage link
8381 !! wikitext
8382 Blah blah blah
8383 [[es:Spanish]]
8384 [[zh:Chinese]]
8385 !! html/php
8386 <p>Blah blah blah
8387 </p>
8388 !! html/parsoid
8389 <p>Blah blah blah</p>
8390 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8391 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8392 !! end
8393
8394 !! test
8395 Interlanguage link variations
8396 !! options
8397 parsoid=wt2html,wt2wt,html2html
8398 !! wikitext
8399 Blah blah blah
8400 [[ es :Spanish]]
8401 [[ ZH :Chinese]]
8402 [[es:Foo_bar]]
8403 !! html/php
8404 <p>Blah blah blah
8405 </p>
8406 !! html/parsoid
8407 <p>Blah blah blah</p>
8408 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8409 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8410 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8411 !! end
8412
8413 !! test
8414 Space and question mark encoding in interlanguage links (T95473)
8415 !! options
8416 parsoid=wt2html,wt2wt,html2html
8417 !! wikitext
8418 Blah blah blah
8419 [[es:Foo bar?]]
8420 !! html/php
8421 <p>Blah blah blah
8422 </p>
8423 !! html/parsoid
8424 <p>Blah blah blah</p>
8425 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8426 !! end
8427
8428 !! test
8429 Interlanguage link, with prefix links
8430 !! options
8431 language=ln
8432 !! wikitext
8433 Blah blah blah
8434 [[zh:Chinese]]
8435 !! html/php
8436 <p>Blah blah blah
8437 </p>
8438 !! html/parsoid
8439 <p>Blah blah blah</p>
8440 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8441 !! end
8442
8443 !! test
8444 Double interlanguage link, with prefix links (bug 8897)
8445 !! options
8446 language=ln
8447 !! wikitext
8448 Blah blah blah
8449 [[es:Spanish]]
8450 [[zh:Chinese]]
8451 !! html/php
8452 <p>Blah blah blah
8453 </p>
8454 !! html/parsoid
8455 <p>Blah blah blah</p>
8456 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8457 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8458 !! end
8459
8460 !! test
8461 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8462 !! wikitext
8463 Blah blah blah
8464 [[mul:Article]]
8465 !! html/php
8466 <p>Blah blah blah
8467 </p>
8468 !! html/parsoid
8469 <p>Blah blah blah</p>
8470 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8471 !! end
8472
8473 !! test
8474 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8475 !! options
8476 language=ln
8477 !! wikitext
8478 [[WW&nbsp;II]]
8479 !! html
8480 <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>
8481 </p>
8482 !! end
8483
8484 !! test
8485 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8486 !! options
8487 parsoid=html2wt
8488 !! html/parsoid
8489 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8490 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8491 !! wikitext
8492 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8493
8494 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8495 !! end
8496
8497 !! test
8498 Parsoid: handle constructor well
8499 !! wikitext
8500 [[constructor]]
8501
8502 [[constructor:foo]]
8503 !! html/php
8504 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8505 </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>
8506 </p>
8507 !! html/parsoid
8508 <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>
8509
8510 <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>
8511 !! end
8512
8513 !! article
8514 ko:
8515 !! text
8516 Test.
8517 !! endarticle
8518
8519 # Note that `ko` isn't a known interlanguage prefix
8520 !! test
8521 Parsoid: recognize interlanguage links without a target page
8522 !! options
8523 ill
8524 !! wikitext
8525 [[es:]]
8526
8527 [[ko:]]
8528 !! html/php
8529 es:
8530 !! html/parsoid
8531 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8532
8533 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8534 !! end
8535
8536 # Note that `ko` isn't a known interwiki prefix
8537 !! test
8538 Parsoid: recognize interwiki links without a target page
8539 !! options
8540 parsoid=wt2html,wt2wt,html2html
8541 !! wikitext
8542 [[:es:]]
8543
8544 [[:ko:]]
8545 !! html/php
8546 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8547 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8548 </p>
8549 !! html/parsoid
8550 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8551 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8552 !! end
8553
8554 !! test
8555 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8556 !! wikitext
8557 [[mi:Foo]]
8558 !! html/php
8559 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8560 </p>
8561 !! html/parsoid
8562 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8563 !! end
8564
8565 !! test
8566 Interlanguage link with preceding local interwiki link (bug 68085)
8567 !! options
8568 parsoid=wt2html,wt2wt,html2html
8569 !! wikitext
8570 Blah blah blah
8571 [[local:es:Spanish]]
8572 !! html/php
8573 <p>Blah blah blah
8574 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8575 </p>
8576 !! html/parsoid
8577 <p>Blah blah blah
8578 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8579 !! end
8580
8581 !! test
8582 Looks like an interlanguage link, but is actually a local interwiki
8583 !! options
8584 parsoid=wt2html,wt2wt,html2html
8585 !! wikitext
8586 Blah blah blah
8587 [[mi:Template:Foo]]
8588 !! html/php
8589 <p>Blah blah blah
8590 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8591 </p>
8592 !! html/parsoid
8593 <p>Blah blah blah
8594 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8595 !! end
8596
8597 ###
8598 ### Redirects, Parsoid-only
8599 ###
8600
8601 !! test
8602 1. Simple redirect to page
8603 !! wikitext
8604 #REDIRECT [[Main Page]]
8605 !! html/parsoid
8606 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8607 !! end
8608
8609 !! test
8610 2. Other redirect variants
8611 !! wikitext
8612 #REDIRECT [[Main_Page]]
8613 !! html/parsoid
8614 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8615 !! end
8616
8617 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8618 # This tests the Parsoid bail-out code.
8619 !! test
8620 3. Other redirect variants
8621 !! wikitext
8622 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8623 !! html/parsoid
8624 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8625 !! end
8626
8627 !! test
8628 4. Redirect to a templated destination
8629 !! wikitext
8630 #REDIRECT [[{{echo|Foo}}bar]]
8631 !! html/parsoid
8632 <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"}]]}'/>
8633 !! end
8634
8635 !! test
8636 Empty redirect
8637 !! options
8638 parsoid=wt2html,wt2wt
8639 !! wikitext
8640 #REDIRECT [[]]
8641 !! html/parsoid
8642 <ol>
8643 <li>REDIRECT [[]]</li></ol>
8644 !! end
8645
8646 !! test
8647 Optional colon in #REDIRECT
8648 !! options
8649 # the colon is archaic syntax. we support it for wt2html, but we
8650 # don't care that it roundtrips back to the modern syntax.
8651 parsoid=wt2html,html2html
8652 !! wikitext
8653 #REDIRECT:[[Main Page]]
8654 !! html/parsoid
8655 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8656 !! end
8657
8658 !! test
8659 Whitespace in #REDIRECT with optional colon
8660 !! options
8661 # the colon and gratuitous whitespace is archaic syntax. we support
8662 # it for wt2html, but we don't care that it roundtrips back to the
8663 # modern syntax (without extra whitespace)
8664 parsoid=wt2html,html2html
8665 !! wikitext
8666
8667 #REDIRECT
8668 :
8669 [[Main Page]]
8670 !! html/parsoid
8671 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8672 !! end
8673
8674 !! test
8675 Piped link in #REDIRECT
8676 !! options
8677 # content after piped link is ignored. we support this syntax,
8678 # but don't care that the piped link is lost when we roundtrip this.
8679 parsoid=wt2html
8680 !! wikitext
8681 #REDIRECT [[Main Page|bar]]
8682 !! html/parsoid
8683 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8684 !! end
8685
8686 !! test
8687 Redirect to category (T104502)
8688 !! options
8689 parsoid=wt2html,wt2wt
8690 !! wikitext
8691 #REDIRECT [[Category:Foo]]
8692 !! html/parsoid
8693 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8694 !! end
8695
8696 !! test
8697 Redirect to category with URL encoding (T104502)
8698 !! options
8699 parsoid=wt2html
8700 !! wikitext
8701 #REDIRECT [[Category%3AFoo]]
8702 !! html/parsoid
8703 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8704 !! end
8705
8706 !! test
8707 Redirect to category page
8708 !! wikitext
8709 #REDIRECT [[:Category:Foo]]
8710 !! html/parsoid
8711 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8712 !! end
8713
8714 !! test
8715 Redirect to image page (1)
8716 !! wikitext
8717 #REDIRECT [[File:Wiki.png]]
8718 !! html/parsoid
8719 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8720 !! end
8721
8722 !! test
8723 Redirect to image page (2)
8724 !! wikitext
8725 #REDIRECT [[Image:Wiki.png]]
8726 !! html/parsoid
8727 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8728 !! end
8729
8730 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8731 # Next test confirms this.
8732 !! test
8733 Redirect to language (1) (T104918)
8734 !! options
8735 parsoid=wt2html,wt2wt,html2html
8736 !! wikitext
8737 #REDIRECT [[en:File:Wiki.png]]
8738 !! html/parsoid
8739 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8740 !! end
8741
8742 !! test
8743 Redirect to language (2) (T104918)
8744 !! wikitext
8745 #REDIRECT [[:en:File:Wiki.png]]
8746 !! html/parsoid
8747 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8748 !! end
8749
8750 !! test
8751 Redirect to interwiki (T104918)
8752 !! wikitext
8753 #REDIRECT [[meatball:File:Wiki.png]]
8754 !! html/parsoid
8755 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8756 !! end
8757
8758 !! test
8759 Non-English #REDIRECT
8760 !! options
8761 language=is
8762 !! wikitext
8763 #TILVÍSUN [[Main Page]]
8764 !! html/parsoid
8765 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8766 !! end
8767
8768 !! test
8769 Redirect syntax under text isn't considered a redirect
8770 !! wikitext
8771 some text
8772 #redirect [[Main Page]]
8773 !! html/parsoid
8774 <p>some text</p>
8775 <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>
8776 !! end
8777
8778 # FIXME: Should hoist the redirect to the top of the page and ensure there
8779 # is only one.
8780 !! test
8781 New redirect
8782 !! options
8783 parsoid=html2wt
8784 !! html/parsoid
8785 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8786 !! wikitext
8787 Foo
8788 #REDIRECT [[Foo]]
8789 !! end
8790
8791 ##
8792 ## XHTML tidiness
8793 ###
8794
8795 !! test
8796 <br> to <br />
8797 !! wikitext
8798 1<br>2<br />3
8799 !! html
8800 <p>1<br />2<br />3
8801 </p>
8802 !! end
8803
8804 !! test
8805 Broken br tag sanitization
8806 !! wikitext
8807 </br>
8808 !! html/php
8809 <p>&lt;/br&gt;
8810 </p>
8811 !! end
8812
8813 # TODO: Fix html2html mode (bug 51055)!
8814 !! test
8815 Parsoid: Broken br tag recognition
8816 !! options
8817 parsoid=wt2html
8818 !! wikitext
8819 </br>
8820
8821 <br/ >
8822 !! html+tidy
8823 <p><br /></p>
8824 <p><br /></p>
8825 !! end
8826
8827 !! test
8828 Incorrecly removing closing slashes from correctly formed XHTML
8829 !! wikitext
8830 <br style="clear:both;" />
8831 !! html
8832 <p><br style="clear:both;" />
8833 </p>
8834 !! end
8835
8836 !! test
8837 Failing to transform badly formed HTML into correct XHTML
8838 !! wikitext
8839 <br style="clear: left;">
8840 <br style="clear: right;">
8841 <br style="clear: both;">
8842 !! html
8843 <p><br style="clear: left;" />
8844 <br style="clear: right;" />
8845 <br style="clear: both;" />
8846 </p>
8847 !!end
8848
8849 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8850 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8851 !! test
8852 Handling html with a div self-closing tag
8853 !! wikitext
8854 <div title />
8855 <div title/>
8856 <div title/ >
8857 <div title=bar />
8858 <div title=bar/>
8859 <div title=bar/ >
8860 !! html/php
8861 <p>&lt;div title /&gt;
8862 &lt;div title/&gt;
8863 </p>
8864 <div>
8865 <p>&lt;div title=bar /&gt;
8866 &lt;div title=bar/&gt;
8867 </p>
8868 <div title="bar/"></div>
8869 </div>
8870
8871 !! html/parsoid
8872 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8873 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8874 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8875 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8876 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8877 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8878 !! end
8879
8880 !! test
8881 Handling html with a br self-closing tag
8882 !! wikitext
8883 <br title />
8884 <br title/>
8885 <br title/ >
8886 <br title=bar />
8887 <br title=bar/>
8888 <br title=bar/ >
8889 !! html/php
8890 <p><br title="" />
8891 <br title="" />
8892 <br />
8893 <br title="bar" />
8894 <br title="bar" />
8895 <br title="bar/" />
8896 </p>
8897 !! html/parsoid
8898 <p><br title="" />
8899 <br title="" />
8900 <br title="" />
8901 <br title="bar" />
8902 <br title="bar" />
8903 <br title="bar/" />
8904 </p>
8905 !! end
8906
8907 !! test
8908 Horizontal ruler (should it add that extra space?)
8909 !! wikitext
8910 <hr>
8911 <hr >
8912 foo <hr
8913 > bar
8914 !! html+tidy
8915 <hr />
8916 <hr />
8917 <p>foo</p>
8918 <hr />
8919 <p>bar</p>
8920 !! end
8921
8922 !! test
8923 Horizontal ruler -- 4+ dashes render hr
8924 !! wikitext
8925 ----
8926 !! html
8927 <hr />
8928
8929 !! end
8930
8931 !! test
8932 Horizontal ruler -- eats additional dashes on the same line
8933 !! wikitext
8934 ---------
8935 !! html
8936 <hr />
8937
8938 !! end
8939
8940 !! test
8941 Horizontal ruler -- does not collapse dashes on consecutive lines
8942 !! wikitext
8943 ----
8944 ----
8945 !! html
8946 <hr />
8947 <hr />
8948
8949 !! end
8950
8951 !! test
8952 Horizontal ruler -- <4 dashes render as plain text
8953 !! wikitext
8954 ---
8955 !! html
8956 <p>---
8957 </p>
8958 !! end
8959
8960 !! test
8961 Horizontal ruler -- Supports content following dashes on same line
8962 !! wikitext
8963 ---- Foo
8964 !! html
8965 <hr /> Foo
8966
8967 !! html+tidy
8968 <hr />
8969 <p>Foo</p>
8970 !! end
8971
8972 ###
8973 ### Block-level elements
8974 ###
8975 !! test
8976 Common list
8977 !! wikitext
8978 *Common list
8979 * item 2
8980 *item 3
8981 !! html
8982 <ul><li>Common list</li>
8983 <li> item 2</li>
8984 <li>item 3</li></ul>
8985
8986 !! end
8987
8988 !! test
8989 Numbered list
8990 !! wikitext
8991 #Numbered list
8992 #item 2
8993 # item 3
8994 !! html
8995 <ol><li>Numbered list</li>
8996 <li>item 2</li>
8997 <li> item 3</li></ol>
8998
8999 !! end
9000
9001 !! test
9002 Mixed list
9003 !! wikitext
9004 *Mixed list
9005 *# with numbers
9006 ** and bullets
9007 *# and numbers
9008 *bullets again
9009 **bullet level 2
9010 ***bullet level 3
9011 ***#Number on level 4
9012 **bullet level 2
9013 **#Number on level 3
9014 **#Number on level 3
9015 *#number level 2
9016 *Level 1
9017 *** Level 3
9018 #** Level 3, but ordered
9019 !! html
9020 <ul><li>Mixed list
9021 <ol><li> with numbers</li></ol>
9022 <ul><li> and bullets</li></ul>
9023 <ol><li> and numbers</li></ol></li>
9024 <li>bullets again
9025 <ul><li>bullet level 2
9026 <ul><li>bullet level 3
9027 <ol><li>Number on level 4</li></ol></li></ul></li>
9028 <li>bullet level 2
9029 <ol><li>Number on level 3</li>
9030 <li>Number on level 3</li></ol></li></ul>
9031 <ol><li>number level 2</li></ol></li>
9032 <li>Level 1
9033 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9034 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9035
9036 !! end
9037
9038 !! test
9039 1. Nested mixed wikitext and html list
9040 !! wikitext
9041 * hi
9042 * <ul><li>ho</li></ul>
9043 * hi
9044 ** ho
9045 !! html/php
9046 <ul><li> hi</li>
9047 <li> <ul><li>ho</li></ul></li>
9048 <li> hi
9049 <ul><li> ho</li></ul></li></ul>
9050
9051 !! html/parsoid
9052 <ul><li> hi</li>
9053 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9054 <li> hi
9055 <ul><li> ho</li></ul></li></ul>
9056 !! end
9057
9058 !! test
9059 2. Nested mixed wikitext and html list (incompatible)
9060 !! wikitext
9061 ; hi
9062 : {{echo|<li>ho</li>}}
9063 !! html/php
9064 <dl><dt> hi</dt>
9065 <dd> <li>ho</li></dd></dl>
9066
9067 !! html/parsoid
9068 <dl><dt> hi</dt>
9069 <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>
9070 !! end
9071
9072 !! test
9073 Nested lists 1
9074 !! wikitext
9075 *foo
9076 **bar
9077 !! html
9078 <ul><li>foo
9079 <ul><li>bar</li></ul></li></ul>
9080
9081 !! end
9082
9083 !! test
9084 Nested lists 2
9085 !! wikitext
9086 **foo
9087 *bar
9088 !! html
9089 <ul><li><ul><li>foo</li></ul></li>
9090 <li>bar</li></ul>
9091
9092 !! end
9093
9094 !! test
9095 Nested lists 3 (first element empty)
9096 !! wikitext
9097 *
9098 **bar
9099 !! html
9100 <ul><li>
9101 <ul><li>bar</li></ul></li></ul>
9102
9103 !! end
9104
9105 !! test
9106 Nested lists 4 (first element empty)
9107 !! wikitext
9108 **
9109 *bar
9110 !! html
9111 <ul><li><ul><li></li></ul></li>
9112 <li>bar</li></ul>
9113
9114 !! end
9115
9116 !! test
9117 Nested lists 5 (both elements empty)
9118 !! wikitext
9119 **
9120 *
9121 !! html
9122 <ul><li><ul><li></li></ul></li>
9123 <li></li></ul>
9124
9125 !! end
9126
9127 !! test
9128 Nested lists 6 (both elements empty)
9129 !! wikitext
9130 *
9131 **
9132 !! html
9133 <ul><li>
9134 <ul><li></li></ul></li></ul>
9135
9136 !! end
9137
9138 !! test
9139 Nested lists 7 (skip initial nesting levels)
9140 !! wikitext
9141 *** foo
9142 !! html
9143 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9144
9145 !! end
9146
9147 !! test
9148 Nested lists 8 (multiple nesting transitions)
9149 !! wikitext
9150 * foo
9151 *** bar
9152 ** baz
9153 * boo
9154 !! html
9155 <ul><li> foo
9156 <ul><li><ul><li> bar</li></ul></li>
9157 <li> baz</li></ul></li>
9158 <li> boo</li></ul>
9159
9160 !! end
9161
9162 !! test
9163 Nested lists 9 (extension interaction)
9164 !! options
9165 parsoid
9166 !! wikitext
9167 *<references />
9168 !! html/parsoid
9169 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9170 !! end
9171
9172 !! test
9173 1. Lists with start-of-line-transparent tokens before bullets: Comments
9174 !! wikitext
9175 *foo
9176 *<!--cmt-->bar
9177 <!--cmt-->*baz
9178 !! html
9179 <ul><li>foo</li>
9180 <li>bar</li>
9181 <li>baz</li></ul>
9182
9183 !! end
9184
9185 !! test
9186 2. Lists with start-of-line-transparent tokens before bullets: Template close
9187 !! wikitext
9188 *foo {{echo|bar
9189 }}*baz
9190 !! html
9191 <ul><li>foo bar</li>
9192 <li>baz</li></ul>
9193
9194 !! end
9195
9196 !! test
9197 List items are not parsed correctly following a <pre> block (bug 785)
9198 !! wikitext
9199 * <pre>foo</pre>
9200 * <pre>bar</pre>
9201 * zar
9202 !! html/php
9203 <ul><li> <pre>foo</pre></li>
9204 <li> <pre>bar</pre></li>
9205 <li> zar</li></ul>
9206
9207 !! html/parsoid
9208 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9209 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9210 <li> zar</li></ul>
9211 !! end
9212
9213 !! test
9214 List items from template
9215 !! wikitext
9216
9217 {{inner list}}
9218 * item 2
9219
9220 * item 0
9221 {{inner list}}
9222 * item 2
9223
9224 * item 0
9225 * notSOL{{inner list}}
9226 * item 2
9227 !! html
9228 <ul><li> item 1</li>
9229 <li> item 2</li></ul>
9230 <ul><li> item 0</li>
9231 <li> item 1</li>
9232 <li> item 2</li></ul>
9233 <ul><li> item 0</li>
9234 <li> notSOL</li>
9235 <li> item 1</li>
9236 <li> item 2</li></ul>
9237
9238 !! end
9239
9240 !! test
9241 List interrupted by empty line or heading
9242 !! wikitext
9243 * foo
9244
9245 ** bar
9246 == A heading ==
9247 * Another list item
9248 !! html
9249 <ul><li> foo</li></ul>
9250 <ul><li><ul><li> bar</li></ul></li></ul>
9251 <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>
9252 <ul><li> Another list item</li></ul>
9253
9254 !!end
9255
9256 !!test
9257 Multiple list tags generated by templates
9258 !! wikitext
9259 {{echo|<li>}}a
9260 {{echo|<li>}}b
9261 {{echo|<li>}}c
9262 !! html
9263 <li>a
9264 <li>b
9265 <li>c</li>
9266 </li>
9267 </li>
9268
9269 !! html+tidy
9270 <ul>
9271 <li>a</li>
9272 <li>b</li>
9273 <li>c</li>
9274 </ul>
9275 !!end
9276
9277 !!test
9278 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9279 !! wikitext
9280 *a
9281 <!--This line will NOT split the list-->
9282 *b
9283 <!--This line will NOT split the list either-->
9284 *c
9285 <!--foo--> <!----> <!--This line NOT split the list either-->
9286 *d
9287 !! html
9288 <ul><li>a</li>
9289 <li>b</li>
9290 <li>c</li>
9291 <li>d</li></ul>
9292
9293 !!end
9294
9295 !!test
9296 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9297 !! wikitext
9298 *a
9299 <!--This line will NOT split the list-->
9300 *b
9301 <!--This line will NOT split the list either-->
9302 *c
9303 <!--foo--> <!----> <!--This line NOT split the list
9304 either-->
9305 *d
9306 !! html
9307 <ul><li>a</li>
9308 <li>b</li>
9309 <li>c</li>
9310 <li>d</li></ul>
9311
9312 !!end
9313
9314 !!test
9315 Test the li-hack
9316 (The PHP parser relies on Tidy for the hack)
9317 !!options
9318 parsoid=wt2html,wt2wt
9319 !! wikitext
9320 * foo
9321 * <li>li-hack
9322 * {{echo|<li>templated li-hack}}
9323 * <!--foo--> <li> unsupported li-hack with preceding comments
9324
9325 <ul>
9326 <li><li>not a li-hack
9327 </li>
9328 </ul>
9329 !! html+tidy
9330 <ul>
9331 <li>foo</li>
9332 <li>li-hack</li>
9333 <li>templated li-hack</li>
9334 <li>unsupported li-hack with preceding comments</li>
9335 </ul>
9336 <ul>
9337 <li>not a li-hack</li>
9338 </ul>
9339 !!end
9340
9341 !! test
9342 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9343 !! options
9344 parsoid
9345 !! wikitext
9346 # foo
9347 ## bar
9348 * foo
9349 ** bar
9350 : foo
9351 :: bar
9352 !! html
9353 <ol>
9354 <li> foo<ol>
9355 <li> bar</li>
9356 </ol></li>
9357 </ol><ul>
9358 <li> foo<ul>
9359 <li> bar</li>
9360 </ul></li>
9361 </ul><dl>
9362 <dd> foo<dl>
9363 <dd> bar</dd>
9364 </dl></dd>
9365 </dl>
9366 !! end
9367
9368 !! test
9369 Parsoid: Test of whitespace serialization with Templated bullets
9370 !! options
9371 parsoid
9372 !! wikitext
9373 * {{bullet}}
9374 !! html
9375 <ul>
9376 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9377 </ul>
9378 !! end
9379
9380 # ------------------------------------------------------------------------
9381 # The next set of tests are about Parsoid's ability to handle badly nested
9382 # tags (parse, minimize scope of fixup, and roundtrip back)
9383 # ------------------------------------------------------------------------
9384
9385 !! test
9386 Unbalanced closing block tags break a list
9387 (php parser relies on Tidy to fix up)
9388 !! wikitext
9389 <div>
9390 *a</div><div>
9391 *b</div>
9392 !! html+tidy
9393 <div>
9394 <ul>
9395 <li>a</li>
9396 </ul>
9397 </div>
9398 <div>
9399 <ul>
9400 <li>b</li>
9401 </ul>
9402 </div>
9403 !! end
9404
9405 # Parsoid fails this test, but it might be tricky to support properly.
9406 # See bug 68395.
9407 !! test
9408 Unbalanced closing non-block tags don't break a list
9409 (php parser relies on Tidy to fix up)
9410 !! wikitext
9411 <span>
9412 *a</span><span>
9413 *b</span>
9414 !! html/php+tidy
9415 <ul>
9416 <li><span>a</span></li>
9417 <li><span>b</span></li>
9418 </ul>
9419 !! html/parsoid
9420 <span>
9421 <ul>
9422 <li>a<span></span>
9423 </li>
9424 <li>b
9425 </li>
9426 </ul>
9427 </span>
9428 !! end
9429
9430 !! test
9431 Unclosed formatting tags that straddle lists are closed and reopened
9432 (php parser relies on Tidy to fix up)
9433 !! options
9434 parsoid=wt2html,wt2wt,html2html
9435 !! wikitext
9436 # <s> a
9437 # b </s>
9438 !! html/php+tidy
9439 <ol>
9440 <li><s>a</s></li>
9441 <li><s>b</s></li>
9442 </ol>
9443 !! html/parsoid
9444 <ol><li> <s> a</s></li>
9445 <li><s> b </s></li></ol>
9446 !! end
9447
9448 # See bug 68395.
9449 !!test
9450 1. List embedded in a formatting tag
9451 !! wikitext
9452 <small>
9453 * foo
9454 </small>
9455 !! html/php+tidy
9456 <ul>
9457 <li><small>foo</small></li>
9458 </ul>
9459 !! html/parsoid
9460 <small>
9461 <ul>
9462 <li> foo</li>
9463 </ul>
9464 </small>
9465 !!end
9466
9467 ## Ugly Parsoid output here
9468 ## Not sure what the right output is.
9469 !!test
9470 2. List embedded in a formatting tag
9471 !! wikitext
9472 <small>
9473 *a
9474 *b</small>
9475 !! html/php+tidy
9476 <ul>
9477 <li><small>a</small></li>
9478 <li><small>b</small></li>
9479 </ul>
9480 !! html/parsoid
9481 <small></small>
9482 <ul><small>
9483 <li>a</li>
9484 </small>
9485 <li><small>b</small></li>
9486 </ul>
9487 !!end
9488
9489 # Ugly Parsoid and PHP parser output here
9490 # Not sure if we want to make this a test!
9491 #
9492 ## !!test
9493 ## 3. Unclosed formatting tags in list elements
9494 ## !! wikitext
9495 ## *<small>a
9496 ## *<small>b
9497 ## !! html/php+tidy
9498 ## <ul>
9499 ## <li><small>a</small></li>
9500 ## <li><small><small>b</small></small></li>
9501 ## </ul>
9502 ## !! html/parsoid
9503 ## <ul>
9504 ## <li><small>a</small></li>
9505 ## <small>
9506 ## <li><small>b</small></li>
9507 ## </small></ul>
9508 ## !!end
9509
9510 # This is a bug in the PHP parser + tidy combination.
9511 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9512 # and then fostered out of the table by tidy.)
9513 # We believe the Parsoid output to be correct.
9514 !! test
9515 Table with missing opening <tr> tag
9516 !! options
9517 parsoid=wt2html,wt2wt
9518 !! wikitext
9519 <table>
9520 <td>foo</td>
9521 </tr>
9522 </table>
9523 !! html+tidy
9524 <table>
9525 <tr>
9526 <td>foo</td>
9527 </tr>
9528 </table>
9529 !! end
9530
9531 ###
9532 ### Magic Words
9533 ###
9534
9535 # Note that the current date is hard-coded as
9536 # 1970-01-01T00:02:03Z (a Thursday)
9537 # when running parser tests. The timezone is also fixed to GMT, so
9538 # local date will be identical to current date.
9539
9540 !! test
9541 Magic Word: {{CURRENTDAY}}
9542 !! wikitext
9543 {{CURRENTDAY}}
9544 !! html
9545 <p>1
9546 </p>
9547 !! end
9548
9549 !! test
9550 Magic Word: {{CURRENTDAY2}}
9551 !! wikitext
9552 {{CURRENTDAY2}}
9553 !! html
9554 <p>01
9555 </p>
9556 !! end
9557
9558 !! test
9559 Magic Word: {{CURRENTDAYNAME}}
9560 !! wikitext
9561 {{CURRENTDAYNAME}}
9562 !! html
9563 <p>Thursday
9564 </p>
9565 !! end
9566
9567 !! test
9568 Magic Word: {{CURRENTDOW}}
9569 !! wikitext
9570 {{CURRENTDOW}}
9571 !! html
9572 <p>4
9573 </p>
9574 !! end
9575
9576 !! test
9577 Magic Word: {{CURRENTMONTH}}
9578 !! wikitext
9579 {{CURRENTMONTH}}
9580 !! html
9581 <p>01
9582 </p>
9583 !! end
9584
9585 !! test
9586 Magic Word: {{CURRENTMONTH1}}
9587 !! wikitext
9588 {{CURRENTMONTH1}}
9589 !! html
9590 <p>1
9591 </p>
9592 !! end
9593
9594 !! test
9595 Magic Word: {{CURRENTMONTHABBREV}}
9596 !! wikitext
9597 {{CURRENTMONTHABBREV}}
9598 !! html
9599 <p>Jan
9600 </p>
9601 !! end
9602
9603 !! test
9604 Magic Word: {{CURRENTMONTHNAME}}
9605 !! wikitext
9606 {{CURRENTMONTHNAME}}
9607 !! html
9608 <p>January
9609 </p>
9610 !! end
9611
9612 !! test
9613 Magic Word: {{CURRENTMONTHNAMEGEN}}
9614 !! wikitext
9615 {{CURRENTMONTHNAMEGEN}}
9616 !! html
9617 <p>January
9618 </p>
9619 !! end
9620
9621 !! test
9622 Magic Word: {{CURRENTTIME}}
9623 !! wikitext
9624 {{CURRENTTIME}}
9625 !! html
9626 <p>00:02
9627 </p>
9628 !! end
9629
9630 !! test
9631 Magic Word: {{CURRENTHOUR}}
9632 !! wikitext
9633 {{CURRENTHOUR}}
9634 !! html
9635 <p>00
9636 </p>
9637 !! end
9638
9639 !! test
9640 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9641 !! wikitext
9642 {{CURRENTWEEK}}
9643 !! html
9644 <p>1
9645 </p>
9646 !! end
9647
9648 !! test
9649 Magic Word: {{CURRENTYEAR}}
9650 !! wikitext
9651 {{CURRENTYEAR}}
9652 !! html
9653 <p>1970
9654 </p>
9655 !! end
9656
9657 !! test
9658 Magic Word: {{CURRENTTIMESTAMP}}
9659 !! wikitext
9660 {{CURRENTTIMESTAMP}}
9661 !! html
9662 <p>19700101000203
9663 </p>
9664 !! end
9665
9666 !! test
9667 Magic Words LOCAL (UTC)
9668 !! wikitext
9669 * {{LOCALMONTH}}
9670 * {{LOCALMONTH1}}
9671 * {{LOCALMONTHNAME}}
9672 * {{LOCALMONTHNAMEGEN}}
9673 * {{LOCALMONTHABBREV}}
9674 * {{LOCALDAY}}
9675 * {{LOCALDAY2}}
9676 * {{LOCALDAYNAME}}
9677 * {{LOCALYEAR}}
9678 * {{LOCALTIME}}
9679 * {{LOCALHOUR}}
9680 * {{LOCALWEEK}}
9681 * {{LOCALDOW}}
9682 * {{LOCALTIMESTAMP}}
9683 !! html
9684 <ul><li> 01</li>
9685 <li> 1</li>
9686 <li> January</li>
9687 <li> January</li>
9688 <li> Jan</li>
9689 <li> 1</li>
9690 <li> 01</li>
9691 <li> Thursday</li>
9692 <li> 1970</li>
9693 <li> 00:02</li>
9694 <li> 00</li>
9695 <li> 1</li>
9696 <li> 4</li>
9697 <li> 19700101000203</li></ul>
9698
9699 !! end
9700
9701 !! test
9702 Magic Word: {{FULLPAGENAME}}
9703 !! options
9704 title=[[User:Ævar Arnfjörð Bjarmason]]
9705 !! wikitext
9706 {{FULLPAGENAME}}
9707 !! html
9708 <p>User:Ævar Arnfjörð Bjarmason
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{FULLPAGENAMEE}}
9714 !! options
9715 title=[[User:Ævar Arnfjörð Bjarmason]]
9716 !! wikitext
9717 {{FULLPAGENAMEE}}
9718 !! html
9719 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9720 </p>
9721 !! end
9722
9723 !! test
9724 Magic Word: {{TALKSPACE}}
9725 !! options
9726 title=[[User:Ævar Arnfjörð Bjarmason]]
9727 !! wikitext
9728 {{TALKSPACE}}
9729 !! html
9730 <p>User talk
9731 </p>
9732 !! end
9733
9734 !! test
9735 Magic Word: {{TALKSPACE}}, same namespace
9736 !! options
9737 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9738 !! wikitext
9739 {{TALKSPACE}}
9740 !! html
9741 <p>User talk
9742 </p>
9743 !! end
9744
9745 !! test
9746 Magic Word: {{TALKSPACE}}, main namespace
9747 !! options
9748 title=[[Parser Test]]
9749 !! wikitext
9750 {{TALKSPACE}}
9751 !! html
9752 <p>Talk
9753 </p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{TALKSPACEE}}
9758 !! options
9759 title=[[User:Ævar Arnfjörð Bjarmason]]
9760 !! wikitext
9761 {{TALKSPACEE}}
9762 !! html
9763 <p>User_talk
9764 </p>
9765 !! end
9766
9767 !! test
9768 Magic Word: {{SUBJECTSPACE}}
9769 !! options
9770 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9771 !! wikitext
9772 {{SUBJECTSPACE}}
9773 !! html
9774 <p>User
9775 </p>
9776 !! end
9777
9778 !! test
9779 Magic Word: {{SUBJECTSPACE}}, same namespace
9780 !! options
9781 title=[[User:Ævar Arnfjörð Bjarmason]]
9782 !! wikitext
9783 {{SUBJECTSPACE}}
9784 !! html
9785 <p>User
9786 </p>
9787 !! end
9788
9789 !! test
9790 Magic Word: {{SUBJECTSPACE}}, main namespace
9791 !! options
9792 title=[[Parser Test]]
9793 !! wikitext
9794 {{SUBJECTSPACE}}
9795 !! html
9796
9797 !! end
9798
9799 !! test
9800 Magic Word: {{SUBJECTSPACEE}}
9801 !! options
9802 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9803 !! wikitext
9804 {{SUBJECTSPACEE}}
9805 !! html
9806 <p>User
9807 </p>
9808 !! end
9809
9810 !! test
9811 Magic Word: {{NAMESPACE}}
9812 !! options
9813 title=[[User:Ævar Arnfjörð Bjarmason]]
9814 !! wikitext
9815 {{NAMESPACE}}
9816 !! html
9817 <p>User
9818 </p>
9819 !! end
9820
9821 !! test
9822 Magic Word: {{NAMESPACEE}}
9823 !! options
9824 title=[[User:Ævar Arnfjörð Bjarmason]]
9825 !! wikitext
9826 {{NAMESPACEE}}
9827 !! html
9828 <p>User
9829 </p>
9830 !! end
9831
9832 !! test
9833 Magic Word: {{NAMESPACENUMBER}}
9834 !! options
9835 title=[[User:Ævar Arnfjörð Bjarmason]]
9836 !! wikitext
9837 {{NAMESPACENUMBER}}
9838 !! html
9839 <p>2
9840 </p>
9841 !! end
9842
9843 !! test
9844 Magic Word: {{SUBPAGENAME}}
9845 !! options
9846 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9847 !! wikitext
9848 {{SUBPAGENAME}}
9849 !! html
9850 <p>sub ö
9851 </p>
9852 !! end
9853
9854 !! test
9855 Magic Word: {{SUBPAGENAMEE}}
9856 !! options
9857 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9858 !! wikitext
9859 {{SUBPAGENAMEE}}
9860 !! html
9861 <p>sub_%C3%B6
9862 </p>
9863 !! end
9864
9865 !! test
9866 Magic Word: {{ROOTPAGENAME}}
9867 !! options
9868 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9869 !! wikitext
9870 {{ROOTPAGENAME}}
9871 !! html
9872 <p>Ævar Arnfjörð Bjarmason
9873 </p>
9874 !! end
9875
9876 !! test
9877 Magic Word: {{ROOTPAGENAMEE}}
9878 !! options
9879 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9880 !! wikitext
9881 {{ROOTPAGENAMEE}}
9882 !! html
9883 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9884 </p>
9885 !! end
9886
9887 !! test
9888 Magic Word: {{BASEPAGENAME}}
9889 !! options
9890 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9891 !! wikitext
9892 {{BASEPAGENAME}}
9893 !! html
9894 <p>Ævar Arnfjörð Bjarmason
9895 </p>
9896 !! end
9897
9898 !! test
9899 Magic Word: {{BASEPAGENAMEE}}
9900 !! options
9901 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9902 !! wikitext
9903 {{BASEPAGENAMEE}}
9904 !! html
9905 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9906 </p>
9907 !! end
9908
9909 !! test
9910 Magic Word: {{TALKPAGENAME}}
9911 !! options
9912 title=[[User:Ævar Arnfjörð Bjarmason]]
9913 !! wikitext
9914 {{TALKPAGENAME}}
9915 !! html
9916 <p>User talk:Ævar Arnfjörð Bjarmason
9917 </p>
9918 !! end
9919
9920 !! test
9921 Magic Word: {{TALKPAGENAMEE}}
9922 !! options
9923 title=[[User:Ævar Arnfjörð Bjarmason]]
9924 !! wikitext
9925 {{TALKPAGENAMEE}}
9926 !! html
9927 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9928 </p>
9929 !! end
9930
9931 !! test
9932 Magic Word: {{SUBJECTPAGENAME}}
9933 !! options
9934 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9935 !! wikitext
9936 {{SUBJECTPAGENAME}}
9937 !! html
9938 <p>User:Ævar Arnfjörð Bjarmason
9939 </p>
9940 !! end
9941
9942 !! test
9943 Magic Word: {{SUBJECTPAGENAMEE}}
9944 !! options
9945 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9946 !! wikitext
9947 {{SUBJECTPAGENAMEE}}
9948 !! html
9949 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9950 </p>
9951 !! end
9952
9953 !! test
9954 Magic Word: {{NUMBEROFFILES}}
9955 !! wikitext
9956 {{NUMBEROFFILES}}
9957 !! html
9958 <p>7
9959 </p>
9960 !! end
9961
9962 !! test
9963 Magic Word: {{PAGENAME}}
9964 !! options
9965 title=[[User:Ævar Arnfjörð Bjarmason]]
9966 !! wikitext
9967 {{PAGENAME}}
9968 !! html
9969 <p>Ævar Arnfjörð Bjarmason
9970 </p>
9971 !! end
9972
9973 !! test
9974 Magic Word: {{PAGENAME}} with metacharacters
9975 !! options
9976 title=[['foo & bar = baz']]
9977 !! wikitext
9978 ''{{PAGENAME}}''
9979 !! html/php
9980 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9981 </p>
9982 !! html+tidy
9983 <p><i>'foo &amp; bar = baz'</i></p>
9984 !! end
9985
9986 !! test
9987 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9988 !! options
9989 title=[[*RFC 1234 http://example.com/]]
9990 !! wikitext
9991 {{PAGENAME}}
9992 !! html/php
9993 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9994 </p>
9995 !! html+tidy
9996 <p>*RFC 1234 http://example.com/</p>
9997 !! end
9998
9999 !! test
10000 Magic Word: {{PAGENAMEE}}
10001 !! options
10002 title=[[User:Ævar Arnfjörð Bjarmason]]
10003 !! wikitext
10004 {{PAGENAMEE}}
10005 !! html
10006 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10012 !! options
10013 title=[[*RFC 1234 http://example.com/]]
10014 !! wikitext
10015 {{PAGENAMEE}}
10016 !! html/php
10017 <p>&#42;RFC_1234_http&#58;//example.com/
10018 </p>
10019 !! html+tidy
10020 <p>*RFC_1234_http://example.com/</p>
10021 !! end
10022
10023 !! test
10024 Magic Word: {{REVISIONID}}
10025 !! wikitext
10026 {{REVISIONID}}
10027 !! html
10028 <p>1337
10029 </p>
10030 !! end
10031
10032 !! test
10033 Magic Word: {{SCRIPTPATH}}
10034 !! wikitext
10035 {{SCRIPTPATH}}
10036 !! html
10037
10038 !! end
10039
10040 !! test
10041 Magic Word: {{STYLEPATH}}
10042 !! wikitext
10043 {{STYLEPATH}}
10044 !! html
10045 <p>/skins
10046 </p>
10047 !! end
10048
10049 !! test
10050 Magic Word: {{SERVER}}
10051 !! wikitext
10052 {{SERVER}}
10053 !! html
10054 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10055 </p>
10056 !! end
10057
10058 !! test
10059 Magic Word: {{SERVERNAME}}
10060 !! wikitext
10061 {{SERVERNAME}}
10062 !! html
10063 <p>example.org
10064 </p>
10065 !! end
10066
10067 !! test
10068 Magic Word: {{SITENAME}}
10069 !! wikitext
10070 {{SITENAME}}
10071 !! html
10072 <p>MediaWiki
10073 </p>
10074 !! end
10075
10076 !! test
10077 Case-sensitive magic words, when cased differently, should just be template transclusions
10078 !! wikitext
10079 {{CurrentMonth}}
10080 {{currentday}}
10081 {{cURreNTweEK}}
10082 {{currentHour}}
10083 !! html
10084 <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>
10085 <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>
10086 <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>
10087 <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>
10088 </p>
10089 !! end
10090
10091 !! test
10092 Case-insensitive magic words should still work with weird casing.
10093 !! wikitext
10094 {{sErVeRNaMe}}
10095 {{LCFirst:AOEU}}
10096 {{ucFIRST:aoeu}}
10097 {{SERver}}
10098 !! html
10099 <p>example.org
10100 aOEU
10101 Aoeu
10102 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10103 </p>
10104 !! end
10105
10106 # From plwiki:PLOS_ONE
10107 !! test
10108 Parsoid: Page property magic word with magic word contents
10109 !! wikitext
10110 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10111 !! html/parsoid
10112 <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>"}]]}'/>
10113 !! end
10114
10115 !! test
10116 Parsoid: Template-generated DISPLAYTITLE
10117 !! wikitext
10118 {{{{echo|DISPLAYTITLE}}:Foo}}
10119 !! html/parsoid
10120 <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}}]}'/>
10121 !! end
10122
10123 !! test
10124 Namespace 1 {{ns:1}}
10125 !! wikitext
10126 {{ns:1}}
10127 !! html
10128 <p>Talk
10129 </p>
10130 !! end
10131
10132 !! test
10133 Namespace 1 {{ns:01}}
10134 !! wikitext
10135 {{ns:01}}
10136 !! html
10137 <p>Talk
10138 </p>
10139 !! end
10140
10141 !! test
10142 Namespace 0 {{ns:0}} (bug 4783)
10143 !! wikitext
10144 {{ns:0}}
10145 !! html
10146
10147 !! end
10148
10149 !! test
10150 Namespace 0 {{ns:00}} (bug 4783)
10151 !! wikitext
10152 {{ns:00}}
10153 !! html
10154
10155 !! end
10156
10157 !! test
10158 Namespace -1 {{ns:-1}}
10159 !! wikitext
10160 {{ns:-1}}
10161 !! html
10162 <p>Special
10163 </p>
10164 !! end
10165
10166 !! test
10167 Namespace User {{ns:User}}
10168 !! wikitext
10169 {{ns:User}}
10170 !! html
10171 <p>User
10172 </p>
10173 !! end
10174
10175 !! test
10176 Namespace User talk {{ns:User_talk}}
10177 !! wikitext
10178 {{ns:User_talk}}
10179 !! html
10180 <p>User talk
10181 </p>
10182 !! end
10183
10184 !! test
10185 Namespace User talk {{ns:uSeR tAlK}}
10186 !! wikitext
10187 {{ns:uSeR tAlK}}
10188 !! html
10189 <p>User talk
10190 </p>
10191 !! end
10192
10193 !! test
10194 Namespace File {{ns:File}}
10195 !! wikitext
10196 {{ns:File}}
10197 !! html
10198 <p>File
10199 </p>
10200 !! end
10201
10202 !! test
10203 Namespace File {{ns:Image}}
10204 !! wikitext
10205 {{ns:Image}}
10206 !! html
10207 <p>File
10208 </p>
10209 !! end
10210
10211 !! test
10212 Namespace (lang=de) Benutzer {{ns:User}}
10213 !! options
10214 language=de
10215 !! wikitext
10216 {{ns:User}}
10217 !! html
10218 <p>Benutzer
10219 </p>
10220 !! end
10221
10222 !! test
10223 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10224 !! options
10225 language=de
10226 !! wikitext
10227 {{ns:3}}
10228 !! html
10229 <p>Benutzer Diskussion
10230 </p>
10231 !! end
10232
10233
10234 !! test
10235 Urlencode
10236 !! wikitext
10237 {{urlencode:hi world?!}}
10238 {{urlencode:hi world?!|WIKI}}
10239 {{urlencode:hi world?!|PATH}}
10240 {{urlencode:hi world?!|QUERY}}
10241 !! html
10242 <p>hi+world%3F%21
10243 hi_world%3F!
10244 hi%20world%3F%21
10245 hi+world%3F%21
10246 </p>
10247 !! end
10248
10249 !! test
10250 Magic Word: prioritize type info over data-parsoid
10251 !! options
10252 parsoid=html2wt
10253 !! html/parsoid
10254 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10255 !! wikitext
10256 __FORCETOC__
10257 !! end
10258
10259 !! test
10260 Magic Word: serialize on separate line (parsoid)
10261 !! options
10262 parsoid=wt2wt,html2wt
10263 !! wikitext
10264 foo
10265 __NOTOC__
10266 bar
10267 !! html/parsoid
10268 foo<meta property="mw:PageProp/notoc"/>bar
10269 !! end
10270
10271 !! test
10272 Magic Word: rt non-english wikis
10273 !! options
10274 parsoid=wt2wt
10275 language=de
10276 !! wikitext
10277 __NOEDITSECTION__
10278 !! html/parsoid
10279 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10280 !! end
10281
10282 !!test
10283 __proto__ is treated as normal wikitext (T105997)
10284 !!wikitext
10285 __proto__
10286 !!html
10287 <p>__proto__
10288 </p>
10289 !!end
10290
10291 ###
10292 ### Magic links
10293 ###
10294 !! test
10295 Magic links: internal link to RFC (bug 479)
10296 !! wikitext
10297 [[RFC 123]]
10298 !! html/php
10299 <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>
10300 </p>
10301 !! html/parsoid
10302 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10303 !! end
10304
10305 !! test
10306 Magic links: RFC (bug 479)
10307 !! wikitext
10308 RFC 822
10309 !! html/php
10310 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10311 </p>
10312 !! html/parsoid
10313 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10314 !! end
10315
10316 !! test
10317 Magic links: RFC (bug 65278)
10318 !! wikitext
10319 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10320 !! html/php
10321 <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.
10322 </p>
10323 !! html/parsoid
10324 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10325 !! end
10326
10327 !! test
10328 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10329 !! wikitext
10330 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10331 RFC
10332 822
10333 !! html/php
10334 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10335 RFC
10336 822
10337 </p>
10338 !! html/parsoid
10339 <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>
10340 RFC
10341 822</p>
10342 !! end
10343
10344 !! test
10345 Magic links: ISBN (bug 1937)
10346 !! wikitext
10347 ISBN 0-306-40615-2
10348 !! html/php
10349 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10350 </p>
10351 !! html/parsoid
10352 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10353 !! end
10354
10355 !! test
10356 Magic links: ISBN (bug 65278)
10357 !! wikitext
10358 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10359 !! html/php
10360 <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.
10361 </p>
10362 !! html/parsoid
10363 <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>
10364 !! end
10365
10366 !! test
10367 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10368 !! wikitext
10369 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10370 ISBN
10371 9780316098113
10372 ISBN 978
10373 0316098113
10374 !! html/php
10375 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10376 ISBN
10377 9780316098113
10378 ISBN 978
10379 0316098113
10380 </p>
10381 !! html/parsoid
10382 <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>
10383 ISBN
10384 9780316098113
10385 ISBN 978
10386 0316098113</p>
10387 !! end
10388
10389 !! test
10390 Magic links: PMID incorrectly converts space to underscore
10391 !! wikitext
10392 PMID 1234
10393 !! html/php
10394 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10395 </p>
10396 !! html/parsoid
10397 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10398 !! end
10399
10400 !! test
10401 Magic links: PMID (bug 65278)
10402 !! wikitext
10403 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10404 !! html/php
10405 <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.
10406 </p>
10407 !! html/parsoid
10408 <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>
10409 !! end
10410
10411 !! test
10412 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10413 !! wikitext
10414 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10415 PMID
10416 1234
10417 !! html/php
10418 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10419 PMID
10420 1234
10421 </p>
10422 !! html/parsoid
10423 <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>
10424 PMID
10425 1234</p>
10426 !! end
10427
10428 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10429 # since these are ExtLinkText, not MagicLinkText
10430 !! test
10431 Magic links: use appropriate serialization for "almost" magic links.
10432 !! wikitext
10433 X[[Special:BookSources/0978739256|foo]]
10434
10435 X[//tools.ietf.org/html/rfc1234 foo]
10436 !! html/php
10437 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10438 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10439 </p>
10440 !! html/parsoid
10441 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10442 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10443 !! end
10444
10445 ###
10446 ### Templates
10447 ####
10448
10449 !! test
10450 Nonexistent template
10451 !! wikitext
10452 {{thistemplatedoesnotexist}}
10453 !! html
10454 <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>
10455 </p>
10456 !! end
10457
10458 !! test
10459 Template with invalid target containing tags
10460 !! wikitext
10461 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10462 !! html
10463 <p>{{a<b>b</b>|foo|a=b|a = b}}
10464 </p>
10465 !! end
10466
10467 !! test
10468 Template with invalid target containing unclosed tag
10469 !! wikitext
10470 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10471 !! html
10472 <p>{{a<b>|foo|a=b|a = b}}</b>
10473 </p>
10474 !! end
10475
10476 !! test
10477 Template with invalid target containing wikilink
10478 !! wikitext
10479 {{[[Main Page]]}}
10480 !! html/php
10481 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10482 </p>
10483 !! html/parsoid
10484 <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>
10485 !! end
10486
10487 !! test
10488 Template with just whitespace in it, bug #68421
10489 !! wikitext
10490 {{echo|{{ }}}}
10491 !! html/parsoid
10492 <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>
10493 !! end
10494
10495 !! article
10496 Template:test
10497 !! text
10498 This is a test template
10499 !! endarticle
10500
10501 !! test
10502 Simple template
10503 !! wikitext
10504 {{test}}
10505 !! html
10506 <p>This is a test template
10507 </p>
10508 !! end
10509
10510 !! test
10511 Template with explicit namespace
10512 !! wikitext
10513 {{Template:test}}
10514 !! html
10515 <p>This is a test template
10516 </p>
10517 !! end
10518
10519
10520 !! article
10521 Template:paramtest
10522 !! text
10523 This is a test template with parameter {{{param}}}
10524 !! endarticle
10525
10526 !! test
10527 Template parameter
10528 !! wikitext
10529 {{paramtest|param=foo}}
10530 !! html
10531 <p>This is a test template with parameter foo
10532 </p>
10533 !! end
10534
10535 !! article
10536 Template:paramtestnum
10537 !! text
10538 [[{{{1}}}|{{{2}}}]]
10539 !! endarticle
10540
10541 !! test
10542 Template unnamed parameter
10543 !! wikitext
10544 {{paramtestnum|Main Page|the main page}}
10545 !! html
10546 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10547 </p>
10548 !! end
10549
10550 !! article
10551 Template:templatesimple
10552 !! text
10553 (test)
10554 !! endarticle
10555
10556 !! article
10557 Template:templateredirect
10558 !! text
10559 #redirect [[Template:templatesimple]]
10560 !! endarticle
10561
10562 !! article
10563 Template:templateasargtestnum
10564 !! text
10565 {{{{{1}}}}}
10566 !! endarticle
10567
10568 !! article
10569 Template:templateasargtest
10570 !! text
10571 {{template{{{templ}}}}}
10572 !! endarticle
10573
10574 !! article
10575 Template:templateasargtest2
10576 !! text
10577 {{{{{templ}}}}}
10578 !! endarticle
10579
10580 !! test
10581 Template with template name as unnamed argument
10582 !! wikitext
10583 {{templateasargtestnum|templatesimple}}
10584 !! html
10585 <p>(test)
10586 </p>
10587 !! end
10588
10589 !! test
10590 Template with template name as argument
10591 !! wikitext
10592 {{templateasargtest|templ=simple}}
10593 !! html
10594 <p>(test)
10595 </p>
10596 !! end
10597
10598 !! test
10599 Template with template name as argument (2)
10600 !! wikitext
10601 {{templateasargtest2|templ=templatesimple}}
10602 !! html
10603 <p>(test)
10604 </p>
10605 !! end
10606
10607 !! article
10608 Template:templateasargtestdefault
10609 !! text
10610 {{{{{templ|templatesimple}}}}}
10611 !! endarticle
10612
10613 !! article
10614 Template:templa
10615 !! text
10616 '''templ'''
10617 !! endarticle
10618
10619 !! test
10620 Template with default value
10621 !! wikitext
10622 {{templateasargtestdefault}}
10623 !! html
10624 <p>(test)
10625 </p>
10626 !! end
10627
10628 !! test
10629 Template with default value (value set)
10630 !! wikitext
10631 {{templateasargtestdefault|templ=templa}}
10632 !! html
10633 <p><b>templ</b>
10634 </p>
10635 !! end
10636
10637 !! test
10638 Template redirect
10639 !! wikitext
10640 {{templateredirect}}
10641 !! html/php
10642 <p>(test)
10643 </p>
10644 !! html/parsoid
10645 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10646 !! end
10647
10648 !! test
10649 Template with argument in separate line
10650 !! wikitext
10651 {{ templateasargtest |
10652 templ = simple }}
10653 !! html
10654 <p>(test)
10655 </p>
10656 !! end
10657
10658 !! test
10659 Template with complex template as argument
10660 !! wikitext
10661 {{paramtest|
10662 param ={{ templateasargtest |
10663 templ = simple }}}}
10664 !! html
10665 <p>This is a test template with parameter (test)
10666 </p>
10667 !! end
10668
10669 !! test
10670 Template with thumb image (with link in description)
10671 !! wikitext
10672 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10673 !! html/php
10674 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>
10675
10676 !! html+tidy
10677 <p>This is a test template with parameter</p>
10678 <div class="thumb tright">
10679 <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>
10680 <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>
10681 </div>
10682 </div>
10683 !! html/parsoid
10684 <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>
10685 !! end
10686
10687 !! article
10688 Template:complextemplate
10689 !! text
10690 {{{1}}} {{paramtest|
10691 param ={{{param}}}}}
10692 !! endarticle
10693
10694 !! test
10695 Template with complex arguments
10696 !! wikitext
10697 {{complextemplate|
10698 param ={{ templateasargtest |
10699 templ = simple }}|[[Template:complextemplate|link]]}}
10700 !! html
10701 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10702 </p>
10703 !! end
10704
10705 !! test
10706 BUG 553: link with two variables in a piped link
10707 !! wikitext
10708 {|
10709 |[[{{{1}}}|{{{2}}}]]
10710 |}
10711 !! html/php
10712 <table>
10713 <tr>
10714 <td>[[{{{1}}}|{{{2}}}]]
10715 </td></tr></table>
10716
10717 !! html/parsoid
10718 <table>
10719 <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>
10720 !! end
10721
10722 # See: T2553
10723 !! test
10724 Abort table cell attribute parsing on wikilink
10725 !! wikitext
10726 {|
10727 | testing [[one|two]] | three || four
10728 | testing one two | three || four
10729 | testing="[[one|two]]" | three || four
10730 |}
10731 !! html/php
10732 <table>
10733 <tr>
10734 <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>
10735 <td> four
10736 </td>
10737 <td> three </td>
10738 <td> four
10739 </td>
10740 <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>
10741 <td> four
10742 </td></tr></table>
10743
10744 !! html/parsoid
10745 <table>
10746 <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>
10747 <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>
10748 <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>
10749 </tbody></table>
10750 !! end
10751
10752 !! test
10753 Don't abort table cell attribute parsing if wikilink is found in template arg
10754 !! wikitext
10755 {|
10756 | Test {{#tag:ref|One two "[[three]]" four}}
10757 |}
10758 !! html/parsoid
10759 <table>
10760 <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>
10761 </tbody></table>
10762 !! end
10763
10764 !! test
10765 Magic variable as template parameter
10766 !! wikitext
10767 {{paramtest|param={{SITENAME}}}}
10768 !! html
10769 <p>This is a test template with parameter MediaWiki
10770 </p>
10771 !! end
10772
10773 !! article
10774 Template:linktest
10775 !! text
10776 [[{{{param}}}|link]]
10777 !! endarticle
10778
10779 !! test
10780 Template parameter as link source
10781 !! wikitext
10782 {{linktest|param=Main Page}}
10783 !! html
10784 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10785 </p>
10786 !! end
10787
10788 !!article
10789 Template:paramtest2
10790 !! text
10791 including another template, {{paramtest|param={{{arg}}}}}
10792 !! endarticle
10793
10794 !! test
10795 Template passing argument to another template
10796 !! wikitext
10797 {{paramtest2|arg='hmm'}}
10798 !! html
10799 <p>including another template, This is a test template with parameter 'hmm'
10800 </p>
10801 !! end
10802
10803 !! article
10804 Template:Linktest2
10805 !! text
10806 Main Page
10807 !! endarticle
10808
10809 !! test
10810 Template as link source
10811 !! wikitext
10812 [[{{linktest2}}]]
10813
10814 [[{{linktest2}}|Main Page]]
10815
10816 [[{{linktest2}}]]Page
10817 !! html
10818 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10819 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10820 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10821 </p>
10822 !! end
10823
10824
10825 !! article
10826 Template:loop1
10827 !! text
10828 {{loop2}}
10829 !! endarticle
10830
10831 !! article
10832 Template:loop2
10833 !! text
10834 {{loop1}}
10835 !! endarticle
10836
10837 !! test
10838 Template infinite loop
10839 !! wikitext
10840 {{loop1}}
10841 !! html
10842 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10843 </p>
10844 !! end
10845
10846 !! test
10847 Template from main namespace
10848 !! wikitext
10849 {{:Main Page}}
10850 !! html
10851 <p>blah blah
10852 </p>
10853 !! end
10854
10855 !! article
10856 Template:table
10857 !! text
10858 {|
10859 | 1 || 2
10860 |-
10861 | 3 || 4
10862 |}
10863 !! endarticle
10864
10865 !! test
10866 BUG 529: Template with table, not included at beginning of line
10867 !! wikitext
10868 foo {{table}}
10869 !! html
10870 <p>foo
10871 </p>
10872 <table>
10873 <tr>
10874 <td> 1 </td>
10875 <td> 2
10876 </td></tr>
10877 <tr>
10878 <td> 3 </td>
10879 <td> 4
10880 </td></tr></table>
10881
10882 !! end
10883
10884 !! test
10885 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10886 !! wikitext
10887 foo
10888 {{table}}
10889 !! html
10890 <p>foo
10891 </p>
10892 <table>
10893 <tr>
10894 <td> 1 </td>
10895 <td> 2
10896 </td></tr>
10897 <tr>
10898 <td> 3 </td>
10899 <td> 4
10900 </td></tr></table>
10901
10902 !! end
10903
10904 !! test
10905 BUG 41: Template parameters shown as broken links
10906 !! wikitext
10907 {{{parameter}}}
10908 !! html
10909 <p>{{{parameter}}}
10910 </p>
10911 !! end
10912
10913 !! test
10914 Template with targets containing wikilinks
10915 !! wikitext
10916 {{[[foo]]}}
10917
10918 {{[[{{echo|foo}}]]}}
10919
10920 {{{{echo|[[foo}}]]}}
10921 !! html
10922 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10923 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10924 </p><p>{{[[foo}}]]
10925 </p>
10926 !! end
10927
10928 !! article
10929 Template:''
10930 !! text
10931 bar
10932 !! endarticle
10933
10934 !! test
10935 Templates: Double quotes as template target
10936 !! wikitext
10937 foo {{''}} baz
10938 !! html/php
10939 <p>foo bar baz
10940 </p>
10941 !! html/parsoid
10942 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10943 </p>
10944 !! end
10945
10946 ## This test is about making sure Parsoid's data-mw is well formed in the
10947 ## face of multiple templates with intersecting and overlapping ranges. The
10948 ## wikitext itself is wretched.
10949 !! test
10950 Templates with intersecting and overlapping ranges
10951 !! wikitext
10952 {|{{echo|
10953 <p>ha</p>}}
10954 {|{{echo|
10955 <p>ho</p>}}
10956 {{echo|{{!}}hi}}
10957 |}
10958 !! html/php+tidy
10959 <p>ha</p>
10960 <p>ho</p>
10961 <table>
10962 <tr>
10963 <td></td>
10964 </tr>
10965 <tr>
10966 <td>hi</td>
10967 </tr>
10968 </table>
10969 <table>
10970 <tr>
10971 <td></td>
10972 </tr>
10973 </table>
10974 !! html/parsoid
10975 <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":""}]]}'>
10976
10977 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10978
10979 <tbody><tr><td>hi</td></tr>
10980 </tbody></table>
10981 !! end
10982
10983 !! article
10984 Template:MSGNW test
10985 !! text
10986 ''None'' of '''this''' should be
10987 * interpreted
10988 but rather passed unmodified
10989 {{test}}
10990 <gallery>
10991 File:Foobar.jpg
10992 </gallery>
10993 <!-- comment -->
10994 !! endarticle
10995
10996 # hmm, fix this or just deprecate msgnw and document its behavior?
10997 !! test
10998 msgnw keyword
10999 !! wikitext
11000 {{msgnw:MSGNW test}}
11001 !! html/php
11002 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11003 &#42; interpreted
11004 &#32;but rather passed unmodified
11005 &#123;&#123;test&#125;&#125;
11006 &#60;gallery&#62;
11007 File:Foobar.jpg
11008 &#60;/gallery&#62;
11009 &#60;!-- comment --&#62;
11010 </p>
11011 !! end
11012
11013 !! test
11014 int keyword
11015 !! wikitext
11016 {{int:youhavenewmessages|lots of money|not!}}
11017 !! html
11018 <p>You have lots of money (not!).
11019 </p>
11020 !! end
11021
11022 !! test
11023 int keyword - non-existing message
11024 !! wikitext
11025 {{int:var}}
11026 !! html
11027 <p>⧼var⧽
11028 </p>
11029 !! end
11030
11031 !! article
11032 Template:Includes
11033 !! text
11034 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11035 !! endarticle
11036
11037 !! test
11038 <includeonly> and <noinclude> being included
11039 !! wikitext
11040 {{Includes}}
11041 !! html
11042 <p>Foobar
11043 </p>
11044 !! end
11045
11046 !! article
11047 Template:Includes2
11048 !! text
11049 <onlyinclude>Foo</onlyinclude>bar
11050 !! endarticle
11051
11052 !! test
11053 <onlyinclude> being included
11054 !! wikitext
11055 {{Includes2}}
11056 !! html
11057 <p>Foo
11058 </p>
11059 !! end
11060
11061
11062 !! article
11063 Template:Includes3
11064 !! text
11065 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11066 !! endarticle
11067
11068 !! test
11069 <onlyinclude> and <includeonly> being included
11070 !! wikitext
11071 {{Includes3}}
11072 !! html
11073 <p>Foo
11074 </p>
11075 !! end
11076
11077 !! test
11078 <includeonly> and <noinclude> on a page
11079 !! wikitext
11080 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11081 !! html
11082 <p>Foozar
11083 </p>
11084 !! end
11085
11086 !! test
11087 Un-closed <noinclude>
11088 !! wikitext
11089 <noinclude>
11090 !! html
11091 !! end
11092
11093 !! test
11094 <onlyinclude> on a page
11095 !! wikitext
11096 <onlyinclude>Foo</onlyinclude>bar
11097 !! html
11098 <p>Foobar
11099 </p>
11100 !! end
11101
11102 !! test
11103 Un-closed <onlyinclude>
11104 !! wikitext
11105 <onlyinclude>
11106 !! html
11107 !! end
11108
11109 !!test
11110 Self-closed noinclude, includeonly, onlyinclude tags
11111 !! wikitext
11112 <noinclude />
11113 <includeonly />
11114 <onlyinclude />
11115 !! html
11116 <p><br />
11117 </p>
11118 !!end
11119
11120 !!test
11121 Unbalanced includeonly and noinclude tags
11122 !! wikitext
11123 {|
11124 |a</noinclude>
11125 |b</noinclude></noinclude>
11126 |c</noinclude></includeonly>
11127 |d</includeonly></includeonly>
11128 |}
11129 !! html
11130 <table>
11131 <tr>
11132 <td>a
11133 </td>
11134 <td>b
11135 </td>
11136 <td>c&lt;/includeonly&gt;
11137 </td>
11138 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11139 </td></tr></table>
11140
11141 !!end
11142
11143 !! article
11144 Template:Includeonly section
11145 !! text
11146 <includeonly>
11147 ==Includeonly section==
11148 </includeonly>
11149 ==Section T-1==
11150 !!endarticle
11151
11152 !! test
11153 Bug 6563: Edit link generation for section shown by <includeonly>
11154 !! wikitext
11155 {{includeonly section}}
11156 !! html
11157 <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>
11158 <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>
11159
11160 !! end
11161
11162 # Uses same input as the contents of [[Template:Includeonly section]]
11163 !! test
11164 Bug 6563: Section extraction for section shown by <includeonly>
11165 !! options
11166 section=T-2
11167 !! wikitext
11168 <includeonly>
11169 ==Includeonly section==
11170 </includeonly>
11171 ==Section T-2==
11172 !! html
11173 ==Section T-2==
11174 !! end
11175
11176 !! test
11177 Bug 6563: Edit link generation for section suppressed by <includeonly>
11178 !! wikitext
11179 <includeonly>
11180 ==Includeonly section==
11181 </includeonly>
11182 ==Section 1==
11183 !! html
11184 <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>
11185
11186 !! end
11187
11188 !! test
11189 Bug 6563: Section extraction for section suppressed by <includeonly>
11190 !! options
11191 section=1
11192 !! wikitext
11193 <includeonly>
11194 ==Includeonly section==
11195 </includeonly>
11196 ==Section 1==
11197 !! html
11198 ==Section 1==
11199 !! end
11200
11201 !! test
11202 Un-closed <includeonly>
11203 !! wikitext
11204 <includeonly>
11205 !! html/php
11206 !! html/parsoid
11207 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11208 !! end
11209
11210 ## We used to, but no longer wt2wt this test since the default serializer
11211 ## will normalize the include directives to serialize on their own line.
11212 ## Selser will take care of preserving formatting in scenarios where they
11213 ## intermingled with other wikitext.
11214 !! test
11215 Includes and comments at SOL
11216 !! options
11217 parsoid=wt2html,html2html
11218 !! wikitext
11219 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11220
11221 <noinclude>
11222 some
11223 </noinclude>* stuff
11224 * here
11225
11226 <includeonly>can have stuff</includeonly>=== here ===
11227
11228 !! html/php
11229 <h2><span class="mw-headline" id="hu">hu</span></h2>
11230 <p>some
11231 </p>
11232 <ul><li> stuff</li>
11233 <li> here</li></ul>
11234 <h3><span class="mw-headline" id="here">here</span></h3>
11235
11236 !! html/parsoid
11237 <!-- 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>
11238
11239 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11240 <p>some</p>
11241 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11242 <li> here</li></ul>
11243
11244 <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>
11245
11246 !! end
11247
11248 # TODO: test with DOM fragment reuse!
11249 !! test
11250 Parsoid: DOM fragment reuse
11251 !! options
11252 parsoid=wt2wt,wt2html
11253 !! wikitext
11254 a{{echo|b<table></table>c}}d
11255
11256 a{{echo|b
11257 <table></table>
11258 c}}d
11259
11260 {{echo|a
11261
11262 <table></table>
11263
11264 b}}
11265 !! html
11266 <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>
11267
11268 <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">
11269 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11270 </span><p about="#mwt2">cd</p>
11271
11272 <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">
11273
11274 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11275
11276 </span><p about="#mwt3">b</p>
11277 !! end
11278
11279 !! test
11280 Parsoid: Merge double tds (T52603)
11281 !! options
11282 parsoid
11283 !! wikitext
11284 {|
11285 |{{echo|{{!}} foo}}
11286 |}
11287 !! html
11288 <table><tbody>
11289 <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>
11290 </tbody></table>
11291 !! end
11292
11293 !! test
11294 Parsoid: Merge double tds in nested transclusion content (T52603)
11295 !! options
11296 parsoid
11297 !! wikitext
11298 {{echo|<div>}}
11299 {|
11300 |{{echo|{{!}} foo}}
11301 |}
11302 {{echo|</div>}}
11303 !! html
11304 <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}}]}'>
11305 <table><tbody>
11306 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11307 </tbody></table>
11308 </div>
11309 !! end
11310
11311 ###
11312 ### <includeonly> and <noinclude> in attributes
11313 ###
11314 !!test
11315 0. includeonly around the entire attribute
11316 !! wikitext
11317 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11318 !! html
11319 <p><span id="v2">bar</span>
11320 </p>
11321 !!end
11322
11323 !!test
11324 1. includeonly in html attr key
11325 !! wikitext
11326 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11327 !! html
11328 <p><span id="foo">bar</span>
11329 </p>
11330 !!end
11331
11332 !!test
11333 2. includeonly in html attr value
11334 !! wikitext
11335 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11336 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11337 !! html
11338 <p><span id="v1">bar</span>
11339 <span id="v1">bar</span>
11340 </p>
11341 !!end
11342
11343 !!test
11344 3. includeonly in part of an attr value
11345 !! wikitext
11346 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11347 !! html
11348 <p><span style="color:red;">bar</span>
11349 </p>
11350 !!end
11351
11352 !!test
11353 4. includeonly in table attributes
11354 !! wikitext
11355 {|
11356 |- <noinclude>
11357 |-
11358 |a
11359 </noinclude>
11360 |- <includeonly>
11361 |-
11362 |b
11363 </includeonly>
11364 |}
11365 !! html
11366 <table>
11367
11368
11369 <tr>
11370 <td>a
11371 </td></tr>
11372 </table>
11373
11374 !!end
11375
11376 ###
11377 ### Token Stream Patcher tests
11378 ###
11379 ### These tests won't always pass wt2wt and other modes because
11380 ### on serialization, the table will be output on a new line.
11381 ### For now, we are blacklisting them, and using this to test selser.
11382 ###
11383
11384 !!test
11385 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11386 !!options
11387 parsoid=wt2html,wt2wt
11388 !!wikitext
11389 {{echo|}}{| width = '100%'
11390 |foo
11391 |}
11392 !!html/parsoid
11393 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11394 <tbody><tr><td>foo</td></tr>
11395 </tbody></table>
11396 !!end
11397
11398 ## We used to, but no longer wt2wt this test since the default serializer
11399 ## will normalize the include directives to serialize on their own line.
11400 ## Selser will take care of preserving formatting in scenarios where they
11401 ## intermingled with other wikitext.
11402 !!test
11403 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11404 !!options
11405 parsoid=wt2html
11406 !!wikitext
11407 <includeonly>a</includeonly>{| {{{b}}}
11408 |c
11409 |}
11410 !!html/parsoid
11411 <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":""}]]}'>
11412 <tbody><tr><td>c</td></tr>
11413 </tbody></table>
11414 !!end
11415
11416 ###
11417 ### Testing parsing of templates where a template arg
11418 ### has the same name as the template itself.
11419 ###
11420
11421 !! article
11422 Template:quote
11423 !! text
11424 {{{quote|{{{1}}}}}}
11425 !! endarticle
11426
11427 !!test
11428 Templates: Template Name/Arg clash: 1. Use of positional param
11429 !! wikitext
11430 {{quote|foo}}
11431 !! html
11432 <p>foo
11433 </p>
11434 !!end
11435
11436 !!test
11437 Templates: Template Name/Arg clash: 2. Use of named param
11438 !! wikitext
11439 {{quote|quote=foo}}
11440 !! html
11441 <p>foo
11442 </p>
11443 !!end
11444
11445 !!test
11446 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11447 !! wikitext
11448 {{quote|quote}}
11449 !! html
11450 <p>quote
11451 </p>
11452 !!end
11453
11454 ###
11455 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11456 ###
11457
11458 !!test
11459 Templates: 1. Simple use
11460 !! wikitext
11461 {{echo|Foo}}
11462 !! html
11463 <p>Foo
11464 </p>
11465 !!end
11466
11467 !!test
11468 Templates: 2. Inside a block tag
11469 !! wikitext
11470 <div>{{echo|Foo}}</div>
11471 <blockquote>{{echo|Foo}}</blockquote>
11472 !! html
11473 <div>Foo</div>
11474 <blockquote>Foo</blockquote>
11475
11476 !! html+tidy
11477 <div>Foo</div>
11478 <blockquote>
11479 <p>Foo</p>
11480 </blockquote>
11481 !!end
11482
11483 !!test
11484 Templates: P-wrapping: 1a. Templates on consecutive lines
11485 !! wikitext
11486 {{echo|Foo}}
11487 {{echo|bar}}
11488 !! html
11489 <p>Foo
11490 bar
11491 </p>
11492 !!end
11493
11494 !!test
11495 Templates: P-wrapping: 1b. Templates on consecutive lines
11496 !! wikitext
11497 Foo
11498
11499 {{echo|bar}}
11500 {{echo|baz}}
11501 !! html
11502 <p>Foo
11503 </p><p>bar
11504 baz
11505 </p>
11506 !!end
11507
11508 !!test
11509 Templates: P-wrapping: 1c. Templates on consecutive lines
11510 !! wikitext
11511 {{echo|Foo}}
11512 {{echo|bar}} <div>baz</div>
11513 !! html
11514 <p>Foo
11515 </p>
11516 bar <div>baz</div>
11517
11518 !! html+tidy
11519 <p>Foo</p>
11520 <p>bar</p>
11521 <div>baz</div>
11522 !! end
11523
11524 !!test
11525 Templates: P-wrapping: 1d. Template preceded by comment-only line
11526 !!options
11527 parsoid
11528 !! wikitext
11529 <!-- foo -->
11530 {{echo|Bar}}
11531 !! html
11532 <!-- foo -->
11533
11534 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11535 !!end
11536
11537 !!test
11538 Templates: Inline Text: 1. Multiple template uses
11539 !! wikitext
11540 {{echo|Foo}}bar{{echo|baz}}
11541 !! html
11542 <p>Foobarbaz
11543 </p>
11544 !!end
11545
11546 !!test
11547 Templates: Inline Text: 2. Back-to-back template uses
11548 !! wikitext
11549 {{echo|Foo}}{{echo|bar}}
11550 !! html
11551 <p>Foobar
11552 </p>
11553 !!end
11554
11555 !!test
11556 Templates: Block Tags: 1. Multiple template uses
11557 !! wikitext
11558 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11559 !! html
11560 <div>Foo</div><div>bar</div><div>baz</div>
11561
11562 !!end
11563
11564 !!test
11565 Templates: Block Tags: 2. Back-to-back template uses
11566 !! wikitext
11567 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11568 !! html
11569 <div>Foo</div><div>bar</div>
11570
11571 !!end
11572
11573 # This is an edge case relating to paragraph wrapping.
11574 !!test
11575 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11576 !! wikitext
11577 {{echo|a
11578 b</p>}}
11579 !! html/parsoid
11580 <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
11581 b</p>
11582 !!end
11583
11584 !!test
11585 Templates: Links: 1. Simple example
11586 !! wikitext
11587 {{echo|[[Foo|bar]]}}
11588 !! html
11589 <p><a href="/wiki/Foo" title="Foo">bar</a>
11590 </p>
11591 !!end
11592
11593 !!test
11594 Templates: Links: 2. Generation of link href
11595 !! wikitext
11596 [[{{echo|Foo}}|bar]]
11597 !! html
11598 <p><a href="/wiki/Foo" title="Foo">bar</a>
11599 </p>
11600 !!end
11601
11602 !!test
11603 Templates: Links: 3. Generation of part of a link href
11604 !! wikitext
11605 [[Fo{{echo|o}}|bar]]
11606
11607 [[Foo{{echo|bar}}]]
11608
11609 [[Foo{{echo|bar}}baz]]
11610
11611 [[Foo{{echo|bar}}|bar]]
11612
11613 [[:Foo{{echo|bar}}]]
11614
11615 [[:Foo{{echo|bar}}|bar]]
11616 !! html
11617 <p><a href="/wiki/Foo" title="Foo">bar</a>
11618 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11619 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11620 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11621 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11622 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11623 </p>
11624 !!end
11625
11626 !!test
11627 Templates: Links: 4. Multiple templates generating link href
11628 !! wikitext
11629 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11630 !! html
11631 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11632 </p>
11633 !!end
11634
11635 !!test
11636 Templates: Links: 5. Generation of link text
11637 !! wikitext
11638 [[Foo|{{echo|bar}}]]
11639 !! html
11640 <p><a href="/wiki/Foo" title="Foo">bar</a>
11641 </p>
11642 !!end
11643
11644 !!test
11645 Templates: Links: 5. Nested templates (only outermost template should be marked)
11646 !! wikitext
11647 {{echo|[[{{echo|Foo}}|bar]]}}
11648 !! html
11649 <p><a href="/wiki/Foo" title="Foo">bar</a>
11650 </p>
11651 !!end
11652
11653 !!test
11654 Templates: HTML Tag: 1. Generation of HTML attr. key
11655 !! wikitext
11656 <div {{echo|style}}="color:red;">foo</div>
11657 !! html
11658 <div style="color:red;">foo</div>
11659
11660 !!end
11661
11662 !!test
11663 Templates: HTML Tag: 2. Generation of HTML attr. value
11664 !! wikitext
11665 <div style={{echo|'color:red;'}}>foo</div>
11666 !! html
11667 <div style="color:red;">foo</div>
11668
11669 !!end
11670
11671 !!test
11672 Templates: HTML Tag: 3. Generation of HTML attr key and value
11673 !! wikitext
11674 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11675 !! html
11676 <div style="color:red;">foo</div>
11677
11678 !!end
11679
11680 !!test
11681 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11682 !! wikitext
11683 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11684 !! html
11685 <div title="This is a long title with just one piece templated">foo</div>
11686
11687 !!end
11688
11689 !!test
11690 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11691 !! wikitext
11692 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11693 !! html
11694 <div title="This is a long title with just one piece templated">foo</div>
11695
11696 !!end
11697
11698 !!test
11699 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11700 !! wikitext
11701 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11702 !! html
11703 <div title="This is a long title with just one piece templated">foo</div>
11704
11705 !!end
11706
11707 # SSS FIXME: While it is great we added support for all this,
11708 # do we want to make this part of the spec? Maybe we want to
11709 # deprecate this kind of usage in the future?
11710 !!test
11711 Templates: HTML Tag: 7. Generation of partial attribute key string
11712 !! wikitext
11713 <div st{{echo|yle}}="color:red;">foo</div>
11714 !! html
11715 <div style="color:red;">foo</div>
11716
11717 !!end
11718
11719 !! test
11720 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11721 !! wikitext
11722 <div {{echo|1=id="v1"}}>bar</div>
11723 !! html
11724 <div id="v1">bar</div>
11725
11726 !!end
11727
11728 !! test
11729 Templates: HTML Tag: 9. Multiple template-generated attributes
11730 !! wikitext
11731 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11732 !! html
11733 <div id="v1" title="foo">bar</div>
11734
11735 !!end
11736
11737 !! test
11738 Templates: Support for templates generating attributes and content
11739 !! wikitext
11740 {| {{mixed_attr_content_template}}
11741 |-
11742 |bar
11743 |}
11744 !! html/php
11745 <table style="color:red;" title="T48811">
11746
11747 <tr>
11748 <td>foo
11749 </td></tr>
11750 <tr>
11751 <td>bar
11752 </td></tr></table>
11753
11754 !! html/parsoid
11755 <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|}"]}'>
11756 <tbody><tr>
11757 <td>foo</td></tr>
11758 <tr>
11759 <td>bar</td></tr>
11760 </tbody></table>
11761 !!end
11762
11763 !! test
11764 1. Entities and nowikis inside templated attributes should be handled correctly
11765 !! wikitext
11766 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11767 !! html/php
11768 <div style="background:#f9f9f9;">foo</div>
11769
11770 !! html/parsoid
11771 <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>
11772 !! end
11773
11774 !! test
11775 2. Entities and nowikis inside templated attributes should be handled correctly
11776 !! wikitext
11777 {|
11778 |{{table_attribs_3}}
11779 |}
11780 !! html/php
11781 <table>
11782 <tr>
11783 <td style="background:#f9f9f9;">Foo
11784 </td></tr></table>
11785
11786 !! html/parsoid
11787 <table>
11788 <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>
11789 </tbody></table>
11790 !! end
11791
11792 !! test
11793 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11794 !! wikitext
11795 {{tbl-start}}
11796 |{{table_attribs_3}}
11797 {{tbl-end}}
11798 !! html/php
11799 <table>
11800 <tr>
11801 <td style="background:#f9f9f9;">Foo
11802 </td></tr></table>
11803
11804 !! html/parsoid
11805 <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}}]}'>
11806 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11807 </tbody></table>
11808 !! end
11809
11810 # T107622
11811 !! test
11812 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11813 !! wikitext
11814 {|
11815 | {{table_attribs_6}} hi
11816 |}
11817 !! html/php
11818 <table>
11819 <tr>
11820 <td style="background: red;"> hi
11821 </td></tr></table>
11822
11823 !! html/parsoid
11824 <table>
11825 <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>
11826 </tbody></table>
11827 !! end
11828
11829 !!test
11830 Templates: HTML Tables: 1. Generating start of a HTML table
11831 !! wikitext
11832 {{echo|<table><tr><td>foo</td>}}</tr></table>
11833 !! html
11834 <table><tr><td>foo</td></tr></table>
11835
11836 !!end
11837
11838 !!test
11839 Templates: HTML Tables: 2a. Generating middle of a HTML table
11840 !! wikitext
11841 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11842 !! html
11843 <table><tr><td>foo</td></tr></table>
11844
11845 !!end
11846
11847 !!test
11848 Templates: HTML Tables: 2b. Generating middle of a HTML table
11849 !! wikitext
11850 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11851 !! html
11852 <table><tr><td>foo</td></tr></table>
11853
11854 !!end
11855
11856 !!test
11857 Templates: HTML Tables: 3. Generating end of a HTML table
11858 !! wikitext
11859 <table><tr>{{echo|<td>foo</td></tr></table>}}
11860 !! html
11861 <table><tr><td>foo</td></tr></table>
11862
11863 !!end
11864
11865 !!test
11866 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11867 !! wikitext
11868 {{echo|<table>}}<tr><td>foo</td></tr></table>
11869 !! html
11870 <table><tr><td>foo</td></tr></table>
11871
11872 !!end
11873
11874 !!test
11875 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11876 !! wikitext
11877 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11878 !! html
11879 <table><tr><td>foo</td></tr></table>
11880
11881 !!end
11882
11883 !!test
11884 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11885 !! wikitext
11886 <table><tr>{{echo|<td>}}foo</td></tr></table>
11887 !! html
11888 <table><tr><td>foo</td></tr></table>
11889
11890 !!end
11891
11892 !!test
11893 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11894 !! wikitext
11895 <table><tr><td>foo{{echo|</td>}}</tr></table>
11896 !! html
11897 <table><tr><td>foo</td></tr></table>
11898
11899 !!end
11900
11901 !!test
11902 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11903 !! wikitext
11904 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11905 !! html
11906 <table><tr><td>foo</td></tr></table>
11907
11908 !!end
11909
11910 !!test
11911 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11912 !! wikitext
11913 <table><tr><td>foo</td></tr>{{echo|</table>}}
11914 !! html
11915 <table><tr><td>foo</td></tr></table>
11916
11917 !!end
11918
11919 !!test
11920 Templates: HTML Tables: 5. Proper fostering of categories from inside
11921 !!options
11922 parsoid=wt2html,wt2wt
11923 !! wikitext
11924 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11925 <!--Two categories (Bug 50330)-->
11926 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11927 !! html
11928 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11929 <!--Two categories (Bug 50330)-->
11930 <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>
11931 !!end
11932
11933 !!test
11934 Templates: Wiki Tables: 1a. Fostering of entire template content
11935 !! wikitext
11936 {|
11937 {{echo|a}}
11938 |}
11939 !! html
11940 <table>
11941 a
11942 <tr><td></td></tr></table>
11943
11944 !! html+tidy
11945 <p>a</p>
11946 <table>
11947 <tr>
11948 <td></td>
11949 </tr>
11950 </table>
11951 !! end
11952
11953 !!test
11954 Templates: Wiki Tables: 1b. Fostering of entire template content
11955 !! wikitext
11956 {|
11957 {{echo|<div>}}
11958 foo
11959 {{echo|</div>}}
11960 |}
11961 !! html
11962 <table>
11963 <div>
11964 <p>foo
11965 </p>
11966 </div>
11967 <tr><td></td></tr></table>
11968
11969 !! html+tidy
11970 <div>
11971 <p>foo</p>
11972 </div>
11973 <table>
11974 <tr>
11975 <td></td>
11976 </tr>
11977 </table>
11978 !! end
11979
11980 !!test
11981 Templates: Wiki Tables: 2. Fostering of partial template content
11982 !! wikitext
11983 {|
11984 {{echo|a
11985 <div>b</div>}}
11986 |}
11987 !! html
11988 <table>
11989 a
11990 <div>b</div>
11991 <tr><td></td></tr></table>
11992
11993 !! html+tidy
11994 <p>a</p>
11995 <div>b</div>
11996 <table>
11997 <tr>
11998 <td></td>
11999 </tr>
12000 </table>
12001 !! end
12002
12003 !!test
12004 Templates: Wiki Tables: 3. td-content via multiple templates
12005 !! wikitext
12006 {|
12007 {{echo|{{pipe}}a}}{{echo|b}}
12008 |}
12009 !! html
12010 <table>
12011 <tr>
12012 <td>ab
12013 </td></tr></table>
12014
12015 !!end
12016
12017 !!test
12018 Templates: Wiki Tables: 4. Templated tags, no content
12019 !! wikitext
12020 {{tbl-start}}
12021 {{tbl-end}}
12022 !! html
12023 <table>
12024 <tr><td></td></tr></table>
12025
12026 !!end
12027
12028 !!test
12029 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12030 !! wikitext
12031 {{tbl-start}}
12032 |foo
12033 {{tbl-end}}
12034 !! html
12035 <table>
12036 <tr>
12037 <td>foo
12038 </td></tr></table>
12039
12040 !!end
12041
12042 !!test
12043 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12044 !! wikitext
12045 {{tbl-start}}
12046 {{!}}foo
12047 {{tbl-end}}
12048 !! html
12049 <table>
12050 <tr>
12051 <td>foo
12052 </td></tr></table>
12053
12054 !!end
12055
12056 ## This test case is very specific to Parsoid's internals
12057 ## and is hence only tested for Parsoid's code. Parsoid uses
12058 ## a <meta> marker tag for <ref> tags and they are expanded
12059 ## much later. We are verifying that this <meta> tag usage
12060 ## doesn't prevent foster parenting.
12061 !!test
12062 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12063 !!wikitext
12064 {{PartialTable}}<ref>foo</ref>
12065 |}
12066
12067 <references />
12068 !!html/parsoid
12069 <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">
12070 <tbody>
12071 </tbody></table>
12072
12073 <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>
12074 !!end
12075
12076 !! test
12077 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12078 !! wikitext
12079 {{echo|
12080 {{{!}}
12081 {{!}}-}}
12082 <onlyinclude>
12083 |foo
12084 </onlyinclude>
12085 {{!}}}
12086 !! html/parsoid
12087 <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{{!}}}"]}'>
12088 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12089 <tbody><tr>
12090
12091 <td>foo
12092 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12093 </tbody></table>
12094 !! end
12095
12096 !!test
12097 Templates: Lists: Multi-line list-items via templates
12098 !! wikitext
12099 *{{echo|a {{nonexistent|
12100 unused}}}}
12101 *{{echo|b {{nonexistent|
12102 unused}}}}
12103 !! html
12104 <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>
12105 <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>
12106
12107 !!end
12108
12109 !!test
12110 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12111 !! wikitext
12112 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12113 !! html
12114 <p><i>ab</i>c<i>d</i>e
12115 </p>
12116 !!end
12117
12118 !!test
12119 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12120 (PHP parser generates misnested html)
12121 !! wikitext
12122 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12123 !! html/parsoid
12124 <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>
12125 !!end
12126
12127 !!test
12128 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12129 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12130 !! options
12131 parsoid=wt2html,wt2wt
12132 !! wikitext
12133 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12134 !! html
12135 <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>
12136 <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>
12137 <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>
12138 !!end
12139
12140 !!test
12141 Templates: Ugly nesting: 4. Divs opened/closed across templates
12142 !! wikitext
12143 a<div>b{{echo|c</div>d}}e
12144 !! html
12145 a<div>bc</div>de
12146
12147 !! html+tidy
12148 <p>a</p>
12149 <div>bc</div>
12150 <p>de</p>
12151 !! end
12152
12153 !!test
12154 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12155 (Parsoid-centric)
12156 !! options
12157 parsoid
12158 !! wikitext
12159 {|
12160 |{{echo|foo</table>}}
12161 |bar
12162 |}
12163 !! html
12164 <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|}"]}'>
12165
12166 <tbody>
12167 <tr>
12168 <td>foo</td></tr></tbody></table><span about="#mwt1">
12169 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12170 |}</span>
12171 !!end
12172
12173 !!test
12174 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12175 (Parsoid-centric)
12176 !! options
12177 parsoid
12178 !! wikitext
12179 <table>
12180 <tr>
12181 <td>
12182 <table>
12183 <tr>
12184 <td>1. {{echo|foo </table>}}</td>
12185 <td> bar </td>
12186 <td>2. {{echo|baz </table>}}</td>
12187 </tr>
12188 <tr>
12189 <td>abc</td>
12190 </tr>
12191 </table>
12192 </td>
12193 </tr>
12194 <tr>
12195 <td>xyz</td>
12196 </tr>
12197 </table>
12198 !! html
12199 <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>"]}'>
12200 <tbody><tr>
12201 <td>
12202 <table>
12203 <tbody><tr>
12204 <td>1. foo </td></tr></tbody></table></td>
12205 <td> bar </td>
12206 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12207 </span><span about="#mwt2">
12208 </span><span about="#mwt2">
12209 </span><span about="#mwt2">abc</span><span about="#mwt2">
12210 </span><span about="#mwt2">
12211 </span><span about="#mwt2">
12212 </span><span about="#mwt2">
12213 </span><span about="#mwt2">
12214 </span><span about="#mwt2">
12215 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12216 </span><span about="#mwt2">
12217 </span>
12218 !!end
12219
12220 !! test
12221 Templates: Ugly templates: 3. newline-only template parameter
12222 !! wikitext
12223 foo {{echo|
12224 }}
12225 !! html
12226 <p>foo
12227 </p>
12228 !! end
12229
12230 # This looks like a bug: a single newline triggers p/br for some reason.
12231 !! test
12232 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12233 !! wikitext
12234 {{echo|
12235 }}
12236 !! html
12237 <p><br />
12238 </p>
12239 !! end
12240
12241 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12242 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12243 !! test
12244 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12245 !! wikitext
12246 {{echo|<table>}}
12247 {{echo|<div>foo}}
12248 {{echo|</table>}}
12249 !! html/parsoid
12250 <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
12251 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12252 </table>
12253 !! end
12254
12255 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12256 # that are "identical" and generate nesting cycles in the algorithm
12257 !! test
12258 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12259 !! wikitext
12260 {{echo|<table><tr><td><table>}}
12261 {{echo|<div>}}
12262 {{echo|</div>}}
12263 !! html/parsoid
12264 <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"}'>
12265 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12266 </table></td></tr></tbody></table>
12267 !! end
12268
12269 !! test
12270 Templates: Parameters substituted at the top-level
12271 !! wikitext
12272 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12273 !! html/php
12274 <p><i>who</i> me? <b>never!</b>
12275 </p>
12276 !! html/parsoid
12277 <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>
12278 !! end
12279
12280 !!test
12281 Parser Functions: 1. Simple example
12282 !! wikitext
12283 {{uc:foo}}
12284 !! html
12285 <p>FOO
12286 </p>
12287 !!end
12288
12289 !!test
12290 Parser Functions: 2. Nested use (only outermost should be marked up)
12291 !! wikitext
12292 {{uc:{{lc:FOO}}}}
12293 !! html
12294 <p>FOO
12295 </p>
12296 !!end
12297
12298 ###
12299 ### Pre-save transform tests
12300 ###
12301 !! test
12302 pre-save transform: subst:
12303 !! options
12304 pst
12305 !! wikitext
12306 {{subst:test}}
12307 !! html/php
12308 This is a test template
12309 !! end
12310
12311 !! test
12312 pre-save transform: normal template
12313 !! options
12314 pst
12315 !! wikitext
12316 {{test}}
12317 !! html/php
12318 {{test}}
12319 !! end
12320
12321 !! test
12322 pre-save transform: nonexistent template
12323 !! options
12324 pst
12325 !! wikitext
12326 {{thistemplatedoesnotexist}}
12327 !! html/php
12328 {{thistemplatedoesnotexist}}
12329 !! end
12330
12331 !! test
12332 pre-save transform: subst magic variables
12333 !! options
12334 pst
12335 !! wikitext
12336 {{subst:SITENAME}}
12337 !! html/php
12338 MediaWiki
12339 !! end
12340
12341 # This is bug 89, which I fixed. -- wtm
12342 !! test
12343 pre-save transform: subst: templates with parameters
12344 !! options
12345 pst
12346 !! wikitext
12347 {{subst:paramtest|param="something else"}}
12348 !! html/php
12349 This is a test template with parameter "something else"
12350 !! end
12351
12352 !! article
12353 Template:nowikitest
12354 !! text
12355 <nowiki>'''not wiki'''</nowiki>
12356 !! endarticle
12357
12358 !! test
12359 pre-save transform: nowiki in subst (bug 1188)
12360 !! options
12361 pst
12362 !! wikitext
12363 {{subst:nowikitest}}
12364 !! html/php
12365 <nowiki>'''not wiki'''</nowiki>
12366 !! end
12367
12368 !! article
12369 Template:commenttest
12370 !! text
12371 This template has <!-- a comment --> in it.
12372 !! endarticle
12373
12374 !! test
12375 pre-save transform: comment in subst (bug 1936)
12376 !! options
12377 pst
12378 !! wikitext
12379 {{subst:commenttest}}
12380 !! html/php
12381 This template has <!-- a comment --> in it.
12382 !! end
12383
12384 !! test
12385 pre-save transform: unclosed tag
12386 !! options
12387 pst
12388 !! wikitext
12389 <nowiki>'''not wiki'''
12390 !! html/php
12391 <nowiki>'''not wiki'''
12392 !! end
12393
12394 !! test
12395 pre-save transform: mixed tag case
12396 !! options
12397 pst
12398 !! wikitext
12399 <NOwiki>'''not wiki'''</noWIKI>
12400 !! html/php
12401 <NOwiki>'''not wiki'''</noWIKI>
12402 !! end
12403
12404 !! test
12405 pre-save transform: unclosed comment in <nowiki>
12406 !! options
12407 pst
12408 !! wikitext
12409 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12410 !! html/php
12411 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12412 !!end
12413
12414 # Leading @ in this template definition works around a limitation
12415 # in parsoid's parserTests which otherwise strips the <span> from the
12416 # result (confusing it for a template wrapper)
12417 !! article
12418 Template:dangerous
12419 !!text
12420 @<span onmouseover="alert('crap')">Oh no</span>
12421 !!endarticle
12422
12423 !!test
12424 (confirming safety of fix for subst bug 1936)
12425 !! wikitext
12426 {{Template:dangerous}}
12427 !! html
12428 <p>@<span>Oh no</span>
12429 </p>
12430 !! end
12431
12432 !! test
12433 pre-save transform: comment containing gallery (bug 5024)
12434 !! options
12435 pst
12436 !! wikitext
12437 <!-- <gallery>data</gallery> -->
12438 !! html/php
12439 <!-- <gallery>data</gallery> -->
12440 !!end
12441
12442 !! test
12443 pre-save transform: comment containing extension
12444 !! options
12445 pst
12446 !! wikitext
12447 <!-- <tag>data</tag> -->
12448 !! html/php
12449 <!-- <tag>data</tag> -->
12450 !!end
12451
12452 !! test
12453 pre-save transform: comment containing nowiki
12454 !! options
12455 pst
12456 !! wikitext
12457 <!-- <nowiki>data</nowiki> -->
12458 !! html/php
12459 <!-- <nowiki>data</nowiki> -->
12460 !!end
12461
12462 !! test
12463 pre-save transform: <noinclude> in subst (bug 3298)
12464 !! options
12465 pst
12466 !! wikitext
12467 {{subst:Includes}}
12468 !! html/php
12469 Foobar
12470 !! end
12471
12472 !! test
12473 pre-save transform: <onlyinclude> in subst (bug 3298)
12474 !! options
12475 pst
12476 !! wikitext
12477 {{subst:Includes2}}
12478 !! html/php
12479 Foo
12480 !! end
12481
12482 !! article
12483 Template:SubstTest
12484 !!text
12485 {{<includeonly>subst:</includeonly>Includes}}
12486 !! endarticle
12487
12488 !! article
12489 Template:SafeSubstTest
12490 !! text
12491 {{<includeonly>safesubst:</includeonly>Includes}}
12492 !! endarticle
12493
12494 !! test
12495 bug 22297: safesubst: works during PST
12496 !! options
12497 pst
12498 !! wikitext
12499 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12500 !! html/php
12501 FoobarFoobar
12502 !! end
12503
12504 !! test
12505 bug 22297: safesubst: works during normal parse
12506 !! wikitext
12507 {{SafeSubstTest}}
12508 !! html
12509 <p>Foobar
12510 </p>
12511 !! end
12512
12513 !! test
12514 subst: does not work during normal parse
12515 !! wikitext
12516 {{SubstTest}}
12517 !! html
12518 <p>{{subst:Includes}}
12519 </p>
12520 !! end
12521
12522 !! test
12523 pre-save transform: context links ("pipe trick")
12524 !! options
12525 pst
12526 !! wikitext
12527 [[Article (context)|]]
12528 [[Bar:Article|]]
12529 [[:Bar:Article|]]
12530 [[Bar:Article (context)|]]
12531 [[:Bar:Article (context)|]]
12532 [[|Article]]
12533 [[|Article (context)]]
12534 [[Bar:X (Y) Z|]]
12535 [[:Bar:X (Y) Z|]]
12536 !! html/php
12537 [[Article (context)|Article]]
12538 [[Bar:Article|Article]]
12539 [[:Bar:Article|Article]]
12540 [[Bar:Article (context)|Article]]
12541 [[:Bar:Article (context)|Article]]
12542 [[Article]]
12543 [[Article (context)]]
12544 [[Bar:X (Y) Z|X (Y) Z]]
12545 [[:Bar:X (Y) Z|X (Y) Z]]
12546 !! end
12547
12548 !! test
12549 pre-save transform: context links ("pipe trick") with interwiki prefix
12550 !! options
12551 pst
12552 !! wikitext
12553 [[interwiki:Article|]]
12554 [[:interwiki:Article|]]
12555 [[interwiki:Bar:Article|]]
12556 [[:interwiki:Bar:Article|]]
12557 !! html/php
12558 [[interwiki:Article|Article]]
12559 [[:interwiki:Article|Article]]
12560 [[interwiki:Bar:Article|Bar:Article]]
12561 [[:interwiki:Bar:Article|Bar:Article]]
12562 !! end
12563
12564 !! test
12565 pre-save transform: context links ("pipe trick") with parens in title
12566 !! options
12567 pst title=[[Somearticle (context)]]
12568 !! wikitext
12569 [[|Article]]
12570 !! html/php
12571 [[Article (context)|Article]]
12572 !! end
12573
12574 !! test
12575 pre-save transform: context links ("pipe trick") with comma in title
12576 !! options
12577 pst title=[[Someplace, Somewhere]]
12578 !! wikitext
12579 [[|Otherplace]]
12580 [[Otherplace, Elsewhere|]]
12581 [[Otherplace, Elsewhere, Anywhere|]]
12582 !! html/php
12583 [[Otherplace, Somewhere|Otherplace]]
12584 [[Otherplace, Elsewhere|Otherplace]]
12585 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12586 !! end
12587
12588 !! test
12589 pre-save transform: context links ("pipe trick") with parens and comma
12590 !! options
12591 pst title=[[Someplace (IGNORED), Somewhere]]
12592 !! wikitext
12593 [[|Otherplace]]
12594 [[Otherplace (place), Elsewhere|]]
12595 !! html/php
12596 [[Otherplace, Somewhere|Otherplace]]
12597 [[Otherplace (place), Elsewhere|Otherplace]]
12598 !! end
12599
12600 !! test
12601 pre-save transform: context links ("pipe trick") with comma and parens
12602 !! options
12603 pst title=[[Who, me? (context)]]
12604 !! wikitext
12605 [[|Yes, you.]]
12606 [[Me, Myself, and I (1937 song)|]]
12607 !! html/php
12608 [[Yes, you. (context)|Yes, you.]]
12609 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12610 !! end
12611
12612 !! test
12613 pre-save transform: context links ("pipe trick") with namespace
12614 !! options
12615 pst title=[[Ns:Somearticle]]
12616 !! wikitext
12617 [[|Article]]
12618 !! html/php
12619 [[Ns:Article|Article]]
12620 !! end
12621
12622 !! test
12623 pre-save transform: context links ("pipe trick") with namespace and parens
12624 !! options
12625 pst title=[[Ns:Somearticle (context)]]
12626 !! wikitext
12627 [[|Article]]
12628 !! html/php
12629 [[Ns:Article (context)|Article]]
12630 !! end
12631
12632 !! test
12633 pre-save transform: context links ("pipe trick") with namespace and comma
12634 !! options
12635 pst title=[[Ns:Somearticle, Context, Whatever]]
12636 !! wikitext
12637 [[|Article]]
12638 !! html/php
12639 [[Ns:Article, Context, Whatever|Article]]
12640 !! end
12641
12642 !! test
12643 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12644 !! options
12645 pst title=[[Ns:Somearticle, Context (context)]]
12646 !! wikitext
12647 [[|Article]]
12648 !! html/php
12649 [[Ns:Article (context)|Article]]
12650 !! end
12651
12652 !! test
12653 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12654 !! options
12655 pst title=[[Ns:Somearticle (IGNORED), Context]]
12656 !! wikitext
12657 [[|Article]]
12658 !! html/php
12659 [[Ns:Article, Context|Article]]
12660 !! end
12661
12662 !! test
12663 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12664 !! options
12665 pst
12666 !! wikitext
12667 [[Article(context)|]]
12668 [[Bar:Article(context)|]]
12669 [[:Bar:Article(context)|]]
12670 [[|Article(context)]]
12671 [[Bar:X(Y)Z|]]
12672 [[:Bar:X(Y)Z|]]
12673 !! html/php
12674 [[Article(context)|Article]]
12675 [[Bar:Article(context)|Article]]
12676 [[:Bar:Article(context)|Article]]
12677 [[Article(context)]]
12678 [[Bar:X(Y)Z|X(Y)Z]]
12679 [[:Bar:X(Y)Z|X(Y)Z]]
12680 !! end
12681
12682 !! test
12683 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12684 !! options
12685 pst
12686 !! wikitext
12687 [[Article (context)|]]
12688 [[Bar:Article (context)|]]
12689 [[:Bar:Article (context)|]]
12690 [[|Article (context)]]
12691 [[Bar:X (Y) Z|]]
12692 [[:Bar:X (Y) Z|]]
12693 !! html/php
12694 [[Article (context)|Article]]
12695 [[Bar:Article (context)|Article]]
12696 [[:Bar:Article (context)|Article]]
12697 [[Article (context)]]
12698 [[Bar:X (Y) Z|X (Y) Z]]
12699 [[:Bar:X (Y) Z|X (Y) Z]]
12700 !! end
12701
12702 !! test
12703 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12704 !! options
12705 pst
12706 !! wikitext
12707 [[Article(context)|]]
12708 [[Bar:Article(context)|]]
12709 [[:Bar:Article(context)|]]
12710 [[|Article(context)]]
12711 [[Bar:X(Y)Z|]]
12712 [[:Bar:X(Y)Z|]]
12713 !! html/php
12714 [[Article(context)|Article]]
12715 [[Bar:Article(context)|Article]]
12716 [[:Bar:Article(context)|Article]]
12717 [[Article(context)]]
12718 [[Bar:X(Y)Z|X(Y)Z]]
12719 [[:Bar:X(Y)Z|X(Y)Z]]
12720 !! end
12721
12722 !! test
12723 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12724 !! options
12725 pst
12726 !! wikitext
12727 [[Article (context), context|]]
12728 [[Article (context),context|]]
12729 [[Bar:Article (context), context|]]
12730 [[Bar:Article (context),context|]]
12731 [[:Bar:Article (context), context|]]
12732 [[:Bar:Article (context),context|]]
12733 !! html/php
12734 [[Article (context), context|Article]]
12735 [[Article (context),context|Article]]
12736 [[Bar:Article (context), context|Article]]
12737 [[Bar:Article (context),context|Article]]
12738 [[:Bar:Article (context), context|Article]]
12739 [[:Bar:Article (context),context|Article]]
12740 !! end
12741
12742 !! test
12743 pre-save transform: trim trailing empty lines
12744 !! options
12745 pst
12746 !! wikitext
12747 Empty lines are trimmed
12748
12749
12750
12751
12752 !! html/php
12753 Empty lines are trimmed
12754 !! end
12755
12756 !! test
12757 pre-save transform: Signature expansion
12758 !! options
12759 pst
12760 !! wikitext
12761 * ~~~
12762 * <noinclude>~~~</noinclude>
12763 * <includeonly>~~~</includeonly>
12764 * <onlyinclude>~~~</onlyinclude>
12765 !! html/php
12766 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12767 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12768 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12769 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12770 !! end
12771
12772
12773 !! test
12774 pre-save transform: Signature expansion in nowiki tags (bug 93)
12775 !! options
12776 pst disabled
12777 !! wikitext
12778 Shall not expand:
12779
12780 <nowiki>~~~~</nowiki>
12781
12782 <includeonly><nowiki>~~~~</nowiki></includeonly>
12783
12784 <noinclude><nowiki>~~~~</nowiki></noinclude>
12785
12786 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12787
12788 {{subst:Foo}} shall be converted to FOO
12789
12790 As well as inside noinclude/onlyinclude
12791 <noinclude>{{subst:Foo}}</noinclude>
12792 <onlyinclude>{{subst:Foo}}</onlyinclude>
12793
12794 But not inside includeonly
12795 <includeonly>{{subst:Foo}}</includeonly>
12796 !! html/php
12797 Shall not expand:
12798
12799 <nowiki>~~~~</nowiki>
12800
12801 <includeonly><nowiki>~~~~</nowiki></includeonly>
12802
12803 <noinclude><nowiki>~~~~</nowiki></noinclude>
12804
12805 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12806
12807 FOO shall be converted to FOO
12808
12809 As well as inside noinclude/onlyinclude
12810 <noinclude>FOO</noinclude>
12811 <onlyinclude>FOO</onlyinclude>
12812
12813 But not inside includeonly
12814 <includeonly>{{subst:Foo}}</includeonly>
12815 !! end
12816
12817 !! test
12818 Parsoid: Recognize nowiki with trailing space in tags
12819 !! options
12820 parsoid=wt2html
12821 !! wikitext
12822 <nowiki ><div>[[foo]]</nowiki >
12823
12824 a<nowiki / >b
12825
12826 c<nowiki />d
12827
12828 e<nowiki/ >f
12829 !! html
12830 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12831 <p>ab</p>
12832 <p>cd</p>
12833 <p>ef</p>
12834 !! end
12835
12836 !! test
12837 Parsoid: Recognize nowiki with odd capitalization
12838 !! options
12839 parsoid=wt2html
12840 !! wikitext
12841 <noWikI ><div>[[foo]]</Nowiki >
12842 !! html
12843 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12844 !! end
12845
12846
12847 !! test
12848 Parsoid: Escape nowiki with trailing space in tags
12849 !! options
12850 parsoid=html2wt
12851 !! html/parsoid
12852 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12853 <p>a&lt;nowiki /&gt;b</p>
12854 <p>c&lt;nowiki/ &gt;d</p>
12855 !! wikitext
12856 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12857
12858 a&lt;nowiki /&gt;b
12859
12860 c&lt;nowiki/ &gt;d
12861 !! end
12862
12863 !! test
12864 Parsoid: Escape weird noWikI capitalizations
12865 !! options
12866 parsoid=html2wt
12867 !! html/parsoid
12868 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12869 !! wikitext
12870 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12871 !! end
12872
12873 ###
12874 ### Message transform tests
12875 ###
12876 !! test
12877 message transform: magic variables
12878 !! options
12879 msg
12880 !! wikitext
12881 {{SITENAME}}
12882 !! html
12883 MediaWiki
12884 !! end
12885
12886 !! test
12887 message transform: should not transform wiki markup
12888 !! options
12889 msg
12890 !! wikitext
12891 ''test''
12892 !! html
12893 ''test''
12894 !! end
12895
12896 !! test
12897 message transform: <noinclude> in transcluded template (bug 4926)
12898 !! options
12899 msg
12900 !! wikitext
12901 {{Includes}}
12902 !! html
12903 Foobar
12904 !! end
12905
12906 !! test
12907 message transform: <onlyinclude> in transcluded template (bug 4926)
12908 !! options
12909 msg
12910 !! wikitext
12911 {{Includes2}}
12912 !! html
12913 Foo
12914 !! end
12915
12916 !! test
12917 {{#special:}} page name, known
12918 !! options
12919 msg
12920 !! wikitext
12921 {{#special:Recentchanges}}
12922 !! html
12923 Special:RecentChanges
12924 !! end
12925
12926 !! test
12927 {{#special:}} page name with subpage, known
12928 !! options
12929 msg
12930 !! wikitext
12931 {{#special:Recentchanges/param}}
12932 !! html
12933 Special:RecentChanges/param
12934 !! end
12935
12936 !! test
12937 {{#special:}} page name, unknown
12938 !! options
12939 msg
12940 !! wikitext
12941 {{#special:foobar nonexistent}}
12942 !! html
12943 Special:Foobar nonexistent
12944 !! end
12945
12946 !! test
12947 {{#speciale:}} page name, known
12948 !! options
12949 msg
12950 !! wikitext
12951 {{#speciale:Recentchanges}}
12952 !! html
12953 Special:RecentChanges
12954 !! end
12955
12956 !! test
12957 {{#speciale:}} page name with subpage, known
12958 !! options
12959 msg
12960 !! wikitext
12961 {{#speciale:Recentchanges/param}}
12962 !! html
12963 Special:RecentChanges/param
12964 !! end
12965
12966 !! test
12967 {{#speciale:}} page name, unknown
12968 !! options
12969 msg
12970 !! wikitext
12971 {{#speciale:foobar nonexistent}}
12972 !! html
12973 Special:Foobar_nonexistent
12974 !! end
12975
12976 ###
12977 ### Images
12978 ###
12979 ### For Parsoid-specific tests, see
12980 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12981
12982 !! test
12983 Simple image
12984 !! options
12985 parsoid=wt2html,wt2wt,html2html
12986 !! wikitext
12987 [[Image:foobar.jpg]]
12988 !! html/php
12989 <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>
12990 </p>
12991 !! html/parsoid
12992 <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>
12993 !! end
12994
12995 !! test
12996 Simple image (using File: namespace, now canonical)
12997 !! wikitext
12998 [[File:Foobar.jpg]]
12999 !! html/php
13000 <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>
13001 </p>
13002 !! html/parsoid
13003 <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>
13004 !! end
13005
13006 !! test
13007 Right-aligned image
13008 !! wikitext
13009 [[File:Foobar.jpg|right]]
13010 !! html/php
13011 <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>
13012
13013 !! html/parsoid
13014 <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>
13015 !! end
13016
13017 !! test
13018 Image with caption
13019 !! wikitext
13020 [[File:Foobar.jpg|right|Caption text]]
13021 !! html/php
13022 <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>
13023
13024 !! html/parsoid
13025 <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>
13026 !! end
13027
13028 !! test
13029 Image with caption, bug 53312 #1
13030 !! wikitext
13031 [[File:Foobar.jpg|right|Caption page stuff]]
13032 !! html/php
13033 <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>
13034
13035 !! html/parsoid
13036 <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>
13037 !! end
13038
13039 !! test
13040 Image with caption, bug 53312 #2
13041 !! wikitext
13042 [[File:Foobar.jpg|right|Caption page=]]
13043 !! html/php
13044 <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>
13045
13046 !! html/parsoid
13047 <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>
13048 !! end
13049
13050 !! test
13051 Image with caption, bug 53312 #3
13052 !! wikitext
13053 [[File:Foobar.jpg|right|Caption page=stuff]]
13054 !! html/php
13055 <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>
13056
13057 !! html/parsoid
13058 <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>
13059 !! end
13060
13061 !! test
13062 Allow empty links in image captions (Bug 60753)
13063 !! options
13064 thumbsize=220
13065 !! wikitext
13066 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13067 [[]]
13068 [[Link2]]
13069 ]]
13070 !! html/php
13071 <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>
13072
13073 !! html/parsoid
13074 <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>
13075 [[]]
13076 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13077 </figcaption></figure>
13078 !! end
13079
13080 !! test
13081 Titles in unlinked images (T23454)
13082 !! wikitext
13083 [[File:Foobar.jpg|link=|stuff]]
13084 !! html/php
13085 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13086 </p>
13087 !! end
13088
13089 !! test
13090 Link with empty target
13091 !! wikitext
13092 [[]]
13093 !! html
13094 <p>[[]]
13095 </p>
13096 !! end
13097
13098 !! test
13099 Image with link trail
13100 !! wikitext
13101 Linktrails should not work for images: [[File:Foobar.jpg]]s
13102 !! html/php
13103 <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
13104 </p>
13105 !! html/parsoid
13106 <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>
13107 !! end
13108
13109 !! test
13110 Image with empty attribute
13111 !! options
13112 parsoid=wt2html,wt2wt,html2html
13113 !! wikitext
13114 [[File:Foobar.jpg|right||Caption text]]
13115 !! html/php
13116 <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>
13117
13118 !! html/parsoid
13119 <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>
13120 !! end
13121
13122 !! test
13123 1. Block image with individual attributes from templates
13124 !! wikitext
13125 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13126 !! html/php
13127 <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>
13128
13129 !! html/parsoid
13130 <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>
13131 !! end
13132
13133 !! test
13134 2. Block Image with individual attributes from templates
13135 !! wikitext
13136 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13137 !! html/php
13138 <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>
13139
13140 !! html/parsoid
13141 <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>
13142 !! end
13143
13144 !! test
13145 3. Inline image with individual attributes from templates
13146 !! wikitext
13147 [[File:Foobar.jpg|{{echo|50px}}]]
13148 !! html/php
13149 <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>
13150 </p>
13151 !! html/parsoid
13152 <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>
13153 !! end
13154
13155 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13156 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13157 !! test
13158 Image with multiple attributes from the same template
13159 !! wikitext
13160 [[File:Foobar.jpg|{{image_attribs}}]]
13161 !! html/php
13162 <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>
13163
13164 !! html/parsoid
13165 <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>
13166 !! end
13167
13168 !! test
13169 Image with link tails
13170 !! options
13171 thumbsize=220
13172 !! wikitext
13173 123[[File:Foobar.jpg]]456
13174 123[[File:Foobar.jpg|right]]456
13175 123[[File:Foobar.jpg|thumb]]456
13176 !! html/php
13177 <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
13178 </p>
13179 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
13180 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
13181
13182 !! html/php+tidy
13183 <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>
13184 <p>123</p>
13185 <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>
13186 <p>456 123</p>
13187 <div class="thumb tright">
13188 <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>
13189 <div class="thumbcaption">
13190 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13191 </div>
13192 </div>
13193 </div>
13194 <p>456</p>
13195 !! html/parsoid
13196 <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>
13197 <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>
13198 <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>
13199 !! end
13200
13201 !! test
13202 Image with multiple captions -- only last one is accepted
13203 !! wikitext
13204 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13205 !! html/php
13206 <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>
13207
13208 !! html/parsoid
13209 <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>
13210 !! end
13211
13212 !! test
13213 Image with multiple widths -- use last
13214 !! wikitext
13215 [[File:Foobar.jpg|200px|300px|caption]]
13216 !! html/php
13217 <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>
13218 </p>
13219 !! html/parsoid
13220 <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>
13221 !! end
13222
13223 !! test
13224 Image with multiple alignments -- use first (bug 48664)
13225 !! options
13226 thumbsize=220
13227 !! wikitext
13228 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13229
13230 [[File:Foobar.jpg|middle|text-top|caption]]
13231 !! html/php
13232 <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>
13233 <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>
13234 </p>
13235 !! html/parsoid
13236 <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>
13237 <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>
13238 !! end
13239
13240 !! test
13241 Image with width attribute at different positions
13242 !! wikitext
13243 [[File:Foobar.jpg|200px|right|Caption]]
13244 [[File:Foobar.jpg|right|200px|Caption]]
13245 [[File:Foobar.jpg|right|Caption|200px]]
13246 !! html/php
13247 <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>
13248 <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>
13249 <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>
13250
13251 !! html/parsoid
13252 <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>
13253 <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>
13254 <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>
13255 !! end
13256
13257 # a sad bit of backward-compatibility
13258 !! test
13259 Image with size specified with pxpx (bug 13500, 51628)
13260 !! options
13261 parsoid=wt2html,wt2wt,html2html
13262 !! wikitext
13263 [[File:Foobar.jpg|20pxpx]]
13264 [[File:Foobar.jpg|200x20pxpx]]
13265 !! html/php
13266 <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>
13267 <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>
13268 </p>
13269 !! html/parsoid
13270 <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>
13271 !! end
13272
13273 !! test
13274 Image with link parameter, wiki target
13275 !! wikitext
13276 [[File:Foobar.jpg|link=Main Page]]
13277 !! html/php
13278 <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>
13279 </p>
13280 !! html/parsoid
13281 <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>
13282 !! end
13283
13284 # parsoid bug 49293 (part 1)
13285 !! test
13286 Image with link parameter, URL target
13287 !! wikitext
13288 [[File:Foobar.jpg|link=http://example.com/]]
13289 !! html/php
13290 <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>
13291 </p>
13292 !! html/parsoid
13293 <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>
13294 !! end
13295
13296 # parsoid bug 49293 (part 2)
13297 !! test
13298 Image with link parameter, protocol-less URL target
13299 !! wikitext
13300 [[File:Foobar.jpg|link=//example.com/]]
13301 !! html/php
13302 <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>
13303 </p>
13304 !! html/parsoid
13305 <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>
13306 !! end
13307
13308 !! test
13309 Escaping non-block captions (T107435)
13310 !! options
13311 parsoid={
13312 "modes": ["wt2wt"],
13313 "changes": [
13314 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13315 ]
13316 }
13317 !! wikitext
13318 [[Image:Foobar.jpg|caption]]
13319 !! wikitext/edited
13320 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13321 !! end
13322
13323 # wgExternalLinkTarget not supported by Parsoid
13324 !! test
13325 Image with link parameter, wgExternalLinkTarget
13326 !! wikitext
13327 [[Image:foobar.jpg|link=http://example.com/]]
13328 !! config
13329 wgExternalLinkTarget='foobar'
13330 !! html/php
13331 <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>
13332 </p>
13333 !! end
13334
13335 !! test
13336 Image with link parameter, wgNoFollowLinks set to false
13337 !! wikitext
13338 [[Image:foobar.jpg|link=http://example.com/]]
13339 !! config
13340 wgNoFollowLinks=false
13341 !! html
13342 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13343 </p>
13344 !! end
13345
13346 !! test
13347 Image with link parameter, wgNoFollowDomainExceptions
13348 !! wikitext
13349 [[Image:foobar.jpg|link=http://example.com/]]
13350 !! config
13351 wgNoFollowDomainExceptions='example.com'
13352 !! html
13353 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13354 </p>
13355 !! end
13356
13357 # wgExternalLinkTarget not supported by Parsoid
13358 !! test
13359 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13360 !! wikitext
13361 [[Image:foobar.jpg|link=http://example.com/|Title]]
13362 !! config
13363 wgExternalLinkTarget='foobar'
13364 !! html/php
13365 <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>
13366 </p>
13367 !! end
13368
13369 !! test
13370 Image with empty link parameter
13371 !! wikitext
13372 [[File:Foobar.jpg|link=]]
13373 !! html/php
13374 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13375 </p>
13376 !! html/parsoid
13377 <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>
13378 !! end
13379
13380 !! test
13381 Image with link parameter (wiki target) and unnamed parameter
13382 !! wikitext
13383 [[File:Foobar.jpg|link=Main_Page|Title]]
13384 !! html/php
13385 <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>
13386 </p>
13387 !! html/parsoid
13388 <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>
13389 !! end
13390
13391 !! test
13392 Image with link parameter (URL target) and unnamed parameter
13393 !! wikitext
13394 [[File:Foobar.jpg|link=http://example.com/|Title]]
13395 !! html/php
13396 <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>
13397 </p>
13398 !! html/parsoid
13399 <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>
13400 !! end
13401
13402 !! test
13403 Thumbnail image with link parameter
13404 !! options
13405 thumbsize=220
13406 parsoid=wt2html,wt2wt,html2html
13407 !! wikitext
13408 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13409 !! html/php
13410 <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>
13411
13412 !! html/parsoid
13413 <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>
13414 !! end
13415
13416 !! test
13417 Manually-specified thumbnail image
13418 !! options
13419 thumbsize=220
13420 !! wikitext
13421 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13422 !! html/php
13423 <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>
13424
13425 !! html/parsoid
13426 <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>
13427 !! end
13428
13429 !! test
13430 Manually-specified thumbnail image with explicit link to wiki page
13431 !! options
13432 thumbsize=220
13433 parsoid=wt2html,wt2wt,html2html
13434 !! wikitext
13435 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13436 !! html/php
13437 <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>
13438
13439 !! html/parsoid
13440 <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>
13441 !! end
13442
13443 !! test
13444 Manually-specified thumbnail image with explicit link to url
13445 !! options
13446 thumbsize=220
13447 parsoid=wt2html,wt2wt,html2html
13448 !! wikitext
13449 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13450 !! html/php
13451 <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>
13452
13453 !! html/parsoid
13454 <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>
13455 !! end
13456
13457 !! test
13458 Manually-specified thumbnail image with explicit no link
13459 !! options
13460 thumbsize=220
13461 parsoid=wt2html,wt2wt,html2html
13462 !! wikitext
13463 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13464 !! html/php
13465 <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>
13466
13467 !! html/parsoid
13468 <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>
13469 !! end
13470
13471 !! test
13472 Manually-specified thumbnail image with explicit link and alt text
13473 !! options
13474 thumbsize=220
13475 parsoid=wt2html,wt2wt,html2html
13476 !! wikitext
13477 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13478 !! html/php
13479 <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>
13480
13481 !! html/parsoid
13482 <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>
13483 !! end
13484
13485 !! test
13486 Image with frame and link
13487 !! options
13488 parsoid=wt2html,wt2wt,html2html
13489 !! wikitext
13490 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13491 !! html/php
13492 <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>
13493
13494 !! html/parsoid
13495 <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>
13496 !! end
13497
13498 !! test
13499 Image with frame and link and explicit alt
13500 !! options
13501 parsoid=wt2html,wt2wt,html2html
13502 !! wikitext
13503 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13504 !! html/php
13505 <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>
13506
13507 !! html/parsoid
13508 <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>
13509 !! end
13510
13511 !! test
13512 Image with wiki markup in implicit alt
13513 !! wikitext
13514 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13515
13516 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13517 !! html/php
13518 <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>
13519 </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>
13520 </p>
13521 !! html/parsoid
13522 <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>
13523
13524 <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>
13525 !! end
13526
13527 !! test
13528 Alt image option should handle most kinds of wikitext without barfing
13529 !! wikitext
13530 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13531 !! html/php
13532 <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>
13533
13534 !! html/parsoid
13535 <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>
13536 !! end
13537
13538 ###################
13539 # Conflicting image format options.
13540 # First option specified should 'win'.
13541 # All three cases in each test should be identical.
13542
13543 !! test
13544 Image with 'frameless' first.
13545 !! options
13546 parsoid=wt2html,wt2wt,html2html
13547 !! wikitext
13548 [[File:Foobar.jpg|frameless|caption]]
13549
13550 [[File:Foobar.jpg|frameless|frame|caption]]
13551
13552 [[File:Foobar.jpg|frameless|thumb|caption]]
13553 !! html/php
13554 <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>
13555 </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>
13556 </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>
13557 </p>
13558 !! html/parsoid
13559 <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>
13560 <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>
13561 <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>
13562 !! end
13563
13564 !! test
13565 Image with 'frame' first.
13566 !! options
13567 parsoid=wt2html,wt2wt,html2html
13568 !! wikitext
13569 [[File:Foobar.jpg|frame|caption]]
13570 [[File:Foobar.jpg|frame|frameless|caption]]
13571 [[File:Foobar.jpg|frame|thumb|caption]]
13572 !! html/php
13573 <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>
13574 <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>
13575 <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>
13576
13577 !! html/parsoid
13578 <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>
13579 <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>
13580 <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>
13581 !! end
13582
13583 !! test
13584 Image with 'thumb' first.
13585 !! options
13586 parsoid=wt2html,wt2wt,html2html
13587 !! wikitext
13588 [[File:Foobar.jpg|thumb|caption]]
13589 [[File:Foobar.jpg|thumb|frameless|caption]]
13590 [[File:Foobar.jpg|thumb|frame|caption]]
13591 !! html/php
13592 <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>
13593 <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>
13594 <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>
13595
13596 !! html/parsoid
13597 <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>
13598 <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>
13599 <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>
13600 !! end
13601
13602 ###################
13603 # Image sizing.
13604 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13605 # and https://phabricator.wikimedia.org/T64258
13606 # Foobar has actual size of 1941x220
13607 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13608 # a scalable format.
13609 # 2. Framed images always ignore size options; always render at default size.
13610 # 3. "Unspecified format" and border are the only types which can be
13611 # enlarged.
13612
13613 !! test
13614 Image: "unspecified format" and border enlarge
13615 !! options
13616 parsoid=wt2html,wt2wt,html2html
13617 !! wikitext
13618 [[File:Foobar.jpg|2000px]]
13619
13620 [[File:Foobar.jpg|border|2000px]]
13621 !! html/php
13622 <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>
13623 </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>
13624 </p>
13625 !! html/parsoid
13626 <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>
13627 <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>
13628 !! end
13629
13630 !! test
13631 Image: "unspecified format" and border reduce
13632 !! options
13633 parsoid=wt2html,wt2wt,html2html
13634 !! wikitext
13635 [[File:Foobar.jpg|1000px]]
13636
13637 [[File:Foobar.jpg|border|1000px]]
13638 !! html/php
13639 <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>
13640 </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>
13641 </p>
13642 !! html/parsoid
13643 <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>
13644 <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>
13645 !! end
13646
13647 !! test
13648 Image: thumbs reduce
13649 !! options
13650 parsoid=wt2html,wt2wt,html2html
13651 !! wikitext
13652 [[File:Foobar.jpg|thumb|50px]]
13653 !! html/php
13654 <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>
13655
13656 !! html/parsoid
13657 <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>
13658 !! end
13659
13660 !! test
13661 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13662 !! options
13663 parsoid=wt2html,wt2wt,html2html
13664 !! wikitext
13665 [[File:Foobar.jpg|thumb|2000px]]
13666
13667 [[File:Foobar.svg|thumb|2000px]]
13668 !! html/php
13669 <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>
13670 <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>
13671
13672 !! html/parsoid
13673 <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>
13674 <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>
13675 !! end
13676
13677 !! test
13678 Image: frameless can reduce in size
13679 !! options
13680 parsoid=wt2html,wt2wt,html2html
13681 !! wikitext
13682 [[File:Foobar.jpg|frameless|50px]]
13683 !! html/php
13684 <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>
13685 </p>
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 Image: bitmap frameless can't be enlarged past original size, but vector can
13692 !! options
13693 parsoid=wt2html,wt2wt,html2html
13694 !! wikitext
13695 [[File:Foobar.jpg|frameless|2000px]]
13696
13697 [[File:Foobar.svg|frameless|2000px]]
13698 !! html/php
13699 <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>
13700 </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>
13701 </p>
13702 !! html/parsoid
13703 <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>
13704 <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>
13705 !! end
13706
13707 !! test
13708 Image: framed images are always unscaled.
13709 !! options
13710 parsoid=wt2html,wt2wt,html2html
13711 !! wikitext
13712 [[File:Foobar.jpg|frame]]
13713
13714 [[File:Foobar.jpg|frame|50px]]
13715
13716 [[File:Foobar.jpg|frame|50x50px]]
13717
13718 [[File:Foobar.jpg|frame|2000px]]
13719 !! html/php
13720 <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>
13721 <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>
13722 <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>
13723 <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>
13724
13725 !! html/parsoid
13726 <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>
13727 <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>
13728 <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>
13729 <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>
13730 !! end
13731
13732 ###################
13733
13734 !! test
13735 Link to image page- image page normally doesn't exists, hence edit link
13736 Add test with existing image page
13737 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13738 !! wikitext
13739 [[:Image:test]]
13740 !! html
13741 <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>
13742 </p>
13743 !! end
13744
13745 !! test
13746 bug 18784 Link to non-existent image page with caption should use caption as link text
13747 !! wikitext
13748 [[:Image:test|caption]]
13749 !! html
13750 <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>
13751 </p>
13752 !! end
13753
13754 !! test
13755 Frameless image caption with a free URL
13756 !! wikitext
13757 [[File:Foobar.jpg|http://example.com]]
13758 !! html/php
13759 <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>
13760 </p>
13761 !! html/parsoid
13762 <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>
13763 !! end
13764
13765 !! test
13766 Thumbnail image caption with a free URL
13767 !! options
13768 thumbsize=220
13769 !! wikitext
13770 [[File:Foobar.jpg|thumb|http://example.com]]
13771 !! html/php
13772 <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>
13773
13774 !! html/parsoid
13775 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13776 !! end
13777
13778 !! test
13779 Thumbnail image caption with a free URL and explicit alt
13780 !! options
13781 thumbsize=220
13782 parsoid=wt2html,wt2wt,html2html
13783 !! wikitext
13784 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13785 !! html/php
13786 <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>
13787
13788 !! html/parsoid
13789 <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>
13790 !! end
13791
13792 !! test
13793 SVG thumbnails with no language set
13794 !! options
13795 !! wikitext
13796 [[File:Foobar.svg|thumb|caption]]
13797 !! html/php
13798 <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>
13799
13800 !! html/parsoid
13801 <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>
13802 !! end
13803
13804 !! test
13805 SVG thumbnails with language de
13806 !! options
13807 parsoid=wt2html,wt2wt,html2html
13808 !! wikitext
13809 [[File:Foobar.svg|thumb|caption|lang=de]]
13810 !! html/php
13811 <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>
13812
13813 !! html/parsoid
13814 <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>
13815 !! end
13816
13817 !! test
13818 SVG thumbnails with invalid language code
13819 !! options
13820 parsoid=wt2html,wt2wt,html2html
13821 !! wikitext
13822 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13823 !! html/php
13824 <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>
13825
13826 !! html/parsoid
13827 <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>
13828 !! end
13829
13830 !! test
13831 BUG 1887: A ISBN with a thumbnail
13832 !! wikitext
13833 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13834 !! html/php
13835 <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>
13836
13837 !! html/parsoid
13838 <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>
13839 !! end
13840
13841 !! test
13842 BUG 1887: A RFC with a thumbnail
13843 !! wikitext
13844 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13845 !! html/php
13846 <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>
13847
13848 !! html/parsoid
13849 <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>
13850 !! end
13851
13852 !! test
13853 BUG 1887: A mailto link with a thumbnail
13854 !! wikitext
13855 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13856 !! html/php
13857 <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>
13858
13859 !! html/parsoid
13860 <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>
13861 !! end
13862
13863 # Pending resolution to bug 368
13864 !! test
13865 BUG 648: Frameless image caption with a link
13866 !! wikitext
13867 [[File:Foobar.jpg|text with a [[link]] in it]]
13868 !! html/php
13869 <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>
13870 </p>
13871 !! html/parsoid
13872 <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>
13873 !! end
13874
13875 !! test
13876 BUG 648: Frameless image caption with a link (suffix)
13877 !! wikitext
13878 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13879 !! html/php
13880 <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>
13881 </p>
13882 !! html/parsoid
13883 <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>
13884 !! end
13885
13886 !! test
13887 BUG 648: Frameless image caption with an interwiki link
13888 !! wikitext
13889 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13890 !! html/php
13891 <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>
13892 </p>
13893 !! html/parsoid
13894 <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>
13895 !! end
13896
13897 !! test
13898 BUG 648: Frameless image caption with a piped interwiki link
13899 !! wikitext
13900 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13901 !! html/php
13902 <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>
13903 </p>
13904 !! html/parsoid
13905 <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>
13906 !! end
13907
13908 !! test
13909 T107474: Frameless image caption with <nowiki>
13910 !! wikitext
13911 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13912 !! html/parsoid
13913 <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>
13914 !! end
13915
13916 !! test
13917 Escape HTML special chars in image alt text
13918 !! wikitext
13919 [[File:Foobar.jpg|& < > "]]
13920 !! html/php
13921 <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>
13922 </p>
13923 !! html/parsoid
13924 <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>
13925 !! end
13926
13927 !! test
13928 BUG 499: Alt text should have &#1234;, not &amp;1234;
13929 !! wikitext
13930 [[File:Foobar.jpg|&#9792;]]
13931 !! html/php
13932 <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>
13933 </p>
13934 !! html/parsoid
13935 <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>
13936 !! end
13937
13938 !! test
13939 Broken image caption with link
13940 !! options
13941 parsoid=wt2html,wt2wt,html2html
13942 !! wikitext
13943 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13944 !! html/php
13945 <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.
13946 </p>
13947 !! html/parsoid
13948 <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>
13949 !! end
13950
13951 !! test
13952 Image caption containing another image
13953 !! wikitext
13954 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13955 !! html/php
13956 <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>
13957
13958 !! html/parsoid
13959 <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>
13960 !! end
13961
13962 !! test
13963 Image: caption containing a newline
13964 !! wikitext
13965 [[File:Foobar.jpg|This
13966 *is some text]]
13967 !! html/php
13968 <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>
13969 </p>
13970 !! html/parsoid
13971 <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>
13972 !!end
13973
13974 !!test
13975 Image: caption containing leading space
13976 (The leading space should not trigger nowiki escaping in wt2wt mode)
13977 !! wikitext
13978 [[File:Foobar.jpg|thumb| bar]]
13979 !! html/php
13980 <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>
13981
13982 !! html/parsoid
13983 <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>
13984 !!end
13985
13986 !! test
13987 Image: caption containing a table
13988 !! options
13989 parsoid=wt2html,wt2wt,html2html
13990 !! wikitext
13991 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13992 {|
13993 ! Foo !! Bar
13994 |-
13995 | Foo1 || Bar1
13996 |}
13997 and some more text.]]
13998 !! html/php
13999 <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>
14000
14001 !! html/parsoid
14002 <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
14003 <table>
14004 <tbody>
14005 <tr><th>Foo </th><th>Bar</th></tr>
14006 <tr>
14007 <td>Foo1 </td>
14008 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14009 !! end
14010
14011 !! test
14012 Bug 3090: External links other than http: in image captions
14013 !! wikitext
14014 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14015 !! html/php
14016 <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>
14017
14018 !! html/parsoid
14019 <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>
14020 !! end
14021
14022 !! test
14023 Custom class
14024 !! options
14025 parsoid=wt2html,wt2wt,html2html
14026 !! wikitext
14027 [[Image:foobar.jpg|a|class=b]]
14028 !! html/php
14029 <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>
14030 </p>
14031 !! html/parsoid
14032 <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>
14033 !! end
14034
14035 !! test
14036 Localized image handling (1).
14037 !! options
14038 parsoid=wt2html,wt2wt,html2html
14039 language=es
14040 !! wikitext
14041 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14042 !! html/php
14043 <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>
14044
14045 !! html/parsoid
14046 <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>
14047 !! end
14048
14049 !! test
14050 Localized image handling (2).
14051 !! options
14052 thumbsize=220
14053 parsoid=wt2html,wt2wt,html2html
14054 language=es
14055 !! wikitext
14056 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14057 !! html/php
14058 <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>
14059
14060 !! html/parsoid
14061 <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>
14062 !! end
14063
14064 !! test
14065 Localized image handling (3).
14066 !! options
14067 language=fa
14068 parsoid=html2wt
14069 !! html/parsoid
14070 <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>
14071 !! wikitext
14072 [[File:Foobar.jpg|بندانگشتی]]
14073 !! end
14074
14075 !! test
14076 "border", "frameless" and "class" attributes on an image.
14077 !! options
14078 thumbsize=220
14079 parsoid=wt2html,wt2wt,html2html
14080 !! wikitext
14081 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14082 !! html/php
14083 <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>
14084 </p>
14085 !! html/parsoid
14086 <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>
14087 !! end
14088
14089 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14090 !! test
14091 Invalid image attributes (bug 62500)
14092 !! options
14093 thumbsize=220
14094 parsoid=wt2html,wt2wt,html2html
14095 !! wikitext
14096 [[File:Foobar.jpg|thumb|float|left|caption]]
14097
14098 [[File:Foobar.jpg|thumb|righ|caption]]
14099
14100 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14101 !! html/php
14102 <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>
14103 <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>
14104 <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>
14105
14106 !! html/parsoid
14107 <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>
14108 <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>
14109 <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>
14110 !! end
14111
14112 !! article
14113 File:Barfoo.jpg
14114 !! text
14115 #REDIRECT [[File:Barfoo.jpg]]
14116 !! endarticle
14117
14118 # FIXME: Parsoid should run this test -- but we'd need to teach the
14119 # mockAPI about the redirected Barfoo.jpg image.
14120 !! test
14121 Redirected image
14122 !! wikitext
14123 [[Image:Barfoo.jpg]]
14124 !! html/php
14125 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14126 </p>
14127 !! end
14128
14129 !! test
14130 Missing image with uploads disabled
14131 !! options
14132 wgEnableUploads=0
14133 !! wikitext
14134 [[File:Foobaz.jpg]]
14135 !! html/php
14136 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14137 </p>
14138 !! html/parsoid
14139 <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>
14140 !! end
14141
14142 # Parsoid-specific testing for images
14143 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14144 # Currently imperfect due to a flaw in the Parsoid testrunner
14145 # Work in progress
14146 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14147 # image tests.
14148
14149 !! test
14150 Parsoid-specific image handling - simple image with size and middle alignment
14151 !! wikitext
14152 [[File:Foobar.jpg|middle|50px]]
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 !! test
14158 Parsoid-specific image handling - simple image with size, middle alignment,
14159 non-standard namespace alias
14160 !! options
14161 parsoid=wt2wt,wt2html,html2html
14162 !! wikitext
14163 [[Image:Foobar.jpg|middle|50px]]
14164 !! html/parsoid
14165 <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>
14166 !! end
14167
14168 !! test
14169 Parsoid-specific image handling - simple image with size and middle alignment
14170 (existing content)
14171 !! wikitext
14172 [[File:Foobar.jpg|50px|middle]]
14173 !! html/parsoid
14174 <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>
14175 !! end
14176
14177 !! test
14178 Parsoid-specific image handling - simple image with size and middle alignment
14179 and non-standard namespace name
14180 !! options
14181 parsoid=wt2html,wt2wt,html2html
14182 !! wikitext
14183 [[Image:Foobar.jpg|50px|middle]]
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 both sizes, a baseline alignment, and a caption
14190 !! wikitext
14191 [[File:Foobar.jpg|500x10px|baseline|caption]]
14192 !! html/parsoid
14193 <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>
14194 !! end
14195
14196 !! test
14197 Parsoid-specific image handling - simple image with border and size spec
14198 !! wikitext
14199 [[File:Foobar.jpg|50px|border|caption]]
14200 !! html/parsoid
14201 <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>
14202 !! end
14203
14204 !! test
14205 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14206 !! wikitext
14207 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14208 !! html/parsoid
14209 <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>
14210 !! end
14211
14212 !! test
14213 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14214 (existing content)
14215 !! wikitext
14216 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14217 !! html/parsoid
14218 <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>
14219 !! end
14220
14221 !! test
14222 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14223 !! wikitext
14224 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14225 !! html/parsoid
14226 <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>
14227 !! end
14228
14229 !! test
14230 Parsoid-specific image handling - thumbnail with specific size, halign,
14231 valign, and caption (existing content)
14232 !! wikitext
14233 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14234 !! html/parsoid
14235 <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>
14236 !! end
14237
14238 !! test
14239 Parsoid-specific image handling - framed image with specific size and caption
14240 (size is ignored)
14241 !! options
14242 parsoid=wt2html,wt2wt,html2html
14243 !! wikitext
14244 [[File:Foobar.jpg|frame|500x50px|caption]]
14245 !! html/parsoid
14246 <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>
14247 !! end
14248
14249 !! test
14250 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14251 (size is ignored)
14252 !! options
14253 parsoid=wt2html,wt2wt,html2html
14254 !! wikitext
14255 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14256 !! html/parsoid
14257 <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>
14258 !! end
14259
14260 !! test
14261 Parsoid-specific image handling - frameless image with specific size, border, and caption
14262 !! wikitext
14263 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14264 !! html/parsoid
14265 <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>
14266 !! end
14267
14268 !! test
14269 Parsoid-specific image handling - simple image with a formatted caption
14270 !! wikitext
14271 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14272 !! html/parsoid
14273 <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>
14274 !! end
14275
14276 !! test
14277 Parsoid-specific image handling - caption with a template in it
14278 !! wikitext
14279 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14280 !! html/parsoid
14281 <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>
14282 !! end
14283
14284 !! test
14285 Parsoid-specific image handling - caption with unbalanced tags in it
14286 !! options
14287 parsoid=wt2html,wt2wt,html2html
14288 !! wikitext
14289 foo
14290 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14291 bar
14292 !! html/parsoid
14293 <p>foo</p>
14294 <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>
14295 <p>bar</p>
14296 !! end
14297
14298 !! test
14299 Parsoid-specific image handling - empty caption (1)
14300 !! options
14301 parsoid=wt2html,wt2wt
14302 !! wikitext
14303 [[File:Foobar.jpg|thumb|]]
14304 !! html/parsoid
14305 <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>
14306 !! end
14307
14308 # empty captions don't get serialized unless we're in the "round trip" case
14309 !! test
14310 Parsoid-specific image handling - empty caption (2)
14311 !! options
14312 parsoid=html2wt
14313 !! html/parsoid
14314 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14315 <a href="./File:Foobar.jpg">
14316 <img resource="./File:Foobar.jpg"
14317 src="//example.com/images/3/3a/Foobar.jpg"
14318 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14319 height="25" width="220"/>
14320 </a>
14321 <figcaption></figcaption>
14322 </figure>
14323 !! wikitext
14324 [[File:Foobar.jpg|thumb]]
14325 !! end
14326
14327 !! test
14328 Parsoid-specific image handling - whitespace caption
14329 !! wikitext
14330 [[File:Foobar.jpg|thumb| ]]
14331 !! html/parsoid
14332 <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>
14333 !! end
14334
14335 !! test
14336 Parsoid-specific image handling - lang option
14337 !! wikitext
14338 foo
14339 [[File:Foobar.svg|lang=de|caption]]
14340 bar
14341 !! html/parsoid
14342 <p>foo
14343 <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>
14344 bar</p>
14345 !! end
14346
14347 ## Edge case bugs in Parsoid from T93580
14348 !! test
14349 T93580: 1. Templated <ref> inside block images
14350 !! wikitext
14351 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14352
14353 <references />
14354 !! html/parsoid
14355 <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>
14356
14357 <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>
14358 !! end
14359
14360 !! test
14361 T93580: 2. <ref> inside inline images
14362 !! wikitext
14363 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14364
14365 <references />
14366 !! html/parsoid
14367 <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>
14368
14369 <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>
14370 !! end
14371
14372 !! test
14373 T93580: 3. Templated <ref> inside inline images
14374 !! wikitext
14375 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14376
14377 <references />
14378 !! html/parsoid
14379 <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>
14380
14381 <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>
14382 !! end
14383
14384 ###
14385 ### Subpages
14386 ###
14387 !! article
14388 Subpage test/subpage
14389 !! text
14390 foo
14391 !! endarticle
14392
14393 !! test
14394 Subpage link
14395 !! options
14396 subpage title=[[Subpage test]]
14397 !! wikitext
14398 [[/subpage]]
14399 !! html
14400 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14401 </p>
14402 !! end
14403
14404 !! test
14405 Subpage noslash link
14406 !! options
14407 subpage title=[[Subpage test]]
14408 !! wikitext
14409 [[/subpage/]]
14410 !! html
14411 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14412 </p>
14413 !! end
14414
14415 !! article
14416 Subpage test/1/2/subpage
14417 !! text
14418 blah
14419 !! endarticle
14420
14421 !! test
14422 Relative subpage noslash link
14423 !! options
14424 parsoid=wt2wt,wt2html,html2html
14425 subpage title=[[Subpage test/1/2/3/4]]
14426 !! wikitext
14427 [[../../subpage/]]
14428
14429 [[../../subpage]]
14430 !! html/php
14431 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14432 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14433 </p>
14434 !! html/parsoid
14435 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14436 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14437 !! end
14438
14439 !! test
14440 Parsoid: dot-slash prefixed wikilinks
14441 !! wikitext
14442 [[./foo]]
14443
14444 [[././bar]]
14445
14446 [[././baz/]]
14447 !! html/php
14448 <p>[[./foo]]
14449 </p><p>[[././bar]]
14450 </p><p>[[././baz/]]
14451 </p>
14452 !! html/parsoid
14453 <p>[[./foo]]
14454 </p><p>[[././bar]]
14455 </p><p>[[././baz/]]
14456 </p>
14457 !! end
14458
14459 !! test
14460 Render invalid page names as plain text (bug 51090)
14461 !! wikitext
14462 [[./../foo|bar]]
14463 [[foo�|bar]]
14464 [[foo/.|bar]]
14465 [[foo/..|bar]]
14466 [[foo~~~bar]]
14467 [[foo>bar]]
14468 [[foo[bar]]
14469 [[.]]
14470 [[..]]
14471 [[foo././bar]]
14472
14473 [[{{echo|./../foo}}|bar]]
14474 [[{{echo|foo/.}}|bar]]
14475 [[{{echo|foo/..}}|bar]]
14476 [[{{echo|foo~~~~bar}}]]
14477 [[{{echo|foo>bar}}]]
14478 [[{{echo|foo././bar}}]]
14479 [[{{echo|foo{bar}}]]
14480 [[{{echo|foo}bar}}]]
14481 [[{{echo|foo[bar}}]]
14482 [[{{echo|foo]bar}}]]
14483 [[{{echo|foo<bar}}]]
14484 !!html/php
14485 <p>[[./../foo|bar]]
14486 [[foo�|bar]]
14487 [[foo/.|bar]]
14488 [[foo/..|bar]]
14489 [[foo~~~bar]]
14490 [[foo&gt;bar]]
14491 [[foo[bar]]
14492 [[.]]
14493 [[..]]
14494 [[foo././bar]]
14495 </p><p>[[./../foo|bar]]
14496 [[foo/.|bar]]
14497 [[foo/..|bar]]
14498 [[foo~~~~bar]]
14499 [[foo&gt;bar]]
14500 [[foo././bar]]
14501 [[foo{bar]]
14502 [[foo}bar]]
14503 [[foo[bar]]
14504 [[foo]bar]]
14505 [[foo&lt;bar]]
14506 </p>
14507 !!html/parsoid
14508 <p>[[./../foo|bar]]
14509 [[foo�|bar]]
14510 [[foo/.|bar]]
14511 [[foo/..|bar]]
14512 [[foo~~~bar]]
14513 [[foo>bar]]
14514 [[foo[bar]]
14515 [[.]]
14516 [[..]]
14517 [[foo././bar]]</p>
14518
14519 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14520 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14521 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14522 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14523 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14524 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14525 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14526 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14527 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14528 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14529 [[<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>
14530 !!end
14531
14532 !! test
14533 Disabled subpages
14534 !! wikitext
14535 [[/subpage]]
14536 !! html
14537 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14538 </p>
14539 !! end
14540
14541 !! test
14542 BUG 561: {{/Subpage}}
14543 !! options
14544 subpage title=[[Page]]
14545 !! wikitext
14546 {{/Subpage}}
14547 !! html
14548 <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>
14549 </p>
14550 !! end
14551
14552 ###
14553 ### Categories
14554 ###
14555 !! article
14556 Category:MediaWiki User's Guide
14557 !! text
14558 blah
14559 !! endarticle
14560
14561 !! test
14562 Link to category
14563 !! wikitext
14564 [[:Category:MediaWiki User's Guide]]
14565 !! html
14566 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14567 </p>
14568 !! end
14569
14570 !! test
14571 Simple category
14572 !! options
14573 cat
14574 !! wikitext
14575 [[Category:MediaWiki User's Guide]]
14576 !! html
14577 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14578 !! end
14579
14580 !! test
14581 PAGESINCATEGORY invalid title fatal (r33546 fix)
14582 !! wikitext
14583 {{PAGESINCATEGORY:<bogus>}}
14584 !! html
14585 <p>0
14586 </p>
14587 !! end
14588
14589 !! test
14590 Category with different sort key
14591 !! options
14592 cat
14593 !! wikitext
14594 [[Category:MediaWiki User's Guide|Foo]]
14595 !! html
14596 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14597 !! end
14598
14599 !! test
14600 Category with identical sort key
14601 !! options
14602 cat
14603 !! wikitext
14604 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14605 !! html
14606 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14607 !! end
14608
14609 !! test
14610 Category with empty sort key
14611 !! options
14612 cat
14613 pst
14614 !! wikitext
14615 [[Category:MediaWiki User's Guide|]]
14616 !! html/php
14617 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14618 !! end
14619
14620 !! test
14621 Category with empty sort key and parentheses
14622 !! options
14623 cat
14624 pst
14625 !! wikitext
14626 [[Category:Foo (bar)|]]
14627 !! html/php
14628 [[Category:Foo (bar)|Foo]]
14629 !! end
14630
14631 ## We used to, but no longer wt2wt this test since the default serializer
14632 ## will normalize all categories to serialize on their own line.
14633 ## This wikitext usage is going to be fairly uncommon in production and
14634 ## selser will take care of preserving formatting in those scenarios.
14635 !! test
14636 Category with link tail
14637 !! options
14638 cat
14639 pst
14640 parsoid=wt2html
14641 !! wikitext
14642 123[[Category:Foo]]456
14643 !! html/php
14644 123[[Category:Foo]]456
14645 !! html/parsoid
14646 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14647 !! end
14648
14649 !! test
14650 Category with template
14651 !! options
14652 cat
14653 pst
14654 !! wikitext
14655 [[Category:{{echo|Foo}}]]
14656 !! html/php
14657 [[Category:{{echo|Foo}}]]
14658 !! end
14659
14660 !! test
14661 Category with template in sort key
14662 !! options
14663 cat
14664 pst
14665 !! wikitext
14666 [[Category:Foo|{{echo|Bar}}]]
14667 !! html/php
14668 [[Category:Foo|{{echo|Bar}}]]
14669 !! end
14670
14671 !! test
14672 Category with template in sort key and title
14673 !! options
14674 cat
14675 pst
14676 !! wikitext
14677 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14678 !! html/php
14679 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14680 !! end
14681
14682 ## We used to, but no longer wt2wt this test since the default serializer
14683 ## will normalize all categories to serialize on their own line.
14684 ## This wikitext usage is going to be fairly uncommon in production and
14685 ## selser will take care of preserving formatting in those scenarios.
14686 !! test
14687 Category / paragraph interactions
14688 !! options
14689 parsoid=wt2html
14690 !! wikitext
14691 Foo [[Category:Baz]] Bar
14692
14693 Foo [[Category:Baz]]
14694 Bar
14695
14696 Foo
14697 [[Category:Baz]]
14698 Bar
14699
14700 Foo
14701 [[Category:Baz]] Bar
14702
14703 Foo
14704 [[Category:Baz]]
14705 [[Category:Baz]]
14706 [[Category:Baz]]
14707 Bar
14708
14709 [[Category:Baz]]
14710 [[Category:Baz]]
14711 [[Category:Baz]]
14712
14713 [[Category:Baz]]
14714 {{echo|[[Category:Baz]]}}
14715 [[Category:Baz]]
14716 !! html/php
14717 <p>Foo Bar
14718 </p><p>Foo
14719 Bar
14720 </p><p>Foo
14721 Bar
14722 </p><p>Foo Bar
14723 </p><p>Foo
14724 Bar
14725 </p>
14726 !! html/parsoid
14727 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14728 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14729 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14730 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14731 <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>
14732 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14733 !! end
14734
14735 ## We used to, but no longer wt2wt this test since the default serializer
14736 ## will normalize all categories to serialize on their own line.
14737 ## This wikitext usage is going to be fairly uncommon in production and
14738 ## selser will take care of preserving formatting in those scenarios.
14739 ##
14740 ## The whitespace on the empty line is part of the test. Please do not delete
14741 !! test
14742 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14743 !! options
14744 parsoid=wt2html
14745 !! wikitext
14746 This
14747
14748 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14749
14750 {{echo|[[Category:Foo]] and so should this!}}
14751 !! html/php
14752 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14753 </p>
14754 !! html/parsoid
14755 <p>This
14756
14757 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14758
14759 <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>
14760 !! end
14761
14762 ## Parsoid will not try to wt2wt this while preserving newlines because
14763 ## it suppresses excess newlines within list items -- and we don't want to
14764 ## introduce a special case just for categories, which is, in reality somewhat
14765 ## odd behavior -- categories are unlikely to be used in list items like this
14766 ## in top-level pages and are only likely to show up in template-generated
14767 ## list items where this RT-ing is a non-issue.
14768 ##
14769 ## The whitespace on the empty line is part of the test. Please do not delete
14770 !! test
14771 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14772 !! options
14773 parsoid=wt2html
14774 !! wikitext
14775 * This
14776
14777 [[Category:Foo]] and this should be part of the same list item
14778 * So should this
14779
14780 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14781 !! html
14782 <ul><li>This and this should be part of the same list item</li>
14783 <li>So should this and this should be part of the same list item</li></ul>
14784 !! html/parsoid
14785 <ul>
14786 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14787 <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>
14788 </ul>
14789 !! end
14790
14791 ## Newlines and categories that follow the last item of a list
14792 ## are treated differently because this (list followed by categories)
14793 ## is an extremely common pattern on wikis.
14794 !! test
14795 3. Categories and newlines: newline suppression for last list item should RT properly
14796 !! wikitext
14797 * a
14798 * b
14799
14800 [[Category:Foo]]
14801
14802 [[Category:Bar]]
14803 [[Category:Baz]]
14804 !! html/parsoid
14805 <ul><li> a</li>
14806 <li> b</li></ul>
14807
14808 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14809
14810 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14811 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14812 !! end
14813
14814 !! test
14815 4. Categories and newlines: newline suppression for last list item should RT properly
14816 !! wikitext
14817 * a
14818 **** b
14819
14820 [[Category:Foo]]
14821 !! html/parsoid
14822 <ul><li> a
14823 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14824
14825 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14826 !! end
14827
14828 ## only wt2html for this to make sure the algo only applies to the rightmost path
14829 !! test
14830 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14831 !! options
14832 parsoid=wt2html
14833 !! wikitext
14834 * a
14835 ** b
14836 [[Category:Foo]]
14837 * c
14838 ** d
14839 [[Category:Foo]]
14840 !! html/parsoid
14841 <ul><li> a
14842 <ul><li> b
14843 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14844 <li> c
14845 <ul><li> d</li></ul></li></ul>
14846 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14847 !! end
14848
14849 ## We used to, but no longer wt2wt this test since the default serializer
14850 ## will normalize all categories to serialize on their own line.
14851 ## This wikitext usage is going to be fairly uncommon in production and
14852 ## selser will take care of preserving formatting in those scenarios.
14853 !! test
14854 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14855 !! options
14856 parsoid=wt2html
14857 !! wikitext
14858 * a [[Category:Foo]]
14859 !! html/parsoid
14860 <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>
14861 !! end
14862
14863 # This test also demonstrates because of newline+category tunneling
14864 # through the list hander, template wrapping doesn't expand to the
14865 # containing list when the list item swallows the category.
14866 !! test
14867 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14868 !! wikitext
14869 * {{echo|a
14870 [[Category:Foo]]}}
14871 !! html/parsoid
14872 <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
14873 </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>
14874 !! end
14875
14876 !! test
14877 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14878 !! wikitext
14879 * a
14880
14881 {{echo|[[Category:Foo]]
14882 [[Category:Bar]]}}
14883 [[Category:Baz]]
14884 !! html/parsoid
14885 <ul><li> a</li></ul>
14886
14887 <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">
14888 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14889 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14890 !! end
14891
14892 !! test
14893 Parsoid: Serialize link to category page with colon escape
14894 !! options
14895 parsoid
14896 !! wikitext
14897
14898 [[:Category:Foo]]
14899 [[:Category:Foo|Bar]]
14900 !! html
14901 <p>
14902 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14903 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14904 </p>
14905 !! end
14906
14907 # We used to, but no longer wt2wt this test since the default serializer
14908 # will normalize all categories to serialize on their own line.
14909 # This wikitext usage is going to be fairly uncommon in production and
14910 # selser will take care of preventing whitespace insertion if this
14911 # occurs in an article.
14912 #
14913 # html2html disabled for the same reason (whitespace insertion between
14914 # x and y).
14915 #
14916 # html2wt disabled because it localizes the "Category" namespace.
14917 !! test
14918 Link prefix/suffixes aren't applied to category links
14919 !! options
14920 parsoid=wt2html
14921 language=is
14922 !! wikitext
14923 x[[Category:Foo]]y
14924 !! html/php
14925 <p>xy
14926 </p>
14927 !! html/parsoid
14928 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14929 !! end
14930
14931 !! test
14932 Parsoid: Serialize link to file page with colon escape
14933 !! options
14934 parsoid
14935 !! wikitext
14936
14937 [[:File:Foo.png]]
14938 [[:File:Foo.png|Bar]]
14939 !! html
14940 <p>
14941 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14942 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14943 </p>
14944 !! end
14945
14946 !! test
14947 Parsoid: Serialize a genuine category link without colon escape
14948 !! options
14949 parsoid
14950 !! wikitext
14951 [[Category:Foo]]
14952 [[Category:Foo|Bar]]
14953 !! html
14954 <link rel="mw:PageProp/Category" href="./Category:Foo">
14955 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14956 !! end
14957
14958 !! test
14959 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14960 !! options
14961 parsoid=html2wt
14962 !! html/parsoid
14963 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14964 !! wikitext
14965 [[Category:Toxine bactérienne]]
14966 !! end
14967
14968 !! test
14969 Parsoid: Defaultsort
14970 !! wikitext
14971 {{DEFAULTSORT:Foo}}
14972 !! html/parsoid
14973 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14974 !! end
14975
14976 !! test
14977 Parsoid: Defaultsort (template-generated)
14978 !! wikitext
14979 {{{{echo|DEFAULTSORT}}:Foo}}
14980 !! html/parsoid
14981 <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}}]}'/>
14982 !! end
14983
14984 ###
14985 ### Inter-language links
14986 ###
14987 !! test
14988 Interlanguage links
14989 !! options
14990 ill
14991 !! wikitext
14992 [[es:Alimento]]
14993 [[fr:Nourriture]]
14994 [[zh:食品]]
14995 !! html/php
14996 es:Alimento fr:Nourriture zh:食品
14997 !! html/parsoid
14998 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14999 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15000 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15001 !! end
15002
15003 !! test
15004 Duplicate interlanguage links (bug 24502)
15005 !! options
15006 ill
15007 !! wikitext
15008 [[es:1]]
15009 [[es:2]]
15010 [[fr:1]]
15011 [[fr:2]]
15012 !! html/php
15013 es:1 fr:1
15014 !! html/parsoid
15015 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15016 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15017 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15018 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15019 !! end
15020
15021 ###
15022 ### Sections
15023 ###
15024 !! test
15025 Basic section headings
15026 !! wikitext
15027 == Headline 1 ==
15028 Some text
15029
15030 ==Headline 2==
15031 More
15032 ===Smaller headline===
15033 Blah blah
15034 !! html
15035 <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>
15036 <p>Some text
15037 </p>
15038 <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>
15039 <p>More
15040 </p>
15041 <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>
15042 <p>Blah blah
15043 </p>
15044 !! end
15045
15046 !! test
15047 Section headings with TOC
15048 !! wikitext
15049 == Headline 1 ==
15050 === Subheadline 1 ===
15051 ===== Skipping a level =====
15052 ====== Skipping a level ======
15053
15054 == Headline 2 ==
15055 Some text
15056 ===Another headline===
15057 !! html
15058 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15059 <ul>
15060 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15061 <ul>
15062 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15063 <ul>
15064 <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>
15065 <ul>
15066 <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>
15067 </ul>
15068 </li>
15069 </ul>
15070 </li>
15071 </ul>
15072 </li>
15073 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15074 <ul>
15075 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15076 </ul>
15077 </li>
15078 </ul>
15079 </div>
15080
15081 <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>
15082 <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>
15083 <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>
15084 <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>
15085 <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>
15086 <p>Some text
15087 </p>
15088 <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>
15089
15090 !! end
15091
15092 !! test
15093 TOC anchors don't collide
15094 !! wikitext
15095 __FORCETOC__
15096 == Headline 2 ==
15097 == Headline ==
15098 == Headline 2 ==
15099 == Headline ==
15100 !! html/php
15101 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15102 <ul>
15103 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15104 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15105 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15106 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15107 </ul>
15108 </div>
15109
15110 <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>
15111 <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>
15112 <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>
15113 <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>
15114
15115 !! end
15116
15117 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15118 !! test
15119 Handling of sections up to level 6 and beyond
15120 !! wikitext
15121 = Level 1 Heading=
15122 == Level 2 Heading==
15123 === Level 3 Heading===
15124 ==== Level 4 Heading====
15125 ===== Level 5 Heading=====
15126 ====== Level 6 Heading======
15127 ======= Level 7 Heading=======
15128 ======== Level 8 Heading========
15129 ========= Level 9 Heading=========
15130 ========== Level 10 Heading==========
15131 !! html
15132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15133 <ul>
15134 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15135 <ul>
15136 <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>
15137 <ul>
15138 <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>
15139 <ul>
15140 <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>
15141 <ul>
15142 <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>
15143 <ul>
15144 <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>
15145 <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>
15146 <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>
15147 <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>
15148 <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>
15149 </ul>
15150 </li>
15151 </ul>
15152 </li>
15153 </ul>
15154 </li>
15155 </ul>
15156 </li>
15157 </ul>
15158 </li>
15159 </ul>
15160 </div>
15161
15162 <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>
15163 <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>
15164 <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>
15165 <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>
15166 <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>
15167 <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>
15168 <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>
15169 <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>
15170 <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>
15171 <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>
15172
15173 !! end
15174
15175 !! test
15176 TOC regression (T11764)
15177 !! wikitext
15178 == title 1 ==
15179 === title 1.1 ===
15180 ==== title 1.1.1 ====
15181 === title 1.2 ===
15182 == title 2 ==
15183 === title 2.1 ===
15184 !! html
15185 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15186 <ul>
15187 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15188 <ul>
15189 <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>
15190 <ul>
15191 <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>
15192 </ul>
15193 </li>
15194 <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>
15195 </ul>
15196 </li>
15197 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15198 <ul>
15199 <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>
15200 </ul>
15201 </li>
15202 </ul>
15203 </div>
15204
15205 <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>
15206 <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>
15207 <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>
15208 <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>
15209 <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>
15210 <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>
15211
15212 !! end
15213
15214 !! test
15215 TOC for heading containing <span id="..."></span> (T96153)
15216 !! wikitext
15217 __FORCETOC__
15218 ==<span id="old-anchor"></span>New title==
15219 !! html/php
15220 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15221 <ul>
15222 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15223 </ul>
15224 </div>
15225
15226 <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>
15227
15228 !! end
15229
15230 !! test
15231 TOC with wgMaxTocLevel=3 (bug 6204)
15232 !! options
15233 wgMaxTocLevel=3
15234 !! wikitext
15235 == title 1 ==
15236 === title 1.1 ===
15237 ==== title 1.1.1 ====
15238 === title 1.2 ===
15239 == title 2 ==
15240 === title 2.1 ===
15241 !! html
15242 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15243 <ul>
15244 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15245 <ul>
15246 <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>
15247 <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>
15248 </ul>
15249 </li>
15250 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15251 <ul>
15252 <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>
15253 </ul>
15254 </li>
15255 </ul>
15256 </div>
15257
15258 <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>
15259 <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>
15260 <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>
15261 <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>
15262 <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>
15263 <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>
15264
15265 !! end
15266
15267 !! test
15268 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15269 !! options
15270 wgMaxTocLevel=3
15271 !! wikitext
15272 ==Section 1==
15273 ===Section 1.1===
15274 ====Section 1.1.1====
15275 ====Section 1.1.1.1====
15276 ==Section 2==
15277 !! html
15278 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15279 <ul>
15280 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15281 <ul>
15282 <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>
15283 </ul>
15284 </li>
15285 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15286 </ul>
15287 </div>
15288
15289 <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>
15290 <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>
15291 <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>
15292 <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>
15293 <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>
15294
15295 !! end
15296
15297
15298 !! test
15299 Resolving duplicate section names
15300 !! wikitext
15301 == Foo bar ==
15302 == Foo bar ==
15303 !! html
15304 <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>
15305 <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>
15306
15307 !! end
15308
15309 !! test
15310 Resolving duplicate section names with differing case (bug 10721)
15311 !! wikitext
15312 == Foo bar ==
15313 == Foo Bar ==
15314 !! html
15315 <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>
15316 <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>
15317
15318 !! end
15319
15320 !! article
15321 Template:sections
15322 !! text
15323 ===Section 1===
15324 ==Section 2==
15325 !! endarticle
15326
15327 !! test
15328 Template with sections, __NOTOC__
15329 !! wikitext
15330 __NOTOC__
15331 ==Section 0==
15332 {{sections}}
15333 ==Section 4==
15334 !! html
15335 <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>
15336 <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>
15337 <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>
15338 <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>
15339
15340 !! end
15341
15342 !! test
15343 __NOEDITSECTION__ keyword
15344 !! wikitext
15345 __NOEDITSECTION__
15346 ==Section 1==
15347 ==Section 2==
15348 !! html
15349 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15350 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15351
15352 !! end
15353
15354 !! test
15355 Link inside a section heading
15356 !! wikitext
15357 ==Section with a [[Main Page|link]] in it==
15358 !! html
15359 <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>
15360
15361 !! end
15362
15363 !! test
15364 TOC regression (T14077)
15365 !! wikitext
15366 __TOC__
15367 == title 1 ==
15368 === title 1.1 ===
15369 == title 2 ==
15370 !! html
15371 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15372 <ul>
15373 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15374 <ul>
15375 <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>
15376 </ul>
15377 </li>
15378 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15379 </ul>
15380 </div>
15381
15382 <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>
15383 <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>
15384 <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>
15385
15386 !! end
15387
15388 !! test
15389 BUG 1219 URL next to image (good)
15390 !! wikitext
15391 http://example.com [[File:Foobar.jpg]]
15392 !! html/php
15393 <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>
15394 </p>
15395 !! html/parsoid
15396 <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>
15397 !!end
15398
15399 !! test
15400 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15401 !! wikitext
15402 ===
15403 The line above must have a trailing space!
15404 === <!--
15405 --> <!-- -->
15406 But just in case it doesn't...
15407 !! html
15408 <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>
15409 <p>The line above must have a trailing space!
15410 </p>
15411 <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>
15412 <p>But just in case it doesn't...
15413 </p>
15414 !! end
15415
15416 !! test
15417 Header with special characters (bug 25462)
15418 !! wikitext
15419 The tooltips shall not show entities to the user (ie. be double escaped)
15420
15421 == text > text ==
15422 section 1
15423
15424 == text < text ==
15425 section 2
15426
15427 == text & text ==
15428 section 3
15429
15430 == text ' text ==
15431 section 4
15432
15433 == text " text ==
15434 section 5
15435 !! html
15436 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15437 </p>
15438 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15439 <ul>
15440 <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>
15441 <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>
15442 <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>
15443 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15444 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15445 </ul>
15446 </div>
15447
15448 <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>
15449 <p>section 1
15450 </p>
15451 <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>
15452 <p>section 2
15453 </p>
15454 <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>
15455 <p>section 3
15456 </p>
15457 <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>
15458 <p>section 4
15459 </p>
15460 <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>
15461 <p>section 5
15462 </p>
15463 !! end
15464
15465 !! test
15466 Header with space, plus and underscore as entity
15467 !! wikitext
15468 Id should not contain + for spaces
15469
15470 == Space between Text ==
15471 section 1
15472
15473 == Space-Entity&#32;between&#32;Text ==
15474 section 2
15475
15476 == Plus+between+Text ==
15477 section 3
15478
15479 == Plus-Entity&#43;between&#43;Text ==
15480 section 4
15481
15482 == Underscore_between_Text ==
15483 section 5
15484
15485 == Underscore-Entity&#95;between&#95;Text ==
15486 section 6
15487
15488 [[#Space between Text]]
15489 [[#Space-Entity&#32;between&#32;Text]]
15490 [[#Plus+between+Text]]
15491 [[#Plus-Entity&#43;between&#43;Text]]
15492 [[#Underscore_between_Text]]
15493 [[#Underscore-Entity&#95;between&#95;Text]]
15494 !! html
15495 <p>Id should not contain + for spaces
15496 </p>
15497 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15498 <ul>
15499 <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>
15500 <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>
15501 <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>
15502 <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>
15503 <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>
15504 <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>
15505 </ul>
15506 </div>
15507
15508 <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>
15509 <p>section 1
15510 </p>
15511 <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>
15512 <p>section 2
15513 </p>
15514 <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>
15515 <p>section 3
15516 </p>
15517 <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>
15518 <p>section 4
15519 </p>
15520 <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>
15521 <p>section 5
15522 </p>
15523 <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>
15524 <p>section 6
15525 </p><p><a href="#Space_between_Text">#Space between Text</a>
15526 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15527 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15528 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15529 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15530 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15531 </p>
15532 !! end
15533
15534 !! test
15535 Headers with excess '=' characters
15536 (Are similar tests necessary beyond the 1st level?)
15537 !! wikitext
15538 =foo==
15539 ==foo=
15540 =''italic'' heading==
15541 ==''italic'' heading=
15542 !! html
15543 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15544 <ul>
15545 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15546 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15547 <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>
15548 <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>
15549 </ul>
15550 </div>
15551
15552 <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>
15553 <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>
15554 <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>
15555 <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>
15556
15557 !! end
15558
15559 !! test
15560 HTML headers vs TOC (bug 23393)
15561 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15562 !! wikitext
15563 <h1>Header 1</h1>
15564 == Header 1.1 ==
15565 == Header 1.2 ==
15566
15567 <h1>Header 2
15568 </h1>
15569 == Header 2.1 ==
15570 == Header 2.2 ==
15571 __NOEDITSECTION__
15572 !! html
15573 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15574 <ul>
15575 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15576 <ul>
15577 <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>
15578 <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>
15579 </ul>
15580 </li>
15581 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15582 <ul>
15583 <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>
15584 <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>
15585 </ul>
15586 </li>
15587 </ul>
15588 </div>
15589
15590 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15591 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15592 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15593 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15594 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15595 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15596
15597 !! end
15598
15599 !! test
15600 Single-line or multiline-comments can follow headings
15601 !! options
15602 parsoid=wt2html,wt2wt
15603 !! wikitext
15604 ==foo==<!---->
15605 ==bar==<!--c1-->
15606 ==baz==<!--
15607 c2
15608 c3-->
15609 !! html
15610 <h2><span class="mw-headline" id="foo">foo</span></h2>
15611 <h2><span class="mw-headline" id="bar">bar</span></h2>
15612 <h2><span class="mw-headline" id="baz">baz</span></h2>
15613
15614 !! end
15615
15616 !! test
15617 BUG 1219 URL next to image (broken)
15618 !! wikitext
15619 http://example.com[[File:Foobar.jpg]]
15620 !! html/php
15621 <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>
15622 </p>
15623 !! html/parsoid
15624 <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>
15625 !!end
15626
15627 !! test
15628 Bug 1186 news: in the middle of text
15629 !! wikitext
15630 http://en.wikinews.org/wiki/Wikinews:Workplace
15631 !! html
15632 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15633 </p>
15634 !!end
15635
15636
15637 !! test
15638 Namespaced link must have a title
15639 !! wikitext
15640 [[Project:]]
15641 !! html
15642 <p>[[Project:]]
15643 </p>
15644 !!end
15645
15646 !! test
15647 Namespaced link must have a title (bad fragment version)
15648 !! wikitext
15649 [[Project:#fragment]]
15650 !! html
15651 <p>[[Project:#fragment]]
15652 </p>
15653 !!end
15654
15655
15656 ###
15657 ### HTML tags and HTML attributes
15658 ###
15659
15660 !! test
15661 div with no attributes
15662 !! wikitext
15663 <div>HTML rocks</div>
15664 !! html
15665 <div>HTML rocks</div>
15666
15667 !! end
15668
15669 !! test
15670 div with double-quoted attribute
15671 !! wikitext
15672 <div id="rock">HTML rocks</div>
15673 !! html
15674 <div id="rock">HTML rocks</div>
15675
15676 !! end
15677
15678 !! test
15679 div with single-quoted attribute
15680 !! wikitext
15681 <div id='rock'>HTML rocks</div>
15682 !! html
15683 <div id="rock">HTML rocks</div>
15684
15685 !! end
15686
15687 !! test
15688 div with unquoted attribute
15689 !! wikitext
15690 <div id=rock>HTML rocks</div>
15691 !! html
15692 <div id="rock">HTML rocks</div>
15693
15694 !! end
15695
15696 !! test
15697 div with illegal double attributes
15698 !! wikitext
15699 <div id="a" id="b">HTML rocks</div>
15700 !! html
15701 <div id="b">HTML rocks</div>
15702
15703 !!end
15704
15705 !! test
15706 div with empty attribute value, space before equals
15707 !! options
15708 parsoid=wt2html,html2html
15709 !! wikitext
15710 <div class =>HTML rocks</div>
15711 !! html/php
15712 <div class="">HTML rocks</div>
15713
15714 !! html/parsoid
15715 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15716 !! end
15717
15718 !! test
15719 div with multiple empty attribute values
15720 !! options
15721 parsoid=wt2html,html2html
15722 !! wikitext
15723 <div id= title=>HTML rocks</div>
15724 !! html/php
15725 <div id="title.3D">HTML rocks</div>
15726
15727 !! html/parsoid
15728 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15729 !! end
15730
15731 !! test
15732 table with multiple empty attribute values
15733 !! options
15734 parsoid=wt2html,html2html
15735 !! wikitext
15736 {| title= id=
15737 | hi
15738 |}
15739 !! html/php
15740 <table title="id=">
15741 <tr>
15742 <td> hi
15743 </td></tr></table>
15744
15745 !! html/parsoid
15746 <table title="id=">
15747 <tbody><tr><td> hi</td></tr>
15748 </tbody></table>
15749 !! end
15750
15751 !! test
15752 div with braces in attribute value
15753 !! wikitext
15754 <div title="{}">Foo</div>
15755 !! html/php
15756 <div title="&#123;}">Foo</div>
15757
15758 !! html/parsoid
15759 <div title="{}">Foo</div>
15760 !! end
15761
15762 !! test
15763 div with empty attribute value, no space before equals
15764 !! options
15765 parsoid=wt2html,html2html
15766 !! wikitext
15767 <div class=>HTML rocks</div>
15768 !! html/php
15769 <div class="">HTML rocks</div>
15770
15771 !! html/parsoid
15772 <div class="">HTML rocks</div>
15773 !! end
15774
15775 !! test
15776 HTML multiple attributes correction
15777 !! wikitext
15778 <p class="error" class="awesome">Awesome!</p>
15779 !! html
15780 <p class="awesome">Awesome!</p>
15781
15782 !!end
15783
15784 !! test
15785 Table multiple attributes correction
15786 !! wikitext
15787 {|
15788 !+ class="error" class="awesome"| status
15789 |}
15790 !! html
15791 <table>
15792 <tr>
15793 <th class="awesome"> status
15794 </th></tr></table>
15795
15796 !!end
15797
15798 !! test
15799 DIV IN UPPERCASE
15800 !! wikitext
15801 <DIV ID="x">HTML ROCKS</DIV>
15802 !! html
15803 <div id="x">HTML ROCKS</div>
15804
15805 !!end
15806
15807 !! test
15808 Non-ASCII pseudo-tags are rendered as text
15809 !! wikitext
15810 <khyô>
15811 !! html
15812 <p>&lt;khyô&gt;
15813 </p>
15814 !! end
15815
15816 !! test
15817 Pseudo-tag with URL 'name' renders as url link
15818 !! wikitext
15819 <http://example.com/>
15820 !! html
15821 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15822 </p>
15823 !! end
15824
15825 !! test
15826 text with amp in the middle of nowhere
15827 !! wikitext
15828 Remember AT&T?
15829 !! html
15830 <p>Remember AT&amp;T?
15831 </p>
15832 !! end
15833
15834 !! test
15835 text with character entity: eacute
15836 !! wikitext
15837 I always thought &eacute; was a cute letter.
15838 !! html
15839 <p>I always thought &#233; was a cute letter.
15840 </p>
15841 !! html+tidy
15842 <p>I always thought é was a cute letter.</p>
15843 !! end
15844
15845 !! test
15846 text with entity-escaped character entity-like string: eacute
15847 !! wikitext
15848 I always thought &amp;eacute; was a cute letter.
15849 !! html
15850 <p>I always thought &amp;eacute; was a cute letter.
15851 </p>
15852 !! end
15853
15854 !! test
15855 text with undefined character entity: xacute
15856 !! wikitext
15857 I always thought &xacute; was a cute letter.
15858 !! html
15859 <p>I always thought &amp;xacute; was a cute letter.
15860 </p>
15861 !! end
15862
15863 !! test
15864 HTML5 tags
15865 !! wikitext
15866 <data value="5">five</data>
15867 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15868 <mark>This highlighted text</mark>
15869 !! html
15870 <p><data value="5">five</data>
15871 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15872 <mark>This highlighted text</mark>
15873 </p>
15874 !! end
15875
15876 !! test
15877 HTML tag with leading space is parsed as text
15878 !! wikitext
15879 < div>foo< /div>
15880 !! html
15881 <p>&lt; div&gt;foo&lt; /div&gt;
15882 </p>
15883 !! end
15884
15885 ###
15886 ### Nesting tests (see bug 41545, 50604, 51081)
15887 ###
15888
15889 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15890 # Note that html2wt is considerably more difficult if we use <b> in
15891 # the test case, instead of <big>
15892 !! test
15893 Ensure that HTML adoption agency algorithm is properly implemented.
15894 !! wikitext
15895 <big>X<big>Y</big>Z</big>
15896 !! html
15897 <p><big>X<big>Y</big>Z</big>
15898 </p>
15899 !! end
15900
15901 # This was bug 41545 in the PHP parser.
15902 # Note that tidy doesn't handle this correctly.
15903 !! test
15904 Nesting of <kbd>
15905 !! wikitext
15906 <kbd>X<kbd>Y</kbd>Z</kbd>
15907 !! html
15908 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15909 </p>
15910 !! end
15911
15912 # The following cases were bug 51081 in the PHP parser.
15913 # Note that there are some other nestable tags (b, i, etc) which are
15914 # not covered; see bug 51081 for discussion.
15915
15916 # Note that tidy doesn't handle this correctly.
15917 !! test
15918 Nesting of <em>
15919 !! wikitext
15920 <em>X<em>Y</em>Z</em>
15921 !! html
15922 <p><em>X<em>Y</em>Z</em>
15923 </p>
15924 !! end
15925
15926 # Note that tidy doesn't handle this correctly.
15927 !! test
15928 Nesting of <strong>
15929 !! wikitext
15930 <strong>X<strong>Y</strong>Z</strong>
15931 !! html
15932 <p><strong>X<strong>Y</strong>Z</strong>
15933 </p>
15934 !! end
15935
15936 !! test
15937 Nesting of <q>
15938 !! wikitext
15939 <q>X<q>Y</q>Z</q>
15940 !! html+tidy
15941 <p><q>X<q>Y</q>Z</q></p>
15942 !! end
15943
15944 # Note that tidy doesn't handle this correctly.
15945 !! test
15946 Nesting of <ruby>
15947 !! wikitext
15948 <ruby>X<ruby>Y</ruby>Z</ruby>
15949 !! html
15950 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15951 </p>
15952 !! end
15953
15954 # Note that tidy doesn't handle this correctly.
15955 !! test
15956 Nesting of <bdo>
15957 !! wikitext
15958 <bdo>X<bdo>Y</bdo>Z</bdo>
15959 !! html
15960 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15961 </p>
15962 !! end
15963
15964
15965 ###
15966 ### Media links
15967 ###
15968
15969 !! test
15970 Media link
15971 !! wikitext
15972 [[Media:Foobar.jpg]]
15973 !! html
15974 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15975 </p>
15976 !! end
15977
15978 !! test
15979 Media link with text
15980 !! wikitext
15981 [[Media:Foobar.jpg|A neat file to look at]]
15982 !! html
15983 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15984 </p>
15985 !! end
15986
15987 # FIXME: this is still bad HTML tag nesting
15988 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15989 !! test
15990 Media link with nasty text
15991 !! wikitext
15992 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15993 !! html
15994 <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>
15995
15996 !! html+tidy
15997 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15998 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15999 !! end
16000
16001 !! test
16002 Media link to nonexistent file (bug 1702)
16003 !! wikitext
16004 [[Media:No such.jpg]]
16005 !! html
16006 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16007 </p>
16008 !! end
16009
16010 !! test
16011 Image link to nonexistent file (bug 1850 - good)
16012 !! wikitext
16013 [[File:No_such.jpg]]
16014 !! html/php
16015 <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>
16016 </p>
16017 !! html/parsoid
16018 <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>
16019 !! end
16020
16021 !! test
16022 :Image link to nonexistent file (bug 1850 - bad)
16023 !! wikitext
16024 [[:Image:No such.jpg]]
16025 !! html/php
16026 <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>
16027 </p>
16028 !! html/parsoid
16029 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16030 !! end
16031
16032
16033
16034 !! test
16035 Character reference normalization in link text (bug 1938)
16036 !! wikitext
16037 [[Main Page|this&that]]
16038 !! html
16039 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16040 </p>
16041 !!end
16042
16043 !! article
16044 אַ
16045 !! text
16046 Test for unicode normalization
16047
16048 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16049 !! endarticle
16050
16051 !! test
16052 (bug 19451) Links should refer to the normalized form.
16053 !! wikitext
16054 [[&#xFB2E;]]
16055 [[&#x5d0;&#x5b7;]]
16056 [[&#x5d0;ַ]]
16057 [[א&#x5b7;]]
16058 [[אַ]]
16059 !! html
16060 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16061 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16062 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16063 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16064 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16065 </p>
16066 !! end
16067
16068 !! test
16069 Empty attribute crash test (bug 2067)
16070 !! wikitext
16071 <font color="">foo</font>
16072 !! html
16073 <p><font color="">foo</font>
16074 </p>
16075 !! end
16076
16077 !! test
16078 Empty attribute crash test single-quotes (bug 2067)
16079 !! wikitext
16080 <font color=''>foo</font>
16081 !! html
16082 <p><font color="">foo</font>
16083 </p>
16084 !! end
16085
16086 !! test
16087 Attribute test: equals, then nothing
16088 !! options
16089 parsoid=wt2html,html2html
16090 !! wikitext
16091 <font color=>foo</font>
16092 !! html/php
16093 <p><font color="">foo</font>
16094 </p>
16095 !! html/parsoid
16096 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16097 !! end
16098
16099 !! test
16100 Attribute test: unquoted value
16101 !! options
16102 parsoid=wt2html,html2html
16103 !! wikitext
16104 <font color=x>foo</font>
16105 !! html/php
16106 <p><font color="x">foo</font>
16107 </p>
16108 !! html/parsoid
16109 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16110 !! end
16111
16112 !! test
16113 Attribute test: unquoted but illegal value (hash)
16114 !! wikitext
16115 <font color=#x>foo</font>
16116 !! html
16117 <p><font color="#x">foo</font>
16118 </p>
16119 !! end
16120
16121 # Parsoid does not serialize to empty attribute syntax,
16122 # so wt2wt and html2wt cases are skipped
16123 !! test
16124 Attribute test: no value (T54330)
16125 !! options
16126 parsoid=wt2html,html2html
16127 !! wikitext
16128 <font color>foo</font>
16129 !! html/php
16130 <p><font color="">foo</font>
16131 </p>
16132 !! html/parsoid
16133 <p><font color="">foo</font></p>
16134 !! end
16135
16136 !! test
16137 Bug 2095: link with three closing brackets
16138 !! wikitext
16139 [[Main Page]]]
16140 !! html/php
16141 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16142 </p>
16143 !! html/parsoid
16144 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16145 !! end
16146
16147 !! test
16148 Bug 2095: link with pipe and three closing brackets
16149 !! wikitext
16150 [[Main Page|link]]]
16151 !! html/php
16152 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16153 </p>
16154 !! html/parsoid
16155 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16156 !! end
16157
16158 !! test
16159 Bug 2095: link with pipe and three closing brackets, version 2
16160 !! wikitext
16161 [[Main Page|[http://example.com/]]]
16162 !! html/php
16163 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16164 </p>
16165 !! html/parsoid
16166 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16167 !! end
16168
16169
16170 ###
16171 ### Safety
16172 ###
16173
16174 !! article
16175 Template:Dangerous attribute
16176 !! text
16177 " onmouseover="alert(document.cookie)
16178 !! endarticle
16179
16180 !! article
16181 Template:Dangerous style attribute
16182 !! text
16183 border-size: expression(alert(document.cookie))
16184 !! endarticle
16185
16186 !! article
16187 Template:Div style
16188 !! text
16189 <div style="float: right; {{{1}}}">Magic div</div>
16190 !! endarticle
16191
16192 !! test
16193 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16194 !! wikitext
16195 <div title="{{test}}"></div>
16196 !! html
16197 <div title="This is a test template"></div>
16198
16199 !! end
16200
16201 # Parsoid has enough context to handle this case
16202 !! test
16203 Bug 2304: HTML attribute safety (dangerous template; 2309)
16204 !! wikitext
16205 <div title="{{dangerous attribute}}"></div>
16206 !! html/php
16207 <div title=""></div>
16208
16209 !! html/parsoid
16210 <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>
16211 !! end
16212
16213 !! test
16214 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16215 !! wikitext
16216 <div style="{{dangerous style attribute}}"></div>
16217 !! html
16218 <div style="/* insecure input */"></div>
16219
16220 !! end
16221
16222 !! test
16223 Bug 2304: HTML attribute safety (safe parameter; 2309)
16224 !! wikitext
16225 {{div style|width: 200px}}
16226 !! html
16227 <div style="float: right; width: 200px">Magic div</div>
16228
16229 !! end
16230
16231 !! test
16232 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16233 !! wikitext
16234 {{div style|width: expression(alert(document.cookie))}}
16235 !! html
16236 <div style="/* insecure input */">Magic div</div>
16237
16238 !! end
16239
16240 !! test
16241 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16242 !! wikitext
16243 {{div style|"><script>alert(document.cookie)</script>}}
16244 !! html
16245 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16246
16247 !! end
16248
16249 !! test
16250 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16251 !! wikitext
16252 {{div style|" ><script>alert(document.cookie)</script>}}
16253 !! html
16254 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16255
16256 !! end
16257
16258 !! test
16259 Bug 2304: HTML attribute safety (link)
16260 !! wikitext
16261 <div title="[[Main Page]]"></div>
16262 !! html
16263 <div title="&#91;&#91;Main Page]]"></div>
16264
16265 !! end
16266
16267 !! test
16268 Bug 2304: HTML attribute safety (italics)
16269 !! wikitext
16270 <div title="''foobar''"></div>
16271 !! html
16272 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16273
16274 !! end
16275
16276 !! test
16277 Bug 2304: HTML attribute safety (bold)
16278 !! wikitext
16279 <div title="'''foobar'''"></div>
16280 !! html
16281 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16282
16283 !! end
16284
16285
16286 !! test
16287 Bug 2304: HTML attribute safety (ISBN)
16288 !! wikitext
16289 <div title="ISBN 1234567890"></div>
16290 !! html
16291 <div title="&#73;SBN 1234567890"></div>
16292
16293 !! end
16294
16295 !! test
16296 Bug 2304: HTML attribute safety (RFC)
16297 !! wikitext
16298 <div title="RFC 1234"></div>
16299 !! html
16300 <div title="&#82;FC 1234"></div>
16301
16302 !! end
16303
16304 !! test
16305 Bug 2304: HTML attribute safety (PMID)
16306 !! wikitext
16307 <div title="PMID 1234567890"></div>
16308 !! html
16309 <div title="&#80;MID 1234567890"></div>
16310
16311 !! end
16312
16313 !! test
16314 Bug 2304: HTML attribute safety (web link)
16315 !! wikitext
16316 <div title="http://example.com/"></div>
16317 !! html
16318 <div title="http&#58;//example.com/"></div>
16319
16320 !! end
16321
16322 !! test
16323 Bug 2304: HTML attribute safety (named web link)
16324 !! wikitext
16325 <div title="[http://example.com/ link]"></div>
16326 !! html
16327 <div title="&#91;http&#58;//example.com/ link]"></div>
16328
16329 !! end
16330
16331 !! test
16332 Bug 3244: HTML attribute safety (extension; safe)
16333 !! wikitext
16334 <div style="<nowiki>background:blue</nowiki>"></div>
16335 !! html
16336 <div style="background:blue"></div>
16337
16338 !! end
16339
16340 !! test
16341 Bug 3244: HTML attribute safety (extension; unsafe)
16342 !! wikitext
16343 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16344 !! html
16345 <div style="/* insecure input */"></div>
16346
16347 !! end
16348
16349 # More MSIE fun discovered by Tom Gilder
16350
16351 !! test
16352 MSIE CSS safety test: spurious slash
16353 !! wikitext
16354 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16355 !! html
16356 <div style="/* insecure input */">evil</div>
16357
16358 !! end
16359
16360 !! test
16361 MSIE CSS safety test: hex code
16362 !! wikitext
16363 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16364 !! html
16365 <div style="/* insecure input */">evil</div>
16366
16367 !! end
16368
16369 !! test
16370 MSIE CSS safety test: comment in url
16371 !! wikitext
16372 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16373 !! html
16374 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16375
16376 !! end
16377
16378 !! test
16379 MSIE CSS safety test: comment in expression
16380 !! wikitext
16381 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16382 !! html
16383 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16384
16385 !! end
16386
16387 !! test
16388 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16389 !! wikitext
16390 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16391 !! html
16392 <p style="/* invalid control char */">A</p>
16393
16394 !! end
16395
16396 !! test
16397 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16398 !! wikitext
16399 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16400 <div style="top:EXPRESSION(alert())">B</div>
16401 !! html
16402 <p style="/* insecure input */">A</p>
16403 <div style="/* insecure input */">B</div>
16404
16405 !! end
16406
16407 !! test
16408 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16409 !! wikitext
16410 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16411 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16412 !! html
16413 <div style="/* insecure input */">A</div>
16414 <p style="/* insecure input */">B</p>
16415
16416 !! end
16417
16418 !! test
16419 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16420 !! wikitext
16421 <div style="background-image:url⁽javascript:alert())">A</div>
16422 <div style="background-image:url₍javascript:alert())">B</div>
16423 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16424 !! html
16425 <div style="/* insecure input */">A</div>
16426 <div style="/* insecure input */">B</div>
16427 <p style="/* insecure input */">C</p>
16428
16429 !! end
16430
16431 # FIXME: Parsoid fails to sanitize this! See T58846.
16432 !! test
16433 Opera -o-link CSS
16434 !! wikitext
16435 <div
16436 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;"
16437 style="-o-link:attr(title);-o-link-source:current">X</div>
16438 !! html
16439 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16440
16441 !! end
16442
16443 !! test
16444 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16445 !! wikitext
16446 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16447 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16448 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16449 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16450 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16451 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16452 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16453 !! html
16454 <p style="/* insecure input */">A</p>
16455 <p style="/* insecure input */">B</p>
16456 <p style="/* insecure input */">C</p>
16457 <p style="/* insecure input */">D</p>
16458 <p style="/* insecure input */">E</p>
16459 <p style="/* insecure input */">F</p>
16460 <p style="/* insecure input */">G</p>
16461
16462 !! end
16463
16464 !! test
16465 Table attribute legitimate extension
16466 !! wikitext
16467 {|
16468 !+ style="<nowiki>color:blue</nowiki>"| status
16469 |}
16470 !! html
16471 <table>
16472 <tr>
16473 <th style="color:blue"> status
16474 </th></tr></table>
16475
16476 !!end
16477
16478 !! test
16479 Table attribute safety
16480 !! wikitext
16481 {|
16482 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16483 |}
16484 !! html
16485 <table>
16486 <tr>
16487 <th style="/* insecure input */"> status
16488 </th></tr></table>
16489
16490 !! end
16491
16492 !! test
16493 CSS line continuation 1
16494 !! wikitext
16495 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16496 !! html
16497 <div style="/* insecure input */"></div>
16498
16499 !! end
16500
16501 !! test
16502 CSS line continuation 2
16503 !! wikitext
16504 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16505 !! html
16506 <div style="/* invalid control char */"></div>
16507
16508 !! end
16509
16510 !! article
16511 Template:Identity
16512 !! text
16513 {{{1}}}
16514 !! endarticle
16515
16516 !! test
16517 Expansion of multi-line templates in attribute values (bug 6255)
16518 !! wikitext
16519 <div style="background: {{identity|#00FF00}}">-</div>
16520 !! html
16521 <div style="background: #00FF00">-</div>
16522
16523 !! end
16524
16525
16526 !! test
16527 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16528 !! wikitext
16529 <div style="background:
16530 #00FF00">-</div>
16531 !! html/php
16532 <div style="background: #00FF00">-</div>
16533
16534 !! html/parsoid
16535 <div style="background:
16536 #00FF00">-</div>
16537 !! end
16538
16539 !! test
16540 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16541 !! wikitext
16542 <div style="background: &#10;#00FF00">-</div>
16543 !! html
16544 <div style="background: &#10;#00FF00">-</div>
16545
16546 !! end
16547
16548 !! test
16549 evil <math>-wiki-tags without Extension:Math enabled
16550 !! wikitext
16551 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16552 !! html+tidy
16553 <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>
16554 !! end
16555
16556 ###
16557 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16558 ###
16559 !! test
16560 Parser hook: empty input
16561 !! wikitext
16562 <tag></tag>
16563 !! html/php
16564 <pre>
16565 ''
16566 array (
16567 )
16568 </pre>
16569
16570 !! html/parsoid
16571 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16572 !! end
16573
16574 ## Don't expect parsoid to rt this form.
16575 !! test
16576 Parser hook: empty input using terminated empty elements
16577 !! options
16578 parsoid=wt2html,html2html
16579 !! wikitext
16580 <tag/>
16581 !! html/php
16582 <pre>
16583 NULL
16584 array (
16585 )
16586 </pre>
16587
16588 !! html/parsoid
16589 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16590 !! end
16591
16592 !! test
16593 Parser hook: empty input using terminated empty elements (space before)
16594 !! wikitext
16595 <tag />
16596 !! html/php
16597 <pre>
16598 NULL
16599 array (
16600 )
16601 </pre>
16602
16603 !! html/parsoid
16604 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16605 !! end
16606
16607 !! test
16608 Parser hook: basic input
16609 !! wikitext
16610 <tag>input</tag>
16611 !! html/php
16612 <pre>
16613 'input'
16614 array (
16615 )
16616 </pre>
16617
16618 !! html/parsoid
16619 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16620 !! end
16621
16622 ## Don't expect parsoid to rt this form.
16623 !! test
16624 Parser hook: case insensitive
16625 !! options
16626 parsoid=wt2html,html2html
16627 !! wikitext
16628 <TAG>input</TAG>
16629 !! html/php
16630 <pre>
16631 'input'
16632 array (
16633 )
16634 </pre>
16635
16636 !! html/parsoid
16637 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16638 !! end
16639
16640 ## Don't expect parsoid to rt this form.
16641 !! test
16642 Parser hook: case insensitive, redux
16643 !! options
16644 parsoid=wt2html,html2html
16645 !! wikitext
16646 <TaG>input</TAg>
16647 !! html/php
16648 <pre>
16649 'input'
16650 array (
16651 )
16652 </pre>
16653
16654 !! html/parsoid
16655 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16656 !! end
16657
16658 !! test
16659 Parser hook: nested tags
16660 !! wikitext
16661 <tag><tag></tag></tag>
16662 !! html/php
16663 <pre>
16664 '<tag>'
16665 array (
16666 )
16667 </pre>&lt;/tag&gt;
16668
16669 !! html/parsoid
16670 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16671 !! end
16672
16673 !! test
16674 Parser hook: basic arguments
16675 !! wikitext
16676 <tag width="200" height="100" depth="50" square=""></tag>
16677 !! html/php
16678 <pre>
16679 ''
16680 array (
16681 'width' => '200',
16682 'height' => '100',
16683 'depth' => '50',
16684 'square' => '',
16685 )
16686 </pre>
16687
16688 !! html/parsoid
16689 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16690 !! end
16691
16692 ## Don't expect parsoid to rt this form.
16693 !! test
16694 Parser hook: basic arguments, variations
16695 !! options
16696 parsoid=wt2html,html2html
16697 !! wikitext
16698 <tag width=200 height = "100" depth = '50' square></tag>
16699 !! html/php
16700 <pre>
16701 ''
16702 array (
16703 'width' => '200',
16704 'height' => '100',
16705 'depth' => '50',
16706 'square' => '',
16707 )
16708 </pre>
16709
16710 !! html/parsoid
16711 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16712 !! end
16713
16714 !! test
16715 Parser hook: argument containing a forward slash (bug 5344)
16716 !! wikitext
16717 <tag filename="/tmp/bla"></tag>
16718 !! html/php
16719 <pre>
16720 ''
16721 array (
16722 'filename' => '/tmp/bla',
16723 )
16724 </pre>
16725
16726 !! html/parsoid
16727 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16728 !! end
16729
16730 ## Don't expect parsoid to rt this form.
16731 !! test
16732 Parser hook: empty input using terminated empty elements (bug 2374)
16733 !! options
16734 parsoid=wt2html,html2html
16735 !! wikitext
16736 <tag foo=bar/>text
16737 !! html/php
16738 <pre>
16739 NULL
16740 array (
16741 'foo' => 'bar',
16742 )
16743 </pre>text
16744
16745 !! html/parsoid
16746 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16747 !! end
16748
16749 ## </tag> should be output literally since there is no matching tag that begins it
16750 ## Don't expect parsoid to rt this form.
16751 !! test
16752 Parser hook: basic arguments using terminated empty elements (bug 2374)
16753 !! options
16754 parsoid=wt2html
16755 !! wikitext
16756 <tag width=200 height = "100" depth = '50' square/>
16757 other stuff
16758 </tag>
16759 !! html/php
16760 <pre>
16761 NULL
16762 array (
16763 'width' => '200',
16764 'height' => '100',
16765 'depth' => '50',
16766 'square' => '',
16767 )
16768 </pre>
16769 <p>other stuff
16770 &lt;/tag&gt;
16771 </p>
16772 !! html/parsoid
16773 <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
16774 &lt;/tag></p>
16775 !! end
16776
16777 ## Don't expect parsoid to rt this form.
16778 !! test
16779 Parser hook: Don't allow unclosed extension tags
16780 !! options
16781 parsoid=wt2html
16782 !! wikitext
16783 test <tag>123
16784
16785 this is a '''test'''
16786 !! html/php
16787 <p>test &lt;tag&gt;123
16788 </p><p>this is a <b>test</b>
16789 </p>
16790 !! html/parsoid
16791 <p>test &lt;tag>123</p>
16792
16793 <p>this is a <b>test</b></p>
16794 !! end
16795
16796 ###
16797 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16798 ###
16799
16800 !! test
16801 Parser hook: static parser hook not inside a comment
16802 !! wikitext
16803 <statictag>hello, world</statictag>
16804
16805 <statictag action="flush" />
16806 !! html/php
16807 <p><br />
16808 hello, world
16809 </p>
16810 !! html/parsoid
16811 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16812 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16813 !! end
16814
16815 !! test
16816 Parser hook: static parser hook inside a comment
16817 !! wikitext
16818 <!-- <statictag>hello, world</statictag> -->
16819 <statictag action="flush" />
16820 !! html/php
16821 <p><br />
16822 </p>
16823 !! html/parsoid
16824 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16825 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16826 !! end
16827
16828 # Nested template calls; this case was broken by Parser.php rev 1.506,
16829 # since reverted.
16830
16831 !! article
16832 Template:One-parameter
16833 !! text
16834 (My parameter is: {{{1}}})
16835 !! endarticle
16836
16837 !! article
16838 Template:Map-one-parameter
16839 !! text
16840 {{{{{1}}}|{{{2}}}}}
16841 !! endarticle
16842
16843 !! test
16844 Nested template calls
16845 !! wikitext
16846 {{Map-one-parameter|One-parameter|param}}
16847 !! html
16848 <p>(My parameter is: param)
16849 </p>
16850 !! end
16851
16852
16853 ###
16854 ### Sanitizer
16855 ###
16856
16857 # HTML+Tidy effectively strips out the empty tags completely
16858 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16859 # which Tidy would have done for the PHP parser had there been content inside it.
16860 !! test
16861 Sanitizer: Closing of open tags
16862 !! wikitext
16863 <s></s><table></table>
16864 !! html
16865 <s></s><table></table>
16866
16867 !! html/parsoid
16868 <p><s></s></p><table></table>
16869 !! end
16870
16871 !! test
16872 Sanitizer: Closing of open but not closed tags
16873 !! wikitext
16874 <s>foo
16875 !! html
16876 <p><s>foo</s>
16877 </p>
16878 !! end
16879
16880 !! test
16881 Sanitizer: Closing of closed but not open tags
16882 !! options
16883 parsoid=wt2html
16884 !! wikitext
16885 </s>
16886 !! html/php+tidy
16887 !! html/parsoid
16888 !! end
16889
16890 !! test
16891 Sanitizer: Closing of closed but not open table tags
16892 !! options
16893 parsoid=wt2html
16894 !! wikitext
16895 Table not started</td></tr></table>
16896 !! html/php+tidy
16897 <p>Table not started</p>
16898 !! html/parsoid
16899 <p>Table not started</p>
16900 !! end
16901
16902 !! test
16903 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16904 !! wikitext
16905 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16906 !! html
16907 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16908 </p>
16909 !! end
16910
16911 # In HTML5, the restrictions are that id must contain at least one character,
16912 # and must not contain any space characters.
16913 !! test
16914 Sanitizer: Validating the contents of the id attribute (bug 4515)
16915 !! options
16916 disabled
16917 !! wikitext
16918 <br id="" /><br id="a space" />
16919 !! html
16920 Something ...
16921 !! end
16922
16923 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16924 !! test
16925 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16926 !! options
16927 disabled
16928 !! wikitext
16929 <br id="foo" /><br id="foo" />
16930 !! html
16931 Something need to be done. foo-2 ?
16932 !! end
16933
16934 !! test
16935 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16936 !! wikitext
16937 <div itemscope>
16938 <meta itemprop="hello" content="world">
16939 <meta http-equiv="refresh" content="5">
16940 <meta itemprop="hello" http-equiv="refresh" content="5">
16941 <link itemprop="hello" href="{{SERVER}}">
16942 <link rel="stylesheet" href="{{SERVER}}">
16943 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16944 </div>
16945 !! html
16946 <div itemscope="">
16947 <p> <meta itemprop="hello" content="world" />
16948 &lt;meta http-equiv="refresh" content="5"&gt;
16949 <meta itemprop="hello" content="5" />
16950 </p>
16951 <link itemprop="hello" href="http&#58;//example.org" />
16952 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16953 <link itemprop="hello" href="http&#58;//example.org" />
16954 </div>
16955
16956 !! end
16957
16958 !! test
16959 Language converter: output gets cut off unexpectedly (bug 5757)
16960 !! options
16961 language=zh
16962 !! wikitext
16963 this bit is safe: }-
16964
16965 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16966
16967 then we get cut off here: }-
16968
16969 all additional text is vanished
16970 !! html
16971 <p>this bit is safe: }-
16972 </p><p>but if we add a conversion instance: xxx
16973 </p><p>then we get cut off here: }-
16974 </p><p>all additional text is vanished
16975 </p>
16976 !! end
16977
16978 !! test
16979 Self closed html pairs (bug 5487)
16980 !! options
16981 !! wikitext
16982 <center><font id="bug" />Centered text</center>
16983 <div><font id="bug2" />In div text</div>
16984 !! html
16985 <center>&lt;font id="bug" /&gt;Centered text</center>
16986 <div>&lt;font id="bug2" /&gt;In div text</div>
16987
16988 !! end
16989
16990 #
16991 #
16992 #
16993
16994 !! test
16995 Punctuation: nbsp before exclamation
16996 !! wikitext
16997 C'est grave !
16998 !! html
16999 <p>C'est grave&#160;!
17000 </p>
17001 !! end
17002
17003 !! test
17004 Punctuation: CSS !important (bug 11874)
17005 !! wikitext
17006 <div style="width:50% !important">important</div>
17007 !! html
17008 <div style="width:50% !important">important</div>
17009
17010 !!end
17011
17012 !! test
17013 Punctuation: CSS ! important (bug 11874; with space after)
17014 !! wikitext
17015 <div style="width:50% ! important">important</div>
17016 !! html
17017 <div style="width:50% ! important">important</div>
17018
17019 !!end
17020
17021 !! test
17022 HTML bullet list, closed tags (bug 5497)
17023 !! wikitext
17024 <ul>
17025 <li>One</li>
17026 <li>Two</li>
17027 </ul>
17028 !! html/php
17029 <ul>
17030 <li>One</li>
17031 <li>Two</li>
17032 </ul>
17033
17034 !! html/parsoid
17035 <ul data-parsoid='{"stx":"html"}'>
17036 <li data-parsoid='{"stx":"html"}'>One</li>
17037 <li data-parsoid='{"stx":"html"}'>Two</li>
17038 </ul>
17039
17040 !! end
17041
17042 !! test
17043 HTML bullet list, unclosed tags (bug 5497)
17044 !! wikitext
17045 <ul>
17046 <li>One
17047 <li>Two
17048 </ul>
17049 !! html/php+tidy
17050 <ul>
17051 <li>One</li>
17052 <li>Two</li>
17053 </ul>
17054 !! html/parsoid
17055 <ul data-parsoid='{"stx":"html"}'>
17056 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17057 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17058 </ul>
17059
17060 !! end
17061
17062 !! test
17063 HTML ordered list, closed tags (bug 5497)
17064 !! wikitext
17065 <ol>
17066 <li>One</li>
17067 <li>Two</li>
17068 </ol>
17069 !! html/php
17070 <ol>
17071 <li>One</li>
17072 <li>Two</li>
17073 </ol>
17074
17075 !! html/parsoid
17076 <ol data-parsoid='{"stx":"html"}'>
17077 <li data-parsoid='{"stx":"html"}'>One</li>
17078 <li data-parsoid='{"stx":"html"}'>Two</li>
17079 </ol>
17080
17081 !! end
17082
17083 !! test
17084 HTML ordered list, unclosed tags (bug 5497)
17085 !! options
17086 !! wikitext
17087 <ol>
17088 <li>One
17089 <li>Two
17090 </ol>
17091 !! html/php+tidy
17092 <ol>
17093 <li>One</li>
17094 <li>Two</li>
17095 </ol>
17096 !! html/parsoid
17097 <ol data-parsoid='{"stx":"html"}'>
17098 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17099 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17100 </ol>
17101
17102 !! end
17103
17104 !! test
17105 HTML nested bullet list, closed tags (bug 5497)
17106 !! wikitext
17107 <ul>
17108 <li>One</li>
17109 <li>Two:
17110 <ul>
17111 <li>Sub-one</li>
17112 <li>Sub-two</li>
17113 </ul>
17114 </li>
17115 </ul>
17116 !! html/php
17117 <ul>
17118 <li>One</li>
17119 <li>Two:
17120 <ul>
17121 <li>Sub-one</li>
17122 <li>Sub-two</li>
17123 </ul>
17124 </li>
17125 </ul>
17126
17127 !! html/parsoid
17128 <ul data-parsoid='{"stx":"html"}'>
17129 <li data-parsoid='{"stx":"html"}'>One</li>
17130 <li data-parsoid='{"stx":"html"}'>Two:
17131 <ul data-parsoid='{"stx":"html"}'>
17132 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17133 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17134 </ul>
17135 </li>
17136 </ul>
17137 !! end
17138
17139 !! test
17140 HTML nested bullet list, open tags (bug 5497)
17141 !! wikitext
17142 <ul>
17143 <li>One
17144 <li>Two:
17145 <ul>
17146 <li>Sub-one
17147 <li>Sub-two
17148 </ul>
17149 </ul>
17150 !! html/php+tidy
17151 <ul>
17152 <li>One</li>
17153 <li>Two:
17154 <ul>
17155 <li>Sub-one</li>
17156 <li>Sub-two</li>
17157 </ul>
17158 </li>
17159 </ul>
17160 !! html/parsoid
17161 <ul>
17162 <li>One
17163 </li>
17164 <li>Two:
17165 <ul>
17166 <li>Sub-one
17167 </li>
17168 <li>Sub-two
17169 </li>
17170 </ul>
17171 </li>
17172 </ul>
17173
17174 !! end
17175
17176 !! test
17177 HTML nested ordered list, closed tags (bug 5497)
17178 !! wikitext
17179 <ol>
17180 <li>One</li>
17181 <li>Two:
17182 <ol>
17183 <li>Sub-one</li>
17184 <li>Sub-two</li>
17185 </ol>
17186 </li>
17187 </ol>
17188 !! html
17189 <ol>
17190 <li>One</li>
17191 <li>Two:
17192 <ol>
17193 <li>Sub-one</li>
17194 <li>Sub-two</li>
17195 </ol>
17196 </li>
17197 </ol>
17198
17199 !! end
17200
17201 !! test
17202 HTML nested ordered list, open tags (bug 5497)
17203 !! wikitext
17204 <ol>
17205 <li>One
17206 <li>Two:
17207 <ol>
17208 <li>Sub-one
17209 <li>Sub-two
17210 </ol>
17211 </ol>
17212 !! html/php
17213 <ol>
17214 <li>One
17215 <li>Two:
17216 <ol>
17217 <li>Sub-one
17218 <li>Sub-two
17219 </ol>
17220 </ol>
17221
17222 !! html/parsoid
17223 <ol>
17224 <li>One
17225 </li>
17226 <li>Two:
17227 <ol>
17228 <li>Sub-one
17229 </li>
17230 <li>Sub-two
17231 </li>
17232 </ol>
17233 </li>
17234 </ol>
17235
17236 !! end
17237
17238 !! test
17239 HTML ordered list item with parameters oddity
17240 !! wikitext
17241 <ol><li id="fragment">One</li>
17242 </ol>
17243 !! html
17244 <ol><li id="fragment">One</li>
17245 </ol>
17246
17247 !! end
17248
17249 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17250 !!test
17251 bug 5918: autonumbering
17252 !! wikitext
17253 [http://first/] [http://second] [ftp://ftp]
17254
17255 ftp://inlineftp
17256
17257 [mailto:enclosed@mail.tld With target]
17258
17259 [mailto:enclosed@mail.tld]
17260
17261 mailto:inline@mail.tld
17262 !! html/php
17263 <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>
17264 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17265 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17266 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17267 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17268 </p>
17269 !! html/parsoid
17270 <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>
17271 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17272 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17273 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17274 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17275 !! end
17276
17277
17278 #
17279 # Security and HTML correctness
17280 # From Nick Jenkins' fuzz testing
17281 #
17282
17283 !! test
17284 Fuzz testing: Parser13
17285 !! wikitext
17286 {|
17287 | http://a|
17288 !! html
17289 <table>
17290 <tr>
17291 <td>
17292 </td>
17293 </tr>
17294 </table>
17295
17296 !! end
17297
17298 !! test
17299 Fuzz testing: Parser14
17300 !! wikitext
17301 == onmouseover= ==
17302 http://__TOC__
17303 !! html
17304 <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>
17305 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17306 <ul>
17307 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17308 </ul>
17309 </div>
17310
17311
17312 !! html+tidy
17313 <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>
17314 <p>http://</p>
17315 <div id="toc" class="toc">
17316 <div id="toctitle">
17317 <h2>Contents</h2>
17318 </div>
17319 <ul>
17320 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17321 </ul>
17322 </div>
17323 <p></p>
17324 !! end
17325
17326 !! test
17327 Fuzz testing: Parser14-table
17328 !! options
17329 parsoid=wt2html,html2html
17330 !! wikitext
17331 ==a==
17332 {| STYLE=__TOC__
17333 !! html
17334 <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>
17335 <table style="&#95;_TOC&#95;_">
17336 <tr><td></td></tr>
17337 </table>
17338
17339 !! html+tidy
17340 <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>
17341 <table style="__TOC__">
17342 <tr>
17343 <td></td>
17344 </tr>
17345 </table>
17346 !! html/parsoid
17347 <h2>a</h2>
17348 <table style="__TOC__"></table>
17349 !! end
17350
17351 # Known to produce bogus xml (extra </td>)
17352 !! test
17353 Fuzz testing: Parser16
17354 !! wikitext
17355 {|
17356 !https://||||||
17357 !! html
17358 <table>
17359 <tr>
17360 <th>https://</th>
17361 <th></th>
17362 <th></th>
17363 <th>
17364 </td>
17365 </tr>
17366 </table>
17367
17368 !! html+tidy
17369 <table>
17370 <tr>
17371 <th>https://</th>
17372 <th></th>
17373 <th></th>
17374 <th></th>
17375 </tr>
17376 </table>
17377 !! end
17378
17379 !! test
17380 Fuzz testing: Parser21
17381 !! wikitext
17382 {|
17383 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17384 |
17385 !! html
17386 <table>
17387 <tr>
17388 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17389 </th>
17390 <td>
17391 </td>
17392 </tr>
17393 </table>
17394
17395 !! end
17396
17397 !! test
17398 Fuzz testing: Parser22
17399 !! wikitext
17400 http://===r:::https://b
17401
17402 {|
17403 !! html
17404 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17405 </p>
17406 <table>
17407 <tr><td></td></tr>
17408 </table>
17409
17410 !! end
17411
17412 # Known to produce bad XML for now
17413 !! test
17414 Fuzz testing: Parser24
17415 !! wikitext
17416 {|
17417 {{{|
17418 <u CLASS=
17419 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17420 <br style="onmouseover='alert(document.cookie);' " />
17421
17422 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17423 |
17424 !! html
17425 <table>
17426 {{{|
17427 <u class="&#124;">}}}} &gt;
17428 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17429
17430 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17431 <tr>
17432 <td></u>
17433 </td>
17434 </tr>
17435 </table>
17436
17437 !! end
17438
17439 # Note: the current result listed for this is not what the original one was,
17440 # but the original bug was JavaScript injection, which is fixed in any case.
17441 # It's not clear that the original result listed was any more correct than the
17442 # current one. Original result:
17443 # <p>{{{|
17444 # </p>
17445 # <li class="&#124;&#124;">
17446 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17447 !!test
17448 Fuzz testing: Parser25 (bug 6055)
17449 !! wikitext
17450 {{{
17451 |
17452 <LI CLASS=||
17453 >
17454 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17455 !! html
17456 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17457 </p>
17458 !! end
17459
17460 !!test
17461 Fuzz testing: URL adjacent extension (with space, clean)
17462 !! wikitext
17463 http://example.com <nowiki>junk</nowiki>
17464 !! html/php
17465 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17466 </p>
17467 !! html/parsoid
17468 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17469 !! end
17470
17471 !!test
17472 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17473 !! wikitext
17474 http://example.com<nowiki>junk</nowiki>
17475 !! html/php
17476 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17477 </p>
17478 !! html/parsoid
17479 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17480 !! end
17481
17482 !!test
17483 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17484 !! wikitext
17485 http://example.com<pre>junk</pre>
17486 !! html/php
17487 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17488
17489 !! html/php+tidy
17490 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17491 <pre>
17492 junk
17493 </pre>
17494 !! html/parsoid
17495 <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>
17496 !!end
17497
17498 !!test
17499 Fuzz testing: image with bogus manual thumbnail
17500 !! wikitext
17501 [[Image:foobar.jpg|thumbnail= ]]
17502 !! html/php
17503 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17504
17505 !! html/parsoid
17506 <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>
17507 !!end
17508
17509 !! test
17510 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17511 !! wikitext
17512 <pre dir="&#10;"></pre>
17513 !! html
17514 <pre dir="&#10;"></pre>
17515
17516 !! end
17517
17518 !! test
17519 Parsing optional HTML elements (Bug 6171)
17520 !! options
17521 !! wikitext
17522 <table>
17523 <tr>
17524 <td> Some tabular data</td>
17525 <td> More tabular data ...
17526 <td> And yet som tabular data</td>
17527 </tr>
17528 </table>
17529 !! html
17530 <table>
17531 <tr>
17532 <td> Some tabular data</td>
17533 <td> More tabular data ...
17534 </td><td> And yet som tabular data</td>
17535 </tr>
17536 </table>
17537
17538 !! end
17539
17540 !! test
17541 Correct handling of <td>, <tr> (Bug 6171)
17542 !! options
17543 !! wikitext
17544 <table>
17545 <tr>
17546 <td> Some tabular data</td>
17547 <td> More tabular data ...</td>
17548 <td> And yet som tabular data</td>
17549 </tr>
17550 </table>
17551 !! html
17552 <table>
17553 <tr>
17554 <td> Some tabular data</td>
17555 <td> More tabular data ...</td>
17556 <td> And yet som tabular data</td>
17557 </tr>
17558 </table>
17559
17560 !! end
17561
17562
17563 !! test
17564 Parsing crashing regression (fr:JavaScript)
17565 !! wikitext
17566 </body></x>
17567 !! html
17568 <p>&lt;/body&gt;&lt;/x&gt;
17569 </p>
17570 !! end
17571
17572 !! test
17573 Inline wiki vs wiki block nesting
17574 !! wikitext
17575 '''Bold paragraph
17576
17577 New wiki paragraph
17578 !! html
17579 <p><b>Bold paragraph</b>
17580 </p><p>New wiki paragraph
17581 </p>
17582 !! end
17583
17584 # FIXME: The current php output is documented
17585 # and desired output is the parsoid target.
17586 !! test
17587 Inline HTML vs wiki block nesting
17588 !! wikitext
17589 <b>Bold paragraph
17590
17591 New wiki paragraph
17592 !! html/php
17593 <p><b>Bold paragraph
17594 </p><p>New wiki paragraph</b>
17595 </p>
17596 !! html/parsoid
17597 <p><b>Bold paragraph</b>
17598 </p><p>New wiki paragraph
17599 </p>
17600 !! end
17601
17602 # Original result was this:
17603 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17604 # </p>
17605 # While that might be marginally more intuitive, maybe, the six-apostrophe
17606 # construct is clearly pathological and the result stated here (which is what
17607 # the parser actually does) is about as reasonable as anything.
17608 !!test
17609 Mixing markup for italics and bold
17610 !! options
17611 !! wikitext
17612 '''bold''''''bold''bolditalics'''''
17613 !! html
17614 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17615 </p>
17616 !! end
17617
17618
17619 !! article
17620 Xyzzyx
17621 !! text
17622 Article for special page transclusion test
17623 !! endarticle
17624
17625 !! test
17626 Special page transclusion
17627 !! options
17628 !! wikitext
17629 {{Special:Prefixindex/Xyzzyx}}
17630 !! html
17631 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17632 </ul>
17633
17634 !! end
17635
17636 !! test
17637 Special page transclusion twice (bug 5021)
17638 !! options
17639 !! wikitext
17640 {{Special:Prefixindex/Xyzzyx}}
17641 {{Special:Prefixindex/Xyzzyx}}
17642 !! html
17643 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17644 </ul>
17645 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17646 </ul>
17647
17648 !! end
17649
17650 !! test
17651 Transclusion of default MediaWiki message
17652 !! wikitext
17653 {{MediaWiki:Mainpage}}
17654 !! html
17655 <p>Main Page
17656 </p>
17657 !! end
17658
17659 !! test
17660 Transclusion of nonexistent MediaWiki message
17661 !! wikitext
17662 {{MediaWiki:Mainpagexxx}}
17663 !! html
17664 <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>
17665 </p>
17666 !! end
17667
17668 !! test
17669 Transclusion of MediaWiki message with underscore
17670 !! wikitext
17671 {{MediaWiki:history_short}}
17672 !! html
17673 <p>History
17674 </p>
17675 !! end
17676
17677 !! test
17678 Transclusion of MediaWiki message with space
17679 !! wikitext
17680 {{MediaWiki:history short}}
17681 !! html
17682 <p>History
17683 </p>
17684 !! end
17685
17686 !! test
17687 Invalid header with following text
17688 !! wikitext
17689 = x = y
17690 !! html
17691 <p>= x = y
17692 </p>
17693 !! end
17694
17695
17696 !! test
17697 Section extraction test (section 0)
17698 !! options
17699 section=0
17700 !! wikitext
17701 start
17702 ==a==
17703 ===aa===
17704 ====aaa====
17705 ==b==
17706 ===ba===
17707 ===bb===
17708 ====bba====
17709 ===bc===
17710 ==c==
17711 ===ca===
17712 !! html/php
17713 start
17714 !! end
17715
17716 !! test
17717 Section extraction test (section 1)
17718 !! options
17719 section=1
17720 !! wikitext
17721 start
17722 ==a==
17723 ===aa===
17724 ====aaa====
17725 ==b==
17726 ===ba===
17727 ===bb===
17728 ====bba====
17729 ===bc===
17730 ==c==
17731 ===ca===
17732 !! html/php
17733 ==a==
17734 ===aa===
17735 ====aaa====
17736 !! end
17737
17738 !! test
17739 Section extraction test (section 2)
17740 !! options
17741 section=2
17742 !! wikitext
17743 start
17744 ==a==
17745 ===aa===
17746 ====aaa====
17747 ==b==
17748 ===ba===
17749 ===bb===
17750 ====bba====
17751 ===bc===
17752 ==c==
17753 ===ca===
17754 !! html/php
17755 ===aa===
17756 ====aaa====
17757 !! end
17758
17759 !! test
17760 Section extraction test (section 3)
17761 !! options
17762 section=3
17763 !! wikitext
17764 start
17765 ==a==
17766 ===aa===
17767 ====aaa====
17768 ==b==
17769 ===ba===
17770 ===bb===
17771 ====bba====
17772 ===bc===
17773 ==c==
17774 ===ca===
17775 !! html/php
17776 ====aaa====
17777 !! end
17778
17779 !! test
17780 Section extraction test (section 4)
17781 !! options
17782 section=4
17783 !! wikitext
17784 start
17785 ==a==
17786 ===aa===
17787 ====aaa====
17788 ==b==
17789 ===ba===
17790 ===bb===
17791 ====bba====
17792 ===bc===
17793 ==c==
17794 ===ca===
17795 !! html/php
17796 ==b==
17797 ===ba===
17798 ===bb===
17799 ====bba====
17800 ===bc===
17801 !! end
17802
17803 !! test
17804 Section extraction test (section 5)
17805 !! options
17806 section=5
17807 !! wikitext
17808 start
17809 ==a==
17810 ===aa===
17811 ====aaa====
17812 ==b==
17813 ===ba===
17814 ===bb===
17815 ====bba====
17816 ===bc===
17817 ==c==
17818 ===ca===
17819 !! html/php
17820 ===ba===
17821 !! end
17822
17823 !! test
17824 Section extraction test (section 6)
17825 !! options
17826 section=6
17827 !! wikitext
17828 start
17829 ==a==
17830 ===aa===
17831 ====aaa====
17832 ==b==
17833 ===ba===
17834 ===bb===
17835 ====bba====
17836 ===bc===
17837 ==c==
17838 ===ca===
17839 !! html/php
17840 ===bb===
17841 ====bba====
17842 !! end
17843
17844 !! test
17845 Section extraction test (section 7)
17846 !! options
17847 section=7
17848 !! wikitext
17849 start
17850 ==a==
17851 ===aa===
17852 ====aaa====
17853 ==b==
17854 ===ba===
17855 ===bb===
17856 ====bba====
17857 ===bc===
17858 ==c==
17859 ===ca===
17860 !! html/php
17861 ====bba====
17862 !! end
17863
17864 !! test
17865 Section extraction test (section 8)
17866 !! options
17867 section=8
17868 !! wikitext
17869 start
17870 ==a==
17871 ===aa===
17872 ====aaa====
17873 ==b==
17874 ===ba===
17875 ===bb===
17876 ====bba====
17877 ===bc===
17878 ==c==
17879 ===ca===
17880 !! html/php
17881 ===bc===
17882 !! end
17883
17884 !! test
17885 Section extraction test (section 9)
17886 !! options
17887 section=9
17888 !! wikitext
17889 start
17890 ==a==
17891 ===aa===
17892 ====aaa====
17893 ==b==
17894 ===ba===
17895 ===bb===
17896 ====bba====
17897 ===bc===
17898 ==c==
17899 ===ca===
17900 !! html/php
17901 ==c==
17902 ===ca===
17903 !! end
17904
17905 !! test
17906 Section extraction test (section 10)
17907 !! options
17908 section=10
17909 !! wikitext
17910 start
17911 ==a==
17912 ===aa===
17913 ====aaa====
17914 ==b==
17915 ===ba===
17916 ===bb===
17917 ====bba====
17918 ===bc===
17919 ==c==
17920 ===ca===
17921 !! html/php
17922 ===ca===
17923 !! end
17924
17925 !! test
17926 Section extraction test (nonexistent section 11)
17927 !! options
17928 section=11
17929 !! wikitext
17930 start
17931 ==a==
17932 ===aa===
17933 ====aaa====
17934 ==b==
17935 ===ba===
17936 ===bb===
17937 ====bba====
17938 ===bc===
17939 ==c==
17940 ===ca===
17941 !! html/php
17942 !! end
17943
17944 !! test
17945 Section extraction test with bogus heading (section 1)
17946 !! options
17947 section=1
17948 !! wikitext
17949 ==a==
17950 ==bogus== not a legal section
17951 ==b==
17952 !! html/php
17953 ==a==
17954 ==bogus== not a legal section
17955 !! end
17956
17957 !! test
17958 Section extraction test with bogus heading (section 2)
17959 !! options
17960 section=2
17961 !! wikitext
17962 ==a==
17963 ==bogus== not a legal section
17964 ==b==
17965 !! html/php
17966 ==b==
17967 !! end
17968
17969 !! test
17970 Section extraction test with comment after heading (section 1)
17971 !! options
17972 section=1
17973 !! wikitext
17974 ==a==
17975 ==b== <!-- -->
17976 ==c==
17977 !! html/php
17978 ==a==
17979 !! end
17980
17981 !! test
17982 Section extraction test with comment after heading (section 2)
17983 !! options
17984 section=2
17985 !! wikitext
17986 ==a==
17987 ==b== <!-- -->
17988 ==c==
17989 !! html/php
17990 ==b== <!-- -->
17991 !! end
17992
17993 !! test
17994 Section extraction test with bogus <nowiki> heading (section 1)
17995 !! options
17996 section=1
17997 !! wikitext
17998 ==a==
17999 ==bogus== <nowiki>not a legal section</nowiki>
18000 ==b==
18001 !! html/php
18002 ==a==
18003 ==bogus== <nowiki>not a legal section</nowiki>
18004 !! end
18005
18006 !! test
18007 Section extraction test with bogus <nowiki> heading (section 2)
18008 !! options
18009 section=2
18010 !! wikitext
18011 ==a==
18012 ==bogus== <nowiki>not a legal section</nowiki>
18013 ==b==
18014 !! html/php
18015 ==b==
18016 !! end
18017
18018 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18019 # instead of respecting commented sections
18020 !! test
18021 Section extraction prefixed by comment (section 1)
18022 !! options
18023 section=1
18024 !! wikitext
18025 <!-- -->==sec1==
18026 ==sec2==
18027 !! html/php
18028 ==sec2==
18029 !!end
18030
18031 !! test
18032 Section extraction prefixed by comment (section 2)
18033 !! options
18034 section=2
18035 !! wikitext
18036 <!-- -->==sec1==
18037 ==sec2==
18038 !! html/php
18039
18040 !!end
18041
18042 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18043 # instead of respecting HTML-style headings
18044 !! test
18045 Section extraction, mixed wiki and html (section 1)
18046 !! options
18047 section=1
18048 !! wikitext
18049 <h2>unmarked</h2>
18050 unmarked
18051 ==1==
18052 one
18053 ==2==
18054 two
18055 !! html/php
18056 ==1==
18057 one
18058 !! end
18059
18060 !! test
18061 Section extraction, mixed wiki and html (section 2)
18062 !! options
18063 section=2
18064 !! wikitext
18065 <h2>unmarked</h2>
18066 unmarked
18067 ==1==
18068 one
18069 ==2==
18070 two
18071 !! html/php
18072 ==2==
18073 two
18074 !! end
18075
18076
18077 # Formerly testing for bug 3342
18078 !! test
18079 Section extraction, heading surrounded by <noinclude>
18080 !! options
18081 section=1
18082 !! wikitext
18083 <noinclude>==unmarked==</noinclude>
18084 ==marked==
18085 !! html/php
18086 ==marked==
18087 !!end
18088
18089 # Test behavior of bug 19910
18090 !! test
18091 Sectiion with all-equals
18092 !! options
18093 section=2
18094 !! wikitext
18095 ===
18096 The line above must have a trailing space
18097 === <!--
18098 --> <!-- -->
18099 But just in case it doesn't...
18100 !! html/php
18101 === <!--
18102 --> <!-- -->
18103 But just in case it doesn't...
18104 !! end
18105
18106 !! test
18107 Section replacement test (section 0)
18108 !! options
18109 replace=0,"xxx"
18110 !! wikitext
18111 start
18112 ==a==
18113 ===aa===
18114 ====aaa====
18115 ==b==
18116 ===ba===
18117 ===bb===
18118 ====bba====
18119 ===bc===
18120 ==c==
18121 ===ca===
18122 !! html/php
18123 xxx
18124
18125 ==a==
18126 ===aa===
18127 ====aaa====
18128 ==b==
18129 ===ba===
18130 ===bb===
18131 ====bba====
18132 ===bc===
18133 ==c==
18134 ===ca===
18135 !! end
18136
18137 !! test
18138 Section replacement test (section 1)
18139 !! options
18140 replace=1,"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 start
18155 xxx
18156
18157 ==b==
18158 ===ba===
18159 ===bb===
18160 ====bba====
18161 ===bc===
18162 ==c==
18163 ===ca===
18164 !! end
18165
18166 !! test
18167 Section replacement test (section 2)
18168 !! options
18169 replace=2,"xxx"
18170 !! wikitext
18171 start
18172 ==a==
18173 ===aa===
18174 ====aaa====
18175 ==b==
18176 ===ba===
18177 ===bb===
18178 ====bba====
18179 ===bc===
18180 ==c==
18181 ===ca===
18182 !! html/php
18183 start
18184 ==a==
18185 xxx
18186
18187 ==b==
18188 ===ba===
18189 ===bb===
18190 ====bba====
18191 ===bc===
18192 ==c==
18193 ===ca===
18194 !! end
18195
18196 !! test
18197 Section replacement test (section 3)
18198 !! options
18199 replace=3,"xxx"
18200 !! wikitext
18201 start
18202 ==a==
18203 ===aa===
18204 ====aaa====
18205 ==b==
18206 ===ba===
18207 ===bb===
18208 ====bba====
18209 ===bc===
18210 ==c==
18211 ===ca===
18212 !! html/php
18213 start
18214 ==a==
18215 ===aa===
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 4)
18229 !! options
18230 replace=4,"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 ====aaa====
18248 xxx
18249
18250 ==c==
18251 ===ca===
18252 !! end
18253
18254 !! test
18255 Section replacement test (section 5)
18256 !! options
18257 replace=5,"xxx"
18258 !! wikitext
18259 start
18260 ==a==
18261 ===aa===
18262 ====aaa====
18263 ==b==
18264 ===ba===
18265 ===bb===
18266 ====bba====
18267 ===bc===
18268 ==c==
18269 ===ca===
18270 !! html/php
18271 start
18272 ==a==
18273 ===aa===
18274 ====aaa====
18275 ==b==
18276 xxx
18277
18278 ===bb===
18279 ====bba====
18280 ===bc===
18281 ==c==
18282 ===ca===
18283 !! end
18284
18285 !! test
18286 Section replacement test (section 6)
18287 !! options
18288 replace=6,"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 ===ba===
18308 xxx
18309
18310 ===bc===
18311 ==c==
18312 ===ca===
18313 !! end
18314
18315 !! test
18316 Section replacement test (section 7)
18317 !! options
18318 replace=7,"xxx"
18319 !! wikitext
18320 start
18321 ==a==
18322 ===aa===
18323 ====aaa====
18324 ==b==
18325 ===ba===
18326 ===bb===
18327 ====bba====
18328 ===bc===
18329 ==c==
18330 ===ca===
18331 !! html/php
18332 start
18333 ==a==
18334 ===aa===
18335 ====aaa====
18336 ==b==
18337 ===ba===
18338 ===bb===
18339 xxx
18340
18341 ===bc===
18342 ==c==
18343 ===ca===
18344 !! end
18345
18346 !! test
18347 Section replacement test (section 8)
18348 !! options
18349 replace=8,"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 ====bba====
18371 xxx
18372
18373 ==c==
18374 ===ca===
18375 !!end
18376
18377 !! test
18378 Section replacement test (section 9)
18379 !! options
18380 replace=9,"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 ===bc===
18403 xxx
18404 !! end
18405
18406 !! test
18407 Section replacement test (section 10)
18408 !! options
18409 replace=10,"xxx"
18410 !! wikitext
18411 start
18412 ==a==
18413 ===aa===
18414 ====aaa====
18415 ==b==
18416 ===ba===
18417 ===bb===
18418 ====bba====
18419 ===bc===
18420 ==c==
18421 ===ca===
18422 !! html/php
18423 start
18424 ==a==
18425 ===aa===
18426 ====aaa====
18427 ==b==
18428 ===ba===
18429 ===bb===
18430 ====bba====
18431 ===bc===
18432 ==c==
18433 xxx
18434 !! end
18435
18436 !! test
18437 Section replacement test with initial whitespace (bug 13728)
18438 !! options
18439 replace=2,"xxx"
18440 !! wikitext
18441 Preformatted initial line
18442 ==a==
18443 ===a===
18444 !! html/php
18445 Preformatted initial line
18446 ==a==
18447 xxx
18448 !! end
18449
18450
18451 !! test
18452 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18453 !! options
18454 section=1
18455 !! wikitext
18456 ==a==
18457 a
18458 !! html/php
18459 ==a==
18460 a
18461 !! end
18462
18463 !! test
18464 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18465 !! options
18466 section=1
18467 !! wikitext
18468 ==a==
18469 a
18470 !! html/php
18471 ==a==
18472 a
18473 !! end
18474
18475
18476 !! test
18477 Section extraction, <pre> around bogus header (bug 10309)
18478 !! options
18479 section=2
18480 !! wikitext
18481 == Section One ==
18482 <pre>
18483 =======
18484 </pre>
18485
18486 == Section Two ==
18487 stuff
18488 !! html/php
18489 == Section Two ==
18490 stuff
18491 !! end
18492
18493 !! test
18494 Section replacement, <pre> around bogus header (bug 10309)
18495 !! options
18496 replace=2,"xxx"
18497 !! wikitext
18498 == Section One ==
18499 <pre>
18500 =======
18501 </pre>
18502
18503 == Section Two ==
18504 stuff
18505 !! html/php
18506 == Section One ==
18507 <pre>
18508 =======
18509 </pre>
18510
18511 xxx
18512 !! end
18513
18514
18515 !! test
18516 Handling of &#x0A; in URLs
18517 !! wikitext
18518 ** irc://&#x0A;a
18519 !! html/php
18520 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18521
18522 !! html/parsoid
18523 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18524 a">irc://
18525 a</a></li></ul></li></ul>
18526 !! end
18527
18528 !! test
18529 Handling of %0A in URLs
18530 !! wikitext
18531 ** irc://%0Aa
18532 !! html/php
18533 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18534
18535 !! html/parsoid
18536 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18537 !! end
18538
18539
18540 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18541 !! test
18542 5 quotes, code coverage +1 line
18543 !! options
18544 parsoid=wt2html
18545 !! wikitext
18546 '''''
18547 !! html/php
18548 !! html/parsoid
18549 <p><b><i></i></b></p>
18550 !! end
18551
18552 # same html as previous, but wikitext adjusted to match parsoid html2wt
18553 # note that wt2html and html2html will put the <i> before the <b>
18554 !! test
18555 5 quotes, code coverage +1 line w/ nowiki (1)
18556 !! options
18557 parsoid=wt2wt,html2wt
18558 !! wikitext
18559 '''''<nowiki/>'''''
18560 !! html/php
18561 <p><i></i>
18562 </p>
18563 !! html/parsoid
18564 <p><b><i></i></b></p>
18565 !! end
18566
18567 # same as previous, just swapping the <i> and <b>
18568 !! test
18569 5 quotes, code coverage +1 line w/ nowiki (2)
18570 !! wikitext
18571 '''''<nowiki/>'''''
18572 !! html/php
18573 <p><i></i>
18574 </p>
18575 !! html/parsoid
18576 <p><i><b></b></i></p>
18577 !! end
18578
18579 !! test
18580 Special:Search page linking.
18581 !! wikitext
18582 {{Special:search}}
18583 !! html
18584 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18585 </p>
18586 !! end
18587
18588 !! test
18589 {{!}} is a magic word
18590 !! wikitext
18591 {{!}} is a magic word there and {{!}} is still a magic word here
18592 | is not a magic word here but {{!}} is still a magic word here
18593 !! html/php
18594 <p>| is a magic word there and | is still a magic word here
18595 | is not a magic word here but | is still a magic word here
18596 </p>
18597 !! html/parsoid
18598 <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
18599 | 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>
18600
18601 !! end
18602
18603 !! test
18604 Say the magic word
18605 !! options
18606 title=[[Parser test]]
18607 !! wikitext
18608 * {{PAGENAME}}
18609 * {{PAGENAMEE}}
18610 * {{FULLPAGENAME}}
18611 * {{FULLPAGENAMEE}}
18612 * {{BASEPAGENAME}}
18613 * {{BASEPAGENAMEE}}
18614 * {{SUBPAGENAME}}
18615 * {{SUBPAGENAMEE}}
18616 * {{ROOTPAGENAME}}
18617 * {{ROOTPAGENAMEE}}
18618 * {{TALKPAGENAME}}
18619 * {{TALKPAGENAMEE}}
18620 * {{SUBJECTPAGENAME}}
18621 * {{SUBJECTPAGENAMEE}}
18622 * {{NAMESPACEE}}
18623 * {{NAMESPACE}}
18624 * {{NAMESPACENUMBER}}
18625 * {{TALKSPACE}}
18626 * {{TALKSPACEE}}
18627 * {{SUBJECTSPACE}}
18628 * {{SUBJECTSPACEE}}
18629 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18630 !! html
18631 <ul><li> Parser test</li>
18632 <li> Parser_test</li>
18633 <li> Parser test</li>
18634 <li> Parser_test</li>
18635 <li> Parser test</li>
18636 <li> Parser_test</li>
18637 <li> Parser test</li>
18638 <li> Parser_test</li>
18639 <li> Parser test</li>
18640 <li> Parser_test</li>
18641 <li> Talk:Parser test</li>
18642 <li> Talk:Parser_test</li>
18643 <li> Parser test</li>
18644 <li> Parser_test</li>
18645 <li> </li>
18646 <li> </li>
18647 <li> 0</li>
18648 <li> Talk</li>
18649 <li> Talk</li>
18650 <li> </li>
18651 <li> </li>
18652 <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>
18653
18654 !! end
18655 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18656
18657 !! test
18658 Gallery
18659 !! wikitext
18660 <gallery>
18661 image1.png |
18662 image2.gif|||||
18663
18664 image3|
18665 image4 |300px| centre
18666 image5.svg| http://///////
18667 [[x|xx]]]]
18668 * image6
18669 </gallery>
18670 !! html
18671 <ul class="gallery mw-gallery-traditional">
18672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18673 <div class="thumb" style="height: 150px;">Image1.png</div>
18674 <div class="gallerytext">
18675 </div>
18676 </div></li>
18677 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18678 <div class="thumb" style="height: 150px;">Image2.gif</div>
18679 <div class="gallerytext">
18680 </div>
18681 </div></li>
18682 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18683 <div class="thumb" style="height: 150px;">Image3</div>
18684 <div class="gallerytext">
18685 </div>
18686 </div></li>
18687 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18688 <div class="thumb" style="height: 150px;">Image4</div>
18689 <div class="gallerytext">
18690 <pre>centre
18691 </pre>
18692 </div>
18693 </div></li>
18694 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18695 <div class="thumb" style="height: 150px;">Image5.svg</div>
18696 <div class="gallerytext">
18697 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18698 </p>
18699 </div>
18700 </div></li>
18701 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18702 <div class="thumb" style="height: 150px;">* image6</div>
18703 <div class="gallerytext">
18704 </div>
18705 </div></li>
18706 </ul>
18707
18708 !! end
18709
18710 !! test
18711 Gallery (with options)
18712 !! wikitext
18713 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18714 File:Nonexistent.jpg|caption
18715 File:Nonexistent.jpg
18716 image:foobar.jpg|some '''caption''' [[Main Page]]
18717 image:foobar.jpg
18718 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18719 </gallery>
18720 !! html
18721 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18722 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18723 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18724 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18725 <div class="gallerytext">
18726 <p>caption
18727 </p>
18728 </div>
18729 </div></li>
18730 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18731 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18732 <div class="gallerytext">
18733 </div>
18734 </div></li>
18735 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18736 <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>
18737 <div class="gallerytext">
18738 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18739 </p>
18740 </div>
18741 </div></li>
18742 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18743 <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>
18744 <div class="gallerytext">
18745 </div>
18746 </div></li>
18747 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18748 <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>
18749 <div class="gallerytext">
18750 <p>blabla.
18751 </p>
18752 </div>
18753 </div></li>
18754 </ul>
18755
18756 !! end
18757
18758 !! test
18759 Gallery with link that has fragment
18760 !! wikitext
18761 <gallery>
18762 image:foobar.jpg|link=Main_Page
18763 image:foobar.jpg|link=Main_Page#section
18764 image:foobar.jpg|link=Main Page#section|caption
18765 </gallery>
18766 !! html
18767 <ul class="gallery mw-gallery-traditional">
18768 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18769 <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>
18770 <div class="gallerytext">
18771 </div>
18772 </div></li>
18773 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18774 <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>
18775 <div class="gallerytext">
18776 </div>
18777 </div></li>
18778 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18779 <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>
18780 <div class="gallerytext">
18781 <p>caption
18782 </p>
18783 </div>
18784 </div></li>
18785 </ul>
18786
18787 !! end
18788
18789 !! test
18790 Gallery with wikitext inside caption
18791 !! wikitext
18792 <gallery>
18793 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18794 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18795 </gallery>
18796 !! html
18797 <ul class="gallery mw-gallery-traditional">
18798 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18799 <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>
18800 <div class="gallerytext">
18801 <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>
18802 </p>
18803 </div>
18804 </div></li>
18805 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18806 <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>
18807 <div class="gallerytext">
18808 <p>This is a test template
18809 </p>
18810 </div>
18811 </div></li>
18812 </ul>
18813
18814 !! end
18815
18816 !! test
18817 gallery (with showfilename option)
18818 !! wikitext
18819 <gallery showfilename>
18820 File:Nonexistent.jpg|caption
18821 File:Nonexistent.jpg
18822 image:foobar.jpg|some '''caption''' [[Main Page]]
18823 File:Foobar.jpg
18824 </gallery>
18825 !! html
18826 <ul class="gallery mw-gallery-traditional">
18827 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18828 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18829 <div class="gallerytext">
18830 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18831 caption
18832 </p>
18833 </div>
18834 </div></li>
18835 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18836 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18837 <div class="gallerytext">
18838 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18839 </p>
18840 </div>
18841 </div></li>
18842 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18843 <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>
18844 <div class="gallerytext">
18845 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18846 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18847 </p>
18848 </div>
18849 </div></li>
18850 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18851 <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>
18852 <div class="gallerytext">
18853 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18854 </p>
18855 </div>
18856 </div></li>
18857 </ul>
18858
18859 !! end
18860
18861 !! test
18862 Gallery (with namespace-less filenames)
18863 !! wikitext
18864 <gallery>
18865 File:Nonexistent.jpg
18866 Nonexistent.jpg
18867 image:foobar.jpg
18868 foobar.jpg
18869 </gallery>
18870 !! html
18871 <ul class="gallery mw-gallery-traditional">
18872 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18873 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18874 <div class="gallerytext">
18875 </div>
18876 </div></li>
18877 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18878 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18879 <div class="gallerytext">
18880 </div>
18881 </div></li>
18882 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18883 <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>
18884 <div class="gallerytext">
18885 </div>
18886 </div></li>
18887 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18888 <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>
18889 <div class="gallerytext">
18890 </div>
18891 </div></li>
18892 </ul>
18893
18894 !! end
18895
18896 !! test
18897 HTML Hex character encoding (spells the word "JavaScript")
18898 !! options
18899 parsoid=wt2html,wt2wt,html2html
18900 !! wikitext
18901 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18902 !! html/php
18903 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18904 </p>
18905 !! html/php+tidy
18906 <p>JavaScript</p>
18907 !! html/parsoid
18908 <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>
18909 !! end
18910
18911 !! test
18912 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18913 !! wikitext
18914 &#xsee;&#XSEE;
18915 !! html/php
18916 <p>&amp;#xsee;&amp;#XSEE;
18917 </p>
18918 !! html/parsoid
18919 <p>&amp;#xsee;&amp;#XSEE;</p>
18920 !! end
18921
18922 !! test
18923 HTML Hex character encoding mixed case
18924 !! options
18925 parsoid=wt2html,wt2wt,html2html
18926 !! wikitext
18927 &#xEE;&#Xee;
18928 !! html/php
18929 <p>&#xee;&#xee;
18930 </p>
18931 !! html/php+tidy
18932 <p>îî</p>
18933 !! html/parsoid
18934 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18935 !! end
18936
18937 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18938 # Note that U+000C (form feed) is not a valid XML character, so
18939 # it is banned even though allowed in HTML5.
18940 !! test
18941 Illegal character references (T106578)
18942 !! wikitext
18943 ; Null: &#00;
18944 ; FF: &#xC;
18945 ; CR: &#xD;
18946 ; Control (low): &#8;
18947 ; Control (high): &#x7F; &#x9F;
18948 ; Surrogate: &#xD83D;&#xDCA9;
18949 ; This is an okay astral character: &#x1F4A9;
18950 !! html+tidy
18951 <dl>
18952 <dt>Null</dt>
18953 <dd>&amp;#00;</dd>
18954 <dt>FF</dt>
18955 <dd>&amp;#xC;</dd>
18956 <dt>CR</dt>
18957 <dd>&amp;#xD;</dd>
18958 <dt>Control (low)</dt>
18959 <dd>&amp;#8;</dd>
18960 <dt>Control (high)</dt>
18961 <dd>&amp;#x7F; &amp;#x9F;</dd>
18962 <dt>Surrogate</dt>
18963 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18964 <dt>This is an okay astral character</dt>
18965 <dd>💩</dd>
18966 </dl>
18967 !! end
18968
18969 !! test
18970 __FORCETOC__ override
18971 !! wikitext
18972 __NEWSECTIONLINK__
18973 __FORCETOC__
18974 !! html/php
18975 <p><br />
18976 </p>
18977 !! end
18978
18979 !! test
18980 ISBN code coverage
18981 !! wikitext
18982 ISBN 978-0-1234-56&#x20;789
18983 !! html
18984 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18985 </p>
18986 !! html+tidy
18987 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18988 !! html/parsoid
18989 <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>
18990 !! end
18991
18992 !! test
18993 ISBN followed by 5 spaces
18994 !! wikitext
18995 ISBN
18996 !! html
18997 <p>ISBN
18998 </p>
18999 !! end
19000
19001 !! test
19002 Double ISBN
19003 !! wikitext
19004 ISBN ISBN 1234567890
19005 !! html/php
19006 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19007 </p>
19008 !! html/parsoid
19009 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19010 !! end
19011
19012 # Uppercase X and lowercase x as well
19013 !! test
19014 ISBN with an X
19015 !! wikitext
19016 ISBN 3-462-04561-X
19017 ISBN 3-462-04561-x
19018 ISBN 080442957X
19019 ISBN 080442957x
19020 ISBN 978080442957X
19021 ISBN 978080442957x
19022 !! html/php
19023 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19024 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19025 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19026 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19027 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19028 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19029 </p>
19030 !! html/parsoid
19031 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19032 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19033 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19034 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19035 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19036 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19037 !! end
19038
19039 !! test
19040 ISBN with empty prefix (parsoid test)
19041 !! wikitext
19042 ISBN 1234567890
19043 !! html/php
19044 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19045 </p>
19046 !! html/parsoid
19047 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19048 !! end
19049
19050 !! test
19051 Bug 22905: <abbr> followed by ISBN followed by </a>
19052 !! wikitext
19053 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19054 !! html/php
19055 <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>
19056 </p>
19057 !! html/parsoid
19058 <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>
19059 !! end
19060
19061 !! test
19062 Double RFC
19063 !! wikitext
19064 RFC RFC 1234
19065 !! html
19066 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19067 </p>
19068 !! end
19069
19070 !! test
19071 Double RFC with a wiki link
19072 !! wikitext
19073 RFC [[RFC 1234]]
19074 !! html
19075 <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>
19076 </p>
19077 !! end
19078
19079 !! test
19080 RFC code coverage
19081 !! wikitext
19082 RFC 983&#x20;987
19083 !! html
19084 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19085 </p>
19086 !! html+tidy
19087 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19088 !! end
19089
19090 !! test
19091 Centre-aligned image
19092 !! wikitext
19093 [[Image:foobar.jpg|centre]]
19094 !! html
19095 <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>
19096
19097 !!end
19098
19099 !! test
19100 None-aligned image
19101 !! wikitext
19102 [[Image:foobar.jpg|none]]
19103 !! html
19104 <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>
19105
19106 !!end
19107
19108 !! test
19109 Width + Height sized image (using px) (height is ignored)
19110 !! wikitext
19111 [[Image:foobar.jpg|640x480px]]
19112 !! html
19113 <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>
19114 </p>
19115 !!end
19116
19117 !! test
19118 Width-sized image (using px, no following whitespace)
19119 !! wikitext
19120 [[Image:foobar.jpg|640px]]
19121 !! html
19122 <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>
19123 </p>
19124 !!end
19125
19126 !! test
19127 Width-sized image (using px, with following whitespace - test regression from r39467)
19128 !! wikitext
19129 [[Image:foobar.jpg|640px ]]
19130 !! html
19131 <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>
19132 </p>
19133 !!end
19134
19135 !! test
19136 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19137 !! wikitext
19138 [[Image:foobar.jpg| 640px]]
19139 !! html
19140 <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>
19141 </p>
19142 !!end
19143
19144 !! test
19145 Image with page parameter
19146 !! options
19147 djvu
19148 !! wikitext
19149 [[File:LoremIpsum.djvu|page=2]]
19150 !! html/php
19151 <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>
19152 </p>
19153 !! html/parsoid
19154 <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>
19155 !! end
19156
19157 !! test
19158 Another italics / bold test
19159 !! wikitext
19160 ''' ''x'
19161 !! html
19162 <pre>'<i> </i>x'
19163 </pre>
19164 !!end
19165
19166 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19167 !! test
19168 dt/dd/dl test
19169 !! wikitext
19170 :;;;::
19171 !! html/php
19172 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19173
19174 !! html/parsoid
19175 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19176
19177 !!end
19178
19179
19180 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19181 !! test
19182 Images with the "|" character in the comment
19183 !! wikitext
19184 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19185 !! html/php
19186 <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>
19187
19188 !! html/parsoid
19189 <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>
19190 !! end
19191
19192 !! test
19193 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19194 !! wikitext
19195 <html><script>alert(1);</script></html>
19196 !! html
19197 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19198 </p>
19199 !! end
19200
19201 !! test
19202 HTML with raw HTML ($wgRawHtml==true)
19203 !! options
19204 wgRawHtml=1
19205 !! wikitext
19206 <html><script>alert(1);</script></html>
19207 !! html
19208 <p><script>alert(1);</script>
19209 </p>
19210 !! end
19211
19212 !! test
19213 Parents of subpages, one level up
19214 !! options
19215 subpage title=[[Subpage test/L1/L2/L3]]
19216 !! wikitext
19217 [[../|L2]]
19218 !! html
19219 <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>
19220 </p>
19221 !! end
19222
19223
19224 !! test
19225 Parents of subpages, one level up, not named
19226 !! options
19227 subpage title=[[Subpage test/L1/L2/L3]]
19228 !! wikitext
19229 [[../]]
19230 !! html
19231 <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>
19232 </p>
19233 !! end
19234
19235
19236
19237 !! test
19238 Parents of subpages, two levels up
19239 !! options
19240 subpage title=[[Subpage test/L1/L2/L3]]
19241 !! wikitext
19242 [[../../|L1]]2
19243
19244 [[../../|L1]]l
19245 !! html
19246 <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
19247 </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>
19248 </p>
19249 !! end
19250
19251 !! test
19252 Parents of subpages, two levels up, without trailing slash or name.
19253 !! options
19254 subpage title=[[Subpage test/L1/L2/L3]]
19255 !! wikitext
19256 [[../..]]
19257 !! html
19258 <p>[[../..]]
19259 </p>
19260 !! end
19261
19262 !! test
19263 Parents of subpages, two levels up, with lots of extra trailing slashes.
19264 !! options
19265 subpage title=[[Subpage test/L1/L2/L3]]
19266 !! wikitext
19267 [[../../////]]
19268 !! html
19269 <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>
19270 </p>
19271 !! end
19272
19273 !! article
19274 Subpage test/L1/L2/L3Sibling
19275 !! text
19276 Sibling article
19277 !! endarticle
19278
19279 !! test
19280 Transclusion of a sibling page (one level up)
19281 !! options
19282 subpage title=[[Subpage test/L1/L2/L3]]
19283 !! wikitext
19284 {{../L3Sibling}}
19285 !! html
19286 <p>Sibling article
19287 </p>
19288 !! end
19289
19290 !! test
19291 Transclusion of a child page
19292 !! options
19293 subpage title=[[Subpage test/L1/L2]]
19294 !! wikitext
19295 {{/L3Sibling}}
19296 !! html
19297 <p>Sibling article
19298 </p>
19299 !! end
19300
19301 !! test
19302 Non-transclusion because of too many up levels
19303 !! options
19304 subpage title=[[Subpage test/L1/L2/L3]]
19305 !! wikitext
19306 {{../../../../More than parent}}
19307 !! html
19308 <p>{{../../../../More than parent}}
19309 </p>
19310 !! end
19311
19312 !! test
19313 Definition list code coverage
19314 !! wikitext
19315 ; title : def
19316 ; title : def
19317 ;title: def
19318 !! html/php
19319 <dl><dt> title &#160;</dt>
19320 <dd> def</dd>
19321 <dt> title&#160;</dt>
19322 <dd> def</dd>
19323 <dt>title</dt>
19324 <dd> def</dd></dl>
19325
19326 !! html/parsoid
19327 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19328 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19329 <dt>title</dt><dd> def</dd></dl>
19330 !! end
19331
19332 !! test
19333 Don't fall for the self-closing div
19334 !! wikitext
19335 <div>hello world</div/>
19336 !! html
19337 <div>hello world</div>
19338
19339 !! end
19340
19341 !! test
19342 MSGNW magic word
19343 !! wikitext
19344 {{MSGNW:msg}}
19345 !! html/php
19346 <p>&#91;&#91;:Template:Msg&#93;&#93;
19347 </p>
19348 !! end
19349
19350 !! test
19351 RAW magic word
19352 !! wikitext
19353 {{RAW:QUERTY}}
19354 !! html
19355 <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>
19356 </p>
19357 !! end
19358
19359 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19360 !! test
19361 Always escape literal '>' in output, not just after '<'
19362 !! wikitext
19363 ><>
19364 !! html
19365 <p>&gt;&lt;&gt;
19366 </p>
19367 !! end
19368
19369 !! test
19370 Template caching
19371 !! wikitext
19372 {{Test}}
19373 {{Test}}
19374 !! html
19375 <p>This is a test template
19376 This is a test template
19377 </p>
19378 !! end
19379
19380
19381 !! article
19382 MediaWiki:Fake
19383 !! text
19384 ==header==
19385 !! endarticle
19386
19387 !! test
19388 Inclusion of !userCanEdit() content
19389 !! wikitext
19390 {{MediaWiki:Fake}}
19391 !! html
19392 <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>
19393
19394 !! end
19395
19396
19397 !! test
19398 Out-of-order TOC heading levels
19399 !! wikitext
19400 ==2==
19401 ======6======
19402 ===3===
19403 =1=
19404 =====5=====
19405 ==2==
19406 !! html
19407 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19408 <ul>
19409 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19410 <ul>
19411 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19412 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19413 </ul>
19414 </li>
19415 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19416 <ul>
19417 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19418 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19419 </ul>
19420 </li>
19421 </ul>
19422 </div>
19423
19424 <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>
19425 <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>
19426 <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>
19427 <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>
19428 <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>
19429 <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>
19430
19431 !! end
19432
19433
19434 !! test
19435 ISBN with a dummy number
19436 !! wikitext
19437 ISBN ---
19438 !! html
19439 <p>ISBN ---
19440 </p>
19441 !! end
19442
19443
19444 !! test
19445 ISBN with space-delimited number
19446 !! wikitext
19447 ISBN 92 9017 032 8
19448 !! html
19449 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19450 </p>
19451 !! end
19452
19453
19454 !! test
19455 ISBN with multiple spaces, no number
19456 !! wikitext
19457 ISBN foo
19458 !! html
19459 <p>ISBN foo
19460 </p>
19461 !! end
19462
19463
19464 !! test
19465 ISBN length
19466 !! wikitext
19467 ISBN 123456789
19468
19469 ISBN 1234567890
19470
19471 ISBN 12345678901
19472 !! html
19473 <p>ISBN 123456789
19474 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19475 </p><p>ISBN 12345678901
19476 </p>
19477 !! end
19478
19479
19480 !! test
19481 ISBN with trailing year (bug 8110)
19482 !! wikitext
19483 ISBN 1-234-56789-0 - 2006
19484
19485 ISBN 1 234 56789 0 - 2006
19486 !! html
19487 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19488 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19489 </p>
19490 !! end
19491
19492
19493 !! test
19494 anchorencode
19495 !! wikitext
19496 {{anchorencode:foo bar©#%n}}
19497 !! html
19498 <p>foo_bar.C2.A9.23.25n
19499 </p>
19500 !! end
19501
19502 !! test
19503 anchorencode trims spaces
19504 !! wikitext
19505 {{anchorencode: __pretty__please__}}
19506 !! html
19507 <p>pretty_please
19508 </p>
19509 !! end
19510
19511 !! test
19512 anchorencode deals with links
19513 !! wikitext
19514 {{anchorencode: [[hello|world]] [[hi]]}}
19515 !! html
19516 <p>world_hi
19517 </p>
19518 !! end
19519
19520 !! test
19521 anchorencode deals with templates
19522 !! wikitext
19523 {{anchorencode: {{Foo}} }}
19524 !! html
19525 <p>FOO
19526 </p>
19527 !! end
19528
19529 !! test
19530 anchorencode encodes like the TOC generator: (bug 18431)
19531 !! wikitext
19532 === _ +:.3A%3A&&amp;]] ===
19533 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19534 __NOEDITSECTION__
19535 !! html
19536 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19537 <p>.2B:.3A.253A.26.26.5D.5D
19538 </p>
19539 !! end
19540
19541 !! test
19542 Bug 6200: blockquotes and paragraph formatting
19543 !! wikitext
19544 <blockquote>
19545 foo
19546 </blockquote>
19547
19548 bar
19549
19550 baz
19551 !! html
19552 <blockquote>
19553 <p>foo
19554 </p>
19555 </blockquote>
19556 <p>bar
19557 </p>
19558 <pre>baz
19559 </pre>
19560 !! end
19561
19562 !! test
19563 Bug 8293: Use of center tag ruins paragraph formatting
19564 !! wikitext
19565 <center>
19566 foo
19567 </center>
19568
19569 bar
19570
19571 baz
19572 !! html
19573 <center>
19574 <p>foo
19575 </p>
19576 </center>
19577 <p>bar
19578 </p>
19579 <pre>baz
19580 </pre>
19581 !! end
19582
19583 !!test
19584 Parsing of overlapping (improperly nested) inline html tags
19585 !! wikitext
19586 <span><s>x</span></s>
19587 !! html/php
19588 <p><span><s>x&lt;/span&gt;</s></span>
19589 </p>
19590 !! html/parsoid
19591 <p><span><s>x</s></span>
19592 </p>
19593 !!end
19594
19595 ###
19596 ### Language variants related tests
19597 ###
19598 !! test
19599 Self-link in language variants
19600 !! options
19601 title=[[Dunav]] language=sr
19602 !! wikitext
19603 Both [[Dunav]] and [[Дунав]] are names for this river.
19604 !! html
19605 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19606 </p>
19607 !!end
19608
19609 !! article
19610 Дуна
19611 !! text
19612 content
19613 !! endarticle
19614
19615 !! test
19616 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19617 !! options
19618 title=[[Duna]] language=sr
19619 !! wikitext
19620 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19621 !! html
19622 <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.
19623 </p>
19624 !! end
19625
19626 !! test
19627 Link to a section of a variant of this title shouldn't be parsed as self-link
19628 !! options
19629 title=[[Duna]] language=sr
19630 !! wikitext
19631 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19632 !! html
19633 <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.
19634 </p>
19635 !! end
19636
19637 !! test
19638 Link to pages in language variants
19639 !! options
19640 language=sr
19641 !! wikitext
19642 Main Page can be written as [[Маин Паге]]
19643 !! html
19644 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19645 </p>
19646 !!end
19647
19648
19649 !! test
19650 Multiple links to pages in language variants
19651 !! options
19652 language=sr
19653 !! wikitext
19654 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19655 !! html
19656 <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>.
19657 </p>
19658 !!end
19659
19660
19661 !! test
19662 Simple template in language variants
19663 !! options
19664 language=sr
19665 !! wikitext
19666 {{тест}}
19667 !! html
19668 <p>This is a test template
19669 </p>
19670 !! end
19671
19672
19673 !! test
19674 Template with explicit namespace in language variants
19675 !! options
19676 language=sr
19677 !! wikitext
19678 {{Template:тест}}
19679 !! html
19680 <p>This is a test template
19681 </p>
19682 !! end
19683
19684
19685 !! test
19686 Basic test for template parameter in language variants
19687 !! options
19688 language=sr
19689 !! wikitext
19690 {{парамтест|param=foo}}
19691 !! html
19692 <p>This is a test template with parameter foo
19693 </p>
19694 !! end
19695
19696
19697 !! test
19698 Simple category in language variants
19699 !! options
19700 language=sr cat
19701 !! wikitext
19702 [[Category:МедиаWики Усер'с Гуиде]]
19703 !! html
19704 <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>
19705 !! end
19706
19707
19708 !! article
19709 Category:分类
19710 !! text
19711 blah
19712 !! endarticle
19713
19714 !! article
19715 Category:分類
19716 !! text
19717 blah
19718 !! endarticle
19719
19720 ## We used to, but no longer wt2wt this test since the default serializer
19721 ## will normalize all categories to serialize on their own line.
19722 ## This wikitext usage is going to be fairly uncommon in production and
19723 ## selser will take care of preserving formatting in those scenarios.
19724 !! test
19725 Don't convert blue categorylinks to another variant (bug 33210)
19726 !! options
19727 cat
19728 language=zh
19729 parsoid=wt2html
19730 !! wikitext
19731 [[A]][[Category:分类]]
19732 !! html/php
19733 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19734 !! html/parsoid
19735 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19736 <link rel="mw:PageProp/Category" href="Category:分类"/>
19737 !! end
19738
19739 !! test
19740 Stripping -{}- tags (language variants)
19741 !! options
19742 language=sr
19743 !! wikitext
19744 Latin proverb: -{Ne nuntium necare}-
19745 !! html
19746 <p>Latin proverb: Ne nuntium necare
19747 </p>
19748 !! end
19749
19750
19751 !! test
19752 Prevent conversion with -{}- tags (language variants)
19753 !! options
19754 language=sr variant=sr-ec
19755 !! wikitext
19756 Latinski: -{Ne nuntium necare}-
19757 !! html
19758 <p>Латински: Ne nuntium necare
19759 </p>
19760 !! end
19761
19762
19763 !! test
19764 Prevent conversion of text with -{}- tags (language variants)
19765 !! options
19766 language=sr variant=sr-ec
19767 !! wikitext
19768 Latinski: -{Ne nuntium necare}-
19769 !! html
19770 <p>Латински: Ne nuntium necare
19771 </p>
19772 !! end
19773
19774
19775 !! test
19776 Prevent conversion of links with -{}- tags (language variants)
19777 !! options
19778 language=sr variant=sr-ec
19779 !! wikitext
19780 -{[[Main Page]]}-
19781 !! html
19782 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19783 </p>
19784 !! end
19785
19786
19787 !! test
19788 -{}- tags within headlines (within html for parserConvert())
19789 !! options
19790 language=sr variant=sr-ec
19791 !! wikitext
19792 == -{Naslov}- ==
19793 !! html
19794 <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>
19795
19796 !! end
19797
19798
19799 !! test
19800 Explicit definition of language variant alternatives
19801 !! options
19802 language=zh variant=zh-tw
19803 !! wikitext
19804 -{zh:China;zh-tw:Taiwan}-, not China
19805 !! html
19806 <p>Taiwan, not China
19807 </p>
19808 !! end
19809
19810
19811 !! test
19812 Conversion around HTML tags
19813 !! options
19814 language=sr variant=sr-ec
19815 !! wikitext
19816 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19817 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19818 !! html
19819 <p>
19820 <span title="ЛаCтин">ски</span>
19821 </p>
19822 !! end
19823
19824
19825 !! test
19826 Explicit session-wise language variant mapping (A flag and - flag)
19827 !! options
19828 language=zh variant=zh-tw
19829 !! wikitext
19830 Taiwan is not China.
19831 But -{A|zh:China;zh-tw:Taiwan}- is China,
19832 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19833 and -{China}- is China.
19834 !! html
19835 <p>Taiwan is not China.
19836 But Taiwan is Taiwan,
19837 (This should be stripped!)
19838 and China is China.
19839 </p>
19840 !! end
19841
19842 !! test
19843 Explicit session-wise language variant mapping (H flag for hide)
19844 !! options
19845 language=zh variant=zh-tw
19846 !! wikitext
19847 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19848 Taiwan is China.
19849 !! html
19850 <p>(This should be stripped!)
19851 Taiwan is Taiwan.
19852 </p>
19853 !! end
19854
19855 !! test
19856 Adding explicit conversion rule for title (T flag)
19857 !! options
19858 language=zh variant=zh-tw showtitle
19859 !! wikitext
19860 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19861 !! html
19862 Taiwan
19863 <p>Should be stripped!
19864 </p>
19865 !! end
19866
19867 !! test
19868 Testing that changing the language variant here in the tests actually works
19869 !! options
19870 language=zh variant=zh showtitle
19871 !! wikitext
19872 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19873 !! html
19874 China
19875 <p>Should be stripped!
19876 </p>
19877 !! end
19878
19879 !! test
19880 Recursive conversion of alt and title attrs shouldn't clear converter state
19881 !! options
19882 language=zh variant=zh-cn showtitle
19883 !! wikitext
19884 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19885 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19886 !! html
19887 China
19888 <p>
19889 Should be stripped<span title="Exclamation">!</span>
19890 </p>
19891 !! end
19892
19893 !! test
19894 Bug 24072: more test on conversion rule for title
19895 !! options
19896 language=zh variant=zh-tw showtitle
19897 !! wikitext
19898 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19899 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19900 !! html
19901 Taiwan
19902 <p>This should be stripped!
19903 This won't take interferes with the title rule.
19904 </p>
19905 !! end
19906
19907 !! test
19908 Partly disable title conversion if variant == main language code
19909 !! options
19910 language=zh variant=zh title=[[ZH]] showtitle
19911 !! wikitext
19912 -{T|zh-cn:CN;zh-tw:TW}-
19913 !! html
19914 ZH
19915 <p>
19916 </p>
19917 !! end
19918
19919 !! test
19920 Partly disable title conversion if variant == main language code, more
19921 !! options
19922 language=zh variant=zh title=[[ZH]] showtitle
19923 !! wikitext
19924 -{T|TW}-
19925 !! html
19926 ZH
19927 <p>
19928 </p>
19929 !! end
19930
19931 !! test
19932 Raw output of variant escape tags (R flag)
19933 !! options
19934 language=zh variant=zh-tw
19935 !! wikitext
19936 Raw: -{R|zh:China;zh-tw:Taiwan}-
19937 !! html
19938 <p>Raw: zh:China;zh-tw:Taiwan
19939 </p>
19940 !! end
19941
19942 !! test
19943 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19944 !! options
19945 language=zh variant=zh-cn
19946 !! input
19947 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19948 !! result
19949 <p>0
19950 </p>
19951 !! end
19952
19953 !! test
19954 Conversion rules from [numeric-only string] to [something else] (T48634)
19955 !! options
19956 language=zh variant=zh-cn
19957 !! input
19958 -{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
19959 !! result
19960 <p>D12345EE12345
19961 </p>
19962 !! end
19963
19964 !! test
19965 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19966 !! options
19967 language=zh variant=zh-cn
19968 !! input
19969 -{H|zh-cn:foo;zh-tw:;}-foobar
19970 !! result
19971 <p>foobar
19972 </p>
19973 !! end
19974
19975 !! test
19976 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19977 !! options
19978 language=zh variant=zh-cn
19979 !! input
19980 -{H|=>zh-cn:foo;}-foobar
19981 !! result
19982 <p>foobar
19983 </p>
19984 !! end
19985
19986 !! test
19987 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19988 !! options
19989 language=zh variant=zh-cn
19990 !! input
19991 -{H|}-foobar
19992 !! result
19993 <p>foobar
19994 </p>
19995 !! end
19996
19997 !! test
19998 Nested using of manual convert syntax
19999 !! options
20000 language=zh variant=zh-hk
20001 !! wikitext
20002 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20003 !! html
20004 <p>Nested: Hello Hong Kong!
20005 </p>
20006 !! end
20007
20008 !! test
20009 Proper conversion of text in external links
20010 !! options
20011 language=sr variant=sr-ec
20012 !! wikitext
20013 http://www.google.com
20014 gopher://www.google.com
20015 [http://www.google.com http://www.google.com]
20016 [gopher://www.google.com gopher://www.google.com]
20017 [https://www.google.com irc://www.google.com]
20018 [ftp://www.google.com www.google.com/ftp://dir]
20019 [//www.google.com www.google.com]
20020 !! html
20021 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20022 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20023 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20024 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20025 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20026 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20027 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20028 </p>
20029 !! end
20030
20031 !! test
20032 Do not convert roman numbers to language variants
20033 !! options
20034 language=sr variant=sr-ec
20035 !! wikitext
20036 Fridrih IV je car.
20037 !! html
20038 <p>Фридрих IV је цар.
20039 </p>
20040 !! end
20041
20042 !! test
20043 Unclosed language converter markup "-{"
20044 !! options
20045 language=sr
20046 !! wikitext
20047 -{T|hello
20048 !! html
20049 <p>-{T|hello
20050 </p>
20051 !! end
20052
20053 !! test
20054 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20055 !! options
20056 language=sr
20057 !! wikitext
20058 -{R|=&gt;}-
20059 !! html
20060 <p>=&gt;
20061 </p>
20062 !!end
20063
20064 !! test
20065 Don't break link parsing if language converter markup is in the caption.
20066 !! options
20067 language=sr variant=sr-ec
20068 !! wikitext
20069 [[Main Page|-{R|main page}-]]
20070 !! html
20071 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20072 </p>
20073 !! end
20074
20075 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20076 !! test
20077 Don't break image parsing if language converter markup is in the caption.
20078 !! options
20079 language=sr
20080 !! wikitext
20081 [[File:Foobar.jpg|-{R|caption}-]]
20082 !! html/parsoid
20083 <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>
20084 </p>
20085 !! end
20086
20087 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20088 !! test
20089 Don't break list handling if language converter markup is in the item.
20090 !! options
20091 language=zh variant=zh-cn
20092 !! wikitext
20093 ;-{zh-cn:AAA;zh-tw:BBB}-
20094 !! html/php
20095 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20096
20097 !! html/parsoid
20098 <dl><dt>AAA
20099 </dt></dl>
20100 !! end
20101
20102 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20103 !! test
20104 Don't break table handling if language converter markup is in the cell.
20105 !! options
20106 language=sr variant=sr-ec
20107 !! wikitext
20108 {|
20109 |-
20110 | -{R|B}-
20111 |}
20112 !! html/php
20113 <table>
20114
20115 <tr>
20116 <td>Б}-
20117 </td></tr></table>
20118
20119 !! html/parsoid
20120 <table>
20121
20122 <tr>
20123 <td> B
20124 </td></tr></table>
20125
20126 !! end
20127
20128 !! test
20129 Bug 529: Uncovered bullet
20130 !! wikitext
20131 * Foo {{bullet}}
20132 !! html
20133 <ul><li> Foo </li>
20134 <li> Bar</li></ul>
20135
20136 !! end
20137
20138 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20139 # Templates in Wikipedia rely on this behavior, as tidy has always been
20140 # enabled there. These tests are normally run *without* tidy, so specify the
20141 # full output here.
20142 # To test realistic parsing behavior, apply a tidy-like transformation to both
20143 # the expected output and your parser's output.
20144 !! test
20145 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20146 !! wikitext
20147 ******* Foo {{bullet}}
20148 !! html
20149 <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>
20150 <li> Bar</li></ul>
20151
20152 !! end
20153
20154 !! test
20155 Bug 529: Uncovered table already at line-start
20156 !! wikitext
20157 x
20158
20159 {{table}}
20160 y
20161 !! html
20162 <p>x
20163 </p>
20164 <table>
20165 <tr>
20166 <td> 1 </td>
20167 <td> 2
20168 </td></tr>
20169 <tr>
20170 <td> 3 </td>
20171 <td> 4
20172 </td></tr></table>
20173 <p>y
20174 </p>
20175 !! end
20176
20177 !! test
20178 Bug 529: Uncovered bullet in parser function result
20179 !! wikitext
20180 * Foo {{lc:{{bullet}} }}
20181 !! html
20182 <ul><li> Foo </li>
20183 <li> bar</li></ul>
20184
20185 !! end
20186
20187 !! test
20188 Bug 5678: Double-parsed template argument
20189 !! wikitext
20190 {{lc:{{{1}}}|hello}}
20191 !! html
20192 <p>{{{1}}}
20193 </p>
20194 !! end
20195
20196 !! test
20197 Bug 5678: Double-parsed template invocation
20198 !! wikitext
20199 {{lc:{{paramtest {{!}} param = hello }} }}
20200 !! html
20201 <p>{{paramtest | param = hello }}
20202 </p>
20203 !! end
20204
20205 !! test
20206 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20207 !! options
20208 language=cs
20209 title=[[Main Page]]
20210 !! wikitext
20211 {{PRVNÍVELKÉ:ěščř}}
20212 {{prvnívelké:ěščř}}
20213 {{PRVNÍMALÉ:ěščř}}
20214 {{prvnímalé:ěščř}}
20215 {{MALÁ:ěščř}}
20216 {{malá:ěščř}}
20217 {{VELKÁ:ěščř}}
20218 {{velká:ěščř}}
20219 !! html
20220 <p>Ěščř
20221 Ěščř
20222 ěščř
20223 ěščř
20224 ěščř
20225 ěščř
20226 ĚŠČŘ
20227 ĚŠČŘ
20228 </p>
20229 !! end
20230
20231 !! test
20232 Morwen/13: Unclosed link followed by heading
20233 !! wikitext
20234 [[link
20235 ==heading==
20236 !! html
20237 <p>[[link
20238 </p>
20239 <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>
20240
20241 !! end
20242
20243 !! test
20244 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20245 !! wikitext
20246 {{foo|
20247 =heading=
20248 !! html
20249 <p>{{foo|
20250 </p>
20251 <h1><span class="mw-headline" id="heading">heading</span></h1>
20252
20253 !! end
20254
20255 !! test
20256 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20257 !! wikitext
20258 {{foo|
20259 ==heading==
20260 !! html
20261 <p>{{foo|
20262 </p>
20263 <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>
20264
20265 !! end
20266
20267 !! test
20268 Tildes in comments
20269 !! options
20270 pst
20271 !! wikitext
20272 <!-- ~~~~ -->
20273 !! html/php
20274 <!-- ~~~~ -->
20275 !! end
20276
20277 !! test
20278 Paragraphs inside divs (no extra line breaks)
20279 !! wikitext
20280 <div>Line one
20281
20282 Line two</div>
20283 !! html
20284 <div>Line one
20285 Line two</div>
20286
20287 !! end
20288
20289 !! test
20290 Paragraphs inside divs (extra line break on open)
20291 !! wikitext
20292 <div>
20293 Line one
20294
20295 Line two</div>
20296 !! html
20297 <div>
20298 <p>Line one
20299 </p>
20300 Line two</div>
20301
20302 !! end
20303
20304 !! test
20305 Paragraphs inside divs (extra line break on close)
20306 !! wikitext
20307 <div>Line one
20308
20309 Line two
20310 </div>
20311 !! html
20312 <div>Line one
20313 <p>Line two
20314 </p>
20315 </div>
20316
20317 !! end
20318
20319 !! test
20320 Paragraphs inside divs (extra line break on open and close)
20321 !! wikitext
20322 <div>
20323 Line one
20324
20325 Line two
20326 </div>
20327 !! html
20328 <div>
20329 <p>Line one
20330 </p><p>Line two
20331 </p>
20332 </div>
20333
20334 !! end
20335
20336 !! test
20337 Nesting tags, paragraphs on lines which begin with <div>
20338 !! wikitext
20339 <div></div><strong>A
20340 B</strong>
20341 !! html/php+tidy
20342 <p><strong>A</strong></p>
20343 <p><strong>B</strong></p>
20344 !! html/parsoid
20345 <div></div>
20346 <p><strong>A
20347 B</strong>
20348 </p>
20349 !! end
20350
20351 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20352 !! test
20353 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20354 !! wikitext
20355 <blockquote>Line one
20356
20357 Line two</blockquote>
20358 !! html
20359 <blockquote>Line one
20360 Line two</blockquote>
20361
20362 !! html+tidy
20363 <blockquote>
20364 <p>Line one Line two</p>
20365 </blockquote>
20366 !! end
20367
20368 !! test
20369 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20370 !! wikitext
20371 <blockquote>
20372 Line one
20373
20374 Line two</blockquote>
20375 !! html
20376 <blockquote>
20377 <p>Line one
20378 </p>
20379 Line two</blockquote>
20380
20381 !! html+tidy
20382 <blockquote>
20383 <p>Line one</p>
20384 Line two</blockquote>
20385 !! end
20386
20387 !! test
20388 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20389 !! wikitext
20390 <blockquote>Line one
20391
20392 Line two
20393 </blockquote>
20394 !! html
20395 <blockquote>Line one
20396 <p>Line two
20397 </p>
20398 </blockquote>
20399
20400 !! html+tidy
20401 <blockquote>
20402 <p>Line one</p>
20403 <p>Line two</p>
20404 </blockquote>
20405 !! end
20406
20407 !! test
20408 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20409 !! wikitext
20410 <blockquote>
20411 Line one
20412
20413 Line two
20414 </blockquote>
20415 !! html
20416 <blockquote>
20417 <p>Line one
20418 </p><p>Line two
20419 </p>
20420 </blockquote>
20421
20422 !! html+tidy
20423 <blockquote>
20424 <p>Line one</p>
20425 <p>Line two</p>
20426 </blockquote>
20427 !! end
20428
20429 !! test
20430 Paragraphs inside blockquotes/divs (no extra line breaks)
20431 !! wikitext
20432 <blockquote><div>Line one
20433
20434 Line two</div></blockquote>
20435 !! html
20436 <blockquote><div>Line one
20437 Line two</div></blockquote>
20438
20439 !! end
20440
20441 !! test
20442 Paragraphs inside blockquotes/divs (extra line break on open)
20443 !! wikitext
20444 <blockquote><div>
20445 Line one
20446
20447 Line two</div></blockquote>
20448 !! html
20449 <blockquote><div>
20450 <p>Line one
20451 </p>
20452 Line two</div></blockquote>
20453
20454 !! end
20455
20456 !! test
20457 Paragraphs inside blockquotes/divs (extra line break on close)
20458 !! wikitext
20459 <blockquote><div>Line one
20460
20461 Line two
20462 </div></blockquote>
20463 !! html
20464 <blockquote><div>Line one
20465 <p>Line two
20466 </p>
20467 </div></blockquote>
20468
20469 !! end
20470
20471 !! test
20472 Paragraphs inside blockquotes/divs (extra line break on open and close)
20473 !! wikitext
20474 <blockquote><div>
20475 Line one
20476
20477 Line two
20478 </div></blockquote>
20479 !! html
20480 <blockquote><div>
20481 <p>Line one
20482 </p><p>Line two
20483 </p>
20484 </div></blockquote>
20485
20486 !! end
20487
20488 !! test
20489 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20490 !! options
20491 wgLinkHolderBatchSize=0
20492 !! wikitext
20493 [[meatball:1]]
20494 [[meatball:2]]
20495 [[meatball:3]]
20496 !! html
20497 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20498 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20499 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20500 </p>
20501 !! end
20502
20503 !! test
20504 Free external link invading image caption
20505 !! wikitext
20506 [[Image:Foobar.jpg|thumb|http://x|hello]]
20507 !! html
20508 <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>
20509
20510 !! end
20511
20512 !! test
20513 Bug 15196: localised external link numbers
20514 !! options
20515 language=fa
20516 !! wikitext
20517 [http://en.wikipedia.org/]
20518 !! html/php
20519 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20520 </p>
20521 !! html/parsoid
20522 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20523 !! end
20524
20525 !! test
20526 Multibyte character in padleft
20527 !! wikitext
20528 {{padleft:-Hello|7|Æ}}
20529 !! html
20530 <p>Æ-Hello
20531 </p>
20532 !! end
20533
20534 !! test
20535 Multibyte character in padright
20536 !! wikitext
20537 {{padright:Hello-|7|Æ}}
20538 !! html
20539 <p>Hello-Æ
20540 </p>
20541 !! end
20542
20543 !!test
20544 formatdate parser function
20545 !! wikitext
20546 {{#formatdate:2009-03-24}}
20547 !! html
20548 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20549 </p>
20550 !! end
20551
20552 !!test
20553 formatdate parser function, with default format
20554 !! wikitext
20555 {{#formatdate:2009-03-24|mdy}}
20556 !! html
20557 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20558 </p>
20559 !! end
20560
20561 !! test
20562 Spacing of numbers in formatted dates
20563 !! wikitext
20564 {{#formatdate:January 15}}
20565 !! html
20566 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20567 </p>
20568 !! end
20569
20570 !! test
20571 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
20572 !! options
20573 language=nl title=[[MediaWiki:Common.css]]
20574 !! wikitext
20575 {{#formatdate:2009-03-24|dmy}}
20576 !! html
20577 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20578 </p>
20579 !! end
20580
20581 #
20582 #
20583 #
20584
20585 #
20586 # Edit comments
20587 #
20588
20589 !! test
20590 Edit comment with link
20591 !! options
20592 comment
20593 !! wikitext
20594 I like the [[Main Page]] a lot
20595 !! html/php
20596 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20597 !!end
20598
20599 !! test
20600 Edit comment with link and link text
20601 !! options
20602 comment
20603 !! wikitext
20604 I like the [[Main Page|best pages]] a lot
20605 !! html/php
20606 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20607 !!end
20608
20609 !! test
20610 Edit comment with link and link text with suffix
20611 !! options
20612 comment
20613 !! wikitext
20614 I like the [[Main Page|best page]]s a lot
20615 !! html/php
20616 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20617 !!end
20618
20619 !! test
20620 Edit comment with section link (non-local, eg in history list)
20621 !! options
20622 comment title=[[Main Page]]
20623 !! wikitext
20624 /* External links */ removed bogus entries
20625 !! html/php
20626 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20627 !!end
20628
20629 !! test
20630 Edit comment with section link and text before it (non-local, eg in history list)
20631 !! options
20632 comment title=[[Main Page]]
20633 !! wikitext
20634 pre-comment text /* External links */ removed bogus entries
20635 !! html/php
20636 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>
20637 !!end
20638
20639 !! test
20640 Edit comment with section link (local, eg in diff view)
20641 !! options
20642 comment local title=[[Main Page]]
20643 !! wikitext
20644 /* External links */ removed bogus entries
20645 !! html/php
20646 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20647 !!end
20648
20649 !! test
20650 Edit comment with subpage link (bug 14080)
20651 !! options
20652 comment
20653 subpage
20654 title=[[Subpage test]]
20655 !! wikitext
20656 Poked at a [[/subpage]] here...
20657 !! html/php
20658 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20659 !!end
20660
20661 !! test
20662 Edit comment with subpage link and link text (bug 14080)
20663 !! options
20664 comment
20665 subpage
20666 title=[[Subpage test]]
20667 !! wikitext
20668 Poked at a [[/subpage|neat little page]] here...
20669 !! html/php
20670 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20671 !!end
20672
20673 !! test
20674 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20675 !! options
20676 comment
20677 title=[[Subpage test]]
20678 !! wikitext
20679 Poked at a [[/subpage]] here...
20680 !! html/php
20681 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...
20682 !!end
20683
20684 !! test
20685 Edit comment with bare anchor link (local, as on diff)
20686 !! options
20687 comment
20688 local
20689 title=[[Main Page]]
20690 !! wikitext
20691 [[#section]]
20692 !! html/php
20693 <a href="#section">#section</a>
20694 !! end
20695
20696 !! test
20697 Edit comment with bare anchor link (non-local, as on history)
20698 !! options
20699 comment
20700 title=[[Main Page]]
20701 !! wikitext
20702 [[#section]]
20703 !! html/php
20704 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20705 !! end
20706
20707 !! test
20708 Anchor starting with underscore
20709 !! options
20710 title=[[Foo]]
20711 !! wikitext
20712 [[#_ref|One]]
20713 !! html/php
20714 <p><a href="#_ref">One</a>
20715 </p>
20716 !! html/parsoid
20717 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20718 !! end
20719
20720 !! test
20721 Id starting with underscore
20722 !! wikitext
20723 <div id="_ref"></div>
20724 !! html/*
20725 <div id="_ref"></div>
20726
20727 !! end
20728
20729 !! test
20730 Space normalisation on autocomment (bug 22784)
20731 !! options
20732 comment
20733 title=[[Main Page]]
20734 !! wikitext
20735 /* __hello__world__ */
20736 !! html/php
20737 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20738 !! end
20739
20740 !! test
20741 percent-encoding and + signs in comments (Bug 26410)
20742 !! options
20743 comment
20744 !! wikitext
20745 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20746 !! html/php
20747 <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>
20748 !! end
20749
20750 # Parsoid doesn't support this yet: see bug 73581
20751 # but it *should* omit the 'src' attribute if the image is bad.
20752 # PHP side of tests was disabled in
20753 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20754 # because of issues in the PHP parserTests infrastructure
20755 # (but the output below is indeed what the PHP side emits)
20756 !! test
20757 Bad images - basic functionality
20758 !! wikitext
20759 [[File:Bad.jpg]]
20760 !! DISABLED/html/php
20761 !! html/parsoid
20762 <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>
20763 !! end
20764
20765 !! test
20766 Bad images - bug 16039: text after bad image disappears
20767 !! wikitext
20768 Foo bar
20769 [[File:Bad.jpg]]
20770 Bar foo
20771 !! DISABLED/html/php
20772 <p>Foo bar
20773 </p><p>Bar foo
20774 </p>
20775 !! html/parsoid
20776 <p>Foo bar
20777 <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>
20778 Bar foo</p>
20779 !! end
20780
20781 !! test
20782 Verify that displaytitle works (bug #22501) no displaytitle
20783 !! options
20784 showtitle
20785 !! config
20786 wgAllowDisplayTitle=true
20787 wgRestrictDisplayTitle=false
20788 !! wikitext
20789 this is not the the title
20790 !! html/php
20791 Parser test
20792 <p>this is not the the title
20793 </p>
20794 !! end
20795
20796 !! test
20797 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20798 !! options
20799 showtitle
20800 title=[[Screen]]
20801 !! config
20802 wgAllowDisplayTitle=true
20803 wgRestrictDisplayTitle=false
20804 !! wikitext
20805 this is not the the title
20806 {{DISPLAYTITLE:whatever}}
20807 !! html/php
20808 whatever
20809 <p>this is not the the title
20810 </p>
20811 !! end
20812
20813 !! test
20814 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20815 !! options
20816 showtitle
20817 title=[[Screen]]
20818 !! config
20819 wgAllowDisplayTitle=true
20820 wgRestrictDisplayTitle=true
20821 !! wikitext
20822 this is not the the title
20823 {{DISPLAYTITLE:whatever}}
20824 !! html/php
20825 Screen
20826 <p>this is not the the title
20827 </p>
20828 !! end
20829
20830 !! test
20831 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20832 !! options
20833 showtitle
20834 title=[[Screen]]
20835 !! config
20836 wgAllowDisplayTitle=true
20837 wgRestrictDisplayTitle=true
20838 !! wikitext
20839 this is not the the title
20840 {{DISPLAYTITLE:screen}}
20841 !! html/php
20842 screen
20843 <p>this is not the the title
20844 </p>
20845 !! end
20846
20847 !! test
20848 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20849 !! options
20850 showtitle
20851 title=[[Screen]]
20852 !! config
20853 wgAllowDisplayTitle=false
20854 !! wikitext
20855 this is not the the title
20856 {{DISPLAYTITLE:screen}}
20857 !! html/php
20858 Screen
20859 <p>this is not the the title
20860 <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>
20861 </p>
20862 !! end
20863
20864 !! test
20865 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20866 !! options
20867 showtitle
20868 title=[[Screen]]
20869 !! config
20870 wgAllowDisplayTitle=false
20871 !! wikitext
20872 this is not the the title
20873 !! html/php
20874 Screen
20875 <p>this is not the the title
20876 </p>
20877 !! end
20878
20879 !! test
20880 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20881 !! options
20882 showtitle
20883 title=[[Screen]]
20884 !! config
20885 wgAllowDisplayTitle=true
20886 wgRestrictDisplayTitle=true
20887 !! wikitext
20888 this is not the the title
20889 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20890 !! html/php
20891 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20892 <p>this is not the the title
20893 </p>
20894 !! end
20895
20896 !! test
20897 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20898 !! options
20899 showtitle
20900 title=[[Screen]]
20901 !! config
20902 wgAllowDisplayTitle=true
20903 wgRestrictDisplayTitle=true
20904 !! wikitext
20905 this is not the the title
20906 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20907 !! html/php
20908 <span style="color: red;">s</span>creen
20909 <p>this is not the the title
20910 </p>
20911 !! end
20912
20913 !! test
20914 Page status indicators: Empty name is invalid
20915 !! options
20916 showindicators
20917 !! wikitext
20918 <indicator name=" "></indicator>
20919 <indicator></indicator>
20920 !! html
20921 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20922 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20923 </p>
20924 !! end
20925
20926 !! test
20927 Page status indicators: Weird syntaxes that are okay
20928 !! options
20929 showindicators
20930 !! wikitext
20931 <indicator name="empty" />
20932 <indicator name="name"></indicator>
20933 !! html
20934 empty=
20935 name=
20936 <p><br />
20937 </p>
20938 !! end
20939
20940 !! test
20941 Page status indicators: Torture test
20942 !! options
20943 showindicators
20944 !! wikitext
20945 <indicator name="01">hello world</indicator>
20946 <indicator name="02">[[Main Page]]</indicator>
20947 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20948 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20949 <indicator name="05">* foo
20950 * bar</indicator>
20951 <indicator name="06"><nowiki>foo</nowiki></indicator>
20952 <indicator name="07"> Preformatted</indicator>
20953 <indicator name="08"><div>Broken tag</indicator>
20954 <indicator name="09">{| class=wikitable
20955 | cell
20956 |}</indicator>
20957 <indicator name="10">Two
20958
20959 paragraphs</indicator>
20960 !! html
20961 01=hello world
20962 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20963 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" />
20964 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>
20965 05=<ul><li> foo</li>
20966 <li> bar</li></ul>
20967
20968 06=foo
20969 07=<pre>Preformatted
20970 </pre>
20971 08=<div>Broken tag</div>
20972
20973 09=<table class="wikitable">
20974 <tr>
20975 <td> cell
20976 </td></tr></table>
20977
20978 10=<p>Two
20979 </p><p>paragraphs
20980 </p>
20981 <p><br />
20982 </p><p><br />
20983 </p><p><br />
20984 </p><p><br />
20985 </p><p><br />
20986 </p>
20987 !! end
20988
20989 !! test
20990 preload: check <noinclude> and <includeonly>
20991 !! options
20992 preload
20993 !! wikitext
20994 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20995 !! html/php
20996 Hello kind world.
20997 !! end
20998
20999 !! test
21000 preload: check <onlyinclude>
21001 !! options
21002 preload
21003 !! wikitext
21004 Goodbye <onlyinclude>Hello world</onlyinclude>
21005 !! html/php
21006 Hello world
21007 !! end
21008
21009 !! test
21010 preload: can pass tags through if we want to
21011 !! options
21012 preload
21013 !! wikitext
21014 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21015 !! html/php
21016 <includeonly>Hello world</includeonly>
21017 !! end
21018
21019 !! test
21020 preload: check that it doesn't try to do tricks
21021 !! options
21022 preload
21023 !! wikitext
21024 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21025 !! html/php
21026 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21027 !! end
21028
21029 !! test
21030 Play a bit with r67090 and bug 3158
21031 !! wikitext
21032 <div style="width:50% !important">&nbsp;</div>
21033 <div style="width:50%&nbsp;!important">&nbsp;</div>
21034 <div style="width:50%&#160;!important">&nbsp;</div>
21035 <div style="border : solid;">&nbsp;</div>
21036 !! html/php
21037 <div style="width:50% !important">&#160;</div>
21038 <div style="width:50% !important">&#160;</div>
21039 <div style="width:50% !important">&#160;</div>
21040 <div style="border&#160;: solid;">&#160;</div>
21041
21042 !! html/parsoid
21043 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21044 <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>
21045 <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>
21046 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21047
21048 !! end
21049
21050 !! test
21051 HTML5 data attributes
21052 !! wikitext
21053 <span data-foo="bar">Baz</span>
21054 <p data-abc-def_hij="">Quuz</p>
21055 !! html/php
21056 <p><span data-foo="bar">Baz</span>
21057 </p>
21058 <p data-abc-def_hij="">Quuz</p>
21059
21060 !! html/parsoid
21061 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21062 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21063 !! end
21064
21065 !! test
21066 Strip reserved data attributes
21067 !! wikitext
21068 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21069 !! html/php
21070 <div data-ok="fred">d</div>
21071
21072 !! html/parsoid
21073 <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>
21074 !! end
21075
21076 !! test
21077 percent-encoding and + signs in internal links (Bug 26410)
21078 !! wikitext
21079 [[User:+%]] [[Page+title%]]
21080 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21081 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21082 [[%33%45]] [[%33%45+]]
21083 !! html/php
21084 <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>
21085 <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>
21086 <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>
21087 <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>
21088 </p>
21089 !! html/parsoid
21090 <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>
21091 <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>
21092 <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>
21093 <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>
21094 !! end
21095
21096 !! test
21097 Special characters in embedded file links (bug 27679)
21098 !! wikitext
21099 [[File:Contains & ampersand.jpg]]
21100 [[File:Does not exist.jpg|Title with & ampersand]]
21101 !! html/php
21102 <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>
21103 <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>
21104 </p>
21105 !! html/parsoid
21106 <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>
21107 <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>
21108 !! end
21109
21110 !! test
21111 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21112 !! wikitext
21113 Text&apos;s been normalized?
21114 !! html
21115 <p>Text&#39;s been normalized?
21116 </p>
21117 !! end
21118
21119 !! test
21120 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21121 !! wikitext
21122 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21123 !! html
21124 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21125 </p>
21126 !! end
21127
21128 !! test
21129 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21130 !! wikitext
21131 [http://www.example.org/ ideograms]
21132 !! html
21133 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21134 </p>
21135 !! end
21136
21137 !! test
21138 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21139 !! wikitext
21140 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21141 !! html
21142 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21143 </p>
21144 !! end
21145
21146 !! article
21147 Mediawiki:loop1
21148 !! text
21149 {{Identical|A}}
21150 !! endarticle
21151
21152 !! article
21153 Mediawiki:loop2
21154 !! text
21155 {{Identical|B}}
21156 !! endarticle
21157
21158 !! article
21159 Template:Identical
21160 !! text
21161 {{int:loop1}}
21162 {{int:loop2}}
21163 !! endarticle
21164
21165 !! test
21166 Bug 31098 Template which includes system messages which includes the template
21167 !! wikitext
21168 {{Identical}}
21169 !! html
21170 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21171 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21172 </p>
21173 !! end
21174
21175 !! test
21176 Bug31490 Turkish: ucfirst 'blah'
21177 !! options
21178 language=tr
21179 !! wikitext
21180 {{ucfirst:blah}}
21181 !! html
21182 <p>Blah
21183 </p>
21184 !! end
21185
21186 !! test
21187 Bug31490 Turkish: ucfirst 'ix'
21188 !! options
21189 language=tr
21190 !! wikitext
21191 {{ucfirst:ix}}
21192 !! html
21193 <p>İx
21194 </p>
21195 !! end
21196
21197 !! test
21198 Bug31490 Turkish: lcfirst 'BLAH'
21199 !! options
21200 language=tr
21201 !! wikitext
21202 {{lcfirst:BLAH}}
21203 !! html
21204 <p>bLAH
21205 </p>
21206 !! end
21207
21208 !! test
21209 Bug31490 Turkish: ucfırst (with a dotless i)
21210 !! options
21211 language=tr
21212 !! wikitext
21213 {{ucfırst:blah}}
21214 !! html
21215 <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>
21216 </p>
21217 !! end
21218
21219 !! test
21220 Bug31490 ucfırst (with a dotless i) with English language
21221 !! options
21222 language=en
21223 !! wikitext
21224 {{ucfırst:blah}}
21225 !! html
21226 <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>
21227 </p>
21228 !! end
21229
21230 !! test
21231 Bug 26375: TOC with italics
21232 !! options
21233 title=[[Main Page]]
21234 !! wikitext
21235 __TOC__
21236 == ''Lost'' episodes ==
21237 !! html
21238 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21239 <ul>
21240 <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>
21241 </ul>
21242 </div>
21243
21244 <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>
21245
21246 !! end
21247
21248 !! test
21249 Bug 26375: TOC with bold
21250 !! options
21251 title=[[Main Page]]
21252 !! wikitext
21253 __TOC__
21254 == '''should be bold''' then normal text ==
21255 !! html
21256 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21257 <ul>
21258 <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>
21259 </ul>
21260 </div>
21261
21262 <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>
21263
21264 !! end
21265
21266 !! test
21267 Bug 33845: Headings become cursive in TOC when they contain an image
21268 !! options
21269 title=[[Main Page]]
21270 !! wikitext
21271 __TOC__
21272 == Image [[Image:foobar.jpg]] ==
21273 !! html
21274 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21275 <ul>
21276 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21277 </ul>
21278 </div>
21279
21280 <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>
21281
21282 !! end
21283
21284 !! test
21285 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21286 !! options
21287 title=[[Main Page]]
21288 !! wikitext
21289 __TOC__
21290 == <blockquote>Quote</blockquote> ==
21291 !! html
21292 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21293 <ul>
21294 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21295 </ul>
21296 </div>
21297
21298 <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>
21299
21300 !! html+tidy
21301 <p></p>
21302 <div id="toc" class="toc">
21303 <div id="toctitle">
21304 <h2>Contents</h2>
21305 </div>
21306 <ul>
21307 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21308 </ul>
21309 </div>
21310 <p></p>
21311 <h2><span class="mw-headline" id="Quote"></span></h2>
21312 <blockquote>
21313 <p><span class="mw-headline" id="Quote">Quote</span></p>
21314 </blockquote>
21315 <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>
21316 !! end
21317
21318 !! test
21319 Unclosed tags in TOC
21320 !! options
21321 title=[[Main Page]]
21322 !! wikitext
21323 __TOC__
21324 == Proof: 2 < 3 ==
21325 <small>Hanc marginis exiguitas non caperet.</small>
21326 QED
21327 !! html
21328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21329 <ul>
21330 <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>
21331 </ul>
21332 </div>
21333
21334 <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>
21335 <p><small>Hanc marginis exiguitas non caperet.</small>
21336 QED
21337 </p>
21338 !! end
21339
21340 !! test
21341 Multiple tags in TOC
21342 !! wikitext
21343 __TOC__
21344 == <i>Foo</i> <b>Bar</b> ==
21345
21346 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21347 !! html
21348 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21349 <ul>
21350 <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>
21351 <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>
21352 </ul>
21353 </div>
21354
21355 <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>
21356 <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>
21357
21358 !! html+tidy
21359 <p></p>
21360 <div id="toc" class="toc">
21361 <div id="toctitle">
21362 <h2>Contents</h2>
21363 </div>
21364 <ul>
21365 <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>
21366 <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>
21367 </ul>
21368 </div>
21369 <p></p>
21370 <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>
21371 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21372 <blockquote>
21373 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21374 </blockquote>
21375 <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>
21376 !! end
21377
21378 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21379 # html5 tag parsing.
21380 !! test
21381 Tags with parameters in TOC
21382 !! options
21383 parsoid=wt2html
21384 !! wikitext
21385 __TOC__
21386 == <sup class="in-h2">Hello</sup> ==
21387
21388 == <sup class="a > b">Evilbye</sup> ==
21389 !! html/php
21390 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21391 <ul>
21392 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21393 <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>
21394 </ul>
21395 </div>
21396
21397 <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>
21398 <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>
21399
21400 !! html/parsoid
21401 <meta property="mw:PageProp/toc" />
21402 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21403
21404 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21405 !! end
21406
21407 !! test
21408 span tags with directionality in TOC
21409 !! wikitext
21410 __TOC__
21411 == <span dir="ltr">C++</span> ==
21412
21413 == <span dir="rtl">זבנג!</span> ==
21414
21415 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21416
21417 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21418
21419 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21420 !! html
21421 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21422 <ul>
21423 <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>
21424 <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>
21425 <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>
21426 <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>
21427 <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>
21428 </ul>
21429 </div>
21430
21431 <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>
21432 <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>
21433 <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>
21434 <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>
21435 <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>
21436
21437 !! end
21438
21439 !! test
21440 Bug 72884: bdi element in ToC
21441 !! wikitext
21442 __TOC__
21443 == <bdi>test</bdi> ==
21444 !! html
21445 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21446 <ul>
21447 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21448 </ul>
21449 </div>
21450
21451 <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>
21452
21453 !! end
21454
21455 # Note that the html output does not have the <p></p>, but the
21456 # html+tidy output *does*. This is because the empty <p></p> is
21457 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21458 !! test
21459 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21460 !! wikitext
21461 __TOC__
21462 == x ==
21463 !! html
21464 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21465 <ul>
21466 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21467 </ul>
21468 </div>
21469
21470 <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>
21471
21472 !! html+tidy
21473 <p></p>
21474 <div id="toc" class="toc">
21475 <div id="toctitle">
21476 <h2>Contents</h2>
21477 </div>
21478 <ul>
21479 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21480 </ul>
21481 </div>
21482 <p></p>
21483 <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>
21484 !! end
21485
21486 !! article
21487 MediaWiki:Bug32057
21488 !! text
21489 == {{int:headline_sample}} ==
21490 !! endarticle
21491
21492 !! test
21493 Bug 32057: Title needed when expanding <h> nodes.
21494 !! options
21495 title=[[Main Page]]
21496 !! wikitext
21497 {{int:Bug32057}}
21498 !! html
21499 <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>
21500
21501 !! end
21502
21503 !! test
21504 Strip marker in urlencode
21505 !! wikitext
21506 {{urlencode:x<nowiki/>y}}
21507 {{urlencode:x<nowiki/>y|wiki}}
21508 {{urlencode:x<nowiki/>y|path}}
21509 {{urlencode:x<pre id="one">two</pre>y}}
21510 !! html
21511 <p>xy
21512 xy
21513 xy
21514 xy
21515 </p>
21516 !! end
21517
21518 !! test
21519 Strip marker in lc
21520 !! wikitext
21521 {{lc:x<nowiki/>y}}
21522 !! html
21523 <p>xy
21524 </p>
21525 !! end
21526
21527 !! test
21528 Strip marker in uc
21529 !! wikitext
21530 {{uc:x<nowiki/>y}}
21531 !! html
21532 <p>XY
21533 </p>
21534 !! end
21535
21536 !! test
21537 Strip marker in formatNum
21538 !! wikitext
21539 {{formatnum:1<nowiki/>2}}
21540 {{formatnum:1<nowiki/>2|R}}
21541 !! html
21542 <p>12
21543 12
21544 </p>
21545 !! end
21546
21547 !! test
21548 Check noCommafy in formatNum
21549 !! options
21550 language=be-tarask
21551 !! wikitext
21552 {{formatnum:123456.78}}
21553 {{formatnum:123456.78|NOSEP}}
21554 !! html
21555 <p>123 456,78
21556 123456.78
21557 </p>
21558 !! end
21559
21560 !! test
21561 Wrong option for formatNum (bug 56199)
21562 !! wikitext
21563 {{formatnum:1,234.56|Random}}
21564 {{formatnum:1,234.56|EVERYTHING}}
21565 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21566 !! html
21567 <p>1,234.56
21568 1,234.56
21569 1,234.56
21570 </p>
21571 !! end
21572
21573 !! test
21574 Strip marker in grammar
21575 !! options
21576 language=fi
21577 !! wikitext
21578 {{grammar:elative|foo<nowiki/>bar}}
21579 !! html
21580 <p>foobarista
21581 </p>
21582 !! end
21583
21584 !! test
21585 Strip marker in padleft
21586 !! wikitext
21587 {{padleft:|2|x<nowiki/>y}}
21588 !! html
21589 <p>xy
21590 </p>
21591 !! end
21592
21593 !! test
21594 Strip marker in padright
21595 !! wikitext
21596 {{padright:|2|x<nowiki/>y}}
21597 !! html
21598 <p>xy
21599 </p>
21600 !! end
21601
21602 !! test
21603 Strip marker in anchorencode
21604 !! wikitext
21605 {{anchorencode:x<nowiki/>y}}
21606 !! html
21607 <p>xy
21608 </p>
21609 !! end
21610
21611 !! test
21612 nowiki inside link inside heading (bug 18295)
21613 !! wikitext
21614 ==[[foo|x<nowiki>y</nowiki>z]]==
21615 !! html
21616 <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>
21617
21618 !! end
21619
21620 !! test
21621 new support for bdi element (bug 31817)
21622 !! wikitext
21623 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21624 !! html
21625 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21626
21627 !!end
21628
21629 !! test
21630 Ignore pipe between table row attributes
21631 !! wikitext
21632 {|
21633 | quux
21634 |- id=foo | style='color: red'
21635 | bar
21636 |}
21637 !! html
21638 <table>
21639 <tr>
21640 <td> quux
21641 </td></tr>
21642 <tr id="foo" style="color: red">
21643 <td> bar
21644 </td></tr></table>
21645
21646 !! end
21647
21648 !!test
21649 Gallery override link with WikiLink (bug 34852)
21650 !! wikitext
21651 <gallery>
21652 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21653 </gallery>
21654 !! html
21655 <ul class="gallery mw-gallery-traditional">
21656 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21657 <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>
21658 <div class="gallerytext">
21659 <p>caption
21660 </p>
21661 </div>
21662 </div></li>
21663 </ul>
21664
21665 !! end
21666
21667 !!test
21668 Gallery override link with absolute external link (bug 34852)
21669 !! wikitext
21670 <gallery>
21671 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21672 </gallery>
21673 !! html
21674 <ul class="gallery mw-gallery-traditional">
21675 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21676 <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>
21677 <div class="gallerytext">
21678 <p>caption
21679 </p>
21680 </div>
21681 </div></li>
21682 </ul>
21683
21684 !! end
21685
21686 !!test
21687 Gallery override link with malicious javascript (bug 34852)
21688 !! wikitext
21689 <gallery>
21690 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21691 </gallery>
21692 !! html
21693 <ul class="gallery mw-gallery-traditional">
21694 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21695 <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>
21696 <div class="gallerytext">
21697 <p>caption
21698 </p>
21699 </div>
21700 </div></li>
21701 </ul>
21702
21703 !! end
21704
21705 !!test
21706 Gallery with invalid title as link (bug 43964)
21707 !! wikitext
21708 <gallery>
21709 File:foobar.jpg|link=<
21710 </gallery>
21711 !! html
21712 <ul class="gallery mw-gallery-traditional">
21713 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21714 <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>
21715 <div class="gallerytext">
21716 </div>
21717 </div></li>
21718 </ul>
21719
21720 !! end
21721
21722 !!test
21723 Language parser function
21724 !! wikitext
21725 {{#language:ar}}
21726 !! html
21727 <p>العربية
21728 </p>
21729 !! end
21730
21731 !!test
21732 Padleft and padright as substr
21733 !! wikitext
21734 {{padleft:|3|abcde}}
21735 {{padright:|3|abcde}}
21736 !! html
21737 <p>abc
21738 abc
21739 </p>
21740 !! end
21741
21742 !!test
21743 Special parser function
21744 !! wikitext
21745 {{#special:RandomPage}}
21746 {{#special:BaDtItLe}}
21747 {{#special:Foobar}}
21748 !! html
21749 <p>Special:Random
21750 Special:Badtitle
21751 Special:Foobar
21752 </p>
21753 !! end
21754
21755 !!test
21756 Bug 34939 - Case insensitive link parsing ([HttP://])
21757 !! wikitext
21758 [HttP://MediaWiki.Org/]
21759 !! html/php
21760 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21761 </p>
21762 !! html/parsoid
21763 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21764 !! end
21765
21766 !!test
21767 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21768 !! wikitext
21769 [HttP://MediaWiki.Org/ MediaWiki]
21770 !! html
21771 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21772 </p>
21773 !! end
21774
21775 !!test
21776 Bug 34939 - Case insensitive link parsing (HttP://)
21777 !! wikitext
21778 HttP://MediaWiki.Org/
21779 !! html/php
21780 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21781 </p>
21782 !! html/parsoid
21783 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21784 !! end
21785
21786 !!test
21787 Disable TOC
21788 !! options
21789 notoc
21790 !! wikitext
21791 Lead
21792 == Section 1 ==
21793 == Section 2 ==
21794 == Section 3 ==
21795 == Section 4 ==
21796 == Section 5 ==
21797 !! html
21798 <p>Lead
21799 </p>
21800
21801 <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>
21802 <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>
21803 <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>
21804 <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>
21805 <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>
21806
21807 !! end
21808
21809
21810 ###
21811 ### Parsoid-specific tests
21812 ### Parsoid-PHP parser incompatibilities
21813 ###
21814 !!test
21815 1. SOL-sensitive wikitext tokens as template-args
21816 !!options
21817 parsoid=wt2html,wt2wt
21818 !! wikitext
21819 {{echo|*a}}
21820 {{echo|#a}}
21821 {{echo|:a}}
21822 !! html
21823 <span about="#mwt1" typeof="mw:Transclusion">
21824 </span><ul about="#mwt1"><li>a</li>
21825 </ul>
21826 <span about="#mwt2" typeof="mw:Transclusion">
21827 </span><ol about="#mwt2"><li>a</li>
21828 </ol>
21829 <span about="#mwt3" typeof="mw:Transclusion">
21830 </span><dl about="#mwt3"><dd>a</dd>
21831 </dl>
21832 !!end
21833
21834 #### -----------------------------------------------------------------
21835 #### Parsoid-specific functionality tests
21836 #### -----------------------------------------------------------------
21837
21838 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21839 # We know wt2wt will fail, but we expect selser to pass.
21840 # Due to the nature of our testing, wt2wt and selser tests will enter the
21841 # blacklist and we'll catch selser regressions based on changes to the
21842 # blacklist entries for selser tests.
21843 !! test
21844 1. Bad treebuilder fixup of formatting elt is cleaned up
21845 !! options
21846 parsoid=wt2html,wt2wt
21847 !! wikitext
21848 {|
21849 |
21850 <small>
21851 [[Image:Foobar.jpg|right|Test]]
21852 </small>
21853 |}
21854 !! html/parsoid
21855 <table>
21856 <tbody><tr><td>
21857 <small>
21858 <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>
21859 </small>
21860 </td></tr>
21861 </tbody></table>
21862 !! end
21863
21864 !! test
21865 2. Bad treebuilder fixup of formatting elt is cleaned up
21866 !! options
21867 parsoid=wt2html,wt2wt
21868 !! wikitext
21869 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21870
21871 <small>[[Image:Foobar.jpg|right|300px]]</small>
21872 !! html/parsoid
21873
21874 <p><b>foo</b></p>
21875 <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>
21876 <p><b>bar</b></p>
21877 <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>
21878 !! end
21879
21880 !! test
21881 3. Bad treebuilder fixup of formatting elt is cleaned up
21882 !! options
21883 parsoid=wt2html,wt2wt
21884 !! wikitext
21885 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21886 !! html/parsoid
21887 <p><small><b>foo</b></small></p>
21888 <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>
21889 <p><small><b>bar</b></small></p>
21890 !! end
21891
21892 !! test
21893 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21894 !! options
21895 parsoid=wt2html,wt2wt
21896 !! wikitext
21897 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21898 !! html/parsoid
21899 <p><b><small></small></b></p>
21900 <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>
21901 <p></p>
21902 !! end
21903
21904 #### ----------------------------------------------------------------
21905 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21906 #### tags. Parsoid's output for these tags differs from that of the
21907 #### PHP parser.
21908 #### ----------------------------------------------------------------
21909
21910 !!test
21911 Ref: 1. ref-location should be replaced with an index span
21912 !! wikitext
21913 A <ref>foo</ref>
21914 B <ref name="x">foo</ref>
21915 C <ref name="y" />
21916 <references />
21917 !! html/parsoid
21918 <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>
21919 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>
21920 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>
21921 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21922 <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>
21923 <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>
21924 <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>
21925 </ol>
21926 !!end
21927
21928 !!test
21929 Ref: 2. ref-tags with identical names should all get the same index
21930 !! wikitext
21931 A <ref name="x">foo</ref>
21932 B <ref name="x" />
21933 <references />
21934 !! html/parsoid
21935 <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>
21936 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>
21937 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21938 <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>
21939 </ol>
21940 !!end
21941
21942 !!test
21943 Ref: 3. spaces in ref-names should be ignored
21944 !! wikitext
21945 A <ref name="x">foo</ref>
21946 B <ref name=" x " />
21947 C <ref name= x />
21948 <references />
21949 !! html/parsoid
21950 <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>
21951 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>
21952 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>
21953 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21954 <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>
21955 </ol>
21956 !!end
21957
21958 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21959 !!test
21960 Ref: 4. 'constructor' should be accepted as a valid ref-name
21961 !! wikitext
21962 A <ref name="constructor">foo</ref>
21963 <references />
21964 !! html/parsoid
21965 <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>
21966 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21967 <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>
21968 </ol>
21969 !!end
21970
21971 !!test
21972 Ref: 5. body should accept generic wikitext
21973 !! wikitext
21974 A <ref>
21975 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21976 </ref>
21977
21978 <references />
21979 !! html/parsoid
21980 <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>
21981
21982 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21983 <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>
21984 </span></li>
21985 </ol>
21986 !!end
21987
21988 !!test
21989 Ref: 6. indent-pres should not be output in ref-body
21990 !! wikitext
21991 A <ref>
21992 foo
21993 bar
21994 baz
21995 </ref>
21996
21997 <references />
21998 !! html/parsoid
21999 <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>
22000
22001 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22002 <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
22003 bar
22004 baz
22005 </span></li>
22006 </ol>
22007 !!end
22008
22009 !!test
22010 Ref: 7. No p-wrapping in ref-body
22011 !! wikitext
22012 A <ref>
22013 foo
22014
22015 bar
22016
22017
22018 baz
22019
22020
22021
22022 booz
22023 </ref>
22024
22025 <references />
22026 !! html/parsoid
22027 <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>
22028
22029 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22030 <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
22031
22032 bar
22033
22034
22035 baz
22036
22037
22038
22039 booz
22040 </span></li>
22041 </ol>
22042 !!end
22043
22044 !!test
22045 Ref: 8. transclusion wikitext has lower precedence
22046 !! wikitext
22047 A <ref> foo {{echo|</ref> B C}}
22048
22049 <references />
22050 !! html/parsoid
22051 <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>
22052 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22053 <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>
22054 </ol>
22055 !!end
22056
22057 !!test
22058 Ref: 9. unclosed comments should not leak out of ref-body
22059 !! wikitext
22060 A <ref> foo <!--</ref> B C
22061 <references />
22062 !! html/parsoid
22063 <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>
22064 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22065 <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>
22066 </ol>
22067 !!end
22068
22069 !!test
22070 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22071 !! wikitext
22072 A <ref> <b> foo </ref> B C
22073
22074 <references />
22075 !! html/parsoid
22076 <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>
22077
22078
22079 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22080 <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>
22081 </ol>
22082 !!end
22083
22084 !!test
22085 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22086 !! wikitext
22087 A <ref>foo</ref> B
22088 C <ref>bar</ref> D
22089 <references />
22090 !! html/parsoid
22091 <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
22092 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>
22093 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22094 <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>
22095 <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>
22096 </ol>
22097 !!end
22098
22099 !!test
22100 Ref: 12. ref-tags act as trailing newline migration barrier
22101 !! wikitext
22102 <!--the newline at the end of this line moves out of the p tag-->a
22103
22104 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22105 <ref />
22106
22107 c
22108 <references />
22109 !! html/parsoid
22110 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22111
22112
22113 <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>
22114 <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>
22115
22116 <p>c</p>
22117 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22118 <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>
22119 <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>
22120 !!end
22121
22122 !!test
22123 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22124 !! wikitext
22125 <ref>foo</ref> A
22126 <ref>bar
22127 </ref> B
22128 <references />
22129 !! html/parsoid
22130 <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
22131 <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>
22132 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22133 <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>
22134 <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
22135 </span></li>
22136 </ol>
22137 !!end
22138
22139 !!test
22140 Ref: 14. A nested ref-tag should be emitted as plain text
22141 !! wikitext
22142 <ref>foo <ref>bar</ref> baz</ref>
22143
22144 <references />
22145 !! html/parsoid
22146 <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>
22147 </p>
22148 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" 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">foo &lt;ref>bar&lt;/ref> baz</span></li>
22150 </ol>
22151 !!end
22152
22153 !!test
22154 Ref: 15. ref-tags with identical names should get identical indexes
22155 !! wikitext
22156 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22157 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22158
22159 <references />
22160 !! html/parsoid
22161 <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>
22162 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>
22163
22164 <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>
22165 </ol>
22166 !!end
22167
22168 ## We don't bother wt2wt-ing non-standard whitespace
22169 !!test
22170 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22171 !!options
22172 parsoid=wt2html
22173 !! wikitext
22174 A <ref >foo</ref >
22175
22176 <references />
22177 !! html/parsoid
22178 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22179 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" 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</span></li></ol>
22181 !!end
22182
22183 !!test
22184 Ref: 17. Generate valid HTML5 id/about attributes
22185 !!wikitext
22186 <ref name="a b">foo</ref>
22187
22188 <references />
22189 !!html/parsoid
22190 <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>
22191 </p>
22192
22193 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22194 <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>
22195 </ol>
22196 !!end
22197
22198 !!test
22199 Ref: 18. T58916: Extension attributes should be parsed as plain text
22200 !!wikitext
22201 <ref name="{{echo|a}}">foo</ref>
22202
22203 <references />
22204 !!html/parsoid
22205 <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>
22206 </p>
22207
22208 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22209 <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>
22210 </ol>
22211 !!end
22212
22213 !!test
22214 Ref: 19. ref-tags with identical name encodings should get identical indexes
22215 !! wikitext
22216 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22217
22218 <references />
22219 !! html/parsoid
22220 <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>
22221 </p>
22222 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22223 <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>
22224 </ol>
22225 !!end
22226
22227 !!test
22228 Ref: 20. ref-tags with identical names but different content should keep it
22229 !! wikitext
22230 A <ref name="foo">Foo one</ref>
22231 B <ref name="foo">Foo two</ref>
22232 C <ref name="foo" />
22233
22234 <references />
22235 !! html/parsoid
22236 <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>
22237 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>
22238 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>
22239
22240 <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>
22241 </ol>
22242 !!end
22243
22244 !!test
22245 References: 1. references tag without any refs should be handled properly
22246 !! wikitext
22247 <references />
22248 !! html/parsoid
22249 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22250 !!end
22251
22252 !!test
22253 References: 2. references tag with group only outputs references from that group
22254 !! wikitext
22255 A <ref group="a">foo</ref>
22256 B <ref group="b">bar</ref>
22257 C <ref>baz</ref>
22258
22259 <references group="a" />
22260 <references />
22261 <references group="b" />
22262 !! html/parsoid
22263 <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>
22264 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>
22265 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>
22266
22267 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22268 <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>
22269 </ol>
22270 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22271 <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>
22272 </ol>
22273 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22274 <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>
22275 </ol>
22276 !!end
22277
22278 !!test
22279 References: 3. ref list should be cleared after processing references
22280 !! wikitext
22281 A <ref>foo</ref>
22282
22283 <references />
22284
22285 B <ref>bar</ref>
22286
22287 <references />
22288 !! html/parsoid
22289 <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>
22290
22291 <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>
22292 </ol>
22293
22294 <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>
22295
22296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22297 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22298 </ol>
22299 !!end
22300
22301 !!test
22302 References: 4. only referenced group should be cleared after processing references
22303 !! wikitext
22304 A <ref group="a">afoo</ref>
22305 B <ref>bfoo</ref>
22306
22307 <references group="a" />
22308
22309 C <ref>cfoo</ref>
22310
22311 <references />
22312 !! html/parsoid
22313 <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>
22314 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>
22315
22316 <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>
22317 </ol>
22318
22319 <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>
22320
22321 <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>
22322 </ol>
22323 !!end
22324
22325 ## Don't expect this to rt since we're dropping content
22326 !! test
22327 References: 5. ref tags in references should be processed while ignoring all other content
22328 !! options
22329 parsoid=wt2html,html2html
22330 !! wikitext
22331 A <ref name="a" />
22332 B <ref name="b">bar</ref>
22333
22334 <references>
22335 <ref name="a">foo</ref>
22336 This should just get lost.
22337 </references>
22338 !! html/parsoid
22339 <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>
22340 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>
22341
22342
22343 <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>
22344 </ol>
22345 !! end
22346
22347 !! test
22348 References: 6. <references /> from a transclusion
22349 !! wikitext
22350 <ref>Foo</ref> {{echo|<references />}}
22351 !! html/parsoid
22352 <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>
22353 </ol>
22354 !! end
22355
22356 !! test
22357 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22358 !! wikitext
22359 A <ref>foo bar for a</ref>
22360 B <ref group="X" name="b" />
22361
22362 <references />
22363
22364 <references group="X">
22365 <ref name="b">foo</ref>
22366 </references>
22367 !! html/parsoid
22368 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22369 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>
22370 </p>
22371
22372 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22373 <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>
22374 </ol>
22375
22376 <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"}}'>
22377 <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>
22378 </ol>
22379 !! end
22380
22381 !! test
22382 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22383 !! wikitext
22384 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22385 <references />
22386 !! html/parsoid
22387 <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>
22388 <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>
22389 </ol>
22390 !!end
22391
22392 # This test only works in wt2html now as the <references /> are always generated
22393 # unless selser is active. Once T72722 is fixed, we should add a changes test
22394 # here to ensure that unrelated changes don't add the new <references />
22395 # when selser is active.
22396 !! test
22397 References: 9. Generate missing references list at the end
22398 !! wikitext
22399 A <ref>foo</ref>
22400 B <ref group="inexistent">bar</ref>
22401 !! html/parsoid
22402 <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>
22403 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
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</span></li>
22405 </ol>
22406 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22407 <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>
22408 </ol>
22409 !! end
22410
22411 !! test
22412 References: 10. New <references/> shouldn't be added for unrelated edits.
22413 !! options
22414 parsoid={
22415 "modes": ["selser"],
22416 "changes": [["#x", "remove"]],
22417 "selser": "noauto"
22418 }
22419 !! wikitext
22420 Unrelated text<span id="x"> that's going to disappear</span>.
22421 A <ref>foo</ref>
22422 !! wikitext/edited
22423 Unrelated text.
22424 A <ref>foo</ref>
22425 !!end
22426
22427 !! test
22428 Entities in ref name
22429 !! wikitext
22430 <ref name="test &amp; me">hi</ref>
22431 <references />
22432 !! html/parsoid
22433 <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>
22434 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22435 <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>
22436 </ol>
22437 !! end
22438
22439 ## The output here may look funny, but it's what the php parser will do. The
22440 ## unclosed references tag becomes escaped text, and then a new references
22441 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22442 ## nowiki tags, and the auto-generated references tag is only dropped in
22443 ## rtTestMode.
22444 !! test
22445 Generate references for unclosed references tag
22446 !! options
22447 parsoid=wt2html
22448 !! wikitext
22449 a<ref>foo</ref>
22450
22451 <references>
22452 !! html/parsoid
22453 <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>
22454
22455 <p>&lt;references></p>
22456 <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>
22457 !! end
22458
22459 !! test
22460 New reference serializes on its own line
22461 !! options
22462 parsoid=wt2wt,html2wt
22463 !! wikitext
22464 foo
22465 <references />
22466 !! html/parsoid
22467 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22468 !! end
22469
22470 #### ----------------------------------------------------------------
22471 #### Parsoid-only testing of Parsoid's impl of LST
22472 #### Not implemented yet, see
22473 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22474 #### ----------------------------------------------------------------
22475
22476 !! test
22477 LST Sections: 1. Simple section start and end
22478 !! options
22479 parsoid={ "suppressErrors": true }
22480 !! wikitext
22481 <section begin="2011-05-16" />
22482 <section end="2014-04-10 (MW 1.23wmf22)" />
22483 !! html/parsoid
22484 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22485 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22486 !! end
22487
22488 #--------- Test stripping of empty nodes in template content ----------
22489 !!test
22490 Empty LI and TR nodes should be stripped from template content
22491 !!wikitext
22492 {{EmptyLITest}}
22493 {{EmptyTRTest}}
22494 !!html/parsoid
22495 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22496 <li>a</li>
22497 <li>b</li>
22498 </ul>
22499 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22500 <tbody>
22501 <tr>
22502 <td>foo</td>
22503 </tr>
22504 <tr>
22505 <td>bar</td>
22506 </tr>
22507 </tbody>
22508 </table>
22509 !!end
22510
22511 !!test
22512 Empty LI and TR nodes should not be stripped from top-level content
22513 !!wikitext
22514 * a
22515 *
22516 * b
22517 {|
22518 |-
22519 |-
22520 |foo
22521 |}
22522 !!html/parsoid
22523 <ul>
22524 <li> a</li>
22525 <li></li>
22526 <li> b</li>
22527 </ul>
22528 <table>
22529 <tbody>
22530 <tr></tr>
22531 <tr>
22532 <td>foo</td>
22533 </tr>
22534 </tbody>
22535 </table>
22536 !!end
22537
22538 !!test
22539 Empty TR nodes should not be stripped if they have any attributes set
22540 !!wikitext
22541 {{EmptyTRWithHTMLAttrTest}}
22542 !!html/parsoid
22543 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22544 <tr align="center"></tr>
22545 <tr><td>foo</td></tr>
22546 <tr align="center"></tr>
22547 <tr><td>bar</td></tr>
22548 </table>
22549 !!end
22550
22551 #### ----------------------------------------------------------------
22552 #### The following section of tests are primarily to test
22553 #### wikitext escaping capabilities of Parsoid. Given that
22554 #### escaping can be done any number of ways, the wikitext (input)
22555 #### is always adjusted to reflect how Parsoid adds nowiki
22556 #### escape tags.
22557 ####
22558 #### We are marking several tests as parsoid-only since the
22559 #### HTML in the result section is different from what the
22560 #### PHP parser generates for it.
22561 #### ----------------------------------------------------------------
22562
22563
22564 #### --------------- Headings ---------------
22565 #### 0. Unnested
22566 #### 1. Nested inside html <h1>=foo=</h1>
22567 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22568 #### 3. Nested inside html with wikitext split by html tags
22569 #### 4. No escape needed
22570 #### 5. Empty headings <h1></h1>
22571 #### 6. Heading chars in SOL context
22572 #### ----------------------------------------
22573 !! test
22574 Headings: 0. Unnested
22575 !! options
22576 parsoid=html2wt
22577 !! html/parsoid
22578 <p>=foo=</p>
22579
22580 <p> =foo=
22581 <!--cmt-->
22582 =foo=</p>
22583
22584 <p>=foo<i>a</i>=</p>
22585 !! wikitext
22586 <nowiki>=foo=</nowiki>
22587
22588 <nowiki> </nowiki>=foo=
22589 <!--cmt-->
22590 <nowiki>=foo=</nowiki>
22591
22592 =foo''a''<nowiki>=</nowiki>
22593 !!end
22594
22595 # New headings and existing headings are handled differently
22596 !! test
22597 Headings: 1. Nested inside html
22598 !! options
22599 parsoid=html2wt
22600 !! html/parsoid
22601 <h1>=foo=</h1>
22602 <h2>=foo=</h2>
22603 <h3>=foo=</h3>
22604
22605 <h1 data-parsoid=''>=foo=</h1>
22606 <h2 data-parsoid=''>=foo=</h2>
22607 <h3 data-parsoid=''>=foo=</h3>
22608 <h4 data-parsoid=''>=foo=</h4>
22609 <h5 data-parsoid=''>=foo=</h5>
22610 <h6 data-parsoid=''>=foo=</h6>
22611 !! wikitext
22612 = =foo= =
22613
22614 == =foo= ==
22615
22616 === =foo= ===
22617
22618 =<nowiki>=foo=</nowiki>=
22619 ==<nowiki>=foo=</nowiki>==
22620 ===<nowiki>=foo=</nowiki>===
22621 ====<nowiki>=foo=</nowiki>====
22622 =====<nowiki>=foo=</nowiki>=====
22623 ======<nowiki>=foo=</nowiki>======
22624
22625 !!end
22626
22627 !! test
22628 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22629 !! options
22630 parsoid=html2wt
22631 !! html/parsoid
22632 <h1>foo</h1>*bar
22633 <h1>foo</h1>=bar
22634 <h1>foo</h1>=bar=
22635 !! wikitext
22636 = foo =
22637 <nowiki>*</nowiki>bar
22638
22639 = foo =
22640 =bar
22641
22642 = foo =
22643 <nowiki>=bar=</nowiki>
22644 !!end
22645
22646 !! test
22647 Headings: 3. Nested inside html with wikitext split by html tags
22648 !! options
22649 parsoid=html2wt
22650 !! html/parsoid
22651 <h1>=<b>bold</b>foo=</h1>
22652 !! wikitext
22653 = ='''bold'''foo= =
22654 !!end
22655
22656 !! test
22657 Headings: 4a. No escaping needed (testing just h1 and h2)
22658 !! options
22659 parsoid=html2wt
22660 !! html/parsoid
22661 <h1>=foo</h1>
22662 <h1>foo=</h1>
22663 <h1> =foo= </h1>
22664 <h1>=foo= bar</h1>
22665 <h2>=foo</h2>
22666 <h2>foo=</h2>
22667 <h1>=</h1>
22668 <h1><i>=</i>foo=</h1>
22669 !! wikitext
22670 = =foo =
22671
22672 = foo= =
22673
22674 = =foo= =
22675
22676 = =foo= bar =
22677
22678 == =foo ==
22679
22680 == foo= ==
22681
22682 = = =
22683
22684 = ''=''foo= =
22685 !!end
22686
22687 !! test
22688 Headings: 4b. No escaping needed (inside p-tags)
22689 !! options
22690 parsoid=html2wt
22691 !! html/parsoid
22692 <p>===
22693 =foo= x
22694 =foo= <s></s>
22695 </p>
22696 !! wikitext
22697 ===
22698 =foo= x
22699 =foo= <s></s>
22700 !!end
22701
22702 !! test
22703 Headings: 5. Empty headings
22704 !! options
22705 parsoid=html2wt
22706 !! html/parsoid
22707 <h1 data-parsoid='{}'></h1>
22708
22709 <h2 data-parsoid='{}'></h2>
22710
22711 <h3 data-parsoid='{}'></h3>
22712
22713 <h4 data-parsoid='{}'></h4>
22714
22715 <h5 data-parsoid='{}'></h5>
22716
22717 <h6 data-parsoid='{}'></h6>
22718 !! wikitext
22719 =<nowiki/>=
22720
22721 ==<nowiki/>==
22722
22723 ===<nowiki/>===
22724
22725 ====<nowiki/>====
22726
22727 =====<nowiki/>=====
22728
22729 ======<nowiki/>======
22730 !!end
22731
22732 !! test
22733 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22734 !! options
22735 parsoid=html2wt
22736 !! html/parsoid
22737 <p>=a=</p>
22738
22739 <p>=a=</p>
22740
22741 <p>=a=</p>
22742 !! wikitext
22743 <nowiki>=a=</nowiki>
22744
22745 <nowiki>=a=</nowiki>
22746
22747 <nowiki>=a=</nowiki>
22748 !!end
22749
22750 !! test
22751 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22752 !! options
22753 parsoid=html2wt
22754 !! html/parsoid
22755 <p>=a=
22756 b</p>
22757
22758 <p>=a=
22759 b</p>
22760
22761 <p>=a=
22762 b</p>
22763 !! wikitext
22764 <nowiki>=a=</nowiki>
22765 b
22766
22767 <nowiki>=a=</nowiki>
22768 b
22769
22770 <nowiki>=a=</nowiki>
22771 b
22772 !!end
22773
22774 !! test
22775 Headings: 6c. Heading chars in SOL context (leading newline break)
22776 !! options
22777 parsoid=html2wt
22778 !! html/parsoid
22779 <p>a
22780 =b=</p>
22781 !! wikitext
22782 a
22783 <nowiki>=b=</nowiki>
22784 !!end
22785
22786 !! test
22787 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22788 !! options
22789 parsoid=html2wt
22790 !! html/parsoid
22791 <!--c0--><p>=a=</p>
22792
22793 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22794 !! wikitext
22795 <!--c0--><nowiki>=a=</nowiki>
22796
22797 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22798 !!end
22799
22800 !! test
22801 Headings: 6d. Heading chars in SOL context (No escaping needed)
22802 !! options
22803 parsoid=html2wt
22804 !! html/parsoid
22805 =a=<div>b</div>
22806 !! wikitext
22807 =a=<div>b</div>
22808 !!end
22809
22810 !! test
22811 Headings: 7. Insert a newline between new content and headings
22812 !! options
22813 parsoid=html2wt
22814 !! html/parsoid
22815 <h2>NEW</h2>
22816 <p>new</p>
22817 <h2 data-parsoid='{}'>A</h2>
22818 <p data-parsoid='{}'>a</p>
22819 !! wikitext
22820 == NEW ==
22821 new
22822
22823 ==A==
22824 a
22825
22826 !! end
22827
22828 #### --------------- Lists ---------------
22829 #### 0. Outside nests (*foo, etc.)
22830 #### 1. Nested inside html <ul><li>*foo</li></ul>
22831 #### 2. Inside definition lists
22832 #### 3. Only bullets at start should be escaped
22833 #### 4. No escapes needed
22834 #### 5. No unnecessary escapes
22835 #### 6. Escape bullets in SOL position
22836 #### 7. Escape bullets in a multi-line context
22837 #### ----------------------------------------
22838
22839 !! test
22840 Lists: 0. Outside nests
22841 !! options
22842 parsoid=html2wt
22843 !! html/parsoid
22844 <p>*foo</p>
22845
22846 <p>#foo</p>
22847
22848 <p>;Foo:bar</p>
22849 !! wikitext
22850 <nowiki>*</nowiki>foo
22851
22852 <nowiki>#</nowiki>foo
22853
22854 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22855 !!end
22856
22857 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22858 ## to test wikitext escaping, and insignificant whitespace diffs
22859 ## cause PHP parser tests to barf
22860 !! test
22861 Lists: 1. Nested inside html (No unnecessary escapes)
22862 !! options
22863 parsoid=html2wt
22864 !! html/parsoid
22865 <ul>
22866 <li>*foo</li>
22867 <li>#foo</li>
22868 <li>:foo</li>
22869 <li>;foo</li>
22870 <li data-parsoid='{}'>*foo</li>
22871 <li data-parsoid='{}'>#foo</li>
22872 <li data-parsoid='{}'>:foo</li>
22873 <li data-parsoid='{}'>;foo</li>
22874 </ul>
22875
22876 <ol>
22877 <li>*foo</li>
22878 <li>#foo</li>
22879 <li>:foo</li>
22880 <li>;foo</li>
22881 <li data-parsoid='{}'>*foo</li>
22882 <li data-parsoid='{}'>#foo</li>
22883 <li data-parsoid='{}'>:foo</li>
22884 <li data-parsoid='{}'>;foo</li>
22885 </ol>
22886 !! wikitext
22887 * *foo
22888 * #foo
22889 * :foo
22890 * ;foo
22891 *<nowiki>*foo</nowiki>
22892 *<nowiki>#foo</nowiki>
22893 *<nowiki>:foo</nowiki>
22894 *<nowiki>;foo</nowiki>
22895
22896 # *foo
22897 # #foo
22898 # :foo
22899 # ;foo
22900 #<nowiki>*foo</nowiki>
22901 #<nowiki>#foo</nowiki>
22902 #<nowiki>:foo</nowiki>
22903 #<nowiki>;foo</nowiki>
22904 !!end
22905
22906 !! test
22907 Lists: 2. Inside definition lists
22908 !! options
22909 parsoid=html2wt
22910 !! html/parsoid
22911 <dl><dt>;foo</dt></dl>
22912 <dl><dt>:foo</dt></dl>
22913 <dl><dt>:foo</dt>
22914 <dd>bar</dd></dl>
22915 <dl><dd>:foo</dd></dl>
22916 !! wikitext
22917 ; ;foo
22918
22919 ; <nowiki>:foo</nowiki>
22920
22921 ; <nowiki>:foo</nowiki>
22922 : bar
22923
22924 : :foo
22925 !!end
22926
22927 !! test
22928 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22929 !! options
22930 parsoid=html2wt
22931 !! html/parsoid
22932 <ul>
22933 <li>*foo*bar</li>
22934 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22935 </ul>
22936 !! wikitext
22937 * *foo*bar
22938 *<nowiki>*foo</nowiki>''it''*bar
22939 !!end
22940
22941 !! test
22942 Lists: 4. No escapes needed
22943 !! options
22944 parsoid=html2wt
22945 !! html/parsoid
22946 <ul>
22947 <li>foo*bar
22948 </li>
22949 </ul>
22950 <ul>
22951 <li><i>foo</i>*bar
22952 </li>
22953 </ul>
22954 <ul>
22955 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22956 </li>
22957 </ul>
22958 <ul>
22959 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22960 </li>
22961 </ul>
22962 !! wikitext
22963 *foo*bar
22964
22965 *''foo''*bar
22966
22967 *[[Foo]]: bar
22968
22969 *[[Foo]]*bar
22970 !!end
22971
22972 !! test
22973 Lists: 5. No unnecessary escapes
22974 !! options
22975 parsoid=html2wt
22976 !! html/parsoid
22977 <ul><li> bar <span>[[foo]]</span></li></ul>
22978 <ul><li> =bar <span>[[foo]]</span></li></ul>
22979 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22980 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22981 <ul><li> =bar <span>foo]]</span>=</li></ul>
22982 <ul><li> <s></s>: a</li></ul>
22983 <ul><li> <i>* foo</i></li></ul>
22984
22985 !! wikitext
22986 * bar <span><nowiki>[[foo]]</nowiki></span>
22987
22988 * =bar <span><nowiki>[[foo]]</nowiki></span>
22989
22990 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22991
22992 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22993
22994 * =bar <span>foo]]</span>=
22995
22996 * <s></s>: a
22997
22998 * ''* foo''
22999 !!end
23000
23001 !! test
23002 Lists: 6. Escape bullets in SOL position
23003 !! options
23004 parsoid=html2wt
23005 !! html/parsoid
23006 <p><!--cmt-->*foo</p>
23007 !! wikitext
23008 <!--cmt--><nowiki>*</nowiki>foo
23009 !!end
23010
23011 !! test
23012 Lists: 7. Escape bullets in a multi-line context
23013 !! options
23014 parsoid=html2wt
23015 !! html/parsoid
23016 <p>a
23017 *b
23018 </p>
23019 !! wikitext
23020 a
23021 <nowiki>*</nowiki>b
23022 !!end
23023
23024 !! test
23025 Lists: 8. Escape colons only if not present in tags
23026 !! options
23027 parsoid=html2wt
23028 !! html/parsoid
23029 <dl><dt>a:b<i>c:d</i></dt></dl>
23030 !! wikitext
23031 ; <nowiki>a:b</nowiki>''c:d''
23032 !! end
23033
23034 #### --------------- HRs ---------------
23035 #### 1. Single line
23036 #### -----------------------------------
23037
23038 !! test
23039 HRs: 1. Single line
23040 !! options
23041 parsoid=html2wt
23042 !! html/parsoid
23043 <hr />----
23044 <hr />=foo=
23045 <hr />*foo
23046 !! wikitext
23047 ----<nowiki>----</nowiki>
23048 ----=foo=
23049 ----*foo
23050 !! end
23051
23052 #### --------------- Tables ---------------
23053 #### 1a. Simple example
23054 #### 1b. No escaping needed (!foo)
23055 #### 1c. No escaping needed (|foo)
23056 #### 1d. No escaping needed (|}foo)
23057 ####
23058 #### 2a. Nested in td (<td>foo|bar</td>)
23059 #### 2b. Nested in td (<td>foo||bar</td>)
23060 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23061 ####
23062 #### 3a. Nested in th (<th>foo!bar</th>)
23063 #### 3b. Nested in th (<th>foo!!bar</th>)
23064 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23065 ####
23066 #### 4a. Escape -
23067 #### 4b. Escape +
23068 #### 4c. No escaping needed
23069 #### --------------------------------------
23070
23071 !! test
23072 Tables: 1a. Simple example
23073 !! options
23074 parsoid=html2wt
23075 !! html/parsoid
23076 <p>{|
23077 |}
23078 </p>
23079 !! wikitext
23080 <nowiki>{|</nowiki>
23081 |}
23082 !! end
23083
23084 !! test
23085 Tables: 1b. No escaping needed
23086 !! options
23087 parsoid=html2wt
23088 !! html/parsoid
23089 <p>!foo
23090 </p>
23091 !! wikitext
23092 !foo
23093 !! end
23094
23095 !! test
23096 Tables: 1c. No escaping needed
23097 !! options
23098 parsoid=html2wt
23099 !! html/parsoid
23100 <p>|foo
23101 </p>
23102 !! wikitext
23103 |foo
23104 !! end
23105
23106 !! test
23107 Tables: 1d. No escaping needed
23108 !! options
23109 parsoid=html2wt
23110 !! html/parsoid
23111 <p>|}foo
23112 </p>
23113 !! wikitext
23114 |}foo
23115 !! end
23116
23117 !! test
23118 Tables: 2a. Nested in td
23119 !! options
23120 parsoid=html2wt
23121 !! html/parsoid
23122 <table><tbody><tr>
23123 <td>foo|bar</td></tr>
23124 <tr><td>x<div>a|b</div></td>
23125 </tbody></table>
23126 !! wikitext
23127 {|
23128 |<nowiki>foo|bar</nowiki>
23129 |-
23130 |x<div><nowiki>a|b</nowiki></div>
23131 |}
23132 !! html/php+tidy
23133 <table>
23134 <tr>
23135 <td>foo|bar</td>
23136 </tr>
23137 <tr>
23138 <td>x
23139 <div>a|b</div>
23140 </td>
23141 </tr>
23142 </table>
23143 !! end
23144
23145 !! test
23146 Tables: 2b. Nested in td
23147 !! options
23148 parsoid=html2wt
23149 !! html/parsoid
23150 <table><tbody><tr>
23151 <td>foo||bar</td>
23152 <td>a<i>b||c</i></td>
23153 <td>a<i><div>b||c</div></i></td>
23154 </tr></tbody></table>
23155 !! wikitext
23156 {|
23157 |<nowiki>foo||bar</nowiki>
23158 |a''<nowiki>b||c</nowiki>''
23159 |a''<div><nowiki>b||c</nowiki></div>''
23160 |}
23161 !! html/php
23162 <table>
23163 <tr>
23164 <td>foo||bar
23165 </td>
23166 <td>a<i>b||c</i>
23167 </td>
23168 <td>a<i><div>b||c</div></i>
23169 </td></tr></table>
23170
23171 !! end
23172
23173 !! test
23174 Tables: 2c. Nested in td -- no escaping needed
23175 !! options
23176 parsoid=html2wt
23177 !! html/*
23178 <table>
23179 <tr>
23180 <td>foo!!bar
23181 </td></tr></table>
23182
23183 !! wikitext
23184 {|
23185 |foo!!bar
23186 |}
23187 !! end
23188
23189 !! test
23190 Tables: 3a. Nested in th
23191 !! options
23192 parsoid=html2wt
23193 !! html/*
23194 <table>
23195 <tr>
23196 <th>foo!bar
23197 </th></tr></table>
23198
23199 !! wikitext
23200 {|
23201 !foo!bar
23202 |}
23203 !! end
23204
23205 !! test
23206 Tables: 3b. Nested in th
23207 !! options
23208 parsoid=html2wt
23209 !! html/parsoid
23210 <table><tbody>
23211 <tr><th>foo!!bar</th>
23212 <th><i>foo|bar</i></th>
23213 <th><i>foo!!bar</i></th>
23214 <th><i><span>foo!!bar</span></i></th>
23215 </tr></tbody></table>
23216 !! wikitext
23217 {|
23218 !<nowiki>foo!!bar</nowiki>
23219 !''<nowiki>foo|bar</nowiki>''
23220 !''<nowiki>foo!!bar</nowiki>''
23221 !''<span><nowiki>foo!!bar</nowiki></span>''
23222 |}
23223 !! html/php
23224 <table>
23225 <tr>
23226 <th>foo!!bar
23227 </th>
23228 <th><i>foo|bar</i>
23229 </th>
23230 <th><i>foo!!bar</i>
23231 </th>
23232 <th><i><span>foo!!bar</span></i>
23233 </th></tr></table>
23234
23235 !! end
23236
23237 !! test
23238 Tables: 3c. Nested in th
23239 !! options
23240 parsoid=html2wt
23241 !! html/parsoid
23242 <table><tbody>
23243 <tr><th>foo||bar</th>
23244 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23245 </tr></tbody></table>
23246 !! wikitext
23247 {|
23248 !<nowiki>foo||bar</nowiki>
23249 !<nowiki>foo||bar</nowiki>
23250 |}
23251 !! html/php
23252 <table>
23253 <tr>
23254 <th>foo||bar
23255 </th>
23256 <th>foo||bar
23257 </th></tr></table>
23258
23259 !! end
23260
23261 !! test
23262 Tables: 4a. Escape -
23263 !! options
23264 parsoid=html2wt
23265 !! html/*
23266 <table>
23267 <tr>
23268 <th>-bar
23269 </th></tr>
23270 <tr>
23271 <td>-bar
23272 </td></tr></table>
23273
23274 !! wikitext
23275 {|
23276 !-bar
23277 |-
23278 |<nowiki>-bar</nowiki>
23279 |}
23280 !! end
23281
23282 !! test
23283 Tables: 4b. Escape +
23284 !! options
23285 parsoid=html2wt
23286 !! html/*
23287 <table>
23288 <tr>
23289 <th>+bar
23290 </th></tr>
23291 <tr>
23292 <td>+bar
23293 </td></tr></table>
23294
23295 !! wikitext
23296 {|
23297 !+bar
23298 |-
23299 |<nowiki>+bar</nowiki>
23300 |}
23301 !! end
23302
23303 !! test
23304 Tables: 4c. No escaping needed
23305 !! options
23306 parsoid=html2wt
23307 !! html/parsoid
23308 <table><tbody>
23309 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23310 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23311 <tr><td>foo
23312 <p>bar|baz
23313 +bar
23314 -bar</p></td></tr>
23315 <tr><td>x
23316 <div>a|b</div></td>
23317 </tbody></table>
23318 !! wikitext
23319 {|
23320 |foo-bar
23321 |foo+bar
23322 |-
23323 |''foo''-bar
23324 |''foo''+bar
23325 |-
23326 |foo
23327 bar|baz
23328 +bar
23329 -bar
23330 |-
23331 |x
23332 <div>a|b</div>
23333 |}
23334 !! html/php
23335 <table>
23336 <tr>
23337 <td>foo-bar
23338 </td>
23339 <td>foo+bar
23340 </td></tr>
23341 <tr>
23342 <td><i>foo</i>-bar
23343 </td>
23344 <td><i>foo</i>+bar
23345 </td></tr>
23346 <tr>
23347 <td>foo
23348 <p>bar|baz
23349 +bar
23350 -bar
23351 </p>
23352 </td></tr>
23353 <tr>
23354 <td>x
23355 <div>a|b</div>
23356 </td></tr></table>
23357
23358 !! end
23359
23360 !! test
23361 Tables: 4d. No escaping needed
23362 !! options
23363 parsoid=html2wt
23364 !! html/parsoid
23365 <table>
23366 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23367 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23368 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23369 </tbody></table>
23370 !! wikitext
23371 {|
23372 |[[Foo]]-bar
23373 ||+1
23374 ||-2
23375 |}
23376 !! html/php
23377 <table>
23378 <tr>
23379 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23380 </td>
23381 <td>+1
23382 </td>
23383 <td>-2
23384 </td></tr></table>
23385
23386 !! end
23387
23388 !! test
23389 T97430: Don't emit empty nowiki pairs around marker meta tags
23390 !! options
23391 parsoid=html2wt
23392 !! html/parsoid
23393 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23394 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23395 !! wikitext
23396 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23397 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23398 !! end
23399
23400 !! test
23401 Unclosed xmlish element in table line shouldn't eat end delimiters
23402 !! options
23403 parsoid=html2wt
23404 !! html/parsoid
23405 <table>
23406 <tbody><tr><td> &lt;foo</td>
23407 <td> bar></td></tr>
23408 </tbody></table>
23409 !! wikitext
23410 {|
23411 | <foo
23412 | bar>
23413 |}
23414 !! html/php
23415 <table>
23416 <tr>
23417 <td> &lt;foo
23418 </td>
23419 <td> bar&gt;
23420 </td></tr></table>
23421
23422 !! end
23423
23424 #### --------------- Links ----------------
23425 #### 1. Quote marks in link text
23426 #### 2. Wikilinks: Escapes needed
23427 #### 3. Wikilinks: No escapes needed
23428 #### 4. Extlinks: Escapes needed
23429 #### 5. Extlinks: No escapes needed
23430 #### --------------------------------------
23431 !! test
23432 Links 1. WikiLinks: No escapes needed
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23437 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23438 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23439 !! wikitext
23440 [[Foo|Foo''boo'']]
23441 [[Foo|[Foobar]]]
23442 [[Foo|x [Foobar] x]]
23443 !! html/php
23444 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23445 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23446 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23447 </p>
23448 !! end
23449
23450 !! test
23451 Links 2. WikiLinks: Escapes needed
23452 !! options
23453 parsoid=html2wt
23454 !! html/parsoid
23455 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23456 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23457 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23458 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23459 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23460 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23461 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23462 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23463 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23464 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23465 !! wikitext
23466 [[Foo|<nowiki>Foobar]</nowiki>]]
23467 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23468 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23469 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23470 [[Foo|<nowiki>|Bar</nowiki>]]
23471 [[Foo|<nowiki>]]bar</nowiki>]]
23472 [[Foo|<nowiki>[[bar</nowiki>]]
23473 [[Foo|<nowiki>x [[ y</nowiki>]]
23474 [[Foo|<nowiki>x ]] y</nowiki>]]
23475 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23476 !! html/php
23477 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23478 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23479 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23480 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23481 <a href="/wiki/Foo" title="Foo">|Bar</a>
23482 <a href="/wiki/Foo" title="Foo">]]bar</a>
23483 <a href="/wiki/Foo" title="Foo">[[bar</a>
23484 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23485 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23486 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23487 </p>
23488 !! end
23489
23490 !! test
23491 Links 3. WikiLinks: No escapes needed
23492 !! options
23493 parsoid=html2wt
23494 !! html/parsoid
23495 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23496 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23497 !! wikitext
23498 [[Foo|[Foobar]]
23499 [[Foo|foo|bar]]
23500 !! html/php
23501 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23502 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23503 </p>
23504 !! end
23505
23506 !! test
23507 Links 4. ExtLinks: Escapes needed
23508 !! options
23509 parsoid=html2wt
23510 !! html/parsoid
23511 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23512 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23513 <p>[http://google.com]</p>
23514 <p>[http://google.com google]</p>
23515 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23516 <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>
23517 !! wikitext
23518 [http://google.com <nowiki>[google]</nowiki>]
23519 [http://google.com <nowiki>google]</nowiki>]
23520
23521 <nowiki>[http://google.com]</nowiki>
23522
23523 <nowiki>[http://google.com google]</nowiki>
23524
23525 [http://google.com<nowiki>]</nowiki>
23526
23527 [{{echo|http://google.com}}<nowiki>]</nowiki>
23528 !! html/php
23529 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23530 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23531 </p><p>[http://google.com]
23532 </p><p>[http://google.com google]
23533 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23534 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23535 </p>
23536 !! end
23537
23538 !! test
23539 Links 5. ExtLinks: No escapes needed
23540 !! options
23541 parsoid=html2wt
23542 !! html/parsoid
23543 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23544 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23545 !! wikitext
23546 [http://google.com [google]
23547
23548 [[http://google.com]]
23549 !! html/php
23550 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23551 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23552 </p>
23553 !! end
23554
23555 !! test
23556 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23557 !! options
23558 parsoid=html2wt
23559 !! html/parsoid
23560 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23561 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23562 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23563 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23564 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23565 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23566 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23567 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23568 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23569 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23570 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23571 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23572 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23573 </p>
23574 !! wikitext
23575 x<nowiki/>http://example.com<nowiki/>y
23576 http://example.com<nowiki/>?x
23577 http://example.com<nowiki/>&x
23578 http://example.com<nowiki/>'x
23579 http://example.com<nowiki/>,x
23580 http://example.com<nowiki/>.x
23581 http://example.com<nowiki/>;x
23582 http://example.com<nowiki/>:x
23583 http://example.com<nowiki/>;x
23584 http://example.com<nowiki/>!x
23585 http://example.com<nowiki/>=x
23586 http://example.com<nowiki/>(x)
23587 http://example.com(x<nowiki/>)
23588 !! end
23589
23590 !! test
23591 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23592 !! options
23593 parsoid=html2wt
23594 !! html/parsoid
23595 <p>x
23596 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23597 y
23598 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23599 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23600 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23601 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23602 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23603 </p>
23604 !! wikitext
23605 x
23606 http://example.com
23607 y
23608 "http://example.com"
23609 (http://example.com)
23610 (http://example.com) foo
23611 http://example.com,
23612 http://example.com, foo
23613 !! html/php
23614 <p>x
23615 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23616 y
23617 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23618 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23619 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23620 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23621 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23622 </p>
23623 !! end
23624
23625 !! test
23626 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23627 !! options
23628 parsoid=html2wt
23629 !! html/parsoid
23630 <p><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">http://example.com</a>:</p>
23632 !! wikitext
23633 http://example.com.,;:!?\
23634 -http://example.com:
23635 !! html/php
23636 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23637 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23638 </p>
23639 !! end
23640
23641 !! test
23642 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23643 !! options
23644 parsoid=html2wt
23645 !! html/parsoid
23646 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23647 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23648 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23649 !! wikitext
23650 RFC 123<nowiki/>4
23651 RFC 123<nowiki/>y
23652 X<nowiki/>RFC 123<nowiki/>y
23653 !! end
23654
23655 !! test
23656 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23657 !! options
23658 parsoid=html2wt
23659 !! html/parsoid
23660 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23661 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23662 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23663 </p>
23664 !! wikitext
23665 RFC 123?foo
23666 RFC 123&foo
23667 -RFC 123-
23668 !! html/php
23669 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23670 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23671 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23672 </p>
23673 !! end
23674
23675 !! test
23676 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23677 !! options
23678 parsoid=html2wt
23679 !! html/parsoid
23680 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23681 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23682 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23683 !! wikitext
23684 PMID 123<nowiki/>4
23685 PMID 123<nowiki/>y
23686 X<nowiki/>PMID 123<nowiki/>y
23687 !! end
23688
23689 !! test
23690 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23691 !! options
23692 parsoid=html2wt
23693 !! html/parsoid
23694 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23695 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23696 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23697 </p>
23698 !! wikitext
23699 PMID 123?foo
23700 PMID 123&foo
23701 -PMID 123-
23702 !! html/php
23703 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23704 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23705 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23706 </p>
23707 !! end
23708
23709 !! test
23710 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23711 !! options
23712 parsoid=html2wt
23713 !! html/parsoid
23714 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23715 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23716 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23717 </p>
23718 !! wikitext
23719 ISBN 1234567890<nowiki/>1
23720 ISBN 1234567890<nowiki/>x
23721 a<nowiki/>ISBN 1234567890<nowiki/>b
23722 !! end
23723
23724 !! test
23725 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23726 !! options
23727 parsoid=html2wt
23728 !! html/parsoid
23729 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23730 !! wikitext
23731 -ISBN 1234567890's
23732 !! html/php
23733 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23734 </p>
23735 !! end
23736
23737 !! test
23738 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23739 !! options
23740 parsoid=html2wt
23741 !! html/*
23742 <p>this is not a link: http://example.com
23743 </p>
23744 !! wikitext
23745 this is not a link: <nowiki>http://example.com</nowiki>
23746 !! end
23747
23748 !! test
23749 Links 15. Link trails can't become link prefixes.
23750 !! options
23751 language=is
23752 parsoid=html2wt
23753 !! html/parsoid
23754 <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>
23755 !! wikitext
23756 [[Söfnuður]]-[[00]]
23757 !! html/php
23758 <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>
23759 </p>
23760 !! end
23761
23762 #### --------------- Quotes ---------------
23763 #### 1. Quotes inside <b> and <i>
23764 #### 2. Link fragments separated by <i> and <b> tags
23765 #### 3. Link fragments inside <i> and <b>
23766 #### 4. No escaping needed
23767 #### --------------------------------------
23768 !! test
23769 1a. Quotes inside <b> and <i>
23770 !! options
23771 parsoid=html2wt
23772 !! html/*
23773 <p><i>'foo'</i>
23774 <i>''foo''</i>
23775 <i>'''foo'''</i>
23776 <i>foo</i>'s
23777 <b>'foo'</b>
23778 <b>''foo''</b>
23779 <b>'''foo'''</b>
23780 <b>foo'<i>bar'</i>baz</b>
23781 <b>foo</b>'s
23782 '<i>foo</i>
23783 <i>foo</i>'
23784 <i>foo'</i>'
23785 '<i>foo</i>'
23786 '<b>foo</b>
23787 <b>foo</b>'
23788 '<b>foo</b>'
23789 <i>fools'<span> errand</span></i>
23790 <i><span>fool</span>'s errand</i>
23791 '<i>foo</i> bar '<i>baz</i>
23792 a|!*#-:;+-~[]{}b'<i>x</i>
23793 </p>
23794 !! wikitext
23795 ''<nowiki/>'foo'''
23796 ''<nowiki>''foo''</nowiki>''
23797 ''<nowiki>'''foo'''</nowiki>''
23798 ''foo''<nowiki/>'s
23799 '''<nowiki/>'foo''''
23800 '''<nowiki>''foo''</nowiki>'''
23801 '''<nowiki>'''foo'''</nowiki>'''
23802 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23803 '''foo'''<nowiki/>'s
23804 '''foo''
23805 ''foo''<nowiki/>'
23806 ''foo'''<nowiki/>'
23807 '''foo''<nowiki/>'
23808 ''''foo'''
23809 '''foo'''<nowiki/>'
23810 ''''foo'''<nowiki/>'
23811 ''fools'<span> errand</span>''
23812 ''<span>fool</span>'s errand''
23813 '<nowiki/>''foo'' bar '''baz''
23814 a|!*#-:;+-~[]{}b'''x''
23815 !! end
23816
23817 !! test
23818 1b. Quotes inside <b> and <i> with other tags on same line
23819 !! options
23820 parsoid=html2wt
23821 !! html/parsoid
23822 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23823 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23824 <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>
23825 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23826 '<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>
23827 '<i>foo</i> <div title="name">test</div>
23828 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23829 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23830 <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>
23831 </ol>
23832 !! wikitext
23833 '''a'' foo ''[[bar]]''
23834 ''a''' foo ''[[bar]]''
23835 ''a''' foo '''{{echo|[[bar]]}}'''
23836 [[foo]] x'''[[bar]]''
23837 '''foo'' <ref>test</ref>
23838 '''foo'' <div title="name">test</div>
23839 '''foo'' and <br> bar
23840 <references />
23841 !! end
23842
23843 !! test
23844 2. Link fragments separated by <i> and <b> tags
23845 !! options
23846 parsoid=html2wt
23847 !! html/parsoid
23848 <p>[[<i>foo</i>hello]]</p>
23849 <p>[[<b>foo</b>hello]]</p>
23850 !! wikitext
23851 [[''foo''<nowiki>hello]]</nowiki>
23852
23853 [['''foo'''<nowiki>hello]]</nowiki>
23854 !! end
23855
23856 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23857 # this is one of the shortcomings of this format
23858 !! test
23859 3. Link fragments inside <i> and <b>
23860 !! options
23861 parsoid=html2wt
23862 !! html/parsoid
23863 <p><i>[[foo</i>]]</p>
23864 <p><b>[[foo</b>]]</p>
23865 !! wikitext
23866 ''[[foo''<nowiki>]]</nowiki>
23867
23868 '''[[foo'''<nowiki>]]</nowiki>
23869 !! end
23870
23871 !! test
23872 4. No escaping needed
23873 !! options
23874 options=html2wt
23875 !! html/parsoid
23876 <p>'<span><i>bar</i></span>'
23877 '<span><b>bar</b></span>'
23878 'a:b'foo
23879 </p>
23880 !! wikitext
23881 '<span>''bar''</span>'
23882 '<span>'''bar'''</span>'
23883 'a:b'foo
23884 !! end
23885
23886 #### ----------- Paragraphs ---------------
23887 #### 1. No unnecessary escapes
23888 #### --------------------------------------
23889
23890 !! test
23891 1. No unnecessary escapes
23892 !! options
23893 parsoid=html2wt
23894 !! html/parsoid
23895 <p>bar <span>[[foo]]</span>
23896 </p><p>=bar <span>[[foo]]</span>
23897 </p><p>[[bar <span>[[foo]]</span>
23898 </p><p>]]bar <span>[[foo]]</span>
23899 </p><p>=bar <span>foo]]</span>=
23900 </p>
23901 !! wikitext
23902 bar <span><nowiki>[[foo]]</nowiki></span>
23903
23904 =bar <span><nowiki>[[foo]]</nowiki></span>
23905
23906 [[bar <span><nowiki>[[foo]]</nowiki></span>
23907
23908 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23909
23910 =bar <span>foo]]</span><nowiki>=</nowiki>
23911 !!end
23912
23913 #### ----------------------- PRE --------------------------
23914 #### 1. Leading whitespace in SOL context should be escaped
23915 #### ------------------------------------------------------
23916 !! test
23917 1. Leading whitespace in SOL context should be escaped
23918 !! options
23919 parsoid=html2wt
23920 !! html/parsoid
23921 <p> a</p>
23922
23923 <p> a</p>
23924
23925 <p> a(tab)</p>
23926
23927 <p> a
23928 <!--cmt-->
23929 a</p>
23930
23931 <p>a
23932 b</p>
23933
23934 <p>a
23935 b</p>
23936
23937 <p>a
23938 b</p>
23939 !! wikitext
23940 <nowiki> </nowiki>a
23941
23942 <nowiki> </nowiki> a
23943
23944 a(tab)
23945
23946 <nowiki> </nowiki> a
23947 <!--cmt-->
23948 <nowiki> </nowiki>a
23949
23950 a
23951 <nowiki> </nowiki>b
23952
23953 a
23954 b
23955
23956 a
23957 b
23958 !! html/php
23959 <p> a
23960 </p><p> a
23961 </p><p> a(tab)
23962 </p><p> a
23963 a
23964 </p><p>a
23965 b
23966 </p><p>a
23967 b
23968 </p><p>a
23969 b
23970 </p>
23971 !! end
23972
23973 !! test
23974 2. Leading whitespace in non-indent-pre contexts should not be escaped
23975 !! options
23976 parsoid=html2wt
23977 !! html/parsoid
23978 <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>
23979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23980 <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>
23981 b</span></li>
23982 </ol>
23983 !! wikitext
23984 foo <ref>''a''
23985 b</ref>
23986 <references />
23987 !! end
23988
23989 !! test
23990 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23991 !! options
23992 parsoid=html2wt
23993 !! html/parsoid
23994 <blockquote>
23995 <p>
23996 a
23997 <span>b</span>
23998 c</p>
23999 </blockquote>
24000 !! wikitext
24001 <blockquote>
24002 a
24003 <span>b</span>
24004 c
24005 </blockquote>
24006 !! end
24007
24008 !! test
24009 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24010 !! options
24011 options=html2wt
24012 !! html/parsoid
24013 <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>
24014 !! wikitext
24015 [[File:Foobar.jpg|thumb|caption]]
24016 !! end
24017
24018 !! test
24019 5. Nowiki escaping should account for indent-pres
24020 !! options
24021 parsoid=html2wt
24022 !! html/parsoid
24023 <pre>==foo==</pre>
24024 !! wikitext
24025 ==foo==
24026 !! end
24027
24028 !!test
24029 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24030 !! options
24031 parsoid=html2wt
24032 !! html/parsoid
24033 <pre>
24034 * foo
24035 * bar
24036 </pre>
24037 !! wikitext
24038 * foo
24039 * bar
24040 !! end
24041
24042 #### --------------- Behavior Switches --------------------
24043
24044 !! test
24045 1. Valid behavior switches should be escaped
24046 !! options
24047 parsoid=html2wt
24048 !! html/parsoid
24049 __TOC__
24050 <i>__TOC__</i>
24051 !! wikitext
24052 <nowiki>__TOC__</nowiki>
24053 ''<nowiki>__TOC__</nowiki>''
24054 !! end
24055
24056 !! test
24057 2. Invalid behavior switches should not be escaped
24058 !! options
24059 parsoid=html2wt
24060 !! html/parsoid
24061 __TOO__
24062 __|__
24063 !! wikitext
24064 __TOO__
24065 __|__
24066 !! end
24067
24068 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24069 !! test
24070 Behavior switches should be SOL-transparent
24071 !! options
24072 parsoid=html2wt
24073 !! html/parsoid
24074 <meta property="mw:PageProp/toc" />
24075
24076 <!-- this one's bogus -->
24077 <pre>__TOO__</pre>
24078
24079 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24080
24081 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24082 !! wikitext
24083 __TOC__
24084
24085 <!-- this one's bogus -->
24086 __TOO__
24087
24088 __TOC__ foo
24089
24090 __TOC__
24091 bar
24092 !! end
24093
24094 #### --------------- HTML tags ---------------
24095 #### 1. a tags
24096 #### 2. other tags
24097 #### 3. multi-line html tag
24098 #### 4. extension tags
24099 #### -----------------------------------------
24100 !! test
24101 1. a tags
24102 !! options
24103 parsoid=html2wt
24104 !! html/parsoid
24105 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24106 !! wikitext
24107 <a href="http://google.com">google</a>
24108 !! end
24109
24110 !! test
24111 2. other tags
24112 !! options
24113 parsoid=html2wt
24114 !! html/parsoid
24115 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24116 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24117 <li> &lt;td&gt;</li></ul>
24118
24119 !! wikitext
24120 * <nowiki><div>foo</div></nowiki>
24121 * <nowiki><div style="color:red">foo</div></nowiki>
24122 * <nowiki><td></nowiki>
24123 !! end
24124
24125 !! test
24126 3. multi-line html tag
24127 !! options
24128 parsoid=html2wt
24129 !! html/parsoid
24130 <p>&lt;div
24131 &gt;foo&lt;/div
24132 &gt;
24133 </p>
24134 !! wikitext
24135 <nowiki><div
24136 >foo</div
24137 ></nowiki>
24138 !! end
24139
24140 !! test
24141 4. extension tags
24142 !! options
24143 parsoid=html2wt
24144 !! html/parsoid
24145 <p>&lt;ref&gt;foo&lt;/ref&gt;
24146 </p><p>&lt;ref&gt;bar
24147 </p><p>baz&lt;/ref&gt;
24148 </p>
24149 !! wikitext
24150 <nowiki><ref>foo</ref></nowiki>
24151
24152 <nowiki><ref>bar</nowiki>
24153
24154 baz<nowiki></ref></nowiki>
24155 !! end
24156
24157 #### --------------- Others ---------------
24158 !! test
24159 Escaping nowikis
24160 !! options
24161 parsoid=html2wt
24162 !! html/parsoid
24163 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24164 </p>
24165 !! wikitext
24166 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24167 !! end
24168
24169 ## The quote-char in the input is necessary for triggering the bug
24170 !! test
24171 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24172 !! options
24173 parsoid=html2wt
24174 !! html/parsoid
24175 <p>foo's bar :</p>
24176 !! wikitext
24177 foo's bar :
24178 !! end
24179
24180 #----------- End of wikitext escaping tests --------------
24181
24182 !! test
24183
24184 Tag-like HTML structures are passed through as text
24185 !! wikitext
24186 <x y>
24187
24188 <x.y>
24189
24190 <x-y>
24191
24192 1>2
24193
24194 x<y
24195
24196 a>b
24197
24198 1<d e>f
24199 !! html
24200 <p>&lt;x y&gt;
24201 </p><p>&lt;x.y&gt;
24202 </p><p>&lt;x-y&gt;
24203 </p><p>1&gt;2
24204 </p><p>x&lt;y
24205 </p><p>a&gt;b
24206 </p><p>1&lt;d e&gt;f
24207 </p>
24208 !! end
24209
24210 !! test
24211 HTML tag with necessary entities in attributes
24212 !! wikitext
24213 <span title="&amp;amp;">foo</span>
24214 !! html
24215 <p><span title="&amp;amp;">foo</span>
24216 </p>
24217 !! end
24218
24219 !! test
24220 HTML tag with 'unnecessary' entity encoding in attributes
24221 !! wikitext
24222 <span title="&amp;">foo</span>
24223 !! html
24224 <p><span title="&amp;">foo</span>
24225 </p>
24226 !! end
24227
24228 !! test
24229 HTML tag with broken attribute value quoting
24230 !! options
24231 parsoid=wt2html,html2html
24232 !! wikitext
24233 <span title="Hello world>Foo</span>
24234 !! html/php
24235 <p><span title="Hello world">Foo</span>
24236 </p>
24237 !! html/parsoid
24238 <p><span title="Hello world">Foo</span></p>
24239 !! end
24240
24241 !! test
24242 Self-closed tag with broken attribute value quoting
24243 !! options
24244 parsoid=wt2html,html2html
24245 !! wikitext
24246 <div title="Hello world />Foo
24247 !! html/php+tidy
24248 <div title="Hello world"></div>
24249 <p>Foo</p>
24250 !! html/parsoid
24251 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24252 !! end
24253
24254 !! test
24255 Table with broken attribute value quoting
24256 !! options
24257 parsoid=wt2html,html2html
24258 !! wikitext
24259 {|
24260 | title="Hello world|Foo
24261 |}
24262 !! html/php
24263 <table>
24264 <tr>
24265 <td title="Hello world">Foo
24266 </td></tr></table>
24267
24268 !! html/parsoid
24269 <table>
24270 <tr>
24271 <td title="Hello world">Foo
24272 </td></tr></table>
24273
24274 !! end
24275
24276 !! test
24277 Table with broken attribute value quoting on consecutive lines
24278 !! options
24279 parsoid=wt2html,html2html
24280 !! wikitext
24281 {|
24282 | title="Hello world|Foo
24283 | style="color:red|Bar
24284 |}
24285 !! html/php
24286 <table>
24287 <tr>
24288 <td title="Hello world">Foo
24289 </td>
24290 <td style="color:red">Bar
24291 </td></tr></table>
24292
24293 !! html/parsoid
24294 <table><tbody>
24295 <tr>
24296 <td title="Hello world">Foo
24297 </td><td style="color: red">Bar
24298 </td></tr></tbody></table>
24299
24300 !! end
24301
24302 !!test
24303 Accept empty td cell attribute
24304 !! wikitext
24305 {|
24306 | align="center" | foo || |
24307 |}
24308 !! html
24309 <table>
24310 <tr>
24311 <td align="center"> foo </td>
24312 <td>
24313 </td></tr></table>
24314
24315 !!end
24316
24317 !!test
24318 Non-empty attributes in th-cells
24319 !! wikitext
24320 {|
24321 ! Foo !! style="color: red" | Bar
24322 |}
24323 !! html
24324 <table>
24325 <tr>
24326 <th> Foo </th>
24327 <th style="color: red"> Bar
24328 </th></tr></table>
24329
24330 !!end
24331
24332 !!test
24333 Accept empty attributes in th-cells
24334 !! wikitext
24335 {|
24336 !| foo !!| bar
24337 |}
24338 !! html
24339 <table>
24340 <tr>
24341 <th> foo </th>
24342 <th> bar
24343 </th></tr></table>
24344
24345 !!end
24346
24347 !!test
24348 Empty table rows go away
24349 !! wikitext
24350 {|
24351 | Hello
24352 | there
24353 |- class="foo"
24354 |-
24355 |}
24356 !! html
24357 <table>
24358 <tr>
24359 <td> Hello
24360 </td>
24361 <td> there
24362 </td></tr>
24363
24364 </table>
24365
24366 !! end
24367
24368 ###
24369 ### Parsoid-centric tests for testing RTing of inter-element separators
24370 ### Edge cases not tested by existing parser tests and specific to
24371 ### Parsoid-specific serialization strategies.
24372 ###
24373
24374 !!test
24375 RT-ed inter-element separators should be valid separators
24376 !! wikitext
24377 {|
24378 |- [[foo]]
24379 |}
24380 !! html/php
24381 <table>
24382
24383 </table>
24384
24385 !! html/parsoid
24386 <table>
24387 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24388 </tbody></table>
24389 !!end
24390
24391 # Parsoid-only since PHP parser relies on Tidy for correct output
24392 !!test
24393 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24394 !!options
24395 parsoid
24396 !! wikitext
24397 {|
24398 |<small>foo
24399 bar
24400 |}
24401
24402 {|
24403 |<small>foo<small>
24404 |}
24405 !! html
24406 <table>
24407 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24408 <p>bar</p></small></td></tr>
24409 </tbody></table>
24410
24411 <table>
24412 <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>
24413 </tbody></table>
24414 !!end
24415
24416 # Note that the "style" attribute is really a template parameter here.
24417 # The = would have to be {{=}} if you wanted the literal.
24418 !!test
24419 Empty TD followed by TD with tpl-generated attribute
24420 !! wikitext
24421 {|
24422 |-
24423 |
24424 |{{echo|style='color:red'}}|foo
24425 |}
24426 !! html
24427 <table>
24428
24429 <tr>
24430 <td>
24431 </td>
24432 <td>foo
24433 </td></tr></table>
24434
24435 !!end
24436
24437 !!test
24438 Indented table with an empty td
24439 !! wikitext
24440 {|
24441 |-
24442 |
24443 |foo
24444 |}
24445 !! html
24446 <table>
24447
24448 <tr>
24449 <td>
24450 </td>
24451 <td>foo
24452 </td></tr></table>
24453
24454 !!end
24455
24456 ## We have some newline diffs RT-ing this edge case
24457 ## and it is not important enough -- we seem to be emitting
24458 ## at most 2 newlines after a </tr> and this is unrelated to
24459 ## the issue from T85627 that this is testing.
24460 !!test
24461 Indented table with blank lines in between (T85627)
24462 !! options
24463 parsoid=wt2html
24464 !! wikitext
24465 {|
24466 |foo
24467
24468
24469 |}
24470 !! html
24471 <table>
24472
24473 <tr>
24474 <td>foo
24475 </td></tr></table>
24476
24477 !!end
24478
24479 !!test
24480 Indented block & table
24481 !! wikitext
24482 <div>foo</div>
24483 {|
24484 |foo
24485 |}
24486 !! html/php
24487 <div>foo</div>
24488 <table>
24489 <tr>
24490 <td>foo
24491 </td></tr></table>
24492
24493 !! html/parsoid
24494 <div data-parsoid='{"stx":"html"}'>foo</div>
24495 <table><tbody>
24496 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24497 </tbody></table>
24498 !!end
24499
24500 !! test
24501 Indent and comment before table row
24502 !! wikitext
24503 {|
24504 <!--hi-->|-
24505 | there
24506 |}
24507 !! html/php
24508 <table>
24509
24510 <tr>
24511 <td> there
24512 </td></tr></table>
24513
24514 !! html/parsoid
24515 <table>
24516 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24517 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24518 </tbody></table>
24519 !! end
24520
24521 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24522 !!test
24523 Empty TR followed by a template-generated TR
24524 !!options
24525 parsoid
24526 !! wikitext
24527 {|
24528 |-
24529 {{echo|<tr><td>foo</td></tr>}}
24530 |}
24531 !! html
24532 <table>
24533 <tbody>
24534 <tr></tr>
24535 <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}}]}'>
24536 <td>foo</td></tr>
24537 </tbody></table>
24538 !!end
24539
24540 ## PHP and parsoid output differ for this, and since this is primarily
24541 ## for testing Parsoid's serializer, marking this Parsoid only
24542 !!test
24543 Empty TR followed by mixed-ws-comment line should RT correctly
24544 !!options
24545 parsoid
24546 !! wikitext
24547 {|
24548 |-
24549 <!--c-->
24550 |-
24551 <!--c--> <!--d-->
24552 |}
24553 !! html
24554 <table>
24555 <tbody>
24556 <tr></tr>
24557 <!--c-->
24558 <tr>
24559 <!--c--> </tr><!--d-->
24560 </tbody></table>
24561
24562 !!end
24563
24564 !!test
24565 Multi-line image caption generated by templates with/without trailing newlines
24566 !! wikitext
24567 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24568 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24569 !! html/parsoid
24570 <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>
24571 <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>
24572 !!end
24573
24574 !! test
24575 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24576 !! options
24577 parsoid=html2wt
24578 !! html/parsoid
24579 <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>
24580
24581 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24582 !! wikitext
24583 <includeonly>foo</includeonly>
24584 new para
24585
24586 [[Category:Foo]]
24587
24588 = new heading =
24589 !! end
24590
24591 ## PHP emits broken html for this, and since this is primarily
24592 ## a Parsoid serializer test, marking this Parsoid only
24593 !!test
24594 Improperly nested inline or quotes tags with whitespace in between
24595 !! wikitext
24596 <span> <s>x</span> </s>
24597 ''' ''x''' ''
24598 !! html/parsoid
24599 <p><span> <s>x</s></span><s> </s>
24600 <b> <i>x</i></b><i> </i>
24601 </p>
24602 !!end
24603
24604 !!test
24605 Encapsulate protected attributes from wt
24606 !! wikitext
24607 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24608 !! html/parsoid
24609 <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>
24610 </body>
24611 !!end
24612
24613 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24614 ## Having nested or stray pre tags results in the attempt to add duplicates,
24615 ## causing an assertion fail. This test tries to prevent that situation.
24616 !!test
24617 Ensure ParagraphWrapper can deal with stray closing pre tags
24618 !!options
24619 parsoid=wt2html
24620 !! wikitext
24621 plain text</pre>
24622 !! html/parsoid
24623 plain text
24624 !!end
24625
24626 !!test
24627 1. Ensure fostered text content is wrapped in element nodes
24628 !!options
24629 parsoid=wt2html
24630 !! wikitext
24631 <table>hi</table><table>ho</table>
24632 !! html/parsoid
24633 <p>hi</p>
24634 <table></table>
24635 <p>ho</p>
24636 <table></table>
24637 !!end
24638
24639 !!test
24640 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24641 !!options
24642 parsoid=wt2html,wt2wt
24643 !! wikitext
24644 <table>
24645 <tr> || ||
24646 <td> a
24647 </table>
24648 !! html/parsoid
24649 <p> || ||
24650 </p><table>
24651 <tbody><tr><td> a</td></tr>
24652 </tbody></table>
24653 !!end
24654
24655 !!test
24656 Encapsulation properly handles null DSR information from foster box
24657 !!options
24658 parsoid=wt2html,wt2wt
24659 !! wikitext
24660 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24661 !! html/parsoid
24662 <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>
24663 !!end
24664
24665 !!test
24666 1. Encapsulate foster-parented transclusion content
24667 !!options
24668 parsoid=wt2wt,wt2html
24669 !! wikitext
24670 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24671 !! html/parsoid
24672 <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>
24673 <tbody>
24674 <tr>
24675 <td>bar</td>
24676 </tr>
24677 </tbody>
24678 </table>
24679 !!end
24680
24681 !!test
24682 2. Encapsulate foster-parented transclusion content
24683 !!options
24684 parsoid=wt2wt,wt2html
24685 !! wikitext
24686 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24687 !! html/parsoid
24688 <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>
24689 <table>
24690 <tbody>
24691 <tr>
24692 <td>bar</td>
24693 </tr>
24694 </tbody>
24695 </table>
24696 !!end
24697
24698 !!test
24699 3. Encapsulate foster-parented transclusion content
24700 !!options
24701 parsoid=wt2wt,wt2html
24702 !! wikitext
24703 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24704 !! html/parsoid
24705 <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;]}">
24706 <p>foo</p>
24707 </div>
24708 <table>
24709 <tbody>
24710 <tr>
24711 <td>bar</td>
24712 </tr>
24713 </tbody>
24714 </table>
24715 !!end
24716
24717 !!test
24718 4. Encapsulate foster-parented transclusion content
24719 !!options
24720 parsoid=wt2wt,wt2html
24721 !! wikitext
24722 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24723 !! html/parsoid
24724 <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;]}">
24725 <p>foo</p>
24726 </div>
24727 <table>
24728 <tbody>
24729 <tr>
24730 <td>bar</td>
24731 </tr>
24732 </tbody>
24733 </table>
24734 !!end
24735
24736 !!test
24737 5. Encapsulate foster-parented transclusion content
24738 !!options
24739 parsoid=wt2wt,wt2html
24740 !! wikitext
24741 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24742 !! html/parsoid
24743 <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>
24744 <table>
24745 <tbody>
24746 <tr>
24747 <td>
24748 <div>
24749 <p>foo</p>
24750 </div>
24751 </td>
24752 </tr>
24753 </tbody>
24754 </table>
24755 !!end
24756
24757 !!test
24758 6. Encapsulate foster-parented transclusion content
24759 !!options
24760 parsoid=wt2wt,wt2html
24761 !! wikitext
24762 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24763 !! html/parsoid
24764 <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>
24765 <table>
24766 <tbody>
24767 <tr>
24768 <td>
24769 <div>
24770 <p>foo</p>
24771 </div>
24772 </td>
24773 </tr>
24774 </tbody>
24775 </table>
24776 <p>ok</p>
24777 !!end
24778
24779 !!test
24780 7. Encapsulate foster-parented transclusion content
24781 !!options
24782 parsoid=wt2wt,wt2html
24783 !! wikitext
24784 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24785 !! html/parsoid
24786 <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>
24787 <table>
24788 <tbody>
24789 <tr>
24790 <td>bar</td>
24791 </tr>
24792 </tbody>
24793 </table>
24794 !!end
24795
24796 # Note that the wt is broken on purpose: the = should be {{=}} if you
24797 # don't want it to be a template parameter key.
24798 !!test
24799 8. Encapsulate foster-parented transclusion content
24800 !!options
24801 parsoid=wt2wt,wt2html
24802 !! wikitext
24803 {{echo|a
24804 }}{|{{echo|style='color:red'}}
24805 |-
24806 |b
24807 |}
24808 !! html/parsoid
24809 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24810 <span> </span>
24811 <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>
24812 <table>
24813 <tbody>
24814 <tr>
24815 <td>b</td>
24816 </tr>
24817 </tbody>
24818 </table>
24819 !!end
24820
24821 !!test
24822 9. Encapsulate foster-parented transclusion content
24823 !!options
24824 parsoid=wt2wt,wt2html
24825 !! wikitext
24826 <table>{{echo|hi</table>hello}}
24827 !! html/parsoid
24828 <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>
24829 !!end
24830
24831 !!test
24832 Table in fosterable position
24833 !!options
24834 parsoid=wt2html
24835 !! wikitext
24836 {{OpenTable}}
24837 <div>
24838 {|
24839 |}
24840 </div>
24841 |}
24842 !! html/parsoid
24843 <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">
24844 </span>
24845 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24846
24847 <table>
24848 </table>
24849 !!end
24850
24851 # Parsoid only for bug 64747
24852 !! test
24853 Properly encapsulate empty-content transclusions in fosterable positions
24854 !! wikitext
24855 <table>
24856 {{#if:|
24857 <td>foo</td>
24858 }}
24859 </table>
24860 !! html/parsoid
24861 <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"}]]}'>
24862
24863 </table>
24864 !! end
24865
24866 !! test
24867 Always encapsulate foster box when template range is expanded to table
24868 !! options
24869 parsoid=wt2wt
24870 !! wikitext
24871 {|
24872 hello
24873 {{OpenTable}}
24874 |}
24875 !! html/parsoid
24876
24877 !! end
24878
24879 !! test
24880 T115289: Unclosed table
24881 !! wikitext
24882 {{echo|<table>}}<!--c-->[[Category:Two]]
24883 !! html/parsoid
24884 <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>
24885 !! end
24886
24887 !! test
24888 T115289: Don't migrate newlines out of tables with fostered content
24889 !! wikitext
24890 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24891 !! html/parsoid
24892 <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>
24893 !! end
24894
24895 !! test
24896 T73074: More fostering fun
24897 !! wikitext
24898 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24899 !! html/parsoid
24900 <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>
24901 !! end
24902
24903 !!test
24904 Support <object> element with .data attribute
24905 !!options
24906 parsoid=html2wt
24907 !! html/parsoid
24908 <object data="test.swf"></object>
24909 !! wikitext
24910 <object data="test.swf"></object>
24911 !!end
24912
24913 !! test
24914 Don't block XML namespace declaration
24915 !! wikitext
24916 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24917 !! html/php
24918 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24919 </p>
24920 !! html/parsoid
24921 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24922 !! end
24923
24924 # -----------------------------------------------------------------
24925 # The following section of tests are primarily to spec requirements
24926 # around serialization of new/edited content.
24927 #
24928 # All these tests are marked Parsoid html2wt and html2html only
24929 # ----------------------------------------------------------------
24930
24931 # 'mi' is a localinterwiki prefix as well as a language
24932 !! test
24933 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24934 !! options
24935 parsoid=html2wt
24936 !! html/parsoid
24937 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24938 !! wikitext
24939 [[Foo]]
24940 !! end
24941
24942 # See T93839
24943 !! test
24944 New wikilinks should be serialized properly
24945 !! options
24946 parsoid=html2wt
24947 !! html/parsoid
24948 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24949 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24950 !! wikitext
24951 [[Foo]]
24952 [[Foo]]
24953 !! end
24954
24955 !! test
24956 New wiki links (href variations)
24957 !! options
24958 parsoid=html2wt
24959 !! html/parsoid
24960 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24961 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24962 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24963 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24964 !! wikitext
24965 [[Foo_bar]]
24966 [[Foo_bar]]
24967 [[Foo_bar]]
24968 [[Toxine bactérienne]]
24969 !! end
24970
24971 !! test
24972 New wiki links (content string variations)
24973 !! options
24974 parsoid=html2wt
24975 !! html/parsoid
24976 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24977 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24978 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24979 !! wikitext
24980 [[Foo_bar]]
24981 [[Foo bar]]
24982 [[Foo_bar|./Foo_bar]]
24983 !! end
24984
24985 !! test
24986 New category links (href variations)
24987 !! options
24988 parsoid=html2wt
24989 !! html/parsoid
24990 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24991 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24992 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24993 !! wikitext
24994 [[Category:Toxine bactérienne]]
24995 [[Category:Toxine bactérienne]]
24996 [[Category:Toxine bactérienne]]
24997 !! end
24998
24999 !! test
25000 New sol transparent links don't need indent-pre nowiki protection
25001 !! options
25002 parsoid=html2wt
25003 language=de
25004 !! html/parsoid
25005 <link rel="mw:PageProp/redirect" href="./Main_Page">
25006 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25007 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25008 !! wikitext
25009 #WEITERLEITUNG [[Main Page]]
25010 <!-- this is good --> [[Category:Good]]
25011 <!-- this is great --> [[Kategorie:Great]]
25012 !! end
25013
25014 !! test
25015 New interlanguage links (href variations)
25016 !! options
25017 parsoid=html2wt
25018 !! html/parsoid
25019 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25020 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25021 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25022 !! wikitext
25023 [[es:Toxine bactérienne]]
25024 [[es:Toxine_bactérienne]]
25025 [[es:Toxine_bactérienne]]
25026 !! end
25027
25028 !! test
25029 Image: Modifying size of an image (1)
25030 !! options
25031 parsoid={
25032 "modes": ["wt2wt"],
25033 "changes": [
25034 ["img[height]", "attr", "height", "22"],
25035 ["img[width]", "attr", "width", "200"]
25036 ]
25037 }
25038 !! wikitext
25039 [[Image:Foobar.jpg|230x230px]]
25040 !! wikitext/edited
25041 [[Image:Foobar.jpg|200x200px]]
25042 !!end
25043
25044 !! test
25045 Image: Modifying size of an image (2)
25046 !! options
25047 parsoid={
25048 "modes": ["wt2wt"],
25049 "changes": [
25050 ["img[height]", "attr", "height", "100"],
25051 ["img[width]", "attr", "width", "500"]
25052 ]
25053 }
25054 !! wikitext
25055 [[Image:Foobar.jpg|230x230px]]
25056 !! wikitext/edited
25057 [[Image:Foobar.jpg|500x500px]]
25058 !!end
25059
25060 # Change in size is ignored so long as class='mw-default-size'
25061 !! test
25062 Image: Modifying size of an image (3)
25063 !! options
25064 parsoid={
25065 "modes": ["wt2wt"],
25066 "changes": [
25067 ["figure[class]", "removeClass", "mw-default-size"],
25068 ["figure img", "attr", "height", "19"],
25069 ["figure img", "attr", "width", "170"]
25070 ]
25071 }
25072 !! wikitext
25073 [[Image:Foobar.jpg|thumb]]
25074 !! wikitext/edited
25075 [[Image:Foobar.jpg|thumb|170x170px]]
25076 !!end
25077
25078 !! test
25079 Image: Modifying alignment of an image (bug 48665)
25080 !! options
25081 parsoid={
25082 "modes": ["wt2wt"],
25083 "changes": [
25084 ["figure[class]", "removeClass", "mw-halign-right"],
25085 ["figure[class]", "addClass", "mw-halign-left"]
25086 ]
25087 }
25088 !! wikitext
25089 [[Image:Foobar.jpg|thumb|caption|right]]
25090 !! wikitext/edited
25091 [[Image:Foobar.jpg|thumb|caption|left]]
25092 !! end
25093
25094 !! test
25095 Image: Modifying mw-default-size of an frameless image (bug 62805)
25096 !! options
25097 parsoid={
25098 "modes": ["wt2wt"],
25099 "changes": [
25100 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25101 ]
25102 }
25103 !! wikitext
25104 [[Image:Foobar.jpg|frameless|right]]
25105 !! wikitext/edited
25106 [[Image:Foobar.jpg|frameless|right|220x220px]]
25107 !! end
25108
25109 !! test
25110 Image: Modifying valign of an image (bug 49221)
25111 !! options
25112 parsoid={
25113 "modes": ["wt2wt"],
25114 "changes": [
25115 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25116 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25117 ]
25118 }
25119 !! wikitext
25120 [[File:Foobar.jpg|20px|middle]]
25121 !! wikitext/edited
25122 [[File:Foobar.jpg|20px|text-top]]
25123 !! end
25124
25125 !! test
25126 Image: Modifying alt attribute of an image (bug 56400)
25127 !! options
25128 parsoid={
25129 "modes": ["wt2wt"],
25130 "changes": [
25131 ["img[alt]", "attr", "alt", "some alternate edited text"]
25132 ]
25133 }
25134 !! wikitext
25135 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25136 !! wikitext/edited
25137 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25138 !!end
25139
25140 !! test
25141 Image: Modifying caption of an image
25142 !! options
25143 parsoid={
25144 "modes": ["wt2wt"],
25145 "changes": [
25146 ["figcaption", "text", "new caption"]
25147 ]
25148 }
25149 !! wikitext
25150 [[Image:Foobar.jpg|thumb|original caption]]
25151 !! wikitext/edited
25152 [[Image:Foobar.jpg|thumb|new caption]]
25153 !!end
25154
25155 !! test
25156 Image: empty alt attribute (bug 48924)
25157 !! options
25158 parsoid
25159 !! wikitext
25160 [[File:Foobar.jpg|thumb|alt=|bar]]
25161 !! html
25162 <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>
25163 !! end
25164
25165 !! test
25166 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25167 !! options
25168 parsoid=html2wt
25169 language=ar
25170 disabled
25171 !! html/parsoid
25172 <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>
25173 !! wikitext
25174 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25175 !! end
25176
25177 !! test
25178 Image: Block level image should have \n before and after
25179 !! wikitext
25180 123
25181 [[File:Foobar.jpg|right|thumb|150x150px]]
25182 456
25183 !! html/parsoid
25184 <p>123</p>
25185 <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>
25186 <p>456</p>
25187 !!end
25188
25189 !! test
25190 Image: New block level image should have \n before and after (existing content)
25191 !! wikitext
25192 123
25193 [[File:Foobar.jpg|right|thumb|150x150px]]
25194 456
25195 !! html/parsoid
25196 <p>123</p>
25197 <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>
25198 <p>456</p>
25199 !!end
25200
25201 !! test
25202 Image: upright option (parsoid)
25203 !! wikitext
25204 [[File:Foobar.jpg|thumb|upright|caption]]
25205 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25206 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25207 !! html/parsoid
25208 <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>
25209 <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>
25210 <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>
25211 !!end
25212
25213 !! test
25214 Image: upright option is ignored on inline and frame images (parsoid)
25215 !! wikitext
25216 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25217 !! html/parsoid
25218 <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>
25219 !!end
25220
25221 !! test
25222 Image: from basic HTML (1)
25223 !! options
25224 parsoid=html2wt
25225 !! html/parsoid
25226 <span typeof="mw:Image">
25227 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25228 </span>
25229 !! wikitext
25230 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25231 !! end
25232
25233 !! test
25234 Image: from basic HTML (2)
25235 !! options
25236 parsoid=html2wt
25237 !! html/parsoid
25238 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25239 !! wikitext
25240 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25241 !! end
25242
25243 !! test
25244 Image: from basic HTML (3)
25245 !! options
25246 parsoid=html2wt
25247 !! html/parsoid
25248 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25249 !! wikitext
25250 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25251 !! end
25252
25253 !! test
25254 Image: from basic HTML (4)
25255 !! options
25256 parsoid=html2wt
25257 !! html/parsoid
25258 <img src="./File:Foobar.jpg">
25259 !! wikitext
25260 [[File:Foobar.jpg|link=]]
25261 !! end
25262
25263 !! test
25264 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25265 !! options
25266 parsoid=html2wt
25267 !! html/parsoid
25268 <ul>
25269 <li><p>foo</p></li>
25270 </ul>
25271 !! wikitext
25272 * foo
25273 !! end
25274
25275 !! test
25276 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25277 !! options
25278 parsoid=html2wt
25279 !! html/parsoid
25280 <ul> <li>foo</li></ul>
25281 !! wikitext
25282 * foo
25283 !! end
25284
25285 !! test
25286 Don't strip leading whitespace when handling indent-pre suppressing tags
25287 !! options
25288 parsoid=html2wt
25289 !! html/parsoid
25290 <table>
25291 <tr><td> indented row</td></tr>
25292 </table>
25293 <blockquote><p>
25294 <b>This is very bold of you!</b>
25295 </p>
25296 <table><tr><td>
25297 indented cell (no pre-wrapping!)
25298 </td></tr></table>
25299 </blockquote>
25300 <p>foo</p>
25301 <div>bar</div>
25302 !! wikitext
25303 {|
25304 | indented row
25305 |}
25306 <blockquote>
25307 '''This is very bold of you!'''
25308
25309 {|
25310 |
25311 indented cell (no pre-wrapping!)
25312 |}
25313 </blockquote>
25314 foo
25315 <div>bar</div>
25316 !! end
25317
25318 !! test
25319 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25320 !! options
25321 parsoid=html2wt
25322 !! html/parsoid
25323 <p>foo</p>
25324 <span>bar</span>
25325
25326 <span>foo2
25327 </span>bar2
25328
25329 <div>foo</div>
25330 <span>bar</span>
25331
25332 <div>
25333 <span>foo</span>
25334 </div>
25335 !! wikitext
25336 foo
25337
25338 <span>bar</span>
25339
25340 <span>foo2
25341 <nowiki> </nowiki></span>bar2
25342
25343 <div>foo</div>
25344 <nowiki> </nowiki><span>bar</span>
25345
25346 <div>
25347 <nowiki> </nowiki><span>foo</span>
25348 </div>
25349 !! end
25350
25351 !! test
25352 Lists: Dont insert newlines in a serialized list item.
25353 !! options
25354 parsoid=html2wt
25355 !! html/parsoid
25356 <ul><li>a<br>b</li><li>c</li></ul>
25357 !! wikitext
25358 * a<br>b
25359 * c
25360 !! end
25361
25362 !! test
25363 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25364 !! options
25365 parsoid={
25366 "modes": ["html2wt"],
25367 "scrubWikitext": false
25368 }
25369 !! html/parsoid
25370 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25371 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25372
25373 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25374 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25375
25376 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25377
25378 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25379 !! wikitext
25380 == hello there [[Category:A1]] ==
25381
25382 == [[Category:A2]] hi pal ==
25383
25384 == <!--foo--> [[Category:A3]] how goes it ==
25385
25386 == it goes well [[Category:A4]] <!--bar--> ==
25387
25388 ==howdy [[Category:A5]]==
25389
25390 == __TOC__ ok ==
25391 !! end
25392
25393 !! test
25394 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25395 !! options
25396 parsoid={
25397 "modes": ["html2wt"],
25398 "scrubWikitext": true
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><meta property="mw:PageProp/toc" /> ok</h2>
25408 !! wikitext
25409 == hello there ==
25410 [[Category:A1]]
25411 [[Category:A2]]
25412
25413 == hi pal ==
25414
25415 <!--foo--> [[Category:A3]]
25416
25417 == how goes it ==
25418
25419 == it goes well ==
25420 [[Category:A4]] <!--bar-->
25421
25422 __TOC__
25423
25424 == ok ==
25425 !! end
25426
25427 !! test
25428 Headings: Don't hoist metas that come from templates
25429 !! options
25430 parsoid={
25431 "modes": ["html2wt"],
25432 "scrubWikitext": true
25433 }
25434 !! html/parsoid
25435 <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>
25436 !! wikitext
25437 == {{echo|foo [[Category:Foo]]}} ==
25438 !! end
25439
25440 !! test
25441 Headings: Category in ref isn't hoisted
25442 !! options
25443 parsoid={
25444 "modes": ["html2wt"],
25445 "scrubWikitext": true
25446 }
25447 !! html/parsoid
25448 <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>
25449
25450 <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>
25451 !! wikitext
25452 == foo <ref>bar
25453 [[Category:Baz]] </ref> ==
25454
25455 <references />
25456 !! end
25457
25458 !! test
25459 Parsoid: Serialize positional parameters with = in them as named parameter
25460 !! options
25461 parsoid=html2wt
25462 !! html/parsoid
25463 <p about="#mwt1" typeof="mw:Transclusion"
25464 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25465
25466 <p about="#mwt1" typeof="mw:Transclusion"
25467 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25468
25469 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25470 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25471 <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>
25472 !! wikitext
25473 {{echo|1=f=oo}}
25474
25475 {{echo|1=f=oo|2=bar}}
25476
25477 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25478 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25479 {{echo|<nowiki>f=oo</nowiki>|bar}}
25480 !! end
25481
25482 !! test
25483 Parsoid: Serialize positional parameters with = in extlink as named parameter
25484 !! options
25485 parsoid=html2wt
25486 !! html/parsoid
25487 <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>
25488 !! wikitext
25489 {{echo|1=http://stuff?is=ok}}
25490 !! end
25491
25492 !! test
25493 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25494 !! options
25495 parsoid=html2wt
25496 !! html/parsoid
25497 <div>a<p>b</p></div>
25498 <div>a
25499 <p>b</p></div>
25500 <div>
25501 a
25502 <p>b</p></div>
25503 !! wikitext
25504 <div>a
25505 b
25506 </div>
25507 <div>a
25508 b
25509 </div>
25510 <div>
25511 a
25512
25513 b
25514 </div>
25515 !! end
25516
25517 !! test
25518 Substrings resembling wikitext in hrefs should not get nowiki escapes
25519 !! options
25520 parsoid=html2wt
25521 !! html/parsoid
25522 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25523 !! wikitext
25524 [[Foo''bar''baz]]
25525 !! end
25526
25527 !! test
25528 Enforce single-line context in the serializer
25529 !! options
25530 parsoid=html2wt
25531 !! html/parsoid
25532 <h2>testing
25533 123</h2>
25534
25535 <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">
25536 </span><span about="#mwt1">you</span> </h2>
25537
25538 <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>
25539
25540 <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
25541 there</span></li></ol>
25542
25543 <ul><li>asd
25544 sdf</li></ul>
25545
25546 <ul><li>foo
25547 bar
25548 baz</li>
25549 <li>foo <b>bar</b>
25550 baz</li></ul>
25551
25552 <dl><dt>hi
25553 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25554 ho</dd></dl>
25555
25556 <dl><dd> <table>
25557 <tbody><tr><td> ha
25558 ha
25559 ha</td></tr>
25560 </tbody></table></dd></dl>
25561 !! wikitext
25562 == testing 123 ==
25563
25564 == hi {{bogus|there
25565 you}} ==
25566
25567 == foo <ref>hello
25568 there</ref> ==
25569
25570 <references />
25571
25572 * asd sdf
25573
25574 * foo bar baz
25575 * foo '''bar''' baz
25576
25577 ; hi ho : hi ho
25578
25579 : {|
25580 | ha
25581 ha
25582 ha
25583 |}
25584 !! end
25585
25586 !! test
25587 Serialize new placeholder space without spans
25588 !! options
25589 parsoid=html2wt
25590 !! html/parsoid
25591 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25592
25593 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25594
25595 <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>
25596 !! wikitext
25597 foo : bar
25598
25599 foo : bar
25600
25601 <ref>foo : bar</ref>ok
25602 !! end
25603
25604
25605 #-----------------------
25606 # Tag minimization tests
25607 #-----------------------
25608
25609 !! test
25610 1. I/B quote minimization: wikitext-only tags should be combined
25611 !! options
25612 parsoid=html2wt
25613 !! html/parsoid
25614 <p><i>A</i><i>B</i></p>
25615 <p><b>A</b><b>B</b></p>
25616 <p><i>A</i><b><i>B</i></b></p>
25617 <p><b>A</b><i><b>B</b></i></p>
25618 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25619 <p><i><b>A</b></i><i><b>B</b></i></p>
25620 <p><i><b>A</b></i><b><i>B</i></b></p>
25621 <p><b><i>A</i></b><i><b>B</b></i></p>
25622 !! wikitext
25623 ''AB''
25624
25625 '''AB'''
25626
25627 ''A'''B'''''
25628
25629 '''A''B'''''
25630
25631 '''A''BC''D'''
25632
25633 '''''AB'''''
25634
25635 '''''AB'''''
25636
25637 '''''AB'''''
25638 !! end
25639
25640 !! test
25641 2. I/B quote minimization: wikitext and html tags should not be combined
25642 !! options
25643 parsoid=html2wt
25644 !! html/parsoid
25645 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25646 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25647 !! wikitext
25648 ''A''<i>B</i>
25649
25650 ''A''<nowiki/>'''<i>B</i>'''
25651 !! end
25652
25653 !! test
25654 3. I/B quote minimization: templated content stops minimization
25655 !! options
25656 parsoid=html2wt
25657 !! html/parsoid
25658 <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>
25659 <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>
25660 !! wikitext
25661 ''A''{{echo|''B''}}
25662
25663 ''A''{{echo|'''''B'''''}}
25664 !! end
25665
25666 !! test
25667 4. I/B quote minimization: new content should be mimimized with adjacent old content
25668 !! options
25669 parsoid=html2wt
25670 !! html/parsoid
25671 <p><i>A</i><i>B</i></p>
25672 <p><b>A</b><b>B</b></p>
25673 <p><i>A</i><b><i>B</i></b></p>
25674 !! wikitext
25675 ''AB''
25676
25677 '''AB'''
25678
25679 ''A'''B'''''
25680 !! end
25681
25682 !! test
25683 5a. Merge adjacent quote nodes if they've been edited
25684 !! options
25685 parsoid={
25686 "modes": ["wt2wt", "selser"],
25687 "changes": [
25688 ["p", "contents", "remove", ":contains('b')"]
25689 ]
25690 }
25691 !! wikitext
25692 ''a''b''c''
25693 !! wikitext/edited
25694 ''ac''
25695 !! end
25696
25697 !! test
25698 5b. Merge adjacent quote nodes if they've been edited
25699 !! options
25700 parsoid={
25701 "modes": ["wt2wt", "selser"],
25702 "changes": [
25703 ["#x", "remove"]
25704 ]
25705 }
25706 !! wikitext
25707 ''a''<span id="x">b</span>''c''
25708 !! wikitext/edited
25709 ''ac''
25710 !! end
25711
25712 !! test
25713 1. Merge adjacent link nodes as long as at least one element is new
25714 !! options
25715 parsoid={
25716 "modes": ["html2wt"],
25717 "scrubWikitext": true
25718 }
25719 !! html/parsoid
25720 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25721 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25722 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25723 !! wikitext
25724 [[Football]]
25725 [[Football]]
25726 [[Football|Foot]][[Football|ball]]
25727 !! end
25728
25729 !! test
25730 2. Merge adjacent link nodes and enable additional normalizations
25731 !! options
25732 parsoid={
25733 "modes": ["html2wt"],
25734 "scrubWikitext": true
25735 }
25736 !! html/parsoid
25737 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25738 !! wikitext
25739 [[Football|''Football'']]
25740 !! end
25741
25742 !! test
25743 3. Don't merge adjacent link nodes if scrubWikitext is false
25744 !! options
25745 parsoid={
25746 "modes": ["html2wt"],
25747 "scrubWikitext": false
25748 }
25749 !! html/parsoid
25750 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25751 !! wikitext
25752 [[Football|Foot]][[Football|ball]]
25753 !! end
25754
25755 #------------------------------
25756 # End of tag minimization tests
25757 #------------------------------
25758
25759 !!test
25760 Bug 54262: New entities
25761 !! options
25762 parsoid=html2wt
25763 !! html/parsoid
25764 <span typeof="mw:Entity">&nbsp;</span>
25765 !! wikitext
25766 &nbsp;
25767 !! end
25768
25769 ## Note that there is no wikitext output for 'unknownproperty' ##
25770 ## Unknown magic words are silently dropped ##
25771
25772 !! test
25773 Magic words
25774 !! options
25775 parsoid=html2wt
25776 !! html/parsoid
25777 <meta property='mw:PageProp/toc' />
25778 <meta property='mw:PageProp/notoc' />
25779 <meta property='mw:PageProp/forcetoc' />
25780 <meta property='mw:PageProp/index' />
25781 <meta property='mw:PageProp/noindex' />
25782 <meta property='mw:PageProp/nogallery' />
25783 <meta property='mw:PageProp/noeditsection' />
25784 <meta property='mw:PageProp/notitleconvert' />
25785 <meta property='mw:PageProp/nocontentconvert' />
25786 <meta property='mw:PageProp/unknownproperty' />
25787 !! wikitext
25788 __TOC__
25789 __NOTOC__
25790 __FORCETOC__
25791 __INDEX__
25792 __NOINDEX__
25793 __NOGALLERY__
25794 __NOEDITSECTION__
25795 __NOTITLECONVERT__
25796 __NOCONTENTCONVERT__
25797 !! end
25798
25799 !! test
25800 Consecutive <pre>s should not get merged
25801 !! options
25802 parsoid=html2wt,html2html
25803 !! html/parsoid
25804 <pre>a</pre><pre>b</pre>
25805
25806 <pre>c
25807 </pre><pre>
25808 d</pre>
25809
25810 <pre>e
25811
25812 </pre><pre>
25813
25814 f</pre>
25815 !! wikitext
25816 a
25817
25818 b
25819
25820 c
25821
25822 d
25823
25824 e
25825
25826
25827
25828 f
25829 !! end
25830
25831 !! test
25832 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25833 !! options
25834 parsoid=html2wt
25835 !! html/parsoid
25836 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25837 !! wikitext
25838 [[Special:BookSources/1234567890|ISBN 1234567895]]
25839 !! end
25840
25841 !! test
25842 Edited RFC links not serializable as RFC links should serialize as extlinks
25843 !! options
25844 parsoid=html2wt
25845 !! html/parsoid
25846 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25847 !! wikitext
25848 [//tools.ietf.org/html/rfc123 New RFC]
25849 !! end
25850
25851 !! test
25852 Edited PMID links not serializable as PMID links should serialize as extlinks
25853 !! options
25854 parsoid=html2wt
25855 !! html/parsoid
25856 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25857 !! wikitext
25858 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25859 !! end
25860
25861 !! test
25862 WTS of autolinks with trailing/surrounding context
25863 !! options
25864 parsoid=html2wt
25865 !! html/parsoid
25866 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25867 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25868 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25869 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25870 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25871 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25872 !! wikitext
25873 http://cscott.net'''foo'''
25874
25875 http://cscott.net<b>foo</b>
25876
25877 '''http://cscott.net'''
25878
25879 '''http://cscott.net '''
25880
25881 '''http://cscott.net<nowiki/>x'''
25882
25883 http://cscott.net<nowiki/>x
25884 !! end
25885
25886 !! test
25887 WTS of autolinks with nowikis (round-trip)
25888 !! wikitext
25889 x<nowiki/>http://cscott.net<nowiki/>x
25890 !! html/parsoid
25891 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25892 !! end
25893
25894 # this is the "easy" test because it leaves in place all the
25895 # data-parsoid information indicating this is an autolink
25896 !! test
25897 WTS of autolinks with escapes (editing)
25898 !! options
25899 parsoid={
25900 "modes": ["wt2wt"],
25901 "changes": [
25902 [ "meta", "remove" ]
25903 ]
25904 }
25905 !! wikitext
25906 x<nowiki/>http://cscott.net<nowiki/>x
25907 !! wikitext/edited
25908 x<nowiki/>http://cscott.net<nowiki/>x
25909 !! end
25910
25911 !! test
25912 WTS of edited autolink-like text (T103364)
25913 !! options
25914 parsoid={
25915 "modes": ["wt2wt"],
25916 "changes": [
25917 [ "span[typeof]", "removeAttr", "typeof" ]
25918 ]
25919 }
25920 !! wikitext
25921 Not a link: <nowiki>http://example.com</nowiki>.
25922 !! wikitext/edited
25923 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25924 !! end
25925
25926 !! test
25927 WTS of newly-authored autolink-like text (T103364)
25928 !! options
25929 parsoid=html2wt
25930 !! html/parsoid
25931 <p>http://example.com is not a link.</p>
25932 !! wikitext
25933 <nowiki>http://example.com</nowiki> is not a link.
25934 !! end
25935
25936 !! test
25937 WTS of autolink-like text after an autolink (T108563)
25938 !! options
25939 parsoid=html2wt
25940 !! html/parsoid
25941 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25942 !! wikitext
25943 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25944 !! end
25945
25946 !! test
25947 Magic links inside links (not autolinked)
25948 !! wikitext
25949 [[Foo|http://example.com]]
25950 [[Foo|RFC 1234]]
25951 [[Foo|PMID 1234]]
25952 [[Foo|ISBN 123456789x]]
25953
25954 [http://foo.com http://example.com]
25955 [http://foo.com RFC 1234]
25956 [http://foo.com PMID 1234]
25957 [http://foo.com ISBN 123456789x]
25958 !! html+tidy
25959 <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>
25960 <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>
25961 !! html/parsoid
25962 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25963 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25964 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25965 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25966
25967 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25968 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25969 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25970 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25971 !! end
25972
25973 !! test
25974 Magic links inside image captions (autolinked)
25975 !! wikitext
25976 [[File:Foobar.jpg|thumb|http://example.com]]
25977 [[File:Foobar.jpg|thumb|RFC 1234]]
25978 [[File:Foobar.jpg|thumb|PMID 1234]]
25979 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25980 !! html+tidy
25981 <div class="thumb tright">
25982 <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>
25983 <div class="thumbcaption">
25984 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25985 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25986 </div>
25987 </div>
25988 <div class="thumb tright">
25989 <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>
25990 <div class="thumbcaption">
25991 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25992 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25993 </div>
25994 </div>
25995 <div class="thumb tright">
25996 <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>
25997 <div class="thumbcaption">
25998 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25999 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26000 </div>
26001 </div>
26002 <div class="thumb tright">
26003 <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>
26004 <div class="thumbcaption">
26005 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26006 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26007 </div>
26008 </div>
26009 !! html/parsoid
26010 <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>
26011 <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>
26012 <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>
26013 <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>
26014 !! end
26015
26016 !! test
26017 WTS of magic word text (T109371)
26018 !! options
26019 parsoid=html2wt
26020 !! html/parsoid
26021 <p>RFC 1234</p>
26022 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26023 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26024 !! wikitext
26025 <nowiki>RFC 1234</nowiki>
26026
26027 [http://foo.com RFC 1234]
26028
26029 [[Foo|RFC 1234]]
26030 !! end
26031
26032 !! test
26033 Edited Redirect link should emit a non-piped wikitext link
26034 !! options
26035 parsoid=html2wt
26036 !! html/parsoid
26037 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26038 !! wikitext
26039 #REDIRECT [[Bar]]
26040 !! end
26041
26042 !! test
26043 T75121: Infer extension name from typeOf if data-mw is not present
26044 !! options
26045 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26046 !! html/parsoid
26047 <div typeOf="mw:Extension/foo"></div>
26048 !! wikitext
26049 <foo />
26050 !! end
26051
26052 # Note that the <p> wrapping isn't present in PHP parser output
26053 # The important thing for this test is that P-wrapping doesn't
26054 # interfere with the <nowiki> protection for leading - in <td>
26055 # (which isn't necessary for <th>).
26056 !! test
26057 T88318: p-wrapped dash in table.
26058 !! options
26059 parsoid=html2wt,wt2wt
26060 !! html/parsoid
26061 <table><tbody>
26062 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26063 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26064 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26065 </tbody></table>
26066 !! wikitext
26067 {|
26068 !-
26069 !-
26070 |-
26071 |<nowiki>-</nowiki>
26072 |<nowiki>- </nowiki>
26073 |-
26074 |<small>-</small>
26075 |<br>
26076 -
26077 |<br>
26078 -
26079 |}
26080 !! html/php+tidy
26081 <table>
26082 <tr>
26083 <th>-</th>
26084 <th>-</th>
26085 </tr>
26086 <tr>
26087 <td>-</td>
26088 <td>-</td>
26089 </tr>
26090 <tr>
26091 <td><small>-</small></td>
26092 <td><br />
26093 <p>-</p>
26094 </td>
26095 <td><br />
26096 <p>-</p>
26097 </td>
26098 </tr>
26099 </table>
26100 !! end
26101
26102 !! test
26103 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26104 !! options
26105 parsoid=html2wt
26106 !! html/parsoid
26107 <table id='mwAb'>
26108 <td id='mwAc'>foo</td>
26109 <td id='serialize-this'>bar</td>
26110 </table>
26111 !! wikitext
26112 {|
26113 |foo
26114 | id="serialize-this" |bar
26115 |}
26116 !! end
26117
26118 !! test
26119 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26120 !! options
26121 parsoid=html2wt
26122 !! html/parsoid
26123 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26124 !! wikitext
26125 <div id="hello">ok</div>
26126 !! end
26127
26128 !! test
26129 WTS change modes
26130 !! options
26131 parsoid={
26132 "modes": ["wt2wt"],
26133 "changes": [
26134 [ "#xyz", "before", "<b>before</b> stuff " ],
26135 [ "#xyz", "after", " stuff <i>after</i>" ],
26136 [ "#xyz", "html", "x <b>y</b> z" ]
26137 ]
26138 }
26139 !! wikitext
26140 <span id="xyz">hello</span>
26141 !! wikitext/edited
26142 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26143 !! end
26144
26145 !! test
26146 Never serialize a-tag as html, regardless of what data-parsoid has to say
26147 !! options
26148 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26149 !! html/parsoid
26150 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26151 !! wikitext
26152 [[Foo]]
26153 !! end
26154
26155 ## SSS FIXME: This is broken output nevertheless.
26156 ## What might be a reasonable non-broken output for this?
26157 ## This is an edge case unlikely to be seen in production
26158 ## that I am not wasting more time on this right now.
26159 !! test
26160 Never serialize a-tag as html, no matter what attributes it has
26161 !! options
26162 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26163 !! html/parsoid
26164 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26165 !! wikitext
26166 [http://boo.org http://boohoo.org]
26167 !! end
26168
26169 # Misnested is an indication that selser can reuse the source but these have
26170 # shown to sneak through on occasion. See T101768.
26171 # The original wikitext here is: [http://test.com [[one]] two three]
26172 !! test
26173 Strip span tags added to mark misnested links
26174 !! options
26175 parsoid=html2wt
26176 !! html/parsoid
26177 <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>
26178 !! wikitext
26179 [http://test.com][[one]] two three
26180 !! end
26181
26182 !! test
26183 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26184 !! options
26185 parsoid=html2wt
26186 !! html/parsoid
26187 <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|}"]}'>
26188 <tbody><tr><td>d
26189 </td></tr>
26190 </tbody></table>
26191 !! wikitext
26192 {{echo|a}}
26193 {|{{echo|c
26194 {{!}}d
26195 }}
26196 |}
26197 !! end
26198
26199 ## This test verifies the presence and computation of this attribute indirectly
26200 ## by making an edit and ensuring that the serialization is correct (which it would be
26201 ## only if firstWikitextNode is properly set).
26202 !! test
26203 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26204 !! options
26205 parsoid= {
26206 "modes": ["wt2wt"],
26207 "changes": [
26208 [ "div#x", "remove" ],
26209 [ "div", "before", "<div>new</div>" ]
26210 ]
26211 }
26212 !! wikitext
26213 <div id="x">foo</div>
26214 {|
26215 {{echo|<div>boo</div>
26216 {{!}}b}}
26217 |c
26218 |}
26219 !! wikitext/edited
26220
26221 <div>new</div>
26222 {|
26223 {{echo|<div>boo</div>
26224 {{!}}b}}
26225 |c
26226 |}
26227 !! end
26228
26229 # --------------------------------------------
26230 # Tests spec'ing wikitext serialization norms |
26231 # --------------------------------------------
26232
26233 !! test
26234 1. Categories should always be serialized on their own line
26235 !! options
26236 parsoid=html2wt
26237 !! html/parsoid
26238 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26239 !! wikitext
26240 foo
26241 [[Category:Foo]]
26242 bar
26243 !! end
26244
26245 !! test
26246 2. Categories that are part of templates should not introduce a line break
26247 !! wikitext
26248 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26249 !! html/parsoid
26250 <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>
26251 !! end
26252
26253 # Careful while editing these next 2 tests. There are \u200f characters
26254 # before and after the <link> tags in the HTML and following some
26255 # of the categories in wikitext
26256 # Do not remove these characters in edits.
26257 #
26258 # As part of the serialization, these bidi characters will get stripped.
26259 !! test
26260 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26261 !! options
26262 parsoid={
26263 "modes": ["html2wt"],
26264 "scrubWikitext": true
26265 }
26266 !! html/parsoid
26267 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26268 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26269 !! wikitext
26270 [[קטגוריה:טקסים]]
26271 [[קטגוריה: שיטות משפט]]
26272 !! end
26273
26274 !! test
26275 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26276 !! options
26277 parsoid={
26278 "modes": ["html2wt"],
26279 "scrubWikitext": true
26280 }
26281 !! html/parsoid
26282 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26283 !! wikitext
26284 [[קטגוריה:טקסים]]
26285 ‏y
26286 !! end
26287
26288 !! test
26289 Lists: Add space after bullets
26290 !! options
26291 parsoid=html2wt
26292 !! html/parsoid
26293 <ul>
26294 <li>foo</li>
26295 <li> bar</li>
26296 <li><span> baz</span></li>
26297 </ul>
26298 !! wikitext
26299 * foo
26300 * bar
26301 * <span> baz</span>
26302 !! end
26303
26304 !! test
26305 1. Headings: Add space before/after == (T53744)
26306 !! options
26307 parsoid=html2wt
26308 !! html/parsoid
26309 <h2>foo</h2>
26310 <h2> bar</h2>
26311 <h2>baz </h2>
26312 <h2><span> baz</span></h2>
26313 !! wikitext
26314 == foo ==
26315
26316 == bar ==
26317
26318 == baz ==
26319
26320 == <span> baz</span> ==
26321 !! end
26322
26323 !! test
26324 2. Headings: Add space before/after == even after hoisted content
26325 !! options
26326 parsoid={
26327 "modes": ["html2wt"],
26328 "scrubWikitext": true
26329 }
26330 !! html/parsoid
26331 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26332 !! wikitext
26333 [[Category:A2]]
26334
26335 == ok ==
26336 !! end
26337
26338 !! test
26339 1. Headings: suppress newly created empty headings
26340 !! options
26341 parsoid={
26342 "modes": ["html2wt"],
26343 "scrubWikitext": true
26344 }
26345 !! html/parsoid
26346 <h2></h2>
26347 !! wikitext
26348 !! end
26349
26350 !! test
26351 2. Headings: don't suppress empty headings if scrubWikitext is false
26352 !! options
26353 parsoid=html2wt
26354 !! html/parsoid
26355 <h2></h2>
26356 !! wikitext
26357 ==<nowiki/>==
26358 !! end
26359
26360 !! test
26361 3. Headings: suppress empty headings on edits
26362 !! options
26363 parsoid={
26364 "modes": ["selser"],
26365 "scrubWikitext": true,
26366 "changes": [
26367 [ "#x", "remove"]
26368 ]
26369 }
26370 !! wikitext
26371 ==<span id="x">foo</span>==
26372 !! wikitext/edited
26373 !! end
26374
26375 !! test
26376 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26377 !! options
26378 parsoid={
26379 "modes": ["html2wt"],
26380 "scrubWikitext": true
26381 }
26382 !! html/parsoid
26383 <h2>foo<br/>bar</h2>
26384 <h2>foo <span><br/>bar</span> baz</h2>
26385 !! wikitext
26386 == foo bar ==
26387
26388 == foo <span> bar</span> baz ==
26389 !! end
26390
26391 !! test
26392 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26393 !! options
26394 parsoid={
26395 "modes": ["html2wt"],
26396 "scrubWikitext": false
26397 }
26398 !! html/parsoid
26399 <h2>foo<br/>bar</h2>
26400 !! wikitext
26401 == foo<br> bar ==
26402 !! end
26403
26404 !! test
26405 1. WT Quote Tags: suppress newly created empty style tags
26406 !! options
26407 parsoid={
26408 "modes": ["html2wt"],
26409 "scrubWikitext": true
26410 }
26411 !! html/parsoid
26412 <i></i><b></b>
26413 !! wikitext
26414 !! end
26415
26416 !! test
26417 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26418 !! options
26419 parsoid=html2wt
26420 !! html/parsoid
26421 <i></i><b></b>
26422 !! wikitext
26423 ''<nowiki/>'''''<nowiki/>'''
26424 !! end
26425
26426 !! test
26427 3. WT Quote Tags: suppress empty style tags on edits
26428 !! options
26429 parsoid={
26430 "modes": ["selser"],
26431 "scrubWikitext": true,
26432 "changes": [
26433 [ "#x", "remove"]
26434 ]
26435 }
26436 !! wikitext
26437 '''<span id="x">foo</span>'''
26438 !! wikitext/edited
26439 !! end
26440
26441 !! test
26442 1. Anchors: suppress newly created empty anchors
26443 !! options
26444 parsoid={
26445 "modes": ["html2wt"],
26446 "scrubWikitext": true
26447 }
26448 !! html/parsoid
26449 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26450 !! wikitext
26451 !! end
26452
26453 !! test
26454 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26455 !! options
26456 parsoid={
26457 "modes": ["html2wt"],
26458 "scrubWikitext": false
26459 }
26460 !! html/parsoid
26461 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26462 !! wikitext
26463 [[Test|<nowiki/>]]
26464 !! end
26465
26466 !! test
26467 3. Anchors: suppress empty anchors on edits
26468 !! options
26469 parsoid={
26470 "modes": ["selser"],
26471 "scrubWikitext": true,
26472 "changes": [
26473 [ "#x", "remove"]
26474 ]
26475 }
26476 !! wikitext
26477 [[Test|<span id="x">foo</span>]]
26478 !! wikitext/edited
26479 !! end
26480
26481 !! test
26482 3a. Anchors: do not suppress numbered extlinks
26483 !! options
26484 parsoid={
26485 "modes": ["wt2wt"],
26486 "scrubWikitext": true
26487 }
26488 !! wikitext
26489 [http://foo.com]
26490 !! html/parsoid
26491 <a rel="mw:ExtLink" href="http://foo.com"></a>
26492 !! end
26493
26494 !! test
26495 3b. Anchors: do not suppress numbered extlinks
26496 !! options
26497 parsoid={
26498 "modes": ["wt2wt"],
26499 "scrubWikitext": true,
26500 "changes": [
26501 [ "#x", "remove"]
26502 ]
26503 }
26504 !! wikitext
26505 [http://foo.com <span id="x">foo</span>]
26506 !! wikitext/edited
26507 [http://foo.com]
26508 !! end
26509
26510 !!test
26511 Normalizations should be restricted to edited content
26512 !!options
26513 parsoid={
26514 "modes": ["selser"],
26515 "scrubWikitext": true,
26516 "changes": [
26517 [ "h1", "before", "<i></i>"]
26518 ]
26519 }
26520 !!wikitext
26521 a
26522 = =
26523 b
26524 !!wikitext/edited
26525 a
26526 = =
26527 b
26528 !!end
26529
26530 !! test
26531 1. Multiple normalizations (html2wt)
26532 !! options
26533 parsoid={
26534 "modes": ["html2wt"],
26535 "scrubWikitext": true
26536 }
26537 !! html
26538 <h2><i></i></h2>
26539 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26540 </a><b><i></i></b>x</p>
26541 !! wikitext
26542
26543 [[foo]]
26544 x
26545
26546 !! end
26547
26548 !! test
26549 2. Multiple normalizations (selser)
26550 !! options
26551 parsoid={
26552 "modes": ["selser"],
26553 "scrubWikitext": true,
26554 "changes": [
26555 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26556 ]
26557 }
26558 !! wikitext
26559 <span id="x">foo</span>
26560 !! wikitext/edited
26561 <span id="x">foo</span>
26562
26563 x
26564 !! end
26565
26566 !! test
26567 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26568 !! options
26569 parsoid={
26570 "modes": ["html2wt"],
26571 "scrubWikitext": true
26572 }
26573 !! html/parsoid
26574 <p> hi</p>
26575 <p> hello</p>
26576 !! wikitext
26577 hi
26578
26579 hello
26580 !! end
26581
26582 !! test
26583 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26584 !! options
26585 parsoid=html2wt
26586 !! html/parsoid
26587 <p> hi</p>
26588 <p> hello</p>
26589 !! wikitext
26590 <nowiki> </nowiki>hi
26591
26592 <nowiki> </nowiki> hello
26593 !! end
26594
26595 !! test
26596 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26597 !! options
26598 parsoid={
26599 "modes": ["html2wt"],
26600 "scrubWikitext": true
26601 }
26602 !! html/parsoid
26603 <p>Foo
26604 bar
26605 baz</p>
26606
26607 <table><tr><td>Foo
26608 bar
26609 baz bang</td></tr></table>
26610
26611 <p><!--boo--> foo
26612 bar</p>
26613
26614 <p> foo
26615 bar<span>boo</span></p>
26616 !! wikitext
26617 Foo
26618 bar
26619 baz
26620
26621 {|
26622 |Foo
26623 bar
26624 baz bang
26625 |}
26626
26627 <!--boo-->foo
26628 bar
26629
26630 foo
26631 bar<span>boo</span>
26632 !! end
26633
26634 !! test
26635 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26636 !! options
26637 parsoid={
26638 "modes": ["selser"],
26639 "scrubWikitext": true,
26640 "changes": [
26641 [ "p", "html", " a\n b" ]
26642 ]
26643 }
26644 !! wikitext
26645 xyz
26646 !! wikitext/edited
26647 a
26648 b
26649 !! end
26650
26651 !! test
26652 1. New links that end in spaces
26653 !! options
26654 parsoid={
26655 "modes": ["html2wt"],
26656 "scrubWikitext": false
26657 }
26658 !! html/parsoid
26659 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26660 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26661 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26662 !! wikitext
26663 [[Berlin ]]<nowiki/>is the capital of Germany.
26664
26665 [[Foo ]]'''bar'''
26666
26667 [[Boston ]] is a city.
26668 !! end
26669
26670 !! test
26671 2. New links that end in spaces
26672 !! options
26673 parsoid={
26674 "modes": ["html2wt"],
26675 "scrubWikitext": true
26676 }
26677 !! html/parsoid
26678 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26679 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26680 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26681 !! wikitext
26682 [[Berlin]] is the capital of Germany.
26683
26684 [[Foo]] '''bar'''
26685
26686 [[Boston]] is a city.
26687 !! end
26688
26689 !! test
26690 1. Table cells with escapable prefixes
26691 !! options
26692 parsoid={
26693 "modes": ["html2wt"],
26694 "scrubWikitext": false
26695 }
26696 !! html
26697 <table>
26698 <tr><td>a</td></tr>
26699 <tr><td>-</td></tr>
26700 <tr><td>+</td></tr>
26701 </table>
26702 !! wikitext
26703 {|
26704 |a
26705 |-
26706 |<nowiki>-</nowiki>
26707 |-
26708 |<nowiki>+</nowiki>
26709 |}
26710 !! end
26711
26712 !! test
26713 2. Table cells with escapable prefixes
26714 !! options
26715 parsoid={
26716 "modes": ["html2wt"],
26717 "scrubWikitext": true
26718 }
26719 !! html
26720 <table>
26721 <tr><td>a</td></tr>
26722 <tr><td>-</td></tr>
26723 <tr><td>+</td></tr>
26724 </table>
26725 !! wikitext
26726 {|
26727 |a
26728 |-
26729 | -
26730 |-
26731 | +
26732 |}
26733 !! end
26734
26735 !! test
26736 3a. Table cells with escapable prefixes after edits
26737 !! options
26738 parsoid={
26739 "modes": ["selser"],
26740 "scrubWikitext": true,
26741 "changes": [
26742 [ "table tbody tr:first-child td:first-child", "remove"]
26743 ]
26744 }
26745 !! wikitext
26746 {|
26747 |a||-
26748 |}
26749 !! wikitext/edited
26750 {|
26751 | -
26752 |}
26753 !! end
26754
26755 !! test
26756 3b. Table cells with escapable prefixes after edits
26757 !! options
26758 parsoid={
26759 "modes": ["selser"],
26760 "scrubWikitext": true,
26761 "changes": [
26762 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26763 [ "#x", "remove" ]
26764 ]
26765 }
26766 !! wikitext
26767 {|
26768 |pqr
26769 |<span id="x">foo</span>+
26770 |}
26771 !! wikitext/edited
26772 {|
26773 | -
26774 | +
26775 |}
26776 !! end
26777
26778 # FIXME: This test will fail because
26779 # normalization doesn't realize that the id attribute
26780 # will eliminate the escapable scenario
26781 !! test
26782 4a. Table cells without escapable prefixes after edits
26783 !! options
26784 parsoid={
26785 "modes": ["selser"],
26786 "scrubWikitext": true,
26787 "changes": [
26788 [ "#x", "html", "-" ]
26789 ]
26790 }
26791 !! wikitext
26792 {|
26793 | id="x" |abcd
26794 |}
26795 !! wikitext/edited
26796 {|
26797 | id="x" |-
26798 |}
26799 !! end
26800
26801 ## This tests normalizer's ability to discriminate between
26802 ## cells having identical content.
26803 !! test
26804 4b. Table cells without escapable prefixes after edits
26805 !! options
26806 parsoid={
26807 "modes": ["selser"],
26808 "scrubWikitext": true,
26809 "changes": [
26810 [ "td", "html", "-" ]
26811 ]
26812 }
26813 !! wikitext
26814 {|
26815 |a||b
26816 |}
26817 !! wikitext/edited
26818 {|
26819 | -||-
26820 |}
26821 !! end
26822
26823 ## This tests normalizer's ability to not be tripped by
26824 ## comments (and whitespace)
26825 !! test
26826 4c. Table cells without escapable prefixes after edits
26827 !! options
26828 parsoid={
26829 "modes": ["selser"],
26830 "scrubWikitext": true,
26831 "changes": [
26832 [ "table tbody tr td:first-child", "remove" ]
26833 ]
26834 }
26835 !! wikitext
26836 {|
26837 |-
26838 <!--foo--> |a||-
26839 |}
26840 !! wikitext/edited
26841 {|
26842 |-
26843 <!--foo--> | -
26844 |}
26845 !! end
26846
26847 ## This tests normalizer's ability to handle HTML cells
26848 !! test
26849 4d. Table cells without escapable prefixes after edits
26850 !! options
26851 parsoid={
26852 "modes": ["selser"],
26853 "scrubWikitext": true,
26854 "changes": [
26855 [ "td", "html", "-" ]
26856 ]
26857 }
26858 !! wikitext
26859 <table>
26860 <tr><td>a</td></tr>
26861 </table>
26862 !! wikitext/edited
26863 <table>
26864 <tr><td>-</td></tr>
26865 </table>
26866 !! end
26867
26868 ## T111151 Remove font elements without attributes
26869 !! test
26870 5a. font tags without attributes should be dropped in scrubWikitext mode
26871 !! options
26872 parsoid={
26873 "modes": ["html2wt"],
26874 "scrubWikitext": true
26875 }
26876 !! html
26877 <font>foo</font>
26878 <font><font>bar</font></font>
26879 <font class="x">boo</font>
26880 !! wikitext
26881 foo
26882 bar
26883 <font class="x">boo</font>
26884 !! end
26885
26886 !! test
26887 5b. font tags should not be dropped without scrubWikitext being enabled
26888 !! options
26889 parsoid={
26890 "modes": ["html2wt"],
26891 "scrubWikitext": false
26892 }
26893 !! html
26894 <font>foo</font>
26895 !! wikitext
26896 <font>foo</font>
26897 !! end
26898
26899 !! test
26900 Escape nowiki DOM elements
26901 !! options
26902 parsoid=html2wt
26903 !! html/parsoid
26904 <nowiki><i>foo</i></nowiki>
26905 !! wikitext
26906 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26907 !! end
26908
26909 # This is meant to be an interim fix while we go about figuring out
26910 # how to not introduce these trailing <nowiki/>s in the first place.
26911 !! test
26912 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26913 !! options
26914 parsoid=html2wt
26915 !! html/parsoid
26916 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26917 y</p>
26918 <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>
26919 <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>
26920 !! wikitext
26921 x
26922 y
26923
26924 {{echo|
26925 1 = <nowiki/>}}
26926
26927 {{echo|
26928 1 = <nowiki/>
26929 }}
26930 !! end
26931
26932 # ---------------------------------------------------
26933 # End of tests spec'ing wikitext serialization norms |
26934 # ---------------------------------------------------
26935
26936 # T104032
26937 !! test
26938 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26939 !! options
26940 parsoid=html2wt
26941 !! html/parsoid
26942 a<p>b</p>
26943 <b>c</b><p>d</p>
26944 <table><tr>
26945 <td>a<p>b</p></td>
26946 <td><b>c</b><p>d</p></td>
26947 </tr></table>
26948 !! wikitext
26949 a
26950
26951 b
26952
26953 '''c'''
26954
26955 d
26956 {|
26957 |a
26958 b
26959 |'''c'''
26960 d
26961 |}
26962 !! end
26963
26964 # -----------------------------------------------------------------
26965 # End of section for Parsoid-only html2wt tests for serialization
26966 # of new content
26967 # -----------------------------------------------------------------
26968
26969 # -----------------------------------------------------------------
26970 # The following section of tests are primarily to spec behavior of
26971 # the selective serializer. All these tests have manual selser
26972 # changes. The automated selser changes for all tests handle the
26973 # wide variation of changes, but these tests here capture specs
26974 # deterministically.
26975 # ----------------------------------------------------------------
26976
26977 ## T90517
26978 !! test
26979 Selser: New comments should not be lost
26980 !! options
26981 parsoid={
26982 "modes": ["selser"],
26983 "changes": [
26984 [ "#a", "after", "<!--c1-->" ],
26985 [ "#b", "before", "<!--c2-->" ]
26986 ]
26987 }
26988 !! wikitext
26989 <span id="a">a</span>
26990
26991 <span id="b">b</span>
26992 !! wikitext/edited
26993 <span id="a">a</span><!--c1-->
26994
26995 <!--c2--><span id="b">b</span>
26996 !! end
26997
26998 ## T89383
26999 !! test
27000 Selser: Check for validity of DSR before using it
27001 !! options
27002 parsoid={
27003 "modes": ["selser"],
27004 "changes": [
27005 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27006 ]
27007 }
27008 !! wikitext
27009 <span id="a">a</span>
27010 !! wikitext/edited
27011 {{DISPLAYTITLE:foo}}
27012 <span id="a">a</span>
27013 !! end
27014
27015 !! test
27016 1. DOMDiff: Changes to <ref> content should be looked up using id
27017 !! options
27018 parsoid={
27019 "modes": ["selser"],
27020 "changes": [
27021 ["#X", "after", "bar"],
27022 ["#Y", "after", "baz"]
27023 ]
27024 }
27025 !! wikitext
27026 X <ref><span id="X">foo</span></ref>
27027 Y <ref name="a" />
27028 <references>
27029 <ref name="a"><span id="Y">foo</span></ref>
27030 </references>
27031 !! wikitext/edited
27032 X <ref><span id="X">foo</span>bar</ref>
27033 Y <ref name="a" />
27034 <references>
27035 <ref name="a"><span id="Y">foo</span>baz</ref>
27036 </references>
27037 !! end
27038
27039 !! test
27040 2. DOMDiff: Changes to <ref> content should be looked up using id
27041 !! options
27042 parsoid={
27043 "modes": ["selser"],
27044 "changes": [
27045 ["#Z", "after", "bar"]
27046 ]
27047 }
27048 !! wikitext
27049 A <ref>foo bar for a</ref>
27050 B <ref group="X" name="b" />
27051
27052 <references />
27053
27054 <references group="X">
27055 <ref name="b"><span id="Z">foo</span></ref>
27056 </references>
27057 !! wikitext/edited
27058 A <ref>foo bar for a</ref>
27059 B <ref group="X" name="b" />
27060
27061 <references />
27062
27063 <references group="X">
27064 <ref name="b"><span id="Z">foo</span>bar</ref>
27065 </references>
27066 !! end
27067
27068 !! test
27069 Empty LI (T49673)
27070 !! wikitext
27071 * a
27072 *
27073 *
27074 * b
27075 !! html/php+tidy
27076 <ul>
27077 <li>a</li>
27078 <li class="mw-empty-li"></li>
27079 <li class="mw-empty-li"></li>
27080 <li>b</li>
27081 </ul>
27082 !! end