523953c1d41d1e41b09b81a05f5f7cefde0bd66b
[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 image
4787 !! wikitext
4788 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4789 !! html
4790 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4791 </p>
4792 !! end
4793
4794 !! test
4795 External image from https
4796 !! wikitext
4797 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4800 </p>
4801 !! end
4802
4803 !! test
4804 External image (when not allowed)
4805 !! options
4806 wgAllowExternalImages=0
4807 !! wikitext
4808 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4809 !! html
4810 <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>
4811 </p>
4812 !! end
4813
4814 !! test
4815 Link to non-http image, no img tag
4816 !! wikitext
4817 Link to non-http image, no img tag: ftp://example.com/test.jpg
4818 !! html
4819 <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>
4820 </p>
4821 !! end
4822
4823 !! test
4824 External links: terminating separator
4825 !! wikitext
4826 Terminating separator: http://example.com/thing,
4827 !! html
4828 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: intervening separator
4834 !! wikitext
4835 Intervening separator: http://example.com/1,2,3
4836 !! html
4837 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4838 </p>
4839 !! end
4840
4841 !! test
4842 External links: old bug with URL in query
4843 !! wikitext
4844 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4845 !! html
4846 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4847 </p>
4848 !! end
4849
4850 !! test
4851 External links: old URL-in-URL bug, mixed protocols
4852 !! wikitext
4853 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4854 !! html
4855 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4856 </p>
4857 !!end
4858
4859 !! test
4860 External links: URL in text
4861 !! wikitext
4862 URL in text: [http://example.com http://example.com]
4863 !! html
4864 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4865 </p>
4866 !! end
4867
4868 !! test
4869 External links: Clickable images
4870 !! wikitext
4871 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4872 !! html/php
4873 <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>
4874 </p>
4875 !! html/parsoid
4876 <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>
4877 !! end
4878
4879 !! test
4880 External links: raw ampersand
4881 !! wikitext
4882 Old &amp; use: http://x&y
4883 !! html
4884 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4885 </p>
4886 !! end
4887
4888 !! test
4889 External links: encoded ampersand
4890 !! wikitext
4891 Old &amp; use: http://x&amp;y
4892 !! html/php
4893 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4894 </p>
4895 !! html/parsoid
4896 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4897 !! end
4898
4899 !! test
4900 External links: encoded equals (bug 6102)
4901 !! wikitext
4902 http://example.com/?foo&#61;bar
4903 !! html/php
4904 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4905 </p>
4906 !! html/parsoid
4907 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4908 !! end
4909
4910 ##
4911 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4912 ## does it number them. As discussed in bug 53505, we can identify
4913 ## autonumbered links via CSS.
4914 ##
4915
4916 !! test
4917 External links: [raw ampersand]
4918 !! wikitext
4919 Old &amp; use: [http://x&y]
4920 !! html/php
4921 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4922 </p>
4923 !! html/parsoid
4924 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4925 !! end
4926
4927 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4928 # mode will return the [raw ampersand] wikitext
4929 !! test
4930 External links: [encoded ampersand]
4931 !! options
4932 parsoid=wt2html,wt2wt,html2html
4933 !! wikitext
4934 Old &amp; use: [http://x&amp;y]
4935 !! html/php
4936 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4937 </p>
4938 !! html/parsoid
4939 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4940 !! end
4941
4942 !! test
4943 External links: [raw equals]
4944 !! wikitext
4945 [http://example.com/?foo=bar]
4946 !! html/php
4947 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4948 </p>
4949 !! html/parsoid
4950 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4951 !! end
4952
4953 # note that parsoid html is identical to [raw equals] case; so html2wt
4954 # mode will return the [raw equals] wikitext
4955 !! test
4956 External links: [encoded equals] (bug 6102)
4957 !! options
4958 parsoid=wt2html,wt2wt,html2html
4959 !! wikitext
4960 [http://example.com/?foo&#61;bar]
4961 !! html/php
4962 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4963 </p>
4964 !! html/parsoid
4965 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4966 !! end
4967
4968 # xxx parsoid strips the IDN character, so the round-trip tests will
4969 # obviously fail and are disabled. --cscott
4970 !! test
4971 External links: [IDN ignored character reference in hostname; strip it right off]
4972 !! options
4973 parsoid=wt2html,wt2wt,html2html
4974 !! wikitext
4975 [http://e&zwnj;xample.com/]
4976 !! html/php
4977 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4978 </p>
4979 !! html/parsoid
4980 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4981 !! end
4982
4983 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4984 # Where an external link could easily circumvent the sanitization of the text of
4985 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4986 # test demands a higher standard. That's a bit strange.
4987 #
4988 # Example:
4989 #
4990 # http://e‌xample.com -> [http://example.com|http://example.com]
4991 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4992 #
4993 # The first example is sanitized, but the second is not. Any security benefits
4994 # from this production are trivial to circumvent. Either remove this test and
4995 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4996 # the test accordingly.
4997 #
4998 # All our love,
4999 # The Parsoid team.
5000 # xxx parsoid strips the IDN character, so the round-trip tests will
5001 # obviously fail and are disabled. --cscott
5002 !! test
5003 External links: IDN ignored character reference in hostname; strip it right off
5004 !! options
5005 parsoid=wt2html,html2html
5006 !! wikitext
5007 http://e&zwnj;xample.com/
5008 !! html/php
5009 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5010 </p>
5011 !! html/parsoid
5012 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5013 !! end
5014
5015 !! test
5016 External links: www.jpeg.org (bug 554)
5017 !! wikitext
5018 http://www.jpeg.org
5019 !! html
5020 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5021 </p>
5022 !! end
5023
5024 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5025 !! test
5026 External links: URL within URL (original bug 2)
5027 !! wikitext
5028 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5029 !! html/php
5030 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5031 </p>
5032 !! html/parsoid
5033 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5034 !! end
5035
5036 !! test
5037 BUG 361: URL inside bracketed URL
5038 !! wikitext
5039 [http://www.example.com/foo http://www.example.com/bar]
5040 !! html
5041 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5042 </p>
5043 !! end
5044
5045 !! test
5046 BUG 361: URL within URL, not bracketed
5047 !! wikitext
5048 http://www.example.com/foo?=http://www.example.com/bar
5049 !! html
5050 <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>
5051 </p>
5052 !! end
5053
5054 !! test
5055 BUG 289: ">"-token in URL-tail
5056 !! wikitext
5057 http://www.example.com/<hello>
5058 !! html
5059 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5060 </p>
5061 !!end
5062
5063 !! test
5064 BUG 289: literal ">"-token in URL-tail
5065 !! wikitext
5066 http://www.example.com/<b>html</b>
5067 !! html/php
5068 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5069 </p>
5070 !! html/parsoid
5071 <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>
5072 !! end
5073
5074 !! test
5075 BUG 289: ">"-token in bracketed URL
5076 !! wikitext
5077 [http://www.example.com/<hello> stuff]
5078 !! html
5079 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5080 </p>
5081 !!end
5082
5083 !! test
5084 BUG 289: literal ">"-token in bracketed URL
5085 !! wikitext
5086 [http://www.example.com/<b>html</b> stuff]
5087 !! html
5088 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5089 </p>
5090 !!end
5091
5092 !! test
5093 BUG 289: literal double quote at end of URL
5094 !! wikitext
5095 http://www.example.com/"hello"
5096 !! html
5097 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5098 </p>
5099 !!end
5100
5101 !! test
5102 BUG 289: literal double quote in bracketed URL
5103 !! wikitext
5104 [http://www.example.com/"hello" stuff]
5105 !! html
5106 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5107 </p>
5108 !!end
5109
5110 !! test
5111 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5112 !! wikitext
5113 [http://www.example.com test]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5116 </p>
5117 !! end
5118
5119 !! test
5120 External links: link text with spaces
5121 !! wikitext
5122 [http://www.example.com a b c]
5123 [http://www.example.com ''a'' ''b'']
5124 !! html
5125 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5126 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5127 </p>
5128 !! end
5129
5130 !! test
5131 External links: wiki links within external link (Bug 3695)
5132 !! options
5133 parsoid=wt2html,html2html
5134 !! wikitext
5135 [http://example.com [[wikilink]] embedded in ext link]
5136 !! html/php
5137 <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>
5138 </p>
5139 !! html/parsoid
5140 <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>
5141 !! end
5142
5143 !! test
5144 BUG 787: Links with one slash after the url protocol are invalid
5145 !! wikitext
5146 http:/example.com
5147
5148 [http:/example.com title]
5149 !! html
5150 <p>http:/example.com
5151 </p><p>[http:/example.com title]
5152 </p>
5153 !! end
5154
5155 !! test
5156 Bracketed external links with template-generated invalid target
5157 !! wikitext
5158 [{{echo|http:/example.com}} title]
5159 !! html
5160 <p>[http:/example.com title]
5161 </p>
5162 !! end
5163
5164 !! test
5165 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5166 !! wikitext
5167 ''[http://example.com text'']
5168 [http://example.com '''text]'''
5169 ''Something [http://example.com in italic'']
5170 ''Something [http://example.com mixed''''', even bold]'''
5171 '''''Now [http://example.com both''''']
5172 !! html
5173 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5174 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5175 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5176 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5177 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5178 </p>
5179 !! end
5180
5181
5182 !! test
5183 Bug 4781: %26 in URL
5184 !! wikitext
5185 http://www.example.com/?title=AT%26T
5186 !! html/php
5187 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5188 </p>
5189 !! html/parsoid
5190 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5191 !! end
5192
5193 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5194 # % is actually legal in HTML5. Any change in output would need testing though.
5195 !! test
5196 Bug 4781, 5267: %25 in URL
5197 !! wikitext
5198 http://www.example.com/?title=100%25_Bran
5199 !! html/php
5200 <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>
5201 </p>
5202 !! html/parsoid
5203 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5204 !! end
5205
5206 !! test
5207 Bug 4781, 5267: %28, %29 in URL
5208 !! wikitext
5209 http://www.example.com/?title=Ben-Hur_%281959_film%29
5210 !! html/php
5211 <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>
5212 </p>
5213 !! html/parsoid
5214 <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>
5215 !! end
5216
5217
5218 !! test
5219 Bug 4781: %26 in autonumber URL
5220 !! wikitext
5221 [http://www.example.com/?title=AT%26T]
5222 !! html/php
5223 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5224 </p>
5225 !! html/parsoid
5226 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5227 !! end
5228
5229 !! test
5230 Bug 4781, 5267: %26 in autonumber URL
5231 !! wikitext
5232 [http://www.example.com/?title=100%25_Bran]
5233 !! html/php
5234 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5235 </p>
5236 !! html/parsoid
5237 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5238 !! end
5239
5240 !! test
5241 Bug 4781, 5267: %28, %29 in autonumber URL
5242 !! wikitext
5243 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5244 !! html/php
5245 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5246 </p>
5247 !! html/parsoid
5248 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5249 !! end
5250
5251
5252 !! test
5253 Bug 4781: %26 in bracketed URL
5254 !! wikitext
5255 [http://www.example.com/?title=AT%26T link]
5256 !! html/php
5257 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5258 </p>
5259 !! html/parsoid
5260 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5261 !! end
5262
5263 !! test
5264 Bug 4781, 5267: %25 in bracketed URL
5265 !! wikitext
5266 [http://www.example.com/?title=100%25_Bran link]
5267 !! html
5268 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5269 </p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %28, %29 in bracketed URL
5274 !! wikitext
5275 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5276 !! html/php
5277 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5281 !! end
5282
5283 !! test
5284 External link containing a period in the anchor. (bug 63947)
5285 !! wikitext
5286 [//foo.org/bar#baz. bang]
5287
5288 [//foo.org/bar. bang]
5289 !! html/php
5290 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5291 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5292 </p>
5293 !! html/parsoid
5294 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5296 !! end
5297
5298 !! test
5299 External link containing a single quote. (bug 63947)
5300 !! wikitext
5301 [//foo.org/bar'baz]
5302
5303 [//foo.org/bar'baz bang]
5304 !! html/php
5305 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5306 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5307 </p>
5308 !! html/parsoid
5309 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5310 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5311 !! end
5312
5313 !! test
5314 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5315 !! wikitext
5316 Some [http://example.com/ pretty ''italics'' and stuff]!
5317 !! html
5318 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5319 </p>
5320 !! end
5321
5322 !! test
5323 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5324 !! wikitext
5325 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5326 !! html
5327 <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>
5328 </p>
5329 !! end
5330
5331 !! test
5332 External link containing double-single-quotes with no space separating the url from text in italics
5333 !! wikitext
5334 [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]].]
5335 !! html/php
5336 <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>
5337 </p>
5338 !! html/php+tidy
5339 <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>
5340 !! html/parsoid
5341 <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>
5342 !! end
5343
5344 !! test
5345 External link with comments in link text
5346 !! wikitext
5347 [http://www.google.com Google <!-- comment -->]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5350 </p>
5351 !! html/parsoid
5352 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5353 !! end
5354
5355 !! test
5356 External link to bare IPv4 address
5357 !! wikitext
5358 [http://192.168.0.1 Link]
5359 !! html/php
5360 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5361 </p>
5362 !! html/parsoid
5363 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5364 !! end
5365
5366 !! test
5367 URL-encoding in URL functions (single parameter)
5368 !! wikitext
5369 {{localurl:Some page|amp=&}}
5370 !! html
5371 <p>/index.php?title=Some_page&amp;amp=&amp;
5372 </p>
5373 !! end
5374
5375 !! test
5376 URL-encoding in URL functions (multiple parameters)
5377 !! wikitext
5378 {{localurl:Some page|q=?&amp=&}}
5379 !! html
5380 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5381 </p>
5382 !! end
5383
5384 !! test
5385 Brackets in urls
5386 !! wikitext
5387 http://example.com/index.php?foozoid%5B%5D=bar
5388
5389 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5390 !! html/php
5391 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5392 </p><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>
5393 </p>
5394 !! html/parsoid
5395 <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>
5396
5397 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5398 !! end
5399
5400 !! test
5401 IPv6 urls, autolink format (T23261)
5402 !! wikitext
5403 http://[2404:130:0:1000::187:2]/index.php
5404
5405 Examples from RFC 2373, section 2.2:
5406 * http://[1080::8:800:200C:417A]/unicast
5407 * http://[FF01::101]/multicast
5408 * http://[::1]/loopback
5409 * http://[::]/unspecified
5410 * http://[::13.1.68.3]/ipv4compat
5411 * http://[::FFFF:129.144.52.38]/ipv4compat
5412
5413 Examples from RFC 2732, section 2:
5414 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5415 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5416 * http://[3ffe:2a00:100:7031::1]
5417 * http://[1080::8:800:200C:417A]/foo
5418 * http://[::192.9.5.5]/ipng
5419 * http://[::FFFF:129.144.52.38]:80/index.html
5420 * http://[2010:836B:4179::836B:4179]
5421
5422 !! html/php
5423 <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>
5424 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5425 </p>
5426 <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>
5427 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5428 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5429 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5430 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5431 <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>
5432 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5433 </p>
5434 <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>
5435 <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>
5436 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5438 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5439 <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>
5440 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5441
5442 !! html/parsoid
5443 <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>
5444
5445 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5446 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5448 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5450 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5451 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5452
5453 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5454 <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>
5455 <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>
5456 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5459 <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>
5460 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5461 !! end
5462
5463 !! test
5464 IPv6 urls, bracketed format (T23261)
5465 !! wikitext
5466 [http://[2404:130:0:1000::187:2]/index.php test]
5467
5468 Examples from RFC 2373, section 2.2:
5469 * [http://[1080::8:800:200C:417A] unicast]
5470 * [http://[FF01::101] multicast]
5471 * [http://[::1]/ loopback]
5472 * [http://[::] unspecified]
5473 * [http://[::13.1.68.3] ipv4compat]
5474 * [http://[::FFFF:129.144.52.38] ipv4compat]
5475
5476 Examples from RFC 2732, section 2:
5477 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5478 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5479 * [http://[3ffe:2a00:100:7031::1] 3]
5480 * [http://[1080::8:800:200C:417A]/foo 4]
5481 * [http://[::192.9.5.5]/ipng 5]
5482 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5483 * [http://[2010:836B:4179::836B:4179] 7]
5484
5485 !! html/php
5486 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5487 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5488 </p>
5489 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5493 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5494 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5495 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5496 </p>
5497 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5498 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5504
5505 !! html/parsoid
5506 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5507
5508 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5509 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5515
5516 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5517 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5524 !! end
5525
5526 !! test
5527 Non-extlinks in brackets
5528 !! wikitext
5529 [foo]
5530 [foo bar]
5531 [foo ''bar'']
5532 [fool's] errand
5533 [fool's errand]
5534 [{{echo|foo}}]
5535 [{{echo|foo}} bar]
5536 [{{echo|foo}} ''bar'']
5537 [{{echo|foo}}l's] errand
5538 [{{echo|foo}}l's errand]
5539 [url={{echo|foo}}]
5540 [url=http://example.com]
5541 [http:// bare protocols don't count]
5542 !! html/php
5543 <p>[foo]
5544 [foo bar]
5545 [foo <i>bar</i>]
5546 [fool's] errand
5547 [fool's errand]
5548 [foo]
5549 [foo bar]
5550 [foo <i>bar</i>]
5551 [fool's] errand
5552 [fool's errand]
5553 [url=foo]
5554 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5555 [http:// bare protocols don't count]
5556 </p>
5557 !! html/parsoid
5558 <p>[foo]
5559 [foo bar]
5560 [foo <i>bar</i>]
5561 [fool's] errand
5562 [fool's errand]
5563 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5564 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5565 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5566 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5567 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5568 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5569 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5570 [http:// bare protocols don't count]</p>
5571 !! end
5572
5573 !! test
5574 Percent encoding in external links
5575 !! wikitext
5576 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5577 !! html/php
5578 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5579 </p>
5580 !! html/parsoid
5581 <p><a rel="mw:ExtLink"
5582 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5583 !! end
5584
5585 !! test
5586 Use url link syntax for links where the content is equal the link target
5587 !! wikitext
5588 http://example.com
5589 !! html/php
5590 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5591 </p>
5592 !! html/parsoid
5593 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5594 !! end
5595
5596 !! test
5597 Parenthesis in external links, especially URL links
5598 !! wikitext
5599 http://example.com)
5600
5601 http://example.com/test)
5602
5603 http://example.com/(test)
5604
5605 http://example.com/((test)
5606
5607 (http://example.com/(test))
5608
5609 (http://example.com/(test)))))
5610
5611 http://example.com/a)b
5612
5613 [http://example.com) foo]
5614 !! html/php
5615 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5616 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5617 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5618 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5619 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5620 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5621 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5622 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5623 </p>
5624 !! html/parsoid
5625 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5626 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5627 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5628 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5629 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5630 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5631 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5632 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5633 !! end
5634
5635 !! test
5636 Parenthesis in external links, w/ transclusion or comment
5637 !! wikitext
5638 (http://example.com/{{echo|hi}})
5639
5640 (http://example.com<!-- hi -->)
5641 !! html/php
5642 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5643 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5644 </p>
5645 !! html/parsoid
5646 <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>
5647
5648 <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>
5649 !! end
5650
5651 !! test
5652 Serialize <a> tags with invalid link targets as plain text
5653 !! options
5654 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5655 !! html/parsoid
5656 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5657 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5658 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5659 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5660 !! wikitext
5661 text
5662 <nowiki>*</nowiki>text
5663 <nowiki>[[foo]]</nowiki>
5664 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5665 !! end
5666
5667 !! test
5668 mw:ExtLink -vs- mw:WikiLink (T94723)
5669 !! options
5670 parsoid=html2wt
5671 !! html/parsoid
5672 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5673 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5674 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5675 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5676 <p>
5677 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5678 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5679 </p>
5680 !! wikitext
5681 [[Foo|Bar]]
5682 [[Foo|Bar]]
5683 [[wikipedia:Foo|Bar]]
5684 [[wikipedia:Foo|Bar]]
5685
5686 [[wikipedia:European_Robin|European Robin]]
5687 [[wikipedia:European_Robin|European Robin]]
5688 !! end
5689
5690 !! test
5691 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5692 !! options
5693 parsoid=wt2wt
5694 !! wikitext
5695 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5696 !! html/parsoid
5697 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5698 !! end
5699
5700
5701 ###
5702 ### Quotes
5703 ###
5704
5705 !! test
5706 Quotes
5707 !! wikitext
5708 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5709
5710 Normal text. '''''Bold italic text.''''' Normal text.
5711 !! html
5712 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5713 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5714 </p>
5715 !! end
5716
5717
5718 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5719 # parser strips. The wikitext contains just the first half of the bold
5720 # quote pair.
5721 !! test
5722 Unclosed and unmatched quotes
5723 !! wikitext
5724 '''''Bold italic text '''with bold deactivated''' in between.'''''
5725
5726 '''''Bold italic text ''with italic deactivated'' in between.'''''
5727
5728 '''Bold text..
5729
5730 ..spanning two paragraphs (should not work).'''
5731
5732 '''Bold tag left open
5733
5734 ''Italic tag left open
5735
5736 Normal text.
5737
5738 <!-- Unmatching number of opening, closing tags: -->
5739 '''This year''''s election ''should'' beat '''last year''''s.
5740
5741 ''Tom'''s car is bigger than ''Susan'''s.
5742
5743 Plain ''italic'''s plain
5744 !! html/php
5745 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5746 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5747 </p><p><b>Bold text..</b>
5748 </p><p>..spanning two paragraphs (should not work).
5749 </p><p><b>Bold tag left open</b>
5750 </p><p><i>Italic tag left open</i>
5751 </p><p>Normal text.
5752 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5753 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5754 </p><p>Plain <i>italic'</i>s plain
5755 </p>
5756 !! html/parsoid
5757 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5758 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5759 </p><p><b>Bold text..</b>
5760 </p><p>..spanning two paragraphs (should not work).<b></b>
5761 </p><p><b>Bold tag left open</b>
5762 </p><p><i>Italic tag left open</i>
5763 </p><p>Normal text.
5764 </p>
5765 <!-- Unmatching number of opening, closing tags: -->
5766 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5767 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5768 </p><p>Plain <i>italic'</i>s plain
5769 </p>
5770 !! end
5771
5772 ###
5773 ### Tables
5774 ###
5775 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5776 ###
5777
5778 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5779 # is the bare minimum required by the spec, see:
5780 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5781 # Parsoid team replies: empty table tags are legal in HTML5
5782 !! test
5783 A table with no data.
5784 !! options
5785 parsoid=wt2html
5786 !! wikitext
5787 {||}
5788 !! html/php
5789
5790 !! html/parsoid
5791 <table></table>
5792
5793 !! end
5794
5795 !! test
5796 A table with stray table end tags on start tag line (wt2html)
5797 !! options
5798 parsoid=wt2html
5799 !! wikitext
5800 {|style="color: red;"|}
5801
5802 {|style="color: red;" |}
5803 |foo
5804 |}
5805
5806 {|style="color: red;"|} id="foo"
5807 |foo
5808 |}
5809
5810 {|style="color: red;" |} id="foo"
5811 |foo
5812 |}
5813 !! html
5814 <table style="color: red;"></table>
5815
5816 <table style="color: red;">
5817 <tbody><tr>
5818 <td>foo</td>
5819 </tr></tbody>
5820 </table>
5821
5822 <table style="color: red;" id="foo">
5823 <tbody><tr>
5824 <td>foo</td>
5825 </tr></tbody>
5826 </table>
5827
5828 <table style="color: red;" id="foo">
5829 <tbody><tr>
5830 <td>foo</td>
5831 </tr></tbody>
5832 </table>
5833
5834 !! end
5835
5836 !! test
5837 A table with no data (take 2)
5838 !! wikitext
5839 {|
5840 |}
5841 !! html/parsoid
5842 <table></table>
5843 !! end
5844
5845 # A table with nothing but a caption is invalid XHTML, we might want to render
5846 # this as <p>caption</p>
5847 # Parsoid team replies: table with only a caption is legal in HTML5
5848 !! test
5849 A table with nothing but a caption
5850 !! wikitext
5851 {|
5852 |+ caption
5853 |}
5854 !! html/php
5855 <table>
5856 <caption> caption
5857 </caption><tr><td></td></tr></table>
5858
5859 !! html/parsoid
5860 <table><caption> caption</caption></table>
5861 !! end
5862
5863 !! test
5864 A table with caption with default-spaced attributes and a table row
5865 !! wikitext
5866 {|
5867 |+ style="color: red;" | caption1
5868 |-
5869 | foo
5870 |}
5871 !! html
5872 <table>
5873 <caption style="color: red;"> caption1
5874 </caption>
5875 <tr>
5876 <td> foo
5877 </td></tr></table>
5878
5879 !! end
5880
5881 !! test
5882 A table with captions with non-default spaced attributes and a table row
5883 !! wikitext
5884 {|
5885 |+style="color: red;"|caption2
5886 |+ style="color: red;"| caption3
5887 |-
5888 | foo
5889 |}
5890 !! html
5891 <table>
5892 <caption style="color: red;">caption2
5893 </caption>
5894 <caption style="color: red;"> caption3
5895 </caption>
5896 <tr>
5897 <td> foo
5898 </td></tr></table>
5899
5900 !! end
5901
5902 !! test
5903 Table td-cell syntax variations
5904 !! wikitext
5905 {|
5906 | foo bar foo | baz
5907 | foo bar foo || baz
5908 | style='color:red;' | baz
5909 | style='color:red;' || baz
5910 |}
5911 !! html
5912 <table>
5913 <tr>
5914 <td> baz
5915 </td>
5916 <td> foo bar foo </td>
5917 <td> baz
5918 </td>
5919 <td style="color:red;"> baz
5920 </td>
5921 <td> style='color:red;' </td>
5922 <td> baz
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Simple table
5929 !! wikitext
5930 {|
5931 | 1 || 2
5932 |-
5933 | 3 || 4
5934 |}
5935 !! html
5936 <table>
5937 <tr>
5938 <td> 1 </td>
5939 <td> 2
5940 </td></tr>
5941 <tr>
5942 <td> 3 </td>
5943 <td> 4
5944 </td></tr></table>
5945
5946 !! end
5947
5948 !! test
5949 Simple table but with multiple dashes for row wikitext
5950 !! wikitext
5951 {|
5952 | foo
5953 |-----
5954 | bar
5955 |}
5956 !! html
5957 <table>
5958 <tr>
5959 <td> foo
5960 </td></tr>
5961 <tr>
5962 <td> bar
5963 </td></tr></table>
5964
5965 !! end
5966
5967 !! test
5968 Multiplication table
5969 !! wikitext
5970 {| border="1" cellpadding="2"
5971 |+Multiplication table
5972 |-
5973 ! &times; !! 1 !! 2 !! 3
5974 |-
5975 ! 1
5976 | 1 || 2 || 3
5977 |-
5978 ! 2
5979 | 2 || 4 || 6
5980 |-
5981 ! 3
5982 | 3 || 6 || 9
5983 |-
5984 ! 4
5985 | 4 || 8 || 12
5986 |-
5987 ! 5
5988 | 5 || 10 || 15
5989 |}
5990 !! html
5991 <table border="1" cellpadding="2">
5992 <caption>Multiplication table
5993 </caption>
5994 <tr>
5995 <th> &#215; </th>
5996 <th> 1 </th>
5997 <th> 2 </th>
5998 <th> 3
5999 </th></tr>
6000 <tr>
6001 <th> 1
6002 </th>
6003 <td> 1 </td>
6004 <td> 2 </td>
6005 <td> 3
6006 </td></tr>
6007 <tr>
6008 <th> 2
6009 </th>
6010 <td> 2 </td>
6011 <td> 4 </td>
6012 <td> 6
6013 </td></tr>
6014 <tr>
6015 <th> 3
6016 </th>
6017 <td> 3 </td>
6018 <td> 6 </td>
6019 <td> 9
6020 </td></tr>
6021 <tr>
6022 <th> 4
6023 </th>
6024 <td> 4 </td>
6025 <td> 8 </td>
6026 <td> 12
6027 </td></tr>
6028 <tr>
6029 <th> 5
6030 </th>
6031 <td> 5 </td>
6032 <td> 10 </td>
6033 <td> 15
6034 </td></tr></table>
6035
6036 !! end
6037
6038 !! test
6039 Accept "||" in table headings
6040 !! wikitext
6041 {|
6042 !h1 || h2
6043 |}
6044 !! html
6045 <table>
6046 <tr>
6047 <th>h1 </th>
6048 <th> h2
6049 </th></tr></table>
6050
6051 !! end
6052
6053 !! test
6054 Accept "!!" in table data
6055 !! wikitext
6056 {|
6057 | Foo!! ||
6058 |}
6059 !! html
6060 <table>
6061 <tr>
6062 <td> Foo!! </td>
6063 <td>
6064 </td></tr></table>
6065
6066 !! html/parsoid
6067 <table>
6068 <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>
6069 </tbody></table>
6070 !! end
6071
6072 !! test
6073 Accept "||" in indented table headings
6074 !! wikitext
6075 :{|
6076 !h1 || h2
6077 |}
6078 !! html
6079 <dl><dd><table>
6080 <tr>
6081 <th>h1 </th>
6082 <th> h2
6083 </th></tr></table></dd></dl>
6084
6085 !! end
6086
6087 !! test
6088 Accept "!!" in templates
6089 !! wikitext
6090 {|
6091 !a {{echo|b!!c}}
6092 |}
6093 !! html/php
6094 <table>
6095 <tr>
6096 <th>a b</th>
6097 <th>c
6098 </th></tr></table>
6099
6100 !! html/parsoid
6101 <table>
6102 <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>
6103 !! end
6104
6105 !! test
6106 Accept "!!" in table headings after newline
6107 !! wikitext
6108 {|
6109 !a
6110 b!!c
6111 |}
6112 !! html/php
6113 <table>
6114 <tr>
6115 <th>a
6116 <p>b!!c
6117 </p>
6118 </th></tr></table>
6119
6120 !! html/parsoid
6121 <table>
6122 <tbody><tr><th>a
6123 <p>b!!c</p></th></tr>
6124 </tbody></table>
6125 !! end
6126
6127 !! test
6128 Accept "!!" in table data of mixed wikitext / html syntax
6129 !! wikitext
6130 {|
6131 !a
6132 <tr><td>b!!c</td></tr>
6133 |}
6134 !! html+tidy
6135 <table>
6136 <tr>
6137 <th>a</th>
6138 </tr>
6139 <tr>
6140 <td>b!!c</td>
6141 </tr>
6142 </table>
6143 !! html/parsoid
6144 <table>
6145 <tbody><tr><th>a</th></tr>
6146 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6147 </tbody></table>
6148 !! end
6149
6150 !! test
6151 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6152 !! wikitext
6153 {|
6154 !| h1
6155 || a
6156 |}
6157 !! html
6158 <table>
6159 <tr>
6160 <th> h1
6161 </th>
6162 <td> a
6163 </td></tr></table>
6164
6165 !! end
6166
6167 !!test
6168 Accept "| !" at start of line in tables (ignore !-attribute)
6169 !! wikitext
6170 {|
6171 |-
6172 | !style="color:red" | bar
6173 |}
6174 !! html
6175 <table>
6176
6177 <tr>
6178 <td> bar
6179 </td></tr></table>
6180
6181 !!end
6182
6183 !!test
6184 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 +/-
6185 !! wikitext
6186 {|
6187 |-
6188 |style='color:red;'|+1
6189 |style='color:blue;'|-1
6190 |-
6191 | 1 || 2 || 3
6192 | 1 ||+2 ||-3
6193 |-
6194 | +1
6195 | -1
6196 |}
6197 !! html
6198 <table>
6199
6200 <tr>
6201 <td style="color:red;">+1
6202 </td>
6203 <td style="color:blue;">-1
6204 </td></tr>
6205 <tr>
6206 <td> 1 </td>
6207 <td> 2 </td>
6208 <td> 3
6209 </td>
6210 <td> 1 </td>
6211 <td>+2 </td>
6212 <td>-3
6213 </td></tr>
6214 <tr>
6215 <td> +1
6216 </td>
6217 <td> -1
6218 </td></tr></table>
6219
6220 !!end
6221
6222 !! test
6223 Table rowspan
6224 !! wikitext
6225 {| border=1
6226 | Cell 1, row 1
6227 |rowspan=2| Cell 2, row 1 (and 2)
6228 | Cell 3, row 1
6229 |-
6230 | Cell 1, row 2
6231 | Cell 3, row 2
6232 |}
6233 !! html
6234 <table border="1">
6235 <tr>
6236 <td> Cell 1, row 1
6237 </td>
6238 <td rowspan="2"> Cell 2, row 1 (and 2)
6239 </td>
6240 <td> Cell 3, row 1
6241 </td></tr>
6242 <tr>
6243 <td> Cell 1, row 2
6244 </td>
6245 <td> Cell 3, row 2
6246 </td></tr></table>
6247
6248 !! end
6249
6250 !! test
6251 Nested table
6252 !! wikitext
6253 {| border=1
6254 | &alpha;
6255 |
6256 {| bgcolor=#ABCDEF border=2
6257 |nested
6258 |-
6259 |table
6260 |}
6261 |the original table again
6262 |}
6263 !! html
6264 <table border="1">
6265 <tr>
6266 <td> &#945;
6267 </td>
6268 <td>
6269 <table bgcolor="#ABCDEF" border="2">
6270 <tr>
6271 <td>nested
6272 </td></tr>
6273 <tr>
6274 <td>table
6275 </td></tr></table>
6276 </td>
6277 <td>the original table again
6278 </td></tr></table>
6279
6280 !! end
6281
6282 !! test
6283 Invalid attributes in table cell (bug 1830)
6284 !! wikitext
6285 {|
6286 |Cell:|broken
6287 |}
6288 !! html
6289 <table>
6290 <tr>
6291 <td>broken
6292 </td></tr></table>
6293
6294 !! end
6295
6296 !! test
6297 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6298 !! wikitext
6299 {|
6300 | title="foo" |bar
6301 | title="foo<nowiki>|</nowiki>" |bar
6302 | title="foo<nowiki>|</nowiki>" bar
6303 |}
6304 !! html/php
6305 <table>
6306 <tr>
6307 <td title="foo">bar
6308 </td>
6309 <td title="foo&#124;">bar
6310 </td>
6311 <td> title="foo|" bar
6312 </td></tr></table>
6313
6314 !! html/parsoid
6315 <table>
6316 <tbody><tr><td title="foo">bar</td>
6317 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6318 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6319 </tbody></table>
6320 !! end
6321
6322 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6323 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6324 # *2wt modes will fail.
6325 !! test
6326 Table security: embedded pipes
6327 !! options
6328 parsoid=wt2html,html2html
6329 !! wikitext
6330 {|
6331 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6332 !! html/php
6333 <table>
6334 <tr>
6335 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6336 <td>]" onmouseover="alert(document.cookie)"&gt;test
6337 </td>
6338 </tr>
6339 </table>
6340
6341 !! html/parsoid
6342 <table><tbody>
6343 <tr>
6344 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6345 !! end
6346
6347 !! test
6348 Element attributes with double ! should not be broken up by <th>
6349 !! wikitext
6350 {|
6351 ! hi <div class="!!">ha</div> ho
6352 |}
6353 !! html/php
6354 <table>
6355 <tr>
6356 <th> hi <div class="!!">ha</div> ho
6357 </th></tr></table>
6358
6359 !! html/parsoid
6360 <table>
6361 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6362 </tbody></table>
6363 !! end
6364
6365 !! test
6366 ! and || in element attributes should not be parsed as <th>/<td>
6367 !! wikitext
6368 {|
6369 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6370 |}
6371 !! html/php
6372 <table>
6373 <tr>
6374 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6375 </td></tr></table>
6376
6377 !! html/parsoid
6378 <table>
6379 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6380 </tbody></table>
6381 !! end
6382
6383 # FIXME: The output seems broken. Filed as T110268.
6384 !! test
6385 ! and || in td attributes should not be parsed as <th>/<td>
6386 !! options
6387 parsoid=wt2html
6388 !! wikitext
6389 {|
6390 | style="color: red !important;" data-contrived="put this here ||" | foo
6391 |}
6392 !! html/php
6393 <table>
6394 <tr>
6395 <td> style="color: red !important;" data-contrived="put this here </td>
6396 <td> foo
6397 </td></tr></table>
6398
6399 !! html/parsoid
6400 <table>
6401 <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>
6402 </tbody></table>
6403 !! end
6404
6405 !! test
6406 Break on | in element attribute in template
6407 !! options
6408 parsoid=wt2html,html2html
6409 !! wikitext
6410 {{echo|1=<div class="hi|ho">ha</div>}}
6411 !! html/php
6412 <p>ho"&gt;ha&lt;/div&gt;
6413 </p>
6414 !! html/parsoid
6415 <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>
6416 !! end
6417
6418 !! test
6419 Indented table markup mixed with indented pre content (proposed in bug 6200)
6420 !! wikitext
6421 <table>
6422 <tr>
6423 <td>
6424 Text that should be rendered preformatted
6425 </td>
6426 </tr>
6427 </table>
6428 !! html
6429 <table>
6430 <tr>
6431 <td>
6432 <pre>Text that should be rendered preformatted
6433 </pre>
6434 </td>
6435 </tr>
6436 </table>
6437
6438 !! end
6439
6440 !! test
6441 1. Template-generated table cell attributes and cell content
6442 !! wikitext
6443 {|
6444 |{{table_attribs}}
6445 | {{table_attribs}}
6446 || {{table_attribs_5}}
6447 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6448 |align=center {{table_attribs}}
6449 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6450 |}
6451 !! html
6452 <table>
6453 <tr>
6454 <td style="color:red;">Foo
6455 </td>
6456 <td style="color:red;">Foo
6457 </td>
6458 <td> style="color:red;"</td>
6459 <td>Bar
6460 </td>
6461 <td style="color:red;">Foo
6462 </td>
6463 <td align="center" style="color:red;">Foo
6464 </td>
6465 <td align="center" style="color:red;">Foo
6466 </td></tr></table>
6467
6468 !! end
6469
6470 !! test
6471 2. Template-generated table cell attributes and cell content
6472 !! wikitext
6473 {|
6474 |{{table_attribs_2}}
6475 |}
6476 !! html/php
6477 <table>
6478 <tr>
6479 <td style="color:red;">Foo
6480 </td>
6481 <td>Bar</td>
6482 <td>Baz
6483 </td></tr></table>
6484
6485 !! html/parsoid
6486 <table>
6487 <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>
6488 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6489 </tbody></table>
6490 !! end
6491
6492 !! test
6493 3. Template-generated table cell attributes and cell content
6494 !! wikitext
6495 {|
6496 !align=center {{table_header_cells}}
6497 |-
6498 |align=center {{table_cells}}
6499 |}
6500 !! html/php
6501 <table>
6502 <tr>
6503 <th align="center" style="color:red;">Foo</th>
6504 <th style="color:red;"><i>Bar</i></th>
6505 <th style="color:brown;"><i>Foo</i> and Baz
6506 </th></tr>
6507 <tr>
6508 <td align="center" style="color:red;">Foo</td>
6509 <td style="color:red;"><i>Bar</i></td>
6510 <td style="color:brown;"><i>Foo</i> and Baz
6511 </td></tr></table>
6512
6513 !! html/parsoid
6514 <table>
6515 <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>
6516 <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>
6517 </tbody></table>
6518 !! end
6519
6520 !! test
6521 4. Template-generated table cell attributes and cell content inside a templated table
6522 !! wikitext
6523 {{tbl-start}}
6524 !align=center {{table_header_cells}}
6525 |-
6526 |align=center {{table_cells}}
6527 {{tbl-end}}
6528 !! html/php
6529 <table>
6530 <tr>
6531 <th align="center" style="color:red;">Foo</th>
6532 <th style="color:red;"><i>Bar</i></th>
6533 <th style="color:brown;"><i>Foo</i> and Baz
6534 </th></tr>
6535 <tr>
6536 <td align="center" style="color:red;">Foo</td>
6537 <td style="color:red;"><i>Bar</i></td>
6538 <td style="color:brown;"><i>Foo</i> and Baz
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table 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}}]}'>
6543 <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>
6544 <tr>
6545 <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>
6546 </tbody></table>
6547 !! end
6548
6549 ## Edge case fix to prevent future regressions
6550 !! test
6551 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6552 !! wikitext
6553 {|
6554 |{{table_attribs_7}}
6555 |}
6556 <references />
6557 !! html/parsoid
6558 <table>
6559 <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>
6560 </tbody></table>
6561 <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>
6562 !! end
6563
6564 !! test
6565 Table with row followed by newlines and table heading
6566 !! wikitext
6567 {|
6568 |-
6569
6570 ! foo
6571 |}
6572 !! html
6573 <table>
6574
6575
6576 <tr>
6577 <th> foo
6578 </th></tr></table>
6579
6580 !! end
6581
6582 !! test
6583 Table with empty line following the start tag
6584 !! wikitext
6585 {|
6586
6587 |-
6588 | foo
6589 |}
6590 !! html
6591 <table>
6592
6593
6594 <tr>
6595 <td> foo
6596 </td></tr></table>
6597
6598 !! end
6599
6600 !! test
6601 Table attributes with empty value
6602 !! options
6603 parsoid=wt2html,html2html
6604 !! wikitext
6605 {|
6606 | style=| hello
6607 |}
6608 !! html/php
6609 <table>
6610 <tr>
6611 <td style=""> hello
6612 </td></tr></table>
6613
6614 !! html/parsoid
6615 <table>
6616 <tbody><tr><td style=""> hello</td></tr>
6617 </tbody></table>
6618 !! end
6619
6620 !! test
6621 Wikitext table with a lot of comments
6622 !! wikitext
6623 {|
6624 <!-- c0 -->
6625 | foo
6626 <!-- c1 -->
6627 |-<!-- c2 -->
6628 <!-- c3 -->
6629 |<!-- c4 -->
6630 <!-- c5 -->
6631 |}
6632 !! html
6633 <table>
6634 <tr>
6635 <td> foo
6636 </td></tr>
6637 <tr>
6638 <td>
6639 </td></tr></table>
6640
6641 !! end
6642
6643 !! test
6644 Wikitext table comments represented in parsoid dom
6645 !! wikitext
6646 {|<!--c1--><!--c2-->
6647 |-<!--c3-->
6648 | x
6649 |}
6650 !! html/php+tidy
6651 <table>
6652 <tr>
6653 <td>x</td>
6654 </tr>
6655 </table>
6656 !! html/parsoid
6657 <table><!--c1--><!--c2-->
6658 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6659 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6660 </tbody></table>
6661 !! end
6662
6663 !! test
6664 Wikitext table with double-line table cell
6665 !! wikitext
6666 {|
6667 |a
6668 b
6669 |}
6670 !! html
6671 <table>
6672 <tr>
6673 <td>a
6674 <p>b
6675 </p>
6676 </td></tr></table>
6677
6678 !! end
6679
6680 !! test
6681 Table cell with a single comment
6682 !! wikitext
6683 {|
6684 | <!-- c1 -->
6685 | a
6686 |}
6687 !! html
6688 <table>
6689 <tr>
6690 <td>
6691 </td>
6692 <td> a
6693 </td></tr></table>
6694
6695 !! end
6696
6697 !! test
6698 Table-cell after a comment-only-empty-line
6699 !! wikitext
6700 {|
6701 |a
6702 <!--c1-->
6703 <!--c2-->| b
6704 |}
6705 !! html
6706 <table>
6707 <tr>
6708 <td>a
6709 </td>
6710 <td> b
6711 </td></tr></table>
6712
6713 !! html/parsoid
6714 <table>
6715 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6716 <!--c1-->
6717 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6718 </tbody></table>
6719
6720 !! end
6721
6722 !! test
6723 Build table with {{!}}
6724 !! wikitext
6725 {{{!}} class="wikitable"
6726 ! header
6727 ! second header
6728 {{!}}- style="color:red;"
6729 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6730 {{!}}}
6731 !! html
6732 <table class="wikitable">
6733 <tr>
6734 <th> header
6735 </th>
6736 <th> second header
6737 </th></tr>
6738 <tr style="color:red;">
6739 <td> data </td>
6740 <td style="color:red;"> second data
6741 </td></tr></table>
6742
6743 !! end
6744
6745 !! test
6746 Build table with pipe as data
6747 !! wikitext
6748 {| class="wikitable"
6749 ! header
6750 ! second header
6751 |- style="color:red;"
6752 | data || style="color:red;" | second data
6753 |-
6754 | style="color:red;" | data with | || style="color:red;" | second data with |
6755 |-
6756 || data with | ||| second data with |
6757 |}
6758 !! html
6759 <table class="wikitable">
6760 <tr>
6761 <th> header
6762 </th>
6763 <th> second header
6764 </th></tr>
6765 <tr style="color:red;">
6766 <td> data </td>
6767 <td style="color:red;"> second data
6768 </td></tr>
6769 <tr>
6770 <td style="color:red;"> data with | </td>
6771 <td style="color:red;"> second data with |
6772 </td></tr>
6773 <tr>
6774 <td> data with | </td>
6775 <td> second data with |
6776 </td></tr></table>
6777
6778 !! end
6779
6780 !! test
6781 Build table with wikilink
6782 !! wikitext
6783 {| class="wikitable"
6784 ! header || second header
6785 |- style="color:red;"
6786 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6787 |-
6788 | data || second data [[Main Page|link|text with pipe]]
6789 |}
6790 !! html
6791 <table class="wikitable">
6792 <tr>
6793 <th> header </th>
6794 <th> second header
6795 </th></tr>
6796 <tr style="color:red;">
6797 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6798 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6799 </td></tr>
6800 <tr>
6801 <td> data </td>
6802 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6803 </td></tr></table>
6804
6805 !! end
6806
6807 # The expected HTML structure in this test is debatable. The PHP parser does
6808 # not parse this kind of table at all. The main focus for Parsoid is on
6809 # round-tripping, so this output is ok for now. TODO: revisit!
6810 !! test
6811 Wikitext table with html-syntax row
6812 !! wikitext
6813 {|
6814 |-
6815 <td>foo</td>
6816 |}
6817 !! html/parsoid
6818 <table>
6819 <tbody>
6820 <tr>
6821 <td>foo</td></tr></tbody></table>
6822 !! end
6823
6824 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6825 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6826 ## PHP parser, which tidy then compounds by fostering the content
6827 ## entirely out of the table. Parsoid recognizes the table context
6828 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6829 ## depends on PHP's treatment of broken table markup!
6830 !! test
6831 Implicit <td> after a |-
6832 !! options
6833 parsoid=wt2html,html2html
6834 !! wikitext
6835 {|
6836 |-
6837 a
6838 |}
6839 !! html/php
6840 <table>
6841
6842 a
6843 </table>
6844
6845 !! html/php+tidy
6846 <p>a</p>
6847 !! html/parsoid
6848 <table>
6849 <tr><td>a</td></tr>
6850 </table>
6851 !! end
6852
6853 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6854 !! test
6855 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6856 !! options
6857 parsoid=wt2html,html2html
6858 !! wikitext
6859 {|
6860 |-
6861 |
6862 a
6863 |-
6864 b
6865 |}
6866 !! html/php
6867 <table>
6868
6869 <tr>
6870 <td>
6871 <pre>a
6872 </pre>
6873 </td></tr>
6874 b
6875 </table>
6876
6877 !! html/php+tidy
6878 <p>b</p>
6879 <table>
6880 <tr>
6881 <td>
6882 <pre>
6883 a
6884 </pre></td>
6885 </tr>
6886 </table>
6887 !! html/parsoid
6888 <table>
6889 <tbody>
6890 <tr><td><pre>a</pre></td></tr>
6891 <tr><td> b</td></tr>
6892 </tbody>
6893 </table>
6894 !! end
6895
6896 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6897 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6898 !! test
6899 Lists should be recognized in an implicit <td> context
6900 !! options
6901 parsoid=wt2html,html2html
6902 !! wikitext
6903 {|
6904 |-
6905 *a
6906 |}
6907 !! html/php
6908 <table>
6909
6910 <ul><li>a</li></ul>
6911 </table>
6912
6913 !! html/php+tidy
6914 <ul>
6915 <li>a</li>
6916 </ul>
6917 !! html/parsoid
6918 <table>
6919 <tr>
6920 <td><ul>
6921 <li>a</li>
6922 </ul></td>
6923 </tr>
6924 </table>
6925 !! end
6926
6927 !! test
6928 Table cells not properly parsed in an implicit-td context
6929 !! wikitext
6930 {|
6931 |-
6932 {{table_attribs_4}} || a || b
6933 |}
6934 !! html/php+tidy
6935 <table>
6936 <tr>
6937 <td style="background-color:#DC241f;" width="10px"></td>
6938 <td>a</td>
6939 <td>b</td>
6940 </tr>
6941 </table>
6942 !! html/parsoid
6943 <table>
6944 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6945 <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>
6946 </tbody></table>
6947 !! end
6948
6949 !! test
6950 Parsoid: Round-trip tables directly followed by content (bug 51219)
6951 !! options
6952 parsoid=wt2html,wt2wt
6953 !! wikitext
6954 {|
6955 |foo
6956 |} bar
6957
6958 {|
6959 |baz
6960 |}<b>quux</b>
6961 !! html+tidy
6962 <table>
6963 <tr>
6964 <td>foo</td>
6965 </tr>
6966 </table>
6967 <p>bar</p>
6968 <table>
6969 <tr>
6970 <td>baz</td>
6971 </tr>
6972 </table>
6973 <p><b>quux</b></p>
6974 !! end
6975
6976 !! test
6977 Parsoid: Default to a newline after tables in new content (bug 51219)
6978 !! options
6979 parsoid=html2wt
6980 !! html/parsoid
6981 <table><tbody>
6982 <tr><td>foo</td></tr></tbody></table> bar
6983 <table><tbody>
6984 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6985 !! wikitext
6986 {|
6987 |foo
6988 |}
6989 <nowiki> </nowiki>bar
6990 {|
6991 |baz
6992 |}
6993 '''quux'''
6994 !! end
6995
6996 !! test
6997 Parsoid: newline inducing block nodes don't suppress <nowiki>
6998 !! options
6999 parsoid=html2wt
7000 !! html/parsoid
7001 a<h1>foo</h1>
7002 !! wikitext
7003 <nowiki> </nowiki>a
7004
7005 = foo =
7006 !! end
7007
7008 !! test
7009 Parsoid: Row-syntax table headings followed by comment & table cells
7010 !! options
7011 parsoid=wt2html,wt2wt
7012 !! wikitext
7013 {|
7014 ! foo || bar
7015 <!-- foo --> || baz || quux
7016 |}
7017 !! html/php
7018 <table>
7019 <tr>
7020 <th> foo </th>
7021 <th> bar
7022 </th>
7023 <td> baz </td>
7024 <td> quux
7025 </td></tr></table>
7026
7027 !! html/parsoid
7028 <table>
7029 <tbody><tr><th> foo </th><th> bar
7030 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7031 </tbody></table>
7032 !! end
7033
7034 !!test
7035 Parsoid: Recover better from broken table attributes
7036 !!options
7037 parsoid=wt2html
7038 !!wikitext
7039 {| class="foo
7040 | class="bar" |
7041 foo
7042 |}
7043 !!html/php+tidy
7044 <table class="foo">
7045 <tr>
7046 <td class="bar">
7047 <p>foo</p>
7048 </td>
7049 </tr>
7050 </table>
7051 !!html/parsoid
7052 <table class="foo">
7053 <tr>
7054 <td class="bar">
7055 <p>foo</p></td></tr>
7056 </tbody></table>
7057 !!end
7058
7059 !! test
7060 Tables: Digest broken attributes on table and tr tag
7061 !! options
7062 parsoid=wt2html
7063 !! wikitext
7064 {| || |} ++
7065 |- || || ++ --
7066 |- > [
7067 |}
7068 !! html
7069 <table>
7070 <tbody>
7071 <tr></tr>
7072 <tr></tr>
7073 </tbody></table>
7074 !! end
7075
7076 !! test
7077 Strip unsupported table tags
7078 !! options
7079 parsoid=html2wt
7080 !! html/parsoid
7081 <table>
7082 <thead>
7083 <tr>
7084 <th>Month</th>
7085 <th>Savings</th>
7086 </tr>
7087 </thead>
7088 <tbody>
7089 <tr>
7090 <td>January</td>
7091 <td>$100</td>
7092 </tr>
7093 <tr>
7094 <td>February</td>
7095 <td>$80</td>
7096 </tr>
7097 </tbody>
7098 <tfoot>
7099 <tr>
7100 <td>Sum</td>
7101 <td>$180</td>
7102 </tr>
7103 </tfoot>
7104 </table>
7105 !! wikitext
7106 {|
7107
7108 !Month
7109 !Savings
7110
7111 |January
7112 |$100
7113
7114 |-
7115 |February
7116 |$80
7117
7118 |Sum
7119 |$180
7120
7121 |}
7122 !! end
7123
7124 !! test
7125 Testing serialization after deletion in references
7126 !! options
7127 parsoid={
7128 "modes": ["wt2wt"],
7129 "changes": [
7130 ["#x", "remove"]
7131 ]
7132 }
7133 !! wikitext
7134 hi <ref><div id="x">ho</div></ref>
7135
7136 <references />
7137 !! wikitext/edited
7138 hi <ref></ref>
7139
7140 <references />
7141 !! end
7142
7143 !!test
7144 Testing serialization after deletion of table cells
7145 !!options
7146 parsoid={
7147 "modes": ["wt2wt", "selser"],
7148 "changes": [
7149 ["#x", "remove"]
7150 ]
7151 }
7152 !!wikitext
7153 {|
7154 !h1 !!h2 !!h3
7155 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7156 |}
7157 !! wikitext/edited
7158 {|
7159 !h1 !!h2 !!h3
7160 |c2 |||c3
7161 |}
7162 !!end
7163
7164 ###
7165 ### Internal links
7166 ###
7167 !! test
7168 Plain link, capitalized
7169 !! wikitext
7170 [[Main Page]]
7171 !! html
7172 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7173 </p>
7174 !! end
7175
7176 !! test
7177 Plain link, uncapitalized
7178 !! wikitext
7179 [[main Page]]
7180 !! html
7181 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7182 </p>
7183 !! end
7184
7185 !! test
7186 Piped link
7187 !! wikitext
7188 [[Main Page|The Main Page]]
7189 !! html
7190 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7191 </p>
7192 !! end
7193
7194 !! test
7195 Piped link with comment in link text
7196 !! wikitext
7197 [[Main Page|The Main<!--front--> Page]]
7198 !! html
7199 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7200 </p>
7201 !! end
7202
7203 !! test
7204 Piped link with multiple pipe characters in link text
7205 !! wikitext
7206 [[Main Page||The|Main|Page|]]
7207 !! html/php
7208 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7209 </p>
7210 !! html/parsoid
7211 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7212 !! end
7213
7214 !! test
7215 Piped link with no link text
7216 !! wikitext
7217 [[Thomas Bek (bishop of St David's)|]]
7218 !! html/php
7219 <p>[[Thomas Bek (bishop of St David's)|]]
7220 </p>
7221 !! html/parsoid
7222 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7223 !! end
7224
7225 !! test
7226 Broken link
7227 !! wikitext
7228 [[Zigzagzogzagzig]]
7229 !! html
7230 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7231 </p>
7232 !! end
7233
7234 !! test
7235 Broken link with fragment
7236 !! wikitext
7237 [[Zigzagzogzagzig#zug]]
7238 !! html
7239 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7240 </p>
7241 !! end
7242
7243 !! test
7244 Special page link with fragment
7245 !! wikitext
7246 [[Special:Version#anchor]]
7247 !! html
7248 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7249 </p>
7250 !! end
7251
7252 !! test
7253 Nonexistent special page link with fragment
7254 !! wikitext
7255 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7256 !! html
7257 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7258 </p>
7259 !! end
7260
7261 !! test
7262 Link with prefix
7263 !! wikitext
7264 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7265 !! html
7266 <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>
7267 </p>
7268 !! end
7269
7270 !! test
7271 Link with suffix
7272 !! wikitext
7273 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7274 !! html
7275 <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>!!!
7276 </p>
7277 !! end
7278
7279 !! article
7280 prefixed article
7281 !! text
7282 Some text
7283 !! endarticle
7284
7285 !! test
7286 Bug 43661: Piped links with identical prefixes
7287 !! wikitext
7288 [[prefixed article|prefixed articles with spaces]]
7289
7290 [[prefixed article|prefixed articlesaoeu]]
7291
7292 [[Main Page|Main Page test]]
7293 !! html
7294 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7295 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7296 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7297 </p>
7298 !! end
7299
7300
7301 !! test
7302 Link with HTML entity in suffix / tail
7303 !! wikitext
7304 [[Main Page]]&quot;, [[Main Page]]&#97;
7305 !! html/php
7306 <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;
7307 </p>
7308 !! html/parsoid
7309 <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>
7310 !! end
7311
7312 !! test
7313 Link with 3 brackets
7314 !! wikitext
7315 [[[Main Page]]]
7316 Foo [[[Main Page]]]
7317 !! html
7318 <p>[[[Main Page]]]
7319 Foo [[[Main Page]]]
7320 </p>
7321 !! end
7322
7323 !! test
7324 Link with 4 brackets
7325 !! wikitext
7326 [[[[Main Page]]]]
7327 !! html
7328 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7329 </p>
7330 !! end
7331
7332 !! test
7333 Piped link with 3 brackets
7334 !! wikitext
7335 [[[main page|the main page]]]
7336 !! html
7337 <p>[[[main page|the main page]]]
7338 </p>
7339 !! end
7340
7341 !! test
7342 Piped link with extlink-like text
7343 !! wikitext
7344 [[Main Page|[bar]]]
7345 [[Main Page|This is a [bar]]]
7346 !! html/php
7347 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7348 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7349 </p>
7350 !! html/parsoid
7351 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7352 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7353 !! end
7354
7355 !! test
7356 Link with multiple pipes
7357 !! wikitext
7358 [[Main Page|The|Main|Page]]
7359 !! html
7360 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7361 </p>
7362 !! end
7363
7364 # Note that parsoid does not munge anchor text; all non-space
7365 # characters are valid in HTML5 ids.
7366 !! test
7367 Anchor containing a #. (bug 63430)
7368 !! wikitext
7369 [[Main Page#And#Link]]
7370 !! html/php
7371 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7372 </p>
7373 !! html/parsoid
7374 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7375 !! end
7376
7377 !! test
7378 Link to namespaces
7379 !! wikitext
7380 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7381 !! html
7382 <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>
7383 </p>
7384 !! end
7385
7386 !! test
7387 Link with space in namespace
7388 !! wikitext
7389 [[User talk:Foo bar]]
7390 !! html
7391 <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>
7392 </p>
7393 !! end
7394
7395 !! article
7396 MemoryAlpha:AlphaTest
7397 !! text
7398 This is an article in the MemoryAlpha namespace
7399 (which shadows the memoryalpha interwiki link).
7400 !! endarticle
7401
7402 !! test
7403 Namespace takes precedence over interwiki link (bug 51680)
7404 !! wikitext
7405 [[MemoryAlpha:AlphaTest]]
7406 !! html
7407 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7408 </p>
7409 !! end
7410
7411 # The previous test doesn't work correctly in html2*, due to not recognizing the
7412 # link as an internal one. This one checks for the correct behavior.
7413 !! test
7414 Link to namespace preferred over interwiki with correct rel attribute
7415 !! options
7416 parsoid=html2wt,html2html
7417 !! html/parsoid
7418 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7419 !! wikitext
7420 [[MemoryAlpha:AlphaTest]]
7421 !! end
7422
7423 !! test
7424 Piped link to namespace
7425 !! wikitext
7426 [[Meta:Disclaimers|The disclaimers]]
7427 !! html
7428 <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>
7429 </p>
7430 !! end
7431
7432 !! test
7433 Link containing }
7434 !! wikitext
7435 [[Usually caused by a typo (oops}]]
7436 !! html
7437 <p>[[Usually caused by a typo (oops}]]
7438 </p>
7439 !! end
7440
7441 !! article
7442 7% Solution
7443 !! text
7444 Just a test of an article title containing a percent.
7445 !! endarticle
7446
7447 !! test
7448 Link containing % (not as a hex sequence)
7449 !! wikitext
7450 [[7% Solution]]
7451 !! html/php
7452 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7453 </p>
7454 !! html/parsoid
7455 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7456 !! end
7457
7458 # note that the parsoid HTML is identical to the previous test output,
7459 # so the previous test ensures that the html2wt mode will generate the
7460 # "not as a hex sequence" wikitext.
7461 !! test
7462 Link containing % as a single hex sequence interpreted to char
7463 !! options
7464 parsoid=wt2wt,wt2html,html2html
7465 !! wikitext
7466 [[7%25 Solution]]
7467 !! html/php
7468 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7469 </p>
7470 !! html/parsoid
7471 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7472 !!end
7473
7474 !! test
7475 Link containing % as a double hex sequence interpreted to hex sequence
7476 !! wikitext
7477 [[7%2525 Solution]]
7478 !! html
7479 <p>[[7%2525 Solution]]
7480 </p>
7481 !!end
7482
7483 # note that parsoid does not munge anchor text; all non-space
7484 # characters are valid in HTML5 anchors.
7485 !! test
7486 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7487 Example for such a section: == < ==
7488 !! wikitext
7489 [[%23%3c]][[%23%3e]]
7490 !! html/php
7491 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7492 </p>
7493 !! html/parsoid
7494 <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>
7495 !! end
7496
7497 !! test
7498 Link containing "<#" and ">#" as a hex sequences
7499 !! wikitext
7500 [[%3c%23]][[%3e%23]]
7501 !! html
7502 <p>[[%3c%23]][[%3e%23]]
7503 </p>
7504 !! end
7505
7506 !! test
7507 Link containing an equals sign
7508 !! wikitext
7509 [[Special:BookSources/isbn=4-00-026157-6]]
7510 !! html/php
7511 <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>
7512 </p>
7513 !! html/parsoid
7514 <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>
7515 !! end
7516
7517 !! article
7518 Foo~bar
7519 !! text
7520 Just a test of an article title containing a tilde.
7521 !! endarticle
7522
7523 # note that links containing signatures, like [[Foo~~~~]], are
7524 # massaged by the pre-save transform (PST) and so the tildes are never
7525 # seen by the parser.
7526 !! test
7527 Link containing a tilde
7528 !! wikitext
7529 [[Foo~bar]]
7530 !! html/php
7531 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7532 </p>
7533 !! html/parsoid
7534 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7535 !! end
7536
7537 !! test
7538 Link containing double-single-quotes '' (bug 4598)
7539 !! wikitext
7540 [[Lista d''e paise d''o munno]]
7541 !! html/php
7542 <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>
7543 </p>
7544 !! html/parsoid
7545 <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>
7546 !! end
7547
7548 !! test
7549 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7550 !! wikitext
7551 Some [[Link|pretty ''italics'' and stuff]]!
7552 !! html/php
7553 <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>!
7554 </p>
7555 !! html/parsoid
7556 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7557 !! end
7558
7559 !! test
7560 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7561 !! wikitext
7562 ''Some [[Link|pretty ''italics'' and stuff]]!''
7563 !! html
7564 <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>
7565 </p>
7566 !! end
7567
7568 !! test
7569 Link with double quotes in title part (literal) and alternate part (interpreted)
7570 !! wikitext
7571 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7572
7573 [[''Pentecoste'']]
7574
7575 [[''Pentecoste''|Pentecoste]]
7576
7577 [[''Pentecoste''|''Pentecoste'']]
7578 !! html/php
7579 <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>
7580 </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>
7581 </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>
7582 </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>
7583 </p>
7584 !! html/parsoid
7585 <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>
7586 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7587 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7588 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7589 !! end
7590
7591 !! test
7592 Broken image links with HTML captions (bug 39700)
7593 !! wikitext
7594 [[File:Nonexistent|<script></script>]]
7595 [[File:Nonexistent|100x100px|<script></script>]]
7596 [[File:Nonexistent|&lt;]]
7597 [[File:Nonexistent|a<i>b</i>c]]
7598 !! html/php
7599 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7600 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7601 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7602 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7603 </p>
7604 !! html/parsoid
7605 <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>
7606 <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>
7607 <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>
7608 <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>
7609 !! end
7610
7611 !! test
7612 Plain link to URL
7613 !! wikitext
7614 [[http://www.example.com]]
7615 !! html/php
7616 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7617 </p>
7618 !! html/parsoid
7619 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7620 !! end
7621
7622 !! test
7623 Plain link to URL with link text
7624 !! wikitext
7625 [[http://www.example.com Link text]]
7626 !! html
7627 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7628 </p>
7629 !! end
7630
7631 !! test
7632 Plain link to protocol-relative URL
7633 !! wikitext
7634 [[//www.example.com]]
7635 !! html/php
7636 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7637 </p>
7638 !! html/parsoid
7639 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7640 !! end
7641
7642 !! test
7643 Plain link to protocol-relative URL with link text
7644 !! wikitext
7645 [[//www.example.com Link text]]
7646 !! html
7647 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7648 </p>
7649 !! end
7650
7651 !! test
7652 Plain link to page with question mark in title
7653 !! wikitext
7654 [[A?b]]
7655
7656 [[A?b|Baz]]
7657 !! html
7658 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7659 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7660 </p>
7661 !! end
7662
7663
7664 # I'm fairly sure the expected result here is wrong.
7665 # We want these to be URL links, not pseudo-pages with URLs for titles....
7666 # However the current output is also pretty screwy.
7667 #
7668 # ----
7669 # I'm changing it to match the current output--it arguably makes more
7670 # sense in the light of the test above. Old expected result was:
7671 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7672 #</p>
7673 # But I think this test is bordering on "garbage in, garbage out" anyway.
7674 # -- wtm
7675 !! test
7676 Piped link to URL
7677 !! wikitext
7678 Piped link to URL: [[http://www.example.com|an example URL]]
7679 !! html/php
7680 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7681 </p>
7682 !! html/parsoid
7683 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7684 !! end
7685
7686 !! test
7687 BUG 2: [[page|http://url/]] should link to page, not http://url/
7688 !! wikitext
7689 [[Main Page|http://url/]]
7690 !! html/php
7691 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7692 </p>
7693 !! html/parsoid
7694 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7695 !! end
7696
7697 # Parsoid does not mark self-links, by design.
7698 !! test
7699 BUG 337: Escaped self-links should be bold
7700 !! options
7701 title=[[Bug462]]
7702 !! wikitext
7703 [[Bu&#103;462]] [[Bug462]]
7704 !! html/php
7705 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7706 </p>
7707 !! html/php+tidy
7708 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7709 !! html/parsoid
7710 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7711 !! end
7712
7713 !! test
7714 Self-link to section should not be bold
7715 !! options
7716 title=[[Main Page]]
7717 !! wikitext
7718 [[Main Page#section]]
7719 !! html
7720 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7721 </p>
7722 !! end
7723
7724 !! article
7725 00
7726 !! text
7727 This is 00.
7728 !! endarticle
7729
7730 !!test
7731 Self-link to numeric title
7732 !!options
7733 title=[[0]]
7734 !! wikitext
7735 [[0]]
7736 !! html
7737 <p><strong class="selflink">0</strong>
7738 </p>
7739 !!end
7740
7741 !!test
7742 Link to numeric-equivalent title
7743 !!options
7744 title=[[0]]
7745 !! wikitext
7746 [[00]]
7747 !! html
7748 <p><a href="/wiki/00" title="00">00</a>
7749 </p>
7750 !!end
7751
7752 !! test
7753 <nowiki> inside a link
7754 !! wikitext
7755 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7756 !! html
7757 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7758 </p>
7759 !! end
7760
7761 !! test
7762 Non-breaking spaces in title
7763 !! wikitext
7764 [[&nbsp; Main &nbsp; Page &nbsp;]]
7765 !! html
7766 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7767 </p>
7768 !!end
7769
7770 !! test
7771 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7772 !! options
7773 language=ca
7774 !! wikitext
7775 '''[[Main Page]]'''
7776 !! html
7777 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7778 </p>
7779 !! end
7780
7781 !! test
7782 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7783 !! options
7784 language=ca
7785 !! wikitext
7786 ''[[Main Page]]''
7787 !! html
7788 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7789 </p>
7790 !! end
7791
7792 !! test
7793 Internal link with en linktrail: no apostrophes (bug 27473)
7794 !! options
7795 language=en
7796 !! wikitext
7797 [[Something]]'nice
7798 !! html
7799 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7800 </p>
7801 !! end
7802
7803 !! test
7804 Internal link with ca linktrail with apostrophes (bug 27473)
7805 !! options
7806 language=ca
7807 !! wikitext
7808 [[Something]]'nice
7809 !! html
7810 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7811 </p>
7812 !! end
7813
7814 !! test
7815 Internal link with kaa linktrail with apostrophes (bug 27473)
7816 !! options
7817 language=kaa
7818 !! wikitext
7819 [[Something]]'nice
7820 !! html
7821 <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>
7822 </p>
7823 !! end
7824
7825 !! test
7826 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7827 !! wikitext
7828 [[User:Foo/Test/63636:Bar|Test]]
7829 !! html/php
7830 <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>
7831 </p>
7832 !! html/parsoid
7833 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7834 !! end
7835
7836 !! test
7837 Purely hash wikilink
7838 !! options
7839 title=[[User:test/123]]
7840 !! wikitext
7841 [[#a|b]]
7842 !! html/php
7843 <p><a href="#a">b</a>
7844 </p>
7845 !! html/parsoid
7846 <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>
7847 !! end
7848
7849 !! test
7850 1. Interaction of linktrail and template encapsulation
7851 !! options
7852 parsoid
7853 !! wikitext
7854 {{echo|[[Foo]]}}l
7855 !! html
7856 <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>
7857 !! end
7858
7859 !! test
7860 2. Interaction of linktrail and template encapsulation
7861 !! options
7862 parsoid
7863 !! wikitext
7864 {{echo|Some [[Fool]]}}s
7865 !! html
7866 <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>
7867 !! end
7868
7869 !! test
7870 3. Interaction of linktrail and template encapsulation
7871 !! options
7872 parsoid
7873 !! wikitext
7874 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7875 !! html
7876 <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>
7877 !! end
7878
7879 !! article
7880 Söfnuður
7881 !! text
7882 Test.
7883 !! endarticle
7884
7885 !! test
7886 Internal link with is link prefix
7887 !! options
7888 language=is
7889 !! wikitext
7890 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7891 !! html
7892 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7893 </p>
7894 !! end
7895
7896 !! article
7897 Mótmælendatrú
7898 !! text
7899 Test.
7900 !! endarticle
7901
7902 !! test
7903 Internal link with is link trail and link prefix
7904 !! options
7905 language=is
7906 !! wikitext
7907 [[mótmælendatrú|xxx]]ar
7908 [[mótmælendatrú]]ar
7909 mótmælenda[[söfnuður]]
7910 mótmælenda[[söfnuður|söfnuðir]]
7911 mótmælenda[[söfnuður|söfnuðir]]xxx
7912 !! html
7913 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7914 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7915 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7916 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7917 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7918 </p>
7919 !! end
7920
7921 !! test
7922 Parsoid link trail escaping
7923 !! options
7924 parsoid=html2wt,html2html
7925 !! html/parsoid
7926 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7927 !! wikitext
7928 [[apple]]<nowiki/>s
7929 !! end
7930
7931 !! test
7932 Parsoid link prefix escaping
7933 !! options
7934 language=is
7935 parsoid=html2wt,html2html
7936 !! html/parsoid
7937 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7938 !! wikitext
7939 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7940 !! end
7941
7942 !! test
7943 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7944 !! wikitext
7945 [[Foo| bar]]
7946
7947 [[Foo| ''bar'']]
7948
7949 [http://wp.org foo]
7950
7951 [http://wp.org ''foo'']
7952 !! html
7953 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7954 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7955 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7956 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7957 </p>
7958 !! end
7959
7960 !! test
7961 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7962 !! options
7963 parsoid
7964 !! wikitext
7965 [[Foo|{{echo|a}} b {{echo|c}}]]
7966 !! html
7967 <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>
7968 !! end
7969
7970 !! test
7971 Link with angle bracket after anchor
7972 !! wikitext
7973 [[Foo#<bar>]]
7974 !! html/php
7975 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7976 </p>
7977 !! html/parsoid
7978 <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>
7979 !! end
7980
7981 ###
7982 ### Interwiki links (see maintenance/interwiki.sql)
7983 ###
7984
7985 !! test
7986 Inline interwiki link
7987 !! options
7988 parsoid=wt2html,wt2wt,html2html
7989 !! wikitext
7990 [[MeatBall:SoftSecurity]]
7991 !! html/php
7992 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7993 </p>
7994 !! html/parsoid
7995 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7996 !! end
7997
7998 !! test
7999 Inline interwiki link with empty title (bug 2372)
8000 !! options
8001 parsoid=wt2html,wt2wt,html2html
8002 !! wikitext
8003 [[MeatBall:]]
8004 !! html/php
8005 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8006 </p>
8007 !! html/parsoid
8008 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8009 !! end
8010
8011 !! test
8012 Interwiki link encoding conversion (bug 1636)
8013 !! wikitext
8014 *[[Wikipedia:ro:Olteni&#0355;a]]
8015 *[[Wikipedia:ro:Olteni&#355;a]]
8016 !! html
8017 <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>
8018 <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>
8019
8020 !! html+tidy
8021 <ul>
8022 <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>
8023 <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>
8024 </ul>
8025 !! end
8026
8027 !! test
8028 Interwiki link with fragment (bug 2130)
8029 !! wikitext
8030 [[MeatBall:SoftSecurity#foo]]
8031 !! html
8032 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8033 </p>
8034 !! end
8035
8036 # Ideally the wikipedia: prefix here should be proto-relative too
8037 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8038 # define the 'en' prefix, and originally the test used 'wikipedia',
8039 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8040 # article.
8041 !! test
8042 Different interwiki prefixes mapping to the same URL
8043 !! wikitext
8044 [[:en:Foo]]
8045
8046 [[:en:Foo|Foo]]
8047
8048 [[wikipedia:Foo]]
8049
8050 [[:wikipedia:Foo|Foo]]
8051
8052 [[wikipedia:en:Foo]]
8053
8054 [[:wikipedia:en:Foo]]
8055
8056 [[ wikiPEdia :Foo]]
8057 !! html/parsoid
8058 <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>
8059
8060 <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>
8061
8062 <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>
8063
8064 <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>
8065
8066 <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>
8067
8068 <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>
8069
8070 <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>
8071 !! end
8072
8073 !! test
8074 Interwiki links that cannot be represented in wiki syntax
8075 !! wikitext
8076 [[meatball:ok]]
8077 [[meatball:ok#foo|ok with fragment]]
8078 [[meatball:ok_as_well?|ok ending with ? mark]]
8079 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8080 [http://de.wikipedia.org/wiki/#foo is just fragment]
8081
8082 !! html/php
8083 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8084 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8085 <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>
8086 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8087 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8088 </p>
8089 !! html/parsoid
8090 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8091 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8092 <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>
8093 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8094 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8095 !! end
8096
8097 !! test
8098 Interwiki links: trail
8099 !! wikitext
8100 [[wikipedia:Foo|Ba]]r
8101 !! html/php
8102 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8103 </p>
8104 !! html/parsoid
8105 <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>
8106 !! end
8107
8108 !! test
8109 Local interwiki link
8110 !! options
8111 parsoid=wt2html,wt2wt,html2html
8112 !! wikitext
8113 [[local:Template:Foo]]
8114 !! html/php
8115 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8116 </p>
8117 !! html/parsoid
8118 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8119 !! end
8120
8121 # Parsoid does not mark self-links, by design.
8122 !! test
8123 Local interwiki link: self-link to current page
8124 !! options
8125 title=[[Main Page]]
8126 parsoid=wt2html,wt2wt,html2html
8127 !! wikitext
8128 [[local:Main Page]]
8129 !! html/php
8130 <p><strong class="selflink">local:Main Page</strong>
8131 </p>
8132 !! html/parsoid
8133 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8134 !! end
8135
8136 !! test
8137 Local interwiki link: prefix only (bug 64167)
8138 !! options
8139 parsoid=wt2html,wt2wt,html2html
8140 !! wikitext
8141 [[local:]]
8142 !! html/php
8143 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8144 </p>
8145 !! html/parsoid
8146 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8147 !! end
8148
8149 !! test
8150 Local interwiki link: with additional interwiki prefix (bug 61357)
8151 !! options
8152 parsoid=wt2html,wt2wt,html2html
8153 !! wikitext
8154 [[local:meatball:Hello]]
8155 !! html/php
8156 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8157 </p>
8158 !! html/parsoid
8159 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8160 !! end
8161
8162 !! test
8163 Multiple local interwiki link prefixes
8164 !! wikitext
8165 [[local:local:local:local:mi:local:Foo]]
8166 !! options
8167 parsoid=wt2html,wt2wt,html2html
8168 !! html/php
8169 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8170 </p>
8171 !! html/parsoid
8172 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8173 !! end
8174
8175 ###
8176 ### Interlanguage links
8177 ### Language links (so that searching for '### language' matches..)
8178 ###
8179
8180 !! test
8181 Interlanguage link
8182 !! options
8183 parsoid=wt2html,wt2wt,html2html
8184 !! wikitext
8185 Blah blah blah
8186 [[zh:Chinese]]
8187 !! html/php
8188 <p>Blah blah blah
8189 </p>
8190 !! html/parsoid
8191 <p>Blah blah blah</p>
8192 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8193 !! end
8194
8195 !! test
8196 Interlanguage link with spacing
8197 !! options
8198 parsoid=wt2html,wt2wt,html2html
8199 !! wikitext
8200 Blah blah blah
8201 [[ zh : Chinese ]]
8202 !! html/php
8203 <p>Blah blah blah
8204 </p>
8205 !! html/parsoid
8206 <p>Blah blah blah</p>
8207 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8208 !! end
8209
8210 !! test
8211 Double interlanguage link
8212 !! options
8213 parsoid=wt2html,wt2wt,html2html
8214 !! wikitext
8215 Blah blah blah
8216 [[es:Spanish]]
8217 [[zh:Chinese]]
8218 !! html/php
8219 <p>Blah blah blah
8220 </p>
8221 !! html/parsoid
8222 <p>Blah blah blah</p>
8223 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8224 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8225 !! end
8226
8227 !! test
8228 Interlanguage link variations
8229 !! options
8230 parsoid=wt2html,wt2wt,html2html
8231 !! wikitext
8232 Blah blah blah
8233 [[ es :Spanish]]
8234 [[ ZH :Chinese]]
8235 [[es:Foo_bar]]
8236 !! html/php
8237 <p>Blah blah blah
8238 </p>
8239 !! html/parsoid
8240 <p>Blah blah blah</p>
8241 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8242 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8243 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8244 !! end
8245
8246 !! test
8247 Space and question mark encoding in interlanguage links (T95473)
8248 !! options
8249 parsoid=wt2html,wt2wt,html2html
8250 !! wikitext
8251 Blah blah blah
8252 [[es:Foo bar?]]
8253 !! html/php
8254 <p>Blah blah blah
8255 </p>
8256 !! html/parsoid
8257 <p>Blah blah blah</p>
8258 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8259 !! end
8260
8261 !! test
8262 Interlanguage link, with prefix links
8263 !! options
8264 language=ln
8265 !! wikitext
8266 Blah blah blah
8267 [[zh:Chinese]]
8268 !! html/php
8269 <p>Blah blah blah
8270 </p>
8271 !! html/parsoid
8272 <p>Blah blah blah</p>
8273 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8274 !! end
8275
8276 !! test
8277 Double interlanguage link, with prefix links (bug 8897)
8278 !! options
8279 language=ln
8280 !! wikitext
8281 Blah blah blah
8282 [[es:Spanish]]
8283 [[zh:Chinese]]
8284 !! html/php
8285 <p>Blah blah blah
8286 </p>
8287 !! html/parsoid
8288 <p>Blah blah blah</p>
8289 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8290 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8291 !! end
8292
8293 !! test
8294 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8295 !! wikitext
8296 Blah blah blah
8297 [[mul:Article]]
8298 !! html/php
8299 <p>Blah blah blah
8300 </p>
8301 !! html/parsoid
8302 <p>Blah blah blah</p>
8303 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8304 !! end
8305
8306 !! test
8307 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8308 !! options
8309 language=ln
8310 !! wikitext
8311 [[WW&nbsp;II]]
8312 !! html
8313 <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>
8314 </p>
8315 !! end
8316
8317 !! test
8318 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8319 !! options
8320 parsoid=html2wt
8321 !! html/parsoid
8322 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8323 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8324 !! wikitext
8325 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8326
8327 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8328 !! end
8329
8330 !! test
8331 Parsoid: handle constructor well
8332 !! wikitext
8333 [[constructor]]
8334
8335 [[constructor:foo]]
8336 !! html/php
8337 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8338 </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>
8339 </p>
8340 !! html/parsoid
8341 <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>
8342
8343 <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>
8344 !! end
8345
8346 !! article
8347 ko:
8348 !! text
8349 Test.
8350 !! endarticle
8351
8352 # Note that `ko` isn't a known interlanguage prefix
8353 !! test
8354 Parsoid: recognize interlanguage links without a target page
8355 !! options
8356 ill
8357 !! wikitext
8358 [[es:]]
8359
8360 [[ko:]]
8361 !! html/php
8362 es:
8363 !! html/parsoid
8364 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8365
8366 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8367 !! end
8368
8369 # Note that `ko` isn't a known interwiki prefix
8370 !! test
8371 Parsoid: recognize interwiki links without a target page
8372 !! options
8373 parsoid=wt2html,wt2wt,html2html
8374 !! wikitext
8375 [[:es:]]
8376
8377 [[:ko:]]
8378 !! html/php
8379 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8380 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8381 </p>
8382 !! html/parsoid
8383 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8384 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8385 !! end
8386
8387 !! test
8388 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8389 !! wikitext
8390 [[mi:Foo]]
8391 !! html/php
8392 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8393 </p>
8394 !! html/parsoid
8395 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8396 !! end
8397
8398 !! test
8399 Interlanguage link with preceding local interwiki link (bug 68085)
8400 !! options
8401 parsoid=wt2html,wt2wt,html2html
8402 !! wikitext
8403 Blah blah blah
8404 [[local:es:Spanish]]
8405 !! html/php
8406 <p>Blah blah blah
8407 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8408 </p>
8409 !! html/parsoid
8410 <p>Blah blah blah
8411 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8412 !! end
8413
8414 !! test
8415 Looks like an interlanguage link, but is actually a local interwiki
8416 !! options
8417 parsoid=wt2html,wt2wt,html2html
8418 !! wikitext
8419 Blah blah blah
8420 [[mi:Template:Foo]]
8421 !! html/php
8422 <p>Blah blah blah
8423 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8424 </p>
8425 !! html/parsoid
8426 <p>Blah blah blah
8427 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8428 !! end
8429
8430 ###
8431 ### Redirects, Parsoid-only
8432 ###
8433
8434 !! test
8435 1. Simple redirect to page
8436 !! wikitext
8437 #REDIRECT [[Main Page]]
8438 !! html/parsoid
8439 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8440 !! end
8441
8442 !! test
8443 2. Other redirect variants
8444 !! wikitext
8445 #REDIRECT [[Main_Page]]
8446 !! html/parsoid
8447 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8448 !! end
8449
8450 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8451 # This tests the Parsoid bail-out code.
8452 !! test
8453 3. Other redirect variants
8454 !! wikitext
8455 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8456 !! html/parsoid
8457 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8458 !! end
8459
8460 !! test
8461 4. Redirect to a templated destination
8462 !! wikitext
8463 #REDIRECT [[{{echo|Foo}}bar]]
8464 !! html/parsoid
8465 <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"}]]}'/>
8466 !! end
8467
8468 !! test
8469 Empty redirect
8470 !! options
8471 parsoid=wt2html,wt2wt
8472 !! wikitext
8473 #REDIRECT [[]]
8474 !! html/parsoid
8475 <ol>
8476 <li>REDIRECT [[]]</li></ol>
8477 !! end
8478
8479 !! test
8480 Optional colon in #REDIRECT
8481 !! options
8482 # the colon is archaic syntax. we support it for wt2html, but we
8483 # don't care that it roundtrips back to the modern syntax.
8484 parsoid=wt2html,html2html
8485 !! wikitext
8486 #REDIRECT:[[Main Page]]
8487 !! html/parsoid
8488 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8489 !! end
8490
8491 !! test
8492 Whitespace in #REDIRECT with optional colon
8493 !! options
8494 # the colon and gratuitous whitespace is archaic syntax. we support
8495 # it for wt2html, but we don't care that it roundtrips back to the
8496 # modern syntax (without extra whitespace)
8497 parsoid=wt2html,html2html
8498 !! wikitext
8499
8500 #REDIRECT
8501 :
8502 [[Main Page]]
8503 !! html/parsoid
8504 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8505 !! end
8506
8507 !! test
8508 Piped link in #REDIRECT
8509 !! options
8510 # content after piped link is ignored. we support this syntax,
8511 # but don't care that the piped link is lost when we roundtrip this.
8512 parsoid=wt2html
8513 !! wikitext
8514 #REDIRECT [[Main Page|bar]]
8515 !! html/parsoid
8516 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8517 !! end
8518
8519 !! test
8520 Redirect to category (T104502)
8521 !! options
8522 parsoid=wt2html,wt2wt
8523 !! wikitext
8524 #REDIRECT [[Category:Foo]]
8525 !! html/parsoid
8526 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8527 !! end
8528
8529 !! test
8530 Redirect to category with URL encoding (T104502)
8531 !! options
8532 parsoid=wt2html
8533 !! wikitext
8534 #REDIRECT [[Category%3AFoo]]
8535 !! html/parsoid
8536 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8537 !! end
8538
8539 !! test
8540 Redirect to category page
8541 !! wikitext
8542 #REDIRECT [[:Category:Foo]]
8543 !! html/parsoid
8544 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8545 !! end
8546
8547 !! test
8548 Redirect to image page (1)
8549 !! wikitext
8550 #REDIRECT [[File:Wiki.png]]
8551 !! html/parsoid
8552 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8553 !! end
8554
8555 !! test
8556 Redirect to image page (2)
8557 !! wikitext
8558 #REDIRECT [[Image:Wiki.png]]
8559 !! html/parsoid
8560 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8561 !! end
8562
8563 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8564 # Next test confirms this.
8565 !! test
8566 Redirect to language (1) (T104918)
8567 !! options
8568 parsoid=wt2html,wt2wt,html2html
8569 !! wikitext
8570 #REDIRECT [[en:File:Wiki.png]]
8571 !! html/parsoid
8572 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8573 !! end
8574
8575 !! test
8576 Redirect to language (2) (T104918)
8577 !! wikitext
8578 #REDIRECT [[:en:File:Wiki.png]]
8579 !! html/parsoid
8580 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8581 !! end
8582
8583 !! test
8584 Redirect to interwiki (T104918)
8585 !! wikitext
8586 #REDIRECT [[meatball:File:Wiki.png]]
8587 !! html/parsoid
8588 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8589 !! end
8590
8591 !! test
8592 Non-English #REDIRECT
8593 !! options
8594 language=is
8595 !! wikitext
8596 #TILVÍSUN [[Main Page]]
8597 !! html/parsoid
8598 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8599 !! end
8600
8601 !! test
8602 Redirect syntax under text isn't considered a redirect
8603 !! wikitext
8604 some text
8605 #redirect [[Main Page]]
8606 !! html/parsoid
8607 <p>some text</p>
8608 <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>
8609 !! end
8610
8611 # FIXME: Should hoist the redirect to the top of the page and ensure there
8612 # is only one.
8613 !! test
8614 New redirect
8615 !! options
8616 parsoid=html2wt
8617 !! html/parsoid
8618 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8619 !! wikitext
8620 Foo
8621 #REDIRECT [[Foo]]
8622 !! end
8623
8624 ##
8625 ## XHTML tidiness
8626 ###
8627
8628 !! test
8629 <br> to <br />
8630 !! wikitext
8631 1<br>2<br />3
8632 !! html
8633 <p>1<br />2<br />3
8634 </p>
8635 !! end
8636
8637 !! test
8638 Broken br tag sanitization
8639 !! wikitext
8640 </br>
8641 !! html/php
8642 <p>&lt;/br&gt;
8643 </p>
8644 !! end
8645
8646 # TODO: Fix html2html mode (bug 51055)!
8647 !! test
8648 Parsoid: Broken br tag recognition
8649 !! options
8650 parsoid=wt2html
8651 !! wikitext
8652 </br>
8653
8654 <br/ >
8655 !! html+tidy
8656 <p><br /></p>
8657 <p><br /></p>
8658 !! end
8659
8660 !! test
8661 Incorrecly removing closing slashes from correctly formed XHTML
8662 !! wikitext
8663 <br style="clear:both;" />
8664 !! html
8665 <p><br style="clear:both;" />
8666 </p>
8667 !! end
8668
8669 !! test
8670 Failing to transform badly formed HTML into correct XHTML
8671 !! wikitext
8672 <br style="clear: left;">
8673 <br style="clear: right;">
8674 <br style="clear: both;">
8675 !! html
8676 <p><br style="clear: left;" />
8677 <br style="clear: right;" />
8678 <br style="clear: both;" />
8679 </p>
8680 !!end
8681
8682 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8683 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8684 !! test
8685 Handling html with a div self-closing tag
8686 !! wikitext
8687 <div title />
8688 <div title/>
8689 <div title/ >
8690 <div title=bar />
8691 <div title=bar/>
8692 <div title=bar/ >
8693 !! html/php
8694 <p>&lt;div title /&gt;
8695 &lt;div title/&gt;
8696 </p>
8697 <div>
8698 <p>&lt;div title=bar /&gt;
8699 &lt;div title=bar/&gt;
8700 </p>
8701 <div title="bar/"></div>
8702 </div>
8703
8704 !! html/parsoid
8705 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8706 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8707 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8708 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8709 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8710 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8711 !! end
8712
8713 !! test
8714 Handling html with a br self-closing tag
8715 !! wikitext
8716 <br title />
8717 <br title/>
8718 <br title/ >
8719 <br title=bar />
8720 <br title=bar/>
8721 <br title=bar/ >
8722 !! html/php
8723 <p><br title="" />
8724 <br title="" />
8725 <br />
8726 <br title="bar" />
8727 <br title="bar" />
8728 <br title="bar/" />
8729 </p>
8730 !! html/parsoid
8731 <p><br title="" />
8732 <br title="" />
8733 <br title="" />
8734 <br title="bar" />
8735 <br title="bar" />
8736 <br title="bar/" />
8737 </p>
8738 !! end
8739
8740 !! test
8741 Horizontal ruler (should it add that extra space?)
8742 !! wikitext
8743 <hr>
8744 <hr >
8745 foo <hr
8746 > bar
8747 !! html+tidy
8748 <hr />
8749 <hr />
8750 <p>foo</p>
8751 <hr />
8752 <p>bar</p>
8753 !! end
8754
8755 !! test
8756 Horizontal ruler -- 4+ dashes render hr
8757 !! wikitext
8758 ----
8759 !! html
8760 <hr />
8761
8762 !! end
8763
8764 !! test
8765 Horizontal ruler -- eats additional dashes on the same line
8766 !! wikitext
8767 ---------
8768 !! html
8769 <hr />
8770
8771 !! end
8772
8773 !! test
8774 Horizontal ruler -- does not collapse dashes on consecutive lines
8775 !! wikitext
8776 ----
8777 ----
8778 !! html
8779 <hr />
8780 <hr />
8781
8782 !! end
8783
8784 !! test
8785 Horizontal ruler -- <4 dashes render as plain text
8786 !! wikitext
8787 ---
8788 !! html
8789 <p>---
8790 </p>
8791 !! end
8792
8793 !! test
8794 Horizontal ruler -- Supports content following dashes on same line
8795 !! wikitext
8796 ---- Foo
8797 !! html
8798 <hr /> Foo
8799
8800 !! html+tidy
8801 <hr />
8802 <p>Foo</p>
8803 !! end
8804
8805 ###
8806 ### Block-level elements
8807 ###
8808 !! test
8809 Common list
8810 !! wikitext
8811 *Common list
8812 * item 2
8813 *item 3
8814 !! html
8815 <ul><li>Common list</li>
8816 <li> item 2</li>
8817 <li>item 3</li></ul>
8818
8819 !! end
8820
8821 !! test
8822 Numbered list
8823 !! wikitext
8824 #Numbered list
8825 #item 2
8826 # item 3
8827 !! html
8828 <ol><li>Numbered list</li>
8829 <li>item 2</li>
8830 <li> item 3</li></ol>
8831
8832 !! end
8833
8834 !! test
8835 Mixed list
8836 !! wikitext
8837 *Mixed list
8838 *# with numbers
8839 ** and bullets
8840 *# and numbers
8841 *bullets again
8842 **bullet level 2
8843 ***bullet level 3
8844 ***#Number on level 4
8845 **bullet level 2
8846 **#Number on level 3
8847 **#Number on level 3
8848 *#number level 2
8849 *Level 1
8850 *** Level 3
8851 #** Level 3, but ordered
8852 !! html
8853 <ul><li>Mixed list
8854 <ol><li> with numbers</li></ol>
8855 <ul><li> and bullets</li></ul>
8856 <ol><li> and numbers</li></ol></li>
8857 <li>bullets again
8858 <ul><li>bullet level 2
8859 <ul><li>bullet level 3
8860 <ol><li>Number on level 4</li></ol></li></ul></li>
8861 <li>bullet level 2
8862 <ol><li>Number on level 3</li>
8863 <li>Number on level 3</li></ol></li></ul>
8864 <ol><li>number level 2</li></ol></li>
8865 <li>Level 1
8866 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8867 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8868
8869 !! end
8870
8871 !! test
8872 1. Nested mixed wikitext and html list
8873 !! wikitext
8874 * hi
8875 * <ul><li>ho</li></ul>
8876 * hi
8877 ** ho
8878 !! html/php
8879 <ul><li> hi</li>
8880 <li> <ul><li>ho</li></ul></li>
8881 <li> hi
8882 <ul><li> ho</li></ul></li></ul>
8883
8884 !! html/parsoid
8885 <ul><li> hi</li>
8886 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8887 <li> hi
8888 <ul><li> ho</li></ul></li></ul>
8889 !! end
8890
8891 !! test
8892 2. Nested mixed wikitext and html list (incompatible)
8893 !! wikitext
8894 ; hi
8895 : {{echo|<li>ho</li>}}
8896 !! html/php
8897 <dl><dt> hi</dt>
8898 <dd> <li>ho</li></dd></dl>
8899
8900 !! html/parsoid
8901 <dl><dt> hi</dt>
8902 <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>
8903 !! end
8904
8905 !! test
8906 Nested lists 1
8907 !! wikitext
8908 *foo
8909 **bar
8910 !! html
8911 <ul><li>foo
8912 <ul><li>bar</li></ul></li></ul>
8913
8914 !! end
8915
8916 !! test
8917 Nested lists 2
8918 !! wikitext
8919 **foo
8920 *bar
8921 !! html
8922 <ul><li><ul><li>foo</li></ul></li>
8923 <li>bar</li></ul>
8924
8925 !! end
8926
8927 !! test
8928 Nested lists 3 (first element empty)
8929 !! wikitext
8930 *
8931 **bar
8932 !! html
8933 <ul><li>
8934 <ul><li>bar</li></ul></li></ul>
8935
8936 !! end
8937
8938 !! test
8939 Nested lists 4 (first element empty)
8940 !! wikitext
8941 **
8942 *bar
8943 !! html
8944 <ul><li><ul><li></li></ul></li>
8945 <li>bar</li></ul>
8946
8947 !! end
8948
8949 !! test
8950 Nested lists 5 (both elements empty)
8951 !! wikitext
8952 **
8953 *
8954 !! html
8955 <ul><li><ul><li></li></ul></li>
8956 <li></li></ul>
8957
8958 !! end
8959
8960 !! test
8961 Nested lists 6 (both elements empty)
8962 !! wikitext
8963 *
8964 **
8965 !! html
8966 <ul><li>
8967 <ul><li></li></ul></li></ul>
8968
8969 !! end
8970
8971 !! test
8972 Nested lists 7 (skip initial nesting levels)
8973 !! wikitext
8974 *** foo
8975 !! html
8976 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8977
8978 !! end
8979
8980 !! test
8981 Nested lists 8 (multiple nesting transitions)
8982 !! wikitext
8983 * foo
8984 *** bar
8985 ** baz
8986 * boo
8987 !! html
8988 <ul><li> foo
8989 <ul><li><ul><li> bar</li></ul></li>
8990 <li> baz</li></ul></li>
8991 <li> boo</li></ul>
8992
8993 !! end
8994
8995 !! test
8996 Nested lists 9 (extension interaction)
8997 !! options
8998 parsoid
8999 !! wikitext
9000 *<references />
9001 !! html/parsoid
9002 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9003 !! end
9004
9005 !! test
9006 1. Lists with start-of-line-transparent tokens before bullets: Comments
9007 !! wikitext
9008 *foo
9009 *<!--cmt-->bar
9010 <!--cmt-->*baz
9011 !! html
9012 <ul><li>foo</li>
9013 <li>bar</li>
9014 <li>baz</li></ul>
9015
9016 !! end
9017
9018 !! test
9019 2. Lists with start-of-line-transparent tokens before bullets: Template close
9020 !! wikitext
9021 *foo {{echo|bar
9022 }}*baz
9023 !! html
9024 <ul><li>foo bar</li>
9025 <li>baz</li></ul>
9026
9027 !! end
9028
9029 !! test
9030 List items are not parsed correctly following a <pre> block (bug 785)
9031 !! wikitext
9032 * <pre>foo</pre>
9033 * <pre>bar</pre>
9034 * zar
9035 !! html/php
9036 <ul><li> <pre>foo</pre></li>
9037 <li> <pre>bar</pre></li>
9038 <li> zar</li></ul>
9039
9040 !! html/parsoid
9041 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9042 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9043 <li> zar</li></ul>
9044 !! end
9045
9046 !! test
9047 List items from template
9048 !! wikitext
9049
9050 {{inner list}}
9051 * item 2
9052
9053 * item 0
9054 {{inner list}}
9055 * item 2
9056
9057 * item 0
9058 * notSOL{{inner list}}
9059 * item 2
9060 !! html
9061 <ul><li> item 1</li>
9062 <li> item 2</li></ul>
9063 <ul><li> item 0</li>
9064 <li> item 1</li>
9065 <li> item 2</li></ul>
9066 <ul><li> item 0</li>
9067 <li> notSOL</li>
9068 <li> item 1</li>
9069 <li> item 2</li></ul>
9070
9071 !! end
9072
9073 !! test
9074 List interrupted by empty line or heading
9075 !! wikitext
9076 * foo
9077
9078 ** bar
9079 == A heading ==
9080 * Another list item
9081 !! html
9082 <ul><li> foo</li></ul>
9083 <ul><li><ul><li> bar</li></ul></li></ul>
9084 <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>
9085 <ul><li> Another list item</li></ul>
9086
9087 !!end
9088
9089 !!test
9090 Multiple list tags generated by templates
9091 !! wikitext
9092 {{echo|<li>}}a
9093 {{echo|<li>}}b
9094 {{echo|<li>}}c
9095 !! html
9096 <li>a
9097 <li>b
9098 <li>c</li>
9099 </li>
9100 </li>
9101
9102 !! html+tidy
9103 <ul>
9104 <li>a</li>
9105 <li>b</li>
9106 <li>c</li>
9107 </ul>
9108 !!end
9109
9110 !!test
9111 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9112 !! wikitext
9113 *a
9114 <!--This line will NOT split the list-->
9115 *b
9116 <!--This line will NOT split the list either-->
9117 *c
9118 <!--foo--> <!----> <!--This line NOT split the list either-->
9119 *d
9120 !! html
9121 <ul><li>a</li>
9122 <li>b</li>
9123 <li>c</li>
9124 <li>d</li></ul>
9125
9126 !!end
9127
9128 !!test
9129 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9130 !! wikitext
9131 *a
9132 <!--This line will NOT split the list-->
9133 *b
9134 <!--This line will NOT split the list either-->
9135 *c
9136 <!--foo--> <!----> <!--This line NOT split the list
9137 either-->
9138 *d
9139 !! html
9140 <ul><li>a</li>
9141 <li>b</li>
9142 <li>c</li>
9143 <li>d</li></ul>
9144
9145 !!end
9146
9147 !!test
9148 Test the li-hack
9149 (The PHP parser relies on Tidy for the hack)
9150 !!options
9151 parsoid=wt2html,wt2wt
9152 !! wikitext
9153 * foo
9154 * <li>li-hack
9155 * {{echo|<li>templated li-hack}}
9156 * <!--foo--> <li> unsupported li-hack with preceding comments
9157
9158 <ul>
9159 <li><li>not a li-hack
9160 </li>
9161 </ul>
9162 !! html+tidy
9163 <ul>
9164 <li>foo</li>
9165 <li>li-hack</li>
9166 <li>templated li-hack</li>
9167 <li>unsupported li-hack with preceding comments</li>
9168 </ul>
9169 <ul>
9170 <li>not a li-hack</li>
9171 </ul>
9172 !!end
9173
9174 !! test
9175 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9176 !! options
9177 parsoid
9178 !! wikitext
9179 # foo
9180 ## bar
9181 * foo
9182 ** bar
9183 : foo
9184 :: bar
9185 !! html
9186 <ol>
9187 <li> foo<ol>
9188 <li> bar</li>
9189 </ol></li>
9190 </ol><ul>
9191 <li> foo<ul>
9192 <li> bar</li>
9193 </ul></li>
9194 </ul><dl>
9195 <dd> foo<dl>
9196 <dd> bar</dd>
9197 </dl></dd>
9198 </dl>
9199 !! end
9200
9201 !! test
9202 Parsoid: Test of whitespace serialization with Templated bullets
9203 !! options
9204 parsoid
9205 !! wikitext
9206 * {{bullet}}
9207 !! html
9208 <ul>
9209 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9210 </ul>
9211 !! end
9212
9213 # ------------------------------------------------------------------------
9214 # The next set of tests are about Parsoid's ability to handle badly nested
9215 # tags (parse, minimize scope of fixup, and roundtrip back)
9216 # ------------------------------------------------------------------------
9217
9218 !! test
9219 Unbalanced closing block tags break a list
9220 (php parser relies on Tidy to fix up)
9221 !! wikitext
9222 <div>
9223 *a</div><div>
9224 *b</div>
9225 !! html+tidy
9226 <div>
9227 <ul>
9228 <li>a</li>
9229 </ul>
9230 </div>
9231 <div>
9232 <ul>
9233 <li>b</li>
9234 </ul>
9235 </div>
9236 !! end
9237
9238 # Parsoid fails this test, but it might be tricky to support properly.
9239 # See bug 68395.
9240 !! test
9241 Unbalanced closing non-block tags don't break a list
9242 (php parser relies on Tidy to fix up)
9243 !! wikitext
9244 <span>
9245 *a</span><span>
9246 *b</span>
9247 !! html/php+tidy
9248 <ul>
9249 <li><span>a</span></li>
9250 <li><span>b</span></li>
9251 </ul>
9252 !! html/parsoid
9253 <span>
9254 <ul>
9255 <li>a<span></span>
9256 </li>
9257 <li>b
9258 </li>
9259 </ul>
9260 </span>
9261 !! end
9262
9263 !! test
9264 Unclosed formatting tags that straddle lists are closed and reopened
9265 (php parser relies on Tidy to fix up)
9266 !! options
9267 parsoid=wt2html,wt2wt,html2html
9268 !! wikitext
9269 # <s> a
9270 # b </s>
9271 !! html/php+tidy
9272 <ol>
9273 <li><s>a</s></li>
9274 <li><s>b</s></li>
9275 </ol>
9276 !! html/parsoid
9277 <ol><li> <s> a</s></li>
9278 <li><s> b </s></li></ol>
9279 !! end
9280
9281 # See bug 68395.
9282 !!test
9283 1. List embedded in a formatting tag
9284 !! wikitext
9285 <small>
9286 * foo
9287 </small>
9288 !! html/php+tidy
9289 <ul>
9290 <li><small>foo</small></li>
9291 </ul>
9292 !! html/parsoid
9293 <small>
9294 <ul>
9295 <li> foo</li>
9296 </ul>
9297 </small>
9298 !!end
9299
9300 ## Ugly Parsoid output here
9301 ## Not sure what the right output is.
9302 !!test
9303 2. List embedded in a formatting tag
9304 !! wikitext
9305 <small>
9306 *a
9307 *b</small>
9308 !! html/php+tidy
9309 <ul>
9310 <li><small>a</small></li>
9311 <li><small>b</small></li>
9312 </ul>
9313 !! html/parsoid
9314 <small></small>
9315 <ul><small>
9316 <li>a</li>
9317 </small>
9318 <li><small>b</small></li>
9319 </ul>
9320 !!end
9321
9322 # Ugly Parsoid and PHP parser output here
9323 # Not sure if we want to make this a test!
9324 #
9325 ## !!test
9326 ## 3. Unclosed formatting tags in list elements
9327 ## !! wikitext
9328 ## *<small>a
9329 ## *<small>b
9330 ## !! html/php+tidy
9331 ## <ul>
9332 ## <li><small>a</small></li>
9333 ## <li><small><small>b</small></small></li>
9334 ## </ul>
9335 ## !! html/parsoid
9336 ## <ul>
9337 ## <li><small>a</small></li>
9338 ## <small>
9339 ## <li><small>b</small></li>
9340 ## </small></ul>
9341 ## !!end
9342
9343 # This is a bug in the PHP parser + tidy combination.
9344 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9345 # and then fostered out of the table by tidy.)
9346 # We believe the Parsoid output to be correct.
9347 !! test
9348 Table with missing opening <tr> tag
9349 !! options
9350 parsoid=wt2html,wt2wt
9351 !! wikitext
9352 <table>
9353 <td>foo</td>
9354 </tr>
9355 </table>
9356 !! html+tidy
9357 <table>
9358 <tr>
9359 <td>foo</td>
9360 </tr>
9361 </table>
9362 !! end
9363
9364 ###
9365 ### Magic Words
9366 ###
9367
9368 # Note that the current date is hard-coded as
9369 # 1970-01-01T00:02:03Z (a Thursday)
9370 # when running parser tests. The timezone is also fixed to GMT, so
9371 # local date will be identical to current date.
9372
9373 !! test
9374 Magic Word: {{CURRENTDAY}}
9375 !! wikitext
9376 {{CURRENTDAY}}
9377 !! html
9378 <p>1
9379 </p>
9380 !! end
9381
9382 !! test
9383 Magic Word: {{CURRENTDAY2}}
9384 !! wikitext
9385 {{CURRENTDAY2}}
9386 !! html
9387 <p>01
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{CURRENTDAYNAME}}
9393 !! wikitext
9394 {{CURRENTDAYNAME}}
9395 !! html
9396 <p>Thursday
9397 </p>
9398 !! end
9399
9400 !! test
9401 Magic Word: {{CURRENTDOW}}
9402 !! wikitext
9403 {{CURRENTDOW}}
9404 !! html
9405 <p>4
9406 </p>
9407 !! end
9408
9409 !! test
9410 Magic Word: {{CURRENTMONTH}}
9411 !! wikitext
9412 {{CURRENTMONTH}}
9413 !! html
9414 <p>01
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic Word: {{CURRENTMONTH1}}
9420 !! wikitext
9421 {{CURRENTMONTH1}}
9422 !! html
9423 <p>1
9424 </p>
9425 !! end
9426
9427 !! test
9428 Magic Word: {{CURRENTMONTHABBREV}}
9429 !! wikitext
9430 {{CURRENTMONTHABBREV}}
9431 !! html
9432 <p>Jan
9433 </p>
9434 !! end
9435
9436 !! test
9437 Magic Word: {{CURRENTMONTHNAME}}
9438 !! wikitext
9439 {{CURRENTMONTHNAME}}
9440 !! html
9441 <p>January
9442 </p>
9443 !! end
9444
9445 !! test
9446 Magic Word: {{CURRENTMONTHNAMEGEN}}
9447 !! wikitext
9448 {{CURRENTMONTHNAMEGEN}}
9449 !! html
9450 <p>January
9451 </p>
9452 !! end
9453
9454 !! test
9455 Magic Word: {{CURRENTTIME}}
9456 !! wikitext
9457 {{CURRENTTIME}}
9458 !! html
9459 <p>00:02
9460 </p>
9461 !! end
9462
9463 !! test
9464 Magic Word: {{CURRENTHOUR}}
9465 !! wikitext
9466 {{CURRENTHOUR}}
9467 !! html
9468 <p>00
9469 </p>
9470 !! end
9471
9472 !! test
9473 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9474 !! wikitext
9475 {{CURRENTWEEK}}
9476 !! html
9477 <p>1
9478 </p>
9479 !! end
9480
9481 !! test
9482 Magic Word: {{CURRENTYEAR}}
9483 !! wikitext
9484 {{CURRENTYEAR}}
9485 !! html
9486 <p>1970
9487 </p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{CURRENTTIMESTAMP}}
9492 !! wikitext
9493 {{CURRENTTIMESTAMP}}
9494 !! html
9495 <p>19700101000203
9496 </p>
9497 !! end
9498
9499 !! test
9500 Magic Words LOCAL (UTC)
9501 !! wikitext
9502 * {{LOCALMONTH}}
9503 * {{LOCALMONTH1}}
9504 * {{LOCALMONTHNAME}}
9505 * {{LOCALMONTHNAMEGEN}}
9506 * {{LOCALMONTHABBREV}}
9507 * {{LOCALDAY}}
9508 * {{LOCALDAY2}}
9509 * {{LOCALDAYNAME}}
9510 * {{LOCALYEAR}}
9511 * {{LOCALTIME}}
9512 * {{LOCALHOUR}}
9513 * {{LOCALWEEK}}
9514 * {{LOCALDOW}}
9515 * {{LOCALTIMESTAMP}}
9516 !! html
9517 <ul><li> 01</li>
9518 <li> 1</li>
9519 <li> January</li>
9520 <li> January</li>
9521 <li> Jan</li>
9522 <li> 1</li>
9523 <li> 01</li>
9524 <li> Thursday</li>
9525 <li> 1970</li>
9526 <li> 00:02</li>
9527 <li> 00</li>
9528 <li> 1</li>
9529 <li> 4</li>
9530 <li> 19700101000203</li></ul>
9531
9532 !! end
9533
9534 !! test
9535 Magic Word: {{FULLPAGENAME}}
9536 !! options
9537 title=[[User:Ævar Arnfjörð Bjarmason]]
9538 !! wikitext
9539 {{FULLPAGENAME}}
9540 !! html
9541 <p>User:Ævar Arnfjörð Bjarmason
9542 </p>
9543 !! end
9544
9545 !! test
9546 Magic Word: {{FULLPAGENAMEE}}
9547 !! options
9548 title=[[User:Ævar Arnfjörð Bjarmason]]
9549 !! wikitext
9550 {{FULLPAGENAMEE}}
9551 !! html
9552 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9553 </p>
9554 !! end
9555
9556 !! test
9557 Magic Word: {{TALKSPACE}}
9558 !! options
9559 title=[[User:Ævar Arnfjörð Bjarmason]]
9560 !! wikitext
9561 {{TALKSPACE}}
9562 !! html
9563 <p>User talk
9564 </p>
9565 !! end
9566
9567 !! test
9568 Magic Word: {{TALKSPACE}}, same namespace
9569 !! options
9570 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9571 !! wikitext
9572 {{TALKSPACE}}
9573 !! html
9574 <p>User talk
9575 </p>
9576 !! end
9577
9578 !! test
9579 Magic Word: {{TALKSPACE}}, main namespace
9580 !! options
9581 title=[[Parser Test]]
9582 !! wikitext
9583 {{TALKSPACE}}
9584 !! html
9585 <p>Talk
9586 </p>
9587 !! end
9588
9589 !! test
9590 Magic Word: {{TALKSPACEE}}
9591 !! options
9592 title=[[User:Ævar Arnfjörð Bjarmason]]
9593 !! wikitext
9594 {{TALKSPACEE}}
9595 !! html
9596 <p>User_talk
9597 </p>
9598 !! end
9599
9600 !! test
9601 Magic Word: {{SUBJECTSPACE}}
9602 !! options
9603 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9604 !! wikitext
9605 {{SUBJECTSPACE}}
9606 !! html
9607 <p>User
9608 </p>
9609 !! end
9610
9611 !! test
9612 Magic Word: {{SUBJECTSPACE}}, same namespace
9613 !! options
9614 title=[[User:Ævar Arnfjörð Bjarmason]]
9615 !! wikitext
9616 {{SUBJECTSPACE}}
9617 !! html
9618 <p>User
9619 </p>
9620 !! end
9621
9622 !! test
9623 Magic Word: {{SUBJECTSPACE}}, main namespace
9624 !! options
9625 title=[[Parser Test]]
9626 !! wikitext
9627 {{SUBJECTSPACE}}
9628 !! html
9629
9630 !! end
9631
9632 !! test
9633 Magic Word: {{SUBJECTSPACEE}}
9634 !! options
9635 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9636 !! wikitext
9637 {{SUBJECTSPACEE}}
9638 !! html
9639 <p>User
9640 </p>
9641 !! end
9642
9643 !! test
9644 Magic Word: {{NAMESPACE}}
9645 !! options
9646 title=[[User:Ævar Arnfjörð Bjarmason]]
9647 !! wikitext
9648 {{NAMESPACE}}
9649 !! html
9650 <p>User
9651 </p>
9652 !! end
9653
9654 !! test
9655 Magic Word: {{NAMESPACEE}}
9656 !! options
9657 title=[[User:Ævar Arnfjörð Bjarmason]]
9658 !! wikitext
9659 {{NAMESPACEE}}
9660 !! html
9661 <p>User
9662 </p>
9663 !! end
9664
9665 !! test
9666 Magic Word: {{NAMESPACENUMBER}}
9667 !! options
9668 title=[[User:Ævar Arnfjörð Bjarmason]]
9669 !! wikitext
9670 {{NAMESPACENUMBER}}
9671 !! html
9672 <p>2
9673 </p>
9674 !! end
9675
9676 !! test
9677 Magic Word: {{SUBPAGENAME}}
9678 !! options
9679 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9680 !! wikitext
9681 {{SUBPAGENAME}}
9682 !! html
9683 <p>sub ö
9684 </p>
9685 !! end
9686
9687 !! test
9688 Magic Word: {{SUBPAGENAMEE}}
9689 !! options
9690 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9691 !! wikitext
9692 {{SUBPAGENAMEE}}
9693 !! html
9694 <p>sub_%C3%B6
9695 </p>
9696 !! end
9697
9698 !! test
9699 Magic Word: {{ROOTPAGENAME}}
9700 !! options
9701 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9702 !! wikitext
9703 {{ROOTPAGENAME}}
9704 !! html
9705 <p>Ævar Arnfjörð Bjarmason
9706 </p>
9707 !! end
9708
9709 !! test
9710 Magic Word: {{ROOTPAGENAMEE}}
9711 !! options
9712 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9713 !! wikitext
9714 {{ROOTPAGENAMEE}}
9715 !! html
9716 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9717 </p>
9718 !! end
9719
9720 !! test
9721 Magic Word: {{BASEPAGENAME}}
9722 !! options
9723 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9724 !! wikitext
9725 {{BASEPAGENAME}}
9726 !! html
9727 <p>Ævar Arnfjörð Bjarmason
9728 </p>
9729 !! end
9730
9731 !! test
9732 Magic Word: {{BASEPAGENAMEE}}
9733 !! options
9734 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9735 !! wikitext
9736 {{BASEPAGENAMEE}}
9737 !! html
9738 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9739 </p>
9740 !! end
9741
9742 !! test
9743 Magic Word: {{TALKPAGENAME}}
9744 !! options
9745 title=[[User:Ævar Arnfjörð Bjarmason]]
9746 !! wikitext
9747 {{TALKPAGENAME}}
9748 !! html
9749 <p>User talk:Ævar Arnfjörð Bjarmason
9750 </p>
9751 !! end
9752
9753 !! test
9754 Magic Word: {{TALKPAGENAMEE}}
9755 !! options
9756 title=[[User:Ævar Arnfjörð Bjarmason]]
9757 !! wikitext
9758 {{TALKPAGENAMEE}}
9759 !! html
9760 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9761 </p>
9762 !! end
9763
9764 !! test
9765 Magic Word: {{SUBJECTPAGENAME}}
9766 !! options
9767 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9768 !! wikitext
9769 {{SUBJECTPAGENAME}}
9770 !! html
9771 <p>User:Ævar Arnfjörð Bjarmason
9772 </p>
9773 !! end
9774
9775 !! test
9776 Magic Word: {{SUBJECTPAGENAMEE}}
9777 !! options
9778 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9779 !! wikitext
9780 {{SUBJECTPAGENAMEE}}
9781 !! html
9782 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9783 </p>
9784 !! end
9785
9786 !! test
9787 Magic Word: {{NUMBEROFFILES}}
9788 !! wikitext
9789 {{NUMBEROFFILES}}
9790 !! html
9791 <p>6
9792 </p>
9793 !! end
9794
9795 !! test
9796 Magic Word: {{PAGENAME}}
9797 !! options
9798 title=[[User:Ævar Arnfjörð Bjarmason]]
9799 !! wikitext
9800 {{PAGENAME}}
9801 !! html
9802 <p>Ævar Arnfjörð Bjarmason
9803 </p>
9804 !! end
9805
9806 !! test
9807 Magic Word: {{PAGENAME}} with metacharacters
9808 !! options
9809 title=[['foo & bar = baz']]
9810 !! wikitext
9811 ''{{PAGENAME}}''
9812 !! html/php
9813 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9814 </p>
9815 !! html+tidy
9816 <p><i>'foo &amp; bar = baz'</i></p>
9817 !! end
9818
9819 !! test
9820 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9821 !! options
9822 title=[[*RFC 1234 http://example.com/]]
9823 !! wikitext
9824 {{PAGENAME}}
9825 !! html/php
9826 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9827 </p>
9828 !! html+tidy
9829 <p>*RFC 1234 http://example.com/</p>
9830 !! end
9831
9832 !! test
9833 Magic Word: {{PAGENAMEE}}
9834 !! options
9835 title=[[User:Ævar Arnfjörð Bjarmason]]
9836 !! wikitext
9837 {{PAGENAMEE}}
9838 !! html
9839 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9840 </p>
9841 !! end
9842
9843 !! test
9844 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9845 !! options
9846 title=[[*RFC 1234 http://example.com/]]
9847 !! wikitext
9848 {{PAGENAMEE}}
9849 !! html/php
9850 <p>&#42;RFC_1234_http&#58;//example.com/
9851 </p>
9852 !! html+tidy
9853 <p>*RFC_1234_http://example.com/</p>
9854 !! end
9855
9856 !! test
9857 Magic Word: {{REVISIONID}}
9858 !! wikitext
9859 {{REVISIONID}}
9860 !! html
9861 <p>1337
9862 </p>
9863 !! end
9864
9865 !! test
9866 Magic Word: {{SCRIPTPATH}}
9867 !! wikitext
9868 {{SCRIPTPATH}}
9869 !! html
9870
9871 !! end
9872
9873 !! test
9874 Magic Word: {{STYLEPATH}}
9875 !! wikitext
9876 {{STYLEPATH}}
9877 !! html
9878 <p>/skins
9879 </p>
9880 !! end
9881
9882 !! test
9883 Magic Word: {{SERVER}}
9884 !! wikitext
9885 {{SERVER}}
9886 !! html
9887 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9888 </p>
9889 !! end
9890
9891 !! test
9892 Magic Word: {{SERVERNAME}}
9893 !! wikitext
9894 {{SERVERNAME}}
9895 !! html
9896 <p>example.org
9897 </p>
9898 !! end
9899
9900 !! test
9901 Magic Word: {{SITENAME}}
9902 !! wikitext
9903 {{SITENAME}}
9904 !! html
9905 <p>MediaWiki
9906 </p>
9907 !! end
9908
9909 !! test
9910 Case-sensitive magic words, when cased differently, should just be template transclusions
9911 !! wikitext
9912 {{CurrentMonth}}
9913 {{currentday}}
9914 {{cURreNTweEK}}
9915 {{currentHour}}
9916 !! html
9917 <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>
9918 <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>
9919 <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>
9920 <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>
9921 </p>
9922 !! end
9923
9924 !! test
9925 Case-insensitive magic words should still work with weird casing.
9926 !! wikitext
9927 {{sErVeRNaMe}}
9928 {{LCFirst:AOEU}}
9929 {{ucFIRST:aoeu}}
9930 {{SERver}}
9931 !! html
9932 <p>example.org
9933 aOEU
9934 Aoeu
9935 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9936 </p>
9937 !! end
9938
9939 # From plwiki:PLOS_ONE
9940 !! test
9941 Parsoid: Page property magic word with magic word contents
9942 !! wikitext
9943 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9944 !! html/parsoid
9945 <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>"}]]}'/>
9946 !! end
9947
9948 !! test
9949 Parsoid: Template-generated DISPLAYTITLE
9950 !! wikitext
9951 {{{{echo|DISPLAYTITLE}}:Foo}}
9952 !! html/parsoid
9953 <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}}]}'/>
9954 !! end
9955
9956 !! test
9957 Namespace 1 {{ns:1}}
9958 !! wikitext
9959 {{ns:1}}
9960 !! html
9961 <p>Talk
9962 </p>
9963 !! end
9964
9965 !! test
9966 Namespace 1 {{ns:01}}
9967 !! wikitext
9968 {{ns:01}}
9969 !! html
9970 <p>Talk
9971 </p>
9972 !! end
9973
9974 !! test
9975 Namespace 0 {{ns:0}} (bug 4783)
9976 !! wikitext
9977 {{ns:0}}
9978 !! html
9979
9980 !! end
9981
9982 !! test
9983 Namespace 0 {{ns:00}} (bug 4783)
9984 !! wikitext
9985 {{ns:00}}
9986 !! html
9987
9988 !! end
9989
9990 !! test
9991 Namespace -1 {{ns:-1}}
9992 !! wikitext
9993 {{ns:-1}}
9994 !! html
9995 <p>Special
9996 </p>
9997 !! end
9998
9999 !! test
10000 Namespace User {{ns:User}}
10001 !! wikitext
10002 {{ns:User}}
10003 !! html
10004 <p>User
10005 </p>
10006 !! end
10007
10008 !! test
10009 Namespace User talk {{ns:User_talk}}
10010 !! wikitext
10011 {{ns:User_talk}}
10012 !! html
10013 <p>User talk
10014 </p>
10015 !! end
10016
10017 !! test
10018 Namespace User talk {{ns:uSeR tAlK}}
10019 !! wikitext
10020 {{ns:uSeR tAlK}}
10021 !! html
10022 <p>User talk
10023 </p>
10024 !! end
10025
10026 !! test
10027 Namespace File {{ns:File}}
10028 !! wikitext
10029 {{ns:File}}
10030 !! html
10031 <p>File
10032 </p>
10033 !! end
10034
10035 !! test
10036 Namespace File {{ns:Image}}
10037 !! wikitext
10038 {{ns:Image}}
10039 !! html
10040 <p>File
10041 </p>
10042 !! end
10043
10044 !! test
10045 Namespace (lang=de) Benutzer {{ns:User}}
10046 !! options
10047 language=de
10048 !! wikitext
10049 {{ns:User}}
10050 !! html
10051 <p>Benutzer
10052 </p>
10053 !! end
10054
10055 !! test
10056 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10057 !! options
10058 language=de
10059 !! wikitext
10060 {{ns:3}}
10061 !! html
10062 <p>Benutzer Diskussion
10063 </p>
10064 !! end
10065
10066
10067 !! test
10068 Urlencode
10069 !! wikitext
10070 {{urlencode:hi world?!}}
10071 {{urlencode:hi world?!|WIKI}}
10072 {{urlencode:hi world?!|PATH}}
10073 {{urlencode:hi world?!|QUERY}}
10074 !! html
10075 <p>hi+world%3F%21
10076 hi_world%3F!
10077 hi%20world%3F%21
10078 hi+world%3F%21
10079 </p>
10080 !! end
10081
10082 !! test
10083 Magic Word: prioritize type info over data-parsoid
10084 !! options
10085 parsoid=html2wt
10086 !! html/parsoid
10087 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10088 !! wikitext
10089 __FORCETOC__
10090 !! end
10091
10092 !! test
10093 Magic Word: serialize on separate line (parsoid)
10094 !! options
10095 parsoid=wt2wt,html2wt
10096 !! wikitext
10097 foo
10098 __NOTOC__
10099 bar
10100 !! html/parsoid
10101 foo<meta property="mw:PageProp/notoc"/>bar
10102 !! end
10103
10104 !! test
10105 Magic Word: rt non-english wikis
10106 !! options
10107 parsoid=wt2wt
10108 language=de
10109 !! wikitext
10110 __NOEDITSECTION__
10111 !! html/parsoid
10112 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10113 !! end
10114
10115 !!test
10116 __proto__ is treated as normal wikitext (T105997)
10117 !!wikitext
10118 __proto__
10119 !!html
10120 <p>__proto__
10121 </p>
10122 !!end
10123
10124 ###
10125 ### Magic links
10126 ###
10127 !! test
10128 Magic links: internal link to RFC (bug 479)
10129 !! wikitext
10130 [[RFC 123]]
10131 !! html/php
10132 <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>
10133 </p>
10134 !! html/parsoid
10135 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10136 !! end
10137
10138 !! test
10139 Magic links: RFC (bug 479)
10140 !! wikitext
10141 RFC 822
10142 !! html/php
10143 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10144 </p>
10145 !! html/parsoid
10146 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10147 !! end
10148
10149 !! test
10150 Magic links: RFC (bug 65278)
10151 !! wikitext
10152 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10153 !! html/php
10154 <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.
10155 </p>
10156 !! html/parsoid
10157 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10158 !! end
10159
10160 !! test
10161 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10162 !! wikitext
10163 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10164 RFC
10165 822
10166 !! html/php
10167 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10168 RFC
10169 822
10170 </p>
10171 !! html/parsoid
10172 <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>
10173 RFC
10174 822</p>
10175 !! end
10176
10177 !! test
10178 Magic links: ISBN (bug 1937)
10179 !! wikitext
10180 ISBN 0-306-40615-2
10181 !! html/php
10182 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10183 </p>
10184 !! html/parsoid
10185 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10186 !! end
10187
10188 !! test
10189 Magic links: ISBN (bug 65278)
10190 !! wikitext
10191 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10192 !! html/php
10193 <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.
10194 </p>
10195 !! html/parsoid
10196 <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>
10197 !! end
10198
10199 !! test
10200 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10201 !! wikitext
10202 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10203 ISBN
10204 9780316098113
10205 ISBN 978
10206 0316098113
10207 !! html/php
10208 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10209 ISBN
10210 9780316098113
10211 ISBN 978
10212 0316098113
10213 </p>
10214 !! html/parsoid
10215 <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>
10216 ISBN
10217 9780316098113
10218 ISBN 978
10219 0316098113</p>
10220 !! end
10221
10222 !! test
10223 Magic links: PMID incorrectly converts space to underscore
10224 !! wikitext
10225 PMID 1234
10226 !! html/php
10227 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10228 </p>
10229 !! html/parsoid
10230 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10231 !! end
10232
10233 !! test
10234 Magic links: PMID (bug 65278)
10235 !! wikitext
10236 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10237 !! html/php
10238 <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.
10239 </p>
10240 !! html/parsoid
10241 <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>
10242 !! end
10243
10244 !! test
10245 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10246 !! wikitext
10247 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10248 PMID
10249 1234
10250 !! html/php
10251 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10252 PMID
10253 1234
10254 </p>
10255 !! html/parsoid
10256 <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>
10257 PMID
10258 1234</p>
10259 !! end
10260
10261 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10262 # since these are ExtLinkText, not MagicLinkText
10263 !! test
10264 Magic links: use appropriate serialization for "almost" magic links.
10265 !! wikitext
10266 X[[Special:BookSources/0978739256|foo]]
10267
10268 X[//tools.ietf.org/html/rfc1234 foo]
10269 !! html/php
10270 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10271 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10272 </p>
10273 !! html/parsoid
10274 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10275 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10276 !! end
10277
10278 ###
10279 ### Templates
10280 ####
10281
10282 !! test
10283 Nonexistent template
10284 !! wikitext
10285 {{thistemplatedoesnotexist}}
10286 !! html
10287 <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>
10288 </p>
10289 !! end
10290
10291 !! test
10292 Template with invalid target containing tags
10293 !! wikitext
10294 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10295 !! html
10296 <p>{{a<b>b</b>|foo|a=b|a = b}}
10297 </p>
10298 !! end
10299
10300 !! test
10301 Template with invalid target containing unclosed tag
10302 !! wikitext
10303 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10304 !! html
10305 <p>{{a<b>|foo|a=b|a = b}}</b>
10306 </p>
10307 !! end
10308
10309 !! test
10310 Template with invalid target containing wikilink
10311 !! wikitext
10312 {{[[Main Page]]}}
10313 !! html/php
10314 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10315 </p>
10316 !! html/parsoid
10317 <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>
10318 !! end
10319
10320 !! test
10321 Template with just whitespace in it, bug #68421
10322 !! wikitext
10323 {{echo|{{ }}}}
10324 !! html/parsoid
10325 <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>
10326 !! end
10327
10328 !! article
10329 Template:test
10330 !! text
10331 This is a test template
10332 !! endarticle
10333
10334 !! test
10335 Simple template
10336 !! wikitext
10337 {{test}}
10338 !! html
10339 <p>This is a test template
10340 </p>
10341 !! end
10342
10343 !! test
10344 Template with explicit namespace
10345 !! wikitext
10346 {{Template:test}}
10347 !! html
10348 <p>This is a test template
10349 </p>
10350 !! end
10351
10352
10353 !! article
10354 Template:paramtest
10355 !! text
10356 This is a test template with parameter {{{param}}}
10357 !! endarticle
10358
10359 !! test
10360 Template parameter
10361 !! wikitext
10362 {{paramtest|param=foo}}
10363 !! html
10364 <p>This is a test template with parameter foo
10365 </p>
10366 !! end
10367
10368 !! article
10369 Template:paramtestnum
10370 !! text
10371 [[{{{1}}}|{{{2}}}]]
10372 !! endarticle
10373
10374 !! test
10375 Template unnamed parameter
10376 !! wikitext
10377 {{paramtestnum|Main Page|the main page}}
10378 !! html
10379 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10380 </p>
10381 !! end
10382
10383 !! article
10384 Template:templatesimple
10385 !! text
10386 (test)
10387 !! endarticle
10388
10389 !! article
10390 Template:templateredirect
10391 !! text
10392 #redirect [[Template:templatesimple]]
10393 !! endarticle
10394
10395 !! article
10396 Template:templateasargtestnum
10397 !! text
10398 {{{{{1}}}}}
10399 !! endarticle
10400
10401 !! article
10402 Template:templateasargtest
10403 !! text
10404 {{template{{{templ}}}}}
10405 !! endarticle
10406
10407 !! article
10408 Template:templateasargtest2
10409 !! text
10410 {{{{{templ}}}}}
10411 !! endarticle
10412
10413 !! test
10414 Template with template name as unnamed argument
10415 !! wikitext
10416 {{templateasargtestnum|templatesimple}}
10417 !! html
10418 <p>(test)
10419 </p>
10420 !! end
10421
10422 !! test
10423 Template with template name as argument
10424 !! wikitext
10425 {{templateasargtest|templ=simple}}
10426 !! html
10427 <p>(test)
10428 </p>
10429 !! end
10430
10431 !! test
10432 Template with template name as argument (2)
10433 !! wikitext
10434 {{templateasargtest2|templ=templatesimple}}
10435 !! html
10436 <p>(test)
10437 </p>
10438 !! end
10439
10440 !! article
10441 Template:templateasargtestdefault
10442 !! text
10443 {{{{{templ|templatesimple}}}}}
10444 !! endarticle
10445
10446 !! article
10447 Template:templa
10448 !! text
10449 '''templ'''
10450 !! endarticle
10451
10452 !! test
10453 Template with default value
10454 !! wikitext
10455 {{templateasargtestdefault}}
10456 !! html
10457 <p>(test)
10458 </p>
10459 !! end
10460
10461 !! test
10462 Template with default value (value set)
10463 !! wikitext
10464 {{templateasargtestdefault|templ=templa}}
10465 !! html
10466 <p><b>templ</b>
10467 </p>
10468 !! end
10469
10470 !! test
10471 Template redirect
10472 !! wikitext
10473 {{templateredirect}}
10474 !! html/php
10475 <p>(test)
10476 </p>
10477 !! html/parsoid
10478 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10479 !! end
10480
10481 !! test
10482 Template with argument in separate line
10483 !! wikitext
10484 {{ templateasargtest |
10485 templ = simple }}
10486 !! html
10487 <p>(test)
10488 </p>
10489 !! end
10490
10491 !! test
10492 Template with complex template as argument
10493 !! wikitext
10494 {{paramtest|
10495 param ={{ templateasargtest |
10496 templ = simple }}}}
10497 !! html
10498 <p>This is a test template with parameter (test)
10499 </p>
10500 !! end
10501
10502 !! test
10503 Template with thumb image (with link in description)
10504 !! wikitext
10505 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10506 !! html/php
10507 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>
10508
10509 !! html+tidy
10510 <p>This is a test template with parameter</p>
10511 <div class="thumb tright">
10512 <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>
10513 <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>
10514 </div>
10515 </div>
10516 !! html/parsoid
10517 <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>
10518 !! end
10519
10520 !! article
10521 Template:complextemplate
10522 !! text
10523 {{{1}}} {{paramtest|
10524 param ={{{param}}}}}
10525 !! endarticle
10526
10527 !! test
10528 Template with complex arguments
10529 !! wikitext
10530 {{complextemplate|
10531 param ={{ templateasargtest |
10532 templ = simple }}|[[Template:complextemplate|link]]}}
10533 !! html
10534 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10535 </p>
10536 !! end
10537
10538 !! test
10539 BUG 553: link with two variables in a piped link
10540 !! wikitext
10541 {|
10542 |[[{{{1}}}|{{{2}}}]]
10543 |}
10544 !! html/php
10545 <table>
10546 <tr>
10547 <td>[[{{{1}}}|{{{2}}}]]
10548 </td></tr></table>
10549
10550 !! html/parsoid
10551 <table>
10552 <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>
10553 !! end
10554
10555 # See: T2553
10556 !! test
10557 Abort table cell attribute parsing on wikilink
10558 !! wikitext
10559 {|
10560 | testing [[one|two]] | three || four
10561 | testing one two | three || four
10562 | testing="[[one|two]]" | three || four
10563 |}
10564 !! html/php
10565 <table>
10566 <tr>
10567 <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>
10568 <td> four
10569 </td>
10570 <td> three </td>
10571 <td> four
10572 </td>
10573 <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>
10574 <td> four
10575 </td></tr></table>
10576
10577 !! html/parsoid
10578 <table>
10579 <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>
10580 <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>
10581 <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>
10582 </tbody></table>
10583 !! end
10584
10585 !! test
10586 Don't abort table cell attribute parsing if wikilink is found in template arg
10587 !! wikitext
10588 {|
10589 | Test {{#tag:ref|One two "[[three]]" four}}
10590 |}
10591 !! html/parsoid
10592 <table>
10593 <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>
10594 </tbody></table>
10595 !! end
10596
10597 !! test
10598 Magic variable as template parameter
10599 !! wikitext
10600 {{paramtest|param={{SITENAME}}}}
10601 !! html
10602 <p>This is a test template with parameter MediaWiki
10603 </p>
10604 !! end
10605
10606 !! article
10607 Template:linktest
10608 !! text
10609 [[{{{param}}}|link]]
10610 !! endarticle
10611
10612 !! test
10613 Template parameter as link source
10614 !! wikitext
10615 {{linktest|param=Main Page}}
10616 !! html
10617 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10618 </p>
10619 !! end
10620
10621 !!article
10622 Template:paramtest2
10623 !! text
10624 including another template, {{paramtest|param={{{arg}}}}}
10625 !! endarticle
10626
10627 !! test
10628 Template passing argument to another template
10629 !! wikitext
10630 {{paramtest2|arg='hmm'}}
10631 !! html
10632 <p>including another template, This is a test template with parameter 'hmm'
10633 </p>
10634 !! end
10635
10636 !! article
10637 Template:Linktest2
10638 !! text
10639 Main Page
10640 !! endarticle
10641
10642 !! test
10643 Template as link source
10644 !! wikitext
10645 [[{{linktest2}}]]
10646
10647 [[{{linktest2}}|Main Page]]
10648
10649 [[{{linktest2}}]]Page
10650 !! html
10651 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10652 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10653 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10654 </p>
10655 !! end
10656
10657
10658 !! article
10659 Template:loop1
10660 !! text
10661 {{loop2}}
10662 !! endarticle
10663
10664 !! article
10665 Template:loop2
10666 !! text
10667 {{loop1}}
10668 !! endarticle
10669
10670 !! test
10671 Template infinite loop
10672 !! wikitext
10673 {{loop1}}
10674 !! html
10675 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10676 </p>
10677 !! end
10678
10679 !! test
10680 Template from main namespace
10681 !! wikitext
10682 {{:Main Page}}
10683 !! html
10684 <p>blah blah
10685 </p>
10686 !! end
10687
10688 !! article
10689 Template:table
10690 !! text
10691 {|
10692 | 1 || 2
10693 |-
10694 | 3 || 4
10695 |}
10696 !! endarticle
10697
10698 !! test
10699 BUG 529: Template with table, not included at beginning of line
10700 !! wikitext
10701 foo {{table}}
10702 !! html
10703 <p>foo
10704 </p>
10705 <table>
10706 <tr>
10707 <td> 1 </td>
10708 <td> 2
10709 </td></tr>
10710 <tr>
10711 <td> 3 </td>
10712 <td> 4
10713 </td></tr></table>
10714
10715 !! end
10716
10717 !! test
10718 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10719 !! wikitext
10720 foo
10721 {{table}}
10722 !! html
10723 <p>foo
10724 </p>
10725 <table>
10726 <tr>
10727 <td> 1 </td>
10728 <td> 2
10729 </td></tr>
10730 <tr>
10731 <td> 3 </td>
10732 <td> 4
10733 </td></tr></table>
10734
10735 !! end
10736
10737 !! test
10738 BUG 41: Template parameters shown as broken links
10739 !! wikitext
10740 {{{parameter}}}
10741 !! html
10742 <p>{{{parameter}}}
10743 </p>
10744 !! end
10745
10746 !! test
10747 Template with targets containing wikilinks
10748 !! wikitext
10749 {{[[foo]]}}
10750
10751 {{[[{{echo|foo}}]]}}
10752
10753 {{{{echo|[[foo}}]]}}
10754 !! html
10755 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10756 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10757 </p><p>{{[[foo}}]]
10758 </p>
10759 !! end
10760
10761 !! article
10762 Template:''
10763 !! text
10764 bar
10765 !! endarticle
10766
10767 !! test
10768 Templates: Double quotes as template target
10769 !! wikitext
10770 foo {{''}} baz
10771 !! html/php
10772 <p>foo bar baz
10773 </p>
10774 !! html/parsoid
10775 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10776 </p>
10777 !! end
10778
10779 ## This test is about making sure Parsoid's data-mw is well formed in the
10780 ## face of multiple templates with intersecting and overlapping ranges. The
10781 ## wikitext itself is wretched.
10782 !! test
10783 Templates with intersecting and overlapping ranges
10784 !! wikitext
10785 {|{{echo|
10786 <p>ha</p>}}
10787 {|{{echo|
10788 <p>ho</p>}}
10789 {{echo|{{!}}hi}}
10790 |}
10791 !! html/php+tidy
10792 <p>ha</p>
10793 <p>ho</p>
10794 <table>
10795 <tr>
10796 <td></td>
10797 </tr>
10798 <tr>
10799 <td>hi</td>
10800 </tr>
10801 </table>
10802 <table>
10803 <tr>
10804 <td></td>
10805 </tr>
10806 </table>
10807 !! html/parsoid
10808 <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":""}]]}'>
10809
10810 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10811
10812 <tbody><tr><td>hi</td></tr>
10813 </tbody></table>
10814 !! end
10815
10816 !! article
10817 Template:MSGNW test
10818 !! text
10819 ''None'' of '''this''' should be
10820 * interpreted
10821 but rather passed unmodified
10822 {{test}}
10823 <gallery>
10824 File:Foobar.jpg
10825 </gallery>
10826 <!-- comment -->
10827 !! endarticle
10828
10829 # hmm, fix this or just deprecate msgnw and document its behavior?
10830 !! test
10831 msgnw keyword
10832 !! wikitext
10833 {{msgnw:MSGNW test}}
10834 !! html/php
10835 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10836 &#42; interpreted
10837 &#32;but rather passed unmodified
10838 &#123;&#123;test&#125;&#125;
10839 &#60;gallery&#62;
10840 File:Foobar.jpg
10841 &#60;/gallery&#62;
10842 &#60;!-- comment --&#62;
10843 </p>
10844 !! end
10845
10846 !! test
10847 int keyword
10848 !! wikitext
10849 {{int:youhavenewmessages|lots of money|not!}}
10850 !! html
10851 <p>You have lots of money (not!).
10852 </p>
10853 !! end
10854
10855 !! test
10856 int keyword - non-existing message
10857 !! wikitext
10858 {{int:var}}
10859 !! html
10860 <p>&lt;var&gt;
10861 </p>
10862 !! end
10863
10864 !! article
10865 Template:Includes
10866 !! text
10867 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10868 !! endarticle
10869
10870 !! test
10871 <includeonly> and <noinclude> being included
10872 !! wikitext
10873 {{Includes}}
10874 !! html
10875 <p>Foobar
10876 </p>
10877 !! end
10878
10879 !! article
10880 Template:Includes2
10881 !! text
10882 <onlyinclude>Foo</onlyinclude>bar
10883 !! endarticle
10884
10885 !! test
10886 <onlyinclude> being included
10887 !! wikitext
10888 {{Includes2}}
10889 !! html
10890 <p>Foo
10891 </p>
10892 !! end
10893
10894
10895 !! article
10896 Template:Includes3
10897 !! text
10898 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10899 !! endarticle
10900
10901 !! test
10902 <onlyinclude> and <includeonly> being included
10903 !! wikitext
10904 {{Includes3}}
10905 !! html
10906 <p>Foo
10907 </p>
10908 !! end
10909
10910 !! test
10911 <includeonly> and <noinclude> on a page
10912 !! wikitext
10913 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10914 !! html
10915 <p>Foozar
10916 </p>
10917 !! end
10918
10919 !! test
10920 Un-closed <noinclude>
10921 !! wikitext
10922 <noinclude>
10923 !! html
10924 !! end
10925
10926 !! test
10927 <onlyinclude> on a page
10928 !! wikitext
10929 <onlyinclude>Foo</onlyinclude>bar
10930 !! html
10931 <p>Foobar
10932 </p>
10933 !! end
10934
10935 !! test
10936 Un-closed <onlyinclude>
10937 !! wikitext
10938 <onlyinclude>
10939 !! html
10940 !! end
10941
10942 !!test
10943 Self-closed noinclude, includeonly, onlyinclude tags
10944 !! wikitext
10945 <noinclude />
10946 <includeonly />
10947 <onlyinclude />
10948 !! html
10949 <p><br />
10950 </p>
10951 !!end
10952
10953 !!test
10954 Unbalanced includeonly and noinclude tags
10955 !! wikitext
10956 {|
10957 |a</noinclude>
10958 |b</noinclude></noinclude>
10959 |c</noinclude></includeonly>
10960 |d</includeonly></includeonly>
10961 |}
10962 !! html
10963 <table>
10964 <tr>
10965 <td>a
10966 </td>
10967 <td>b
10968 </td>
10969 <td>c&lt;/includeonly&gt;
10970 </td>
10971 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10972 </td></tr></table>
10973
10974 !!end
10975
10976 !! article
10977 Template:Includeonly section
10978 !! text
10979 <includeonly>
10980 ==Includeonly section==
10981 </includeonly>
10982 ==Section T-1==
10983 !!endarticle
10984
10985 !! test
10986 Bug 6563: Edit link generation for section shown by <includeonly>
10987 !! wikitext
10988 {{includeonly section}}
10989 !! html
10990 <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>
10991 <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>
10992
10993 !! end
10994
10995 # Uses same input as the contents of [[Template:Includeonly section]]
10996 !! test
10997 Bug 6563: Section extraction for section shown by <includeonly>
10998 !! options
10999 section=T-2
11000 !! wikitext
11001 <includeonly>
11002 ==Includeonly section==
11003 </includeonly>
11004 ==Section T-2==
11005 !! html
11006 ==Section T-2==
11007 !! end
11008
11009 !! test
11010 Bug 6563: Edit link generation for section suppressed by <includeonly>
11011 !! wikitext
11012 <includeonly>
11013 ==Includeonly section==
11014 </includeonly>
11015 ==Section 1==
11016 !! html
11017 <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>
11018
11019 !! end
11020
11021 !! test
11022 Bug 6563: Section extraction for section suppressed by <includeonly>
11023 !! options
11024 section=1
11025 !! wikitext
11026 <includeonly>
11027 ==Includeonly section==
11028 </includeonly>
11029 ==Section 1==
11030 !! html
11031 ==Section 1==
11032 !! end
11033
11034 !! test
11035 Un-closed <includeonly>
11036 !! wikitext
11037 <includeonly>
11038 !! html/php
11039 !! html/parsoid
11040 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11041 !! end
11042
11043 ## We used to, but no longer wt2wt this test since the default serializer
11044 ## will normalize the include directives to serialize on their own line.
11045 ## Selser will take care of preserving formatting in scenarios where they
11046 ## intermingled with other wikitext.
11047 !! test
11048 Includes and comments at SOL
11049 !! options
11050 parsoid=wt2html,html2html
11051 !! wikitext
11052 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11053
11054 <noinclude>
11055 some
11056 </noinclude>* stuff
11057 * here
11058
11059 <includeonly>can have stuff</includeonly>=== here ===
11060
11061 !! html/php
11062 <h2><span class="mw-headline" id="hu">hu</span></h2>
11063 <p>some
11064 </p>
11065 <ul><li> stuff</li>
11066 <li> here</li></ul>
11067 <h3><span class="mw-headline" id="here">here</span></h3>
11068
11069 !! html/parsoid
11070 <!-- 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>
11071
11072 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11073 <p>some</p>
11074 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11075 <li> here</li></ul>
11076
11077 <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>
11078
11079 !! end
11080
11081 # TODO: test with DOM fragment reuse!
11082 !! test
11083 Parsoid: DOM fragment reuse
11084 !! options
11085 parsoid=wt2wt,wt2html
11086 !! wikitext
11087 a{{echo|b<table></table>c}}d
11088
11089 a{{echo|b
11090 <table></table>
11091 c}}d
11092
11093 {{echo|a
11094
11095 <table></table>
11096
11097 b}}
11098 !! html
11099 <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>
11100
11101 <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">
11102 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11103 </span><p about="#mwt2">cd</p>
11104
11105 <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">
11106
11107 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11108
11109 </span><p about="#mwt3">b</p>
11110 !! end
11111
11112 !! test
11113 Parsoid: Merge double tds (T52603)
11114 !! options
11115 parsoid
11116 !! wikitext
11117 {|
11118 |{{echo|{{!}} foo}}
11119 |}
11120 !! html
11121 <table><tbody>
11122 <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>
11123 </tbody></table>
11124 !! end
11125
11126 !! test
11127 Parsoid: Merge double tds in nested transclusion content (T52603)
11128 !! options
11129 parsoid
11130 !! wikitext
11131 {{echo|<div>}}
11132 {|
11133 |{{echo|{{!}} foo}}
11134 |}
11135 {{echo|</div>}}
11136 !! html
11137 <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}}]}'>
11138 <table><tbody>
11139 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11140 </tbody></table>
11141 </div>
11142 !! end
11143
11144 ###
11145 ### <includeonly> and <noinclude> in attributes
11146 ###
11147 !!test
11148 0. includeonly around the entire attribute
11149 !! wikitext
11150 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11151 !! html
11152 <p><span id="v2">bar</span>
11153 </p>
11154 !!end
11155
11156 !!test
11157 1. includeonly in html attr key
11158 !! wikitext
11159 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11160 !! html
11161 <p><span id="foo">bar</span>
11162 </p>
11163 !!end
11164
11165 !!test
11166 2. includeonly in html attr value
11167 !! wikitext
11168 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11169 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11170 !! html
11171 <p><span id="v1">bar</span>
11172 <span id="v1">bar</span>
11173 </p>
11174 !!end
11175
11176 !!test
11177 3. includeonly in part of an attr value
11178 !! wikitext
11179 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11180 !! html
11181 <p><span style="color:red;">bar</span>
11182 </p>
11183 !!end
11184
11185 !!test
11186 4. includeonly in table attributes
11187 !! wikitext
11188 {|
11189 |- <noinclude>
11190 |-
11191 |a
11192 </noinclude>
11193 |- <includeonly>
11194 |-
11195 |b
11196 </includeonly>
11197 |}
11198 !! html
11199 <table>
11200
11201
11202 <tr>
11203 <td>a
11204 </td></tr>
11205 </table>
11206
11207 !!end
11208
11209 ###
11210 ### Token Stream Patcher tests
11211 ###
11212 ### These tests won't always pass wt2wt and other modes because
11213 ### on serialization, the table will be output on a new line.
11214 ### For now, we are blacklisting them, and using this to test selser.
11215 ###
11216
11217 !!test
11218 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11219 !!options
11220 parsoid=wt2html,wt2wt
11221 !!wikitext
11222 {{echo|}}{| width = '100%'
11223 |foo
11224 |}
11225 !!html/parsoid
11226 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11227 <tbody><tr><td>foo</td></tr>
11228 </tbody></table>
11229 !!end
11230
11231 ## We used to, but no longer wt2wt this test since the default serializer
11232 ## will normalize the include directives to serialize on their own line.
11233 ## Selser will take care of preserving formatting in scenarios where they
11234 ## intermingled with other wikitext.
11235 !!test
11236 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11237 !!options
11238 parsoid=wt2html
11239 !!wikitext
11240 <includeonly>a</includeonly>{| {{{b}}}
11241 |c
11242 |}
11243 !!html/parsoid
11244 <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":""}]]}'>
11245 <tbody><tr><td>c</td></tr>
11246 </tbody></table>
11247 !!end
11248
11249 ###
11250 ### Testing parsing of templates where a template arg
11251 ### has the same name as the template itself.
11252 ###
11253
11254 !! article
11255 Template:quote
11256 !! text
11257 {{{quote|{{{1}}}}}}
11258 !! endarticle
11259
11260 !!test
11261 Templates: Template Name/Arg clash: 1. Use of positional param
11262 !! wikitext
11263 {{quote|foo}}
11264 !! html
11265 <p>foo
11266 </p>
11267 !!end
11268
11269 !!test
11270 Templates: Template Name/Arg clash: 2. Use of named param
11271 !! wikitext
11272 {{quote|quote=foo}}
11273 !! html
11274 <p>foo
11275 </p>
11276 !!end
11277
11278 !!test
11279 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11280 !! wikitext
11281 {{quote|quote}}
11282 !! html
11283 <p>quote
11284 </p>
11285 !!end
11286
11287 ###
11288 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11289 ###
11290
11291 !!test
11292 Templates: 1. Simple use
11293 !! wikitext
11294 {{echo|Foo}}
11295 !! html
11296 <p>Foo
11297 </p>
11298 !!end
11299
11300 !!test
11301 Templates: 2. Inside a block tag
11302 !! wikitext
11303 <div>{{echo|Foo}}</div>
11304 <blockquote>{{echo|Foo}}</blockquote>
11305 !! html
11306 <div>Foo</div>
11307 <blockquote>Foo</blockquote>
11308
11309 !! html+tidy
11310 <div>Foo</div>
11311 <blockquote>
11312 <p>Foo</p>
11313 </blockquote>
11314 !!end
11315
11316 !!test
11317 Templates: P-wrapping: 1a. Templates on consecutive lines
11318 !! wikitext
11319 {{echo|Foo}}
11320 {{echo|bar}}
11321 !! html
11322 <p>Foo
11323 bar
11324 </p>
11325 !!end
11326
11327 !!test
11328 Templates: P-wrapping: 1b. Templates on consecutive lines
11329 !! wikitext
11330 Foo
11331
11332 {{echo|bar}}
11333 {{echo|baz}}
11334 !! html
11335 <p>Foo
11336 </p><p>bar
11337 baz
11338 </p>
11339 !!end
11340
11341 !!test
11342 Templates: P-wrapping: 1c. Templates on consecutive lines
11343 !! wikitext
11344 {{echo|Foo}}
11345 {{echo|bar}} <div>baz</div>
11346 !! html
11347 <p>Foo
11348 </p>
11349 bar <div>baz</div>
11350
11351 !! html+tidy
11352 <p>Foo</p>
11353 <p>bar</p>
11354 <div>baz</div>
11355 !! end
11356
11357 !!test
11358 Templates: P-wrapping: 1d. Template preceded by comment-only line
11359 !!options
11360 parsoid
11361 !! wikitext
11362 <!-- foo -->
11363 {{echo|Bar}}
11364 !! html
11365 <!-- foo -->
11366
11367 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11368 !!end
11369
11370 !!test
11371 Templates: Inline Text: 1. Multiple template uses
11372 !! wikitext
11373 {{echo|Foo}}bar{{echo|baz}}
11374 !! html
11375 <p>Foobarbaz
11376 </p>
11377 !!end
11378
11379 !!test
11380 Templates: Inline Text: 2. Back-to-back template uses
11381 !! wikitext
11382 {{echo|Foo}}{{echo|bar}}
11383 !! html
11384 <p>Foobar
11385 </p>
11386 !!end
11387
11388 !!test
11389 Templates: Block Tags: 1. Multiple template uses
11390 !! wikitext
11391 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11392 !! html
11393 <div>Foo</div><div>bar</div><div>baz</div>
11394
11395 !!end
11396
11397 !!test
11398 Templates: Block Tags: 2. Back-to-back template uses
11399 !! wikitext
11400 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11401 !! html
11402 <div>Foo</div><div>bar</div>
11403
11404 !!end
11405
11406 # This is an edge case relating to paragraph wrapping.
11407 !!test
11408 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11409 !! wikitext
11410 {{echo|a
11411 b</p>}}
11412 !! html/parsoid
11413 <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
11414 b</p>
11415 !!end
11416
11417 !!test
11418 Templates: Links: 1. Simple example
11419 !! wikitext
11420 {{echo|[[Foo|bar]]}}
11421 !! html
11422 <p><a href="/wiki/Foo" title="Foo">bar</a>
11423 </p>
11424 !!end
11425
11426 !!test
11427 Templates: Links: 2. Generation of link href
11428 !! wikitext
11429 [[{{echo|Foo}}|bar]]
11430 !! html
11431 <p><a href="/wiki/Foo" title="Foo">bar</a>
11432 </p>
11433 !!end
11434
11435 !!test
11436 Templates: Links: 3. Generation of part of a link href
11437 !! wikitext
11438 [[Fo{{echo|o}}|bar]]
11439
11440 [[Foo{{echo|bar}}]]
11441
11442 [[Foo{{echo|bar}}baz]]
11443
11444 [[Foo{{echo|bar}}|bar]]
11445
11446 [[:Foo{{echo|bar}}]]
11447
11448 [[:Foo{{echo|bar}}|bar]]
11449 !! html
11450 <p><a href="/wiki/Foo" title="Foo">bar</a>
11451 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11452 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11453 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11454 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11455 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11456 </p>
11457 !!end
11458
11459 !!test
11460 Templates: Links: 4. Multiple templates generating link href
11461 !! wikitext
11462 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11463 !! html
11464 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11465 </p>
11466 !!end
11467
11468 !!test
11469 Templates: Links: 5. Generation of link text
11470 !! wikitext
11471 [[Foo|{{echo|bar}}]]
11472 !! html
11473 <p><a href="/wiki/Foo" title="Foo">bar</a>
11474 </p>
11475 !!end
11476
11477 !!test
11478 Templates: Links: 5. Nested templates (only outermost template should be marked)
11479 !! wikitext
11480 {{echo|[[{{echo|Foo}}|bar]]}}
11481 !! html
11482 <p><a href="/wiki/Foo" title="Foo">bar</a>
11483 </p>
11484 !!end
11485
11486 !!test
11487 Templates: HTML Tag: 1. Generation of HTML attr. key
11488 !! wikitext
11489 <div {{echo|style}}="color:red;">foo</div>
11490 !! html
11491 <div style="color:red;">foo</div>
11492
11493 !!end
11494
11495 !!test
11496 Templates: HTML Tag: 2. Generation of HTML attr. value
11497 !! wikitext
11498 <div style={{echo|'color:red;'}}>foo</div>
11499 !! html
11500 <div style="color:red;">foo</div>
11501
11502 !!end
11503
11504 !!test
11505 Templates: HTML Tag: 3. Generation of HTML attr key and value
11506 !! wikitext
11507 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11508 !! html
11509 <div style="color:red;">foo</div>
11510
11511 !!end
11512
11513 !!test
11514 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11515 !! wikitext
11516 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11517 !! html
11518 <div title="This is a long title with just one piece templated">foo</div>
11519
11520 !!end
11521
11522 !!test
11523 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11524 !! wikitext
11525 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11526 !! html
11527 <div title="This is a long title with just one piece templated">foo</div>
11528
11529 !!end
11530
11531 !!test
11532 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11533 !! wikitext
11534 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11535 !! html
11536 <div title="This is a long title with just one piece templated">foo</div>
11537
11538 !!end
11539
11540 # SSS FIXME: While it is great we added support for all this,
11541 # do we want to make this part of the spec? Maybe we want to
11542 # deprecate this kind of usage in the future?
11543 !!test
11544 Templates: HTML Tag: 7. Generation of partial attribute key string
11545 !! wikitext
11546 <div st{{echo|yle}}="color:red;">foo</div>
11547 !! html
11548 <div style="color:red;">foo</div>
11549
11550 !!end
11551
11552 !! test
11553 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11554 !! wikitext
11555 <div {{echo|1=id="v1"}}>bar</div>
11556 !! html
11557 <div id="v1">bar</div>
11558
11559 !!end
11560
11561 !! test
11562 Templates: HTML Tag: 9. Multiple template-generated attributes
11563 !! wikitext
11564 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11565 !! html
11566 <div id="v1" title="foo">bar</div>
11567
11568 !!end
11569
11570 !! test
11571 Templates: Support for templates generating attributes and content
11572 !! wikitext
11573 {| {{mixed_attr_content_template}}
11574 |-
11575 |bar
11576 |}
11577 !! html/php
11578 <table style="color:red;" title="T48811">
11579
11580 <tr>
11581 <td>foo
11582 </td></tr>
11583 <tr>
11584 <td>bar
11585 </td></tr></table>
11586
11587 !! html/parsoid
11588 <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|}"]}'>
11589 <tbody><tr>
11590 <td>foo</td></tr>
11591 <tr>
11592 <td>bar</td></tr>
11593 </tbody></table>
11594 !!end
11595
11596 !! test
11597 1. Entities and nowikis inside templated attributes should be handled correctly
11598 !! wikitext
11599 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11600 !! html/php
11601 <div style="background:#f9f9f9;">foo</div>
11602
11603 !! html/parsoid
11604 <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>
11605 !! end
11606
11607 !! test
11608 2. Entities and nowikis inside templated attributes should be handled correctly
11609 !! wikitext
11610 {|
11611 |{{table_attribs_3}}
11612 |}
11613 !! html/php
11614 <table>
11615 <tr>
11616 <td style="background:#f9f9f9;">Foo
11617 </td></tr></table>
11618
11619 !! html/parsoid
11620 <table>
11621 <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>
11622 </tbody></table>
11623 !! end
11624
11625 !! test
11626 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11627 !! wikitext
11628 {{tbl-start}}
11629 |{{table_attribs_3}}
11630 {{tbl-end}}
11631 !! html/php
11632 <table>
11633 <tr>
11634 <td style="background:#f9f9f9;">Foo
11635 </td></tr></table>
11636
11637 !! html/parsoid
11638 <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}}]}'>
11639 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11640 </tbody></table>
11641 !! end
11642
11643 # T107622
11644 !! test
11645 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11646 !! wikitext
11647 {|
11648 | {{table_attribs_6}} hi
11649 |}
11650 !! html/php
11651 <table>
11652 <tr>
11653 <td style="background: red;"> hi
11654 </td></tr></table>
11655
11656 !! html/parsoid
11657 <table>
11658 <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>
11659 </tbody></table>
11660 !! end
11661
11662 !!test
11663 Templates: HTML Tables: 1. Generating start of a HTML table
11664 !! wikitext
11665 {{echo|<table><tr><td>foo</td>}}</tr></table>
11666 !! html
11667 <table><tr><td>foo</td></tr></table>
11668
11669 !!end
11670
11671 !!test
11672 Templates: HTML Tables: 2a. Generating middle of a HTML table
11673 !! wikitext
11674 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11675 !! html
11676 <table><tr><td>foo</td></tr></table>
11677
11678 !!end
11679
11680 !!test
11681 Templates: HTML Tables: 2b. Generating middle of a HTML table
11682 !! wikitext
11683 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11684 !! html
11685 <table><tr><td>foo</td></tr></table>
11686
11687 !!end
11688
11689 !!test
11690 Templates: HTML Tables: 3. Generating end of a HTML table
11691 !! wikitext
11692 <table><tr>{{echo|<td>foo</td></tr></table>}}
11693 !! html
11694 <table><tr><td>foo</td></tr></table>
11695
11696 !!end
11697
11698 !!test
11699 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11700 !! wikitext
11701 {{echo|<table>}}<tr><td>foo</td></tr></table>
11702 !! html
11703 <table><tr><td>foo</td></tr></table>
11704
11705 !!end
11706
11707 !!test
11708 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11709 !! wikitext
11710 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11711 !! html
11712 <table><tr><td>foo</td></tr></table>
11713
11714 !!end
11715
11716 !!test
11717 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11718 !! wikitext
11719 <table><tr>{{echo|<td>}}foo</td></tr></table>
11720 !! html
11721 <table><tr><td>foo</td></tr></table>
11722
11723 !!end
11724
11725 !!test
11726 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11727 !! wikitext
11728 <table><tr><td>foo{{echo|</td>}}</tr></table>
11729 !! html
11730 <table><tr><td>foo</td></tr></table>
11731
11732 !!end
11733
11734 !!test
11735 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11736 !! wikitext
11737 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11738 !! html
11739 <table><tr><td>foo</td></tr></table>
11740
11741 !!end
11742
11743 !!test
11744 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11745 !! wikitext
11746 <table><tr><td>foo</td></tr>{{echo|</table>}}
11747 !! html
11748 <table><tr><td>foo</td></tr></table>
11749
11750 !!end
11751
11752 !!test
11753 Templates: HTML Tables: 5. Proper fostering of categories from inside
11754 !!options
11755 parsoid=wt2html,wt2wt
11756 !! wikitext
11757 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11758 <!--Two categories (Bug 50330)-->
11759 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11760 !! html
11761 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11762 <!--Two categories (Bug 50330)-->
11763 <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>
11764 !!end
11765
11766 !!test
11767 Templates: Wiki Tables: 1a. Fostering of entire template content
11768 !! wikitext
11769 {|
11770 {{echo|a}}
11771 |}
11772 !! html
11773 <table>
11774 a
11775 <tr><td></td></tr></table>
11776
11777 !! html+tidy
11778 <p>a</p>
11779 <table>
11780 <tr>
11781 <td></td>
11782 </tr>
11783 </table>
11784 !! end
11785
11786 !!test
11787 Templates: Wiki Tables: 1b. Fostering of entire template content
11788 !! wikitext
11789 {|
11790 {{echo|<div>}}
11791 foo
11792 {{echo|</div>}}
11793 |}
11794 !! html
11795 <table>
11796 <div>
11797 <p>foo
11798 </p>
11799 </div>
11800 <tr><td></td></tr></table>
11801
11802 !! html+tidy
11803 <div>
11804 <p>foo</p>
11805 </div>
11806 <table>
11807 <tr>
11808 <td></td>
11809 </tr>
11810 </table>
11811 !! end
11812
11813 !!test
11814 Templates: Wiki Tables: 2. Fostering of partial template content
11815 !! wikitext
11816 {|
11817 {{echo|a
11818 <div>b</div>}}
11819 |}
11820 !! html
11821 <table>
11822 a
11823 <div>b</div>
11824 <tr><td></td></tr></table>
11825
11826 !! html+tidy
11827 <p>a</p>
11828 <div>b</div>
11829 <table>
11830 <tr>
11831 <td></td>
11832 </tr>
11833 </table>
11834 !! end
11835
11836 !!test
11837 Templates: Wiki Tables: 3. td-content via multiple templates
11838 !! wikitext
11839 {|
11840 {{echo|{{pipe}}a}}{{echo|b}}
11841 |}
11842 !! html
11843 <table>
11844 <tr>
11845 <td>ab
11846 </td></tr></table>
11847
11848 !!end
11849
11850 !!test
11851 Templates: Wiki Tables: 4. Templated tags, no content
11852 !! wikitext
11853 {{tbl-start}}
11854 {{tbl-end}}
11855 !! html
11856 <table>
11857 <tr><td></td></tr></table>
11858
11859 !!end
11860
11861 !!test
11862 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11863 !! wikitext
11864 {{tbl-start}}
11865 |foo
11866 {{tbl-end}}
11867 !! html
11868 <table>
11869 <tr>
11870 <td>foo
11871 </td></tr></table>
11872
11873 !!end
11874
11875 !!test
11876 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11877 !! wikitext
11878 {{tbl-start}}
11879 {{!}}foo
11880 {{tbl-end}}
11881 !! html
11882 <table>
11883 <tr>
11884 <td>foo
11885 </td></tr></table>
11886
11887 !!end
11888
11889 ## This test case is very specific to Parsoid's internals
11890 ## and is hence only tested for Parsoid's code. Parsoid uses
11891 ## a <meta> marker tag for <ref> tags and they are expanded
11892 ## much later. We are verifying that this <meta> tag usage
11893 ## doesn't prevent foster parenting.
11894 !!test
11895 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11896 !!wikitext
11897 {{PartialTable}}<ref>foo</ref>
11898 |}
11899
11900 <references />
11901 !!html/parsoid
11902 <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">
11903 <tbody>
11904 </tbody></table>
11905
11906 <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>
11907 !!end
11908
11909 !! test
11910 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11911 !! wikitext
11912 {{echo|
11913 {{{!}}
11914 {{!}}-}}
11915 <onlyinclude>
11916 |foo
11917 </onlyinclude>
11918 {{!}}}
11919 !! html/parsoid
11920 <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{{!}}}"]}'>
11921 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11922 <tbody><tr>
11923
11924 <td>foo
11925 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11926 </tbody></table>
11927 !! end
11928
11929 !!test
11930 Templates: Lists: Multi-line list-items via templates
11931 !! wikitext
11932 *{{echo|a {{nonexistent|
11933 unused}}}}
11934 *{{echo|b {{nonexistent|
11935 unused}}}}
11936 !! html
11937 <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>
11938 <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>
11939
11940 !!end
11941
11942 !!test
11943 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11944 !! wikitext
11945 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11946 !! html
11947 <p><i>ab</i>c<i>d</i>e
11948 </p>
11949 !!end
11950
11951 !!test
11952 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11953 (PHP parser generates misnested html)
11954 !! wikitext
11955 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11956 !! html/parsoid
11957 <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>
11958 !!end
11959
11960 !!test
11961 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11962 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11963 !! options
11964 parsoid=wt2html,wt2wt
11965 !! wikitext
11966 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11967 !! html
11968 <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>
11969 <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>
11970 <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>
11971 !!end
11972
11973 !!test
11974 Templates: Ugly nesting: 4. Divs opened/closed across templates
11975 !! wikitext
11976 a<div>b{{echo|c</div>d}}e
11977 !! html
11978 a<div>bc</div>de
11979
11980 !! html+tidy
11981 <p>a</p>
11982 <div>bc</div>
11983 <p>de</p>
11984 !! end
11985
11986 !!test
11987 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11988 (Parsoid-centric)
11989 !! options
11990 parsoid
11991 !! wikitext
11992 {|
11993 |{{echo|foo</table>}}
11994 |bar
11995 |}
11996 !! html
11997 <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|}"]}'>
11998
11999 <tbody>
12000 <tr>
12001 <td>foo</td></tr></tbody></table><span about="#mwt1">
12002 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12003 |}</span>
12004 !!end
12005
12006 !!test
12007 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12008 (Parsoid-centric)
12009 !! options
12010 parsoid
12011 !! wikitext
12012 <table>
12013 <tr>
12014 <td>
12015 <table>
12016 <tr>
12017 <td>1. {{echo|foo </table>}}</td>
12018 <td> bar </td>
12019 <td>2. {{echo|baz </table>}}</td>
12020 </tr>
12021 <tr>
12022 <td>abc</td>
12023 </tr>
12024 </table>
12025 </td>
12026 </tr>
12027 <tr>
12028 <td>xyz</td>
12029 </tr>
12030 </table>
12031 !! html
12032 <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>"]}'>
12033 <tbody><tr>
12034 <td>
12035 <table>
12036 <tbody><tr>
12037 <td>1. foo </td></tr></tbody></table></td>
12038 <td> bar </td>
12039 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12040 </span><span about="#mwt2">
12041 </span><span about="#mwt2">
12042 </span><span about="#mwt2">abc</span><span about="#mwt2">
12043 </span><span about="#mwt2">
12044 </span><span about="#mwt2">
12045 </span><span about="#mwt2">
12046 </span><span about="#mwt2">
12047 </span><span about="#mwt2">
12048 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12049 </span><span about="#mwt2">
12050 </span>
12051 !!end
12052
12053 !! test
12054 Templates: Ugly templates: 3. newline-only template parameter
12055 !! wikitext
12056 foo {{echo|
12057 }}
12058 !! html
12059 <p>foo
12060 </p>
12061 !! end
12062
12063 # This looks like a bug: a single newline triggers p/br for some reason.
12064 !! test
12065 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12066 !! wikitext
12067 {{echo|
12068 }}
12069 !! html
12070 <p><br />
12071 </p>
12072 !! end
12073
12074 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12075 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12076 !! test
12077 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12078 !! wikitext
12079 {{echo|<table>}}
12080 {{echo|<div>foo}}
12081 {{echo|</table>}}
12082 !! html/parsoid
12083 <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
12084 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12085 </table>
12086 !! end
12087
12088 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12089 # that are "identical" and generate nesting cycles in the algorithm
12090 !! test
12091 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12092 !! wikitext
12093 {{echo|<table><tr><td><table>}}
12094 {{echo|<div>}}
12095 {{echo|</div>}}
12096 !! html/parsoid
12097 <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"}'>
12098 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12099 </table></td></tr></tbody></table>
12100 !! end
12101
12102 !! test
12103 Templates: Parameters substituted at the top-level
12104 !! wikitext
12105 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12106 !! html/php
12107 <p><i>who</i> me? <b>never!</b>
12108 </p>
12109 !! html/parsoid
12110 <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>
12111 !! end
12112
12113 !!test
12114 Parser Functions: 1. Simple example
12115 !! wikitext
12116 {{uc:foo}}
12117 !! html
12118 <p>FOO
12119 </p>
12120 !!end
12121
12122 !!test
12123 Parser Functions: 2. Nested use (only outermost should be marked up)
12124 !! wikitext
12125 {{uc:{{lc:FOO}}}}
12126 !! html
12127 <p>FOO
12128 </p>
12129 !!end
12130
12131 ###
12132 ### Pre-save transform tests
12133 ###
12134 !! test
12135 pre-save transform: subst:
12136 !! options
12137 pst
12138 !! wikitext
12139 {{subst:test}}
12140 !! html/php
12141 This is a test template
12142 !! end
12143
12144 !! test
12145 pre-save transform: normal template
12146 !! options
12147 pst
12148 !! wikitext
12149 {{test}}
12150 !! html/php
12151 {{test}}
12152 !! end
12153
12154 !! test
12155 pre-save transform: nonexistent template
12156 !! options
12157 pst
12158 !! wikitext
12159 {{thistemplatedoesnotexist}}
12160 !! html/php
12161 {{thistemplatedoesnotexist}}
12162 !! end
12163
12164 !! test
12165 pre-save transform: subst magic variables
12166 !! options
12167 pst
12168 !! wikitext
12169 {{subst:SITENAME}}
12170 !! html/php
12171 MediaWiki
12172 !! end
12173
12174 # This is bug 89, which I fixed. -- wtm
12175 !! test
12176 pre-save transform: subst: templates with parameters
12177 !! options
12178 pst
12179 !! wikitext
12180 {{subst:paramtest|param="something else"}}
12181 !! html/php
12182 This is a test template with parameter "something else"
12183 !! end
12184
12185 !! article
12186 Template:nowikitest
12187 !! text
12188 <nowiki>'''not wiki'''</nowiki>
12189 !! endarticle
12190
12191 !! test
12192 pre-save transform: nowiki in subst (bug 1188)
12193 !! options
12194 pst
12195 !! wikitext
12196 {{subst:nowikitest}}
12197 !! html/php
12198 <nowiki>'''not wiki'''</nowiki>
12199 !! end
12200
12201 !! article
12202 Template:commenttest
12203 !! text
12204 This template has <!-- a comment --> in it.
12205 !! endarticle
12206
12207 !! test
12208 pre-save transform: comment in subst (bug 1936)
12209 !! options
12210 pst
12211 !! wikitext
12212 {{subst:commenttest}}
12213 !! html/php
12214 This template has <!-- a comment --> in it.
12215 !! end
12216
12217 !! test
12218 pre-save transform: unclosed tag
12219 !! options
12220 pst
12221 !! wikitext
12222 <nowiki>'''not wiki'''
12223 !! html/php
12224 <nowiki>'''not wiki'''
12225 !! end
12226
12227 !! test
12228 pre-save transform: mixed tag case
12229 !! options
12230 pst
12231 !! wikitext
12232 <NOwiki>'''not wiki'''</noWIKI>
12233 !! html/php
12234 <NOwiki>'''not wiki'''</noWIKI>
12235 !! end
12236
12237 !! test
12238 pre-save transform: unclosed comment in <nowiki>
12239 !! options
12240 pst
12241 !! wikitext
12242 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12243 !! html/php
12244 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12245 !!end
12246
12247 # Leading @ in this template definition works around a limitation
12248 # in parsoid's parserTests which otherwise strips the <span> from the
12249 # result (confusing it for a template wrapper)
12250 !! article
12251 Template:dangerous
12252 !!text
12253 @<span onmouseover="alert('crap')">Oh no</span>
12254 !!endarticle
12255
12256 !!test
12257 (confirming safety of fix for subst bug 1936)
12258 !! wikitext
12259 {{Template:dangerous}}
12260 !! html
12261 <p>@<span>Oh no</span>
12262 </p>
12263 !! end
12264
12265 !! test
12266 pre-save transform: comment containing gallery (bug 5024)
12267 !! options
12268 pst
12269 !! wikitext
12270 <!-- <gallery>data</gallery> -->
12271 !! html/php
12272 <!-- <gallery>data</gallery> -->
12273 !!end
12274
12275 !! test
12276 pre-save transform: comment containing extension
12277 !! options
12278 pst
12279 !! wikitext
12280 <!-- <tag>data</tag> -->
12281 !! html/php
12282 <!-- <tag>data</tag> -->
12283 !!end
12284
12285 !! test
12286 pre-save transform: comment containing nowiki
12287 !! options
12288 pst
12289 !! wikitext
12290 <!-- <nowiki>data</nowiki> -->
12291 !! html/php
12292 <!-- <nowiki>data</nowiki> -->
12293 !!end
12294
12295 !! test
12296 pre-save transform: <noinclude> in subst (bug 3298)
12297 !! options
12298 pst
12299 !! wikitext
12300 {{subst:Includes}}
12301 !! html/php
12302 Foobar
12303 !! end
12304
12305 !! test
12306 pre-save transform: <onlyinclude> in subst (bug 3298)
12307 !! options
12308 pst
12309 !! wikitext
12310 {{subst:Includes2}}
12311 !! html/php
12312 Foo
12313 !! end
12314
12315 !! article
12316 Template:SubstTest
12317 !!text
12318 {{<includeonly>subst:</includeonly>Includes}}
12319 !! endarticle
12320
12321 !! article
12322 Template:SafeSubstTest
12323 !! text
12324 {{<includeonly>safesubst:</includeonly>Includes}}
12325 !! endarticle
12326
12327 !! test
12328 bug 22297: safesubst: works during PST
12329 !! options
12330 pst
12331 !! wikitext
12332 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12333 !! html/php
12334 FoobarFoobar
12335 !! end
12336
12337 !! test
12338 bug 22297: safesubst: works during normal parse
12339 !! wikitext
12340 {{SafeSubstTest}}
12341 !! html
12342 <p>Foobar
12343 </p>
12344 !! end
12345
12346 !! test
12347 subst: does not work during normal parse
12348 !! wikitext
12349 {{SubstTest}}
12350 !! html
12351 <p>{{subst:Includes}}
12352 </p>
12353 !! end
12354
12355 !! test
12356 pre-save transform: context links ("pipe trick")
12357 !! options
12358 pst
12359 !! wikitext
12360 [[Article (context)|]]
12361 [[Bar:Article|]]
12362 [[:Bar:Article|]]
12363 [[Bar:Article (context)|]]
12364 [[:Bar:Article (context)|]]
12365 [[|Article]]
12366 [[|Article (context)]]
12367 [[Bar:X (Y) Z|]]
12368 [[:Bar:X (Y) Z|]]
12369 !! html/php
12370 [[Article (context)|Article]]
12371 [[Bar:Article|Article]]
12372 [[:Bar:Article|Article]]
12373 [[Bar:Article (context)|Article]]
12374 [[:Bar:Article (context)|Article]]
12375 [[Article]]
12376 [[Article (context)]]
12377 [[Bar:X (Y) Z|X (Y) Z]]
12378 [[:Bar:X (Y) Z|X (Y) Z]]
12379 !! end
12380
12381 !! test
12382 pre-save transform: context links ("pipe trick") with interwiki prefix
12383 !! options
12384 pst
12385 !! wikitext
12386 [[interwiki:Article|]]
12387 [[:interwiki:Article|]]
12388 [[interwiki:Bar:Article|]]
12389 [[:interwiki:Bar:Article|]]
12390 !! html/php
12391 [[interwiki:Article|Article]]
12392 [[:interwiki:Article|Article]]
12393 [[interwiki:Bar:Article|Bar:Article]]
12394 [[:interwiki:Bar:Article|Bar:Article]]
12395 !! end
12396
12397 !! test
12398 pre-save transform: context links ("pipe trick") with parens in title
12399 !! options
12400 pst title=[[Somearticle (context)]]
12401 !! wikitext
12402 [[|Article]]
12403 !! html/php
12404 [[Article (context)|Article]]
12405 !! end
12406
12407 !! test
12408 pre-save transform: context links ("pipe trick") with comma in title
12409 !! options
12410 pst title=[[Someplace, Somewhere]]
12411 !! wikitext
12412 [[|Otherplace]]
12413 [[Otherplace, Elsewhere|]]
12414 [[Otherplace, Elsewhere, Anywhere|]]
12415 !! html/php
12416 [[Otherplace, Somewhere|Otherplace]]
12417 [[Otherplace, Elsewhere|Otherplace]]
12418 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12419 !! end
12420
12421 !! test
12422 pre-save transform: context links ("pipe trick") with parens and comma
12423 !! options
12424 pst title=[[Someplace (IGNORED), Somewhere]]
12425 !! wikitext
12426 [[|Otherplace]]
12427 [[Otherplace (place), Elsewhere|]]
12428 !! html/php
12429 [[Otherplace, Somewhere|Otherplace]]
12430 [[Otherplace (place), Elsewhere|Otherplace]]
12431 !! end
12432
12433 !! test
12434 pre-save transform: context links ("pipe trick") with comma and parens
12435 !! options
12436 pst title=[[Who, me? (context)]]
12437 !! wikitext
12438 [[|Yes, you.]]
12439 [[Me, Myself, and I (1937 song)|]]
12440 !! html/php
12441 [[Yes, you. (context)|Yes, you.]]
12442 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12443 !! end
12444
12445 !! test
12446 pre-save transform: context links ("pipe trick") with namespace
12447 !! options
12448 pst title=[[Ns:Somearticle]]
12449 !! wikitext
12450 [[|Article]]
12451 !! html/php
12452 [[Ns:Article|Article]]
12453 !! end
12454
12455 !! test
12456 pre-save transform: context links ("pipe trick") with namespace and parens
12457 !! options
12458 pst title=[[Ns:Somearticle (context)]]
12459 !! wikitext
12460 [[|Article]]
12461 !! html/php
12462 [[Ns:Article (context)|Article]]
12463 !! end
12464
12465 !! test
12466 pre-save transform: context links ("pipe trick") with namespace and comma
12467 !! options
12468 pst title=[[Ns:Somearticle, Context, Whatever]]
12469 !! wikitext
12470 [[|Article]]
12471 !! html/php
12472 [[Ns:Article, Context, Whatever|Article]]
12473 !! end
12474
12475 !! test
12476 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12477 !! options
12478 pst title=[[Ns:Somearticle, Context (context)]]
12479 !! wikitext
12480 [[|Article]]
12481 !! html/php
12482 [[Ns:Article (context)|Article]]
12483 !! end
12484
12485 !! test
12486 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12487 !! options
12488 pst title=[[Ns:Somearticle (IGNORED), Context]]
12489 !! wikitext
12490 [[|Article]]
12491 !! html/php
12492 [[Ns:Article, Context|Article]]
12493 !! end
12494
12495 !! test
12496 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12497 !! options
12498 pst
12499 !! wikitext
12500 [[Article(context)|]]
12501 [[Bar:Article(context)|]]
12502 [[:Bar:Article(context)|]]
12503 [[|Article(context)]]
12504 [[Bar:X(Y)Z|]]
12505 [[:Bar:X(Y)Z|]]
12506 !! html/php
12507 [[Article(context)|Article]]
12508 [[Bar:Article(context)|Article]]
12509 [[:Bar:Article(context)|Article]]
12510 [[Article(context)]]
12511 [[Bar:X(Y)Z|X(Y)Z]]
12512 [[:Bar:X(Y)Z|X(Y)Z]]
12513 !! end
12514
12515 !! test
12516 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12517 !! options
12518 pst
12519 !! wikitext
12520 [[Article (context)|]]
12521 [[Bar:Article (context)|]]
12522 [[:Bar:Article (context)|]]
12523 [[|Article (context)]]
12524 [[Bar:X (Y) Z|]]
12525 [[:Bar:X (Y) Z|]]
12526 !! html/php
12527 [[Article (context)|Article]]
12528 [[Bar:Article (context)|Article]]
12529 [[:Bar:Article (context)|Article]]
12530 [[Article (context)]]
12531 [[Bar:X (Y) Z|X (Y) Z]]
12532 [[:Bar:X (Y) Z|X (Y) Z]]
12533 !! end
12534
12535 !! test
12536 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12537 !! options
12538 pst
12539 !! wikitext
12540 [[Article(context)|]]
12541 [[Bar:Article(context)|]]
12542 [[:Bar:Article(context)|]]
12543 [[|Article(context)]]
12544 [[Bar:X(Y)Z|]]
12545 [[:Bar:X(Y)Z|]]
12546 !! html/php
12547 [[Article(context)|Article]]
12548 [[Bar:Article(context)|Article]]
12549 [[:Bar:Article(context)|Article]]
12550 [[Article(context)]]
12551 [[Bar:X(Y)Z|X(Y)Z]]
12552 [[:Bar:X(Y)Z|X(Y)Z]]
12553 !! end
12554
12555 !! test
12556 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12557 !! options
12558 pst
12559 !! wikitext
12560 [[Article (context), context|]]
12561 [[Article (context),context|]]
12562 [[Bar:Article (context), context|]]
12563 [[Bar:Article (context),context|]]
12564 [[:Bar:Article (context), context|]]
12565 [[:Bar:Article (context),context|]]
12566 !! html/php
12567 [[Article (context), context|Article]]
12568 [[Article (context),context|Article]]
12569 [[Bar:Article (context), context|Article]]
12570 [[Bar:Article (context),context|Article]]
12571 [[:Bar:Article (context), context|Article]]
12572 [[:Bar:Article (context),context|Article]]
12573 !! end
12574
12575 !! test
12576 pre-save transform: trim trailing empty lines
12577 !! options
12578 pst
12579 !! wikitext
12580 Empty lines are trimmed
12581
12582
12583
12584
12585 !! html/php
12586 Empty lines are trimmed
12587 !! end
12588
12589 !! test
12590 pre-save transform: Signature expansion
12591 !! options
12592 pst
12593 !! wikitext
12594 * ~~~
12595 * <noinclude>~~~</noinclude>
12596 * <includeonly>~~~</includeonly>
12597 * <onlyinclude>~~~</onlyinclude>
12598 !! html/php
12599 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12600 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12601 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12602 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12603 !! end
12604
12605
12606 !! test
12607 pre-save transform: Signature expansion in nowiki tags (bug 93)
12608 !! options
12609 pst disabled
12610 !! wikitext
12611 Shall not expand:
12612
12613 <nowiki>~~~~</nowiki>
12614
12615 <includeonly><nowiki>~~~~</nowiki></includeonly>
12616
12617 <noinclude><nowiki>~~~~</nowiki></noinclude>
12618
12619 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12620
12621 {{subst:Foo}} shall be converted to FOO
12622
12623 As well as inside noinclude/onlyinclude
12624 <noinclude>{{subst:Foo}}</noinclude>
12625 <onlyinclude>{{subst:Foo}}</onlyinclude>
12626
12627 But not inside includeonly
12628 <includeonly>{{subst:Foo}}</includeonly>
12629 !! html/php
12630 Shall not expand:
12631
12632 <nowiki>~~~~</nowiki>
12633
12634 <includeonly><nowiki>~~~~</nowiki></includeonly>
12635
12636 <noinclude><nowiki>~~~~</nowiki></noinclude>
12637
12638 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12639
12640 FOO shall be converted to FOO
12641
12642 As well as inside noinclude/onlyinclude
12643 <noinclude>FOO</noinclude>
12644 <onlyinclude>FOO</onlyinclude>
12645
12646 But not inside includeonly
12647 <includeonly>{{subst:Foo}}</includeonly>
12648 !! end
12649
12650 !! test
12651 Parsoid: Recognize nowiki with trailing space in tags
12652 !! options
12653 parsoid=wt2html
12654 !! wikitext
12655 <nowiki ><div>[[foo]]</nowiki >
12656
12657 a<nowiki / >b
12658
12659 c<nowiki />d
12660
12661 e<nowiki/ >f
12662 !! html
12663 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12664 <p>ab</p>
12665 <p>cd</p>
12666 <p>ef</p>
12667 !! end
12668
12669 !! test
12670 Parsoid: Recognize nowiki with odd capitalization
12671 !! options
12672 parsoid=wt2html
12673 !! wikitext
12674 <noWikI ><div>[[foo]]</Nowiki >
12675 !! html
12676 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12677 !! end
12678
12679
12680 !! test
12681 Parsoid: Escape nowiki with trailing space in tags
12682 !! options
12683 parsoid=html2wt
12684 !! html/parsoid
12685 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12686 <p>a&lt;nowiki /&gt;b</p>
12687 <p>c&lt;nowiki/ &gt;d</p>
12688 !! wikitext
12689 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12690
12691 a&lt;nowiki /&gt;b
12692
12693 c&lt;nowiki/ &gt;d
12694 !! end
12695
12696 !! test
12697 Parsoid: Escape weird noWikI capitalizations
12698 !! options
12699 parsoid=html2wt
12700 !! html/parsoid
12701 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12702 !! wikitext
12703 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12704 !! end
12705
12706 ###
12707 ### Message transform tests
12708 ###
12709 !! test
12710 message transform: magic variables
12711 !! options
12712 msg
12713 !! wikitext
12714 {{SITENAME}}
12715 !! html
12716 MediaWiki
12717 !! end
12718
12719 !! test
12720 message transform: should not transform wiki markup
12721 !! options
12722 msg
12723 !! wikitext
12724 ''test''
12725 !! html
12726 ''test''
12727 !! end
12728
12729 !! test
12730 message transform: <noinclude> in transcluded template (bug 4926)
12731 !! options
12732 msg
12733 !! wikitext
12734 {{Includes}}
12735 !! html
12736 Foobar
12737 !! end
12738
12739 !! test
12740 message transform: <onlyinclude> in transcluded template (bug 4926)
12741 !! options
12742 msg
12743 !! wikitext
12744 {{Includes2}}
12745 !! html
12746 Foo
12747 !! end
12748
12749 !! test
12750 {{#special:}} page name, known
12751 !! options
12752 msg
12753 !! wikitext
12754 {{#special:Recentchanges}}
12755 !! html
12756 Special:RecentChanges
12757 !! end
12758
12759 !! test
12760 {{#special:}} page name with subpage, known
12761 !! options
12762 msg
12763 !! wikitext
12764 {{#special:Recentchanges/param}}
12765 !! html
12766 Special:RecentChanges/param
12767 !! end
12768
12769 !! test
12770 {{#special:}} page name, unknown
12771 !! options
12772 msg
12773 !! wikitext
12774 {{#special:foobar nonexistent}}
12775 !! html
12776 Special:Foobar nonexistent
12777 !! end
12778
12779 !! test
12780 {{#speciale:}} page name, known
12781 !! options
12782 msg
12783 !! wikitext
12784 {{#speciale:Recentchanges}}
12785 !! html
12786 Special:RecentChanges
12787 !! end
12788
12789 !! test
12790 {{#speciale:}} page name with subpage, known
12791 !! options
12792 msg
12793 !! wikitext
12794 {{#speciale:Recentchanges/param}}
12795 !! html
12796 Special:RecentChanges/param
12797 !! end
12798
12799 !! test
12800 {{#speciale:}} page name, unknown
12801 !! options
12802 msg
12803 !! wikitext
12804 {{#speciale:foobar nonexistent}}
12805 !! html
12806 Special:Foobar_nonexistent
12807 !! end
12808
12809 ###
12810 ### Images
12811 ###
12812 ### For Parsoid-specific tests, see
12813 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12814
12815 !! test
12816 Simple image
12817 !! options
12818 parsoid=wt2html,wt2wt,html2html
12819 !! wikitext
12820 [[Image:foobar.jpg]]
12821 !! html/php
12822 <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>
12823 </p>
12824 !! html/parsoid
12825 <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>
12826 !! end
12827
12828 !! test
12829 Simple image (using File: namespace, now canonical)
12830 !! wikitext
12831 [[File:Foobar.jpg]]
12832 !! html/php
12833 <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>
12834 </p>
12835 !! html/parsoid
12836 <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>
12837 !! end
12838
12839 !! test
12840 Right-aligned image
12841 !! wikitext
12842 [[File:Foobar.jpg|right]]
12843 !! html/php
12844 <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>
12845
12846 !! html/parsoid
12847 <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>
12848 !! end
12849
12850 !! test
12851 Image with caption
12852 !! wikitext
12853 [[File:Foobar.jpg|right|Caption text]]
12854 !! html/php
12855 <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>
12856
12857 !! html/parsoid
12858 <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>
12859 !! end
12860
12861 !! test
12862 Image with caption, bug 53312 #1
12863 !! wikitext
12864 [[File:Foobar.jpg|right|Caption page stuff]]
12865 !! html/php
12866 <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>
12867
12868 !! html/parsoid
12869 <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>
12870 !! end
12871
12872 !! test
12873 Image with caption, bug 53312 #2
12874 !! wikitext
12875 [[File:Foobar.jpg|right|Caption page=]]
12876 !! html/php
12877 <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>
12878
12879 !! html/parsoid
12880 <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>
12881 !! end
12882
12883 !! test
12884 Image with caption, bug 53312 #3
12885 !! wikitext
12886 [[File:Foobar.jpg|right|Caption page=stuff]]
12887 !! html/php
12888 <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>
12889
12890 !! html/parsoid
12891 <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>
12892 !! end
12893
12894 !! test
12895 Allow empty links in image captions (Bug 60753)
12896 !! options
12897 thumbsize=220
12898 !! wikitext
12899 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12900 [[]]
12901 [[Link2]]
12902 ]]
12903 !! html/php
12904 <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>
12905
12906 !! html/parsoid
12907 <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>
12908 [[]]
12909 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12910 </figcaption></figure>
12911 !! end
12912
12913 !! test
12914 Titles in unlinked images (T23454)
12915 !! wikitext
12916 [[File:Foobar.jpg|link=|stuff]]
12917 !! html/php
12918 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12919 </p>
12920 !! end
12921
12922 !! test
12923 Link with empty target
12924 !! wikitext
12925 [[]]
12926 !! html
12927 <p>[[]]
12928 </p>
12929 !! end
12930
12931 !! test
12932 Image with link trail
12933 !! wikitext
12934 Linktrails should not work for images: [[File:Foobar.jpg]]s
12935 !! html/php
12936 <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
12937 </p>
12938 !! html/parsoid
12939 <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>
12940 !! end
12941
12942 !! test
12943 Image with empty attribute
12944 !! options
12945 parsoid=wt2html,wt2wt,html2html
12946 !! wikitext
12947 [[File:Foobar.jpg|right||Caption text]]
12948 !! html/php
12949 <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>
12950
12951 !! html/parsoid
12952 <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>
12953 !! end
12954
12955 !! test
12956 1. Block image with individual attributes from templates
12957 !! wikitext
12958 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12959 !! html/php
12960 <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>
12961
12962 !! html/parsoid
12963 <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>
12964 !! end
12965
12966 !! test
12967 2. Block Image with individual attributes from templates
12968 !! wikitext
12969 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12970 !! html/php
12971 <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>
12972
12973 !! html/parsoid
12974 <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>
12975 !! end
12976
12977 !! test
12978 3. Inline image with individual attributes from templates
12979 !! wikitext
12980 [[File:Foobar.jpg|{{echo|50px}}]]
12981 !! html/php
12982 <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>
12983 </p>
12984 !! html/parsoid
12985 <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>
12986 !! end
12987
12988 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12989 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12990 !! test
12991 Image with multiple attributes from the same template
12992 !! wikitext
12993 [[File:Foobar.jpg|{{image_attribs}}]]
12994 !! html/php
12995 <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>
12996
12997 !! html/parsoid
12998 <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>
12999 !! end
13000
13001 !! test
13002 Image with link tails
13003 !! options
13004 thumbsize=220
13005 !! wikitext
13006 123[[File:Foobar.jpg]]456
13007 123[[File:Foobar.jpg|right]]456
13008 123[[File:Foobar.jpg|thumb]]456
13009 !! html/php
13010 <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
13011 </p>
13012 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
13013 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
13014
13015 !! html/php+tidy
13016 <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>
13017 <p>123</p>
13018 <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>
13019 <p>456 123</p>
13020 <div class="thumb tright">
13021 <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>
13022 <div class="thumbcaption">
13023 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13024 </div>
13025 </div>
13026 </div>
13027 <p>456</p>
13028 !! html/parsoid
13029 <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>
13030 <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>
13031 <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>
13032 !! end
13033
13034 !! test
13035 Image with multiple captions -- only last one is accepted
13036 !! wikitext
13037 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13038 !! html/php
13039 <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>
13040
13041 !! html/parsoid
13042 <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>
13043 !! end
13044
13045 !! test
13046 Image with multiple widths -- use last
13047 !! wikitext
13048 [[File:Foobar.jpg|200px|300px|caption]]
13049 !! html/php
13050 <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>
13051 </p>
13052 !! html/parsoid
13053 <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>
13054 !! end
13055
13056 !! test
13057 Image with multiple alignments -- use first (bug 48664)
13058 !! options
13059 thumbsize=220
13060 !! wikitext
13061 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13062
13063 [[File:Foobar.jpg|middle|text-top|caption]]
13064 !! html/php
13065 <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>
13066 <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>
13067 </p>
13068 !! html/parsoid
13069 <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>
13070 <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>
13071 !! end
13072
13073 !! test
13074 Image with width attribute at different positions
13075 !! wikitext
13076 [[File:Foobar.jpg|200px|right|Caption]]
13077 [[File:Foobar.jpg|right|200px|Caption]]
13078 [[File:Foobar.jpg|right|Caption|200px]]
13079 !! html/php
13080 <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>
13081 <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>
13082 <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>
13083
13084 !! html/parsoid
13085 <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>
13086 <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>
13087 <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>
13088 !! end
13089
13090 # a sad bit of backward-compatibility
13091 !! test
13092 Image with size specified with pxpx (bug 13500, 51628)
13093 !! options
13094 parsoid=wt2html,wt2wt,html2html
13095 !! wikitext
13096 [[File:Foobar.jpg|20pxpx]]
13097 [[File:Foobar.jpg|200x20pxpx]]
13098 !! html/php
13099 <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>
13100 <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>
13101 </p>
13102 !! html/parsoid
13103 <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>
13104 !! end
13105
13106 !! test
13107 Image with link parameter, wiki target
13108 !! wikitext
13109 [[File:Foobar.jpg|link=Main Page]]
13110 !! html/php
13111 <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>
13112 </p>
13113 !! html/parsoid
13114 <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>
13115 !! end
13116
13117 # parsoid bug 49293 (part 1)
13118 !! test
13119 Image with link parameter, URL target
13120 !! wikitext
13121 [[File:Foobar.jpg|link=http://example.com/]]
13122 !! html/php
13123 <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>
13124 </p>
13125 !! html/parsoid
13126 <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>
13127 !! end
13128
13129 # parsoid bug 49293 (part 2)
13130 !! test
13131 Image with link parameter, protocol-less URL target
13132 !! wikitext
13133 [[File:Foobar.jpg|link=//example.com/]]
13134 !! html/php
13135 <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>
13136 </p>
13137 !! html/parsoid
13138 <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>
13139 !! end
13140
13141 !! test
13142 Escaping non-block captions (T107435)
13143 !! options
13144 parsoid={
13145 "modes": ["wt2wt"],
13146 "changes": [
13147 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13148 ]
13149 }
13150 !! wikitext
13151 [[Image:Foobar.jpg|caption]]
13152 !! wikitext/edited
13153 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13154 !! end
13155
13156 # wgExternalLinkTarget not supported by Parsoid
13157 !! test
13158 Image with link parameter, wgExternalLinkTarget
13159 !! wikitext
13160 [[Image:foobar.jpg|link=http://example.com/]]
13161 !! config
13162 wgExternalLinkTarget='foobar'
13163 !! html/php
13164 <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>
13165 </p>
13166 !! end
13167
13168 !! test
13169 Image with link parameter, wgNoFollowLinks set to false
13170 !! wikitext
13171 [[Image:foobar.jpg|link=http://example.com/]]
13172 !! config
13173 wgNoFollowLinks=false
13174 !! html
13175 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13176 </p>
13177 !! end
13178
13179 !! test
13180 Image with link parameter, wgNoFollowDomainExceptions
13181 !! wikitext
13182 [[Image:foobar.jpg|link=http://example.com/]]
13183 !! config
13184 wgNoFollowDomainExceptions='example.com'
13185 !! html
13186 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13187 </p>
13188 !! end
13189
13190 # wgExternalLinkTarget not supported by Parsoid
13191 !! test
13192 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13193 !! wikitext
13194 [[Image:foobar.jpg|link=http://example.com/|Title]]
13195 !! config
13196 wgExternalLinkTarget='foobar'
13197 !! html/php
13198 <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>
13199 </p>
13200 !! end
13201
13202 !! test
13203 Image with empty link parameter
13204 !! wikitext
13205 [[File:Foobar.jpg|link=]]
13206 !! html/php
13207 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13208 </p>
13209 !! html/parsoid
13210 <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>
13211 !! end
13212
13213 !! test
13214 Image with link parameter (wiki target) and unnamed parameter
13215 !! wikitext
13216 [[File:Foobar.jpg|link=Main_Page|Title]]
13217 !! html/php
13218 <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>
13219 </p>
13220 !! html/parsoid
13221 <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>
13222 !! end
13223
13224 !! test
13225 Image with link parameter (URL target) and unnamed parameter
13226 !! wikitext
13227 [[File:Foobar.jpg|link=http://example.com/|Title]]
13228 !! html/php
13229 <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>
13230 </p>
13231 !! html/parsoid
13232 <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>
13233 !! end
13234
13235 !! test
13236 Thumbnail image with link parameter
13237 !! options
13238 thumbsize=220
13239 parsoid=wt2html,wt2wt,html2html
13240 !! wikitext
13241 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13242 !! html/php
13243 <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>
13244
13245 !! html/parsoid
13246 <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>
13247 !! end
13248
13249 !! test
13250 Manually-specified thumbnail image
13251 !! options
13252 thumbsize=220
13253 !! wikitext
13254 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13255 !! html/php
13256 <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>
13257
13258 !! html/parsoid
13259 <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>
13260 !! end
13261
13262 !! test
13263 Manually-specified thumbnail image with explicit link to wiki page
13264 !! options
13265 thumbsize=220
13266 parsoid=wt2html,wt2wt,html2html
13267 !! wikitext
13268 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13269 !! html/php
13270 <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>
13271
13272 !! html/parsoid
13273 <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>
13274 !! end
13275
13276 !! test
13277 Manually-specified thumbnail image with explicit link to url
13278 !! options
13279 thumbsize=220
13280 parsoid=wt2html,wt2wt,html2html
13281 !! wikitext
13282 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13283 !! html/php
13284 <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>
13285
13286 !! html/parsoid
13287 <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>
13288 !! end
13289
13290 !! test
13291 Manually-specified thumbnail image with explicit no link
13292 !! options
13293 thumbsize=220
13294 parsoid=wt2html,wt2wt,html2html
13295 !! wikitext
13296 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13297 !! html/php
13298 <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>
13299
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 !! test
13305 Manually-specified thumbnail image with explicit link and alt text
13306 !! options
13307 thumbsize=220
13308 parsoid=wt2html,wt2wt,html2html
13309 !! wikitext
13310 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13311 !! html/php
13312 <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>
13313
13314 !! html/parsoid
13315 <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>
13316 !! end
13317
13318 !! test
13319 Image with frame and link
13320 !! options
13321 parsoid=wt2html,wt2wt,html2html
13322 !! wikitext
13323 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13324 !! html/php
13325 <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>
13326
13327 !! html/parsoid
13328 <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>
13329 !! end
13330
13331 !! test
13332 Image with frame and link and explicit alt
13333 !! options
13334 parsoid=wt2html,wt2wt,html2html
13335 !! wikitext
13336 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13337 !! html/php
13338 <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>
13339
13340 !! html/parsoid
13341 <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>
13342 !! end
13343
13344 !! test
13345 Image with wiki markup in implicit alt
13346 !! wikitext
13347 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13348
13349 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13350 !! html/php
13351 <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>
13352 </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>
13353 </p>
13354 !! html/parsoid
13355 <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>
13356
13357 <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>
13358 !! end
13359
13360 !! test
13361 Alt image option should handle most kinds of wikitext without barfing
13362 !! wikitext
13363 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13364 !! html/php
13365 <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>
13366
13367 !! html/parsoid
13368 <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>
13369 !! end
13370
13371 ###################
13372 # Conflicting image format options.
13373 # First option specified should 'win'.
13374 # All three cases in each test should be identical.
13375
13376 !! test
13377 Image with 'frameless' first.
13378 !! options
13379 parsoid=wt2html,wt2wt,html2html
13380 !! wikitext
13381 [[File:Foobar.jpg|frameless|caption]]
13382
13383 [[File:Foobar.jpg|frameless|frame|caption]]
13384
13385 [[File:Foobar.jpg|frameless|thumb|caption]]
13386 !! html/php
13387 <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>
13388 </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>
13389 </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>
13390 </p>
13391 !! html/parsoid
13392 <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>
13393 <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>
13394 <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>
13395 !! end
13396
13397 !! test
13398 Image with 'frame' first.
13399 !! options
13400 parsoid=wt2html,wt2wt,html2html
13401 !! wikitext
13402 [[File:Foobar.jpg|frame|caption]]
13403 [[File:Foobar.jpg|frame|frameless|caption]]
13404 [[File:Foobar.jpg|frame|thumb|caption]]
13405 !! html/php
13406 <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>
13407 <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>
13408 <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>
13409
13410 !! html/parsoid
13411 <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>
13412 <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>
13413 <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>
13414 !! end
13415
13416 !! test
13417 Image with 'thumb' first.
13418 !! options
13419 parsoid=wt2html,wt2wt,html2html
13420 !! wikitext
13421 [[File:Foobar.jpg|thumb|caption]]
13422 [[File:Foobar.jpg|thumb|frameless|caption]]
13423 [[File:Foobar.jpg|thumb|frame|caption]]
13424 !! html/php
13425 <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>
13426 <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>
13427 <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>
13428
13429 !! html/parsoid
13430 <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>
13431 <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>
13432 <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>
13433 !! end
13434
13435 ###################
13436 # Image sizing.
13437 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13438 # and https://phabricator.wikimedia.org/T64258
13439 # Foobar has actual size of 1941x220
13440 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13441 # a scalable format.
13442 # 2. Framed images always ignore size options; always render at default size.
13443 # 3. "Unspecified format" and border are the only types which can be
13444 # enlarged.
13445
13446 !! test
13447 Image: "unspecified format" and border enlarge
13448 !! options
13449 parsoid=wt2html,wt2wt,html2html
13450 !! wikitext
13451 [[File:Foobar.jpg|2000px]]
13452
13453 [[File:Foobar.jpg|border|2000px]]
13454 !! html/php
13455 <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>
13456 </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>
13457 </p>
13458 !! html/parsoid
13459 <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>
13460 <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>
13461 !! end
13462
13463 !! test
13464 Image: "unspecified format" and border reduce
13465 !! options
13466 parsoid=wt2html,wt2wt,html2html
13467 !! wikitext
13468 [[File:Foobar.jpg|1000px]]
13469
13470 [[File:Foobar.jpg|border|1000px]]
13471 !! html/php
13472 <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>
13473 </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>
13474 </p>
13475 !! html/parsoid
13476 <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>
13477 <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>
13478 !! end
13479
13480 !! test
13481 Image: thumbs reduce
13482 !! options
13483 parsoid=wt2html,wt2wt,html2html
13484 !! wikitext
13485 [[File:Foobar.jpg|thumb|50px]]
13486 !! html/php
13487 <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>
13488
13489 !! html/parsoid
13490 <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>
13491 !! end
13492
13493 !! test
13494 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13495 !! options
13496 parsoid=wt2html,wt2wt,html2html
13497 !! wikitext
13498 [[File:Foobar.jpg|thumb|2000px]]
13499
13500 [[File:Foobar.svg|thumb|2000px]]
13501 !! html/php
13502 <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>
13503 <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>
13504
13505 !! html/parsoid
13506 <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>
13507 <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>
13508 !! end
13509
13510 !! test
13511 Image: frameless can reduce in size
13512 !! options
13513 parsoid=wt2html,wt2wt,html2html
13514 !! wikitext
13515 [[File:Foobar.jpg|frameless|50px]]
13516 !! html/php
13517 <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>
13518 </p>
13519 !! html/parsoid
13520 <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>
13521 !! end
13522
13523 !! test
13524 Image: bitmap frameless can't be enlarged past original size, but vector can
13525 !! options
13526 parsoid=wt2html,wt2wt,html2html
13527 !! wikitext
13528 [[File:Foobar.jpg|frameless|2000px]]
13529
13530 [[File:Foobar.svg|frameless|2000px]]
13531 !! html/php
13532 <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>
13533 </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>
13534 </p>
13535 !! html/parsoid
13536 <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>
13537 <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>
13538 !! end
13539
13540 !! test
13541 Image: framed images are always unscaled.
13542 !! options
13543 parsoid=wt2html,wt2wt,html2html
13544 !! wikitext
13545 [[File:Foobar.jpg|frame]]
13546
13547 [[File:Foobar.jpg|frame|50px]]
13548
13549 [[File:Foobar.jpg|frame|50x50px]]
13550
13551 [[File:Foobar.jpg|frame|2000px]]
13552 !! html/php
13553 <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>
13554 <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>
13555 <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>
13556 <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>
13557
13558 !! html/parsoid
13559 <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>
13560 <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>
13561 <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>
13562 <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>
13563 !! end
13564
13565 ###################
13566
13567 !! test
13568 Link to image page- image page normally doesn't exists, hence edit link
13569 Add test with existing image page
13570 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13571 !! wikitext
13572 [[:Image:test]]
13573 !! html
13574 <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>
13575 </p>
13576 !! end
13577
13578 !! test
13579 bug 18784 Link to non-existent image page with caption should use caption as link text
13580 !! wikitext
13581 [[:Image:test|caption]]
13582 !! html
13583 <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>
13584 </p>
13585 !! end
13586
13587 !! test
13588 Frameless image caption with a free URL
13589 !! wikitext
13590 [[File:Foobar.jpg|http://example.com]]
13591 !! html/php
13592 <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>
13593 </p>
13594 !! html/parsoid
13595 <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>
13596 !! end
13597
13598 !! test
13599 Thumbnail image caption with a free URL
13600 !! options
13601 thumbsize=220
13602 !! wikitext
13603 [[File:Foobar.jpg|thumb|http://example.com]]
13604 !! html/php
13605 <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>
13606
13607 !! html/parsoid
13608 <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>
13609 !! end
13610
13611 !! test
13612 Thumbnail image caption with a free URL and explicit alt
13613 !! options
13614 thumbsize=220
13615 parsoid=wt2html,wt2wt,html2html
13616 !! wikitext
13617 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13618 !! html/php
13619 <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>
13620
13621 !! html/parsoid
13622 <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>
13623 !! end
13624
13625 !! test
13626 SVG thumbnails with no language set
13627 !! options
13628 !! wikitext
13629 [[File:Foobar.svg|thumb|caption]]
13630 !! html/php
13631 <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>
13632
13633 !! html/parsoid
13634 <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>
13635 !! end
13636
13637 !! test
13638 SVG thumbnails with language de
13639 !! options
13640 parsoid=wt2html,wt2wt,html2html
13641 !! wikitext
13642 [[File:Foobar.svg|thumb|caption|lang=de]]
13643 !! html/php
13644 <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>
13645
13646 !! html/parsoid
13647 <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>
13648 !! end
13649
13650 !! test
13651 SVG thumbnails with invalid language code
13652 !! options
13653 parsoid=wt2html,wt2wt,html2html
13654 !! wikitext
13655 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13656 !! html/php
13657 <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>
13658
13659 !! html/parsoid
13660 <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>
13661 !! end
13662
13663 !! test
13664 BUG 1887: A ISBN with a thumbnail
13665 !! wikitext
13666 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13667 !! html/php
13668 <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>
13669
13670 !! html/parsoid
13671 <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>
13672 !! end
13673
13674 !! test
13675 BUG 1887: A RFC with a thumbnail
13676 !! wikitext
13677 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13678 !! html/php
13679 <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>
13680
13681 !! html/parsoid
13682 <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>
13683 !! end
13684
13685 !! test
13686 BUG 1887: A mailto link with a thumbnail
13687 !! wikitext
13688 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13689 !! html/php
13690 <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>
13691
13692 !! html/parsoid
13693 <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>
13694 !! end
13695
13696 # Pending resolution to bug 368
13697 !! test
13698 BUG 648: Frameless image caption with a link
13699 !! wikitext
13700 [[File:Foobar.jpg|text with a [[link]] in it]]
13701 !! html/php
13702 <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>
13703 </p>
13704 !! html/parsoid
13705 <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>
13706 !! end
13707
13708 !! test
13709 BUG 648: Frameless image caption with a link (suffix)
13710 !! wikitext
13711 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13712 !! html/php
13713 <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>
13714 </p>
13715 !! html/parsoid
13716 <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>
13717 !! end
13718
13719 !! test
13720 BUG 648: Frameless image caption with an interwiki link
13721 !! wikitext
13722 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13723 !! html/php
13724 <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>
13725 </p>
13726 !! html/parsoid
13727 <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>
13728 !! end
13729
13730 !! test
13731 BUG 648: Frameless image caption with a piped interwiki link
13732 !! wikitext
13733 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13734 !! html/php
13735 <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>
13736 </p>
13737 !! html/parsoid
13738 <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>
13739 !! end
13740
13741 !! test
13742 T107474: Frameless image caption with <nowiki>
13743 !! wikitext
13744 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13745 !! html/parsoid
13746 <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>
13747 !! end
13748
13749 !! test
13750 Escape HTML special chars in image alt text
13751 !! wikitext
13752 [[File:Foobar.jpg|& < > "]]
13753 !! html/php
13754 <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>
13755 </p>
13756 !! html/parsoid
13757 <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>
13758 !! end
13759
13760 !! test
13761 BUG 499: Alt text should have &#1234;, not &amp;1234;
13762 !! wikitext
13763 [[File:Foobar.jpg|&#9792;]]
13764 !! html/php
13765 <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>
13766 </p>
13767 !! html/parsoid
13768 <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>
13769 !! end
13770
13771 !! test
13772 Broken image caption with link
13773 !! options
13774 parsoid=wt2html,wt2wt,html2html
13775 !! wikitext
13776 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13777 !! html/php
13778 <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.
13779 </p>
13780 !! html/parsoid
13781 <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>
13782 !! end
13783
13784 !! test
13785 Image caption containing another image
13786 !! wikitext
13787 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13788 !! html/php
13789 <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>
13790
13791 !! html/parsoid
13792 <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>
13793 !! end
13794
13795 !! test
13796 Image: caption containing a newline
13797 !! wikitext
13798 [[File:Foobar.jpg|This
13799 *is some text]]
13800 !! html/php
13801 <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>
13802 </p>
13803 !! html/parsoid
13804 <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>
13805 !!end
13806
13807 !!test
13808 Image: caption containing leading space
13809 (The leading space should not trigger nowiki escaping in wt2wt mode)
13810 !! wikitext
13811 [[File:Foobar.jpg|thumb| bar]]
13812 !! html/php
13813 <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>
13814
13815 !! html/parsoid
13816 <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>
13817 !!end
13818
13819 !! test
13820 Image: caption containing a table
13821 !! options
13822 parsoid=wt2html,wt2wt,html2html
13823 !! wikitext
13824 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13825 {|
13826 ! Foo !! Bar
13827 |-
13828 | Foo1 || Bar1
13829 |}
13830 and some more text.]]
13831 !! html/php
13832 <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>
13833
13834 !! html/parsoid
13835 <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
13836 <table>
13837 <tbody>
13838 <tr><th>Foo </th><th>Bar</th></tr>
13839 <tr>
13840 <td>Foo1 </td>
13841 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13842 !! end
13843
13844 !! test
13845 Bug 3090: External links other than http: in image captions
13846 !! wikitext
13847 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13848 !! html/php
13849 <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>
13850
13851 !! html/parsoid
13852 <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>
13853 !! end
13854
13855 !! test
13856 Custom class
13857 !! options
13858 parsoid=wt2html,wt2wt,html2html
13859 !! wikitext
13860 [[Image:foobar.jpg|a|class=b]]
13861 !! html/php
13862 <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>
13863 </p>
13864 !! html/parsoid
13865 <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>
13866 !! end
13867
13868 !! test
13869 Localized image handling (1).
13870 !! options
13871 parsoid=wt2html,wt2wt,html2html
13872 language=es
13873 !! wikitext
13874 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13875 !! html/php
13876 <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>
13877
13878 !! html/parsoid
13879 <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>
13880 !! end
13881
13882 !! test
13883 Localized image handling (2).
13884 !! options
13885 thumbsize=220
13886 parsoid=wt2html,wt2wt,html2html
13887 language=es
13888 !! wikitext
13889 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13890 !! html/php
13891 <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>
13892
13893 !! html/parsoid
13894 <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>
13895 !! end
13896
13897 !! test
13898 Localized image handling (3).
13899 !! options
13900 language=fa
13901 parsoid=html2wt
13902 !! html/parsoid
13903 <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>
13904 !! wikitext
13905 [[File:Foobar.jpg|بندانگشتی]]
13906 !! end
13907
13908 !! test
13909 "border", "frameless" and "class" attributes on an image.
13910 !! options
13911 thumbsize=220
13912 parsoid=wt2html,wt2wt,html2html
13913 !! wikitext
13914 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13915 !! html/php
13916 <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>
13917 </p>
13918 !! html/parsoid
13919 <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>
13920 !! end
13921
13922 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13923 !! test
13924 Invalid image attributes (bug 62500)
13925 !! options
13926 thumbsize=220
13927 parsoid=wt2html,wt2wt,html2html
13928 !! wikitext
13929 [[File:Foobar.jpg|thumb|float|left|caption]]
13930
13931 [[File:Foobar.jpg|thumb|righ|caption]]
13932
13933 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13934 !! html/php
13935 <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>
13936 <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>
13937 <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>
13938
13939 !! html/parsoid
13940 <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>
13941 <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>
13942 <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>
13943 !! end
13944
13945 !! article
13946 File:Barfoo.jpg
13947 !! text
13948 #REDIRECT [[File:Barfoo.jpg]]
13949 !! endarticle
13950
13951 # FIXME: Parsoid should run this test -- but we'd need to teach the
13952 # mockAPI about the redirected Barfoo.jpg image.
13953 !! test
13954 Redirected image
13955 !! wikitext
13956 [[Image:Barfoo.jpg]]
13957 !! html/php
13958 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13959 </p>
13960 !! end
13961
13962 !! test
13963 Missing image with uploads disabled
13964 !! options
13965 wgEnableUploads=0
13966 !! wikitext
13967 [[File:Foobaz.jpg]]
13968 !! html/php
13969 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13970 </p>
13971 !! html/parsoid
13972 <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>
13973 !! end
13974
13975 # Parsoid-specific testing for images
13976 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13977 # Currently imperfect due to a flaw in the Parsoid testrunner
13978 # Work in progress
13979 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13980 # image tests.
13981
13982 !! test
13983 Parsoid-specific image handling - simple image with size and middle alignment
13984 !! wikitext
13985 [[File:Foobar.jpg|middle|50px]]
13986 !! html/parsoid
13987 <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>
13988 !! end
13989
13990 !! test
13991 Parsoid-specific image handling - simple image with size, middle alignment,
13992 non-standard namespace alias
13993 !! options
13994 parsoid=wt2wt,wt2html,html2html
13995 !! wikitext
13996 [[Image:Foobar.jpg|middle|50px]]
13997 !! html/parsoid
13998 <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>
13999 !! end
14000
14001 !! test
14002 Parsoid-specific image handling - simple image with size and middle alignment
14003 (existing content)
14004 !! wikitext
14005 [[File:Foobar.jpg|50px|middle]]
14006 !! html/parsoid
14007 <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>
14008 !! end
14009
14010 !! test
14011 Parsoid-specific image handling - simple image with size and middle alignment
14012 and non-standard namespace name
14013 !! options
14014 parsoid=wt2html,wt2wt,html2html
14015 !! wikitext
14016 [[Image:Foobar.jpg|50px|middle]]
14017 !! html/parsoid
14018 <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>
14019 !! end
14020
14021 !! test
14022 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14023 !! wikitext
14024 [[File:Foobar.jpg|500x10px|baseline|caption]]
14025 !! html/parsoid
14026 <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>
14027 !! end
14028
14029 !! test
14030 Parsoid-specific image handling - simple image with border and size spec
14031 !! wikitext
14032 [[File:Foobar.jpg|50px|border|caption]]
14033 !! html/parsoid
14034 <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>
14035 !! end
14036
14037 !! test
14038 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14039 !! wikitext
14040 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14041 !! html/parsoid
14042 <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>
14043 !! end
14044
14045 !! test
14046 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14047 (existing content)
14048 !! wikitext
14049 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14050 !! html/parsoid
14051 <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>
14052 !! end
14053
14054 !! test
14055 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14056 !! wikitext
14057 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14058 !! html/parsoid
14059 <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>
14060 !! end
14061
14062 !! test
14063 Parsoid-specific image handling - thumbnail with specific size, halign,
14064 valign, and caption (existing content)
14065 !! wikitext
14066 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14067 !! html/parsoid
14068 <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>
14069 !! end
14070
14071 !! test
14072 Parsoid-specific image handling - framed image with specific size and caption
14073 (size is ignored)
14074 !! options
14075 parsoid=wt2html,wt2wt,html2html
14076 !! wikitext
14077 [[File:Foobar.jpg|frame|500x50px|caption]]
14078 !! html/parsoid
14079 <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>
14080 !! end
14081
14082 !! test
14083 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14084 (size is ignored)
14085 !! options
14086 parsoid=wt2html,wt2wt,html2html
14087 !! wikitext
14088 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14089 !! html/parsoid
14090 <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>
14091 !! end
14092
14093 !! test
14094 Parsoid-specific image handling - frameless image with specific size, border, and caption
14095 !! wikitext
14096 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14097 !! html/parsoid
14098 <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>
14099 !! end
14100
14101 !! test
14102 Parsoid-specific image handling - simple image with a formatted caption
14103 !! wikitext
14104 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14105 !! html/parsoid
14106 <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>
14107 !! end
14108
14109 !! test
14110 Parsoid-specific image handling - caption with a template in it
14111 !! wikitext
14112 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14113 !! html/parsoid
14114 <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>
14115 !! end
14116
14117 !! test
14118 Parsoid-specific image handling - caption with unbalanced tags in it
14119 !! options
14120 parsoid=wt2html,wt2wt,html2html
14121 !! wikitext
14122 foo
14123 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14124 bar
14125 !! html/parsoid
14126 <p>foo</p>
14127 <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>
14128 <p>bar</p>
14129 !! end
14130
14131 !! test
14132 Parsoid-specific image handling - empty caption (1)
14133 !! options
14134 parsoid=wt2html,wt2wt
14135 !! wikitext
14136 [[File:Foobar.jpg|thumb|]]
14137 !! html/parsoid
14138 <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>
14139 !! end
14140
14141 # empty captions don't get serialized unless we're in the "round trip" case
14142 !! test
14143 Parsoid-specific image handling - empty caption (2)
14144 !! options
14145 parsoid=html2wt
14146 !! html/parsoid
14147 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14148 <a href="./File:Foobar.jpg">
14149 <img resource="./File:Foobar.jpg"
14150 src="//example.com/images/3/3a/Foobar.jpg"
14151 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14152 height="25" width="220"/>
14153 </a>
14154 <figcaption></figcaption>
14155 </figure>
14156 !! wikitext
14157 [[File:Foobar.jpg|thumb]]
14158 !! end
14159
14160 !! test
14161 Parsoid-specific image handling - whitespace caption
14162 !! wikitext
14163 [[File:Foobar.jpg|thumb| ]]
14164 !! html/parsoid
14165 <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>
14166 !! end
14167
14168 !! test
14169 Parsoid-specific image handling - lang option
14170 !! wikitext
14171 foo
14172 [[File:Foobar.svg|lang=de|caption]]
14173 bar
14174 !! html/parsoid
14175 <p>foo
14176 <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>
14177 bar</p>
14178 !! end
14179
14180 ## Edge case bugs in Parsoid from T93580
14181 !! test
14182 T93580: 1. Templated <ref> inside block images
14183 !! wikitext
14184 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14185
14186 <references />
14187 !! html/parsoid
14188 <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>
14189
14190 <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>
14191 !! end
14192
14193 !! test
14194 T93580: 2. <ref> inside inline images
14195 !! wikitext
14196 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14197
14198 <references />
14199 !! html/parsoid
14200 <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>
14201
14202 <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>
14203 !! end
14204
14205 !! test
14206 T93580: 3. Templated <ref> inside inline images
14207 !! wikitext
14208 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14209
14210 <references />
14211 !! html/parsoid
14212 <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>
14213
14214 <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>
14215 !! end
14216
14217 ###
14218 ### Subpages
14219 ###
14220 !! article
14221 Subpage test/subpage
14222 !! text
14223 foo
14224 !! endarticle
14225
14226 !! test
14227 Subpage link
14228 !! options
14229 subpage title=[[Subpage test]]
14230 !! wikitext
14231 [[/subpage]]
14232 !! html
14233 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14234 </p>
14235 !! end
14236
14237 !! test
14238 Subpage noslash link
14239 !! options
14240 subpage title=[[Subpage test]]
14241 !! wikitext
14242 [[/subpage/]]
14243 !! html
14244 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14245 </p>
14246 !! end
14247
14248 !! article
14249 Subpage test/1/2/subpage
14250 !! text
14251 blah
14252 !! endarticle
14253
14254 !! test
14255 Relative subpage noslash link
14256 !! options
14257 parsoid=wt2wt,wt2html,html2html
14258 subpage title=[[Subpage test/1/2/3/4]]
14259 !! wikitext
14260 [[../../subpage/]]
14261
14262 [[../../subpage]]
14263 !! html/php
14264 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14265 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14266 </p>
14267 !! html/parsoid
14268 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14269 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14270 !! end
14271
14272 !! test
14273 Parsoid: dot-slash prefixed wikilinks
14274 !! wikitext
14275 [[./foo]]
14276
14277 [[././bar]]
14278
14279 [[././baz/]]
14280 !! html/php
14281 <p>[[./foo]]
14282 </p><p>[[././bar]]
14283 </p><p>[[././baz/]]
14284 </p>
14285 !! html/parsoid
14286 <p>[[./foo]]
14287 </p><p>[[././bar]]
14288 </p><p>[[././baz/]]
14289 </p>
14290 !! end
14291
14292 !! test
14293 Render invalid page names as plain text (bug 51090)
14294 !! wikitext
14295 [[./../foo|bar]]
14296 [[foo�|bar]]
14297 [[foo/.|bar]]
14298 [[foo/..|bar]]
14299 [[foo~~~bar]]
14300 [[foo>bar]]
14301 [[foo[bar]]
14302 [[.]]
14303 [[..]]
14304 [[foo././bar]]
14305
14306 [[{{echo|./../foo}}|bar]]
14307 [[{{echo|foo/.}}|bar]]
14308 [[{{echo|foo/..}}|bar]]
14309 [[{{echo|foo~~~~bar}}]]
14310 [[{{echo|foo>bar}}]]
14311 [[{{echo|foo././bar}}]]
14312 [[{{echo|foo{bar}}]]
14313 [[{{echo|foo}bar}}]]
14314 [[{{echo|foo[bar}}]]
14315 [[{{echo|foo]bar}}]]
14316 [[{{echo|foo<bar}}]]
14317 !!html/php
14318 <p>[[./../foo|bar]]
14319 [[foo�|bar]]
14320 [[foo/.|bar]]
14321 [[foo/..|bar]]
14322 [[foo~~~bar]]
14323 [[foo&gt;bar]]
14324 [[foo[bar]]
14325 [[.]]
14326 [[..]]
14327 [[foo././bar]]
14328 </p><p>[[./../foo|bar]]
14329 [[foo/.|bar]]
14330 [[foo/..|bar]]
14331 [[foo~~~~bar]]
14332 [[foo&gt;bar]]
14333 [[foo././bar]]
14334 [[foo{bar]]
14335 [[foo}bar]]
14336 [[foo[bar]]
14337 [[foo]bar]]
14338 [[foo&lt;bar]]
14339 </p>
14340 !!html/parsoid
14341 <p>[[./../foo|bar]]
14342 [[foo�|bar]]
14343 [[foo/.|bar]]
14344 [[foo/..|bar]]
14345 [[foo~~~bar]]
14346 [[foo>bar]]
14347 [[foo[bar]]
14348 [[.]]
14349 [[..]]
14350 [[foo././bar]]</p>
14351
14352 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14353 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14354 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14355 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14356 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14357 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14358 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14359 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14360 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14361 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14362 [[<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>
14363 !!end
14364
14365 !! test
14366 Disabled subpages
14367 !! wikitext
14368 [[/subpage]]
14369 !! html
14370 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14371 </p>
14372 !! end
14373
14374 !! test
14375 BUG 561: {{/Subpage}}
14376 !! options
14377 subpage title=[[Page]]
14378 !! wikitext
14379 {{/Subpage}}
14380 !! html
14381 <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>
14382 </p>
14383 !! end
14384
14385 ###
14386 ### Categories
14387 ###
14388 !! article
14389 Category:MediaWiki User's Guide
14390 !! text
14391 blah
14392 !! endarticle
14393
14394 !! test
14395 Link to category
14396 !! wikitext
14397 [[:Category:MediaWiki User's Guide]]
14398 !! html
14399 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14400 </p>
14401 !! end
14402
14403 !! test
14404 Simple category
14405 !! options
14406 cat
14407 !! wikitext
14408 [[Category:MediaWiki User's Guide]]
14409 !! html
14410 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14411 !! end
14412
14413 !! test
14414 PAGESINCATEGORY invalid title fatal (r33546 fix)
14415 !! wikitext
14416 {{PAGESINCATEGORY:<bogus>}}
14417 !! html
14418 <p>0
14419 </p>
14420 !! end
14421
14422 !! test
14423 Category with different sort key
14424 !! options
14425 cat
14426 !! wikitext
14427 [[Category:MediaWiki User's Guide|Foo]]
14428 !! html
14429 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14430 !! end
14431
14432 !! test
14433 Category with identical sort key
14434 !! options
14435 cat
14436 !! wikitext
14437 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14438 !! html
14439 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14440 !! end
14441
14442 !! test
14443 Category with empty sort key
14444 !! options
14445 cat
14446 pst
14447 !! wikitext
14448 [[Category:MediaWiki User's Guide|]]
14449 !! html/php
14450 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14451 !! end
14452
14453 !! test
14454 Category with empty sort key and parentheses
14455 !! options
14456 cat
14457 pst
14458 !! wikitext
14459 [[Category:Foo (bar)|]]
14460 !! html/php
14461 [[Category:Foo (bar)|Foo]]
14462 !! end
14463
14464 ## We used to, but no longer wt2wt this test since the default serializer
14465 ## will normalize all categories to serialize on their own line.
14466 ## This wikitext usage is going to be fairly uncommon in production and
14467 ## selser will take care of preserving formatting in those scenarios.
14468 !! test
14469 Category with link tail
14470 !! options
14471 cat
14472 pst
14473 parsoid=wt2html
14474 !! wikitext
14475 123[[Category:Foo]]456
14476 !! html/php
14477 123[[Category:Foo]]456
14478 !! html/parsoid
14479 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14480 !! end
14481
14482 !! test
14483 Category with template
14484 !! options
14485 cat
14486 pst
14487 !! wikitext
14488 [[Category:{{echo|Foo}}]]
14489 !! html/php
14490 [[Category:{{echo|Foo}}]]
14491 !! end
14492
14493 !! test
14494 Category with template in sort key
14495 !! options
14496 cat
14497 pst
14498 !! wikitext
14499 [[Category:Foo|{{echo|Bar}}]]
14500 !! html/php
14501 [[Category:Foo|{{echo|Bar}}]]
14502 !! end
14503
14504 !! test
14505 Category with template in sort key and title
14506 !! options
14507 cat
14508 pst
14509 !! wikitext
14510 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14511 !! html/php
14512 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14513 !! end
14514
14515 ## We used to, but no longer wt2wt this test since the default serializer
14516 ## will normalize all categories to serialize on their own line.
14517 ## This wikitext usage is going to be fairly uncommon in production and
14518 ## selser will take care of preserving formatting in those scenarios.
14519 !! test
14520 Category / paragraph interactions
14521 !! options
14522 parsoid=wt2html
14523 !! wikitext
14524 Foo [[Category:Baz]] Bar
14525
14526 Foo [[Category:Baz]]
14527 Bar
14528
14529 Foo
14530 [[Category:Baz]]
14531 Bar
14532
14533 Foo
14534 [[Category:Baz]] Bar
14535
14536 Foo
14537 [[Category:Baz]]
14538 [[Category:Baz]]
14539 [[Category:Baz]]
14540 Bar
14541
14542 [[Category:Baz]]
14543 [[Category:Baz]]
14544 [[Category:Baz]]
14545
14546 [[Category:Baz]]
14547 {{echo|[[Category:Baz]]}}
14548 [[Category:Baz]]
14549 !! html/php
14550 <p>Foo Bar
14551 </p><p>Foo
14552 Bar
14553 </p><p>Foo
14554 Bar
14555 </p><p>Foo Bar
14556 </p><p>Foo
14557 Bar
14558 </p>
14559 !! html/parsoid
14560 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14561 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14562 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14563 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14564 <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>
14565 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14566 !! end
14567
14568 ## We used to, but no longer wt2wt this test since the default serializer
14569 ## will normalize all categories to serialize on their own line.
14570 ## This wikitext usage is going to be fairly uncommon in production and
14571 ## selser will take care of preserving formatting in those scenarios.
14572 ##
14573 ## The whitespace on the empty line is part of the test. Please do not delete
14574 !! test
14575 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14576 !! options
14577 parsoid=wt2html
14578 !! wikitext
14579 This
14580
14581 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14582
14583 {{echo|[[Category:Foo]] and so should this!}}
14584 !! html/php
14585 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14586 </p>
14587 !! html/parsoid
14588 <p>This
14589
14590 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14591
14592 <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>
14593 !! end
14594
14595 ## Parsoid will not try to wt2wt this while preserving newlines because
14596 ## it suppresses excess newlines within list items -- and we don't want to
14597 ## introduce a special case just for categories, which is, in reality somewhat
14598 ## odd behavior -- categories are unlikely to be used in list items like this
14599 ## in top-level pages and are only likely to show up in template-generated
14600 ## list items where this RT-ing is a non-issue.
14601 ##
14602 ## The whitespace on the empty line is part of the test. Please do not delete
14603 !! test
14604 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14605 !! options
14606 parsoid=wt2html
14607 !! wikitext
14608 * This
14609
14610 [[Category:Foo]] and this should be part of the same list item
14611 * So should this
14612
14613 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14614 !! html
14615 <ul><li>This and this should be part of the same list item</li>
14616 <li>So should this and this should be part of the same list item</li></ul>
14617 !! html/parsoid
14618 <ul>
14619 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14620 <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>
14621 </ul>
14622 !! end
14623
14624 ## Newlines and categories that follow the last item of a list
14625 ## are treated differently because this (list followed by categories)
14626 ## is an extremely common pattern on wikis.
14627 !! test
14628 3. Categories and newlines: newline suppression for last list item should RT properly
14629 !! wikitext
14630 * a
14631 * b
14632
14633 [[Category:Foo]]
14634
14635 [[Category:Bar]]
14636 [[Category:Baz]]
14637 !! html/parsoid
14638 <ul><li> a</li>
14639 <li> b</li></ul>
14640
14641 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14642
14643 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14644 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14645 !! end
14646
14647 !! test
14648 4. Categories and newlines: newline suppression for last list item should RT properly
14649 !! wikitext
14650 * a
14651 **** b
14652
14653 [[Category:Foo]]
14654 !! html/parsoid
14655 <ul><li> a
14656 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14657
14658 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14659 !! end
14660
14661 ## only wt2html for this to make sure the algo only applies to the rightmost path
14662 !! test
14663 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14664 !! options
14665 parsoid=wt2html
14666 !! wikitext
14667 * a
14668 ** b
14669 [[Category:Foo]]
14670 * c
14671 ** d
14672 [[Category:Foo]]
14673 !! html/parsoid
14674 <ul><li> a
14675 <ul><li> b
14676 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14677 <li> c
14678 <ul><li> d</li></ul></li></ul>
14679 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
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 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14688 !! options
14689 parsoid=wt2html
14690 !! wikitext
14691 * a [[Category:Foo]]
14692 !! html/parsoid
14693 <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>
14694 !! end
14695
14696 # This test also demonstrates because of newline+category tunneling
14697 # through the list hander, template wrapping doesn't expand to the
14698 # containing list when the list item swallows the category.
14699 !! test
14700 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14701 !! wikitext
14702 * {{echo|a
14703 [[Category:Foo]]}}
14704 !! html/parsoid
14705 <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
14706 </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>
14707 !! end
14708
14709 !! test
14710 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14711 !! wikitext
14712 * a
14713
14714 {{echo|[[Category:Foo]]
14715 [[Category:Bar]]}}
14716 [[Category:Baz]]
14717 !! html/parsoid
14718 <ul><li> a</li></ul>
14719
14720 <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">
14721 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14722 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14723 !! end
14724
14725 !! test
14726 Parsoid: Serialize link to category page with colon escape
14727 !! options
14728 parsoid
14729 !! wikitext
14730
14731 [[:Category:Foo]]
14732 [[:Category:Foo|Bar]]
14733 !! html
14734 <p>
14735 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14736 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14737 </p>
14738 !! end
14739
14740 # We used to, but no longer wt2wt this test since the default serializer
14741 # will normalize all categories to serialize on their own line.
14742 # This wikitext usage is going to be fairly uncommon in production and
14743 # selser will take care of preventing whitespace insertion if this
14744 # occurs in an article.
14745 #
14746 # html2html disabled for the same reason (whitespace insertion between
14747 # x and y).
14748 #
14749 # html2wt disabled because it localizes the "Category" namespace.
14750 !! test
14751 Link prefix/suffixes aren't applied to category links
14752 !! options
14753 parsoid=wt2html
14754 language=is
14755 !! wikitext
14756 x[[Category:Foo]]y
14757 !! html/php
14758 <p>xy
14759 </p>
14760 !! html/parsoid
14761 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14762 !! end
14763
14764 !! test
14765 Parsoid: Serialize link to file page with colon escape
14766 !! options
14767 parsoid
14768 !! wikitext
14769
14770 [[:File:Foo.png]]
14771 [[:File:Foo.png|Bar]]
14772 !! html
14773 <p>
14774 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14775 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14776 </p>
14777 !! end
14778
14779 !! test
14780 Parsoid: Serialize a genuine category link without colon escape
14781 !! options
14782 parsoid
14783 !! wikitext
14784 [[Category:Foo]]
14785 [[Category:Foo|Bar]]
14786 !! html
14787 <link rel="mw:PageProp/Category" href="./Category:Foo">
14788 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14789 !! end
14790
14791 !! test
14792 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14793 !! options
14794 parsoid=html2wt
14795 !! html/parsoid
14796 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14797 !! wikitext
14798 [[Category:Toxine bactérienne]]
14799 !! end
14800
14801 !! test
14802 Parsoid: Defaultsort
14803 !! wikitext
14804 {{DEFAULTSORT:Foo}}
14805 !! html/parsoid
14806 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14807 !! end
14808
14809 !! test
14810 Parsoid: Defaultsort (template-generated)
14811 !! wikitext
14812 {{{{echo|DEFAULTSORT}}:Foo}}
14813 !! html/parsoid
14814 <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}}]}'/>
14815 !! end
14816
14817 ###
14818 ### Inter-language links
14819 ###
14820 !! test
14821 Interlanguage links
14822 !! options
14823 ill
14824 !! wikitext
14825 [[es:Alimento]]
14826 [[fr:Nourriture]]
14827 [[zh:食品]]
14828 !! html/php
14829 es:Alimento fr:Nourriture zh:食品
14830 !! html/parsoid
14831 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14832 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14833 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14834 !! end
14835
14836 !! test
14837 Duplicate interlanguage links (bug 24502)
14838 !! options
14839 ill
14840 !! wikitext
14841 [[es:1]]
14842 [[es:2]]
14843 [[fr:1]]
14844 [[fr:2]]
14845 !! html/php
14846 es:1 fr:1
14847 !! html/parsoid
14848 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14849 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14850 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14851 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14852 !! end
14853
14854 ###
14855 ### Sections
14856 ###
14857 !! test
14858 Basic section headings
14859 !! wikitext
14860 == Headline 1 ==
14861 Some text
14862
14863 ==Headline 2==
14864 More
14865 ===Smaller headline===
14866 Blah blah
14867 !! html
14868 <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>
14869 <p>Some text
14870 </p>
14871 <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>
14872 <p>More
14873 </p>
14874 <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>
14875 <p>Blah blah
14876 </p>
14877 !! end
14878
14879 !! test
14880 Section headings with TOC
14881 !! wikitext
14882 == Headline 1 ==
14883 === Subheadline 1 ===
14884 ===== Skipping a level =====
14885 ====== Skipping a level ======
14886
14887 == Headline 2 ==
14888 Some text
14889 ===Another headline===
14890 !! html
14891 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14892 <ul>
14893 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14894 <ul>
14895 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14896 <ul>
14897 <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>
14898 <ul>
14899 <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>
14900 </ul>
14901 </li>
14902 </ul>
14903 </li>
14904 </ul>
14905 </li>
14906 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14907 <ul>
14908 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14909 </ul>
14910 </li>
14911 </ul>
14912 </div>
14913
14914 <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>
14915 <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>
14916 <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>
14917 <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>
14918 <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>
14919 <p>Some text
14920 </p>
14921 <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>
14922
14923 !! end
14924
14925 !! test
14926 TOC anchors don't collide
14927 !! wikitext
14928 __FORCETOC__
14929 == Headline 2 ==
14930 == Headline ==
14931 == Headline 2 ==
14932 == Headline ==
14933 !! html/php
14934 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14935 <ul>
14936 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14937 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14938 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14939 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14940 </ul>
14941 </div>
14942
14943 <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>
14944 <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>
14945 <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>
14946 <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>
14947
14948 !! end
14949
14950 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14951 !! test
14952 Handling of sections up to level 6 and beyond
14953 !! wikitext
14954 = Level 1 Heading=
14955 == Level 2 Heading==
14956 === Level 3 Heading===
14957 ==== Level 4 Heading====
14958 ===== Level 5 Heading=====
14959 ====== Level 6 Heading======
14960 ======= Level 7 Heading=======
14961 ======== Level 8 Heading========
14962 ========= Level 9 Heading=========
14963 ========== Level 10 Heading==========
14964 !! html
14965 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14966 <ul>
14967 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14968 <ul>
14969 <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>
14970 <ul>
14971 <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>
14972 <ul>
14973 <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>
14974 <ul>
14975 <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>
14976 <ul>
14977 <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>
14978 <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>
14979 <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>
14980 <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>
14981 <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>
14982 </ul>
14983 </li>
14984 </ul>
14985 </li>
14986 </ul>
14987 </li>
14988 </ul>
14989 </li>
14990 </ul>
14991 </li>
14992 </ul>
14993 </div>
14994
14995 <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>
14996 <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>
14997 <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>
14998 <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>
14999 <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>
15000 <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>
15001 <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>
15002 <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>
15003 <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>
15004 <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>
15005
15006 !! end
15007
15008 !! test
15009 TOC regression (T11764)
15010 !! wikitext
15011 == title 1 ==
15012 === title 1.1 ===
15013 ==== title 1.1.1 ====
15014 === title 1.2 ===
15015 == title 2 ==
15016 === title 2.1 ===
15017 !! html
15018 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15019 <ul>
15020 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15021 <ul>
15022 <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>
15023 <ul>
15024 <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>
15025 </ul>
15026 </li>
15027 <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>
15028 </ul>
15029 </li>
15030 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15031 <ul>
15032 <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>
15033 </ul>
15034 </li>
15035 </ul>
15036 </div>
15037
15038 <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>
15039 <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>
15040 <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>
15041 <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>
15042 <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>
15043 <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>
15044
15045 !! end
15046
15047 !! test
15048 TOC for heading containing <span id="..."></span> (T96153)
15049 !! wikitext
15050 __FORCETOC__
15051 ==<span id="old-anchor"></span>New title==
15052 !! html/php
15053 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15054 <ul>
15055 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15056 </ul>
15057 </div>
15058
15059 <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>
15060
15061 !! end
15062
15063 !! test
15064 TOC with wgMaxTocLevel=3 (bug 6204)
15065 !! options
15066 wgMaxTocLevel=3
15067 !! wikitext
15068 == title 1 ==
15069 === title 1.1 ===
15070 ==== title 1.1.1 ====
15071 === title 1.2 ===
15072 == title 2 ==
15073 === title 2.1 ===
15074 !! html
15075 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15076 <ul>
15077 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15078 <ul>
15079 <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>
15080 <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>
15081 </ul>
15082 </li>
15083 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15084 <ul>
15085 <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>
15086 </ul>
15087 </li>
15088 </ul>
15089 </div>
15090
15091 <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>
15092 <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>
15093 <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>
15094 <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>
15095 <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>
15096 <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>
15097
15098 !! end
15099
15100 !! test
15101 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15102 !! options
15103 wgMaxTocLevel=3
15104 !! wikitext
15105 ==Section 1==
15106 ===Section 1.1===
15107 ====Section 1.1.1====
15108 ====Section 1.1.1.1====
15109 ==Section 2==
15110 !! html
15111 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15112 <ul>
15113 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15114 <ul>
15115 <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>
15116 </ul>
15117 </li>
15118 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15119 </ul>
15120 </div>
15121
15122 <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>
15123 <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>
15124 <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>
15125 <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>
15126 <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>
15127
15128 !! end
15129
15130
15131 !! test
15132 Resolving duplicate section names
15133 !! wikitext
15134 == Foo bar ==
15135 == Foo bar ==
15136 !! html
15137 <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>
15138 <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>
15139
15140 !! end
15141
15142 !! test
15143 Resolving duplicate section names with differing case (bug 10721)
15144 !! wikitext
15145 == Foo bar ==
15146 == Foo Bar ==
15147 !! html
15148 <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>
15149 <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>
15150
15151 !! end
15152
15153 !! article
15154 Template:sections
15155 !! text
15156 ===Section 1===
15157 ==Section 2==
15158 !! endarticle
15159
15160 !! test
15161 Template with sections, __NOTOC__
15162 !! wikitext
15163 __NOTOC__
15164 ==Section 0==
15165 {{sections}}
15166 ==Section 4==
15167 !! html
15168 <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>
15169 <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>
15170 <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>
15171 <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>
15172
15173 !! end
15174
15175 !! test
15176 __NOEDITSECTION__ keyword
15177 !! wikitext
15178 __NOEDITSECTION__
15179 ==Section 1==
15180 ==Section 2==
15181 !! html
15182 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15183 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15184
15185 !! end
15186
15187 !! test
15188 Link inside a section heading
15189 !! wikitext
15190 ==Section with a [[Main Page|link]] in it==
15191 !! html
15192 <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>
15193
15194 !! end
15195
15196 !! test
15197 TOC regression (T14077)
15198 !! wikitext
15199 __TOC__
15200 == title 1 ==
15201 === title 1.1 ===
15202 == title 2 ==
15203 !! html
15204 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15205 <ul>
15206 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15207 <ul>
15208 <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>
15209 </ul>
15210 </li>
15211 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15212 </ul>
15213 </div>
15214
15215 <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>
15216 <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>
15217 <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>
15218
15219 !! end
15220
15221 !! test
15222 BUG 1219 URL next to image (good)
15223 !! wikitext
15224 http://example.com [[File:Foobar.jpg]]
15225 !! html/php
15226 <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>
15227 </p>
15228 !! html/parsoid
15229 <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>
15230 !!end
15231
15232 !! test
15233 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15234 !! wikitext
15235 ===
15236 The line above must have a trailing space!
15237 === <!--
15238 --> <!-- -->
15239 But just in case it doesn't...
15240 !! html
15241 <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>
15242 <p>The line above must have a trailing space!
15243 </p>
15244 <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>
15245 <p>But just in case it doesn't...
15246 </p>
15247 !! end
15248
15249 !! test
15250 Header with special characters (bug 25462)
15251 !! wikitext
15252 The tooltips shall not show entities to the user (ie. be double escaped)
15253
15254 == text > text ==
15255 section 1
15256
15257 == text < text ==
15258 section 2
15259
15260 == text & text ==
15261 section 3
15262
15263 == text ' text ==
15264 section 4
15265
15266 == text " text ==
15267 section 5
15268 !! html
15269 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15270 </p>
15271 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15272 <ul>
15273 <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>
15274 <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>
15275 <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>
15276 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15277 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15278 </ul>
15279 </div>
15280
15281 <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>
15282 <p>section 1
15283 </p>
15284 <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>
15285 <p>section 2
15286 </p>
15287 <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>
15288 <p>section 3
15289 </p>
15290 <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>
15291 <p>section 4
15292 </p>
15293 <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>
15294 <p>section 5
15295 </p>
15296 !! end
15297
15298 !! test
15299 Header with space, plus and underscore as entity
15300 !! wikitext
15301 Id should not contain + for spaces
15302
15303 == Space between Text ==
15304 section 1
15305
15306 == Space-Entity&#32;between&#32;Text ==
15307 section 2
15308
15309 == Plus+between+Text ==
15310 section 3
15311
15312 == Plus-Entity&#43;between&#43;Text ==
15313 section 4
15314
15315 == Underscore_between_Text ==
15316 section 5
15317
15318 == Underscore-Entity&#95;between&#95;Text ==
15319 section 6
15320
15321 [[#Space between Text]]
15322 [[#Space-Entity&#32;between&#32;Text]]
15323 [[#Plus+between+Text]]
15324 [[#Plus-Entity&#43;between&#43;Text]]
15325 [[#Underscore_between_Text]]
15326 [[#Underscore-Entity&#95;between&#95;Text]]
15327 !! html
15328 <p>Id should not contain + for spaces
15329 </p>
15330 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15331 <ul>
15332 <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>
15333 <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>
15334 <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>
15335 <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>
15336 <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>
15337 <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>
15338 </ul>
15339 </div>
15340
15341 <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>
15342 <p>section 1
15343 </p>
15344 <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>
15345 <p>section 2
15346 </p>
15347 <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>
15348 <p>section 3
15349 </p>
15350 <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>
15351 <p>section 4
15352 </p>
15353 <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>
15354 <p>section 5
15355 </p>
15356 <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>
15357 <p>section 6
15358 </p><p><a href="#Space_between_Text">#Space between Text</a>
15359 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15360 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15361 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15362 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15363 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15364 </p>
15365 !! end
15366
15367 !! test
15368 Headers with excess '=' characters
15369 (Are similar tests necessary beyond the 1st level?)
15370 !! wikitext
15371 =foo==
15372 ==foo=
15373 =''italic'' heading==
15374 ==''italic'' heading=
15375 !! html
15376 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15377 <ul>
15378 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15379 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15380 <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>
15381 <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>
15382 </ul>
15383 </div>
15384
15385 <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>
15386 <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>
15387 <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>
15388 <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>
15389
15390 !! end
15391
15392 !! test
15393 HTML headers vs TOC (bug 23393)
15394 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15395 !! wikitext
15396 <h1>Header 1</h1>
15397 == Header 1.1 ==
15398 == Header 1.2 ==
15399
15400 <h1>Header 2
15401 </h1>
15402 == Header 2.1 ==
15403 == Header 2.2 ==
15404 __NOEDITSECTION__
15405 !! html
15406 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15407 <ul>
15408 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15409 <ul>
15410 <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>
15411 <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>
15412 </ul>
15413 </li>
15414 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15415 <ul>
15416 <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>
15417 <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>
15418 </ul>
15419 </li>
15420 </ul>
15421 </div>
15422
15423 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15424 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15425 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15426 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15427 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15428 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15429
15430 !! end
15431
15432 !! test
15433 Single-line or multiline-comments can follow headings
15434 !! options
15435 parsoid=wt2html,wt2wt
15436 !! wikitext
15437 ==foo==<!---->
15438 ==bar==<!--c1-->
15439 ==baz==<!--
15440 c2
15441 c3-->
15442 !! html
15443 <h2><span class="mw-headline" id="foo">foo</span></h2>
15444 <h2><span class="mw-headline" id="bar">bar</span></h2>
15445 <h2><span class="mw-headline" id="baz">baz</span></h2>
15446
15447 !! end
15448
15449 !! test
15450 BUG 1219 URL next to image (broken)
15451 !! wikitext
15452 http://example.com[[File:Foobar.jpg]]
15453 !! html/php
15454 <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>
15455 </p>
15456 !! html/parsoid
15457 <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>
15458 !!end
15459
15460 !! test
15461 Bug 1186 news: in the middle of text
15462 !! wikitext
15463 http://en.wikinews.org/wiki/Wikinews:Workplace
15464 !! html
15465 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15466 </p>
15467 !!end
15468
15469
15470 !! test
15471 Namespaced link must have a title
15472 !! wikitext
15473 [[Project:]]
15474 !! html
15475 <p>[[Project:]]
15476 </p>
15477 !!end
15478
15479 !! test
15480 Namespaced link must have a title (bad fragment version)
15481 !! wikitext
15482 [[Project:#fragment]]
15483 !! html
15484 <p>[[Project:#fragment]]
15485 </p>
15486 !!end
15487
15488
15489 ###
15490 ### HTML tags and HTML attributes
15491 ###
15492
15493 !! test
15494 div with no attributes
15495 !! wikitext
15496 <div>HTML rocks</div>
15497 !! html
15498 <div>HTML rocks</div>
15499
15500 !! end
15501
15502 !! test
15503 div with double-quoted attribute
15504 !! wikitext
15505 <div id="rock">HTML rocks</div>
15506 !! html
15507 <div id="rock">HTML rocks</div>
15508
15509 !! end
15510
15511 !! test
15512 div with single-quoted attribute
15513 !! wikitext
15514 <div id='rock'>HTML rocks</div>
15515 !! html
15516 <div id="rock">HTML rocks</div>
15517
15518 !! end
15519
15520 !! test
15521 div with unquoted attribute
15522 !! wikitext
15523 <div id=rock>HTML rocks</div>
15524 !! html
15525 <div id="rock">HTML rocks</div>
15526
15527 !! end
15528
15529 !! test
15530 div with illegal double attributes
15531 !! wikitext
15532 <div id="a" id="b">HTML rocks</div>
15533 !! html
15534 <div id="b">HTML rocks</div>
15535
15536 !!end
15537
15538 !! test
15539 div with empty attribute value, space before equals
15540 !! options
15541 parsoid=wt2html,html2html
15542 !! wikitext
15543 <div class =>HTML rocks</div>
15544 !! html/php
15545 <div class="">HTML rocks</div>
15546
15547 !! html/parsoid
15548 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15549 !! end
15550
15551 !! test
15552 div with multiple empty attribute values
15553 !! options
15554 parsoid=wt2html,html2html
15555 !! wikitext
15556 <div id= title=>HTML rocks</div>
15557 !! html/php
15558 <div id="title.3D">HTML rocks</div>
15559
15560 !! html/parsoid
15561 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15562 !! end
15563
15564 !! test
15565 table with multiple empty attribute values
15566 !! options
15567 parsoid=wt2html,html2html
15568 !! wikitext
15569 {| title= id=
15570 | hi
15571 |}
15572 !! html/php
15573 <table title="id=">
15574 <tr>
15575 <td> hi
15576 </td></tr></table>
15577
15578 !! html/parsoid
15579 <table title="id=">
15580 <tbody><tr><td> hi</td></tr>
15581 </tbody></table>
15582 !! end
15583
15584 !! test
15585 div with braces in attribute value
15586 !! wikitext
15587 <div title="{}">Foo</div>
15588 !! html/php
15589 <div title="&#123;}">Foo</div>
15590
15591 !! html/parsoid
15592 <div title="{}">Foo</div>
15593 !! end
15594
15595 !! test
15596 div with empty attribute value, no space before equals
15597 !! options
15598 parsoid=wt2html,html2html
15599 !! wikitext
15600 <div class=>HTML rocks</div>
15601 !! html/php
15602 <div class="">HTML rocks</div>
15603
15604 !! html/parsoid
15605 <div class="">HTML rocks</div>
15606 !! end
15607
15608 !! test
15609 HTML multiple attributes correction
15610 !! wikitext
15611 <p class="error" class="awesome">Awesome!</p>
15612 !! html
15613 <p class="awesome">Awesome!</p>
15614
15615 !!end
15616
15617 !! test
15618 Table multiple attributes correction
15619 !! wikitext
15620 {|
15621 !+ class="error" class="awesome"| status
15622 |}
15623 !! html
15624 <table>
15625 <tr>
15626 <th class="awesome"> status
15627 </th></tr></table>
15628
15629 !!end
15630
15631 !! test
15632 DIV IN UPPERCASE
15633 !! wikitext
15634 <DIV ID="x">HTML ROCKS</DIV>
15635 !! html
15636 <div id="x">HTML ROCKS</div>
15637
15638 !!end
15639
15640 !! test
15641 Non-ASCII pseudo-tags are rendered as text
15642 !! wikitext
15643 <khyô>
15644 !! html
15645 <p>&lt;khyô&gt;
15646 </p>
15647 !! end
15648
15649 !! test
15650 Pseudo-tag with URL 'name' renders as url link
15651 !! wikitext
15652 <http://example.com/>
15653 !! html
15654 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15655 </p>
15656 !! end
15657
15658 !! test
15659 text with amp in the middle of nowhere
15660 !! wikitext
15661 Remember AT&T?
15662 !! html
15663 <p>Remember AT&amp;T?
15664 </p>
15665 !! end
15666
15667 !! test
15668 text with character entity: eacute
15669 !! wikitext
15670 I always thought &eacute; was a cute letter.
15671 !! html
15672 <p>I always thought &#233; was a cute letter.
15673 </p>
15674 !! html+tidy
15675 <p>I always thought é was a cute letter.</p>
15676 !! end
15677
15678 !! test
15679 text with entity-escaped character entity-like string: eacute
15680 !! wikitext
15681 I always thought &amp;eacute; was a cute letter.
15682 !! html
15683 <p>I always thought &amp;eacute; was a cute letter.
15684 </p>
15685 !! end
15686
15687 !! test
15688 text with undefined character entity: xacute
15689 !! wikitext
15690 I always thought &xacute; was a cute letter.
15691 !! html
15692 <p>I always thought &amp;xacute; was a cute letter.
15693 </p>
15694 !! end
15695
15696 !! test
15697 HTML5 tags
15698 !! wikitext
15699 <data value="5">five</data>
15700 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15701 <mark>This highlighted text</mark>
15702 !! html
15703 <p><data value="5">five</data>
15704 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15705 <mark>This highlighted text</mark>
15706 </p>
15707 !! end
15708
15709 !! test
15710 HTML tag with leading space is parsed as text
15711 !! wikitext
15712 < div>foo< /div>
15713 !! html
15714 <p>&lt; div&gt;foo&lt; /div&gt;
15715 </p>
15716 !! end
15717
15718 ###
15719 ### Nesting tests (see bug 41545, 50604, 51081)
15720 ###
15721
15722 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15723 # Note that html2wt is considerably more difficult if we use <b> in
15724 # the test case, instead of <big>
15725 !! test
15726 Ensure that HTML adoption agency algorithm is properly implemented.
15727 !! wikitext
15728 <big>X<big>Y</big>Z</big>
15729 !! html
15730 <p><big>X<big>Y</big>Z</big>
15731 </p>
15732 !! end
15733
15734 # This was bug 41545 in the PHP parser.
15735 # Note that tidy doesn't handle this correctly.
15736 !! test
15737 Nesting of <kbd>
15738 !! wikitext
15739 <kbd>X<kbd>Y</kbd>Z</kbd>
15740 !! html
15741 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15742 </p>
15743 !! end
15744
15745 # The following cases were bug 51081 in the PHP parser.
15746 # Note that there are some other nestable tags (b, i, etc) which are
15747 # not covered; see bug 51081 for discussion.
15748
15749 # Note that tidy doesn't handle this correctly.
15750 !! test
15751 Nesting of <em>
15752 !! wikitext
15753 <em>X<em>Y</em>Z</em>
15754 !! html
15755 <p><em>X<em>Y</em>Z</em>
15756 </p>
15757 !! end
15758
15759 # Note that tidy doesn't handle this correctly.
15760 !! test
15761 Nesting of <strong>
15762 !! wikitext
15763 <strong>X<strong>Y</strong>Z</strong>
15764 !! html
15765 <p><strong>X<strong>Y</strong>Z</strong>
15766 </p>
15767 !! end
15768
15769 !! test
15770 Nesting of <q>
15771 !! wikitext
15772 <q>X<q>Y</q>Z</q>
15773 !! html+tidy
15774 <p><q>X<q>Y</q>Z</q></p>
15775 !! end
15776
15777 # Note that tidy doesn't handle this correctly.
15778 !! test
15779 Nesting of <ruby>
15780 !! wikitext
15781 <ruby>X<ruby>Y</ruby>Z</ruby>
15782 !! html
15783 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15784 </p>
15785 !! end
15786
15787 # Note that tidy doesn't handle this correctly.
15788 !! test
15789 Nesting of <bdo>
15790 !! wikitext
15791 <bdo>X<bdo>Y</bdo>Z</bdo>
15792 !! html
15793 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15794 </p>
15795 !! end
15796
15797
15798 ###
15799 ### Media links
15800 ###
15801
15802 !! test
15803 Media link
15804 !! wikitext
15805 [[Media:Foobar.jpg]]
15806 !! html
15807 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15808 </p>
15809 !! end
15810
15811 !! test
15812 Media link with text
15813 !! wikitext
15814 [[Media:Foobar.jpg|A neat file to look at]]
15815 !! html
15816 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15817 </p>
15818 !! end
15819
15820 # FIXME: this is still bad HTML tag nesting
15821 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15822 !! test
15823 Media link with nasty text
15824 !! wikitext
15825 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15826 !! html
15827 <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>
15828
15829 !! html+tidy
15830 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15831 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15832 !! end
15833
15834 !! test
15835 Media link to nonexistent file (bug 1702)
15836 !! wikitext
15837 [[Media:No such.jpg]]
15838 !! html
15839 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15840 </p>
15841 !! end
15842
15843 !! test
15844 Image link to nonexistent file (bug 1850 - good)
15845 !! wikitext
15846 [[File:No_such.jpg]]
15847 !! html/php
15848 <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>
15849 </p>
15850 !! html/parsoid
15851 <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>
15852 !! end
15853
15854 !! test
15855 :Image link to nonexistent file (bug 1850 - bad)
15856 !! wikitext
15857 [[:Image:No such.jpg]]
15858 !! html/php
15859 <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>
15860 </p>
15861 !! html/parsoid
15862 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15863 !! end
15864
15865
15866
15867 !! test
15868 Character reference normalization in link text (bug 1938)
15869 !! wikitext
15870 [[Main Page|this&that]]
15871 !! html
15872 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15873 </p>
15874 !!end
15875
15876 !! article
15877 אַ
15878 !! text
15879 Test for unicode normalization
15880
15881 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15882 !! endarticle
15883
15884 !! test
15885 (bug 19451) Links should refer to the normalized form.
15886 !! wikitext
15887 [[&#xFB2E;]]
15888 [[&#x5d0;&#x5b7;]]
15889 [[&#x5d0;ַ]]
15890 [[א&#x5b7;]]
15891 [[אַ]]
15892 !! html
15893 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15894 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15895 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15896 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15897 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15898 </p>
15899 !! end
15900
15901 !! test
15902 Empty attribute crash test (bug 2067)
15903 !! wikitext
15904 <font color="">foo</font>
15905 !! html
15906 <p><font color="">foo</font>
15907 </p>
15908 !! end
15909
15910 !! test
15911 Empty attribute crash test single-quotes (bug 2067)
15912 !! wikitext
15913 <font color=''>foo</font>
15914 !! html
15915 <p><font color="">foo</font>
15916 </p>
15917 !! end
15918
15919 !! test
15920 Attribute test: equals, then nothing
15921 !! options
15922 parsoid=wt2html,html2html
15923 !! wikitext
15924 <font color=>foo</font>
15925 !! html/php
15926 <p><font color="">foo</font>
15927 </p>
15928 !! html/parsoid
15929 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15930 !! end
15931
15932 !! test
15933 Attribute test: unquoted value
15934 !! options
15935 parsoid=wt2html,html2html
15936 !! wikitext
15937 <font color=x>foo</font>
15938 !! html/php
15939 <p><font color="x">foo</font>
15940 </p>
15941 !! html/parsoid
15942 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15943 !! end
15944
15945 !! test
15946 Attribute test: unquoted but illegal value (hash)
15947 !! wikitext
15948 <font color=#x>foo</font>
15949 !! html
15950 <p><font color="#x">foo</font>
15951 </p>
15952 !! end
15953
15954 # Parsoid does not serialize to empty attribute syntax,
15955 # so wt2wt and html2wt cases are skipped
15956 !! test
15957 Attribute test: no value (T54330)
15958 !! options
15959 parsoid=wt2html,html2html
15960 !! wikitext
15961 <font color>foo</font>
15962 !! html/php
15963 <p><font color="">foo</font>
15964 </p>
15965 !! html/parsoid
15966 <p><font color="">foo</font></p>
15967 !! end
15968
15969 !! test
15970 Bug 2095: link with three closing brackets
15971 !! wikitext
15972 [[Main Page]]]
15973 !! html/php
15974 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15975 </p>
15976 !! html/parsoid
15977 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15978 !! end
15979
15980 !! test
15981 Bug 2095: link with pipe and three closing brackets
15982 !! wikitext
15983 [[Main Page|link]]]
15984 !! html/php
15985 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15986 </p>
15987 !! html/parsoid
15988 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15989 !! end
15990
15991 !! test
15992 Bug 2095: link with pipe and three closing brackets, version 2
15993 !! wikitext
15994 [[Main Page|[http://example.com/]]]
15995 !! html/php
15996 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15997 </p>
15998 !! html/parsoid
15999 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16000 !! end
16001
16002
16003 ###
16004 ### Safety
16005 ###
16006
16007 !! article
16008 Template:Dangerous attribute
16009 !! text
16010 " onmouseover="alert(document.cookie)
16011 !! endarticle
16012
16013 !! article
16014 Template:Dangerous style attribute
16015 !! text
16016 border-size: expression(alert(document.cookie))
16017 !! endarticle
16018
16019 !! article
16020 Template:Div style
16021 !! text
16022 <div style="float: right; {{{1}}}">Magic div</div>
16023 !! endarticle
16024
16025 !! test
16026 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16027 !! wikitext
16028 <div title="{{test}}"></div>
16029 !! html
16030 <div title="This is a test template"></div>
16031
16032 !! end
16033
16034 # Parsoid has enough context to handle this case
16035 !! test
16036 Bug 2304: HTML attribute safety (dangerous template; 2309)
16037 !! wikitext
16038 <div title="{{dangerous attribute}}"></div>
16039 !! html/php
16040 <div title=""></div>
16041
16042 !! html/parsoid
16043 <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>
16044 !! end
16045
16046 !! test
16047 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16048 !! wikitext
16049 <div style="{{dangerous style attribute}}"></div>
16050 !! html
16051 <div style="/* insecure input */"></div>
16052
16053 !! end
16054
16055 !! test
16056 Bug 2304: HTML attribute safety (safe parameter; 2309)
16057 !! wikitext
16058 {{div style|width: 200px}}
16059 !! html
16060 <div style="float: right; width: 200px">Magic div</div>
16061
16062 !! end
16063
16064 !! test
16065 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16066 !! wikitext
16067 {{div style|width: expression(alert(document.cookie))}}
16068 !! html
16069 <div style="/* insecure input */">Magic div</div>
16070
16071 !! end
16072
16073 !! test
16074 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16075 !! wikitext
16076 {{div style|"><script>alert(document.cookie)</script>}}
16077 !! html
16078 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16079
16080 !! end
16081
16082 !! test
16083 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16084 !! wikitext
16085 {{div style|" ><script>alert(document.cookie)</script>}}
16086 !! html
16087 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16088
16089 !! end
16090
16091 !! test
16092 Bug 2304: HTML attribute safety (link)
16093 !! wikitext
16094 <div title="[[Main Page]]"></div>
16095 !! html
16096 <div title="&#91;&#91;Main Page]]"></div>
16097
16098 !! end
16099
16100 !! test
16101 Bug 2304: HTML attribute safety (italics)
16102 !! wikitext
16103 <div title="''foobar''"></div>
16104 !! html
16105 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16106
16107 !! end
16108
16109 !! test
16110 Bug 2304: HTML attribute safety (bold)
16111 !! wikitext
16112 <div title="'''foobar'''"></div>
16113 !! html
16114 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16115
16116 !! end
16117
16118
16119 !! test
16120 Bug 2304: HTML attribute safety (ISBN)
16121 !! wikitext
16122 <div title="ISBN 1234567890"></div>
16123 !! html
16124 <div title="&#73;SBN 1234567890"></div>
16125
16126 !! end
16127
16128 !! test
16129 Bug 2304: HTML attribute safety (RFC)
16130 !! wikitext
16131 <div title="RFC 1234"></div>
16132 !! html
16133 <div title="&#82;FC 1234"></div>
16134
16135 !! end
16136
16137 !! test
16138 Bug 2304: HTML attribute safety (PMID)
16139 !! wikitext
16140 <div title="PMID 1234567890"></div>
16141 !! html
16142 <div title="&#80;MID 1234567890"></div>
16143
16144 !! end
16145
16146 !! test
16147 Bug 2304: HTML attribute safety (web link)
16148 !! wikitext
16149 <div title="http://example.com/"></div>
16150 !! html
16151 <div title="http&#58;//example.com/"></div>
16152
16153 !! end
16154
16155 !! test
16156 Bug 2304: HTML attribute safety (named web link)
16157 !! wikitext
16158 <div title="[http://example.com/ link]"></div>
16159 !! html
16160 <div title="&#91;http&#58;//example.com/ link]"></div>
16161
16162 !! end
16163
16164 !! test
16165 Bug 3244: HTML attribute safety (extension; safe)
16166 !! wikitext
16167 <div style="<nowiki>background:blue</nowiki>"></div>
16168 !! html
16169 <div style="background:blue"></div>
16170
16171 !! end
16172
16173 !! test
16174 Bug 3244: HTML attribute safety (extension; unsafe)
16175 !! wikitext
16176 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16177 !! html
16178 <div style="/* insecure input */"></div>
16179
16180 !! end
16181
16182 # More MSIE fun discovered by Tom Gilder
16183
16184 !! test
16185 MSIE CSS safety test: spurious slash
16186 !! wikitext
16187 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16188 !! html
16189 <div style="/* insecure input */">evil</div>
16190
16191 !! end
16192
16193 !! test
16194 MSIE CSS safety test: hex code
16195 !! wikitext
16196 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16197 !! html
16198 <div style="/* insecure input */">evil</div>
16199
16200 !! end
16201
16202 !! test
16203 MSIE CSS safety test: comment in url
16204 !! wikitext
16205 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16206 !! html
16207 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16208
16209 !! end
16210
16211 !! test
16212 MSIE CSS safety test: comment in expression
16213 !! wikitext
16214 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16215 !! html
16216 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16217
16218 !! end
16219
16220 !! test
16221 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16222 !! wikitext
16223 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16224 !! html
16225 <p style="/* invalid control char */">A</p>
16226
16227 !! end
16228
16229 !! test
16230 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16231 !! wikitext
16232 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16233 <div style="top:EXPRESSION(alert())">B</div>
16234 !! html
16235 <p style="/* insecure input */">A</p>
16236 <div style="/* insecure input */">B</div>
16237
16238 !! end
16239
16240 !! test
16241 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16242 !! wikitext
16243 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16244 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16245 !! html
16246 <div style="/* insecure input */">A</div>
16247 <p style="/* insecure input */">B</p>
16248
16249 !! end
16250
16251 !! test
16252 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16253 !! wikitext
16254 <div style="background-image:url⁽javascript:alert())">A</div>
16255 <div style="background-image:url₍javascript:alert())">B</div>
16256 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16257 !! html
16258 <div style="/* insecure input */">A</div>
16259 <div style="/* insecure input */">B</div>
16260 <p style="/* insecure input */">C</p>
16261
16262 !! end
16263
16264 # FIXME: Parsoid fails to sanitize this! See T58846.
16265 !! test
16266 Opera -o-link CSS
16267 !! wikitext
16268 <div
16269 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;"
16270 style="-o-link:attr(title);-o-link-source:current">X</div>
16271 !! html
16272 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16273
16274 !! end
16275
16276 !! test
16277 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16278 !! wikitext
16279 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16280 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16281 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16282 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16283 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16284 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16285 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16286 !! html
16287 <p style="/* insecure input */">A</p>
16288 <p style="/* insecure input */">B</p>
16289 <p style="/* insecure input */">C</p>
16290 <p style="/* insecure input */">D</p>
16291 <p style="/* insecure input */">E</p>
16292 <p style="/* insecure input */">F</p>
16293 <p style="/* insecure input */">G</p>
16294
16295 !! end
16296
16297 !! test
16298 Table attribute legitimate extension
16299 !! wikitext
16300 {|
16301 !+ style="<nowiki>color:blue</nowiki>"| status
16302 |}
16303 !! html
16304 <table>
16305 <tr>
16306 <th style="color:blue"> status
16307 </th></tr></table>
16308
16309 !!end
16310
16311 !! test
16312 Table attribute safety
16313 !! wikitext
16314 {|
16315 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16316 |}
16317 !! html
16318 <table>
16319 <tr>
16320 <th style="/* insecure input */"> status
16321 </th></tr></table>
16322
16323 !! end
16324
16325 !! test
16326 CSS line continuation 1
16327 !! wikitext
16328 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16329 !! html
16330 <div style="/* insecure input */"></div>
16331
16332 !! end
16333
16334 !! test
16335 CSS line continuation 2
16336 !! wikitext
16337 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16338 !! html
16339 <div style="/* invalid control char */"></div>
16340
16341 !! end
16342
16343 !! article
16344 Template:Identity
16345 !! text
16346 {{{1}}}
16347 !! endarticle
16348
16349 !! test
16350 Expansion of multi-line templates in attribute values (bug 6255)
16351 !! wikitext
16352 <div style="background: {{identity|#00FF00}}">-</div>
16353 !! html
16354 <div style="background: #00FF00">-</div>
16355
16356 !! end
16357
16358
16359 !! test
16360 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16361 !! wikitext
16362 <div style="background:
16363 #00FF00">-</div>
16364 !! html/php
16365 <div style="background: #00FF00">-</div>
16366
16367 !! html/parsoid
16368 <div style="background:
16369 #00FF00">-</div>
16370 !! end
16371
16372 !! test
16373 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16374 !! wikitext
16375 <div style="background: &#10;#00FF00">-</div>
16376 !! html
16377 <div style="background: &#10;#00FF00">-</div>
16378
16379 !! end
16380
16381 !! test
16382 evil <math>-wiki-tags without Extension:Math enabled
16383 !! wikitext
16384 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16385 !! html+tidy
16386 <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>
16387 !! end
16388
16389 ###
16390 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16391 ###
16392 !! test
16393 Parser hook: empty input
16394 !! wikitext
16395 <tag></tag>
16396 !! html/php
16397 <pre>
16398 ''
16399 array (
16400 )
16401 </pre>
16402
16403 !! html/parsoid
16404 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16405 !! end
16406
16407 ## Don't expect parsoid to rt this form.
16408 !! test
16409 Parser hook: empty input using terminated empty elements
16410 !! options
16411 parsoid=wt2html,html2html
16412 !! wikitext
16413 <tag/>
16414 !! html/php
16415 <pre>
16416 NULL
16417 array (
16418 )
16419 </pre>
16420
16421 !! html/parsoid
16422 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16423 !! end
16424
16425 !! test
16426 Parser hook: empty input using terminated empty elements (space before)
16427 !! wikitext
16428 <tag />
16429 !! html/php
16430 <pre>
16431 NULL
16432 array (
16433 )
16434 </pre>
16435
16436 !! html/parsoid
16437 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16438 !! end
16439
16440 !! test
16441 Parser hook: basic input
16442 !! wikitext
16443 <tag>input</tag>
16444 !! html/php
16445 <pre>
16446 'input'
16447 array (
16448 )
16449 </pre>
16450
16451 !! html/parsoid
16452 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16453 !! end
16454
16455 ## Don't expect parsoid to rt this form.
16456 !! test
16457 Parser hook: case insensitive
16458 !! options
16459 parsoid=wt2html,html2html
16460 !! wikitext
16461 <TAG>input</TAG>
16462 !! html/php
16463 <pre>
16464 'input'
16465 array (
16466 )
16467 </pre>
16468
16469 !! html/parsoid
16470 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16471 !! end
16472
16473 ## Don't expect parsoid to rt this form.
16474 !! test
16475 Parser hook: case insensitive, redux
16476 !! options
16477 parsoid=wt2html,html2html
16478 !! wikitext
16479 <TaG>input</TAg>
16480 !! html/php
16481 <pre>
16482 'input'
16483 array (
16484 )
16485 </pre>
16486
16487 !! html/parsoid
16488 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16489 !! end
16490
16491 !! test
16492 Parser hook: nested tags
16493 !! wikitext
16494 <tag><tag></tag></tag>
16495 !! html/php
16496 <pre>
16497 '<tag>'
16498 array (
16499 )
16500 </pre>&lt;/tag&gt;
16501
16502 !! html/parsoid
16503 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16504 !! end
16505
16506 !! test
16507 Parser hook: basic arguments
16508 !! wikitext
16509 <tag width="200" height="100" depth="50" square=""></tag>
16510 !! html/php
16511 <pre>
16512 ''
16513 array (
16514 'width' => '200',
16515 'height' => '100',
16516 'depth' => '50',
16517 'square' => '',
16518 )
16519 </pre>
16520
16521 !! html/parsoid
16522 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16523 !! end
16524
16525 ## Don't expect parsoid to rt this form.
16526 !! test
16527 Parser hook: basic arguments, variations
16528 !! options
16529 parsoid=wt2html,html2html
16530 !! wikitext
16531 <tag width=200 height = "100" depth = '50' square></tag>
16532 !! html/php
16533 <pre>
16534 ''
16535 array (
16536 'width' => '200',
16537 'height' => '100',
16538 'depth' => '50',
16539 'square' => '',
16540 )
16541 </pre>
16542
16543 !! html/parsoid
16544 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16545 !! end
16546
16547 !! test
16548 Parser hook: argument containing a forward slash (bug 5344)
16549 !! wikitext
16550 <tag filename="/tmp/bla"></tag>
16551 !! html/php
16552 <pre>
16553 ''
16554 array (
16555 'filename' => '/tmp/bla',
16556 )
16557 </pre>
16558
16559 !! html/parsoid
16560 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16561 !! end
16562
16563 ## Don't expect parsoid to rt this form.
16564 !! test
16565 Parser hook: empty input using terminated empty elements (bug 2374)
16566 !! options
16567 parsoid=wt2html,html2html
16568 !! wikitext
16569 <tag foo=bar/>text
16570 !! html/php
16571 <pre>
16572 NULL
16573 array (
16574 'foo' => 'bar',
16575 )
16576 </pre>text
16577
16578 !! html/parsoid
16579 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16580 !! end
16581
16582 ## </tag> should be output literally since there is no matching tag that begins it
16583 ## Don't expect parsoid to rt this form.
16584 !! test
16585 Parser hook: basic arguments using terminated empty elements (bug 2374)
16586 !! options
16587 parsoid=wt2html
16588 !! wikitext
16589 <tag width=200 height = "100" depth = '50' square/>
16590 other stuff
16591 </tag>
16592 !! html/php
16593 <pre>
16594 NULL
16595 array (
16596 'width' => '200',
16597 'height' => '100',
16598 'depth' => '50',
16599 'square' => '',
16600 )
16601 </pre>
16602 <p>other stuff
16603 &lt;/tag&gt;
16604 </p>
16605 !! html/parsoid
16606 <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
16607 &lt;/tag></p>
16608 !! end
16609
16610 ## Don't expect parsoid to rt this form.
16611 !! test
16612 Parser hook: Don't allow unclosed extension tags
16613 !! options
16614 parsoid=wt2html
16615 !! wikitext
16616 test <tag>123
16617
16618 this is a '''test'''
16619 !! html/php
16620 <p>test &lt;tag&gt;123
16621 </p><p>this is a <b>test</b>
16622 </p>
16623 !! html/parsoid
16624 <p>test &lt;tag>123</p>
16625
16626 <p>this is a <b>test</b></p>
16627 !! end
16628
16629 ###
16630 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16631 ###
16632
16633 !! test
16634 Parser hook: static parser hook not inside a comment
16635 !! wikitext
16636 <statictag>hello, world</statictag>
16637
16638 <statictag action="flush" />
16639 !! html/php
16640 <p><br />
16641 hello, world
16642 </p>
16643 !! html/parsoid
16644 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16645 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16646 !! end
16647
16648 !! test
16649 Parser hook: static parser hook inside a comment
16650 !! wikitext
16651 <!-- <statictag>hello, world</statictag> -->
16652 <statictag action="flush" />
16653 !! html/php
16654 <p><br />
16655 </p>
16656 !! html/parsoid
16657 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16658 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16659 !! end
16660
16661 # Nested template calls; this case was broken by Parser.php rev 1.506,
16662 # since reverted.
16663
16664 !! article
16665 Template:One-parameter
16666 !! text
16667 (My parameter is: {{{1}}})
16668 !! endarticle
16669
16670 !! article
16671 Template:Map-one-parameter
16672 !! text
16673 {{{{{1}}}|{{{2}}}}}
16674 !! endarticle
16675
16676 !! test
16677 Nested template calls
16678 !! wikitext
16679 {{Map-one-parameter|One-parameter|param}}
16680 !! html
16681 <p>(My parameter is: param)
16682 </p>
16683 !! end
16684
16685
16686 ###
16687 ### Sanitizer
16688 ###
16689
16690 # HTML+Tidy effectively strips out the empty tags completely
16691 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16692 # which Tidy would have done for the PHP parser had there been content inside it.
16693 !! test
16694 Sanitizer: Closing of open tags
16695 !! wikitext
16696 <s></s><table></table>
16697 !! html
16698 <s></s><table></table>
16699
16700 !! html/parsoid
16701 <p><s></s></p><table></table>
16702 !! end
16703
16704 !! test
16705 Sanitizer: Closing of open but not closed tags
16706 !! wikitext
16707 <s>foo
16708 !! html
16709 <p><s>foo</s>
16710 </p>
16711 !! end
16712
16713 !! test
16714 Sanitizer: Closing of closed but not open tags
16715 !! options
16716 parsoid=wt2html
16717 !! wikitext
16718 </s>
16719 !! html/php+tidy
16720 !! html/parsoid
16721 !! end
16722
16723 !! test
16724 Sanitizer: Closing of closed but not open table tags
16725 !! options
16726 parsoid=wt2html
16727 !! wikitext
16728 Table not started</td></tr></table>
16729 !! html/php+tidy
16730 <p>Table not started</p>
16731 !! html/parsoid
16732 <p>Table not started</p>
16733 !! end
16734
16735 !! test
16736 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16737 !! wikitext
16738 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16739 !! html
16740 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16741 </p>
16742 !! end
16743
16744 # In HTML5, the restrictions are that id must contain at least one character,
16745 # and must not contain any space characters.
16746 !! test
16747 Sanitizer: Validating the contents of the id attribute (bug 4515)
16748 !! options
16749 disabled
16750 !! wikitext
16751 <br id="" /><br id="a space" />
16752 !! html
16753 Something ...
16754 !! end
16755
16756 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16757 !! test
16758 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16759 !! options
16760 disabled
16761 !! wikitext
16762 <br id="foo" /><br id="foo" />
16763 !! html
16764 Something need to be done. foo-2 ?
16765 !! end
16766
16767 !! test
16768 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16769 !! wikitext
16770 <div itemscope>
16771 <meta itemprop="hello" content="world">
16772 <meta http-equiv="refresh" content="5">
16773 <meta itemprop="hello" http-equiv="refresh" content="5">
16774 <link itemprop="hello" href="{{SERVER}}">
16775 <link rel="stylesheet" href="{{SERVER}}">
16776 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16777 </div>
16778 !! html
16779 <div itemscope="">
16780 <p> <meta itemprop="hello" content="world" />
16781 &lt;meta http-equiv="refresh" content="5"&gt;
16782 <meta itemprop="hello" content="5" />
16783 </p>
16784 <link itemprop="hello" href="http&#58;//example.org" />
16785 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16786 <link itemprop="hello" href="http&#58;//example.org" />
16787 </div>
16788
16789 !! end
16790
16791 !! test
16792 Language converter: output gets cut off unexpectedly (bug 5757)
16793 !! options
16794 language=zh
16795 !! wikitext
16796 this bit is safe: }-
16797
16798 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16799
16800 then we get cut off here: }-
16801
16802 all additional text is vanished
16803 !! html
16804 <p>this bit is safe: }-
16805 </p><p>but if we add a conversion instance: xxx
16806 </p><p>then we get cut off here: }-
16807 </p><p>all additional text is vanished
16808 </p>
16809 !! end
16810
16811 !! test
16812 Self closed html pairs (bug 5487)
16813 !! options
16814 !! wikitext
16815 <center><font id="bug" />Centered text</center>
16816 <div><font id="bug2" />In div text</div>
16817 !! html
16818 <center>&lt;font id="bug" /&gt;Centered text</center>
16819 <div>&lt;font id="bug2" /&gt;In div text</div>
16820
16821 !! end
16822
16823 #
16824 #
16825 #
16826
16827 !! test
16828 Punctuation: nbsp before exclamation
16829 !! wikitext
16830 C'est grave !
16831 !! html
16832 <p>C'est grave&#160;!
16833 </p>
16834 !! end
16835
16836 !! test
16837 Punctuation: CSS !important (bug 11874)
16838 !! wikitext
16839 <div style="width:50% !important">important</div>
16840 !! html
16841 <div style="width:50% !important">important</div>
16842
16843 !!end
16844
16845 !! test
16846 Punctuation: CSS ! important (bug 11874; with space after)
16847 !! wikitext
16848 <div style="width:50% ! important">important</div>
16849 !! html
16850 <div style="width:50% ! important">important</div>
16851
16852 !!end
16853
16854 !! test
16855 HTML bullet list, closed tags (bug 5497)
16856 !! wikitext
16857 <ul>
16858 <li>One</li>
16859 <li>Two</li>
16860 </ul>
16861 !! html/php
16862 <ul>
16863 <li>One</li>
16864 <li>Two</li>
16865 </ul>
16866
16867 !! html/parsoid
16868 <ul data-parsoid='{"stx":"html"}'>
16869 <li data-parsoid='{"stx":"html"}'>One</li>
16870 <li data-parsoid='{"stx":"html"}'>Two</li>
16871 </ul>
16872
16873 !! end
16874
16875 !! test
16876 HTML bullet list, unclosed tags (bug 5497)
16877 !! wikitext
16878 <ul>
16879 <li>One
16880 <li>Two
16881 </ul>
16882 !! html/php+tidy
16883 <ul>
16884 <li>One</li>
16885 <li>Two</li>
16886 </ul>
16887 !! html/parsoid
16888 <ul data-parsoid='{"stx":"html"}'>
16889 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16890 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16891 </ul>
16892
16893 !! end
16894
16895 !! test
16896 HTML ordered list, closed tags (bug 5497)
16897 !! wikitext
16898 <ol>
16899 <li>One</li>
16900 <li>Two</li>
16901 </ol>
16902 !! html/php
16903 <ol>
16904 <li>One</li>
16905 <li>Two</li>
16906 </ol>
16907
16908 !! html/parsoid
16909 <ol data-parsoid='{"stx":"html"}'>
16910 <li data-parsoid='{"stx":"html"}'>One</li>
16911 <li data-parsoid='{"stx":"html"}'>Two</li>
16912 </ol>
16913
16914 !! end
16915
16916 !! test
16917 HTML ordered list, unclosed tags (bug 5497)
16918 !! options
16919 !! wikitext
16920 <ol>
16921 <li>One
16922 <li>Two
16923 </ol>
16924 !! html/php+tidy
16925 <ol>
16926 <li>One</li>
16927 <li>Two</li>
16928 </ol>
16929 !! html/parsoid
16930 <ol data-parsoid='{"stx":"html"}'>
16931 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16932 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16933 </ol>
16934
16935 !! end
16936
16937 !! test
16938 HTML nested bullet list, closed tags (bug 5497)
16939 !! wikitext
16940 <ul>
16941 <li>One</li>
16942 <li>Two:
16943 <ul>
16944 <li>Sub-one</li>
16945 <li>Sub-two</li>
16946 </ul>
16947 </li>
16948 </ul>
16949 !! html/php
16950 <ul>
16951 <li>One</li>
16952 <li>Two:
16953 <ul>
16954 <li>Sub-one</li>
16955 <li>Sub-two</li>
16956 </ul>
16957 </li>
16958 </ul>
16959
16960 !! html/parsoid
16961 <ul data-parsoid='{"stx":"html"}'>
16962 <li data-parsoid='{"stx":"html"}'>One</li>
16963 <li data-parsoid='{"stx":"html"}'>Two:
16964 <ul data-parsoid='{"stx":"html"}'>
16965 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
16966 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
16967 </ul>
16968 </li>
16969 </ul>
16970 !! end
16971
16972 !! test
16973 HTML nested bullet list, open tags (bug 5497)
16974 !! wikitext
16975 <ul>
16976 <li>One
16977 <li>Two:
16978 <ul>
16979 <li>Sub-one
16980 <li>Sub-two
16981 </ul>
16982 </ul>
16983 !! html/php+tidy
16984 <ul>
16985 <li>One</li>
16986 <li>Two:
16987 <ul>
16988 <li>Sub-one</li>
16989 <li>Sub-two</li>
16990 </ul>
16991 </li>
16992 </ul>
16993 !! html/parsoid
16994 <ul>
16995 <li>One
16996 </li>
16997 <li>Two:
16998 <ul>
16999 <li>Sub-one
17000 </li>
17001 <li>Sub-two
17002 </li>
17003 </ul>
17004 </li>
17005 </ul>
17006
17007 !! end
17008
17009 !! test
17010 HTML nested ordered list, closed tags (bug 5497)
17011 !! wikitext
17012 <ol>
17013 <li>One</li>
17014 <li>Two:
17015 <ol>
17016 <li>Sub-one</li>
17017 <li>Sub-two</li>
17018 </ol>
17019 </li>
17020 </ol>
17021 !! html
17022 <ol>
17023 <li>One</li>
17024 <li>Two:
17025 <ol>
17026 <li>Sub-one</li>
17027 <li>Sub-two</li>
17028 </ol>
17029 </li>
17030 </ol>
17031
17032 !! end
17033
17034 !! test
17035 HTML nested ordered list, open tags (bug 5497)
17036 !! wikitext
17037 <ol>
17038 <li>One
17039 <li>Two:
17040 <ol>
17041 <li>Sub-one
17042 <li>Sub-two
17043 </ol>
17044 </ol>
17045 !! html/php
17046 <ol>
17047 <li>One
17048 <li>Two:
17049 <ol>
17050 <li>Sub-one
17051 <li>Sub-two
17052 </ol>
17053 </ol>
17054
17055 !! html/parsoid
17056 <ol>
17057 <li>One
17058 </li>
17059 <li>Two:
17060 <ol>
17061 <li>Sub-one
17062 </li>
17063 <li>Sub-two
17064 </li>
17065 </ol>
17066 </li>
17067 </ol>
17068
17069 !! end
17070
17071 !! test
17072 HTML ordered list item with parameters oddity
17073 !! wikitext
17074 <ol><li id="fragment">One</li>
17075 </ol>
17076 !! html
17077 <ol><li id="fragment">One</li>
17078 </ol>
17079
17080 !! end
17081
17082 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17083 !!test
17084 bug 5918: autonumbering
17085 !! wikitext
17086 [http://first/] [http://second] [ftp://ftp]
17087
17088 ftp://inlineftp
17089
17090 [mailto:enclosed@mail.tld With target]
17091
17092 [mailto:enclosed@mail.tld]
17093
17094 mailto:inline@mail.tld
17095 !! html/php
17096 <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>
17097 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17098 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17099 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17100 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17101 </p>
17102 !! html/parsoid
17103 <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>
17104 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17105 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17106 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17107 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17108 !! end
17109
17110
17111 #
17112 # Security and HTML correctness
17113 # From Nick Jenkins' fuzz testing
17114 #
17115
17116 !! test
17117 Fuzz testing: Parser13
17118 !! wikitext
17119 {|
17120 | http://a|
17121 !! html
17122 <table>
17123 <tr>
17124 <td>
17125 </td>
17126 </tr>
17127 </table>
17128
17129 !! end
17130
17131 !! test
17132 Fuzz testing: Parser14
17133 !! wikitext
17134 == onmouseover= ==
17135 http://__TOC__
17136 !! html
17137 <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>
17138 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17139 <ul>
17140 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17141 </ul>
17142 </div>
17143
17144
17145 !! html+tidy
17146 <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>
17147 <p>http://</p>
17148 <div id="toc" class="toc">
17149 <div id="toctitle">
17150 <h2>Contents</h2>
17151 </div>
17152 <ul>
17153 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17154 </ul>
17155 </div>
17156 <p></p>
17157 !! end
17158
17159 !! test
17160 Fuzz testing: Parser14-table
17161 !! options
17162 parsoid=wt2html,html2html
17163 !! wikitext
17164 ==a==
17165 {| STYLE=__TOC__
17166 !! html
17167 <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>
17168 <table style="&#95;_TOC&#95;_">
17169 <tr><td></td></tr>
17170 </table>
17171
17172 !! html+tidy
17173 <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>
17174 <table style="__TOC__">
17175 <tr>
17176 <td></td>
17177 </tr>
17178 </table>
17179 !! html/parsoid
17180 <h2>a</h2>
17181 <table style="__TOC__"></table>
17182 !! end
17183
17184 # Known to produce bogus xml (extra </td>)
17185 !! test
17186 Fuzz testing: Parser16
17187 !! wikitext
17188 {|
17189 !https://||||||
17190 !! html
17191 <table>
17192 <tr>
17193 <th>https://</th>
17194 <th></th>
17195 <th></th>
17196 <th>
17197 </td>
17198 </tr>
17199 </table>
17200
17201 !! html+tidy
17202 <table>
17203 <tr>
17204 <th>https://</th>
17205 <th></th>
17206 <th></th>
17207 <th></th>
17208 </tr>
17209 </table>
17210 !! end
17211
17212 !! test
17213 Fuzz testing: Parser21
17214 !! wikitext
17215 {|
17216 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17217 |
17218 !! html
17219 <table>
17220 <tr>
17221 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17222 </th>
17223 <td>
17224 </td>
17225 </tr>
17226 </table>
17227
17228 !! end
17229
17230 !! test
17231 Fuzz testing: Parser22
17232 !! wikitext
17233 http://===r:::https://b
17234
17235 {|
17236 !! html
17237 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17238 </p>
17239 <table>
17240 <tr><td></td></tr>
17241 </table>
17242
17243 !! end
17244
17245 # Known to produce bad XML for now
17246 !! test
17247 Fuzz testing: Parser24
17248 !! wikitext
17249 {|
17250 {{{|
17251 <u CLASS=
17252 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17253 <br style="onmouseover='alert(document.cookie);' " />
17254
17255 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17256 |
17257 !! html
17258 <table>
17259 {{{|
17260 <u class="&#124;">}}}} &gt;
17261 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17262
17263 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17264 <tr>
17265 <td></u>
17266 </td>
17267 </tr>
17268 </table>
17269
17270 !! end
17271
17272 # Note: the current result listed for this is not what the original one was,
17273 # but the original bug was JavaScript injection, which is fixed in any case.
17274 # It's not clear that the original result listed was any more correct than the
17275 # current one. Original result:
17276 # <p>{{{|
17277 # </p>
17278 # <li class="&#124;&#124;">
17279 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17280 !!test
17281 Fuzz testing: Parser25 (bug 6055)
17282 !! wikitext
17283 {{{
17284 |
17285 <LI CLASS=||
17286 >
17287 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17288 !! html
17289 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17290 </p>
17291 !! end
17292
17293 !!test
17294 Fuzz testing: URL adjacent extension (with space, clean)
17295 !! wikitext
17296 http://example.com <nowiki>junk</nowiki>
17297 !! html/php
17298 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17299 </p>
17300 !! html/parsoid
17301 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17302 !! end
17303
17304 !!test
17305 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17306 !! wikitext
17307 http://example.com<nowiki>junk</nowiki>
17308 !! html/php
17309 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17310 </p>
17311 !! html/parsoid
17312 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17313 !! end
17314
17315 !!test
17316 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17317 !! wikitext
17318 http://example.com<pre>junk</pre>
17319 !! html/php
17320 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17321
17322 !! html/php+tidy
17323 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17324 <pre>
17325 junk
17326 </pre>
17327 !! html/parsoid
17328 <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>
17329 !!end
17330
17331 !!test
17332 Fuzz testing: image with bogus manual thumbnail
17333 !! wikitext
17334 [[Image:foobar.jpg|thumbnail= ]]
17335 !! html/php
17336 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17337
17338 !! html/parsoid
17339 <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>
17340 !!end
17341
17342 !! test
17343 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17344 !! wikitext
17345 <pre dir="&#10;"></pre>
17346 !! html
17347 <pre dir="&#10;"></pre>
17348
17349 !! end
17350
17351 !! test
17352 Parsing optional HTML elements (Bug 6171)
17353 !! options
17354 !! wikitext
17355 <table>
17356 <tr>
17357 <td> Some tabular data</td>
17358 <td> More tabular data ...
17359 <td> And yet som tabular data</td>
17360 </tr>
17361 </table>
17362 !! html
17363 <table>
17364 <tr>
17365 <td> Some tabular data</td>
17366 <td> More tabular data ...
17367 </td><td> And yet som tabular data</td>
17368 </tr>
17369 </table>
17370
17371 !! end
17372
17373 !! test
17374 Correct handling of <td>, <tr> (Bug 6171)
17375 !! options
17376 !! wikitext
17377 <table>
17378 <tr>
17379 <td> Some tabular data</td>
17380 <td> More tabular data ...</td>
17381 <td> And yet som tabular data</td>
17382 </tr>
17383 </table>
17384 !! html
17385 <table>
17386 <tr>
17387 <td> Some tabular data</td>
17388 <td> More tabular data ...</td>
17389 <td> And yet som tabular data</td>
17390 </tr>
17391 </table>
17392
17393 !! end
17394
17395
17396 !! test
17397 Parsing crashing regression (fr:JavaScript)
17398 !! wikitext
17399 </body></x>
17400 !! html
17401 <p>&lt;/body&gt;&lt;/x&gt;
17402 </p>
17403 !! end
17404
17405 !! test
17406 Inline wiki vs wiki block nesting
17407 !! wikitext
17408 '''Bold paragraph
17409
17410 New wiki paragraph
17411 !! html
17412 <p><b>Bold paragraph</b>
17413 </p><p>New wiki paragraph
17414 </p>
17415 !! end
17416
17417 # FIXME: The current php output is documented
17418 # and desired output is the parsoid target.
17419 !! test
17420 Inline HTML vs wiki block nesting
17421 !! wikitext
17422 <b>Bold paragraph
17423
17424 New wiki paragraph
17425 !! html/php
17426 <p><b>Bold paragraph
17427 </p><p>New wiki paragraph</b>
17428 </p>
17429 !! html/parsoid
17430 <p><b>Bold paragraph</b>
17431 </p><p>New wiki paragraph
17432 </p>
17433 !! end
17434
17435 # Original result was this:
17436 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17437 # </p>
17438 # While that might be marginally more intuitive, maybe, the six-apostrophe
17439 # construct is clearly pathological and the result stated here (which is what
17440 # the parser actually does) is about as reasonable as anything.
17441 !!test
17442 Mixing markup for italics and bold
17443 !! options
17444 !! wikitext
17445 '''bold''''''bold''bolditalics'''''
17446 !! html
17447 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17448 </p>
17449 !! end
17450
17451
17452 !! article
17453 Xyzzyx
17454 !! text
17455 Article for special page transclusion test
17456 !! endarticle
17457
17458 !! test
17459 Special page transclusion
17460 !! options
17461 !! wikitext
17462 {{Special:Prefixindex/Xyzzyx}}
17463 !! html
17464 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17465 </ul>
17466
17467 !! end
17468
17469 !! test
17470 Special page transclusion twice (bug 5021)
17471 !! options
17472 !! wikitext
17473 {{Special:Prefixindex/Xyzzyx}}
17474 {{Special:Prefixindex/Xyzzyx}}
17475 !! html
17476 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17477 </ul>
17478 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17479 </ul>
17480
17481 !! end
17482
17483 !! test
17484 Transclusion of default MediaWiki message
17485 !! wikitext
17486 {{MediaWiki:Mainpage}}
17487 !! html
17488 <p>Main Page
17489 </p>
17490 !! end
17491
17492 !! test
17493 Transclusion of nonexistent MediaWiki message
17494 !! wikitext
17495 {{MediaWiki:Mainpagexxx}}
17496 !! html
17497 <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>
17498 </p>
17499 !! end
17500
17501 !! test
17502 Transclusion of MediaWiki message with underscore
17503 !! wikitext
17504 {{MediaWiki:history_short}}
17505 !! html
17506 <p>History
17507 </p>
17508 !! end
17509
17510 !! test
17511 Transclusion of MediaWiki message with space
17512 !! wikitext
17513 {{MediaWiki:history short}}
17514 !! html
17515 <p>History
17516 </p>
17517 !! end
17518
17519 !! test
17520 Invalid header with following text
17521 !! wikitext
17522 = x = y
17523 !! html
17524 <p>= x = y
17525 </p>
17526 !! end
17527
17528
17529 !! test
17530 Section extraction test (section 0)
17531 !! options
17532 section=0
17533 !! wikitext
17534 start
17535 ==a==
17536 ===aa===
17537 ====aaa====
17538 ==b==
17539 ===ba===
17540 ===bb===
17541 ====bba====
17542 ===bc===
17543 ==c==
17544 ===ca===
17545 !! html/php
17546 start
17547 !! end
17548
17549 !! test
17550 Section extraction test (section 1)
17551 !! options
17552 section=1
17553 !! wikitext
17554 start
17555 ==a==
17556 ===aa===
17557 ====aaa====
17558 ==b==
17559 ===ba===
17560 ===bb===
17561 ====bba====
17562 ===bc===
17563 ==c==
17564 ===ca===
17565 !! html/php
17566 ==a==
17567 ===aa===
17568 ====aaa====
17569 !! end
17570
17571 !! test
17572 Section extraction test (section 2)
17573 !! options
17574 section=2
17575 !! wikitext
17576 start
17577 ==a==
17578 ===aa===
17579 ====aaa====
17580 ==b==
17581 ===ba===
17582 ===bb===
17583 ====bba====
17584 ===bc===
17585 ==c==
17586 ===ca===
17587 !! html/php
17588 ===aa===
17589 ====aaa====
17590 !! end
17591
17592 !! test
17593 Section extraction test (section 3)
17594 !! options
17595 section=3
17596 !! wikitext
17597 start
17598 ==a==
17599 ===aa===
17600 ====aaa====
17601 ==b==
17602 ===ba===
17603 ===bb===
17604 ====bba====
17605 ===bc===
17606 ==c==
17607 ===ca===
17608 !! html/php
17609 ====aaa====
17610 !! end
17611
17612 !! test
17613 Section extraction test (section 4)
17614 !! options
17615 section=4
17616 !! wikitext
17617 start
17618 ==a==
17619 ===aa===
17620 ====aaa====
17621 ==b==
17622 ===ba===
17623 ===bb===
17624 ====bba====
17625 ===bc===
17626 ==c==
17627 ===ca===
17628 !! html/php
17629 ==b==
17630 ===ba===
17631 ===bb===
17632 ====bba====
17633 ===bc===
17634 !! end
17635
17636 !! test
17637 Section extraction test (section 5)
17638 !! options
17639 section=5
17640 !! wikitext
17641 start
17642 ==a==
17643 ===aa===
17644 ====aaa====
17645 ==b==
17646 ===ba===
17647 ===bb===
17648 ====bba====
17649 ===bc===
17650 ==c==
17651 ===ca===
17652 !! html/php
17653 ===ba===
17654 !! end
17655
17656 !! test
17657 Section extraction test (section 6)
17658 !! options
17659 section=6
17660 !! wikitext
17661 start
17662 ==a==
17663 ===aa===
17664 ====aaa====
17665 ==b==
17666 ===ba===
17667 ===bb===
17668 ====bba====
17669 ===bc===
17670 ==c==
17671 ===ca===
17672 !! html/php
17673 ===bb===
17674 ====bba====
17675 !! end
17676
17677 !! test
17678 Section extraction test (section 7)
17679 !! options
17680 section=7
17681 !! wikitext
17682 start
17683 ==a==
17684 ===aa===
17685 ====aaa====
17686 ==b==
17687 ===ba===
17688 ===bb===
17689 ====bba====
17690 ===bc===
17691 ==c==
17692 ===ca===
17693 !! html/php
17694 ====bba====
17695 !! end
17696
17697 !! test
17698 Section extraction test (section 8)
17699 !! options
17700 section=8
17701 !! wikitext
17702 start
17703 ==a==
17704 ===aa===
17705 ====aaa====
17706 ==b==
17707 ===ba===
17708 ===bb===
17709 ====bba====
17710 ===bc===
17711 ==c==
17712 ===ca===
17713 !! html/php
17714 ===bc===
17715 !! end
17716
17717 !! test
17718 Section extraction test (section 9)
17719 !! options
17720 section=9
17721 !! wikitext
17722 start
17723 ==a==
17724 ===aa===
17725 ====aaa====
17726 ==b==
17727 ===ba===
17728 ===bb===
17729 ====bba====
17730 ===bc===
17731 ==c==
17732 ===ca===
17733 !! html/php
17734 ==c==
17735 ===ca===
17736 !! end
17737
17738 !! test
17739 Section extraction test (section 10)
17740 !! options
17741 section=10
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 ===ca===
17756 !! end
17757
17758 !! test
17759 Section extraction test (nonexistent section 11)
17760 !! options
17761 section=11
17762 !! wikitext
17763 start
17764 ==a==
17765 ===aa===
17766 ====aaa====
17767 ==b==
17768 ===ba===
17769 ===bb===
17770 ====bba====
17771 ===bc===
17772 ==c==
17773 ===ca===
17774 !! html/php
17775 !! end
17776
17777 !! test
17778 Section extraction test with bogus heading (section 1)
17779 !! options
17780 section=1
17781 !! wikitext
17782 ==a==
17783 ==bogus== not a legal section
17784 ==b==
17785 !! html/php
17786 ==a==
17787 ==bogus== not a legal section
17788 !! end
17789
17790 !! test
17791 Section extraction test with bogus heading (section 2)
17792 !! options
17793 section=2
17794 !! wikitext
17795 ==a==
17796 ==bogus== not a legal section
17797 ==b==
17798 !! html/php
17799 ==b==
17800 !! end
17801
17802 !! test
17803 Section extraction test with comment after heading (section 1)
17804 !! options
17805 section=1
17806 !! wikitext
17807 ==a==
17808 ==b== <!-- -->
17809 ==c==
17810 !! html/php
17811 ==a==
17812 !! end
17813
17814 !! test
17815 Section extraction test with comment after heading (section 2)
17816 !! options
17817 section=2
17818 !! wikitext
17819 ==a==
17820 ==b== <!-- -->
17821 ==c==
17822 !! html/php
17823 ==b== <!-- -->
17824 !! end
17825
17826 !! test
17827 Section extraction test with bogus <nowiki> heading (section 1)
17828 !! options
17829 section=1
17830 !! wikitext
17831 ==a==
17832 ==bogus== <nowiki>not a legal section</nowiki>
17833 ==b==
17834 !! html/php
17835 ==a==
17836 ==bogus== <nowiki>not a legal section</nowiki>
17837 !! end
17838
17839 !! test
17840 Section extraction test with bogus <nowiki> heading (section 2)
17841 !! options
17842 section=2
17843 !! wikitext
17844 ==a==
17845 ==bogus== <nowiki>not a legal section</nowiki>
17846 ==b==
17847 !! html/php
17848 ==b==
17849 !! end
17850
17851 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17852 # instead of respecting commented sections
17853 !! test
17854 Section extraction prefixed by comment (section 1)
17855 !! options
17856 section=1
17857 !! wikitext
17858 <!-- -->==sec1==
17859 ==sec2==
17860 !! html/php
17861 ==sec2==
17862 !!end
17863
17864 !! test
17865 Section extraction prefixed by comment (section 2)
17866 !! options
17867 section=2
17868 !! wikitext
17869 <!-- -->==sec1==
17870 ==sec2==
17871 !! html/php
17872
17873 !!end
17874
17875 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17876 # instead of respecting HTML-style headings
17877 !! test
17878 Section extraction, mixed wiki and html (section 1)
17879 !! options
17880 section=1
17881 !! wikitext
17882 <h2>unmarked</h2>
17883 unmarked
17884 ==1==
17885 one
17886 ==2==
17887 two
17888 !! html/php
17889 ==1==
17890 one
17891 !! end
17892
17893 !! test
17894 Section extraction, mixed wiki and html (section 2)
17895 !! options
17896 section=2
17897 !! wikitext
17898 <h2>unmarked</h2>
17899 unmarked
17900 ==1==
17901 one
17902 ==2==
17903 two
17904 !! html/php
17905 ==2==
17906 two
17907 !! end
17908
17909
17910 # Formerly testing for bug 3342
17911 !! test
17912 Section extraction, heading surrounded by <noinclude>
17913 !! options
17914 section=1
17915 !! wikitext
17916 <noinclude>==unmarked==</noinclude>
17917 ==marked==
17918 !! html/php
17919 ==marked==
17920 !!end
17921
17922 # Test behavior of bug 19910
17923 !! test
17924 Sectiion with all-equals
17925 !! options
17926 section=2
17927 !! wikitext
17928 ===
17929 The line above must have a trailing space
17930 === <!--
17931 --> <!-- -->
17932 But just in case it doesn't...
17933 !! html/php
17934 === <!--
17935 --> <!-- -->
17936 But just in case it doesn't...
17937 !! end
17938
17939 !! test
17940 Section replacement test (section 0)
17941 !! options
17942 replace=0,"xxx"
17943 !! wikitext
17944 start
17945 ==a==
17946 ===aa===
17947 ====aaa====
17948 ==b==
17949 ===ba===
17950 ===bb===
17951 ====bba====
17952 ===bc===
17953 ==c==
17954 ===ca===
17955 !! html/php
17956 xxx
17957
17958 ==a==
17959 ===aa===
17960 ====aaa====
17961 ==b==
17962 ===ba===
17963 ===bb===
17964 ====bba====
17965 ===bc===
17966 ==c==
17967 ===ca===
17968 !! end
17969
17970 !! test
17971 Section replacement test (section 1)
17972 !! options
17973 replace=1,"xxx"
17974 !! wikitext
17975 start
17976 ==a==
17977 ===aa===
17978 ====aaa====
17979 ==b==
17980 ===ba===
17981 ===bb===
17982 ====bba====
17983 ===bc===
17984 ==c==
17985 ===ca===
17986 !! html/php
17987 start
17988 xxx
17989
17990 ==b==
17991 ===ba===
17992 ===bb===
17993 ====bba====
17994 ===bc===
17995 ==c==
17996 ===ca===
17997 !! end
17998
17999 !! test
18000 Section replacement test (section 2)
18001 !! options
18002 replace=2,"xxx"
18003 !! wikitext
18004 start
18005 ==a==
18006 ===aa===
18007 ====aaa====
18008 ==b==
18009 ===ba===
18010 ===bb===
18011 ====bba====
18012 ===bc===
18013 ==c==
18014 ===ca===
18015 !! html/php
18016 start
18017 ==a==
18018 xxx
18019
18020 ==b==
18021 ===ba===
18022 ===bb===
18023 ====bba====
18024 ===bc===
18025 ==c==
18026 ===ca===
18027 !! end
18028
18029 !! test
18030 Section replacement test (section 3)
18031 !! options
18032 replace=3,"xxx"
18033 !! wikitext
18034 start
18035 ==a==
18036 ===aa===
18037 ====aaa====
18038 ==b==
18039 ===ba===
18040 ===bb===
18041 ====bba====
18042 ===bc===
18043 ==c==
18044 ===ca===
18045 !! html/php
18046 start
18047 ==a==
18048 ===aa===
18049 xxx
18050
18051 ==b==
18052 ===ba===
18053 ===bb===
18054 ====bba====
18055 ===bc===
18056 ==c==
18057 ===ca===
18058 !! end
18059
18060 !! test
18061 Section replacement test (section 4)
18062 !! options
18063 replace=4,"xxx"
18064 !! wikitext
18065 start
18066 ==a==
18067 ===aa===
18068 ====aaa====
18069 ==b==
18070 ===ba===
18071 ===bb===
18072 ====bba====
18073 ===bc===
18074 ==c==
18075 ===ca===
18076 !! html/php
18077 start
18078 ==a==
18079 ===aa===
18080 ====aaa====
18081 xxx
18082
18083 ==c==
18084 ===ca===
18085 !! end
18086
18087 !! test
18088 Section replacement test (section 5)
18089 !! options
18090 replace=5,"xxx"
18091 !! wikitext
18092 start
18093 ==a==
18094 ===aa===
18095 ====aaa====
18096 ==b==
18097 ===ba===
18098 ===bb===
18099 ====bba====
18100 ===bc===
18101 ==c==
18102 ===ca===
18103 !! html/php
18104 start
18105 ==a==
18106 ===aa===
18107 ====aaa====
18108 ==b==
18109 xxx
18110
18111 ===bb===
18112 ====bba====
18113 ===bc===
18114 ==c==
18115 ===ca===
18116 !! end
18117
18118 !! test
18119 Section replacement test (section 6)
18120 !! options
18121 replace=6,"xxx"
18122 !! wikitext
18123 start
18124 ==a==
18125 ===aa===
18126 ====aaa====
18127 ==b==
18128 ===ba===
18129 ===bb===
18130 ====bba====
18131 ===bc===
18132 ==c==
18133 ===ca===
18134 !! html/php
18135 start
18136 ==a==
18137 ===aa===
18138 ====aaa====
18139 ==b==
18140 ===ba===
18141 xxx
18142
18143 ===bc===
18144 ==c==
18145 ===ca===
18146 !! end
18147
18148 !! test
18149 Section replacement test (section 7)
18150 !! options
18151 replace=7,"xxx"
18152 !! wikitext
18153 start
18154 ==a==
18155 ===aa===
18156 ====aaa====
18157 ==b==
18158 ===ba===
18159 ===bb===
18160 ====bba====
18161 ===bc===
18162 ==c==
18163 ===ca===
18164 !! html/php
18165 start
18166 ==a==
18167 ===aa===
18168 ====aaa====
18169 ==b==
18170 ===ba===
18171 ===bb===
18172 xxx
18173
18174 ===bc===
18175 ==c==
18176 ===ca===
18177 !! end
18178
18179 !! test
18180 Section replacement test (section 8)
18181 !! options
18182 replace=8,"xxx"
18183 !! wikitext
18184 start
18185 ==a==
18186 ===aa===
18187 ====aaa====
18188 ==b==
18189 ===ba===
18190 ===bb===
18191 ====bba====
18192 ===bc===
18193 ==c==
18194 ===ca===
18195 !! html/php
18196 start
18197 ==a==
18198 ===aa===
18199 ====aaa====
18200 ==b==
18201 ===ba===
18202 ===bb===
18203 ====bba====
18204 xxx
18205
18206 ==c==
18207 ===ca===
18208 !!end
18209
18210 !! test
18211 Section replacement test (section 9)
18212 !! options
18213 replace=9,"xxx"
18214 !! wikitext
18215 start
18216 ==a==
18217 ===aa===
18218 ====aaa====
18219 ==b==
18220 ===ba===
18221 ===bb===
18222 ====bba====
18223 ===bc===
18224 ==c==
18225 ===ca===
18226 !! html/php
18227 start
18228 ==a==
18229 ===aa===
18230 ====aaa====
18231 ==b==
18232 ===ba===
18233 ===bb===
18234 ====bba====
18235 ===bc===
18236 xxx
18237 !! end
18238
18239 !! test
18240 Section replacement test (section 10)
18241 !! options
18242 replace=10,"xxx"
18243 !! wikitext
18244 start
18245 ==a==
18246 ===aa===
18247 ====aaa====
18248 ==b==
18249 ===ba===
18250 ===bb===
18251 ====bba====
18252 ===bc===
18253 ==c==
18254 ===ca===
18255 !! html/php
18256 start
18257 ==a==
18258 ===aa===
18259 ====aaa====
18260 ==b==
18261 ===ba===
18262 ===bb===
18263 ====bba====
18264 ===bc===
18265 ==c==
18266 xxx
18267 !! end
18268
18269 !! test
18270 Section replacement test with initial whitespace (bug 13728)
18271 !! options
18272 replace=2,"xxx"
18273 !! wikitext
18274 Preformatted initial line
18275 ==a==
18276 ===a===
18277 !! html/php
18278 Preformatted initial line
18279 ==a==
18280 xxx
18281 !! end
18282
18283
18284 !! test
18285 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18286 !! options
18287 section=1
18288 !! wikitext
18289 ==a==
18290 a
18291 !! html/php
18292 ==a==
18293 a
18294 !! end
18295
18296 !! test
18297 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18298 !! options
18299 section=1
18300 !! wikitext
18301 ==a==
18302 a
18303 !! html/php
18304 ==a==
18305 a
18306 !! end
18307
18308
18309 !! test
18310 Section extraction, <pre> around bogus header (bug 10309)
18311 !! options
18312 section=2
18313 !! wikitext
18314 == Section One ==
18315 <pre>
18316 =======
18317 </pre>
18318
18319 == Section Two ==
18320 stuff
18321 !! html/php
18322 == Section Two ==
18323 stuff
18324 !! end
18325
18326 !! test
18327 Section replacement, <pre> around bogus header (bug 10309)
18328 !! options
18329 replace=2,"xxx"
18330 !! wikitext
18331 == Section One ==
18332 <pre>
18333 =======
18334 </pre>
18335
18336 == Section Two ==
18337 stuff
18338 !! html/php
18339 == Section One ==
18340 <pre>
18341 =======
18342 </pre>
18343
18344 xxx
18345 !! end
18346
18347
18348 !! test
18349 Handling of &#x0A; in URLs
18350 !! wikitext
18351 ** irc://&#x0A;a
18352 !! html/php
18353 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18354
18355 !! html/parsoid
18356 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18357 a">irc://
18358 a</a></li></ul></li></ul>
18359 !! end
18360
18361 !! test
18362 Handling of %0A in URLs
18363 !! wikitext
18364 ** irc://%0Aa
18365 !! html/php
18366 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18367
18368 !! html/parsoid
18369 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18370 !! end
18371
18372
18373 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18374 !! test
18375 5 quotes, code coverage +1 line
18376 !! options
18377 parsoid=wt2html
18378 !! wikitext
18379 '''''
18380 !! html/php
18381 !! html/parsoid
18382 <p><b><i></i></b></p>
18383 !! end
18384
18385 # same html as previous, but wikitext adjusted to match parsoid html2wt
18386 # note that wt2html and html2html will put the <i> before the <b>
18387 !! test
18388 5 quotes, code coverage +1 line w/ nowiki (1)
18389 !! options
18390 parsoid=wt2wt,html2wt
18391 !! wikitext
18392 '''''<nowiki/>'''''
18393 !! html/php
18394 <p><i></i>
18395 </p>
18396 !! html/parsoid
18397 <p><b><i></i></b></p>
18398 !! end
18399
18400 # same as previous, just swapping the <i> and <b>
18401 !! test
18402 5 quotes, code coverage +1 line w/ nowiki (2)
18403 !! wikitext
18404 '''''<nowiki/>'''''
18405 !! html/php
18406 <p><i></i>
18407 </p>
18408 !! html/parsoid
18409 <p><i><b></b></i></p>
18410 !! end
18411
18412 !! test
18413 Special:Search page linking.
18414 !! wikitext
18415 {{Special:search}}
18416 !! html
18417 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18418 </p>
18419 !! end
18420
18421 !! test
18422 {{!}} is a magic word
18423 !! wikitext
18424 {{!}} is a magic word there and {{!}} is still a magic word here
18425 | is not a magic word here but {{!}} is still a magic word here
18426 !! html/php
18427 <p>| is a magic word there and | is still a magic word here
18428 | is not a magic word here but | is still a magic word here
18429 </p>
18430 !! html/parsoid
18431 <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
18432 | 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>
18433
18434 !! end
18435
18436 !! test
18437 Say the magic word
18438 !! options
18439 title=[[Parser test]]
18440 !! wikitext
18441 * {{PAGENAME}}
18442 * {{PAGENAMEE}}
18443 * {{FULLPAGENAME}}
18444 * {{FULLPAGENAMEE}}
18445 * {{BASEPAGENAME}}
18446 * {{BASEPAGENAMEE}}
18447 * {{SUBPAGENAME}}
18448 * {{SUBPAGENAMEE}}
18449 * {{ROOTPAGENAME}}
18450 * {{ROOTPAGENAMEE}}
18451 * {{TALKPAGENAME}}
18452 * {{TALKPAGENAMEE}}
18453 * {{SUBJECTPAGENAME}}
18454 * {{SUBJECTPAGENAMEE}}
18455 * {{NAMESPACEE}}
18456 * {{NAMESPACE}}
18457 * {{NAMESPACENUMBER}}
18458 * {{TALKSPACE}}
18459 * {{TALKSPACEE}}
18460 * {{SUBJECTSPACE}}
18461 * {{SUBJECTSPACEE}}
18462 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18463 !! html
18464 <ul><li> Parser test</li>
18465 <li> Parser_test</li>
18466 <li> Parser test</li>
18467 <li> Parser_test</li>
18468 <li> Parser test</li>
18469 <li> Parser_test</li>
18470 <li> Parser test</li>
18471 <li> Parser_test</li>
18472 <li> Parser test</li>
18473 <li> Parser_test</li>
18474 <li> Talk:Parser test</li>
18475 <li> Talk:Parser_test</li>
18476 <li> Parser test</li>
18477 <li> Parser_test</li>
18478 <li> </li>
18479 <li> </li>
18480 <li> 0</li>
18481 <li> Talk</li>
18482 <li> Talk</li>
18483 <li> </li>
18484 <li> </li>
18485 <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>
18486
18487 !! end
18488 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18489
18490 !! test
18491 Gallery
18492 !! wikitext
18493 <gallery>
18494 image1.png |
18495 image2.gif|||||
18496
18497 image3|
18498 image4 |300px| centre
18499 image5.svg| http://///////
18500 [[x|xx]]]]
18501 * image6
18502 </gallery>
18503 !! html
18504 <ul class="gallery mw-gallery-traditional">
18505 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18506 <div class="thumb" style="height: 150px;">Image1.png</div>
18507 <div class="gallerytext">
18508 </div>
18509 </div></li>
18510 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18511 <div class="thumb" style="height: 150px;">Image2.gif</div>
18512 <div class="gallerytext">
18513 </div>
18514 </div></li>
18515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18516 <div class="thumb" style="height: 150px;">Image3</div>
18517 <div class="gallerytext">
18518 </div>
18519 </div></li>
18520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18521 <div class="thumb" style="height: 150px;">Image4</div>
18522 <div class="gallerytext">
18523 <pre>centre
18524 </pre>
18525 </div>
18526 </div></li>
18527 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18528 <div class="thumb" style="height: 150px;">Image5.svg</div>
18529 <div class="gallerytext">
18530 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18531 </p>
18532 </div>
18533 </div></li>
18534 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18535 <div class="thumb" style="height: 150px;">* image6</div>
18536 <div class="gallerytext">
18537 </div>
18538 </div></li>
18539 </ul>
18540
18541 !! end
18542
18543 !! test
18544 Gallery (with options)
18545 !! wikitext
18546 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18547 File:Nonexistent.jpg|caption
18548 File:Nonexistent.jpg
18549 image:foobar.jpg|some '''caption''' [[Main Page]]
18550 image:foobar.jpg
18551 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18552 </gallery>
18553 !! html
18554 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18555 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18556 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18557 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18558 <div class="gallerytext">
18559 <p>caption
18560 </p>
18561 </div>
18562 </div></li>
18563 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18564 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18565 <div class="gallerytext">
18566 </div>
18567 </div></li>
18568 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18569 <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>
18570 <div class="gallerytext">
18571 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18572 </p>
18573 </div>
18574 </div></li>
18575 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18576 <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>
18577 <div class="gallerytext">
18578 </div>
18579 </div></li>
18580 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18581 <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>
18582 <div class="gallerytext">
18583 <p>blabla.
18584 </p>
18585 </div>
18586 </div></li>
18587 </ul>
18588
18589 !! end
18590
18591 !! test
18592 Gallery with link that has fragment
18593 !! wikitext
18594 <gallery>
18595 image:foobar.jpg|link=Main_Page
18596 image:foobar.jpg|link=Main_Page#section
18597 image:foobar.jpg|link=Main Page#section|caption
18598 </gallery>
18599 !! html
18600 <ul class="gallery mw-gallery-traditional">
18601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18602 <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>
18603 <div class="gallerytext">
18604 </div>
18605 </div></li>
18606 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18607 <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>
18608 <div class="gallerytext">
18609 </div>
18610 </div></li>
18611 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18612 <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>
18613 <div class="gallerytext">
18614 <p>caption
18615 </p>
18616 </div>
18617 </div></li>
18618 </ul>
18619
18620 !! end
18621
18622 !! test
18623 Gallery with wikitext inside caption
18624 !! wikitext
18625 <gallery>
18626 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18627 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18628 </gallery>
18629 !! html
18630 <ul class="gallery mw-gallery-traditional">
18631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18632 <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>
18633 <div class="gallerytext">
18634 <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>
18635 </p>
18636 </div>
18637 </div></li>
18638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18639 <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>
18640 <div class="gallerytext">
18641 <p>This is a test template
18642 </p>
18643 </div>
18644 </div></li>
18645 </ul>
18646
18647 !! end
18648
18649 !! test
18650 gallery (with showfilename option)
18651 !! wikitext
18652 <gallery showfilename>
18653 File:Nonexistent.jpg|caption
18654 File:Nonexistent.jpg
18655 image:foobar.jpg|some '''caption''' [[Main Page]]
18656 File:Foobar.jpg
18657 </gallery>
18658 !! html
18659 <ul class="gallery mw-gallery-traditional">
18660 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18661 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18662 <div class="gallerytext">
18663 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18664 caption
18665 </p>
18666 </div>
18667 </div></li>
18668 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18669 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18670 <div class="gallerytext">
18671 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18672 </p>
18673 </div>
18674 </div></li>
18675 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18676 <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>
18677 <div class="gallerytext">
18678 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18679 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18680 </p>
18681 </div>
18682 </div></li>
18683 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18684 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18685 <div class="gallerytext">
18686 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18687 </p>
18688 </div>
18689 </div></li>
18690 </ul>
18691
18692 !! end
18693
18694 !! test
18695 Gallery (with namespace-less filenames)
18696 !! wikitext
18697 <gallery>
18698 File:Nonexistent.jpg
18699 Nonexistent.jpg
18700 image:foobar.jpg
18701 foobar.jpg
18702 </gallery>
18703 !! html
18704 <ul class="gallery mw-gallery-traditional">
18705 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18706 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18707 <div class="gallerytext">
18708 </div>
18709 </div></li>
18710 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18711 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18712 <div class="gallerytext">
18713 </div>
18714 </div></li>
18715 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18716 <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>
18717 <div class="gallerytext">
18718 </div>
18719 </div></li>
18720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18721 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
18722 <div class="gallerytext">
18723 </div>
18724 </div></li>
18725 </ul>
18726
18727 !! end
18728
18729 !! test
18730 HTML Hex character encoding (spells the word "JavaScript")
18731 !! options
18732 parsoid=wt2html,wt2wt,html2html
18733 !! wikitext
18734 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18735 !! html/php
18736 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18737 </p>
18738 !! html/php+tidy
18739 <p>JavaScript</p>
18740 !! html/parsoid
18741 <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>
18742 !! end
18743
18744 !! test
18745 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18746 !! wikitext
18747 &#xsee;&#XSEE;
18748 !! html/php
18749 <p>&amp;#xsee;&amp;#XSEE;
18750 </p>
18751 !! html/parsoid
18752 <p>&amp;#xsee;&amp;#XSEE;</p>
18753 !! end
18754
18755 !! test
18756 HTML Hex character encoding mixed case
18757 !! options
18758 parsoid=wt2html,wt2wt,html2html
18759 !! wikitext
18760 &#xEE;&#Xee;
18761 !! html/php
18762 <p>&#xee;&#xee;
18763 </p>
18764 !! html/php+tidy
18765 <p>îî</p>
18766 !! html/parsoid
18767 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18768 !! end
18769
18770 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18771 # Note that U+000C (form feed) is not a valid XML character, so
18772 # it is banned even though allowed in HTML5.
18773 !! test
18774 Illegal character references (T106578)
18775 !! wikitext
18776 ; Null: &#00;
18777 ; FF: &#xC;
18778 ; CR: &#xD;
18779 ; Control (low): &#8;
18780 ; Control (high): &#x7F; &#x9F;
18781 ; Surrogate: &#xD83D;&#xDCA9;
18782 ; This is an okay astral character: &#x1F4A9;
18783 !! html+tidy
18784 <dl>
18785 <dt>Null</dt>
18786 <dd>&amp;#00;</dd>
18787 <dt>FF</dt>
18788 <dd>&amp;#xC;</dd>
18789 <dt>CR</dt>
18790 <dd>&amp;#xD;</dd>
18791 <dt>Control (low)</dt>
18792 <dd>&amp;#8;</dd>
18793 <dt>Control (high)</dt>
18794 <dd>&amp;#x7F; &amp;#x9F;</dd>
18795 <dt>Surrogate</dt>
18796 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18797 <dt>This is an okay astral character</dt>
18798 <dd>💩</dd>
18799 </dl>
18800 !! end
18801
18802 !! test
18803 __FORCETOC__ override
18804 !! wikitext
18805 __NEWSECTIONLINK__
18806 __FORCETOC__
18807 !! html/php
18808 <p><br />
18809 </p>
18810 !! end
18811
18812 !! test
18813 ISBN code coverage
18814 !! wikitext
18815 ISBN 978-0-1234-56&#x20;789
18816 !! html
18817 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18818 </p>
18819 !! html+tidy
18820 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18821 !! html/parsoid
18822 <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>
18823 !! end
18824
18825 !! test
18826 ISBN followed by 5 spaces
18827 !! wikitext
18828 ISBN
18829 !! html
18830 <p>ISBN
18831 </p>
18832 !! end
18833
18834 !! test
18835 Double ISBN
18836 !! wikitext
18837 ISBN ISBN 1234567890
18838 !! html/php
18839 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18840 </p>
18841 !! html/parsoid
18842 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18843 !! end
18844
18845 # Uppercase X and lowercase x as well
18846 !! test
18847 ISBN with an X
18848 !! wikitext
18849 ISBN 3-462-04561-X
18850 ISBN 3-462-04561-x
18851 ISBN 080442957X
18852 ISBN 080442957x
18853 ISBN 978080442957X
18854 ISBN 978080442957x
18855 !! html/php
18856 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18857 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18858 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18859 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18860 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18861 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18862 </p>
18863 !! html/parsoid
18864 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18865 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18866 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18867 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18868 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18869 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18870 !! end
18871
18872 !! test
18873 ISBN with empty prefix (parsoid test)
18874 !! wikitext
18875 ISBN 1234567890
18876 !! html/php
18877 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18878 </p>
18879 !! html/parsoid
18880 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18881 !! end
18882
18883 !! test
18884 Bug 22905: <abbr> followed by ISBN followed by </a>
18885 !! wikitext
18886 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18887 !! html/php
18888 <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>
18889 </p>
18890 !! html/parsoid
18891 <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>
18892 !! end
18893
18894 !! test
18895 Double RFC
18896 !! wikitext
18897 RFC RFC 1234
18898 !! html
18899 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18900 </p>
18901 !! end
18902
18903 !! test
18904 Double RFC with a wiki link
18905 !! wikitext
18906 RFC [[RFC 1234]]
18907 !! html
18908 <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>
18909 </p>
18910 !! end
18911
18912 !! test
18913 RFC code coverage
18914 !! wikitext
18915 RFC 983&#x20;987
18916 !! html
18917 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18918 </p>
18919 !! html+tidy
18920 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18921 !! end
18922
18923 !! test
18924 Centre-aligned image
18925 !! wikitext
18926 [[Image:foobar.jpg|centre]]
18927 !! html
18928 <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>
18929
18930 !!end
18931
18932 !! test
18933 None-aligned image
18934 !! wikitext
18935 [[Image:foobar.jpg|none]]
18936 !! html
18937 <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>
18938
18939 !!end
18940
18941 !! test
18942 Width + Height sized image (using px) (height is ignored)
18943 !! wikitext
18944 [[Image:foobar.jpg|640x480px]]
18945 !! html
18946 <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>
18947 </p>
18948 !!end
18949
18950 !! test
18951 Width-sized image (using px, no following whitespace)
18952 !! wikitext
18953 [[Image:foobar.jpg|640px]]
18954 !! html
18955 <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>
18956 </p>
18957 !!end
18958
18959 !! test
18960 Width-sized image (using px, with following whitespace - test regression from r39467)
18961 !! wikitext
18962 [[Image:foobar.jpg|640px ]]
18963 !! html
18964 <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>
18965 </p>
18966 !!end
18967
18968 !! test
18969 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18970 !! wikitext
18971 [[Image:foobar.jpg| 640px]]
18972 !! html
18973 <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>
18974 </p>
18975 !!end
18976
18977 !! test
18978 Image with page parameter
18979 !! options
18980 djvu
18981 !! wikitext
18982 [[File:LoremIpsum.djvu|page=2]]
18983 !! html/php
18984 <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>
18985 </p>
18986 !! html/parsoid
18987 <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>
18988 !! end
18989
18990 !! test
18991 Another italics / bold test
18992 !! wikitext
18993 ''' ''x'
18994 !! html
18995 <pre>'<i> </i>x'
18996 </pre>
18997 !!end
18998
18999 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19000 !! test
19001 dt/dd/dl test
19002 !! wikitext
19003 :;;;::
19004 !! html/php
19005 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19006
19007 !! html/parsoid
19008 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19009
19010 !!end
19011
19012
19013 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19014 !! test
19015 Images with the "|" character in the comment
19016 !! wikitext
19017 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19018 !! html/php
19019 <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>
19020
19021 !! html/parsoid
19022 <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>
19023 !! end
19024
19025 !! test
19026 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19027 !! wikitext
19028 <html><script>alert(1);</script></html>
19029 !! html
19030 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19031 </p>
19032 !! end
19033
19034 !! test
19035 HTML with raw HTML ($wgRawHtml==true)
19036 !! options
19037 wgRawHtml=1
19038 !! wikitext
19039 <html><script>alert(1);</script></html>
19040 !! html
19041 <p><script>alert(1);</script>
19042 </p>
19043 !! end
19044
19045 !! test
19046 Parents of subpages, one level up
19047 !! options
19048 subpage title=[[Subpage test/L1/L2/L3]]
19049 !! wikitext
19050 [[../|L2]]
19051 !! html
19052 <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>
19053 </p>
19054 !! end
19055
19056
19057 !! test
19058 Parents of subpages, one level up, not named
19059 !! options
19060 subpage title=[[Subpage test/L1/L2/L3]]
19061 !! wikitext
19062 [[../]]
19063 !! html
19064 <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>
19065 </p>
19066 !! end
19067
19068
19069
19070 !! test
19071 Parents of subpages, two levels up
19072 !! options
19073 subpage title=[[Subpage test/L1/L2/L3]]
19074 !! wikitext
19075 [[../../|L1]]2
19076
19077 [[../../|L1]]l
19078 !! html
19079 <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
19080 </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>
19081 </p>
19082 !! end
19083
19084 !! test
19085 Parents of subpages, two levels up, without trailing slash or name.
19086 !! options
19087 subpage title=[[Subpage test/L1/L2/L3]]
19088 !! wikitext
19089 [[../..]]
19090 !! html
19091 <p>[[../..]]
19092 </p>
19093 !! end
19094
19095 !! test
19096 Parents of subpages, two levels up, with lots of extra trailing slashes.
19097 !! options
19098 subpage title=[[Subpage test/L1/L2/L3]]
19099 !! wikitext
19100 [[../../////]]
19101 !! html
19102 <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>
19103 </p>
19104 !! end
19105
19106 !! article
19107 Subpage test/L1/L2/L3Sibling
19108 !! text
19109 Sibling article
19110 !! endarticle
19111
19112 !! test
19113 Transclusion of a sibling page (one level up)
19114 !! options
19115 subpage title=[[Subpage test/L1/L2/L3]]
19116 !! wikitext
19117 {{../L3Sibling}}
19118 !! html
19119 <p>Sibling article
19120 </p>
19121 !! end
19122
19123 !! test
19124 Transclusion of a child page
19125 !! options
19126 subpage title=[[Subpage test/L1/L2]]
19127 !! wikitext
19128 {{/L3Sibling}}
19129 !! html
19130 <p>Sibling article
19131 </p>
19132 !! end
19133
19134 !! test
19135 Non-transclusion because of too many up levels
19136 !! options
19137 subpage title=[[Subpage test/L1/L2/L3]]
19138 !! wikitext
19139 {{../../../../More than parent}}
19140 !! html
19141 <p>{{../../../../More than parent}}
19142 </p>
19143 !! end
19144
19145 !! test
19146 Definition list code coverage
19147 !! wikitext
19148 ; title : def
19149 ; title : def
19150 ;title: def
19151 !! html/php
19152 <dl><dt> title &#160;</dt>
19153 <dd> def</dd>
19154 <dt> title&#160;</dt>
19155 <dd> def</dd>
19156 <dt>title</dt>
19157 <dd> def</dd></dl>
19158
19159 !! html/parsoid
19160 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19161 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19162 <dt>title</dt><dd> def</dd></dl>
19163 !! end
19164
19165 !! test
19166 Don't fall for the self-closing div
19167 !! wikitext
19168 <div>hello world</div/>
19169 !! html
19170 <div>hello world</div>
19171
19172 !! end
19173
19174 !! test
19175 MSGNW magic word
19176 !! wikitext
19177 {{MSGNW:msg}}
19178 !! html/php
19179 <p>&#91;&#91;:Template:Msg&#93;&#93;
19180 </p>
19181 !! end
19182
19183 !! test
19184 RAW magic word
19185 !! wikitext
19186 {{RAW:QUERTY}}
19187 !! html
19188 <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>
19189 </p>
19190 !! end
19191
19192 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19193 !! test
19194 Always escape literal '>' in output, not just after '<'
19195 !! wikitext
19196 ><>
19197 !! html
19198 <p>&gt;&lt;&gt;
19199 </p>
19200 !! end
19201
19202 !! test
19203 Template caching
19204 !! wikitext
19205 {{Test}}
19206 {{Test}}
19207 !! html
19208 <p>This is a test template
19209 This is a test template
19210 </p>
19211 !! end
19212
19213
19214 !! article
19215 MediaWiki:Fake
19216 !! text
19217 ==header==
19218 !! endarticle
19219
19220 !! test
19221 Inclusion of !userCanEdit() content
19222 !! wikitext
19223 {{MediaWiki:Fake}}
19224 !! html
19225 <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>
19226
19227 !! end
19228
19229
19230 !! test
19231 Out-of-order TOC heading levels
19232 !! wikitext
19233 ==2==
19234 ======6======
19235 ===3===
19236 =1=
19237 =====5=====
19238 ==2==
19239 !! html
19240 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19241 <ul>
19242 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19243 <ul>
19244 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19245 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19246 </ul>
19247 </li>
19248 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19249 <ul>
19250 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19251 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19252 </ul>
19253 </li>
19254 </ul>
19255 </div>
19256
19257 <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>
19258 <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>
19259 <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>
19260 <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>
19261 <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>
19262 <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>
19263
19264 !! end
19265
19266
19267 !! test
19268 ISBN with a dummy number
19269 !! wikitext
19270 ISBN ---
19271 !! html
19272 <p>ISBN ---
19273 </p>
19274 !! end
19275
19276
19277 !! test
19278 ISBN with space-delimited number
19279 !! wikitext
19280 ISBN 92 9017 032 8
19281 !! html
19282 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19283 </p>
19284 !! end
19285
19286
19287 !! test
19288 ISBN with multiple spaces, no number
19289 !! wikitext
19290 ISBN foo
19291 !! html
19292 <p>ISBN foo
19293 </p>
19294 !! end
19295
19296
19297 !! test
19298 ISBN length
19299 !! wikitext
19300 ISBN 123456789
19301
19302 ISBN 1234567890
19303
19304 ISBN 12345678901
19305 !! html
19306 <p>ISBN 123456789
19307 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19308 </p><p>ISBN 12345678901
19309 </p>
19310 !! end
19311
19312
19313 !! test
19314 ISBN with trailing year (bug 8110)
19315 !! wikitext
19316 ISBN 1-234-56789-0 - 2006
19317
19318 ISBN 1 234 56789 0 - 2006
19319 !! html
19320 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19321 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19322 </p>
19323 !! end
19324
19325
19326 !! test
19327 anchorencode
19328 !! wikitext
19329 {{anchorencode:foo bar©#%n}}
19330 !! html
19331 <p>foo_bar.C2.A9.23.25n
19332 </p>
19333 !! end
19334
19335 !! test
19336 anchorencode trims spaces
19337 !! wikitext
19338 {{anchorencode: __pretty__please__}}
19339 !! html
19340 <p>pretty_please
19341 </p>
19342 !! end
19343
19344 !! test
19345 anchorencode deals with links
19346 !! wikitext
19347 {{anchorencode: [[hello|world]] [[hi]]}}
19348 !! html
19349 <p>world_hi
19350 </p>
19351 !! end
19352
19353 !! test
19354 anchorencode deals with templates
19355 !! wikitext
19356 {{anchorencode: {{Foo}} }}
19357 !! html
19358 <p>FOO
19359 </p>
19360 !! end
19361
19362 !! test
19363 anchorencode encodes like the TOC generator: (bug 18431)
19364 !! wikitext
19365 === _ +:.3A%3A&&amp;]] ===
19366 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19367 __NOEDITSECTION__
19368 !! html
19369 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19370 <p>.2B:.3A.253A.26.26.5D.5D
19371 </p>
19372 !! end
19373
19374 !! test
19375 Bug 6200: blockquotes and paragraph formatting
19376 !! wikitext
19377 <blockquote>
19378 foo
19379 </blockquote>
19380
19381 bar
19382
19383 baz
19384 !! html
19385 <blockquote>
19386 <p>foo
19387 </p>
19388 </blockquote>
19389 <p>bar
19390 </p>
19391 <pre>baz
19392 </pre>
19393 !! end
19394
19395 !! test
19396 Bug 8293: Use of center tag ruins paragraph formatting
19397 !! wikitext
19398 <center>
19399 foo
19400 </center>
19401
19402 bar
19403
19404 baz
19405 !! html
19406 <center>
19407 <p>foo
19408 </p>
19409 </center>
19410 <p>bar
19411 </p>
19412 <pre>baz
19413 </pre>
19414 !! end
19415
19416 !!test
19417 Parsing of overlapping (improperly nested) inline html tags
19418 !! wikitext
19419 <span><s>x</span></s>
19420 !! html/php
19421 <p><span><s>x&lt;/span&gt;</s></span>
19422 </p>
19423 !! html/parsoid
19424 <p><span><s>x</s></span>
19425 </p>
19426 !!end
19427
19428 ###
19429 ### Language variants related tests
19430 ###
19431 !! test
19432 Self-link in language variants
19433 !! options
19434 title=[[Dunav]] language=sr
19435 !! wikitext
19436 Both [[Dunav]] and [[Дунав]] are names for this river.
19437 !! html
19438 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19439 </p>
19440 !!end
19441
19442 !! article
19443 Дуна
19444 !! text
19445 content
19446 !! endarticle
19447
19448 !! test
19449 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19450 !! options
19451 title=[[Duna]] language=sr
19452 !! wikitext
19453 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19454 !! html
19455 <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.
19456 </p>
19457 !! end
19458
19459 !! test
19460 Link to a section of a variant of this title shouldn't be parsed as self-link
19461 !! options
19462 title=[[Duna]] language=sr
19463 !! wikitext
19464 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19465 !! html
19466 <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.
19467 </p>
19468 !! end
19469
19470 !! test
19471 Link to pages in language variants
19472 !! options
19473 language=sr
19474 !! wikitext
19475 Main Page can be written as [[Маин Паге]]
19476 !! html
19477 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19478 </p>
19479 !!end
19480
19481
19482 !! test
19483 Multiple links to pages in language variants
19484 !! options
19485 language=sr
19486 !! wikitext
19487 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19488 !! html
19489 <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>.
19490 </p>
19491 !!end
19492
19493
19494 !! test
19495 Simple template in language variants
19496 !! options
19497 language=sr
19498 !! wikitext
19499 {{тест}}
19500 !! html
19501 <p>This is a test template
19502 </p>
19503 !! end
19504
19505
19506 !! test
19507 Template with explicit namespace in language variants
19508 !! options
19509 language=sr
19510 !! wikitext
19511 {{Template:тест}}
19512 !! html
19513 <p>This is a test template
19514 </p>
19515 !! end
19516
19517
19518 !! test
19519 Basic test for template parameter in language variants
19520 !! options
19521 language=sr
19522 !! wikitext
19523 {{парамтест|param=foo}}
19524 !! html
19525 <p>This is a test template with parameter foo
19526 </p>
19527 !! end
19528
19529
19530 !! test
19531 Simple category in language variants
19532 !! options
19533 language=sr cat
19534 !! wikitext
19535 [[Category:МедиаWики Усер'с Гуиде]]
19536 !! html
19537 <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>
19538 !! end
19539
19540
19541 !! article
19542 Category:分类
19543 !! text
19544 blah
19545 !! endarticle
19546
19547 !! article
19548 Category:分類
19549 !! text
19550 blah
19551 !! endarticle
19552
19553 ## We used to, but no longer wt2wt this test since the default serializer
19554 ## will normalize all categories to serialize on their own line.
19555 ## This wikitext usage is going to be fairly uncommon in production and
19556 ## selser will take care of preserving formatting in those scenarios.
19557 !! test
19558 Don't convert blue categorylinks to another variant (bug 33210)
19559 !! options
19560 cat
19561 language=zh
19562 parsoid=wt2html
19563 !! wikitext
19564 [[A]][[Category:分类]]
19565 !! html/php
19566 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19567 !! html/parsoid
19568 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19569 <link rel="mw:PageProp/Category" href="Category:分类"/>
19570 !! end
19571
19572 !! test
19573 Stripping -{}- tags (language variants)
19574 !! options
19575 language=sr
19576 !! wikitext
19577 Latin proverb: -{Ne nuntium necare}-
19578 !! html
19579 <p>Latin proverb: Ne nuntium necare
19580 </p>
19581 !! end
19582
19583
19584 !! test
19585 Prevent conversion with -{}- tags (language variants)
19586 !! options
19587 language=sr variant=sr-ec
19588 !! wikitext
19589 Latinski: -{Ne nuntium necare}-
19590 !! html
19591 <p>Латински: Ne nuntium necare
19592 </p>
19593 !! end
19594
19595
19596 !! test
19597 Prevent conversion of text with -{}- tags (language variants)
19598 !! options
19599 language=sr variant=sr-ec
19600 !! wikitext
19601 Latinski: -{Ne nuntium necare}-
19602 !! html
19603 <p>Латински: Ne nuntium necare
19604 </p>
19605 !! end
19606
19607
19608 !! test
19609 Prevent conversion of links with -{}- tags (language variants)
19610 !! options
19611 language=sr variant=sr-ec
19612 !! wikitext
19613 -{[[Main Page]]}-
19614 !! html
19615 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19616 </p>
19617 !! end
19618
19619
19620 !! test
19621 -{}- tags within headlines (within html for parserConvert())
19622 !! options
19623 language=sr variant=sr-ec
19624 !! wikitext
19625 == -{Naslov}- ==
19626 !! html
19627 <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>
19628
19629 !! end
19630
19631
19632 !! test
19633 Explicit definition of language variant alternatives
19634 !! options
19635 language=zh variant=zh-tw
19636 !! wikitext
19637 -{zh:China;zh-tw:Taiwan}-, not China
19638 !! html
19639 <p>Taiwan, not China
19640 </p>
19641 !! end
19642
19643
19644 !! test
19645 Conversion around HTML tags
19646 !! options
19647 language=sr variant=sr-ec
19648 !! wikitext
19649 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19650 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19651 !! html
19652 <p>
19653 <span title="ЛаCтин">ски</span>
19654 </p>
19655 !! end
19656
19657
19658 !! test
19659 Explicit session-wise language variant mapping (A flag and - flag)
19660 !! options
19661 language=zh variant=zh-tw
19662 !! wikitext
19663 Taiwan is not China.
19664 But -{A|zh:China;zh-tw:Taiwan}- is China,
19665 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19666 and -{China}- is China.
19667 !! html
19668 <p>Taiwan is not China.
19669 But Taiwan is Taiwan,
19670 (This should be stripped!)
19671 and China is China.
19672 </p>
19673 !! end
19674
19675 !! test
19676 Explicit session-wise language variant mapping (H flag for hide)
19677 !! options
19678 language=zh variant=zh-tw
19679 !! wikitext
19680 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19681 Taiwan is China.
19682 !! html
19683 <p>(This should be stripped!)
19684 Taiwan is Taiwan.
19685 </p>
19686 !! end
19687
19688 !! test
19689 Adding explicit conversion rule for title (T flag)
19690 !! options
19691 language=zh variant=zh-tw showtitle
19692 !! wikitext
19693 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19694 !! html
19695 Taiwan
19696 <p>Should be stripped!
19697 </p>
19698 !! end
19699
19700 !! test
19701 Testing that changing the language variant here in the tests actually works
19702 !! options
19703 language=zh variant=zh showtitle
19704 !! wikitext
19705 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19706 !! html
19707 China
19708 <p>Should be stripped!
19709 </p>
19710 !! end
19711
19712 !! test
19713 Recursive conversion of alt and title attrs shouldn't clear converter state
19714 !! options
19715 language=zh variant=zh-cn showtitle
19716 !! wikitext
19717 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19718 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19719 !! html
19720 China
19721 <p>
19722 Should be stripped<span title="Exclamation">!</span>
19723 </p>
19724 !! end
19725
19726 !! test
19727 Bug 24072: more test on conversion rule for title
19728 !! options
19729 language=zh variant=zh-tw showtitle
19730 !! wikitext
19731 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19732 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19733 !! html
19734 Taiwan
19735 <p>This should be stripped!
19736 This won't take interferes with the title rule.
19737 </p>
19738 !! end
19739
19740 !! test
19741 Partly disable title conversion if variant == main language code
19742 !! options
19743 language=zh variant=zh title=[[ZH]] showtitle
19744 !! wikitext
19745 -{T|zh-cn:CN;zh-tw:TW}-
19746 !! html
19747 ZH
19748 <p>
19749 </p>
19750 !! end
19751
19752 !! test
19753 Partly disable title conversion if variant == main language code, more
19754 !! options
19755 language=zh variant=zh title=[[ZH]] showtitle
19756 !! wikitext
19757 -{T|TW}-
19758 !! html
19759 ZH
19760 <p>
19761 </p>
19762 !! end
19763
19764 !! test
19765 Raw output of variant escape tags (R flag)
19766 !! options
19767 language=zh variant=zh-tw
19768 !! wikitext
19769 Raw: -{R|zh:China;zh-tw:Taiwan}-
19770 !! html
19771 <p>Raw: zh:China;zh-tw:Taiwan
19772 </p>
19773 !! end
19774
19775 !! test
19776 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19777 !! options
19778 language=zh variant=zh-cn
19779 !! input
19780 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19781 !! result
19782 <p>0
19783 </p>
19784 !! end
19785
19786 !! test
19787 Conversion rules from [numeric-only string] to [something else] (T48634)
19788 !! options
19789 language=zh variant=zh-cn
19790 !! input
19791 -{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
19792 !! result
19793 <p>D12345EE12345
19794 </p>
19795 !! end
19796
19797 !! test
19798 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19799 !! options
19800 language=zh variant=zh-cn
19801 !! input
19802 -{H|zh-cn:foo;zh-tw:;}-foobar
19803 !! result
19804 <p>foobar
19805 </p>
19806 !! end
19807
19808 !! test
19809 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19810 !! options
19811 language=zh variant=zh-cn
19812 !! input
19813 -{H|=>zh-cn:foo;}-foobar
19814 !! result
19815 <p>foobar
19816 </p>
19817 !! end
19818
19819 !! test
19820 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19821 !! options
19822 language=zh variant=zh-cn
19823 !! input
19824 -{H|}-foobar
19825 !! result
19826 <p>foobar
19827 </p>
19828 !! end
19829
19830 !! test
19831 Nested using of manual convert syntax
19832 !! options
19833 language=zh variant=zh-hk
19834 !! wikitext
19835 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19836 !! html
19837 <p>Nested: Hello Hong Kong!
19838 </p>
19839 !! end
19840
19841 !! test
19842 Proper conversion of text in external links
19843 !! options
19844 language=sr variant=sr-ec
19845 !! wikitext
19846 http://www.google.com
19847 gopher://www.google.com
19848 [http://www.google.com http://www.google.com]
19849 [gopher://www.google.com gopher://www.google.com]
19850 [https://www.google.com irc://www.google.com]
19851 [ftp://www.google.com www.google.com/ftp://dir]
19852 [//www.google.com www.google.com]
19853 !! html
19854 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19855 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19856 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19857 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19858 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19859 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19860 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19861 </p>
19862 !! end
19863
19864 !! test
19865 Do not convert roman numbers to language variants
19866 !! options
19867 language=sr variant=sr-ec
19868 !! wikitext
19869 Fridrih IV je car.
19870 !! html
19871 <p>Фридрих IV је цар.
19872 </p>
19873 !! end
19874
19875 !! test
19876 Unclosed language converter markup "-{"
19877 !! options
19878 language=sr
19879 !! wikitext
19880 -{T|hello
19881 !! html
19882 <p>-{T|hello
19883 </p>
19884 !! end
19885
19886 !! test
19887 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19888 !! options
19889 language=sr
19890 !! wikitext
19891 -{R|=&gt;}-
19892 !! html
19893 <p>=&gt;
19894 </p>
19895 !!end
19896
19897 !! test
19898 Don't break link parsing if language converter markup is in the caption.
19899 !! options
19900 language=sr variant=sr-ec
19901 !! wikitext
19902 [[Main Page|-{R|main page}-]]
19903 !! html
19904 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19905 </p>
19906 !! end
19907
19908 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19909 !! test
19910 Don't break image parsing if language converter markup is in the caption.
19911 !! options
19912 language=sr
19913 !! wikitext
19914 [[File:Foobar.jpg|-{R|caption}-]]
19915 !! html/parsoid
19916 <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>
19917 </p>
19918 !! end
19919
19920 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19921 !! test
19922 Don't break list handling if language converter markup is in the item.
19923 !! options
19924 language=zh variant=zh-cn
19925 !! wikitext
19926 ;-{zh-cn:AAA;zh-tw:BBB}-
19927 !! html/php
19928 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19929
19930 !! html/parsoid
19931 <dl><dt>AAA
19932 </dt></dl>
19933 !! end
19934
19935 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19936 !! test
19937 Don't break table handling if language converter markup is in the cell.
19938 !! options
19939 language=sr variant=sr-ec
19940 !! wikitext
19941 {|
19942 |-
19943 | -{R|B}-
19944 |}
19945 !! html/php
19946 <table>
19947
19948 <tr>
19949 <td>Б}-
19950 </td></tr></table>
19951
19952 !! html/parsoid
19953 <table>
19954
19955 <tr>
19956 <td> B
19957 </td></tr></table>
19958
19959 !! end
19960
19961 !! test
19962 Bug 529: Uncovered bullet
19963 !! wikitext
19964 * Foo {{bullet}}
19965 !! html
19966 <ul><li> Foo </li>
19967 <li> Bar</li></ul>
19968
19969 !! end
19970
19971 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19972 # Templates in Wikipedia rely on this behavior, as tidy has always been
19973 # enabled there. These tests are normally run *without* tidy, so specify the
19974 # full output here.
19975 # To test realistic parsing behavior, apply a tidy-like transformation to both
19976 # the expected output and your parser's output.
19977 !! test
19978 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19979 !! wikitext
19980 ******* Foo {{bullet}}
19981 !! html
19982 <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>
19983 <li> Bar</li></ul>
19984
19985 !! end
19986
19987 !! test
19988 Bug 529: Uncovered table already at line-start
19989 !! wikitext
19990 x
19991
19992 {{table}}
19993 y
19994 !! html
19995 <p>x
19996 </p>
19997 <table>
19998 <tr>
19999 <td> 1 </td>
20000 <td> 2
20001 </td></tr>
20002 <tr>
20003 <td> 3 </td>
20004 <td> 4
20005 </td></tr></table>
20006 <p>y
20007 </p>
20008 !! end
20009
20010 !! test
20011 Bug 529: Uncovered bullet in parser function result
20012 !! wikitext
20013 * Foo {{lc:{{bullet}} }}
20014 !! html
20015 <ul><li> Foo </li>
20016 <li> bar</li></ul>
20017
20018 !! end
20019
20020 !! test
20021 Bug 5678: Double-parsed template argument
20022 !! wikitext
20023 {{lc:{{{1}}}|hello}}
20024 !! html
20025 <p>{{{1}}}
20026 </p>
20027 !! end
20028
20029 !! test
20030 Bug 5678: Double-parsed template invocation
20031 !! wikitext
20032 {{lc:{{paramtest {{!}} param = hello }} }}
20033 !! html
20034 <p>{{paramtest | param = hello }}
20035 </p>
20036 !! end
20037
20038 !! test
20039 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20040 !! options
20041 language=cs
20042 title=[[Main Page]]
20043 !! wikitext
20044 {{PRVNÍVELKÉ:ěščř}}
20045 {{prvnívelké:ěščř}}
20046 {{PRVNÍMALÉ:ěščř}}
20047 {{prvnímalé:ěščř}}
20048 {{MALÁ:ěščř}}
20049 {{malá:ěščř}}
20050 {{VELKÁ:ěščř}}
20051 {{velká:ěščř}}
20052 !! html
20053 <p>Ěščř
20054 Ěščř
20055 ěščř
20056 ěščř
20057 ěščř
20058 ěščř
20059 ĚŠČŘ
20060 ĚŠČŘ
20061 </p>
20062 !! end
20063
20064 !! test
20065 Morwen/13: Unclosed link followed by heading
20066 !! wikitext
20067 [[link
20068 ==heading==
20069 !! html
20070 <p>[[link
20071 </p>
20072 <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>
20073
20074 !! end
20075
20076 !! test
20077 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20078 !! wikitext
20079 {{foo|
20080 =heading=
20081 !! html
20082 <p>{{foo|
20083 </p>
20084 <h1><span class="mw-headline" id="heading">heading</span></h1>
20085
20086 !! end
20087
20088 !! test
20089 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20090 !! wikitext
20091 {{foo|
20092 ==heading==
20093 !! html
20094 <p>{{foo|
20095 </p>
20096 <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>
20097
20098 !! end
20099
20100 !! test
20101 Tildes in comments
20102 !! options
20103 pst
20104 !! wikitext
20105 <!-- ~~~~ -->
20106 !! html/php
20107 <!-- ~~~~ -->
20108 !! end
20109
20110 !! test
20111 Paragraphs inside divs (no extra line breaks)
20112 !! wikitext
20113 <div>Line one
20114
20115 Line two</div>
20116 !! html
20117 <div>Line one
20118 Line two</div>
20119
20120 !! end
20121
20122 !! test
20123 Paragraphs inside divs (extra line break on open)
20124 !! wikitext
20125 <div>
20126 Line one
20127
20128 Line two</div>
20129 !! html
20130 <div>
20131 <p>Line one
20132 </p>
20133 Line two</div>
20134
20135 !! end
20136
20137 !! test
20138 Paragraphs inside divs (extra line break on close)
20139 !! wikitext
20140 <div>Line one
20141
20142 Line two
20143 </div>
20144 !! html
20145 <div>Line one
20146 <p>Line two
20147 </p>
20148 </div>
20149
20150 !! end
20151
20152 !! test
20153 Paragraphs inside divs (extra line break on open and close)
20154 !! wikitext
20155 <div>
20156 Line one
20157
20158 Line two
20159 </div>
20160 !! html
20161 <div>
20162 <p>Line one
20163 </p><p>Line two
20164 </p>
20165 </div>
20166
20167 !! end
20168
20169 !! test
20170 Nesting tags, paragraphs on lines which begin with <div>
20171 !! wikitext
20172 <div></div><strong>A
20173 B</strong>
20174 !! html/php+tidy
20175 <p><strong>A</strong></p>
20176 <p><strong>B</strong></p>
20177 !! html/parsoid
20178 <div></div>
20179 <p><strong>A
20180 B</strong>
20181 </p>
20182 !! end
20183
20184 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20185 !! test
20186 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20187 !! wikitext
20188 <blockquote>Line one
20189
20190 Line two</blockquote>
20191 !! html
20192 <blockquote>Line one
20193 Line two</blockquote>
20194
20195 !! html+tidy
20196 <blockquote>
20197 <p>Line one Line two</p>
20198 </blockquote>
20199 !! end
20200
20201 !! test
20202 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20203 !! wikitext
20204 <blockquote>
20205 Line one
20206
20207 Line two</blockquote>
20208 !! html
20209 <blockquote>
20210 <p>Line one
20211 </p>
20212 Line two</blockquote>
20213
20214 !! html+tidy
20215 <blockquote>
20216 <p>Line one</p>
20217 Line two</blockquote>
20218 !! end
20219
20220 !! test
20221 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20222 !! wikitext
20223 <blockquote>Line one
20224
20225 Line two
20226 </blockquote>
20227 !! html
20228 <blockquote>Line one
20229 <p>Line two
20230 </p>
20231 </blockquote>
20232
20233 !! html+tidy
20234 <blockquote>
20235 <p>Line one</p>
20236 <p>Line two</p>
20237 </blockquote>
20238 !! end
20239
20240 !! test
20241 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20242 !! wikitext
20243 <blockquote>
20244 Line one
20245
20246 Line two
20247 </blockquote>
20248 !! html
20249 <blockquote>
20250 <p>Line one
20251 </p><p>Line two
20252 </p>
20253 </blockquote>
20254
20255 !! html+tidy
20256 <blockquote>
20257 <p>Line one</p>
20258 <p>Line two</p>
20259 </blockquote>
20260 !! end
20261
20262 !! test
20263 Paragraphs inside blockquotes/divs (no extra line breaks)
20264 !! wikitext
20265 <blockquote><div>Line one
20266
20267 Line two</div></blockquote>
20268 !! html
20269 <blockquote><div>Line one
20270 Line two</div></blockquote>
20271
20272 !! end
20273
20274 !! test
20275 Paragraphs inside blockquotes/divs (extra line break on open)
20276 !! wikitext
20277 <blockquote><div>
20278 Line one
20279
20280 Line two</div></blockquote>
20281 !! html
20282 <blockquote><div>
20283 <p>Line one
20284 </p>
20285 Line two</div></blockquote>
20286
20287 !! end
20288
20289 !! test
20290 Paragraphs inside blockquotes/divs (extra line break on close)
20291 !! wikitext
20292 <blockquote><div>Line one
20293
20294 Line two
20295 </div></blockquote>
20296 !! html
20297 <blockquote><div>Line one
20298 <p>Line two
20299 </p>
20300 </div></blockquote>
20301
20302 !! end
20303
20304 !! test
20305 Paragraphs inside blockquotes/divs (extra line break on open and close)
20306 !! wikitext
20307 <blockquote><div>
20308 Line one
20309
20310 Line two
20311 </div></blockquote>
20312 !! html
20313 <blockquote><div>
20314 <p>Line one
20315 </p><p>Line two
20316 </p>
20317 </div></blockquote>
20318
20319 !! end
20320
20321 !! test
20322 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20323 !! options
20324 wgLinkHolderBatchSize=0
20325 !! wikitext
20326 [[meatball:1]]
20327 [[meatball:2]]
20328 [[meatball:3]]
20329 !! html
20330 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20331 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20332 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20333 </p>
20334 !! end
20335
20336 !! test
20337 Free external link invading image caption
20338 !! wikitext
20339 [[Image:Foobar.jpg|thumb|http://x|hello]]
20340 !! html
20341 <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>
20342
20343 !! end
20344
20345 !! test
20346 Bug 15196: localised external link numbers
20347 !! options
20348 language=fa
20349 !! wikitext
20350 [http://en.wikipedia.org/]
20351 !! html/php
20352 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20353 </p>
20354 !! html/parsoid
20355 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20356 !! end
20357
20358 !! test
20359 Multibyte character in padleft
20360 !! wikitext
20361 {{padleft:-Hello|7|Æ}}
20362 !! html
20363 <p>Æ-Hello
20364 </p>
20365 !! end
20366
20367 !! test
20368 Multibyte character in padright
20369 !! wikitext
20370 {{padright:Hello-|7|Æ}}
20371 !! html
20372 <p>Hello-Æ
20373 </p>
20374 !! end
20375
20376 !!test
20377 formatdate parser function
20378 !! wikitext
20379 {{#formatdate:2009-03-24}}
20380 !! html
20381 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20382 </p>
20383 !! end
20384
20385 !!test
20386 formatdate parser function, with default format
20387 !! wikitext
20388 {{#formatdate:2009-03-24|mdy}}
20389 !! html
20390 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20391 </p>
20392 !! end
20393
20394 !! test
20395 Spacing of numbers in formatted dates
20396 !! wikitext
20397 {{#formatdate:January 15}}
20398 !! html
20399 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20400 </p>
20401 !! end
20402
20403 !! test
20404 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
20405 !! options
20406 language=nl title=[[MediaWiki:Common.css]]
20407 !! wikitext
20408 {{#formatdate:2009-03-24|dmy}}
20409 !! html
20410 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20411 </p>
20412 !! end
20413
20414 #
20415 #
20416 #
20417
20418 #
20419 # Edit comments
20420 #
20421
20422 !! test
20423 Edit comment with link
20424 !! options
20425 comment
20426 !! wikitext
20427 I like the [[Main Page]] a lot
20428 !! html/php
20429 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20430 !!end
20431
20432 !! test
20433 Edit comment with link and link text
20434 !! options
20435 comment
20436 !! wikitext
20437 I like the [[Main Page|best pages]] a lot
20438 !! html/php
20439 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20440 !!end
20441
20442 !! test
20443 Edit comment with link and link text with suffix
20444 !! options
20445 comment
20446 !! wikitext
20447 I like the [[Main Page|best page]]s a lot
20448 !! html/php
20449 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20450 !!end
20451
20452 !! test
20453 Edit comment with section link (non-local, eg in history list)
20454 !! options
20455 comment title=[[Main Page]]
20456 !! wikitext
20457 /* External links */ removed bogus entries
20458 !! html/php
20459 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20460 !!end
20461
20462 !! test
20463 Edit comment with section link and text before it (non-local, eg in history list)
20464 !! options
20465 comment title=[[Main Page]]
20466 !! wikitext
20467 pre-comment text /* External links */ removed bogus entries
20468 !! html/php
20469 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>
20470 !!end
20471
20472 !! test
20473 Edit comment with section link (local, eg in diff view)
20474 !! options
20475 comment local title=[[Main Page]]
20476 !! wikitext
20477 /* External links */ removed bogus entries
20478 !! html/php
20479 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20480 !!end
20481
20482 !! test
20483 Edit comment with subpage link (bug 14080)
20484 !! options
20485 comment
20486 subpage
20487 title=[[Subpage test]]
20488 !! wikitext
20489 Poked at a [[/subpage]] here...
20490 !! html/php
20491 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20492 !!end
20493
20494 !! test
20495 Edit comment with subpage link and link text (bug 14080)
20496 !! options
20497 comment
20498 subpage
20499 title=[[Subpage test]]
20500 !! wikitext
20501 Poked at a [[/subpage|neat little page]] here...
20502 !! html/php
20503 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20504 !!end
20505
20506 !! test
20507 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20508 !! options
20509 comment
20510 title=[[Subpage test]]
20511 !! wikitext
20512 Poked at a [[/subpage]] here...
20513 !! html/php
20514 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...
20515 !!end
20516
20517 !! test
20518 Edit comment with bare anchor link (local, as on diff)
20519 !! options
20520 comment
20521 local
20522 title=[[Main Page]]
20523 !! wikitext
20524 [[#section]]
20525 !! html/php
20526 <a href="#section">#section</a>
20527 !! end
20528
20529 !! test
20530 Edit comment with bare anchor link (non-local, as on history)
20531 !! options
20532 comment
20533 title=[[Main Page]]
20534 !! wikitext
20535 [[#section]]
20536 !! html/php
20537 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20538 !! end
20539
20540 !! test
20541 Anchor starting with underscore
20542 !! options
20543 title=[[Foo]]
20544 !! wikitext
20545 [[#_ref|One]]
20546 !! html/php
20547 <p><a href="#_ref">One</a>
20548 </p>
20549 !! html/parsoid
20550 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20551 !! end
20552
20553 !! test
20554 Id starting with underscore
20555 !! wikitext
20556 <div id="_ref"></div>
20557 !! html/*
20558 <div id="_ref"></div>
20559
20560 !! end
20561
20562 !! test
20563 Space normalisation on autocomment (bug 22784)
20564 !! options
20565 comment
20566 title=[[Main Page]]
20567 !! wikitext
20568 /* __hello__world__ */
20569 !! html/php
20570 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20571 !! end
20572
20573 !! test
20574 percent-encoding and + signs in comments (Bug 26410)
20575 !! options
20576 comment
20577 !! wikitext
20578 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20579 !! html/php
20580 <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>
20581 !! end
20582
20583 # Parsoid doesn't support this yet: see bug 73581
20584 # but it *should* omit the 'src' attribute if the image is bad.
20585 # PHP side of tests was disabled in
20586 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20587 # because of issues in the PHP parserTests infrastructure
20588 # (but the output below is indeed what the PHP side emits)
20589 !! test
20590 Bad images - basic functionality
20591 !! wikitext
20592 [[File:Bad.jpg]]
20593 !! DISABLED/html/php
20594 !! html/parsoid
20595 <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>
20596 !! end
20597
20598 !! test
20599 Bad images - bug 16039: text after bad image disappears
20600 !! wikitext
20601 Foo bar
20602 [[File:Bad.jpg]]
20603 Bar foo
20604 !! DISABLED/html/php
20605 <p>Foo bar
20606 </p><p>Bar foo
20607 </p>
20608 !! html/parsoid
20609 <p>Foo bar
20610 <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>
20611 Bar foo</p>
20612 !! end
20613
20614 !! test
20615 Verify that displaytitle works (bug #22501) no displaytitle
20616 !! options
20617 showtitle
20618 !! config
20619 wgAllowDisplayTitle=true
20620 wgRestrictDisplayTitle=false
20621 !! wikitext
20622 this is not the the title
20623 !! html/php
20624 Parser test
20625 <p>this is not the the title
20626 </p>
20627 !! end
20628
20629 !! test
20630 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20631 !! options
20632 showtitle
20633 title=[[Screen]]
20634 !! config
20635 wgAllowDisplayTitle=true
20636 wgRestrictDisplayTitle=false
20637 !! wikitext
20638 this is not the the title
20639 {{DISPLAYTITLE:whatever}}
20640 !! html/php
20641 whatever
20642 <p>this is not the the title
20643 </p>
20644 !! end
20645
20646 !! test
20647 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20648 !! options
20649 showtitle
20650 title=[[Screen]]
20651 !! config
20652 wgAllowDisplayTitle=true
20653 wgRestrictDisplayTitle=true
20654 !! wikitext
20655 this is not the the title
20656 {{DISPLAYTITLE:whatever}}
20657 !! html/php
20658 Screen
20659 <p>this is not the the title
20660 <span class="error"><strong>Warning:</strong> Display title "whatever" was ignored since it is not equivalent to the page's actual title.</span>
20661 </p>
20662 !! end
20663
20664 !! test
20665 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20666 !! options
20667 showtitle
20668 title=[[Screen]]
20669 !! config
20670 wgAllowDisplayTitle=true
20671 wgRestrictDisplayTitle=true
20672 !! wikitext
20673 this is not the the title
20674 {{DISPLAYTITLE:screen}}
20675 !! html/php
20676 screen
20677 <p>this is not the the title
20678 </p>
20679 !! end
20680
20681 !! test
20682 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20683 !! options
20684 showtitle
20685 title=[[Screen]]
20686 !! config
20687 wgAllowDisplayTitle=false
20688 !! wikitext
20689 this is not the the title
20690 {{DISPLAYTITLE:screen}}
20691 !! html/php
20692 Screen
20693 <p>this is not the the title
20694 <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>
20695 </p>
20696 !! end
20697
20698 !! test
20699 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20700 !! options
20701 showtitle
20702 title=[[Screen]]
20703 !! config
20704 wgAllowDisplayTitle=false
20705 !! wikitext
20706 this is not the the title
20707 !! html/php
20708 Screen
20709 <p>this is not the the title
20710 </p>
20711 !! end
20712
20713 !! test
20714 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20715 !! options
20716 showtitle
20717 title=[[Screen]]
20718 !! config
20719 wgAllowDisplayTitle=true
20720 wgRestrictDisplayTitle=true
20721 !! wikitext
20722 this is not the the title
20723 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20724 !! html/php
20725 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20726 <p>this is not the the title
20727 </p>
20728 !! end
20729
20730 !! test
20731 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20732 !! options
20733 showtitle
20734 title=[[Screen]]
20735 !! config
20736 wgAllowDisplayTitle=true
20737 wgRestrictDisplayTitle=true
20738 !! wikitext
20739 this is not the the title
20740 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20741 !! html/php
20742 <span style="color: red;">s</span>creen
20743 <p>this is not the the title
20744 </p>
20745 !! end
20746
20747 !! test
20748 Page status indicators: Empty name is invalid
20749 !! options
20750 showindicators
20751 !! wikitext
20752 <indicator name=" "></indicator>
20753 <indicator></indicator>
20754 !! html
20755 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20756 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20757 </p>
20758 !! end
20759
20760 !! test
20761 Page status indicators: Weird syntaxes that are okay
20762 !! options
20763 showindicators
20764 !! wikitext
20765 <indicator name="empty" />
20766 <indicator name="name"></indicator>
20767 !! html
20768 empty=
20769 name=
20770 <p><br />
20771 </p>
20772 !! end
20773
20774 !! test
20775 Page status indicators: Torture test
20776 !! options
20777 showindicators
20778 !! wikitext
20779 <indicator name="01">hello world</indicator>
20780 <indicator name="02">[[Main Page]]</indicator>
20781 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20782 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20783 <indicator name="05">* foo
20784 * bar</indicator>
20785 <indicator name="06"><nowiki>foo</nowiki></indicator>
20786 <indicator name="07"> Preformatted</indicator>
20787 <indicator name="08"><div>Broken tag</indicator>
20788 <indicator name="09">{| class=wikitable
20789 | cell
20790 |}</indicator>
20791 <indicator name="10">Two
20792
20793 paragraphs</indicator>
20794 !! html
20795 01=hello world
20796 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20797 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" />
20798 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>
20799 05=<ul><li> foo</li>
20800 <li> bar</li></ul>
20801
20802 06=foo
20803 07=<pre>Preformatted
20804 </pre>
20805 08=<div>Broken tag</div>
20806
20807 09=<table class="wikitable">
20808 <tr>
20809 <td> cell
20810 </td></tr></table>
20811
20812 10=<p>Two
20813 </p><p>paragraphs
20814 </p>
20815 <p><br />
20816 </p><p><br />
20817 </p><p><br />
20818 </p><p><br />
20819 </p><p><br />
20820 </p>
20821 !! end
20822
20823 !! test
20824 preload: check <noinclude> and <includeonly>
20825 !! options
20826 preload
20827 !! wikitext
20828 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20829 !! html/php
20830 Hello kind world.
20831 !! end
20832
20833 !! test
20834 preload: check <onlyinclude>
20835 !! options
20836 preload
20837 !! wikitext
20838 Goodbye <onlyinclude>Hello world</onlyinclude>
20839 !! html/php
20840 Hello world
20841 !! end
20842
20843 !! test
20844 preload: can pass tags through if we want to
20845 !! options
20846 preload
20847 !! wikitext
20848 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20849 !! html/php
20850 <includeonly>Hello world</includeonly>
20851 !! end
20852
20853 !! test
20854 preload: check that it doesn't try to do tricks
20855 !! options
20856 preload
20857 !! wikitext
20858 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20859 !! html/php
20860 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20861 !! end
20862
20863 !! test
20864 Play a bit with r67090 and bug 3158
20865 !! wikitext
20866 <div style="width:50% !important">&nbsp;</div>
20867 <div style="width:50%&nbsp;!important">&nbsp;</div>
20868 <div style="width:50%&#160;!important">&nbsp;</div>
20869 <div style="border : solid;">&nbsp;</div>
20870 !! html/php
20871 <div style="width:50% !important">&#160;</div>
20872 <div style="width:50% !important">&#160;</div>
20873 <div style="width:50% !important">&#160;</div>
20874 <div style="border&#160;: solid;">&#160;</div>
20875
20876 !! html/parsoid
20877 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20878 <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>
20879 <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>
20880 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20881
20882 !! end
20883
20884 !! test
20885 HTML5 data attributes
20886 !! wikitext
20887 <span data-foo="bar">Baz</span>
20888 <p data-abc-def_hij="">Quuz</p>
20889 !! html/php
20890 <p><span data-foo="bar">Baz</span>
20891 </p>
20892 <p data-abc-def_hij="">Quuz</p>
20893
20894 !! html/parsoid
20895 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20896 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20897 !! end
20898
20899 !! test
20900 Strip reserved data attributes
20901 !! wikitext
20902 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20903 !! html/php
20904 <div data-ok="fred">d</div>
20905
20906 !! html/parsoid
20907 <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>
20908 !! end
20909
20910 !! test
20911 percent-encoding and + signs in internal links (Bug 26410)
20912 !! wikitext
20913 [[User:+%]] [[Page+title%]]
20914 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20915 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20916 [[%33%45]] [[%33%45+]]
20917 !! html/php
20918 <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>
20919 <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>
20920 <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>
20921 <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>
20922 </p>
20923 !! html/parsoid
20924 <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>
20925 <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>
20926 <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>
20927 <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>
20928 !! end
20929
20930 !! test
20931 Special characters in embedded file links (bug 27679)
20932 !! wikitext
20933 [[File:Contains & ampersand.jpg]]
20934 [[File:Does not exist.jpg|Title with & ampersand]]
20935 !! html/php
20936 <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>
20937 <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>
20938 </p>
20939 !! html/parsoid
20940 <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>
20941 <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>
20942 !! end
20943
20944 !! test
20945 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20946 !! wikitext
20947 Text&apos;s been normalized?
20948 !! html
20949 <p>Text&#39;s been normalized?
20950 </p>
20951 !! end
20952
20953 !! test
20954 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20955 !! wikitext
20956 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20957 !! html
20958 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20959 </p>
20960 !! end
20961
20962 !! test
20963 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20964 !! wikitext
20965 [http://www.example.org/ ideograms]
20966 !! html
20967 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20968 </p>
20969 !! end
20970
20971 !! test
20972 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20973 !! wikitext
20974 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20975 !! html
20976 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20977 </p>
20978 !! end
20979
20980 !! article
20981 Mediawiki:loop1
20982 !! text
20983 {{Identical|A}}
20984 !! endarticle
20985
20986 !! article
20987 Mediawiki:loop2
20988 !! text
20989 {{Identical|B}}
20990 !! endarticle
20991
20992 !! article
20993 Template:Identical
20994 !! text
20995 {{int:loop1}}
20996 {{int:loop2}}
20997 !! endarticle
20998
20999 !! test
21000 Bug 31098 Template which includes system messages which includes the template
21001 !! wikitext
21002 {{Identical}}
21003 !! html
21004 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21005 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21006 </p>
21007 !! end
21008
21009 !! test
21010 Bug31490 Turkish: ucfirst 'blah'
21011 !! options
21012 language=tr
21013 !! wikitext
21014 {{ucfirst:blah}}
21015 !! html
21016 <p>Blah
21017 </p>
21018 !! end
21019
21020 !! test
21021 Bug31490 Turkish: ucfirst 'ix'
21022 !! options
21023 language=tr
21024 !! wikitext
21025 {{ucfirst:ix}}
21026 !! html
21027 <p>İx
21028 </p>
21029 !! end
21030
21031 !! test
21032 Bug31490 Turkish: lcfirst 'BLAH'
21033 !! options
21034 language=tr
21035 !! wikitext
21036 {{lcfirst:BLAH}}
21037 !! html
21038 <p>bLAH
21039 </p>
21040 !! end
21041
21042 !! test
21043 Bug31490 Turkish: ucfırst (with a dotless i)
21044 !! options
21045 language=tr
21046 !! wikitext
21047 {{ucfırst:blah}}
21048 !! html
21049 <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>
21050 </p>
21051 !! end
21052
21053 !! test
21054 Bug31490 ucfırst (with a dotless i) with English language
21055 !! options
21056 language=en
21057 !! wikitext
21058 {{ucfırst:blah}}
21059 !! html
21060 <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>
21061 </p>
21062 !! end
21063
21064 !! test
21065 Bug 26375: TOC with italics
21066 !! options
21067 title=[[Main Page]]
21068 !! wikitext
21069 __TOC__
21070 == ''Lost'' episodes ==
21071 !! html
21072 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21073 <ul>
21074 <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>
21075 </ul>
21076 </div>
21077
21078 <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>
21079
21080 !! end
21081
21082 !! test
21083 Bug 26375: TOC with bold
21084 !! options
21085 title=[[Main Page]]
21086 !! wikitext
21087 __TOC__
21088 == '''should be bold''' then normal text ==
21089 !! html
21090 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21091 <ul>
21092 <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>
21093 </ul>
21094 </div>
21095
21096 <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>
21097
21098 !! end
21099
21100 !! test
21101 Bug 33845: Headings become cursive in TOC when they contain an image
21102 !! options
21103 title=[[Main Page]]
21104 !! wikitext
21105 __TOC__
21106 == Image [[Image:foobar.jpg]] ==
21107 !! html
21108 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21109 <ul>
21110 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21111 </ul>
21112 </div>
21113
21114 <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>
21115
21116 !! end
21117
21118 !! test
21119 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21120 !! options
21121 title=[[Main Page]]
21122 !! wikitext
21123 __TOC__
21124 == <blockquote>Quote</blockquote> ==
21125 !! html
21126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21127 <ul>
21128 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21129 </ul>
21130 </div>
21131
21132 <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>
21133
21134 !! html+tidy
21135 <p></p>
21136 <div id="toc" class="toc">
21137 <div id="toctitle">
21138 <h2>Contents</h2>
21139 </div>
21140 <ul>
21141 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21142 </ul>
21143 </div>
21144 <p></p>
21145 <h2><span class="mw-headline" id="Quote"></span></h2>
21146 <blockquote>
21147 <p><span class="mw-headline" id="Quote">Quote</span></p>
21148 </blockquote>
21149 <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>
21150 !! end
21151
21152 !! test
21153 Unclosed tags in TOC
21154 !! options
21155 title=[[Main Page]]
21156 !! wikitext
21157 __TOC__
21158 == Proof: 2 < 3 ==
21159 <small>Hanc marginis exiguitas non caperet.</small>
21160 QED
21161 !! html
21162 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21163 <ul>
21164 <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>
21165 </ul>
21166 </div>
21167
21168 <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>
21169 <p><small>Hanc marginis exiguitas non caperet.</small>
21170 QED
21171 </p>
21172 !! end
21173
21174 !! test
21175 Multiple tags in TOC
21176 !! wikitext
21177 __TOC__
21178 == <i>Foo</i> <b>Bar</b> ==
21179
21180 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21181 !! html
21182 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21183 <ul>
21184 <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>
21185 <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>
21186 </ul>
21187 </div>
21188
21189 <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>
21190 <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>
21191
21192 !! html+tidy
21193 <p></p>
21194 <div id="toc" class="toc">
21195 <div id="toctitle">
21196 <h2>Contents</h2>
21197 </div>
21198 <ul>
21199 <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>
21200 <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>
21201 </ul>
21202 </div>
21203 <p></p>
21204 <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>
21205 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21206 <blockquote>
21207 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21208 </blockquote>
21209 <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>
21210 !! end
21211
21212 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21213 # html5 tag parsing.
21214 !! test
21215 Tags with parameters in TOC
21216 !! options
21217 parsoid=wt2html
21218 !! wikitext
21219 __TOC__
21220 == <sup class="in-h2">Hello</sup> ==
21221
21222 == <sup class="a > b">Evilbye</sup> ==
21223 !! html/php
21224 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21225 <ul>
21226 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21227 <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>
21228 </ul>
21229 </div>
21230
21231 <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>
21232 <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>
21233
21234 !! html/parsoid
21235 <meta property="mw:PageProp/toc" />
21236 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21237
21238 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21239 !! end
21240
21241 !! test
21242 span tags with directionality in TOC
21243 !! wikitext
21244 __TOC__
21245 == <span dir="ltr">C++</span> ==
21246
21247 == <span dir="rtl">זבנג!</span> ==
21248
21249 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21250
21251 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21252
21253 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21254 !! html
21255 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21256 <ul>
21257 <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>
21258 <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>
21259 <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>
21260 <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>
21261 <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>
21262 </ul>
21263 </div>
21264
21265 <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>
21266 <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>
21267 <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>
21268 <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>
21269 <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>
21270
21271 !! end
21272
21273 !! test
21274 Bug 72884: bdi element in ToC
21275 !! wikitext
21276 __TOC__
21277 == <bdi>test</bdi> ==
21278 !! html
21279 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21280 <ul>
21281 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21282 </ul>
21283 </div>
21284
21285 <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>
21286
21287 !! end
21288
21289 # Note that the html output does not have the <p></p>, but the
21290 # html+tidy output *does*. This is because the empty <p></p> is
21291 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21292 !! test
21293 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21294 !! wikitext
21295 __TOC__
21296 == x ==
21297 !! html
21298 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21299 <ul>
21300 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21301 </ul>
21302 </div>
21303
21304 <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>
21305
21306 !! html+tidy
21307 <p></p>
21308 <div id="toc" class="toc">
21309 <div id="toctitle">
21310 <h2>Contents</h2>
21311 </div>
21312 <ul>
21313 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21314 </ul>
21315 </div>
21316 <p></p>
21317 <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>
21318 !! end
21319
21320 !! article
21321 MediaWiki:Bug32057
21322 !! text
21323 == {{int:headline_sample}} ==
21324 !! endarticle
21325
21326 !! test
21327 Bug 32057: Title needed when expanding <h> nodes.
21328 !! options
21329 title=[[Main Page]]
21330 !! wikitext
21331 {{int:Bug32057}}
21332 !! html
21333 <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>
21334
21335 !! end
21336
21337 !! test
21338 Strip marker in urlencode
21339 !! wikitext
21340 {{urlencode:x<nowiki/>y}}
21341 {{urlencode:x<nowiki/>y|wiki}}
21342 {{urlencode:x<nowiki/>y|path}}
21343 {{urlencode:x<pre id="one">two</pre>y}}
21344 !! html
21345 <p>xy
21346 xy
21347 xy
21348 xy
21349 </p>
21350 !! end
21351
21352 !! test
21353 Strip marker in lc
21354 !! wikitext
21355 {{lc:x<nowiki/>y}}
21356 !! html
21357 <p>xy
21358 </p>
21359 !! end
21360
21361 !! test
21362 Strip marker in uc
21363 !! wikitext
21364 {{uc:x<nowiki/>y}}
21365 !! html
21366 <p>XY
21367 </p>
21368 !! end
21369
21370 !! test
21371 Strip marker in formatNum
21372 !! wikitext
21373 {{formatnum:1<nowiki/>2}}
21374 {{formatnum:1<nowiki/>2|R}}
21375 !! html
21376 <p>12
21377 12
21378 </p>
21379 !! end
21380
21381 !! test
21382 Check noCommafy in formatNum
21383 !! options
21384 language=be-tarask
21385 !! wikitext
21386 {{formatnum:123456.78}}
21387 {{formatnum:123456.78|NOSEP}}
21388 !! html
21389 <p>123 456,78
21390 123456.78
21391 </p>
21392 !! end
21393
21394 !! test
21395 Wrong option for formatNum (bug 56199)
21396 !! wikitext
21397 {{formatnum:1,234.56|Random}}
21398 {{formatnum:1,234.56|EVERYTHING}}
21399 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21400 !! html
21401 <p>1,234.56
21402 1,234.56
21403 1,234.56
21404 </p>
21405 !! end
21406
21407 !! test
21408 Strip marker in grammar
21409 !! options
21410 language=fi
21411 !! wikitext
21412 {{grammar:elative|foo<nowiki/>bar}}
21413 !! html
21414 <p>foobarista
21415 </p>
21416 !! end
21417
21418 !! test
21419 Strip marker in padleft
21420 !! wikitext
21421 {{padleft:|2|x<nowiki/>y}}
21422 !! html
21423 <p>xy
21424 </p>
21425 !! end
21426
21427 !! test
21428 Strip marker in padright
21429 !! wikitext
21430 {{padright:|2|x<nowiki/>y}}
21431 !! html
21432 <p>xy
21433 </p>
21434 !! end
21435
21436 !! test
21437 Strip marker in anchorencode
21438 !! wikitext
21439 {{anchorencode:x<nowiki/>y}}
21440 !! html
21441 <p>xy
21442 </p>
21443 !! end
21444
21445 !! test
21446 nowiki inside link inside heading (bug 18295)
21447 !! wikitext
21448 ==[[foo|x<nowiki>y</nowiki>z]]==
21449 !! html
21450 <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>
21451
21452 !! end
21453
21454 !! test
21455 new support for bdi element (bug 31817)
21456 !! wikitext
21457 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21458 !! html
21459 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21460
21461 !!end
21462
21463 !! test
21464 Ignore pipe between table row attributes
21465 !! wikitext
21466 {|
21467 | quux
21468 |- id=foo | style='color: red'
21469 | bar
21470 |}
21471 !! html
21472 <table>
21473 <tr>
21474 <td> quux
21475 </td></tr>
21476 <tr id="foo" style="color: red">
21477 <td> bar
21478 </td></tr></table>
21479
21480 !! end
21481
21482 !!test
21483 Gallery override link with WikiLink (bug 34852)
21484 !! wikitext
21485 <gallery>
21486 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21487 </gallery>
21488 !! html
21489 <ul class="gallery mw-gallery-traditional">
21490 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21491 <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>
21492 <div class="gallerytext">
21493 <p>caption
21494 </p>
21495 </div>
21496 </div></li>
21497 </ul>
21498
21499 !! end
21500
21501 !!test
21502 Gallery override link with absolute external link (bug 34852)
21503 !! wikitext
21504 <gallery>
21505 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21506 </gallery>
21507 !! html
21508 <ul class="gallery mw-gallery-traditional">
21509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21510 <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>
21511 <div class="gallerytext">
21512 <p>caption
21513 </p>
21514 </div>
21515 </div></li>
21516 </ul>
21517
21518 !! end
21519
21520 !!test
21521 Gallery override link with malicious javascript (bug 34852)
21522 !! wikitext
21523 <gallery>
21524 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21525 </gallery>
21526 !! html
21527 <ul class="gallery mw-gallery-traditional">
21528 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21529 <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>
21530 <div class="gallerytext">
21531 <p>caption
21532 </p>
21533 </div>
21534 </div></li>
21535 </ul>
21536
21537 !! end
21538
21539 !!test
21540 Gallery with invalid title as link (bug 43964)
21541 !! wikitext
21542 <gallery>
21543 File:foobar.jpg|link=<
21544 </gallery>
21545 !! html
21546 <ul class="gallery mw-gallery-traditional">
21547 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21548 <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>
21549 <div class="gallerytext">
21550 </div>
21551 </div></li>
21552 </ul>
21553
21554 !! end
21555
21556 !!test
21557 Language parser function
21558 !! wikitext
21559 {{#language:ar}}
21560 !! html
21561 <p>العربية
21562 </p>
21563 !! end
21564
21565 !!test
21566 Padleft and padright as substr
21567 !! wikitext
21568 {{padleft:|3|abcde}}
21569 {{padright:|3|abcde}}
21570 !! html
21571 <p>abc
21572 abc
21573 </p>
21574 !! end
21575
21576 !!test
21577 Special parser function
21578 !! wikitext
21579 {{#special:RandomPage}}
21580 {{#special:BaDtItLe}}
21581 {{#special:Foobar}}
21582 !! html
21583 <p>Special:Random
21584 Special:Badtitle
21585 Special:Foobar
21586 </p>
21587 !! end
21588
21589 !!test
21590 Bug 34939 - Case insensitive link parsing ([HttP://])
21591 !! wikitext
21592 [HttP://MediaWiki.Org/]
21593 !! html/php
21594 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21595 </p>
21596 !! html/parsoid
21597 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21598 !! end
21599
21600 !!test
21601 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21602 !! wikitext
21603 [HttP://MediaWiki.Org/ MediaWiki]
21604 !! html
21605 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21606 </p>
21607 !! end
21608
21609 !!test
21610 Bug 34939 - Case insensitive link parsing (HttP://)
21611 !! wikitext
21612 HttP://MediaWiki.Org/
21613 !! html/php
21614 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21615 </p>
21616 !! html/parsoid
21617 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21618 !! end
21619
21620 !!test
21621 Disable TOC
21622 !! options
21623 notoc
21624 !! wikitext
21625 Lead
21626 == Section 1 ==
21627 == Section 2 ==
21628 == Section 3 ==
21629 == Section 4 ==
21630 == Section 5 ==
21631 !! html
21632 <p>Lead
21633 </p>
21634
21635 <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>
21636 <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>
21637 <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>
21638 <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>
21639 <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>
21640
21641 !! end
21642
21643
21644 ###
21645 ### Parsoid-specific tests
21646 ### Parsoid-PHP parser incompatibilities
21647 ###
21648 !!test
21649 1. SOL-sensitive wikitext tokens as template-args
21650 !!options
21651 parsoid=wt2html,wt2wt
21652 !! wikitext
21653 {{echo|*a}}
21654 {{echo|#a}}
21655 {{echo|:a}}
21656 !! html
21657 <span about="#mwt1" typeof="mw:Transclusion">
21658 </span><ul about="#mwt1"><li>a</li>
21659 </ul>
21660 <span about="#mwt2" typeof="mw:Transclusion">
21661 </span><ol about="#mwt2"><li>a</li>
21662 </ol>
21663 <span about="#mwt3" typeof="mw:Transclusion">
21664 </span><dl about="#mwt3"><dd>a</dd>
21665 </dl>
21666 !!end
21667
21668 #### -----------------------------------------------------------------
21669 #### Parsoid-specific functionality tests
21670 #### -----------------------------------------------------------------
21671
21672 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21673 # We know wt2wt will fail, but we expect selser to pass.
21674 # Due to the nature of our testing, wt2wt and selser tests will enter the
21675 # blacklist and we'll catch selser regressions based on changes to the
21676 # blacklist entries for selser tests.
21677 !! test
21678 1. Bad treebuilder fixup of formatting elt is cleaned up
21679 !! options
21680 parsoid=wt2html,wt2wt
21681 !! wikitext
21682 {|
21683 |
21684 <small>
21685 [[Image:Foobar.jpg|right|Test]]
21686 </small>
21687 |}
21688 !! html/parsoid
21689 <table>
21690 <tbody><tr><td>
21691 <small>
21692 <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>
21693 </small>
21694 </td></tr>
21695 </tbody></table>
21696 !! end
21697
21698 !! test
21699 2. Bad treebuilder fixup of formatting elt is cleaned up
21700 !! options
21701 parsoid=wt2html,wt2wt
21702 !! wikitext
21703 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21704
21705 <small>[[Image:Foobar.jpg|right|300px]]</small>
21706 !! html/parsoid
21707
21708 <p><b>foo</b></p>
21709 <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>
21710 <p><b>bar</b></p>
21711 <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>
21712 !! end
21713
21714 !! test
21715 3. Bad treebuilder fixup of formatting elt is cleaned up
21716 !! options
21717 parsoid=wt2html,wt2wt
21718 !! wikitext
21719 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21720 !! html/parsoid
21721 <p><small><b>foo</b></small></p>
21722 <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>
21723 <p><small><b>bar</b></small></p>
21724 !! end
21725
21726 !! test
21727 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21728 !! options
21729 parsoid=wt2html,wt2wt
21730 !! wikitext
21731 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21732 !! html/parsoid
21733 <p><b><small></small></b></p>
21734 <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>
21735 <p></p>
21736 !! end
21737
21738 #### ----------------------------------------------------------------
21739 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21740 #### tags. Parsoid's output for these tags differs from that of the
21741 #### PHP parser.
21742 #### ----------------------------------------------------------------
21743
21744 !!test
21745 Ref: 1. ref-location should be replaced with an index span
21746 !! wikitext
21747 A <ref>foo</ref>
21748 B <ref name="x">foo</ref>
21749 C <ref name="y" />
21750 <references />
21751 !! html/parsoid
21752 <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>
21753 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>
21754 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>
21755 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21756 <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>
21757 <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>
21758 <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>
21759 </ol>
21760 !!end
21761
21762 !!test
21763 Ref: 2. ref-tags with identical names should all get the same index
21764 !! wikitext
21765 A <ref name="x">foo</ref>
21766 B <ref name="x" />
21767 <references />
21768 !! html/parsoid
21769 <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>
21770 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>
21771 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21772 <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>
21773 </ol>
21774 !!end
21775
21776 !!test
21777 Ref: 3. spaces in ref-names should be ignored
21778 !! wikitext
21779 A <ref name="x">foo</ref>
21780 B <ref name=" x " />
21781 C <ref name= x />
21782 <references />
21783 !! html/parsoid
21784 <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>
21785 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>
21786 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>
21787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21788 <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>
21789 </ol>
21790 !!end
21791
21792 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21793 !!test
21794 Ref: 4. 'constructor' should be accepted as a valid ref-name
21795 !! wikitext
21796 A <ref name="constructor">foo</ref>
21797 <references />
21798 !! html/parsoid
21799 <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>
21800 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21801 <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>
21802 </ol>
21803 !!end
21804
21805 !!test
21806 Ref: 5. body should accept generic wikitext
21807 !! wikitext
21808 A <ref>
21809 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21810 </ref>
21811
21812 <references />
21813 !! html/parsoid
21814 <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>
21815
21816 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21817 <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>
21818 </span></li>
21819 </ol>
21820 !!end
21821
21822 !!test
21823 Ref: 6. indent-pres should not be output in ref-body
21824 !! wikitext
21825 A <ref>
21826 foo
21827 bar
21828 baz
21829 </ref>
21830
21831 <references />
21832 !! html/parsoid
21833 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21834
21835 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21836 <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
21837 bar
21838 baz
21839 </span></li>
21840 </ol>
21841 !!end
21842
21843 !!test
21844 Ref: 7. No p-wrapping in ref-body
21845 !! wikitext
21846 A <ref>
21847 foo
21848
21849 bar
21850
21851
21852 baz
21853
21854
21855
21856 booz
21857 </ref>
21858
21859 <references />
21860 !! html/parsoid
21861 <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>
21862
21863 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21864 <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
21865
21866 bar
21867
21868
21869 baz
21870
21871
21872
21873 booz
21874 </span></li>
21875 </ol>
21876 !!end
21877
21878 !!test
21879 Ref: 8. transclusion wikitext has lower precedence
21880 !! wikitext
21881 A <ref> foo {{echo|</ref> B C}}
21882
21883 <references />
21884 !! html/parsoid
21885 <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>
21886 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21887 <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>
21888 </ol>
21889 !!end
21890
21891 !!test
21892 Ref: 9. unclosed comments should not leak out of ref-body
21893 !! wikitext
21894 A <ref> foo <!--</ref> B C
21895 <references />
21896 !! html/parsoid
21897 <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>
21898 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21899 <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>
21900 </ol>
21901 !!end
21902
21903 !!test
21904 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21905 !! wikitext
21906 A <ref> <b> foo </ref> B C
21907
21908 <references />
21909 !! html/parsoid
21910 <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>
21911
21912
21913 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21914 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
21915 </ol>
21916 !!end
21917
21918 !!test
21919 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21920 !! wikitext
21921 A <ref>foo</ref> B
21922 C <ref>bar</ref> D
21923 <references />
21924 !! html/parsoid
21925 <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
21926 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>
21927 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21928 <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>
21929 <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>
21930 </ol>
21931 !!end
21932
21933 !!test
21934 Ref: 12. ref-tags act as trailing newline migration barrier
21935 !! wikitext
21936 <!--the newline at the end of this line moves out of the p tag-->a
21937
21938 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21939 <ref />
21940
21941 c
21942 <references />
21943 !! html/parsoid
21944 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21945
21946
21947 <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>
21948 <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>
21949
21950 <p>c</p>
21951 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21952 <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>
21953 <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>
21954 !!end
21955
21956 !!test
21957 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21958 !! wikitext
21959 <ref>foo</ref> A
21960 <ref>bar
21961 </ref> B
21962 <references />
21963 !! html/parsoid
21964 <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
21965 <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>
21966 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21967 <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>
21968 <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
21969 </span></li>
21970 </ol>
21971 !!end
21972
21973 !!test
21974 Ref: 14. A nested ref-tag should be emitted as plain text
21975 !! wikitext
21976 <ref>foo <ref>bar</ref> baz</ref>
21977
21978 <references />
21979 !! html/parsoid
21980 <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>
21981 </p>
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">foo &lt;ref>bar&lt;/ref> baz</span></li>
21984 </ol>
21985 !!end
21986
21987 !!test
21988 Ref: 15. ref-tags with identical names should get identical indexes
21989 !! wikitext
21990 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21991 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21992
21993 <references />
21994 !! html/parsoid
21995 <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>
21996 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>
21997
21998 <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>
21999 </ol>
22000 !!end
22001
22002 ## We don't bother wt2wt-ing non-standard whitespace
22003 !!test
22004 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22005 !!options
22006 parsoid=wt2html
22007 !! wikitext
22008 A <ref >foo</ref >
22009
22010 <references />
22011 !! html/parsoid
22012 <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>
22013 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22014 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22015 !!end
22016
22017 !!test
22018 Ref: 17. Generate valid HTML5 id/about attributes
22019 !!wikitext
22020 <ref name="a b">foo</ref>
22021
22022 <references />
22023 !!html/parsoid
22024 <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>
22025 </p>
22026
22027 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22028 <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>
22029 </ol>
22030 !!end
22031
22032 !!test
22033 Ref: 18. T58916: Extension attributes should be parsed as plain text
22034 !!wikitext
22035 <ref name="{{echo|a}}">foo</ref>
22036
22037 <references />
22038 !!html/parsoid
22039 <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>
22040 </p>
22041
22042 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22043 <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>
22044 </ol>
22045 !!end
22046
22047 !!test
22048 Ref: 19. ref-tags with identical name encodings should get identical indexes
22049 !! wikitext
22050 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22051
22052 <references />
22053 !! html/parsoid
22054 <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>
22055 </p>
22056 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22057 <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>
22058 </ol>
22059 !!end
22060
22061 !!test
22062 Ref: 20. ref-tags with identical names but different content should keep it
22063 !! wikitext
22064 A <ref name="foo">Foo one</ref>
22065 B <ref name="foo">Foo two</ref>
22066 C <ref name="foo" />
22067
22068 <references />
22069 !! html/parsoid
22070 <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>
22071 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>
22072 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>
22073
22074 <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>
22075 </ol>
22076 !!end
22077
22078 !!test
22079 References: 1. references tag without any refs should be handled properly
22080 !! wikitext
22081 <references />
22082 !! html/parsoid
22083 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22084 !!end
22085
22086 !!test
22087 References: 2. references tag with group only outputs references from that group
22088 !! wikitext
22089 A <ref group="a">foo</ref>
22090 B <ref group="b">bar</ref>
22091 C <ref>baz</ref>
22092
22093 <references group="a" />
22094 <references />
22095 <references group="b" />
22096 !! html/parsoid
22097 <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>
22098 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>
22099 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>
22100
22101 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22102 <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>
22103 </ol>
22104 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22105 <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>
22106 </ol>
22107 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22108 <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>
22109 </ol>
22110 !!end
22111
22112 !!test
22113 References: 3. ref list should be cleared after processing references
22114 !! wikitext
22115 A <ref>foo</ref>
22116
22117 <references />
22118
22119 B <ref>bar</ref>
22120
22121 <references />
22122 !! html/parsoid
22123 <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>
22124
22125 <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>
22126 </ol>
22127
22128 <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>
22129
22130 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22131 <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>
22132 </ol>
22133 !!end
22134
22135 !!test
22136 References: 4. only referenced group should be cleared after processing references
22137 !! wikitext
22138 A <ref group="a">afoo</ref>
22139 B <ref>bfoo</ref>
22140
22141 <references group="a" />
22142
22143 C <ref>cfoo</ref>
22144
22145 <references />
22146 !! html/parsoid
22147 <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>
22148 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>
22149
22150 <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>
22151 </ol>
22152
22153 <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>
22154
22155 <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>
22156 </ol>
22157 !!end
22158
22159 ## Don't expect this to rt since we're dropping content
22160 !! test
22161 References: 5. ref tags in references should be processed while ignoring all other content
22162 !! options
22163 parsoid=wt2html,html2html
22164 !! wikitext
22165 A <ref name="a" />
22166 B <ref name="b">bar</ref>
22167
22168 <references>
22169 <ref name="a">foo</ref>
22170 This should just get lost.
22171 </references>
22172 !! html/parsoid
22173 <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>
22174 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>
22175
22176
22177 <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>
22178 </ol>
22179 !! end
22180
22181 !! test
22182 References: 6. <references /> from a transclusion
22183 !! wikitext
22184 <ref>Foo</ref> {{echo|<references />}}
22185 !! html/parsoid
22186 <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>
22187 </ol>
22188 !! end
22189
22190 !! test
22191 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22192 !! wikitext
22193 A <ref>foo bar for a</ref>
22194 B <ref group="X" name="b" />
22195
22196 <references />
22197
22198 <references group="X">
22199 <ref name="b">foo</ref>
22200 </references>
22201 !! html/parsoid
22202 <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>
22203 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>
22204 </p>
22205
22206 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22207 <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>
22208 </ol>
22209
22210 <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"}}'>
22211 <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>
22212 </ol>
22213 !! end
22214
22215 !! test
22216 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22217 !! wikitext
22218 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22219 <references />
22220 !! html/parsoid
22221 <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>
22222 <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>
22223 </ol>
22224 !!end
22225
22226 # This test only works in wt2html now as the <references /> are always generated
22227 # unless selser is active. Once T72722 is fixed, we should add a changes test
22228 # here to ensure that unrelated changes don't add the new <references />
22229 # when selser is active.
22230 !! test
22231 References: 9. Generate missing references list at the end
22232 !! wikitext
22233 A <ref>foo</ref>
22234 B <ref group="inexistent">bar</ref>
22235 !! html/parsoid
22236 <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>
22237 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22238 <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>
22239 </ol>
22240 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22241 <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>
22242 </ol>
22243 !! end
22244
22245 !! test
22246 References: 10. New <references/> shouldn't be added for unrelated edits.
22247 !! options
22248 parsoid={
22249 "modes": ["selser"],
22250 "changes": [["#x", "remove"]],
22251 "selser": "noauto"
22252 }
22253 !! wikitext
22254 Unrelated text<span id="x"> that's going to disappear</span>.
22255 A <ref>foo</ref>
22256 !! wikitext/edited
22257 Unrelated text.
22258 A <ref>foo</ref>
22259 !!end
22260
22261 !! test
22262 Entities in ref name
22263 !! wikitext
22264 <ref name="test &amp; me">hi</ref>
22265 <references />
22266 !! html/parsoid
22267 <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>
22268 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22269 <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>
22270 </ol>
22271 !! end
22272
22273 ## The output here may look funny, but it's what the php parser will do. The
22274 ## unclosed references tag becomes escaped text, and then a new references
22275 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22276 ## nowiki tags, and the auto-generated references tag is only dropped in
22277 ## rtTestMode.
22278 !! test
22279 Generate references for unclosed references tag
22280 !! options
22281 parsoid=wt2html
22282 !! wikitext
22283 a<ref>foo</ref>
22284
22285 <references>
22286 !! html/parsoid
22287 <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>
22288
22289 <p>&lt;references></p>
22290 <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>
22291 !! end
22292
22293 !! test
22294 New reference serializes on its own line
22295 !! options
22296 parsoid=wt2wt,html2wt
22297 !! wikitext
22298 foo
22299 <references />
22300 !! html/parsoid
22301 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22302 !! end
22303
22304 #### ----------------------------------------------------------------
22305 #### Parsoid-only testing of Parsoid's impl of LST
22306 #### Not implemented yet, see
22307 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22308 #### ----------------------------------------------------------------
22309
22310 !! test
22311 LST Sections: 1. Simple section start and end
22312 !! options
22313 parsoid={ "suppressErrors": true }
22314 !! wikitext
22315 <section begin="2011-05-16" />
22316 <section end="2014-04-10 (MW 1.23wmf22)" />
22317 !! html/parsoid
22318 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22319 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22320 !! end
22321
22322 #--------- Test stripping of empty nodes in template content ----------
22323 !!test
22324 Empty LI and TR nodes should be stripped from template content
22325 !!wikitext
22326 {{EmptyLITest}}
22327 {{EmptyTRTest}}
22328 !!html/parsoid
22329 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22330 <li>a</li>
22331 <li>b</li>
22332 </ul>
22333 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22334 <tbody>
22335 <tr>
22336 <td>foo</td>
22337 </tr>
22338 <tr>
22339 <td>bar</td>
22340 </tr>
22341 </tbody>
22342 </table>
22343 !!end
22344
22345 !!test
22346 Empty LI and TR nodes should not be stripped from top-level content
22347 !!wikitext
22348 * a
22349 *
22350 * b
22351 {|
22352 |-
22353 |-
22354 |foo
22355 |}
22356 !!html/parsoid
22357 <ul>
22358 <li> a</li>
22359 <li></li>
22360 <li> b</li>
22361 </ul>
22362 <table>
22363 <tbody>
22364 <tr></tr>
22365 <tr>
22366 <td>foo</td>
22367 </tr>
22368 </tbody>
22369 </table>
22370 !!end
22371
22372 !!test
22373 Empty TR nodes should not be stripped if they have any attributes set
22374 !!wikitext
22375 {{EmptyTRWithHTMLAttrTest}}
22376 !!html/parsoid
22377 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22378 <tr align="center"></tr>
22379 <tr><td>foo</td></tr>
22380 <tr align="center"></tr>
22381 <tr><td>bar</td></tr>
22382 </table>
22383 !!end
22384
22385 #### ----------------------------------------------------------------
22386 #### The following section of tests are primarily to test
22387 #### wikitext escaping capabilities of Parsoid. Given that
22388 #### escaping can be done any number of ways, the wikitext (input)
22389 #### is always adjusted to reflect how Parsoid adds nowiki
22390 #### escape tags.
22391 ####
22392 #### We are marking several tests as parsoid-only since the
22393 #### HTML in the result section is different from what the
22394 #### PHP parser generates for it.
22395 #### ----------------------------------------------------------------
22396
22397
22398 #### --------------- Headings ---------------
22399 #### 0. Unnested
22400 #### 1. Nested inside html <h1>=foo=</h1>
22401 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22402 #### 3. Nested inside html with wikitext split by html tags
22403 #### 4. No escape needed
22404 #### 5. Empty headings <h1></h1>
22405 #### 6. Heading chars in SOL context
22406 #### ----------------------------------------
22407 !! test
22408 Headings: 0. Unnested
22409 !! options
22410 parsoid=html2wt
22411 !! html/parsoid
22412 <p>=foo=</p>
22413
22414 <p> =foo=
22415 <!--cmt-->
22416 =foo=</p>
22417
22418 <p>=foo<i>a</i>=</p>
22419 !! wikitext
22420 <nowiki>=foo=</nowiki>
22421
22422 <nowiki> </nowiki>=foo=
22423 <!--cmt-->
22424 <nowiki>=foo=</nowiki>
22425
22426 =foo''a''<nowiki>=</nowiki>
22427 !!end
22428
22429 # New headings and existing headings are handled differently
22430 !! test
22431 Headings: 1. Nested inside html
22432 !! options
22433 parsoid=html2wt
22434 !! html/parsoid
22435 <h1>=foo=</h1>
22436 <h2>=foo=</h2>
22437 <h3>=foo=</h3>
22438
22439 <h1 data-parsoid=''>=foo=</h1>
22440 <h2 data-parsoid=''>=foo=</h2>
22441 <h3 data-parsoid=''>=foo=</h3>
22442 <h4 data-parsoid=''>=foo=</h4>
22443 <h5 data-parsoid=''>=foo=</h5>
22444 <h6 data-parsoid=''>=foo=</h6>
22445 !! wikitext
22446 = =foo= =
22447
22448 == =foo= ==
22449
22450 === =foo= ===
22451
22452 =<nowiki>=foo=</nowiki>=
22453 ==<nowiki>=foo=</nowiki>==
22454 ===<nowiki>=foo=</nowiki>===
22455 ====<nowiki>=foo=</nowiki>====
22456 =====<nowiki>=foo=</nowiki>=====
22457 ======<nowiki>=foo=</nowiki>======
22458
22459 !!end
22460
22461 !! test
22462 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22463 !! options
22464 parsoid=html2wt
22465 !! html/parsoid
22466 <h1>foo</h1>*bar
22467 <h1>foo</h1>=bar
22468 <h1>foo</h1>=bar=
22469 !! wikitext
22470 = foo =
22471 <nowiki>*</nowiki>bar
22472
22473 = foo =
22474 =bar
22475
22476 = foo =
22477 <nowiki>=bar=</nowiki>
22478 !!end
22479
22480 !! test
22481 Headings: 3. Nested inside html with wikitext split by html tags
22482 !! options
22483 parsoid=html2wt
22484 !! html/parsoid
22485 <h1>=<b>bold</b>foo=</h1>
22486 !! wikitext
22487 = ='''bold'''foo= =
22488 !!end
22489
22490 !! test
22491 Headings: 4a. No escaping needed (testing just h1 and h2)
22492 !! options
22493 parsoid=html2wt
22494 !! html/parsoid
22495 <h1>=foo</h1>
22496 <h1>foo=</h1>
22497 <h1> =foo= </h1>
22498 <h1>=foo= bar</h1>
22499 <h2>=foo</h2>
22500 <h2>foo=</h2>
22501 <h1>=</h1>
22502 <h1><i>=</i>foo=</h1>
22503 !! wikitext
22504 = =foo =
22505
22506 = foo= =
22507
22508 = =foo= =
22509
22510 = =foo= bar =
22511
22512 == =foo ==
22513
22514 == foo= ==
22515
22516 = = =
22517
22518 = ''=''foo= =
22519 !!end
22520
22521 !! test
22522 Headings: 4b. No escaping needed (inside p-tags)
22523 !! options
22524 parsoid=html2wt
22525 !! html/parsoid
22526 <p>===
22527 =foo= x
22528 =foo= <s></s>
22529 </p>
22530 !! wikitext
22531 ===
22532 =foo= x
22533 =foo= <s></s>
22534 !!end
22535
22536 !! test
22537 Headings: 5. Empty headings
22538 !! options
22539 parsoid=html2wt
22540 !! html/parsoid
22541 <h1 data-parsoid='{}'></h1>
22542
22543 <h2 data-parsoid='{}'></h2>
22544
22545 <h3 data-parsoid='{}'></h3>
22546
22547 <h4 data-parsoid='{}'></h4>
22548
22549 <h5 data-parsoid='{}'></h5>
22550
22551 <h6 data-parsoid='{}'></h6>
22552 !! wikitext
22553 =<nowiki/>=
22554
22555 ==<nowiki/>==
22556
22557 ===<nowiki/>===
22558
22559 ====<nowiki/>====
22560
22561 =====<nowiki/>=====
22562
22563 ======<nowiki/>======
22564 !!end
22565
22566 !! test
22567 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22568 !! options
22569 parsoid=html2wt
22570 !! html/parsoid
22571 <p>=a=</p>
22572
22573 <p>=a=</p>
22574
22575 <p>=a=</p>
22576 !! wikitext
22577 <nowiki>=a=</nowiki>
22578
22579 <nowiki>=a=</nowiki>
22580
22581 <nowiki>=a=</nowiki>
22582 !!end
22583
22584 !! test
22585 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22586 !! options
22587 parsoid=html2wt
22588 !! html/parsoid
22589 <p>=a=
22590 b</p>
22591
22592 <p>=a=
22593 b</p>
22594
22595 <p>=a=
22596 b</p>
22597 !! wikitext
22598 <nowiki>=a=</nowiki>
22599 b
22600
22601 <nowiki>=a=</nowiki>
22602 b
22603
22604 <nowiki>=a=</nowiki>
22605 b
22606 !!end
22607
22608 !! test
22609 Headings: 6c. Heading chars in SOL context (leading newline break)
22610 !! options
22611 parsoid=html2wt
22612 !! html/parsoid
22613 <p>a
22614 =b=</p>
22615 !! wikitext
22616 a
22617 <nowiki>=b=</nowiki>
22618 !!end
22619
22620 !! test
22621 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22622 !! options
22623 parsoid=html2wt
22624 !! html/parsoid
22625 <!--c0--><p>=a=</p>
22626
22627 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22628 !! wikitext
22629 <!--c0--><nowiki>=a=</nowiki>
22630
22631 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22632 !!end
22633
22634 !! test
22635 Headings: 6d. Heading chars in SOL context (No escaping needed)
22636 !! options
22637 parsoid=html2wt
22638 !! html/parsoid
22639 =a=<div>b</div>
22640 !! wikitext
22641 =a=<div>b</div>
22642 !!end
22643
22644 !! test
22645 Headings: 7. Insert a newline between new content and headings
22646 !! options
22647 parsoid=html2wt
22648 !! html/parsoid
22649 <h2>NEW</h2>
22650 <p>new</p>
22651 <h2 data-parsoid='{}'>A</h2>
22652 <p data-parsoid='{}'>a</p>
22653 !! wikitext
22654 == NEW ==
22655 new
22656
22657 ==A==
22658 a
22659
22660 !! end
22661
22662 #### --------------- Lists ---------------
22663 #### 0. Outside nests (*foo, etc.)
22664 #### 1. Nested inside html <ul><li>*foo</li></ul>
22665 #### 2. Inside definition lists
22666 #### 3. Only bullets at start should be escaped
22667 #### 4. No escapes needed
22668 #### 5. No unnecessary escapes
22669 #### 6. Escape bullets in SOL position
22670 #### 7. Escape bullets in a multi-line context
22671 #### ----------------------------------------
22672
22673 !! test
22674 Lists: 0. Outside nests
22675 !! options
22676 parsoid=html2wt
22677 !! html/parsoid
22678 <p>*foo</p>
22679
22680 <p>#foo</p>
22681
22682 <p>;Foo:bar</p>
22683 !! wikitext
22684 <nowiki>*</nowiki>foo
22685
22686 <nowiki>#</nowiki>foo
22687
22688 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22689 !!end
22690
22691 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22692 ## to test wikitext escaping, and insignificant whitespace diffs
22693 ## cause PHP parser tests to barf
22694 !! test
22695 Lists: 1. Nested inside html (No unnecessary escapes)
22696 !! options
22697 parsoid=html2wt
22698 !! html/parsoid
22699 <ul>
22700 <li>*foo</li>
22701 <li>#foo</li>
22702 <li>:foo</li>
22703 <li>;foo</li>
22704 <li data-parsoid='{}'>*foo</li>
22705 <li data-parsoid='{}'>#foo</li>
22706 <li data-parsoid='{}'>:foo</li>
22707 <li data-parsoid='{}'>;foo</li>
22708 </ul>
22709
22710 <ol>
22711 <li>*foo</li>
22712 <li>#foo</li>
22713 <li>:foo</li>
22714 <li>;foo</li>
22715 <li data-parsoid='{}'>*foo</li>
22716 <li data-parsoid='{}'>#foo</li>
22717 <li data-parsoid='{}'>:foo</li>
22718 <li data-parsoid='{}'>;foo</li>
22719 </ol>
22720 !! wikitext
22721 * *foo
22722 * #foo
22723 * :foo
22724 * ;foo
22725 *<nowiki>*foo</nowiki>
22726 *<nowiki>#foo</nowiki>
22727 *<nowiki>:foo</nowiki>
22728 *<nowiki>;foo</nowiki>
22729
22730 # *foo
22731 # #foo
22732 # :foo
22733 # ;foo
22734 #<nowiki>*foo</nowiki>
22735 #<nowiki>#foo</nowiki>
22736 #<nowiki>:foo</nowiki>
22737 #<nowiki>;foo</nowiki>
22738 !!end
22739
22740 !! test
22741 Lists: 2. Inside definition lists
22742 !! options
22743 parsoid=html2wt
22744 !! html/parsoid
22745 <dl><dt>;foo</dt></dl>
22746 <dl><dt>:foo</dt></dl>
22747 <dl><dt>:foo</dt>
22748 <dd>bar</dd></dl>
22749 <dl><dd>:foo</dd></dl>
22750 !! wikitext
22751 ; ;foo
22752
22753 ; <nowiki>:foo</nowiki>
22754
22755 ; <nowiki>:foo</nowiki>
22756 : bar
22757
22758 : :foo
22759 !!end
22760
22761 !! test
22762 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22763 !! options
22764 parsoid=html2wt
22765 !! html/parsoid
22766 <ul>
22767 <li>*foo*bar</li>
22768 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22769 </ul>
22770 !! wikitext
22771 * *foo*bar
22772 *<nowiki>*foo</nowiki>''it''*bar
22773 !!end
22774
22775 !! test
22776 Lists: 4. No escapes needed
22777 !! options
22778 parsoid=html2wt
22779 !! html/parsoid
22780 <ul>
22781 <li>foo*bar
22782 </li>
22783 </ul>
22784 <ul>
22785 <li><i>foo</i>*bar
22786 </li>
22787 </ul>
22788 <ul>
22789 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22790 </li>
22791 </ul>
22792 <ul>
22793 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22794 </li>
22795 </ul>
22796 !! wikitext
22797 *foo*bar
22798
22799 *''foo''*bar
22800
22801 *[[Foo]]: bar
22802
22803 *[[Foo]]*bar
22804 !!end
22805
22806 !! test
22807 Lists: 5. No unnecessary escapes
22808 !! options
22809 parsoid=html2wt
22810 !! html/parsoid
22811 <ul><li> bar <span>[[foo]]</span></li></ul>
22812 <ul><li> =bar <span>[[foo]]</span></li></ul>
22813 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22814 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22815 <ul><li> =bar <span>foo]]</span>=</li></ul>
22816 <ul><li> <s></s>: a</li></ul>
22817 <ul><li> <i>* foo</i></li></ul>
22818
22819 !! wikitext
22820 * bar <span><nowiki>[[foo]]</nowiki></span>
22821
22822 * =bar <span><nowiki>[[foo]]</nowiki></span>
22823
22824 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22825
22826 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22827
22828 * =bar <span>foo]]</span>=
22829
22830 * <s></s>: a
22831
22832 * ''* foo''
22833 !!end
22834
22835 !! test
22836 Lists: 6. Escape bullets in SOL position
22837 !! options
22838 parsoid=html2wt
22839 !! html/parsoid
22840 <p><!--cmt-->*foo</p>
22841 !! wikitext
22842 <!--cmt--><nowiki>*</nowiki>foo
22843 !!end
22844
22845 !! test
22846 Lists: 7. Escape bullets in a multi-line context
22847 !! options
22848 parsoid=html2wt
22849 !! html/parsoid
22850 <p>a
22851 *b
22852 </p>
22853 !! wikitext
22854 a
22855 <nowiki>*</nowiki>b
22856 !!end
22857
22858 !! test
22859 Lists: 8. Escape colons only if not present in tags
22860 !! options
22861 parsoid=html2wt
22862 !! html/parsoid
22863 <dl><dt>a:b<i>c:d</i></dt></dl>
22864 !! wikitext
22865 ; <nowiki>a:b</nowiki>''c:d''
22866 !! end
22867
22868 #### --------------- HRs ---------------
22869 #### 1. Single line
22870 #### -----------------------------------
22871
22872 !! test
22873 HRs: 1. Single line
22874 !! options
22875 parsoid=html2wt
22876 !! html/parsoid
22877 <hr />----
22878 <hr />=foo=
22879 <hr />*foo
22880 !! wikitext
22881 ----<nowiki>----</nowiki>
22882 ----=foo=
22883 ----*foo
22884 !! end
22885
22886 #### --------------- Tables ---------------
22887 #### 1a. Simple example
22888 #### 1b. No escaping needed (!foo)
22889 #### 1c. No escaping needed (|foo)
22890 #### 1d. No escaping needed (|}foo)
22891 ####
22892 #### 2a. Nested in td (<td>foo|bar</td>)
22893 #### 2b. Nested in td (<td>foo||bar</td>)
22894 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22895 ####
22896 #### 3a. Nested in th (<th>foo!bar</th>)
22897 #### 3b. Nested in th (<th>foo!!bar</th>)
22898 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22899 ####
22900 #### 4a. Escape -
22901 #### 4b. Escape +
22902 #### 4c. No escaping needed
22903 #### --------------------------------------
22904
22905 !! test
22906 Tables: 1a. Simple example
22907 !! options
22908 parsoid=html2wt
22909 !! html/parsoid
22910 <p>{|
22911 |}
22912 </p>
22913 !! wikitext
22914 <nowiki>{|</nowiki>
22915 |}
22916 !! end
22917
22918 !! test
22919 Tables: 1b. No escaping needed
22920 !! options
22921 parsoid=html2wt
22922 !! html/parsoid
22923 <p>!foo
22924 </p>
22925 !! wikitext
22926 !foo
22927 !! end
22928
22929 !! test
22930 Tables: 1c. No escaping needed
22931 !! options
22932 parsoid=html2wt
22933 !! html/parsoid
22934 <p>|foo
22935 </p>
22936 !! wikitext
22937 |foo
22938 !! end
22939
22940 !! test
22941 Tables: 1d. No escaping needed
22942 !! options
22943 parsoid=html2wt
22944 !! html/parsoid
22945 <p>|}foo
22946 </p>
22947 !! wikitext
22948 |}foo
22949 !! end
22950
22951 !! test
22952 Tables: 2a. Nested in td
22953 !! options
22954 parsoid=html2wt
22955 !! html/parsoid
22956 <table><tbody><tr>
22957 <td>foo|bar</td></tr>
22958 <tr><td>x<div>a|b</div></td>
22959 </tbody></table>
22960 !! wikitext
22961 {|
22962 |<nowiki>foo|bar</nowiki>
22963 |-
22964 |x<div><nowiki>a|b</nowiki></div>
22965 |}
22966 !! html/php+tidy
22967 <table>
22968 <tr>
22969 <td>foo|bar</td>
22970 </tr>
22971 <tr>
22972 <td>x
22973 <div>a|b</div>
22974 </td>
22975 </tr>
22976 </table>
22977 !! end
22978
22979 !! test
22980 Tables: 2b. Nested in td
22981 !! options
22982 parsoid=html2wt
22983 !! html/parsoid
22984 <table><tbody><tr>
22985 <td>foo||bar</td>
22986 <td>a<i>b||c</i></td>
22987 <td>a<i><div>b||c</div></i></td>
22988 </tr></tbody></table>
22989 !! wikitext
22990 {|
22991 |<nowiki>foo||bar</nowiki>
22992 |a''<nowiki>b||c</nowiki>''
22993 |a''<div><nowiki>b||c</nowiki></div>''
22994 |}
22995 !! html/php
22996 <table>
22997 <tr>
22998 <td>foo||bar
22999 </td>
23000 <td>a<i>b||c</i>
23001 </td>
23002 <td>a<i><div>b||c</div></i>
23003 </td></tr></table>
23004
23005 !! end
23006
23007 !! test
23008 Tables: 2c. Nested in td -- no escaping needed
23009 !! options
23010 parsoid=html2wt
23011 !! html/*
23012 <table>
23013
23014 <tr>
23015 <td>foo!!bar
23016 </td></tr></table>
23017
23018 !! wikitext
23019 {|
23020
23021 |foo!!bar
23022 |}
23023 !! end
23024
23025 !! test
23026 Tables: 3a. Nested in th
23027 !! options
23028 parsoid=html2wt
23029 !! html/*
23030 <table>
23031
23032 <tr>
23033 <th>foo!bar
23034 </th></tr></table>
23035
23036 !! wikitext
23037 {|
23038
23039 !foo!bar
23040 |}
23041 !! end
23042
23043 !! test
23044 Tables: 3b. Nested in th
23045 !! options
23046 parsoid=html2wt
23047 !! html/parsoid
23048 <table><tbody>
23049 <tr><th>foo!!bar</th>
23050 <th><i>foo|bar</i></th>
23051 <th><i>foo!!bar</i></th>
23052 <th><i><span>foo!!bar</span></i></th>
23053 </tr></tbody></table>
23054 !! wikitext
23055 {|
23056 !<nowiki>foo!!bar</nowiki>
23057 !''<nowiki>foo|bar</nowiki>''
23058 !''<nowiki>foo!!bar</nowiki>''
23059 !''<span><nowiki>foo!!bar</nowiki></span>''
23060 |}
23061 !! html/php
23062 <table>
23063 <tr>
23064 <th>foo!!bar
23065 </th>
23066 <th><i>foo|bar</i>
23067 </th>
23068 <th><i>foo!!bar</i>
23069 </th>
23070 <th><i><span>foo!!bar</span></i>
23071 </th></tr></table>
23072
23073 !! end
23074
23075 !! test
23076 Tables: 3c. Nested in th
23077 !! options
23078 parsoid=html2wt
23079 !! html/parsoid
23080 <table><tbody>
23081 <tr><th>foo||bar</th>
23082 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23083 </tr></tbody></table>
23084 !! wikitext
23085 {|
23086 !<nowiki>foo||bar</nowiki>
23087 !<nowiki>foo||bar</nowiki>
23088 |}
23089 !! html/php
23090 <table>
23091 <tr>
23092 <th>foo||bar
23093 </th>
23094 <th>foo||bar
23095 </th></tr></table>
23096
23097 !! end
23098
23099 !! test
23100 Tables: 4a. Escape -
23101 !! options
23102 parsoid=html2wt
23103 !! html/*
23104 <table>
23105
23106 <tr>
23107 <th>-bar
23108 </th></tr>
23109 <tr>
23110 <td>-bar
23111 </td></tr></table>
23112
23113 !! wikitext
23114 {|
23115
23116 !-bar
23117
23118 |-
23119 |<nowiki>-bar</nowiki>
23120 |}
23121 !! end
23122
23123 !! test
23124 Tables: 4b. Escape +
23125 !! options
23126 parsoid=html2wt
23127 !! html/*
23128 <table>
23129
23130 <tr>
23131 <th>+bar
23132 </th></tr>
23133 <tr>
23134 <td>+bar
23135 </td></tr></table>
23136
23137 !! wikitext
23138 {|
23139
23140 !+bar
23141
23142 |-
23143 |<nowiki>+bar</nowiki>
23144 |}
23145 !! end
23146
23147 !! test
23148 Tables: 4c. No escaping needed
23149 !! options
23150 parsoid=html2wt
23151 !! html/parsoid
23152 <table><tbody>
23153 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23154 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23155 <tr><td>foo
23156 <p>bar|baz
23157 +bar
23158 -bar</p></td></tr>
23159 <tr><td>x
23160 <div>a|b</div></td>
23161 </tbody></table>
23162 !! wikitext
23163 {|
23164 |foo-bar
23165 |foo+bar
23166 |-
23167 |''foo''-bar
23168 |''foo''+bar
23169 |-
23170 |foo
23171 bar|baz
23172 +bar
23173 -bar
23174 |-
23175 |x
23176 <div>a|b</div>
23177 |}
23178 !! html/php
23179 <table>
23180 <tr>
23181 <td>foo-bar
23182 </td>
23183 <td>foo+bar
23184 </td></tr>
23185 <tr>
23186 <td><i>foo</i>-bar
23187 </td>
23188 <td><i>foo</i>+bar
23189 </td></tr>
23190 <tr>
23191 <td>foo
23192 <p>bar|baz
23193 +bar
23194 -bar
23195 </p>
23196 </td></tr>
23197 <tr>
23198 <td>x
23199 <div>a|b</div>
23200 </td></tr></table>
23201
23202 !! end
23203
23204 !! test
23205 Tables: 4d. No escaping needed
23206 !! options
23207 parsoid=html2wt
23208 !! html/parsoid
23209 <table>
23210 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23211 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23212 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23213 </tbody></table>
23214 !! wikitext
23215 {|
23216 |[[Foo]]-bar
23217 ||+1
23218 ||-2
23219 |}
23220 !! html/php
23221 <table>
23222 <tr>
23223 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23224 </td>
23225 <td>+1
23226 </td>
23227 <td>-2
23228 </td></tr></table>
23229
23230 !! end
23231
23232 !! test
23233 T97430: Don't emit empty nowiki pairs around marker meta tags
23234 !! options
23235 parsoid=html2wt
23236 !! html/parsoid
23237 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23238 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23239 !! wikitext
23240 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23241 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23242 !! end
23243
23244 !! test
23245 Unclosed xmlish element in table line shouldn't eat end delimiters
23246 !! options
23247 parsoid=html2wt
23248 !! html/parsoid
23249 <table>
23250 <tbody><tr><td> &lt;foo</td>
23251 <td> bar></td></tr>
23252 </tbody></table>
23253 !! wikitext
23254 {|
23255 | <foo
23256 | bar>
23257 |}
23258 !! html/php
23259 <table>
23260 <tr>
23261 <td> &lt;foo
23262 </td>
23263 <td> bar&gt;
23264 </td></tr></table>
23265
23266 !! end
23267
23268 #### --------------- Links ----------------
23269 #### 1. Quote marks in link text
23270 #### 2. Wikilinks: Escapes needed
23271 #### 3. Wikilinks: No escapes needed
23272 #### 4. Extlinks: Escapes needed
23273 #### 5. Extlinks: No escapes needed
23274 #### --------------------------------------
23275 !! test
23276 Links 1. WikiLinks: No escapes needed
23277 !! options
23278 parsoid=html2wt
23279 !! html/parsoid
23280 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23281 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23282 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23283 !! wikitext
23284 [[Foo|Foo''boo'']]
23285 [[Foo|[Foobar]]]
23286 [[Foo|x [Foobar] x]]
23287 !! html/php
23288 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23289 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23290 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23291 </p>
23292 !! end
23293
23294 !! test
23295 Links 2. WikiLinks: Escapes needed
23296 !! options
23297 parsoid=html2wt
23298 !! html/parsoid
23299 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23300 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23301 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23302 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23303 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23304 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23305 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23306 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23307 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23308 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23309 !! wikitext
23310 [[Foo|<nowiki>Foobar]</nowiki>]]
23311 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23312 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23313 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23314 [[Foo|<nowiki>|Bar</nowiki>]]
23315 [[Foo|<nowiki>]]bar</nowiki>]]
23316 [[Foo|<nowiki>[[bar</nowiki>]]
23317 [[Foo|<nowiki>x [[ y</nowiki>]]
23318 [[Foo|<nowiki>x ]] y</nowiki>]]
23319 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23320 !! html/php
23321 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23322 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23323 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23324 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23325 <a href="/wiki/Foo" title="Foo">|Bar</a>
23326 <a href="/wiki/Foo" title="Foo">]]bar</a>
23327 <a href="/wiki/Foo" title="Foo">[[bar</a>
23328 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23329 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23330 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23331 </p>
23332 !! end
23333
23334 !! test
23335 Links 3. WikiLinks: No escapes needed
23336 !! options
23337 parsoid=html2wt
23338 !! html/parsoid
23339 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23340 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23341 !! wikitext
23342 [[Foo|[Foobar]]
23343 [[Foo|foo|bar]]
23344 !! html/php
23345 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23346 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23347 </p>
23348 !! end
23349
23350 !! test
23351 Links 4. ExtLinks: Escapes needed
23352 !! options
23353 parsoid=html2wt
23354 !! html/parsoid
23355 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23356 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23357 <p>[http://google.com]</p>
23358 <p>[http://google.com google]</p>
23359 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23360 <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>
23361 !! wikitext
23362 [http://google.com <nowiki>[google]</nowiki>]
23363 [http://google.com <nowiki>google]</nowiki>]
23364
23365 <nowiki>[http://google.com]</nowiki>
23366
23367 <nowiki>[http://google.com google]</nowiki>
23368
23369 [http://google.com<nowiki>]</nowiki>
23370
23371 [{{echo|http://google.com}}<nowiki>]</nowiki>
23372 !! html/php
23373 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23374 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23375 </p><p>[http://google.com]
23376 </p><p>[http://google.com google]
23377 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23378 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23379 </p>
23380 !! end
23381
23382 !! test
23383 Links 5. ExtLinks: No escapes needed
23384 !! options
23385 parsoid=html2wt
23386 !! html/parsoid
23387 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23388 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23389 !! wikitext
23390 [http://google.com [google]
23391
23392 [[http://google.com]]
23393 !! html/php
23394 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23395 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23396 </p>
23397 !! end
23398
23399 !! test
23400 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23401 !! options
23402 parsoid=html2wt
23403 !! html/parsoid
23404 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23405 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23406 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23407 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23408 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23409 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23410 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23411 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23412 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23413 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23414 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23415 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23416 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23417 </p>
23418 !! wikitext
23419 x<nowiki/>http://example.com<nowiki/>y
23420 http://example.com<nowiki/>?x
23421 http://example.com<nowiki/>&x
23422 http://example.com<nowiki/>'x
23423 http://example.com<nowiki/>,x
23424 http://example.com<nowiki/>.x
23425 http://example.com<nowiki/>;x
23426 http://example.com<nowiki/>:x
23427 http://example.com<nowiki/>;x
23428 http://example.com<nowiki/>!x
23429 http://example.com<nowiki/>=x
23430 http://example.com<nowiki/>(x)
23431 http://example.com(x<nowiki/>)
23432 !! end
23433
23434 !! test
23435 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23436 !! options
23437 parsoid=html2wt
23438 !! html/parsoid
23439 <p>x
23440 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23441 y
23442 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23443 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23444 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23445 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23446 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23447 </p>
23448 !! wikitext
23449 x
23450 http://example.com
23451 y
23452 "http://example.com"
23453 (http://example.com)
23454 (http://example.com) foo
23455 http://example.com,
23456 http://example.com, foo
23457 !! html/php
23458 <p>x
23459 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23460 y
23461 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23462 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23463 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23464 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23465 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23466 </p>
23467 !! end
23468
23469 !! test
23470 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23471 !! options
23472 parsoid=html2wt
23473 !! html/parsoid
23474 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23475 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23476 !! wikitext
23477 http://example.com.,;:!?\
23478 -http://example.com:
23479 !! html/php
23480 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23481 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23482 </p>
23483 !! end
23484
23485 !! test
23486 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23487 !! options
23488 parsoid=html2wt
23489 !! html/parsoid
23490 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23491 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23492 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23493 !! wikitext
23494 RFC 123<nowiki/>4
23495 RFC 123<nowiki/>y
23496 X<nowiki/>RFC 123<nowiki/>y
23497 !! end
23498
23499 !! test
23500 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23501 !! options
23502 parsoid=html2wt
23503 !! html/parsoid
23504 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23505 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23506 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23507 </p>
23508 !! wikitext
23509 RFC 123?foo
23510 RFC 123&foo
23511 -RFC 123-
23512 !! html/php
23513 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23514 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23515 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23516 </p>
23517 !! end
23518
23519 !! test
23520 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23521 !! options
23522 parsoid=html2wt
23523 !! html/parsoid
23524 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23525 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23526 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23527 !! wikitext
23528 PMID 123<nowiki/>4
23529 PMID 123<nowiki/>y
23530 X<nowiki/>PMID 123<nowiki/>y
23531 !! end
23532
23533 !! test
23534 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23535 !! options
23536 parsoid=html2wt
23537 !! html/parsoid
23538 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23539 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23540 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23541 </p>
23542 !! wikitext
23543 PMID 123?foo
23544 PMID 123&foo
23545 -PMID 123-
23546 !! html/php
23547 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23548 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23549 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23550 </p>
23551 !! end
23552
23553 !! test
23554 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23555 !! options
23556 parsoid=html2wt
23557 !! html/parsoid
23558 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23559 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23560 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23561 </p>
23562 !! wikitext
23563 ISBN 1234567890<nowiki/>1
23564 ISBN 1234567890<nowiki/>x
23565 a<nowiki/>ISBN 1234567890<nowiki/>b
23566 !! end
23567
23568 !! test
23569 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23570 !! options
23571 parsoid=html2wt
23572 !! html/parsoid
23573 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23574 !! wikitext
23575 -ISBN 1234567890's
23576 !! html/php
23577 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23578 </p>
23579 !! end
23580
23581 !! test
23582 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23583 !! options
23584 parsoid=html2wt
23585 !! html/*
23586 <p>this is not a link: http://example.com
23587 </p>
23588 !! wikitext
23589 this is not a link: <nowiki>http://example.com</nowiki>
23590 !! end
23591
23592 !! test
23593 Links 15. Link trails can't become link prefixes.
23594 !! options
23595 language=is
23596 parsoid=html2wt
23597 !! html/parsoid
23598 <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>
23599 !! wikitext
23600 [[Söfnuður]]-[[00]]
23601 !! html/php
23602 <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>
23603 </p>
23604 !! end
23605
23606 #### --------------- Quotes ---------------
23607 #### 1. Quotes inside <b> and <i>
23608 #### 2. Link fragments separated by <i> and <b> tags
23609 #### 3. Link fragments inside <i> and <b>
23610 #### 4. No escaping needed
23611 #### --------------------------------------
23612 !! test
23613 1a. Quotes inside <b> and <i>
23614 !! options
23615 parsoid=html2wt
23616 !! html/*
23617 <p><i>'foo'</i>
23618 <i>''foo''</i>
23619 <i>'''foo'''</i>
23620 <i>foo</i>'s
23621 <b>'foo'</b>
23622 <b>''foo''</b>
23623 <b>'''foo'''</b>
23624 <b>foo'<i>bar'</i>baz</b>
23625 <b>foo</b>'s
23626 '<i>foo</i>
23627 <i>foo</i>'
23628 <i>foo'</i>'
23629 '<i>foo</i>'
23630 '<b>foo</b>
23631 <b>foo</b>'
23632 '<b>foo</b>'
23633 <i>fools'<span> errand</span></i>
23634 <i><span>fool</span>'s errand</i>
23635 '<i>foo</i> bar '<i>baz</i>
23636 a|!*#-:;+-~[]{}b'<i>x</i>
23637 </p>
23638 !! wikitext
23639 ''<nowiki/>'foo'''
23640 ''<nowiki>''foo''</nowiki>''
23641 ''<nowiki>'''foo'''</nowiki>''
23642 ''foo''<nowiki/>'s
23643 '''<nowiki/>'foo''''
23644 '''<nowiki>''foo''</nowiki>'''
23645 '''<nowiki>'''foo'''</nowiki>'''
23646 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23647 '''foo'''<nowiki/>'s
23648 '''foo''
23649 ''foo''<nowiki/>'
23650 ''foo'''<nowiki/>'
23651 '''foo''<nowiki/>'
23652 ''''foo'''
23653 '''foo'''<nowiki/>'
23654 ''''foo'''<nowiki/>'
23655 ''fools'<span> errand</span>''
23656 ''<span>fool</span>'s errand''
23657 '<nowiki/>''foo'' bar '''baz''
23658 a|!*#-:;+-~[]{}b'''x''
23659 !! end
23660
23661 !! test
23662 1b. Quotes inside <b> and <i> with other tags on same line
23663 !! options
23664 parsoid=html2wt
23665 !! html/parsoid
23666 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23667 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23668 <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>
23669 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23670 '<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>
23671 '<i>foo</i> <div title="name">test</div>
23672 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23673 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23674 <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>
23675 </ol>
23676 !! wikitext
23677 '''a'' foo ''[[bar]]''
23678 ''a''' foo ''[[bar]]''
23679 ''a''' foo '''{{echo|[[bar]]}}'''
23680 [[foo]] x'''[[bar]]''
23681 '''foo'' <ref>test</ref>
23682 '''foo'' <div title="name">test</div>
23683 '''foo'' and <br> bar
23684 <references />
23685 !! end
23686
23687 !! test
23688 2. Link fragments separated by <i> and <b> tags
23689 !! options
23690 parsoid=html2wt
23691 !! html/parsoid
23692 <p>[[<i>foo</i>hello]]</p>
23693 <p>[[<b>foo</b>hello]]</p>
23694 !! wikitext
23695 [[''foo''<nowiki>hello]]</nowiki>
23696
23697 [['''foo'''<nowiki>hello]]</nowiki>
23698 !! end
23699
23700 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23701 # this is one of the shortcomings of this format
23702 !! test
23703 3. Link fragments inside <i> and <b>
23704 !! options
23705 parsoid=html2wt
23706 !! html/parsoid
23707 <p><i>[[foo</i>]]</p>
23708 <p><b>[[foo</b>]]</p>
23709 !! wikitext
23710 ''[[foo''<nowiki>]]</nowiki>
23711
23712 '''[[foo'''<nowiki>]]</nowiki>
23713 !! end
23714
23715 !! test
23716 4. No escaping needed
23717 !! options
23718 options=html2wt
23719 !! html/parsoid
23720 <p>'<span><i>bar</i></span>'
23721 '<span><b>bar</b></span>'
23722 'a:b'foo
23723 </p>
23724 !! wikitext
23725 '<span>''bar''</span>'
23726 '<span>'''bar'''</span>'
23727 'a:b'foo
23728 !! end
23729
23730 #### ----------- Paragraphs ---------------
23731 #### 1. No unnecessary escapes
23732 #### --------------------------------------
23733
23734 !! test
23735 1. No unnecessary escapes
23736 !! options
23737 parsoid=html2wt
23738 !! html/parsoid
23739 <p>bar <span>[[foo]]</span>
23740 </p><p>=bar <span>[[foo]]</span>
23741 </p><p>[[bar <span>[[foo]]</span>
23742 </p><p>]]bar <span>[[foo]]</span>
23743 </p><p>=bar <span>foo]]</span>=
23744 </p>
23745 !! wikitext
23746 bar <span><nowiki>[[foo]]</nowiki></span>
23747
23748 =bar <span><nowiki>[[foo]]</nowiki></span>
23749
23750 [[bar <span><nowiki>[[foo]]</nowiki></span>
23751
23752 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23753
23754 =bar <span>foo]]</span><nowiki>=</nowiki>
23755 !!end
23756
23757 #### ----------------------- PRE --------------------------
23758 #### 1. Leading whitespace in SOL context should be escaped
23759 #### ------------------------------------------------------
23760 !! test
23761 1. Leading whitespace in SOL context should be escaped
23762 !! options
23763 parsoid=html2wt
23764 !! html/parsoid
23765 <p> a</p>
23766
23767 <p> a</p>
23768
23769 <p> a(tab)</p>
23770
23771 <p> a
23772 <!--cmt-->
23773 a</p>
23774
23775 <p>a
23776 b</p>
23777
23778 <p>a
23779 b</p>
23780
23781 <p>a
23782 b</p>
23783 !! wikitext
23784 <nowiki> </nowiki>a
23785
23786 <nowiki> </nowiki> a
23787
23788 a(tab)
23789
23790 <nowiki> </nowiki> a
23791 <!--cmt-->
23792 <nowiki> </nowiki>a
23793
23794 a
23795 <nowiki> </nowiki>b
23796
23797 a
23798 b
23799
23800 a
23801 b
23802 !! html/php
23803 <p> a
23804 </p><p> a
23805 </p><p> a(tab)
23806 </p><p> a
23807 a
23808 </p><p>a
23809 b
23810 </p><p>a
23811 b
23812 </p><p>a
23813 b
23814 </p>
23815 !! end
23816
23817 !! test
23818 2. Leading whitespace in non-indent-pre contexts should not be escaped
23819 !! options
23820 parsoid=html2wt
23821 !! html/parsoid
23822 <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>
23823 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23824 <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>
23825 b</span></li>
23826 </ol>
23827 !! wikitext
23828 foo <ref>''a''
23829 b</ref>
23830 <references />
23831 !! end
23832
23833 !! test
23834 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23835 !! options
23836 parsoid=html2wt
23837 !! html/parsoid
23838 <blockquote>
23839 <p>
23840 a
23841 <span>b</span>
23842 c</p>
23843 </blockquote>
23844 !! wikitext
23845 <blockquote>
23846 a
23847 <span>b</span>
23848 c
23849 </blockquote>
23850 !! end
23851
23852 !! test
23853 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23854 !! options
23855 options=html2wt
23856 !! html/parsoid
23857 <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>
23858 !! wikitext
23859 [[File:Foobar.jpg|thumb|caption]]
23860 !! end
23861
23862 !! test
23863 5. Nowiki escaping should account for indent-pres
23864 !! options
23865 parsoid=html2wt
23866 !! html/parsoid
23867 <pre>==foo==</pre>
23868 !! wikitext
23869 ==foo==
23870 !! end
23871
23872 !!test
23873 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23874 !! options
23875 parsoid=html2wt
23876 !! html/parsoid
23877 <pre>
23878 * foo
23879 * bar
23880 </pre>
23881 !! wikitext
23882 * foo
23883 * bar
23884 !! end
23885
23886 #### --------------- Behavior Switches --------------------
23887
23888 !! test
23889 1. Valid behavior switches should be escaped
23890 !! options
23891 parsoid=html2wt
23892 !! html/parsoid
23893 __TOC__
23894 <i>__TOC__</i>
23895 !! wikitext
23896 <nowiki>__TOC__</nowiki>
23897 ''<nowiki>__TOC__</nowiki>''
23898 !! end
23899
23900 !! test
23901 2. Invalid behavior switches should not be escaped
23902 !! options
23903 parsoid=html2wt
23904 !! html/parsoid
23905 __TOO__
23906 __|__
23907 !! wikitext
23908 __TOO__
23909 __|__
23910 !! end
23911
23912 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23913 !! test
23914 Behavior switches should be SOL-transparent
23915 !! options
23916 parsoid=html2wt
23917 !! html/parsoid
23918 <meta property="mw:PageProp/toc" />
23919
23920 <!-- this one's bogus -->
23921 <pre>__TOO__</pre>
23922
23923 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23924
23925 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23926 !! wikitext
23927 __TOC__
23928
23929 <!-- this one's bogus -->
23930 __TOO__
23931
23932 __TOC__ foo
23933
23934 __TOC__
23935 bar
23936 !! end
23937
23938 #### --------------- HTML tags ---------------
23939 #### 1. a tags
23940 #### 2. other tags
23941 #### 3. multi-line html tag
23942 #### 4. extension tags
23943 #### -----------------------------------------
23944 !! test
23945 1. a tags
23946 !! options
23947 parsoid=html2wt
23948 !! html/parsoid
23949 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23950 !! wikitext
23951 <a href="http://google.com">google</a>
23952 !! end
23953
23954 !! test
23955 2. other tags
23956 !! options
23957 parsoid=html2wt
23958 !! html/parsoid
23959 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23960 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23961 <li> &lt;td&gt;</li></ul>
23962
23963 !! wikitext
23964 * <nowiki><div>foo</div></nowiki>
23965 * <nowiki><div style="color:red">foo</div></nowiki>
23966 * <nowiki><td></nowiki>
23967 !! end
23968
23969 !! test
23970 3. multi-line html tag
23971 !! options
23972 parsoid=html2wt
23973 !! html/parsoid
23974 <p>&lt;div
23975 &gt;foo&lt;/div
23976 &gt;
23977 </p>
23978 !! wikitext
23979 <nowiki><div
23980 >foo</div
23981 ></nowiki>
23982 !! end
23983
23984 !! test
23985 4. extension tags
23986 !! options
23987 parsoid=html2wt
23988 !! html/parsoid
23989 <p>&lt;ref&gt;foo&lt;/ref&gt;
23990 </p><p>&lt;ref&gt;bar
23991 </p><p>baz&lt;/ref&gt;
23992 </p>
23993 !! wikitext
23994 <nowiki><ref>foo</ref></nowiki>
23995
23996 <nowiki><ref>bar</nowiki>
23997
23998 baz<nowiki></ref></nowiki>
23999 !! end
24000
24001 #### --------------- Others ---------------
24002 !! test
24003 Escaping nowikis
24004 !! options
24005 parsoid=html2wt
24006 !! html/parsoid
24007 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24008 </p>
24009 !! wikitext
24010 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24011 !! end
24012
24013 ## The quote-char in the input is necessary for triggering the bug
24014 !! test
24015 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24016 !! options
24017 parsoid=html2wt
24018 !! html/parsoid
24019 <p>foo's bar :</p>
24020 !! wikitext
24021 foo's bar :
24022 !! end
24023
24024 #----------- End of wikitext escaping tests --------------
24025
24026 !! test
24027
24028 Tag-like HTML structures are passed through as text
24029 !! wikitext
24030 <x y>
24031
24032 <x.y>
24033
24034 <x-y>
24035
24036 1>2
24037
24038 x<y
24039
24040 a>b
24041
24042 1<d e>f
24043 !! html
24044 <p>&lt;x y&gt;
24045 </p><p>&lt;x.y&gt;
24046 </p><p>&lt;x-y&gt;
24047 </p><p>1&gt;2
24048 </p><p>x&lt;y
24049 </p><p>a&gt;b
24050 </p><p>1&lt;d e&gt;f
24051 </p>
24052 !! end
24053
24054 !! test
24055 HTML tag with necessary entities in attributes
24056 !! wikitext
24057 <span title="&amp;amp;">foo</span>
24058 !! html
24059 <p><span title="&amp;amp;">foo</span>
24060 </p>
24061 !! end
24062
24063 !! test
24064 HTML tag with 'unnecessary' entity encoding in attributes
24065 !! wikitext
24066 <span title="&amp;">foo</span>
24067 !! html
24068 <p><span title="&amp;">foo</span>
24069 </p>
24070 !! end
24071
24072 !! test
24073 HTML tag with broken attribute value quoting
24074 !! options
24075 parsoid=wt2html,html2html
24076 !! wikitext
24077 <span title="Hello world>Foo</span>
24078 !! html/php
24079 <p><span title="Hello world">Foo</span>
24080 </p>
24081 !! html/parsoid
24082 <p><span title="Hello world">Foo</span></p>
24083 !! end
24084
24085 !! test
24086 Self-closed tag with broken attribute value quoting
24087 !! options
24088 parsoid=wt2html,html2html
24089 !! wikitext
24090 <div title="Hello world />Foo
24091 !! html/php+tidy
24092 <div title="Hello world"></div>
24093 <p>Foo</p>
24094 !! html/parsoid
24095 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24096 !! end
24097
24098 !! test
24099 Table with broken attribute value quoting
24100 !! options
24101 parsoid=wt2html,html2html
24102 !! wikitext
24103 {|
24104 | title="Hello world|Foo
24105 |}
24106 !! html/php
24107 <table>
24108 <tr>
24109 <td title="Hello world">Foo
24110 </td></tr></table>
24111
24112 !! html/parsoid
24113 <table>
24114 <tr>
24115 <td title="Hello world">Foo
24116 </td></tr></table>
24117
24118 !! end
24119
24120 !! test
24121 Table with broken attribute value quoting on consecutive lines
24122 !! options
24123 parsoid=wt2html,html2html
24124 !! wikitext
24125 {|
24126 | title="Hello world|Foo
24127 | style="color:red|Bar
24128 |}
24129 !! html/php
24130 <table>
24131 <tr>
24132 <td title="Hello world">Foo
24133 </td>
24134 <td style="color:red">Bar
24135 </td></tr></table>
24136
24137 !! html/parsoid
24138 <table><tbody>
24139 <tr>
24140 <td title="Hello world">Foo
24141 </td><td style="color: red">Bar
24142 </td></tr></tbody></table>
24143
24144 !! end
24145
24146 !!test
24147 Accept empty td cell attribute
24148 !! wikitext
24149 {|
24150 | align="center" | foo || |
24151 |}
24152 !! html
24153 <table>
24154 <tr>
24155 <td align="center"> foo </td>
24156 <td>
24157 </td></tr></table>
24158
24159 !!end
24160
24161 !!test
24162 Non-empty attributes in th-cells
24163 !! wikitext
24164 {|
24165 ! Foo !! style="color: red" | Bar
24166 |}
24167 !! html
24168 <table>
24169 <tr>
24170 <th> Foo </th>
24171 <th style="color: red"> Bar
24172 </th></tr></table>
24173
24174 !!end
24175
24176 !!test
24177 Accept empty attributes in th-cells
24178 !! wikitext
24179 {|
24180 !| foo !!| bar
24181 |}
24182 !! html
24183 <table>
24184 <tr>
24185 <th> foo </th>
24186 <th> bar
24187 </th></tr></table>
24188
24189 !!end
24190
24191 !!test
24192 Empty table rows go away
24193 !! wikitext
24194 {|
24195 | Hello
24196 | there
24197 |- class="foo"
24198 |-
24199 |}
24200 !! html
24201 <table>
24202 <tr>
24203 <td> Hello
24204 </td>
24205 <td> there
24206 </td></tr>
24207
24208 </table>
24209
24210 !! end
24211
24212 ###
24213 ### Parsoid-centric tests for testing RTing of inter-element separators
24214 ### Edge cases not tested by existing parser tests and specific to
24215 ### Parsoid-specific serialization strategies.
24216 ###
24217
24218 !!test
24219 RT-ed inter-element separators should be valid separators
24220 !! wikitext
24221 {|
24222 |- [[foo]]
24223 |}
24224 !! html/php
24225 <table>
24226
24227 </table>
24228
24229 !! html/parsoid
24230 <table>
24231 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24232 </tbody></table>
24233 !!end
24234
24235 # Parsoid-only since PHP parser relies on Tidy for correct output
24236 !!test
24237 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24238 !!options
24239 parsoid
24240 !! wikitext
24241 {|
24242 |<small>foo
24243 bar
24244 |}
24245
24246 {|
24247 |<small>foo<small>
24248 |}
24249 !! html
24250 <table>
24251 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24252 <p>bar</p></small></td></tr>
24253 </tbody></table>
24254
24255 <table>
24256 <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>
24257 </tbody></table>
24258 !!end
24259
24260 # Note that the "style" attribute is really a template parameter here.
24261 # The = would have to be {{=}} if you wanted the literal.
24262 !!test
24263 Empty TD followed by TD with tpl-generated attribute
24264 !! wikitext
24265 {|
24266 |-
24267 |
24268 |{{echo|style='color:red'}}|foo
24269 |}
24270 !! html
24271 <table>
24272
24273 <tr>
24274 <td>
24275 </td>
24276 <td>foo
24277 </td></tr></table>
24278
24279 !!end
24280
24281 !!test
24282 Indented table with an empty td
24283 !! wikitext
24284 {|
24285 |-
24286 |
24287 |foo
24288 |}
24289 !! html
24290 <table>
24291
24292 <tr>
24293 <td>
24294 </td>
24295 <td>foo
24296 </td></tr></table>
24297
24298 !!end
24299
24300 ## We have some newline diffs RT-ing this edge case
24301 ## and it is not important enough -- we seem to be emitting
24302 ## at most 2 newlines after a </tr> and this is unrelated to
24303 ## the issue from T85627 that this is testing.
24304 !!test
24305 Indented table with blank lines in between (T85627)
24306 !! options
24307 parsoid=wt2html
24308 !! wikitext
24309 {|
24310 |foo
24311
24312
24313 |}
24314 !! html
24315 <table>
24316
24317 <tr>
24318 <td>foo
24319 </td></tr></table>
24320
24321 !!end
24322
24323 !!test
24324 Indented block & table
24325 !! wikitext
24326 <div>foo</div>
24327 {|
24328 |foo
24329 |}
24330 !! html/php
24331 <div>foo</div>
24332 <table>
24333 <tr>
24334 <td>foo
24335 </td></tr></table>
24336
24337 !! html/parsoid
24338 <div data-parsoid='{"stx":"html"}'>foo</div>
24339 <table><tbody>
24340 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24341 </tbody></table>
24342 !!end
24343
24344 !! test
24345 Indent and comment before table row
24346 !! wikitext
24347 {|
24348 <!--hi-->|-
24349 | there
24350 |}
24351 !! html/php
24352 <table>
24353
24354 <tr>
24355 <td> there
24356 </td></tr></table>
24357
24358 !! html/parsoid
24359 <table>
24360 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24361 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24362 </tbody></table>
24363 !! end
24364
24365 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24366 !!test
24367 Empty TR followed by a template-generated TR
24368 !!options
24369 parsoid
24370 !! wikitext
24371 {|
24372 |-
24373 {{echo|<tr><td>foo</td></tr>}}
24374 |}
24375 !! html
24376 <table>
24377 <tbody>
24378 <tr></tr>
24379 <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}}]}'>
24380 <td>foo</td></tr>
24381 </tbody></table>
24382 !!end
24383
24384 ## PHP and parsoid output differ for this, and since this is primarily
24385 ## for testing Parsoid's serializer, marking this Parsoid only
24386 !!test
24387 Empty TR followed by mixed-ws-comment line should RT correctly
24388 !!options
24389 parsoid
24390 !! wikitext
24391 {|
24392 |-
24393 <!--c-->
24394 |-
24395 <!--c--> <!--d-->
24396 |}
24397 !! html
24398 <table>
24399 <tbody>
24400 <tr></tr>
24401 <!--c-->
24402 <tr>
24403 <!--c--> </tr><!--d-->
24404 </tbody></table>
24405
24406 !!end
24407
24408 !!test
24409 Multi-line image caption generated by templates with/without trailing newlines
24410 !! wikitext
24411 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24412 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24413 !! html/parsoid
24414 <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>
24415 <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>
24416 !!end
24417
24418 !! test
24419 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24420 !! options
24421 parsoid=html2wt
24422 !! html/parsoid
24423 <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>
24424
24425 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24426 !! wikitext
24427 <includeonly>foo</includeonly>
24428 new para
24429
24430 [[Category:Foo]]
24431
24432 = new heading =
24433 !! end
24434
24435 ## PHP emits broken html for this, and since this is primarily
24436 ## a Parsoid serializer test, marking this Parsoid only
24437 !!test
24438 Improperly nested inline or quotes tags with whitespace in between
24439 !! wikitext
24440 <span> <s>x</span> </s>
24441 ''' ''x''' ''
24442 !! html/parsoid
24443 <p><span> <s>x</s></span><s> </s>
24444 <b> <i>x</i></b><i> </i>
24445 </p>
24446 !!end
24447
24448 !!test
24449 Encapsulate protected attributes from wt
24450 !! wikitext
24451 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24452 !! html/parsoid
24453 <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>
24454 </body>
24455 !!end
24456
24457 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24458 ## Having nested or stray pre tags results in the attempt to add duplicates,
24459 ## causing an assertion fail. This test tries to prevent that situation.
24460 !!test
24461 Ensure ParagraphWrapper can deal with stray closing pre tags
24462 !!options
24463 parsoid=wt2html
24464 !! wikitext
24465 plain text</pre>
24466 !! html/parsoid
24467 plain text
24468 !!end
24469
24470 !!test
24471 1. Ensure fostered text content is wrapped in element nodes
24472 !!options
24473 parsoid=wt2html
24474 !! wikitext
24475 <table>hi</table><table>ho</table>
24476 !! html/parsoid
24477 <p>hi</p>
24478 <table></table>
24479 <p>ho</p>
24480 <table></table>
24481 !!end
24482
24483 !!test
24484 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24485 !!options
24486 parsoid=wt2html,wt2wt
24487 !! wikitext
24488 <table>
24489 <tr> || ||
24490 <td> a
24491 </table>
24492 !! html/parsoid
24493 <p> || ||
24494 </p><table>
24495 <tbody><tr><td> a</td></tr>
24496 </tbody></table>
24497 !!end
24498
24499 !!test
24500 Encapsulation properly handles null DSR information from foster box
24501 !!options
24502 parsoid=wt2html,wt2wt
24503 !! wikitext
24504 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24505 !! html/parsoid
24506 <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>
24507 !!end
24508
24509 !!test
24510 1. Encapsulate foster-parented transclusion content
24511 !!options
24512 parsoid=wt2wt,wt2html
24513 !! wikitext
24514 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24515 !! html/parsoid
24516 <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>
24517 <tbody>
24518 <tr>
24519 <td>bar</td>
24520 </tr>
24521 </tbody>
24522 </table>
24523 !!end
24524
24525 !!test
24526 2. Encapsulate foster-parented transclusion content
24527 !!options
24528 parsoid=wt2wt,wt2html
24529 !! wikitext
24530 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24531 !! html/parsoid
24532 <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>
24533 <table>
24534 <tbody>
24535 <tr>
24536 <td>bar</td>
24537 </tr>
24538 </tbody>
24539 </table>
24540 !!end
24541
24542 !!test
24543 3. Encapsulate foster-parented transclusion content
24544 !!options
24545 parsoid=wt2wt,wt2html
24546 !! wikitext
24547 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24548 !! html/parsoid
24549 <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;]}">
24550 <p>foo</p>
24551 </div>
24552 <table>
24553 <tbody>
24554 <tr>
24555 <td>bar</td>
24556 </tr>
24557 </tbody>
24558 </table>
24559 !!end
24560
24561 !!test
24562 4. Encapsulate foster-parented transclusion content
24563 !!options
24564 parsoid=wt2wt,wt2html
24565 !! wikitext
24566 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24567 !! html/parsoid
24568 <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;]}">
24569 <p>foo</p>
24570 </div>
24571 <table>
24572 <tbody>
24573 <tr>
24574 <td>bar</td>
24575 </tr>
24576 </tbody>
24577 </table>
24578 !!end
24579
24580 !!test
24581 5. Encapsulate foster-parented transclusion content
24582 !!options
24583 parsoid=wt2wt,wt2html
24584 !! wikitext
24585 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24586 !! html/parsoid
24587 <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>
24588 <table>
24589 <tbody>
24590 <tr>
24591 <td>
24592 <div>
24593 <p>foo</p>
24594 </div>
24595 </td>
24596 </tr>
24597 </tbody>
24598 </table>
24599 !!end
24600
24601 !!test
24602 6. Encapsulate foster-parented transclusion content
24603 !!options
24604 parsoid=wt2wt,wt2html
24605 !! wikitext
24606 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24607 !! html/parsoid
24608 <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>
24609 <table>
24610 <tbody>
24611 <tr>
24612 <td>
24613 <div>
24614 <p>foo</p>
24615 </div>
24616 </td>
24617 </tr>
24618 </tbody>
24619 </table>
24620 <p>ok</p>
24621 !!end
24622
24623 !!test
24624 7. Encapsulate foster-parented transclusion content
24625 !!options
24626 parsoid=wt2wt,wt2html
24627 !! wikitext
24628 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24629 !! html/parsoid
24630 <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>
24631 <table>
24632 <tbody>
24633 <tr>
24634 <td>bar</td>
24635 </tr>
24636 </tbody>
24637 </table>
24638 !!end
24639
24640 # Note that the wt is broken on purpose: the = should be {{=}} if you
24641 # don't want it to be a template parameter key.
24642 !!test
24643 8. Encapsulate foster-parented transclusion content
24644 !!options
24645 parsoid=wt2wt,wt2html
24646 !! wikitext
24647 {{echo|a
24648 }}{|{{echo|style='color:red'}}
24649 |-
24650 |b
24651 |}
24652 !! html/parsoid
24653 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24654 <span> </span>
24655 <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>
24656 <table>
24657 <tbody>
24658 <tr>
24659 <td>b</td>
24660 </tr>
24661 </tbody>
24662 </table>
24663 !!end
24664
24665 !!test
24666 9. Encapsulate foster-parented transclusion content
24667 !!options
24668 parsoid=wt2wt,wt2html
24669 !! wikitext
24670 <table>{{echo|hi</table>hello}}
24671 !! html/parsoid
24672 <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>
24673 !!end
24674
24675 !!test
24676 Table in fosterable position
24677 !!options
24678 parsoid=wt2html
24679 !! wikitext
24680 {{OpenTable}}
24681 <div>
24682 {|
24683 |}
24684 </div>
24685 |}
24686 !! html/parsoid
24687 <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">
24688 </span>
24689 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24690
24691 <table>
24692 </table>
24693 !!end
24694
24695 # Parsoid only for bug 64747
24696 !! test
24697 Properly encapsulate empty-content transclusions in fosterable positions
24698 !! wikitext
24699 <table>
24700 {{#if:|
24701 <td>foo</td>
24702 }}
24703 </table>
24704 !! html/parsoid
24705 <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"}]]}'>
24706
24707 </table>
24708 !! end
24709
24710 !! test
24711 Always encapsulate foster box when template range is expanded to table
24712 !! options
24713 parsoid=wt2wt
24714 !! wikitext
24715 {|
24716 hello
24717 {{OpenTable}}
24718 |}
24719 !! html/parsoid
24720
24721 !! end
24722
24723 !! test
24724 T115289: Unclosed table
24725 !! wikitext
24726 {{echo|<table>}}<!--c-->[[Category:Two]]
24727 !! html/parsoid
24728 <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>
24729 !! end
24730
24731 !! test
24732 T115289: Don't migrate newlines out of tables with fostered content
24733 !! wikitext
24734 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24735 !! html/parsoid
24736 <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>
24737 !! end
24738
24739 !! test
24740 T73074: More fostering fun
24741 !! wikitext
24742 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24743 !! html/parsoid
24744 <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>
24745 !! end
24746
24747 !!test
24748 Support <object> element with .data attribute
24749 !!options
24750 parsoid=html2wt
24751 !! html/parsoid
24752 <object data="test.swf"></object>
24753 !! wikitext
24754 <object data="test.swf"></object>
24755 !!end
24756
24757 !! test
24758 Don't block XML namespace declaration
24759 !! wikitext
24760 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24761 !! html/php
24762 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24763 </p>
24764 !! html/parsoid
24765 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24766 !! end
24767
24768 # -----------------------------------------------------------------
24769 # The following section of tests are primarily to spec requirements
24770 # around serialization of new/edited content.
24771 #
24772 # All these tests are marked Parsoid html2wt and html2html only
24773 # ----------------------------------------------------------------
24774
24775 # 'mi' is a localinterwiki prefix as well as a language
24776 !! test
24777 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24778 !! options
24779 parsoid=html2wt
24780 !! html/parsoid
24781 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24782 !! wikitext
24783 [[Foo]]
24784 !! end
24785
24786 # See T93839
24787 !! test
24788 New wikilinks should be serialized properly
24789 !! options
24790 parsoid=html2wt
24791 !! html/parsoid
24792 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24793 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24794 !! wikitext
24795 [[Foo]]
24796 [[Foo]]
24797 !! end
24798
24799 !! test
24800 New wiki links (href variations)
24801 !! options
24802 parsoid=html2wt
24803 !! html/parsoid
24804 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24805 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24806 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24807 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24808 !! wikitext
24809 [[Foo_bar]]
24810 [[Foo_bar]]
24811 [[Foo_bar]]
24812 [[Toxine bactérienne]]
24813 !! end
24814
24815 !! test
24816 New wiki links (content string variations)
24817 !! options
24818 parsoid=html2wt
24819 !! html/parsoid
24820 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24821 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24822 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24823 !! wikitext
24824 [[Foo_bar]]
24825 [[Foo bar]]
24826 [[Foo_bar|./Foo_bar]]
24827 !! end
24828
24829 !! test
24830 New category links (href variations)
24831 !! options
24832 parsoid=html2wt
24833 !! html/parsoid
24834 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24835 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24836 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24837 !! wikitext
24838 [[Category:Toxine bactérienne]]
24839 [[Category:Toxine bactérienne]]
24840 [[Category:Toxine bactérienne]]
24841 !! end
24842
24843 !! test
24844 New sol transparent links don't need indent-pre nowiki protection
24845 !! options
24846 parsoid=html2wt
24847 language=de
24848 !! html/parsoid
24849 <link rel="mw:PageProp/redirect" href="./Main_Page">
24850 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24851 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24852 !! wikitext
24853 #WEITERLEITUNG [[Main Page]]
24854 <!-- this is good --> [[Category:Good]]
24855 <!-- this is great --> [[Kategorie:Great]]
24856 !! end
24857
24858 !! test
24859 New interlanguage links (href variations)
24860 !! options
24861 parsoid=html2wt
24862 !! html/parsoid
24863 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24864 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24865 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24866 !! wikitext
24867 [[es:Toxine bactérienne]]
24868 [[es:Toxine_bactérienne]]
24869 [[es:Toxine_bactérienne]]
24870 !! end
24871
24872 !! test
24873 Image: Modifying size of an image (1)
24874 !! options
24875 parsoid={
24876 "modes": ["wt2wt"],
24877 "changes": [
24878 ["img[height]", "attr", "height", "22"],
24879 ["img[width]", "attr", "width", "200"]
24880 ]
24881 }
24882 !! wikitext
24883 [[Image:Foobar.jpg|230x230px]]
24884 !! wikitext/edited
24885 [[Image:Foobar.jpg|200x200px]]
24886 !!end
24887
24888 !! test
24889 Image: Modifying size of an image (2)
24890 !! options
24891 parsoid={
24892 "modes": ["wt2wt"],
24893 "changes": [
24894 ["img[height]", "attr", "height", "100"],
24895 ["img[width]", "attr", "width", "500"]
24896 ]
24897 }
24898 !! wikitext
24899 [[Image:Foobar.jpg|230x230px]]
24900 !! wikitext/edited
24901 [[Image:Foobar.jpg|500x500px]]
24902 !!end
24903
24904 # Change in size is ignored so long as class='mw-default-size'
24905 !! test
24906 Image: Modifying size of an image (3)
24907 !! options
24908 parsoid={
24909 "modes": ["wt2wt"],
24910 "changes": [
24911 ["figure[class]", "removeClass", "mw-default-size"],
24912 ["figure img", "attr", "height", "19"],
24913 ["figure img", "attr", "width", "170"]
24914 ]
24915 }
24916 !! wikitext
24917 [[Image:Foobar.jpg|thumb]]
24918 !! wikitext/edited
24919 [[Image:Foobar.jpg|thumb|170x170px]]
24920 !!end
24921
24922 !! test
24923 Image: Modifying alignment of an image (bug 48665)
24924 !! options
24925 parsoid={
24926 "modes": ["wt2wt"],
24927 "changes": [
24928 ["figure[class]", "removeClass", "mw-halign-right"],
24929 ["figure[class]", "addClass", "mw-halign-left"]
24930 ]
24931 }
24932 !! wikitext
24933 [[Image:Foobar.jpg|thumb|caption|right]]
24934 !! wikitext/edited
24935 [[Image:Foobar.jpg|thumb|caption|left]]
24936 !! end
24937
24938 !! test
24939 Image: Modifying mw-default-size of an frameless image (bug 62805)
24940 !! options
24941 parsoid={
24942 "modes": ["wt2wt"],
24943 "changes": [
24944 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24945 ]
24946 }
24947 !! wikitext
24948 [[Image:Foobar.jpg|frameless|right]]
24949 !! wikitext/edited
24950 [[Image:Foobar.jpg|frameless|right|220x220px]]
24951 !! end
24952
24953 !! test
24954 Image: Modifying valign of an image (bug 49221)
24955 !! options
24956 parsoid={
24957 "modes": ["wt2wt"],
24958 "changes": [
24959 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24960 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24961 ]
24962 }
24963 !! wikitext
24964 [[File:Foobar.jpg|20px|middle]]
24965 !! wikitext/edited
24966 [[File:Foobar.jpg|20px|text-top]]
24967 !! end
24968
24969 !! test
24970 Image: Modifying alt attribute of an image (bug 56400)
24971 !! options
24972 parsoid={
24973 "modes": ["wt2wt"],
24974 "changes": [
24975 ["img[alt]", "attr", "alt", "some alternate edited text"]
24976 ]
24977 }
24978 !! wikitext
24979 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24980 !! wikitext/edited
24981 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24982 !!end
24983
24984 !! test
24985 Image: Modifying caption of an image
24986 !! options
24987 parsoid={
24988 "modes": ["wt2wt"],
24989 "changes": [
24990 ["figcaption", "text", "new caption"]
24991 ]
24992 }
24993 !! wikitext
24994 [[Image:Foobar.jpg|thumb|original caption]]
24995 !! wikitext/edited
24996 [[Image:Foobar.jpg|thumb|new caption]]
24997 !!end
24998
24999 !! test
25000 Image: empty alt attribute (bug 48924)
25001 !! options
25002 parsoid
25003 !! wikitext
25004 [[File:Foobar.jpg|thumb|alt=|bar]]
25005 !! html
25006 <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>
25007 !! end
25008
25009 !! test
25010 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25011 !! options
25012 parsoid=html2wt
25013 language=ar
25014 disabled
25015 !! html/parsoid
25016 <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>
25017 !! wikitext
25018 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25019 !! end
25020
25021 !! test
25022 Image: Block level image should have \n before and after
25023 !! wikitext
25024 123
25025 [[File:Foobar.jpg|right|thumb|150x150px]]
25026 456
25027 !! html/parsoid
25028 <p>123</p>
25029 <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>
25030 <p>456</p>
25031 !!end
25032
25033 !! test
25034 Image: New block level image should have \n before and after (existing content)
25035 !! wikitext
25036 123
25037 [[File:Foobar.jpg|right|thumb|150x150px]]
25038 456
25039 !! html/parsoid
25040 <p>123</p>
25041 <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>
25042 <p>456</p>
25043 !!end
25044
25045 !! test
25046 Image: upright option (parsoid)
25047 !! wikitext
25048 [[File:Foobar.jpg|thumb|upright|caption]]
25049 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25050 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25051 !! html/parsoid
25052 <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>
25053 <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>
25054 <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>
25055 !!end
25056
25057 !! test
25058 Image: upright option is ignored on inline and frame images (parsoid)
25059 !! wikitext
25060 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25061 !! html/parsoid
25062 <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>
25063 !!end
25064
25065 !! test
25066 Image: from basic HTML (1)
25067 !! options
25068 parsoid=html2wt
25069 !! html/parsoid
25070 <span typeof="mw:Image">
25071 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25072 </span>
25073 !! wikitext
25074 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25075 !! end
25076
25077 !! test
25078 Image: from basic HTML (2)
25079 !! options
25080 parsoid=html2wt
25081 !! html/parsoid
25082 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25083 !! wikitext
25084 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25085 !! end
25086
25087 !! test
25088 Image: from basic HTML (3)
25089 !! options
25090 parsoid=html2wt
25091 !! html/parsoid
25092 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25093 !! wikitext
25094 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25095 !! end
25096
25097 !! test
25098 Image: from basic HTML (4)
25099 !! options
25100 parsoid=html2wt
25101 !! html/parsoid
25102 <img src="./File:Foobar.jpg">
25103 !! wikitext
25104 [[File:Foobar.jpg|link=]]
25105 !! end
25106
25107 !! test
25108 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25109 !! options
25110 parsoid=html2wt
25111 !! html/parsoid
25112 <ul>
25113 <li><p>foo</p></li>
25114 </ul>
25115 !! wikitext
25116 * foo
25117 !! end
25118
25119 !! test
25120 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25121 !! options
25122 parsoid=html2wt
25123 !! html/parsoid
25124 <ul> <li>foo</li></ul>
25125 !! wikitext
25126 * foo
25127 !! end
25128
25129 !! test
25130 Don't strip leading whitespace when handling indent-pre suppressing tags
25131 !! options
25132 parsoid=html2wt
25133 !! html/parsoid
25134 <table>
25135 <tr><td> indented row</td></tr>
25136 </table>
25137 <blockquote><p>
25138 <b>This is very bold of you!</b>
25139 </p>
25140 <table><tr><td>
25141 indented cell (no pre-wrapping!)
25142 </td></tr></table>
25143 </blockquote>
25144 <p>foo</p>
25145 <div>bar</div>
25146 !! wikitext
25147 {|
25148 | indented row
25149 |}
25150 <blockquote>
25151 '''This is very bold of you!'''
25152
25153 {|
25154 |
25155 indented cell (no pre-wrapping!)
25156 |}
25157 </blockquote>
25158 foo
25159 <div>bar</div>
25160 !! end
25161
25162 !! test
25163 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25164 !! options
25165 parsoid=html2wt
25166 !! html/parsoid
25167 <p>foo</p>
25168 <span>bar</span>
25169
25170 <span>foo2
25171 </span>bar2
25172
25173 <div>foo</div>
25174 <span>bar</span>
25175
25176 <div>
25177 <span>foo</span>
25178 </div>
25179 !! wikitext
25180 foo
25181
25182 <span>bar</span>
25183
25184 <span>foo2
25185 <nowiki> </nowiki></span>bar2
25186
25187 <div>foo</div>
25188 <nowiki> </nowiki><span>bar</span>
25189
25190 <div>
25191 <nowiki> </nowiki><span>foo</span>
25192 </div>
25193 !! end
25194
25195 !! test
25196 Lists: Dont insert newlines in a serialized list item.
25197 !! options
25198 parsoid=html2wt
25199 !! html/parsoid
25200 <ul><li>a<br>b</li><li>c</li></ul>
25201 !! wikitext
25202 * a<br>b
25203 * c
25204 !! end
25205
25206 !! test
25207 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25208 !! options
25209 parsoid={
25210 "modes": ["html2wt"],
25211 "scrubWikitext": false
25212 }
25213 !! html/parsoid
25214 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25215 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25216
25217 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25218 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25219
25220 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25221
25222 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25223 !! wikitext
25224 == hello there [[Category:A1]] ==
25225
25226 == [[Category:A2]] hi pal ==
25227
25228 == <!--foo--> [[Category:A3]] how goes it ==
25229
25230 == it goes well [[Category:A4]] <!--bar--> ==
25231
25232 ==howdy [[Category:A5]]==
25233
25234 == __TOC__ ok ==
25235 !! end
25236
25237 !! test
25238 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25239 !! options
25240 parsoid={
25241 "modes": ["html2wt"],
25242 "scrubWikitext": true
25243 }
25244 !! html/parsoid
25245 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25246 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25247
25248 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25249 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25250
25251 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25252 !! wikitext
25253 == hello there ==
25254 [[Category:A1]]
25255 [[Category:A2]]
25256
25257 == hi pal ==
25258
25259 <!--foo--> [[Category:A3]]
25260
25261 == how goes it ==
25262
25263 == it goes well ==
25264 [[Category:A4]] <!--bar-->
25265
25266 __TOC__
25267
25268 == ok ==
25269 !! end
25270
25271 !! test
25272 Headings: Don't hoist metas that come from templates
25273 !! options
25274 parsoid={
25275 "modes": ["html2wt"],
25276 "scrubWikitext": true
25277 }
25278 !! html/parsoid
25279 <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>
25280 !! wikitext
25281 == {{echo|foo [[Category:Foo]]}} ==
25282 !! end
25283
25284 !! test
25285 Headings: Category in ref isn't hoisted
25286 !! options
25287 parsoid={
25288 "modes": ["html2wt"],
25289 "scrubWikitext": true
25290 }
25291 !! html/parsoid
25292 <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>
25293
25294 <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>
25295 !! wikitext
25296 == foo <ref>bar
25297 [[Category:Baz]] </ref> ==
25298
25299 <references />
25300 !! end
25301
25302 !! test
25303 Parsoid: Serialize positional parameters with = in them as named parameter
25304 !! options
25305 parsoid=html2wt
25306 !! html/parsoid
25307 <p about="#mwt1" typeof="mw:Transclusion"
25308 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25309
25310 <p about="#mwt1" typeof="mw:Transclusion"
25311 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25312
25313 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25314 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25315 <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>
25316 !! wikitext
25317 {{echo|1=f=oo}}
25318
25319 {{echo|1=f=oo|2=bar}}
25320
25321 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25322 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25323 {{echo|<nowiki>f=oo</nowiki>|bar}}
25324 !! end
25325
25326 !! test
25327 Parsoid: Serialize positional parameters with = in extlink as named parameter
25328 !! options
25329 parsoid=html2wt
25330 !! html/parsoid
25331 <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>
25332 !! wikitext
25333 {{echo|1=http://stuff?is=ok}}
25334 !! end
25335
25336 !! test
25337 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25338 !! options
25339 parsoid=html2wt
25340 !! html/parsoid
25341 <div>a<p>b</p></div>
25342 <div>a
25343 <p>b</p></div>
25344 <div>
25345 a
25346 <p>b</p></div>
25347 !! wikitext
25348 <div>a
25349 b
25350 </div>
25351 <div>a
25352 b
25353 </div>
25354 <div>
25355 a
25356
25357 b
25358 </div>
25359 !! end
25360
25361 !! test
25362 Substrings resembling wikitext in hrefs should not get nowiki escapes
25363 !! options
25364 parsoid=html2wt
25365 !! html/parsoid
25366 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25367 !! wikitext
25368 [[Foo''bar''baz]]
25369 !! end
25370
25371 !! test
25372 Enforce single-line context in the serializer
25373 !! options
25374 parsoid=html2wt
25375 !! html/parsoid
25376 <h2>testing
25377 123</h2>
25378
25379 <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">
25380 </span><span about="#mwt1">you</span> </h2>
25381
25382 <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>
25383
25384 <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
25385 there</span></li></ol>
25386
25387 <ul><li>asd
25388 sdf</li></ul>
25389
25390 <ul><li>foo
25391 bar
25392 baz</li>
25393 <li>foo <b>bar</b>
25394 baz</li></ul>
25395
25396 <dl><dt>hi
25397 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25398 ho</dd></dl>
25399
25400 <dl><dd> <table>
25401 <tbody><tr><td> ha
25402 ha
25403 ha</td></tr>
25404 </tbody></table></dd></dl>
25405 !! wikitext
25406 == testing 123 ==
25407
25408 == hi {{bogus|there
25409 you}} ==
25410
25411 == foo <ref>hello
25412 there</ref> ==
25413
25414 <references />
25415
25416 * asd sdf
25417
25418 * foo bar baz
25419 * foo '''bar''' baz
25420
25421 ; hi ho : hi ho
25422
25423 : {|
25424 | ha
25425 ha
25426 ha
25427 |}
25428 !! end
25429
25430 !! test
25431 Serialize new placeholder space without spans
25432 !! options
25433 parsoid=html2wt
25434 !! html/parsoid
25435 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25436
25437 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25438
25439 <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>
25440 !! wikitext
25441 foo : bar
25442
25443 foo : bar
25444
25445 <ref>foo : bar</ref>ok
25446 !! end
25447
25448
25449 #-----------------------
25450 # Tag minimization tests
25451 #-----------------------
25452
25453 !! test
25454 1. I/B quote minimization: wikitext-only tags should be combined
25455 !! options
25456 parsoid=html2wt
25457 !! html/parsoid
25458 <p><i>A</i><i>B</i></p>
25459 <p><b>A</b><b>B</b></p>
25460 <p><i>A</i><b><i>B</i></b></p>
25461 <p><b>A</b><i><b>B</b></i></p>
25462 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25463 <p><i><b>A</b></i><i><b>B</b></i></p>
25464 <p><i><b>A</b></i><b><i>B</i></b></p>
25465 <p><b><i>A</i></b><i><b>B</b></i></p>
25466 !! wikitext
25467 ''AB''
25468
25469 '''AB'''
25470
25471 ''A'''B'''''
25472
25473 '''A''B'''''
25474
25475 '''A''BC''D'''
25476
25477 '''''AB'''''
25478
25479 '''''AB'''''
25480
25481 '''''AB'''''
25482 !! end
25483
25484 !! test
25485 2. I/B quote minimization: wikitext and html tags should not be combined
25486 !! options
25487 parsoid=html2wt
25488 !! html/parsoid
25489 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25490 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25491 !! wikitext
25492 ''A''<i>B</i>
25493
25494 ''A''<nowiki/>'''<i>B</i>'''
25495 !! end
25496
25497 !! test
25498 3. I/B quote minimization: templated content stops minimization
25499 !! options
25500 parsoid=html2wt
25501 !! html/parsoid
25502 <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>
25503 <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>
25504 !! wikitext
25505 ''A''{{echo|''B''}}
25506
25507 ''A''{{echo|'''''B'''''}}
25508 !! end
25509
25510 !! test
25511 4. I/B quote minimization: new content should be mimimized with adjacent old content
25512 !! options
25513 parsoid=html2wt
25514 !! html/parsoid
25515 <p><i>A</i><i>B</i></p>
25516 <p><b>A</b><b>B</b></p>
25517 <p><i>A</i><b><i>B</i></b></p>
25518 !! wikitext
25519 ''AB''
25520
25521 '''AB'''
25522
25523 ''A'''B'''''
25524 !! end
25525
25526 !! test
25527 5a. Merge adjacent quote nodes if they've been edited
25528 !! options
25529 parsoid={
25530 "modes": ["wt2wt", "selser"],
25531 "changes": [
25532 ["p", "contents", "remove", ":contains('b')"]
25533 ]
25534 }
25535 !! wikitext
25536 ''a''b''c''
25537 !! wikitext/edited
25538 ''ac''
25539 !! end
25540
25541 !! test
25542 5b. Merge adjacent quote nodes if they've been edited
25543 !! options
25544 parsoid={
25545 "modes": ["wt2wt", "selser"],
25546 "changes": [
25547 ["#x", "remove"]
25548 ]
25549 }
25550 !! wikitext
25551 ''a''<span id="x">b</span>''c''
25552 !! wikitext/edited
25553 ''ac''
25554 !! end
25555
25556 !! test
25557 1. Merge adjacent link nodes as long as at least one element is new
25558 !! options
25559 parsoid={
25560 "modes": ["html2wt"],
25561 "scrubWikitext": true
25562 }
25563 !! html/parsoid
25564 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25565 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25566 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25567 !! wikitext
25568 [[Football]]
25569 [[Football]]
25570 [[Football|Foot]][[Football|ball]]
25571 !! end
25572
25573 !! test
25574 2. Merge adjacent link nodes and enable additional normalizations
25575 !! options
25576 parsoid={
25577 "modes": ["html2wt"],
25578 "scrubWikitext": true
25579 }
25580 !! html/parsoid
25581 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25582 !! wikitext
25583 [[Football|''Football'']]
25584 !! end
25585
25586 !! test
25587 3. Don't merge adjacent link nodes if scrubWikitext is false
25588 !! options
25589 parsoid={
25590 "modes": ["html2wt"],
25591 "scrubWikitext": false
25592 }
25593 !! html/parsoid
25594 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25595 !! wikitext
25596 [[Football|Foot]][[Football|ball]]
25597 !! end
25598
25599 #------------------------------
25600 # End of tag minimization tests
25601 #------------------------------
25602
25603 !!test
25604 Bug 54262: New entities
25605 !! options
25606 parsoid=html2wt
25607 !! html/parsoid
25608 <span typeof="mw:Entity">&nbsp;</span>
25609 !! wikitext
25610 &nbsp;
25611 !! end
25612
25613 ## Note that there is no wikitext output for 'unknownproperty' ##
25614 ## Unknown magic words are silently dropped ##
25615
25616 !! test
25617 Magic words
25618 !! options
25619 parsoid=html2wt
25620 !! html/parsoid
25621 <meta property='mw:PageProp/toc' />
25622 <meta property='mw:PageProp/notoc' />
25623 <meta property='mw:PageProp/forcetoc' />
25624 <meta property='mw:PageProp/index' />
25625 <meta property='mw:PageProp/noindex' />
25626 <meta property='mw:PageProp/nogallery' />
25627 <meta property='mw:PageProp/noeditsection' />
25628 <meta property='mw:PageProp/notitleconvert' />
25629 <meta property='mw:PageProp/nocontentconvert' />
25630 <meta property='mw:PageProp/unknownproperty' />
25631 !! wikitext
25632 __TOC__
25633 __NOTOC__
25634 __FORCETOC__
25635 __INDEX__
25636 __NOINDEX__
25637 __NOGALLERY__
25638 __NOEDITSECTION__
25639 __NOTITLECONVERT__
25640 __NOCONTENTCONVERT__
25641 !! end
25642
25643 !! test
25644 Consecutive <pre>s should not get merged
25645 !! options
25646 parsoid=html2wt,html2html
25647 !! html/parsoid
25648 <pre>a</pre><pre>b</pre>
25649
25650 <pre>c
25651 </pre><pre>
25652 d</pre>
25653
25654 <pre>e
25655
25656 </pre><pre>
25657
25658 f</pre>
25659 !! wikitext
25660 a
25661
25662 b
25663
25664 c
25665
25666 d
25667
25668 e
25669
25670
25671
25672 f
25673 !! end
25674
25675 !! test
25676 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25677 !! options
25678 parsoid=html2wt
25679 !! html/parsoid
25680 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25681 !! wikitext
25682 [[Special:BookSources/1234567890|ISBN 1234567895]]
25683 !! end
25684
25685 !! test
25686 Edited RFC links not serializable as RFC links should serialize as extlinks
25687 !! options
25688 parsoid=html2wt
25689 !! html/parsoid
25690 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25691 !! wikitext
25692 [//tools.ietf.org/html/rfc123 New RFC]
25693 !! end
25694
25695 !! test
25696 Edited PMID links not serializable as PMID links should serialize as extlinks
25697 !! options
25698 parsoid=html2wt
25699 !! html/parsoid
25700 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25701 !! wikitext
25702 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25703 !! end
25704
25705 !! test
25706 WTS of autolinks with trailing/surrounding context
25707 !! options
25708 parsoid=html2wt
25709 !! html/parsoid
25710 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25711 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25712 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25713 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25714 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25715 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25716 !! wikitext
25717 http://cscott.net'''foo'''
25718
25719 http://cscott.net<b>foo</b>
25720
25721 '''http://cscott.net'''
25722
25723 '''http://cscott.net '''
25724
25725 '''http://cscott.net<nowiki/>x'''
25726
25727 http://cscott.net<nowiki/>x
25728 !! end
25729
25730 !! test
25731 WTS of autolinks with nowikis (round-trip)
25732 !! wikitext
25733 x<nowiki/>http://cscott.net<nowiki/>x
25734 !! html/parsoid
25735 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25736 !! end
25737
25738 # this is the "easy" test because it leaves in place all the
25739 # data-parsoid information indicating this is an autolink
25740 !! test
25741 WTS of autolinks with escapes (editing)
25742 !! options
25743 parsoid={
25744 "modes": ["wt2wt"],
25745 "changes": [
25746 [ "meta", "remove" ]
25747 ]
25748 }
25749 !! wikitext
25750 x<nowiki/>http://cscott.net<nowiki/>x
25751 !! wikitext/edited
25752 x<nowiki/>http://cscott.net<nowiki/>x
25753 !! end
25754
25755 !! test
25756 WTS of edited autolink-like text (T103364)
25757 !! options
25758 parsoid={
25759 "modes": ["wt2wt"],
25760 "changes": [
25761 [ "span[typeof]", "removeAttr", "typeof" ]
25762 ]
25763 }
25764 !! wikitext
25765 Not a link: <nowiki>http://example.com</nowiki>.
25766 !! wikitext/edited
25767 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25768 !! end
25769
25770 !! test
25771 WTS of newly-authored autolink-like text (T103364)
25772 !! options
25773 parsoid=html2wt
25774 !! html/parsoid
25775 <p>http://example.com is not a link.</p>
25776 !! wikitext
25777 <nowiki>http://example.com</nowiki> is not a link.
25778 !! end
25779
25780 !! test
25781 WTS of autolink-like text after an autolink (T108563)
25782 !! options
25783 parsoid=html2wt
25784 !! html/parsoid
25785 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25786 !! wikitext
25787 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25788 !! end
25789
25790 !! test
25791 Magic links inside links (not autolinked)
25792 !! wikitext
25793 [[Foo|http://example.com]]
25794 [[Foo|RFC 1234]]
25795 [[Foo|PMID 1234]]
25796 [[Foo|ISBN 123456789x]]
25797
25798 [http://foo.com http://example.com]
25799 [http://foo.com RFC 1234]
25800 [http://foo.com PMID 1234]
25801 [http://foo.com ISBN 123456789x]
25802 !! html+tidy
25803 <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>
25804 <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>
25805 !! html/parsoid
25806 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25807 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25808 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25809 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25810
25811 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25812 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25813 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25814 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25815 !! end
25816
25817 !! test
25818 Magic links inside image captions (autolinked)
25819 !! wikitext
25820 [[File:Foobar.jpg|thumb|http://example.com]]
25821 [[File:Foobar.jpg|thumb|RFC 1234]]
25822 [[File:Foobar.jpg|thumb|PMID 1234]]
25823 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25824 !! html+tidy
25825 <div class="thumb tright">
25826 <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>
25827 <div class="thumbcaption">
25828 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25829 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25830 </div>
25831 </div>
25832 <div class="thumb tright">
25833 <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>
25834 <div class="thumbcaption">
25835 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25836 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25837 </div>
25838 </div>
25839 <div class="thumb tright">
25840 <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>
25841 <div class="thumbcaption">
25842 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25843 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25844 </div>
25845 </div>
25846 <div class="thumb tright">
25847 <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>
25848 <div class="thumbcaption">
25849 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25850 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25851 </div>
25852 </div>
25853 !! html/parsoid
25854 <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>
25855 <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>
25856 <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>
25857 <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>
25858 !! end
25859
25860 !! test
25861 WTS of magic word text (T109371)
25862 !! options
25863 parsoid=html2wt
25864 !! html/parsoid
25865 <p>RFC 1234</p>
25866 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25867 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25868 !! wikitext
25869 <nowiki>RFC 1234</nowiki>
25870
25871 [http://foo.com RFC 1234]
25872
25873 [[Foo|RFC 1234]]
25874 !! end
25875
25876 !! test
25877 Edited Redirect link should emit a non-piped wikitext link
25878 !! options
25879 parsoid=html2wt
25880 !! html/parsoid
25881 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25882 !! wikitext
25883 #REDIRECT [[Bar]]
25884 !! end
25885
25886 !! test
25887 T75121: Infer extension name from typeOf if data-mw is not present
25888 !! options
25889 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25890 !! html/parsoid
25891 <div typeOf="mw:Extension/foo"></div>
25892 !! wikitext
25893 <foo />
25894 !! end
25895
25896 # Note that the <p> wrapping isn't present in PHP parser output
25897 # The important thing for this test is that P-wrapping doesn't
25898 # interfere with the <nowiki> protection for leading - in <td>
25899 # (which isn't necessary for <th>).
25900 !! test
25901 T88318: p-wrapped dash in table.
25902 !! options
25903 parsoid=html2wt,wt2wt
25904 !! html/parsoid
25905 <table><tbody>
25906 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25907 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25908 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25909 </tbody></table>
25910 !! wikitext
25911 {|
25912 !-
25913 !-
25914 |-
25915 |<nowiki>-</nowiki>
25916 |<nowiki>- </nowiki>
25917 |-
25918 |<small>-</small>
25919 |<br>
25920 -
25921 |<br>
25922 -
25923 |}
25924 !! html/php+tidy
25925 <table>
25926 <tr>
25927 <th>-</th>
25928 <th>-</th>
25929 </tr>
25930 <tr>
25931 <td>-</td>
25932 <td>-</td>
25933 </tr>
25934 <tr>
25935 <td><small>-</small></td>
25936 <td><br />
25937 <p>-</p>
25938 </td>
25939 <td><br />
25940 <p>-</p>
25941 </td>
25942 </tr>
25943 </table>
25944 !! end
25945
25946 !! test
25947 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25948 !! options
25949 parsoid=html2wt
25950 !! html/parsoid
25951 <table id='mwAb'>
25952 <td id='mwAc'>foo</td>
25953 <td id='serialize-this'>bar</td>
25954 </table>
25955 !! wikitext
25956 {|
25957 |foo
25958 | id="serialize-this" |bar
25959 |}
25960 !! end
25961
25962 !! test
25963 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25964 !! options
25965 parsoid=html2wt
25966 !! html/parsoid
25967 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25968 !! wikitext
25969 <div id="hello">ok</div>
25970 !! end
25971
25972 !! test
25973 WTS change modes
25974 !! options
25975 parsoid={
25976 "modes": ["wt2wt"],
25977 "changes": [
25978 [ "#xyz", "before", "<b>before</b> stuff " ],
25979 [ "#xyz", "after", " stuff <i>after</i>" ],
25980 [ "#xyz", "html", "x <b>y</b> z" ]
25981 ]
25982 }
25983 !! wikitext
25984 <span id="xyz">hello</span>
25985 !! wikitext/edited
25986 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25987 !! end
25988
25989 !! test
25990 Never serialize a-tag as html, regardless of what data-parsoid has to say
25991 !! options
25992 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25993 !! html/parsoid
25994 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25995 !! wikitext
25996 [[Foo]]
25997 !! end
25998
25999 ## SSS FIXME: This is broken output nevertheless.
26000 ## What might be a reasonable non-broken output for this?
26001 ## This is an edge case unlikely to be seen in production
26002 ## that I am not wasting more time on this right now.
26003 !! test
26004 Never serialize a-tag as html, no matter what attributes it has
26005 !! options
26006 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26007 !! html/parsoid
26008 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26009 !! wikitext
26010 [http://boo.org http://boohoo.org]
26011 !! end
26012
26013 # Misnested is an indication that selser can reuse the source but these have
26014 # shown to sneak through on occasion. See T101768.
26015 # The original wikitext here is: [http://test.com [[one]] two three]
26016 !! test
26017 Strip span tags added to mark misnested links
26018 !! options
26019 parsoid=html2wt
26020 !! html/parsoid
26021 <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>
26022 !! wikitext
26023 [http://test.com][[one]] two three
26024 !! end
26025
26026 !! test
26027 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26028 !! options
26029 parsoid=html2wt
26030 !! html/parsoid
26031 <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|}"]}'>
26032 <tbody><tr><td>d
26033 </td></tr>
26034 </tbody></table>
26035 !! wikitext
26036 {{echo|a}}
26037 {|{{echo|c
26038 {{!}}d
26039 }}
26040 |}
26041 !! end
26042
26043 ## This test verifies the presence and computation of this attribute indirectly
26044 ## by making an edit and ensuring that the serialization is correct (which it would be
26045 ## only if firstWikitextNode is properly set).
26046 !! test
26047 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26048 !! options
26049 parsoid= {
26050 "modes": ["wt2wt"],
26051 "changes": [
26052 [ "div#x", "remove" ],
26053 [ "div", "before", "<div>new</div>" ]
26054 ]
26055 }
26056 !! wikitext
26057 <div id="x">foo</div>
26058 {|
26059 {{echo|<div>boo</div>
26060 {{!}}b}}
26061 |c
26062 |}
26063 !! wikitext/edited
26064
26065 <div>new</div>
26066 {|
26067 {{echo|<div>boo</div>
26068 {{!}}b}}
26069 |c
26070 |}
26071 !! end
26072
26073 # --------------------------------------------
26074 # Tests spec'ing wikitext serialization norms |
26075 # --------------------------------------------
26076
26077 !! test
26078 1. Categories should always be serialized on their own line
26079 !! options
26080 parsoid=html2wt
26081 !! html/parsoid
26082 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26083 !! wikitext
26084 foo
26085 [[Category:Foo]]
26086 bar
26087 !! end
26088
26089 !! test
26090 2. Categories that are part of templates should not introduce a line break
26091 !! wikitext
26092 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26093 !! html/parsoid
26094 <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>
26095 !! end
26096
26097 # Careful while editing these next 2 tests. There are \u200f characters
26098 # before and after the <link> tags in the HTML and following some
26099 # of the categories in wikitext
26100 # Do not remove these characters in edits.
26101 #
26102 # As part of the serialization, these bidi characters will get stripped.
26103 !! test
26104 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26105 !! options
26106 parsoid={
26107 "modes": ["html2wt"],
26108 "scrubWikitext": true
26109 }
26110 !! html/parsoid
26111 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26112 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26113 !! wikitext
26114 [[קטגוריה:טקסים]]
26115 [[קטגוריה: שיטות משפט]]
26116 !! end
26117
26118 !! test
26119 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26120 !! options
26121 parsoid={
26122 "modes": ["html2wt"],
26123 "scrubWikitext": true
26124 }
26125 !! html/parsoid
26126 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26127 !! wikitext
26128 [[קטגוריה:טקסים]]
26129 ‏y
26130 !! end
26131
26132 !! test
26133 Lists: Add space after bullets
26134 !! options
26135 parsoid=html2wt
26136 !! html/parsoid
26137 <ul>
26138 <li>foo</li>
26139 <li> bar</li>
26140 <li><span> baz</span></li>
26141 </ul>
26142 !! wikitext
26143 * foo
26144 * bar
26145 * <span> baz</span>
26146 !! end
26147
26148 !! test
26149 1. Headings: Add space before/after == (T53744)
26150 !! options
26151 parsoid=html2wt
26152 !! html/parsoid
26153 <h2>foo</h2>
26154 <h2> bar</h2>
26155 <h2>baz </h2>
26156 <h2><span> baz</span></h2>
26157 !! wikitext
26158 == foo ==
26159
26160 == bar ==
26161
26162 == baz ==
26163
26164 == <span> baz</span> ==
26165 !! end
26166
26167 !! test
26168 2. Headings: Add space before/after == even after hoisted content
26169 !! options
26170 parsoid={
26171 "modes": ["html2wt"],
26172 "scrubWikitext": true
26173 }
26174 !! html/parsoid
26175 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26176 !! wikitext
26177 [[Category:A2]]
26178
26179 == ok ==
26180 !! end
26181
26182 !! test
26183 1. Headings: suppress newly created empty headings
26184 !! options
26185 parsoid={
26186 "modes": ["html2wt"],
26187 "scrubWikitext": true
26188 }
26189 !! html/parsoid
26190 <h2></h2>
26191 !! wikitext
26192 !! end
26193
26194 !! test
26195 2. Headings: don't suppress empty headings if scrubWikitext is false
26196 !! options
26197 parsoid=html2wt
26198 !! html/parsoid
26199 <h2></h2>
26200 !! wikitext
26201 ==<nowiki/>==
26202 !! end
26203
26204 !! test
26205 3. Headings: suppress empty headings on edits
26206 !! options
26207 parsoid={
26208 "modes": ["selser"],
26209 "scrubWikitext": true,
26210 "changes": [
26211 [ "#x", "remove"]
26212 ]
26213 }
26214 !! wikitext
26215 ==<span id="x">foo</span>==
26216 !! wikitext/edited
26217 !! end
26218
26219 !! test
26220 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26221 !! options
26222 parsoid={
26223 "modes": ["html2wt"],
26224 "scrubWikitext": true
26225 }
26226 !! html/parsoid
26227 <h2>foo<br/>bar</h2>
26228 <h2>foo <span><br/>bar</span> baz</h2>
26229 !! wikitext
26230 == foo bar ==
26231
26232 == foo <span> bar</span> baz ==
26233 !! end
26234
26235 !! test
26236 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26237 !! options
26238 parsoid={
26239 "modes": ["html2wt"],
26240 "scrubWikitext": false
26241 }
26242 !! html/parsoid
26243 <h2>foo<br/>bar</h2>
26244 !! wikitext
26245 == foo<br> bar ==
26246 !! end
26247
26248 !! test
26249 1. WT Quote Tags: suppress newly created empty style tags
26250 !! options
26251 parsoid={
26252 "modes": ["html2wt"],
26253 "scrubWikitext": true
26254 }
26255 !! html/parsoid
26256 <i></i><b></b>
26257 !! wikitext
26258 !! end
26259
26260 !! test
26261 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26262 !! options
26263 parsoid=html2wt
26264 !! html/parsoid
26265 <i></i><b></b>
26266 !! wikitext
26267 ''<nowiki/>'''''<nowiki/>'''
26268 !! end
26269
26270 !! test
26271 3. WT Quote Tags: suppress empty style tags on edits
26272 !! options
26273 parsoid={
26274 "modes": ["selser"],
26275 "scrubWikitext": true,
26276 "changes": [
26277 [ "#x", "remove"]
26278 ]
26279 }
26280 !! wikitext
26281 '''<span id="x">foo</span>'''
26282 !! wikitext/edited
26283 !! end
26284
26285 !! test
26286 1. Anchors: suppress newly created empty anchors
26287 !! options
26288 parsoid={
26289 "modes": ["html2wt"],
26290 "scrubWikitext": true
26291 }
26292 !! html/parsoid
26293 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26294 !! wikitext
26295 !! end
26296
26297 !! test
26298 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26299 !! options
26300 parsoid={
26301 "modes": ["html2wt"],
26302 "scrubWikitext": false
26303 }
26304 !! html/parsoid
26305 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26306 !! wikitext
26307 [[Test|<nowiki/>]]
26308 !! end
26309
26310 !! test
26311 3. Anchors: suppress empty anchors on edits
26312 !! options
26313 parsoid={
26314 "modes": ["selser"],
26315 "scrubWikitext": true,
26316 "changes": [
26317 [ "#x", "remove"]
26318 ]
26319 }
26320 !! wikitext
26321 [[Test|<span id="x">foo</span>]]
26322 !! wikitext/edited
26323 !! end
26324
26325 !! test
26326 3a. Anchors: do not suppress numbered extlinks
26327 !! options
26328 parsoid={
26329 "modes": ["wt2wt"],
26330 "scrubWikitext": true
26331 }
26332 !! wikitext
26333 [http://foo.com]
26334 !! html/parsoid
26335 <a rel="mw:ExtLink" href="http://foo.com"></a>
26336 !! end
26337
26338 !! test
26339 3b. Anchors: do not suppress numbered extlinks
26340 !! options
26341 parsoid={
26342 "modes": ["wt2wt"],
26343 "scrubWikitext": true,
26344 "changes": [
26345 [ "#x", "remove"]
26346 ]
26347 }
26348 !! wikitext
26349 [http://foo.com <span id="x">foo</span>]
26350 !! wikitext/edited
26351 [http://foo.com]
26352 !! end
26353
26354 !!test
26355 Normalizations should be restricted to edited content
26356 !!options
26357 parsoid={
26358 "modes": ["selser"],
26359 "scrubWikitext": true,
26360 "changes": [
26361 [ "h1", "before", "<i></i>"]
26362 ]
26363 }
26364 !!wikitext
26365 a
26366 = =
26367 b
26368 !!wikitext/edited
26369 a
26370 = =
26371 b
26372 !!end
26373
26374 !! test
26375 1. Multiple normalizations (html2wt)
26376 !! options
26377 parsoid={
26378 "modes": ["html2wt"],
26379 "scrubWikitext": true
26380 }
26381 !! html
26382 <h2><i></i></h2>
26383 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26384 </a><b><i></i></b>x</p>
26385 !! wikitext
26386
26387 [[foo]]
26388 x
26389
26390 !! end
26391
26392 !! test
26393 2. Multiple normalizations (selser)
26394 !! options
26395 parsoid={
26396 "modes": ["selser"],
26397 "scrubWikitext": true,
26398 "changes": [
26399 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26400 ]
26401 }
26402 !! wikitext
26403 <span id="x">foo</span>
26404 !! wikitext/edited
26405 <span id="x">foo</span>
26406
26407 x
26408 !! end
26409
26410 !! test
26411 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26412 !! options
26413 parsoid={
26414 "modes": ["html2wt"],
26415 "scrubWikitext": true
26416 }
26417 !! html/parsoid
26418 <p> hi</p>
26419 <p> hello</p>
26420 !! wikitext
26421 hi
26422
26423 hello
26424 !! end
26425
26426 !! test
26427 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26428 !! options
26429 parsoid=html2wt
26430 !! html/parsoid
26431 <p> hi</p>
26432 <p> hello</p>
26433 !! wikitext
26434 <nowiki> </nowiki>hi
26435
26436 <nowiki> </nowiki> hello
26437 !! end
26438
26439 !! test
26440 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26441 !! options
26442 parsoid={
26443 "modes": ["html2wt"],
26444 "scrubWikitext": true
26445 }
26446 !! html/parsoid
26447 <p>Foo
26448 bar
26449 baz</p>
26450
26451 <table><tr><td>Foo
26452 bar
26453 baz bang</td></tr></table>
26454
26455 <p><!--boo--> foo
26456 bar</p>
26457
26458 <p> foo
26459 bar<span>boo</span></p>
26460 !! wikitext
26461 Foo
26462 bar
26463 baz
26464
26465 {|
26466 |Foo
26467 bar
26468 baz bang
26469 |}
26470
26471 <!--boo-->foo
26472 bar
26473
26474 foo
26475 bar<span>boo</span>
26476 !! end
26477
26478 !! test
26479 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26480 !! options
26481 parsoid={
26482 "modes": ["selser"],
26483 "scrubWikitext": true,
26484 "changes": [
26485 [ "p", "html", " a\n b" ]
26486 ]
26487 }
26488 !! wikitext
26489 xyz
26490 !! wikitext/edited
26491 a
26492 b
26493 !! end
26494
26495 !! test
26496 1. New links that end in spaces
26497 !! options
26498 parsoid={
26499 "modes": ["html2wt"],
26500 "scrubWikitext": false
26501 }
26502 !! html/parsoid
26503 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26504 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26505 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26506 !! wikitext
26507 [[Berlin ]]<nowiki/>is the capital of Germany.
26508
26509 [[Foo ]]'''bar'''
26510
26511 [[Boston ]] is a city.
26512 !! end
26513
26514 !! test
26515 2. New links that end in spaces
26516 !! options
26517 parsoid={
26518 "modes": ["html2wt"],
26519 "scrubWikitext": true
26520 }
26521 !! html/parsoid
26522 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26523 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26524 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26525 !! wikitext
26526 [[Berlin]] is the capital of Germany.
26527
26528 [[Foo]] '''bar'''
26529
26530 [[Boston]] is a city.
26531 !! end
26532
26533 !! test
26534 1. Table cells with escapable prefixes
26535 !! options
26536 parsoid={
26537 "modes": ["html2wt"],
26538 "scrubWikitext": false
26539 }
26540 !! html
26541 <table>
26542 <tr><td>a</td></tr>
26543 <tr><td>-</td></tr>
26544 <tr><td>+</td></tr>
26545 </table>
26546 !! wikitext
26547 {|
26548 |a
26549 |-
26550 |<nowiki>-</nowiki>
26551 |-
26552 |<nowiki>+</nowiki>
26553 |}
26554 !! end
26555
26556 !! test
26557 2. Table cells with escapable prefixes
26558 !! options
26559 parsoid={
26560 "modes": ["html2wt"],
26561 "scrubWikitext": true
26562 }
26563 !! html
26564 <table>
26565 <tr><td>a</td></tr>
26566 <tr><td>-</td></tr>
26567 <tr><td>+</td></tr>
26568 </table>
26569 !! wikitext
26570 {|
26571 |a
26572 |-
26573 | -
26574 |-
26575 | +
26576 |}
26577 !! end
26578
26579 !! test
26580 3a. Table cells with escapable prefixes after edits
26581 !! options
26582 parsoid={
26583 "modes": ["selser"],
26584 "scrubWikitext": true,
26585 "changes": [
26586 [ "table tbody tr:first-child td:first-child", "remove"]
26587 ]
26588 }
26589 !! wikitext
26590 {|
26591 |a||-
26592 |}
26593 !! wikitext/edited
26594 {|
26595 | -
26596 |}
26597 !! end
26598
26599 !! test
26600 3b. Table cells with escapable prefixes after edits
26601 !! options
26602 parsoid={
26603 "modes": ["selser"],
26604 "scrubWikitext": true,
26605 "changes": [
26606 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26607 [ "#x", "remove" ]
26608 ]
26609 }
26610 !! wikitext
26611 {|
26612 |pqr
26613 |<span id="x">foo</span>+
26614 |}
26615 !! wikitext/edited
26616 {|
26617 | -
26618 | +
26619 |}
26620 !! end
26621
26622 # FIXME: This test will fail because
26623 # normalization doesn't realize that the id attribute
26624 # will eliminate the escapable scenario
26625 !! test
26626 4a. Table cells without escapable prefixes after edits
26627 !! options
26628 parsoid={
26629 "modes": ["selser"],
26630 "scrubWikitext": true,
26631 "changes": [
26632 [ "#x", "html", "-" ]
26633 ]
26634 }
26635 !! wikitext
26636 {|
26637 | id="x" |abcd
26638 |}
26639 !! wikitext/edited
26640 {|
26641 | id="x" |-
26642 |}
26643 !! end
26644
26645 ## This tests normalizer's ability to discriminate between
26646 ## cells having identical content.
26647 !! test
26648 4b. Table cells without escapable prefixes after edits
26649 !! options
26650 parsoid={
26651 "modes": ["selser"],
26652 "scrubWikitext": true,
26653 "changes": [
26654 [ "td", "html", "-" ]
26655 ]
26656 }
26657 !! wikitext
26658 {|
26659 |a||b
26660 |}
26661 !! wikitext/edited
26662 {|
26663 | -||-
26664 |}
26665 !! end
26666
26667 ## This tests normalizer's ability to not be tripped by
26668 ## comments (and whitespace)
26669 !! test
26670 4c. Table cells without escapable prefixes after edits
26671 !! options
26672 parsoid={
26673 "modes": ["selser"],
26674 "scrubWikitext": true,
26675 "changes": [
26676 [ "table tbody tr td:first-child", "remove" ]
26677 ]
26678 }
26679 !! wikitext
26680 {|
26681 |-
26682 <!--foo--> |a||-
26683 |}
26684 !! wikitext/edited
26685 {|
26686 |-
26687 <!--foo--> | -
26688 |}
26689 !! end
26690
26691 ## This tests normalizer's ability to handle HTML cells
26692 !! test
26693 4d. Table cells without escapable prefixes after edits
26694 !! options
26695 parsoid={
26696 "modes": ["selser"],
26697 "scrubWikitext": true,
26698 "changes": [
26699 [ "td", "html", "-" ]
26700 ]
26701 }
26702 !! wikitext
26703 <table>
26704 <tr><td>a</td></tr>
26705 </table>
26706 !! wikitext/edited
26707 <table>
26708 <tr><td>-</td></tr>
26709 </table>
26710 !! end
26711
26712 ## T111151 Remove font elements without attributes
26713 !! test
26714 5a. font tags without attributes should be dropped in scrubWikitext mode
26715 !! options
26716 parsoid={
26717 "modes": ["html2wt"],
26718 "scrubWikitext": true
26719 }
26720 !! html
26721 <font>foo</font>
26722 <font><font>bar</font></font>
26723 <font class="x">boo</font>
26724 !! wikitext
26725 foo
26726 bar
26727 <font class="x">boo</font>
26728 !! end
26729
26730 !! test
26731 5b. font tags should not be dropped without scrubWikitext being enabled
26732 !! options
26733 parsoid={
26734 "modes": ["html2wt"],
26735 "scrubWikitext": false
26736 }
26737 !! html
26738 <font>foo</font>
26739 !! wikitext
26740 <font>foo</font>
26741 !! end
26742
26743 !! test
26744 Escape nowiki DOM elements
26745 !! options
26746 parsoid=html2wt
26747 !! html/parsoid
26748 <nowiki><i>foo</i></nowiki>
26749 !! wikitext
26750 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26751 !! end
26752
26753 # This is meant to be an interim fix while we go about figuring out
26754 # how to not introduce these trailing <nowiki/>s in the first place.
26755 !! test
26756 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26757 !! options
26758 parsoid=html2wt
26759 !! html/parsoid
26760 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26761 y</p>
26762 <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>
26763 <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>
26764 !! wikitext
26765 x
26766 y
26767
26768 {{echo|
26769 1 = <nowiki/>}}
26770
26771 {{echo|
26772 1 = <nowiki/>
26773 }}
26774 !! end
26775
26776 # ---------------------------------------------------
26777 # End of tests spec'ing wikitext serialization norms |
26778 # ---------------------------------------------------
26779
26780 # T104032
26781 !! test
26782 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26783 !! options
26784 parsoid=html2wt
26785 !! html/parsoid
26786 a<p>b</p>
26787 <b>c</b><p>d</p>
26788 <table><tr>
26789 <td>a<p>b</p></td>
26790 <td><b>c</b><p>d</p></td>
26791 </tr></table>
26792 !! wikitext
26793 a
26794
26795 b
26796
26797 '''c'''
26798
26799 d
26800 {|
26801 |a
26802 b
26803 |'''c'''
26804 d
26805 |}
26806 !! end
26807
26808 # -----------------------------------------------------------------
26809 # End of section for Parsoid-only html2wt tests for serialization
26810 # of new content
26811 # -----------------------------------------------------------------
26812
26813 # -----------------------------------------------------------------
26814 # The following section of tests are primarily to spec behavior of
26815 # the selective serializer. All these tests have manual selser
26816 # changes. The automated selser changes for all tests handle the
26817 # wide variation of changes, but these tests here capture specs
26818 # deterministically.
26819 # ----------------------------------------------------------------
26820
26821 ## T90517
26822 !! test
26823 Selser: New comments should not be lost
26824 !! options
26825 parsoid={
26826 "modes": ["selser"],
26827 "changes": [
26828 [ "#a", "after", "<!--c1-->" ],
26829 [ "#b", "before", "<!--c2-->" ]
26830 ]
26831 }
26832 !! wikitext
26833 <span id="a">a</span>
26834
26835 <span id="b">b</span>
26836 !! wikitext/edited
26837 <span id="a">a</span><!--c1-->
26838
26839 <!--c2--><span id="b">b</span>
26840 !! end
26841
26842 ## T89383
26843 !! test
26844 Selser: Check for validity of DSR before using it
26845 !! options
26846 parsoid={
26847 "modes": ["selser"],
26848 "changes": [
26849 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26850 ]
26851 }
26852 !! wikitext
26853 <span id="a">a</span>
26854 !! wikitext/edited
26855 {{DISPLAYTITLE:foo}}
26856 <span id="a">a</span>
26857 !! end
26858
26859 !! test
26860 1. DOMDiff: Changes to <ref> content should be looked up using id
26861 !! options
26862 parsoid={
26863 "modes": ["selser"],
26864 "changes": [
26865 ["#X", "after", "bar"],
26866 ["#Y", "after", "baz"]
26867 ]
26868 }
26869 !! wikitext
26870 X <ref><span id="X">foo</span></ref>
26871 Y <ref name="a" />
26872 <references>
26873 <ref name="a"><span id="Y">foo</span></ref>
26874 </references>
26875 !! wikitext/edited
26876 X <ref><span id="X">foo</span>bar</ref>
26877 Y <ref name="a" />
26878 <references>
26879 <ref name="a"><span id="Y">foo</span>baz</ref>
26880 </references>
26881 !! end
26882
26883 !! test
26884 2. DOMDiff: Changes to <ref> content should be looked up using id
26885 !! options
26886 parsoid={
26887 "modes": ["selser"],
26888 "changes": [
26889 ["#Z", "after", "bar"]
26890 ]
26891 }
26892 !! wikitext
26893 A <ref>foo bar for a</ref>
26894 B <ref group="X" name="b" />
26895
26896 <references />
26897
26898 <references group="X">
26899 <ref name="b"><span id="Z">foo</span></ref>
26900 </references>
26901 !! wikitext/edited
26902 A <ref>foo bar for a</ref>
26903 B <ref group="X" name="b" />
26904
26905 <references />
26906
26907 <references group="X">
26908 <ref name="b"><span id="Z">foo</span>bar</ref>
26909 </references>
26910 !! end
26911
26912 !! test
26913 Empty LI (T49673)
26914 !! wikitext
26915 * a
26916 *
26917 *
26918 * b
26919 !! html/php+tidy
26920 <ul>
26921 <li>a</li>
26922 <li class="mw-empty-li"></li>
26923 <li class="mw-empty-li"></li>
26924 <li>b</li>
26925 </ul>
26926 !! end