Merge "Fix key prefix comment after 0a38dbc809c8"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml
39 #
40 # For testing purposes, temporary articles can created:
41 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
42 # where '/' denotes a newline.
43
44 # This is the standard article assumed to exist.
45 !! article
46 Main Page
47 !! text
48 blah blah
49 !! endarticle
50
51 !!article
52 Foo
53 !!text
54 FOO
55 !!endarticle
56
57 !!article
58 Template:Foo
59 !!text
60 FOO
61 !!endarticle
62
63 !! article
64 Template:Blank
65 !! text
66 !! endarticle
67
68 !! article
69 Template:pipe
70 !! text
71 |
72 !! endarticle
73
74 !! article
75 Template:=
76 !! text
77 <nowiki>=</nowiki>
78 !! endarticle
79
80 !!article
81 MediaWiki:bad image list
82 !!text
83 * [[File:Bad.jpg]] except [[Nasty page]]
84 !!endarticle
85
86 !! article
87 Template:inner list
88 !! text
89 * item 1
90 !! endarticle
91
92 !! article
93 Template:tbl-start
94 !! text
95 {|
96 !! endarticle
97
98 !! article
99 Template:tbl-end
100 !! text
101 |}
102 !! endarticle
103
104 !! article
105 Template:echo
106 !! text
107 {{{1}}}
108 !! endarticle
109
110 !! article
111 Template:echo_with_span
112 !! text
113 <span>{{{1}}}</span>
114 !! endarticle
115
116 !! article
117 Template:echo_with_div
118 !! text
119 <div>{{{1}}}</div>
120 !! endarticle
121
122 !! article
123 Template:blank_param
124 !! text
125 {{{1}}}
126 {{{}}}
127 !! endarticle
128
129 !! article
130 Template:table_attribs
131 !! text
132 <noinclude>
133 |</noinclude>style="color:red;"|Foo
134 !! endarticle
135
136 !! article
137 Template:table_attribs_2
138 !! text
139 <noinclude>
140 |</noinclude>style="color:red;"|Foo
141 |Bar||Baz
142 !! endarticle
143
144 !! article
145 Template:table_attribs_3
146 !! text
147 <noinclude>
148 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
149 !! endarticle
150
151 !! article
152 Template:table_attribs_4
153 !! text
154 | style="background-color:#DC241f;" width="10px" |
155 !! endarticle
156
157 !! article
158 Template:table_attribs_5
159 !! text
160 <noinclude>
161 |</noinclude>style="color:red;"||Bar
162 !! endarticle
163
164 !! article
165 Template:table_attribs_6
166 !! text
167 style="background: <nowiki>
168
169
170 red;</nowiki>" |
171 !! endarticle
172
173 !! article
174 Template:table_attribs_7
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
178 !! endarticle
179
180 !! article
181 Template:table_header_cells
182 !! text
183 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
184 !! endarticle
185
186 !! article
187 Template:table_cells
188 !! text
189 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
190 !! endarticle
191
192 !! article
193 Template:PartialTable
194 !! text
195 {|
196 |-
197 !! endarticle
198
199 !! article
200 Template:image_attribs
201 !! text
202 <noinclude>
203 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
204 !! endarticle
205
206 ## See T48811 for details
207 !! article
208 Template:mixed_attr_content_template
209 !! text
210 style="color:red;" title="T48811"
211 |-
212 |foo
213 !! endarticle
214
215 !! article
216 Template:definition_list
217 !! text
218 one
219 ::two
220 !! endarticle
221
222 !! article
223 A?b
224 !! text
225 Weirdo titles!
226 !! endarticle
227
228 !!article
229 Template:Bullet
230 !!text
231 * Bar
232 !!endarticle
233
234 !!article
235 Template:OpenTable
236 !!text
237 {|
238 !!endarticle
239
240 !!article
241 Template:EmptyLITest
242 !!text
243 *a
244 *
245 *
246 *b
247 !!endarticle
248
249 !!article
250 Template:EmptyTRTest
251 !!text
252 {|
253 |-
254 |-
255 |foo
256 |-
257 |-
258 |bar
259 |}
260 !!endarticle
261
262 !!article
263 Template:EmptyTRWithHTMLAttrTest
264 !!text
265 <table>
266 <tr align="center"></tr>
267 <tr><td>foo</td></tr>
268 <tr align="center"></tr>
269 <tr><td>bar</td></tr>
270 </table>
271 !!endarticle
272
273 ###
274 ### Basic tests
275 ###
276 !! test
277 Blank input
278 !! wikitext
279 !! html
280 !! end
281
282
283 !! test
284 Simple paragraph
285 !! wikitext
286 This is a simple paragraph.
287 !! html
288 <p>This is a simple paragraph.
289 </p>
290 !! end
291
292 !! test
293 Paragraphs with extra newline spacing
294 !! wikitext
295 foo
296
297 bar
298
299
300 baz
301
302
303
304 booz
305 !! html
306 <p>foo
307 </p><p>bar
308 </p><p><br />
309 baz
310 </p><p><br />
311 </p><p>booz
312 </p>
313 !! end
314
315 !! test
316 Paragraphs with newline spacing with comment lines in between
317 !! wikitext
318 ----
319 a
320 <!--foo-->
321 b
322 ----
323 a
324 <!--foo--><!--More than 1 comment, still stripped-->
325 b
326 ----
327 a
328 <!--foo--> <!----> <!-- bar -->
329 b
330 ----
331 a
332 <!--foo-->
333
334 b
335 ----
336 a
337
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo-->
343
344
345 b
346 ----
347 a
348
349
350 <!--foo-->
351 b
352 ----
353 !! html
354 <hr />
355 <p>a
356 b
357 </p>
358 <hr />
359 <p>a
360 b
361 </p>
362 <hr />
363 <p>a
364 b
365 </p>
366 <hr />
367 <p>a
368 </p><p>b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
377 b
378 </p>
379 <hr />
380 <p>a
381 </p><p><br />
382 b
383 </p>
384 <hr />
385
386 !! end
387
388 !! test
389 Paragraphs with newline spacing with non-empty white-space lines in between
390 !! wikitext
391 ----
392 a
393
394 b
395 ----
396 a
397
398
399 b
400 ----
401 !! html
402 <hr />
403 <p>a
404 </p><p>b
405 </p>
406 <hr />
407 <p>a
408 </p><p><br />
409 b
410 </p>
411 <hr />
412
413 !! end
414
415 !! test
416 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
417 !! wikitext
418 ----
419 a
420 <!--foo-->
421 b
422 ----
423 a
424 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
425 b
426 ----
427 a
428
429 <!--foo-->
430 <!--bar-->
431 b
432 ----
433 a
434
435 <!--foo-->
436 <!--bar-->
437
438 b
439 ----
440 !! html
441 <hr />
442 <p>a
443 b
444 </p>
445 <hr />
446 <p>a
447 b
448 </p>
449 <hr />
450 <p>a
451 </p><p>b
452 </p>
453 <hr />
454 <p>a
455 </p><p><br />
456 b
457 </p>
458 <hr />
459
460 !! end
461
462 !! test
463 Extra newlines: More paragraphs with indented comment
464 !! wikitext
465 a
466
467 <!--boo-->
468
469 b
470 !! html
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 !!end
476
477 !! test
478 Extra newlines followed by heading
479 !! wikitext
480 a
481
482
483
484 =b=
485 [[a]]
486
487
488 =b=
489 !! html
490 <p>a
491 </p><p><br />
492 </p>
493 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p><p><br />
496 </p>
497 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
498
499 !! end
500
501 !! test
502 Extra newlines between heading and content are swallowed
503 !! wikitext
504 =b=
505
506
507
508 [[a]]
509 !! html
510 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p>
513 !! end
514
515 !! test
516 Parsing an URL
517 !! wikitext
518 http://fr.wikipedia.org/wiki/🍺
519 <!-- EasterEgg we love beer, better be able be able to link to it -->
520 !! html
521 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
522 </p>
523 !! end
524
525 # Note that the html+tidy output removes the spaces after the <li>,
526 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
527 # This is an issue for all tests with lists. We intentionally do
528 # *not* add html+tidy clauses for these, as we don't want to
529 # document/test the broken behavior. (Parsoid matches the non-tidy
530 # output in these cases.)
531
532 !! test
533 Simple list
534 !! wikitext
535 * Item 1
536 * Item 2
537 !! html
538 <ul><li> Item 1</li>
539 <li> Item 2</li></ul>
540
541 !! end
542
543 !! test
544 Italics and bold
545 !! wikitext
546 * plain
547 * plain''italic''plain
548 * plain''italic''plain''italic''plain
549 * plain'''bold'''plain
550 * plain'''bold'''plain'''bold'''plain
551 * plain''italic''plain'''bold'''plain
552 * plain'''bold'''plain''italic''plain
553 * plain''italic'''bold-italic'''italic''plain
554 * plain'''bold''bold-italic''bold'''plain
555 * plain'''''bold-italic'''italic''plain
556 * plain'''''bold-italic''bold'''plain
557 * plain''italic'''bold-italic'''''plain
558 * plain'''bold''bold-italic'''''plain
559 * plain l'''italic''plain
560 * plain l''''bold''' plain
561 !! html
562 <ul><li> plain</li>
563 <li> plain<i>italic</i>plain</li>
564 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
565 <li> plain<b>bold</b>plain</li>
566 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
567 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
568 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
569 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
570 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
571 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
572 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
573 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
574 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
575 <li> plain l'<i>italic</i>plain</li>
576 <li> plain l'<b>bold</b> plain</li></ul>
577
578 !! end
579
580 # this example taken from the [[simple:Moon]] article (bug 47326)
581 !! test
582 Italics and possessives (1)
583 !! wikitext
584 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
585 !! html
586 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
587 </p>
588 !! end
589
590 # this example taken from [[en:Flaming Pie]] (bug 49926)
591 !! test
592 Italics and possessives (2)
593 !! wikitext
594 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
595 !! html
596 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
597 </p>
598 !! end
599
600 # this example taken from [[en:Dictionary]] (bug 49926)
601 !! test
602 Italics and possessives (3)
603 !! wikitext
604 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
605 !! html
606 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
607 </p>
608 !! end
609
610
611 ###
612 ### 2-quote opening sequence tests
613 ###
614 !! test
615 Italics and bold: 2-quote opening sequence: (2,2)
616 !! wikitext
617 ''foo''
618 !! html
619 <p><i>foo</i>
620 </p>
621 !!end
622
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,3)
625 !! wikitext
626 ''foo'''
627 !! html/*
628 <p><i>foo'</i>
629 </p>
630 !!end
631
632 !! test
633 Italics and bold: 2-quote opening sequence: (2,4)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 ''foo''''
638 !! html/*
639 <p><i>foo''</i>
640 </p>
641 !!end
642
643 # same html as previous, but wikitext adjusted to match parsoid html2wt
644 !! test
645 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
646 !! wikitext
647 ''foo<nowiki>''</nowiki>''
648 !! html
649 <p><i>foo''</i>
650 </p>
651 !! end
652
653 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
654 !! test
655 Italics and bold: 2-quote opening sequence: (2,5)
656 !! options
657 parsoid=wt2html
658 !! wikitext
659 ''foo'''''
660 !! html/php
661 <p><i>foo</i>
662 </p>
663 !! html/parsoid
664 <p><i>foo</i><b></b>
665 </p>
666 !!end
667
668 # same html as previous, but wikitext adjusted to match parsoid html2wt
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
671 !! wikitext
672 ''foo'''''<nowiki/>'''
673 !! html/php
674 <p><i>foo</i>
675 </p>
676 !! html/parsoid
677 <p><i>foo</i><b></b>
678 </p>
679 !! end
680
681
682 ###
683 ### 3-quote opening sequence tests
684 ###
685
686 !! test
687 Italics and bold: 3-quote opening sequence: (3,2)
688 !! wikitext
689 '''foo''
690 !! html/*
691 <p>'<i>foo</i>
692 </p>
693 !!end
694
695 !! test
696 Italics and bold: 3-quote opening sequence: (3,3)
697 !! wikitext
698 '''foo'''
699 !! html
700 <p><b>foo</b>
701 </p>
702 !!end
703
704 !! test
705 Italics and bold: 3-quote opening sequence: (3,4)
706 !! wikitext
707 '''foo''''
708 !! html/*
709 <p><b>foo'</b>
710 </p>
711 !!end
712
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 '''foo'''''
720 !! html/php
721 <p><b>foo</b>
722 </p>
723 !! html/parsoid
724 <p><b>foo</b><i></i>
725 </p>
726 !!end
727
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
731 !! wikitext
732 '''foo'''''<nowiki/>''
733 !! html/php
734 <p><b>foo</b>
735 </p>
736 !! html/parsoid
737 <p><b>foo</b><i></i>
738 </p>
739 !! end
740
741
742 ###
743 ### 4-quote opening sequence tests
744 ###
745
746 !! test
747 Italics and bold: 4-quote opening sequence: (4,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 ''''foo''
752 !! html/*
753 <p>''<i>foo</i>
754 </p>
755 !!end
756
757 # same html as previous, but wikitext adjusted to match parsoid html2wt
758 !! test
759 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
760 !! wikitext
761 <nowiki>''</nowiki>''foo''
762 !! html
763 <p>''<i>foo</i>
764 </p>
765 !! end
766
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,3)
769 !! wikitext
770 ''''foo'''
771 !! html/*
772 <p>'<b>foo</b>
773 </p>
774 !!end
775
776 !! test
777 Italics and bold: 4-quote opening sequence: (4,4)
778 !! options
779 parsoid=wt2html
780 !! wikitext
781 ''''foo''''
782 !! html/*
783 <p>'<b>foo'</b>
784 </p>
785 !!end
786
787 # same html as previous, but wikitext adjusted to match parsoid html2wt
788 !! test
789 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
790 !! wikitext
791 '<nowiki/>'''foo''''
792 !! html
793 <p>'<b>foo'</b>
794 </p>
795 !! end
796
797 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
798 !! test
799 Italics and bold: 4-quote opening sequence: (4,5)
800 !! options
801 parsoid=wt2html
802 !! wikitext
803 ''''foo'''''
804 !! html/php
805 <p>'<b>foo</b>
806 </p>
807 !! html/parsoid
808 <p>'<b>foo</b><i></i>
809 </p>
810 !!end
811
812 # same html as previous, but wikitext adjusted to match parsoid html2wt
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
815 !! wikitext
816 '<nowiki/>'''foo'''''<nowiki/>''
817 !! html/php
818 <p>'<b>foo</b>
819 </p>
820 !! html/parsoid
821 <p>'<b>foo</b><i></i>
822 </p>
823 !! end
824
825
826 ###
827 ### 5-quote opening sequence tests
828 ###
829
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,2)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 '''''foo''
836 !! html/*
837 <p><b><i>foo</i></b>
838 </p>
839 !!end
840
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! wikitext
845 '''''foo'''''
846 !! html/*
847 <p><i><b>foo</b></i>
848 </p>
849 !! end
850
851 !! test
852 Italics and bold: 5-quote opening sequence: (5,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 '''''foo'''
857 !! html/*
858 <p><i><b>foo</b></i>
859 </p>
860 !!end
861
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,3+2)
865 !! wikitext
866 '''''foo'''''
867 !! html
868 <p><i><b>foo</b></i>
869 </p>
870 !! end
871
872 !! test
873 Italics and bold: 5-quote opening sequence: (5,4)
874 !! options
875 parsoid=wt2html
876 !! wikitext
877 '''''foo''''
878 !! html/*
879 <p><i><b>foo'</b></i>
880 </p>
881 !!end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,5)
885 !! wikitext
886 '''''foo'''''
887 !! html
888 <p><i><b>foo</b></i>
889 </p>
890 !!end
891
892 !! test
893 Italics and bold: 5-quote opening sequence: (5,6)
894 !! wikitext
895 '''''foo''''''
896 !! html/*
897 <p><i><b>foo'</b></i>
898 </p>
899 !! end
900
901 ###
902 ### multiple quote sequences in a line
903 ###
904 !! test
905 Italics and bold: multiple quote sequences: (2,4,2)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 ''foo''''bar''
910 !! html/*
911 <p><i>foo'<b>bar</b></i>
912 </p>
913 !!end
914
915
916 # same html as previous, but wikitext adjusted to match parsoid html2wt
917 !! test
918 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
919 !! wikitext
920 ''foo'<nowiki/>'''bar'''''
921 !! html
922 <p><i>foo'<b>bar</b></i>
923 </p>
924 !! end
925
926
927 !! test
928 Italics and bold: multiple quote sequences: (2,4,3)
929 !! options
930 parsoid=wt2html
931 !! wikitext
932 ''foo''''bar'''
933 !! html/*
934 <p><i>foo'<b>bar</b></i>
935 </p>
936 !!end
937
938
939 # same html as previous, but wikitext adjusted to match parsoid html2wt
940 !! test
941 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
942 !! wikitext
943 ''foo'<nowiki/>'''bar'''''
944 !! html
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,4)
952 !! options
953 parsoid=wt2html
954 !! wikitext
955 ''foo''''bar''''
956 !! html/*
957 <p><i>foo'<b>bar'</b></i>
958 </p>
959 !!end
960
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'<nowiki/>'''''
967 !! html
968 <p><i>foo'<b>bar'</b></i>
969 </p>
970 !! end
971
972
973 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
974 !! test
975 Italics and bold: multiple quote sequences: (3,4,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''foo''''bar''
980 !! html/php
981 <p><b>foo'</b>bar
982 </p>
983 !! html/parsoid
984 <p><b>foo'</b>bar<i></i>
985 </p>
986 !!end
987
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
991 !! options
992 parsoid
993 !! wikitext
994 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
995 !! html/php
996 <p><b>foo'</b>bar
997 </p>
998 !! html/parsoid
999 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1000 </p>
1001 !! end
1002
1003
1004 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1005 !! test
1006 Italics and bold: multiple quote sequences: (3,4,3)
1007 !! options
1008 parsoid=wt2html
1009 !! wikitext
1010 '''foo''''bar'''
1011 !! html/php
1012 <p><b>foo'</b>bar
1013 </p>
1014 !! html/parsoid
1015 <p><b>foo'</b>bar<b></b>
1016 </p>
1017 !!end
1018
1019 # same html as previous, but wikitext adjusted to match parsoid html2wt
1020 !! test
1021 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1022 !! wikitext
1023 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1024 !! html/php
1025 <p><b>foo'</b>bar
1026 </p>
1027 !! html/parsoid
1028 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1029 </p>
1030 !! end
1031
1032 ###
1033 ### other quote tests
1034 ###
1035 !! test
1036 Italics and bold: other quote tests: (2,3,5)
1037 !! wikitext
1038 ''this is about '''foo's family'''''
1039 !! html
1040 <p><i>this is about <b>foo's family</b></i>
1041 </p>
1042 !!end
1043
1044
1045 !! test
1046 Italics and bold: other quote tests: (2,(3,3),2)
1047 !! wikitext
1048 ''this is about '''foo's''' family''
1049 !! html
1050 <p><i>this is about <b>foo's</b> family</i>
1051 </p>
1052 !!end
1053
1054
1055 !! test
1056 Italics and bold: other quote tests: (3,2,3,2)
1057 !! options
1058 parsoid=wt2html
1059 !! wikitext
1060 '''this is about ''foo'''s family''
1061 !! html/*
1062 <p><b>this is about <i>foo</i></b><i>s family</i>
1063 </p>
1064 !!end
1065
1066
1067 # same html as previous, but wikitext adjusted to match parsoid html2wt
1068 !! test
1069 Italics and bold: other quote tests: (3,2,3+2+2,2)
1070 !! wikitext
1071 '''this is about ''foo'''''<nowiki/>''s family''
1072 !! html
1073 <p><b>this is about <i>foo</i></b><i>s family</i>
1074 </p>
1075 !! end
1076
1077
1078 !! test
1079 Italics and bold: other quote tests: (3,2,3,3)
1080 !! wikitext
1081 '''this is about ''foo'''s family'''
1082 !! html/*
1083 <p>'<i>this is about </i>foo<b>s family</b>
1084 </p>
1085 !!end
1086
1087
1088 !! test
1089 Italics and bold: other quote tests: (3,(2,2),3)
1090 !! wikitext
1091 '''this is about ''foo's'' family'''
1092 !! html
1093 <p><b>this is about <i>foo's</i> family</b>
1094 </p>
1095 !!end
1096
1097
1098 !! test
1099 Italicized possessive
1100 !! wikitext
1101 The ''[[Main Page]]'''s talk page.
1102 !! html/php
1103 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1104 </p>
1105 !! html/parsoid
1106 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1107 !! end
1108
1109 !! test
1110 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1111 (Requires tidy for PHP parser output to be fixed up)
1112 !! options
1113 parsoid=wt2html,wt2wt
1114 !! wikitext
1115 {|
1116 !''a!!''b
1117 |''a||''b
1118 |}
1119 !! html/php+tidy
1120 <table>
1121 <tr>
1122 <th><i>a</i></th>
1123 <th><i>b</i></th>
1124 <td><i>a</i></td>
1125 <td><i>b</i></td>
1126 </tr>
1127 </table>
1128 !! html/parsoid
1129 <table>
1130 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1131 <td><i>a</i></td><td><i>b</i></td></tr>
1132 </tbody></table>
1133 !! end
1134
1135 ###
1136 ### Non-html5 tags
1137 ###
1138
1139 !! test
1140 Non-html5 tags should be accepted
1141 !! wikitext
1142 <center>''foo''</center>
1143 <big>''foo''</big>
1144 <font>''foo''</font>
1145 <strike>''foo''</strike>
1146 <tt>''foo''</tt>
1147 !! html
1148 <center><i>foo</i></center>
1149 <p><big><i>foo</i></big>
1150 <font><i>foo</i></font>
1151 <strike><i>foo</i></strike>
1152 <tt><i>foo</i></tt>
1153 </p>
1154 !! end
1155
1156 !! test
1157 <wbr> is valid wikitext (bug 52468)
1158 !! wikitext
1159 <wbr>
1160 !! html
1161 <p><wbr />
1162 </p>
1163 !! end
1164
1165 # <strike> is HTML4, <s> is HTML4/5.
1166 !! test
1167 <s> or <strike> for strikethrough
1168 !! wikitext
1169 <strike>strike</strike>
1170
1171 <s>s</s>
1172 !! html
1173 <p><strike>strike</strike>
1174 </p><p><s>s</s>
1175 </p>
1176 !! end
1177
1178 ## a not permitted
1179 ## i,b,br omitted
1180 !! test
1181 Text-level semantic html elements in wikitext
1182 !! wikitext
1183 <em>text</em>
1184 <strong>text</strong>
1185 <small>text</small>
1186 <s>text</s>
1187 <cite>text</cite>
1188 <q>text</q>
1189 <dfn>text</dfn>
1190 <abbr>text</abbr>
1191 <data>text</data>
1192 <time>text</time>
1193 <code>text</code>
1194 <var>text</var>
1195 <samp>text</samp>
1196 <kbd>text</kbd>
1197 <sub>text</sub>
1198 <u>text</u>
1199 <mark>text</mark>
1200 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1201 <bdi>text</bdi>
1202 <bdo>text</bdo>
1203 <span>text</span>
1204 <wbr />
1205 !! html
1206 <p><em>text</em>
1207 <strong>text</strong>
1208 <small>text</small>
1209 <s>text</s>
1210 <cite>text</cite>
1211 <q>text</q>
1212 <dfn>text</dfn>
1213 <abbr>text</abbr>
1214 <data>text</data>
1215 <time>text</time>
1216 <code>text</code>
1217 <var>text</var>
1218 <samp>text</samp>
1219 <kbd>text</kbd>
1220 <sub>text</sub>
1221 <u>text</u>
1222 <mark>text</mark>
1223 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1224 <bdi>text</bdi>
1225 <bdo>text</bdo>
1226 <span>text</span>
1227 <wbr />
1228 </p>
1229 !! end
1230
1231 # test cases taken from
1232 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1233 !! test
1234 Ruby markup (W3C-style)
1235 !! wikitext
1236 ; Mono-ruby for individual base characters
1237 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1238 ; Group ruby
1239 : <ruby>今日<rt>きょう</rt></ruby>
1240 ; Jukugo ruby
1241 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1242 ; Inline ruby
1243 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1244 ; Double-sided ruby
1245 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1246 <ruby>
1247 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1248 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1249 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1250 </ruby>
1251 !! html
1252 <dl><dt> Mono-ruby for individual base characters</dt>
1253 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1254 <dt> Group ruby</dt>
1255 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1256 <dt> Jukugo ruby</dt>
1257 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1258 <dt> Inline ruby</dt>
1259 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1260 <dt> Double-sided ruby</dt>
1261 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1262 <p><ruby>
1263 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1264 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1265 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1266 </ruby>
1267 </p>
1268 !! end
1269
1270 # The next two test different paths in the sanitizer.
1271 !! test
1272 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1273 !! wikitext
1274 <blockquote|>a</blockquote>
1275
1276 <b→> doesn't terminate </b→>
1277
1278 <bä> doesn't terminate </bä>
1279
1280 <boo> doesn't terminate </boo>
1281
1282 <s.foo> doesn't terminate </s.foo>
1283
1284 <sub-ID#1>
1285 !! html
1286 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1287 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1288 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1289 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1290 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1291 </p><p>&lt;sub-ID#1&gt;
1292 </p>
1293 !! end
1294
1295 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1296 # If the non-word-character tag made it through the sanitizer, tidy
1297 # would munge it up.
1298 !! test
1299 Non-word characters don't terminate tag names + tidy
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html+tidy
1313 <p>&lt;blockquote|&gt;a</p>
1314 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1315 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1316 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1317 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1318 <p>&lt;sub-ID#1&gt;</p>
1319 !! end
1320
1321 ###
1322 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1323 ### This checks that HTML5 tags (with non-word characters in the tag
1324 ### name) make it safely through the parser -- the Sanitizer will
1325 ### munge them later, as it should.
1326 ###
1327 !! test
1328 Non-word characters are valid in extension tags (T19663)
1329 !! wikitext
1330 <tåg>tåg</tåg>
1331 !! html/php
1332 <pre>
1333 'tåg'
1334 array (
1335 )
1336 </pre>
1337
1338 !! html/parsoid
1339 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1340 !! end
1341
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1348
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1355
1356 ###
1357 ### Special characters
1358 ###
1359
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1363 |
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1368
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1377
1378 ###
1379 ### <nowiki> test cases
1380 ###
1381
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1392
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1397
1398 sed abit.
1399 sed nullum.
1400
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1405
1406 sed abit.
1407 sed nullum.
1408
1409 :and a colon
1410
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1414
1415 sed abit.
1416 sed nullum.
1417
1418 :and a colon
1419 </span></p>
1420 !! end
1421
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1427
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1430
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1440
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1444
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1447
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1451
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Entities inside template parameters
1463 !! wikitext
1464 {{echo|&ndash;}}
1465 !! html/php+tidy
1466 <p>–</p>
1467 !! html/parsoid
1468 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1469 !! end
1470
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html/parsoid
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1480
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1490
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1504
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1516
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1525 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1530
1531 !! test
1532 T53961: Output correct nowikis in template arguments
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|<nowiki>a }} b</nowiki>}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1548
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1557
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1563 {|
1564 !<nowiki>this needs protection !! here</nowiki>
1565 |}
1566
1567 {|
1568 !this does not need
1569 protection !! here
1570 |}
1571 !! end
1572
1573 ###
1574 ### Comments
1575 ###
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1586
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1599 xyz
1600 </pre>
1601 !! end
1602
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1608 jkl
1609 !! html
1610 <p>asdf
1611 jkl
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620
1621 jkl
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1627
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1634 jkl
1635 !! html
1636 <p>asdf
1637 jkl
1638 </p>
1639 !! end
1640
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment spacing
1652 !! wikitext
1653 a
1654 <!-- foo --> b <!-- bar -->
1655 c
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1670
1671 !! end
1672
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1678
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1689
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1711
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1722
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1736
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1757
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1765
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1774
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1778 a
1779 {{blank}}<!---->
1780 b
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
1789 !! wikitext
1790 a
1791 {{blank}} <!---->
1792 b
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1798
1799 !! test
1800 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html/php
1807 <ul><li>a</li>
1808 <li>b</li></ul>
1809
1810 !! html/parsoid
1811 <!--c1--><ul>
1812 <li>a
1813 </li>
1814 <!--c2--><!--c3--><!--c4-->
1815 <li>b
1816 </li>
1817 </ul>
1818 !! end
1819
1820 ###
1821 ### paragraph wrapping tests
1822 ###
1823 !! test
1824 No block tags
1825 !! wikitext
1826 a
1827
1828 b
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1834
1835 !! test
1836 Block tag on one line (<div>)
1837 !! wikitext
1838 a <div>foo</div>
1839
1840 b
1841 !! html
1842 a <div>foo</div>
1843 <p>b
1844 </p>
1845 !! html+tidy
1846 <p>a</p>
1847 <div>foo</div>
1848 <p>b</p>
1849 !! end
1850
1851 !! test
1852 Block tag on one line (<blockquote>)
1853 !! wikitext
1854 a <blockquote>foo</blockquote>
1855
1856 b
1857 !! html
1858 a <blockquote>foo</blockquote>
1859 <p>b
1860 </p>
1861 !! html+tidy
1862 <p>a</p>
1863 <blockquote>
1864 <p>foo</p>
1865 </blockquote>
1866 <p>b</p>
1867 !! end
1868
1869 !! test
1870 Block tag on both lines (<div>)
1871 !! wikitext
1872 a <div>foo</div>
1873
1874 b <div>foo</div>
1875 !! html
1876 a <div>foo</div>
1877 b <div>foo</div>
1878
1879 !! html+tidy
1880 <p>a</p>
1881 <div>foo</div>
1882 <p>b</p>
1883 <div>foo</div>
1884 !! end
1885
1886 !! test
1887 Block tag on both lines (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b <blockquote>foo</blockquote>
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 b <blockquote>foo</blockquote>
1895
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 <blockquote>
1903 <p>foo</p>
1904 </blockquote>
1905 !! end
1906
1907 !! test
1908 Multiple lines without block tags
1909 !! wikitext
1910 <div>foo</div> a
1911 b
1912 c
1913 d<!--foo--> e
1914 x <div>foo</div> z
1915 !! html
1916 <div>foo</div> a
1917 <p>b
1918 c
1919 d e
1920 </p>
1921 x <div>foo</div> z
1922
1923 !! html+tidy
1924 <div>foo</div>
1925 <p>a</p>
1926 <p>b c d e</p>
1927 <p>x</p>
1928 <div>foo</div>
1929 <p>z</p>
1930 !! end
1931
1932 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1933 # So, we have a separate section for Parsoid. We don't want
1934 # to mimic this stripping behavior in Parsoid. It affects
1935 # editing experience and also requires us to maintain additional
1936 # info for RT-ing.
1937 !! test
1938 Empty lines between lines with block tags
1939 !! wikitext
1940 <div></div>
1941
1942
1943 <div></div>a
1944
1945 b
1946 <div>a</div>b
1947
1948 <div>b</div>d
1949
1950
1951 <div>e</div>
1952 !! html
1953 <div></div>
1954 <p><br />
1955 </p>
1956 <div></div>a
1957 <p>b
1958 </p>
1959 <div>a</div>b
1960 <div>b</div>d
1961 <p><br />
1962 </p>
1963 <div>e</div>
1964
1965 !! html+tidy
1966 <p><br /></p>
1967 <p>a</p>
1968 <p>b</p>
1969 <div>a</div>
1970 <p>b</p>
1971 <div>b</div>
1972 <p>d</p>
1973 <p><br /></p>
1974 <div>e</div>
1975 !! html/parsoid
1976 <div data-parsoid='{"stx":"html"}'></div>
1977
1978 <p><br /></p>
1979 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1980
1981 <p>b</p>
1982 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1983
1984 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1985
1986 <p><br /></p>
1987 <div data-parsoid='{"stx":"html"}'>e</div>
1988 !! end
1989
1990 ## PHP parser emits output which is broken
1991 !! test
1992 Unclosed HTML p-tags should be handled properly
1993 !! wikitext
1994 <div><p>foo</div>
1995 a
1996
1997 b
1998 !! html/php+tidy
1999 <div>
2000 <p>foo</p>
2001 </div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! html/parsoid
2005 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2006 <p>a</p>
2007 <p>b</p>
2008 !! end
2009
2010 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2011 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2012 ## them for now.
2013 !! test
2014 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2015 !! options
2016 parsoid=wt2html
2017 !! wikitext
2018 a [[Category:A1]] [[Category:A2]]
2019 [[Category:A3]]
2020 [[Category:A4]]
2021 !! html/parsoid
2022 <p>a</p>
2023 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2024 !! end
2025
2026 !! test
2027 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2028 !! options
2029 parsoid=wt2html
2030 !! wikitext
2031 [[Category:A1]]a
2032 !! html/parsoid
2033 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2034 !! end
2035
2036 ###
2037 ### Preformatted text
2038 ###
2039 !! test
2040 Preformatted text
2041 !! wikitext
2042 This is some
2043 Preformatted text
2044 With ''italic''
2045 And '''bold'''
2046 And a [[Main Page|link]]
2047 !! html
2048 <pre>This is some
2049 Preformatted text
2050 With <i>italic</i>
2051 And <b>bold</b>
2052 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2053 </pre>
2054 !! end
2055
2056 !! test
2057 Tabs don't trigger preformatted text
2058 !! wikitext
2059 This is not
2060 preformatted text.
2061 This is preformatted text.
2062 So is this.
2063 !! html/php
2064 <p> This is not
2065 preformatted text.
2066 </p>
2067 <pre>This is preformatted text.
2068 So is this.
2069 </pre>
2070 !! html/parsoid
2071 <p> This is not
2072 preformatted text.</p>
2073 <pre>This is preformatted text.
2074 So is this.</pre>
2075 !! end
2076
2077 !! test
2078 Space before tab needs nowiki pre protection
2079 !! options
2080 parsoid=html2wt
2081 !! html/parsoid
2082 <p> a</p>
2083 !! wikitext
2084 <nowiki> </nowiki> a
2085 !! end
2086
2087 !! test
2088 Ident preformatting with inline content
2089 !! wikitext
2090 a
2091 ''b''
2092 !! html
2093 <pre>a
2094 <i>b</i>
2095 </pre>
2096 !! end
2097
2098 !! test
2099 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2100 !! wikitext
2101 <pre><nowiki>
2102 <b>
2103 <cite>
2104 <em>
2105 </nowiki></pre>
2106 !! html
2107 <pre>
2108 &lt;b&gt;
2109 &lt;cite&gt;
2110 &lt;em&gt;
2111 </pre>
2112
2113 !! end
2114
2115 !! test
2116 Regression with preformatted in <center>
2117 !! wikitext
2118 <center>
2119 Blah
2120 </center>
2121 !! html
2122 <center>
2123 <pre>Blah
2124 </pre>
2125 </center>
2126
2127 !! end
2128
2129 !! test
2130 Bug 52763: Preformatted in <blockquote>
2131 !! wikitext
2132 <blockquote>
2133 Blah
2134 {|
2135 |
2136 indented cell (no pre-wrapping!)
2137 |}
2138 </blockquote>
2139 !! html
2140 <blockquote>
2141 <p> Blah
2142 </p>
2143 <table>
2144 <tr>
2145 <td>
2146 <p> indented cell (no pre-wrapping!)
2147 </p>
2148 </td></tr></table>
2149 </blockquote>
2150
2151 !! end
2152
2153 !! test
2154 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2155 !! wikitext
2156 <blockquote>
2157 Foo
2158
2159 Bar
2160 </blockquote>
2161 !! html
2162 <blockquote>
2163 <p>Foo
2164 </p><p>Bar
2165 </p>
2166 </blockquote>
2167
2168 !! end
2169
2170 !! test
2171 Bug 15491: <ins>/<del> in blockquote
2172 !! wikitext
2173 <blockquote>
2174 Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p>Foo <del>bar</del> <ins>baz</ins> quux
2179 </p>
2180 </blockquote>
2181
2182 !! end
2183
2184 # Note that the p-wrapping is newline sensitive, which could be
2185 # considered a bug: tidy will wrap only the 'Foo' in the example
2186 # below in a <p> tag. (see comment 23-25 of bug #6200)
2187 !! test
2188 Bug 15491: <ins>/<del> in blockquote (2)
2189 !! wikitext
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192 !! html
2193 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2194 </blockquote>
2195
2196 !! html+tidy
2197 <blockquote>
2198 <p>Foo</p>
2199 <del>bar</del> <ins>baz</ins> quux</blockquote>
2200 !! end
2201
2202 !! test
2203 <pre> with attributes (bug 3202)
2204 !! wikitext
2205 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2206 !! html
2207 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2208
2209 !! end
2210
2211 !! test
2212 <pre> with width attribute (bug 3202)
2213 !! wikitext
2214 <pre width="8">Narrow screen goodies</pre>
2215 !! html
2216 <pre width="8">Narrow screen goodies</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute (bug 3202)
2222 !! wikitext
2223 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 Entities inside <pre>
2231 !! wikitext
2232 <pre>&lt;</pre>
2233 !! html
2234 <pre>&lt;</pre>
2235
2236 !! end
2237
2238 !! test
2239 <pre> with forbidden attribute values (bug 3202)
2240 !! wikitext
2241 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2242 !! html
2243 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2244
2245 !! end
2246
2247 !! test
2248 <nowiki> inside <pre> (bug 13238)
2249 !! wikitext
2250 <pre>
2251 <nowiki>
2252 </pre>
2253 <pre>
2254 <nowiki></nowiki>
2255 </pre>
2256 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2257 !! html
2258 <pre>
2259 &lt;nowiki&gt;
2260 </pre>
2261 <pre>
2262
2263 </pre>
2264 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2265
2266 !! end
2267
2268 !! test
2269 <nowiki> inside of #tag:pre
2270 !! wikitext
2271 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2272 !! html/php
2273 <pre>Foo &#8594;bar</pre>
2274
2275 !! html/parsoid
2276 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2277 !! end
2278
2279 !! test
2280 <nowiki> and <pre> preference (first one wins)
2281 !! wikitext
2282 <pre>
2283 <nowiki>
2284 </pre>
2285 </nowiki>
2286 </pre>
2287
2288 <nowiki>
2289 <pre>
2290 <nowiki>
2291 </pre>
2292 </nowiki>
2293 </pre>
2294
2295 !! html/php
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <p>&lt;/nowiki&gt;
2300 &lt;/pre&gt;
2301 </p><p>
2302 &lt;pre&gt;
2303 &lt;nowiki&gt;
2304 &lt;/pre&gt;
2305
2306 &lt;/pre&gt;
2307 </p>
2308 !! html/parsoid
2309 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2310 </pre>
2311 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2312 &lt;/pre></p>
2313
2314 <p><span typeof="mw:Nowiki">
2315 &lt;pre>
2316 &lt;nowiki>
2317 &lt;/pre>
2318 </span>
2319 &lt;/pre></p>
2320 !! end
2321
2322 !! test
2323 </pre> inside nowiki
2324 !! wikitext
2325 <nowiki></pre></nowiki>
2326 !! html
2327 <p>&lt;/pre&gt;
2328 </p>
2329 !! end
2330
2331 # Parsoid doesn't strip empty tags, like Tidy does.
2332 !! test
2333 Empty pre; pre inside other HTML tags (bug 54946)
2334 !! options
2335 parsoid=wt2html,wt2wt
2336 !! wikitext
2337 a
2338
2339 <div><pre>
2340 foo
2341 </pre></div>
2342 <pre></pre>
2343 !! html/php
2344 <p>a
2345 </p>
2346 <div><pre>
2347 foo
2348 </pre></div>
2349 <pre></pre>
2350
2351 !! html/php+tidy
2352 <p>a</p>
2353 <div>
2354 <pre>
2355 foo
2356 </pre></div>
2357 !! html/parsoid
2358 <p>a</p>
2359
2360 <div><pre>foo
2361 </pre></div>
2362 <pre></pre>
2363 !! end
2364
2365 !! test
2366 HTML pre followed by indent-pre
2367 !! wikitext
2368 <pre>foo</pre>
2369 bar
2370 !! html
2371 <pre>foo</pre>
2372 <pre>bar
2373 </pre>
2374 !! end
2375
2376 # Note that tidy removes the empty <p> tags from the start and end.
2377 # Parsoid does not, by design.
2378 !!test
2379 Block tag pre
2380 !! wikitext
2381 <p><pre>foo</pre></p>
2382 !! html/php+tidy
2383 <pre>
2384 foo
2385 </pre>
2386 !! html/parsoid
2387 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2388 !!end
2389
2390 !!test
2391 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2392 !! wikitext
2393 {{echo|}}
2394 !! html
2395
2396 !!end
2397
2398 !!test
2399 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2400 !! wikitext
2401 {{echo|
2402 foo}}
2403 !! html
2404 <p>foo
2405 </p>
2406 !!end
2407
2408 !! test
2409 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2410 !! wikitext
2411 {{echo|a
2412 b}}
2413 !! html
2414 <pre>a
2415 </pre>
2416 <p>b
2417 </p>
2418 !!end
2419
2420 !! test
2421 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2422 !! wikitext
2423 {{echo|a
2424 b
2425 c
2426 d
2427 e
2428 }}
2429 !! html
2430 <pre>a
2431 </pre>
2432 <p>b
2433 c
2434 </p>
2435 <pre>d
2436 </pre>
2437 <p>e
2438 </p>
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2443 !! wikitext
2444 {{echo| foo}}
2445
2446 {{echo| foo}}{{echo| bar}}
2447
2448 {{echo| foo}}
2449 {{echo| bar}}
2450
2451 {{echo|<!--cmt--> foo}}
2452
2453 <!--cmt-->{{echo| foo}}
2454
2455 {{echo|{{echo| }}bar}}
2456 !! html
2457 <pre>foo
2458 </pre>
2459 <pre>foo bar
2460 </pre>
2461 <pre>foo
2462 bar
2463 </pre>
2464 <pre>foo
2465 </pre>
2466 <pre>foo
2467 </pre>
2468 <pre>bar
2469 </pre>
2470 !!end
2471
2472 !! test
2473 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2474 !! wikitext
2475 {{echo| }}a
2476
2477 {{echo|
2478 }}a
2479
2480 {{echo|
2481 b}}
2482
2483 {{echo|a
2484 }}b
2485
2486 {{echo|a
2487 }} b
2488 !! html
2489 <pre>a
2490 </pre>
2491 <p><br />
2492 </p>
2493 <pre>a
2494 </pre>
2495 <p><br />
2496 </p>
2497 <pre>b
2498 </pre>
2499 <p>a
2500 </p>
2501 <pre>b
2502 </pre>
2503 <p>a
2504 </p>
2505 <pre>b
2506 </pre>
2507 !!end
2508
2509 !! test
2510 Pres with newline attributes
2511 !! wikitext
2512 <pre class="one
2513 two">hi</pre>
2514 !! html/php
2515 <pre class="one two">hi</pre>
2516
2517 !! html/parsoid
2518 <pre class="one
2519 two" data-parsoid='{"stx":"html"}'>hi</pre>
2520 !! end
2521
2522 !! test
2523 Things that look like <pre> tags aren't treated as such
2524 !! wikitext
2525 Barack Obama <President> of the United States
2526 <President></President>
2527 !! html
2528 <p>Barack Obama &lt;President&gt; of the United States
2529 &lt;President&gt;&lt;/President&gt;
2530 </p>
2531 !! end
2532
2533 !! test
2534 Handle broken pre-like tags (bug 64025)
2535 !! options
2536 parsoid=wt2html
2537 !! wikitext
2538 {{echo|<pre <pre>x</pre>}}
2539
2540 <table><pre </table>
2541 !! html/php
2542 <pre>x</pre>
2543 <table>&lt;pre </table>
2544
2545 !! html/php+tidy
2546 <pre>
2547 x
2548 </pre>
2549 <p>&lt;pre</p>
2550 !! html/parsoid
2551 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2552
2553
2554 <p>&lt;pre </p>
2555
2556 <table></table>
2557 !! end
2558
2559 !! test
2560 Parsoid: handle pre with space after attribute
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 <pre style="width:50%;" >{{echo|foo}}</pre>
2565 !! html/php
2566 <pre style="width:50%;">{{echo|foo}}</pre>
2567
2568 !! html/parsoid
2569 <pre style="width:50%;">{{echo|foo}}</pre>
2570 !! end
2571
2572 # TODO / maybe: fix wt2wt for this
2573 !! test
2574 Parsoid: Don't paragraph-wrap fosterable content
2575 !! options
2576 parsoid=wt2html
2577 !! wikitext
2578 {|
2579 <td></td>
2580 <td></td>
2581
2582
2583
2584 |}
2585 !! html
2586 <table>
2587
2588 <tbody>
2589 <tr>
2590 <td></td>
2591
2592 <td></td></tr>
2593
2594
2595
2596 </tbody></table>
2597 !! end
2598
2599 !! test
2600 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 {|
2605 <td>
2606 <td>
2607 </td>
2608
2609
2610
2611 |}
2612 !! html
2613 <table>
2614
2615 <tbody>
2616 <tr>
2617 <td></td>
2618
2619 <td>
2620 </td></tr>
2621
2622
2623
2624 </tbody></table>
2625 !! end
2626
2627
2628 #--------------------------------------------------------------------
2629 # Transclusion parameter whitespace stripping tests
2630 # Behavior is different for positional and named parameters
2631 #--------------------------------------------------------------------
2632 !! test
2633 Templates: Strip leading and trailing whitespace from named-param values
2634 !! wikitext
2635 {{echo|1= a }}
2636
2637 {{echo|1= {{echo|b}} }}
2638
2639 {{echo| 1 =
2640 c }}
2641
2642 {{echo| 1 =
2643 * d
2644 }}
2645 !! html
2646 <p>a
2647 </p><p>b
2648 </p><p>c
2649 </p>
2650 <ul><li> d</li></ul>
2651
2652 !! end
2653
2654 !! test
2655 Templates: Don't strip whitespace from positional-param values
2656 !! wikitext
2657 {{echo|a }}
2658
2659 {{echo|{{echo|b}} }}
2660
2661 {{echo| c
2662 }}
2663
2664 {{echo| {{echo|d}}
2665 }}
2666
2667 {{echo|
2668 e}}
2669
2670 {{echo|
2671 * f}}
2672
2673 {{echo|
2674 }}g
2675 !! html
2676 <p>a
2677 </p><p>b
2678 </p>
2679 <pre>c
2680 </pre>
2681 <p><br />
2682 </p>
2683 <pre>d
2684 </pre>
2685 <p><br />
2686 </p>
2687 <pre>e
2688 </pre>
2689 <p><br />
2690 </p>
2691 <ul><li> f</li></ul>
2692 <p><br />
2693 </p>
2694 <pre>g
2695 </pre>
2696 !! end
2697
2698 !! test
2699 Templates: Handle empty comment-and-ws-only lines correctly
2700 !! wikitext
2701 {{echo|foo
2702 <!--should be ignored-->
2703 <!--should be ignored as well-->
2704 bar}}
2705 !! html
2706 <p>foo
2707 bar
2708 </p>
2709 !! end
2710
2711 !! test
2712 Templates: Handle comments in the target
2713 !! wikitext
2714 {{echo
2715 <!-- should be ignored -->
2716 |foo}}
2717
2718 {{echo<!-- should be ignored -->
2719 |foo}}
2720
2721 {{echo<!-- should be ignored -->|foo}}
2722
2723 {{<!-- should be ignored -->echo|foo}}
2724 !!html/parsoid
2725 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2726
2727 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2728
2729 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2730
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2732 !!end
2733
2734 !! test
2735 Templates: Handle comments in parameter names (bug 67657)
2736 !! wikitext
2737 {{echo|1
2738 <!-- should be ignored -->
2739 =foo}}
2740
2741 {{echo|
2742 <!-- should be ignored -->
2743 1 = foo}}
2744
2745 {{echo|1<!-- should be ignored -->=foo}}
2746
2747 {{echo|<!-- should be ignored -->1=foo}}
2748 !!html/parsoid
2749 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2750
2751 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2752
2753 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2754
2755 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2756 !!end
2757
2758 !! test
2759 Templates: Other wikitext in parameter names (bug 67657)
2760 !! wikitext
2761 {{echo|''1''=foo}}
2762 !!html/parsoid
2763 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2764 !!html/php
2765 <p>{{{1}}}
2766 </p>
2767 !!end
2768
2769 #--------------------------------------------------------------------
2770 # Transclusion parameter escaping tests
2771 #--------------------------------------------------------------------
2772 !! test
2773 Templates: Parsoid parameter escaping test 1
2774 !! wikitext
2775 {{echo|[foo]|{{echo|[bar]}}}}
2776 !! html/php+tidy
2777 <p>[foo]</p>
2778 !! html/parsoid
2779 <p about="#mwt1" typeof="mw:Transclusion"
2780 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2781 !! end
2782
2783 !! test
2784 Parsoid: Pipes in external links in template parameter
2785 !! wikitext
2786 {{echo|[{{echo|http://example.com}} link]}}
2787 !! html/php+tidy
2788 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2789 !! html/parsoid
2790 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2791 !! end
2792
2793 !! test
2794 Parsoid: pipe in transclusion parameter
2795 !! wikitext
2796 {{echo|http://foo.com/a&#124;b}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2803 !! end
2804
2805 !! test
2806 Parsoid: Pipe in external link target and content in template parameter
2807 !! options
2808 parsoid=html2wt,wt2wt
2809 !! wikitext
2810 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2811 !! html/php+tidy
2812 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2813 !! html/parsoid
2814 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2815 typeof="mw:Transclusion"
2816 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2817 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2818 !! end
2819
2820 !! test
2821 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2822 !! options
2823 parsoid
2824 !! wikitext
2825 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2826 !! html
2827 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main_Page bar]</p>
2828 !! end
2829
2830 !! test
2831 Templates: Don't escape already nowiki-escaped text in template parameters
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|foo<nowiki>|</nowiki>bar}}
2836 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2837 {{echo|<nowiki></nowiki>}}
2838 !! html/php+tidy
2839 <p>foo|bar &lt;div&gt;</p>
2840 !! html/parsoid
2841 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2842 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2843 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2844 </p>
2845 !! end
2846
2847 ## Bug 52824
2848 !! test
2849 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2850 !! options
2851 parsoid=html2wt,wt2wt
2852 !! wikitext
2853 {{echo|{{echo|1=bar}}}}
2854 !! html/php+tidy
2855 <p>bar</p>
2856 !! html/parsoid
2857 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2858 !! end
2859
2860 ## Bug 56733
2861 !! test
2862 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2863 !! wikitext
2864 {{echo|a : b}}
2865 !! html/php+tidy
2866 <p>a&#160;: b</p>
2867 !! html/parsoid
2868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2869 !! end
2870
2871 ## Bug T73412
2872 !! test
2873 Templates: Preserve blank parameter names
2874 !! wikitext
2875 {{echo|=foo}}
2876 !! html/php+tidy
2877 <p>{{{1}}}</p>
2878 !! html/parsoid
2879 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2880 !! end
2881
2882 !! test
2883 Templates: Preserve blank parameter names in other positions
2884 !! wikitext
2885 {{blank_param|bar|=foo}}
2886 !! html/php+tidy
2887 <p>bar foo</p>
2888 !! html/parsoid
2889 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2890 foo</p>
2891 !! end
2892
2893 ###
2894 ### Parsoid-centric tests for testing RT edge cases for pre
2895 ###
2896
2897 !!test
2898 1a. Indent-Pre and Comments
2899 !! wikitext
2900 a
2901 <!--a-->
2902 c
2903 !! html
2904 <pre>a
2905 </pre>
2906 <p>c
2907 </p>
2908 !!end
2909
2910 !!test
2911 1b. Indent-Pre and Comments
2912 !! wikitext
2913 a
2914 <!--a-->
2915 c
2916 !! html
2917 <pre>a
2918 </pre>
2919 <p>c
2920 </p>
2921 !!end
2922
2923 !!test
2924 1c. Indent-Pre and Comments
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--a--> a
2929 !! html
2930 <pre> a
2931 </pre>
2932 <pre> a
2933 </pre>
2934 !!end
2935
2936 !!test
2937 1d. Indent-Pre and Comments
2938 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2939 !! wikitext
2940 <!--a--> a
2941
2942 <!--b-->b
2943 !! html
2944 <pre>a
2945 </pre>
2946 <pre>b
2947 </pre>
2948 !!end
2949
2950 !!test
2951 2a. Indent-Pre and tables
2952 !! wikitext
2953 {|
2954 |-
2955 !h1!!h2
2956 |foo||bar
2957 |}
2958 !! html
2959 <table>
2960
2961 <tr>
2962 <th>h1</th>
2963 <th>h2
2964 </th>
2965 <td>foo</td>
2966 <td>bar
2967 </td></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2b. Indent-Pre and tables
2973 !! wikitext
2974 {|
2975 |-
2976 |foo
2977 |}
2978 !! html
2979 <table>
2980
2981 <tr>
2982 <td>foo
2983 </td></tr></table>
2984
2985 !!end
2986
2987 !!test
2988 2c. Indent-Pre and tables (bug 42252)
2989 !! wikitext
2990 {|
2991 |+ foo
2992 ! | bar
2993 |}
2994 !! html
2995 <table>
2996 <caption> foo
2997 </caption>
2998 <tr>
2999 <th> bar
3000 </th></tr></table>
3001
3002 !!end
3003
3004 !!test
3005 2d. Indent-Pre and tables
3006 !! wikitext
3007 a
3008 {|
3009 | b
3010 |}
3011 !! html/php
3012 <pre>a
3013 </pre>
3014 <table>
3015 <tr>
3016 <td> b
3017 </td></tr></table>
3018
3019 !! html/parsoid
3020 <pre>a</pre>
3021 <table>
3022 <tbody><tr><td> b</td></tr>
3023 </tbody></table>
3024 !!end
3025
3026 !!test
3027 2e. Indent-Pre and table-line syntax
3028 !! wikitext
3029 a
3030 | b
3031 | c
3032 !! html/php
3033 <pre>a
3034 | b
3035 | c
3036 </pre>
3037 !!end
3038
3039 !!test
3040 2f. Indent-pre started by table-line syntax
3041 !! wikitext
3042 a
3043 | b
3044 | c
3045 !! html/php
3046 <p>a
3047 </p>
3048 <pre>| b
3049 | c
3050 </pre>
3051 !! html/parsoid
3052 <p>a</p>
3053 <pre>
3054 | b
3055 | c</pre>
3056 !!end
3057
3058 !!test
3059 3a. Indent-Pre and block tags (single-line html)
3060 !! wikitext
3061 a <p> foo </p>
3062 b <div> foo </div>
3063 c <blockquote> foo </blockquote>
3064 <span> foo </span>
3065 !! html
3066 a <p> foo </p>
3067 b <div> foo </div>
3068 c <blockquote> foo </blockquote>
3069 <pre><span> foo </span>
3070 </pre>
3071 !! html/parsoid
3072 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3073 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3074 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3075 <pre><span> foo </span>
3076 </pre>
3077 !! html+tidy
3078 <p>a</p>
3079 <p>foo</p>
3080 <p>b</p>
3081 <div>foo</div>
3082 <p>c</p>
3083 <blockquote>
3084 <p>foo</p>
3085 </blockquote>
3086 <pre>
3087 <span> foo </span>
3088 </pre>
3089 !! end
3090
3091 !!test
3092 3b. Indent-Pre and block tags (multi-line html)
3093 !! wikitext
3094 a <span>foo</span>
3095 b <div> foo </div>
3096 !! html
3097 <pre>a <span>foo</span>
3098 </pre>
3099 b <div> foo </div>
3100
3101 !! html/parsoid
3102 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3103 b <div data-parsoid='{"stx":"html"}'> foo </div>
3104 !! html+tidy
3105 <pre>
3106 a <span>foo</span>
3107 </pre>
3108 <p>b</p>
3109 <div>foo</div>
3110 !!end
3111
3112 !!test
3113 3c. Indent-Pre and block tags (pre-content on separate line)
3114 !! wikitext
3115 <p>
3116 foo
3117 </p>
3118
3119 <div>
3120 foo
3121 </div>
3122
3123 <center>
3124 foo
3125 </center>
3126
3127 <blockquote>
3128 foo
3129 </blockquote>
3130
3131 <blockquote>
3132 <pre>
3133 foo
3134 </pre>
3135 </blockquote>
3136
3137 <table><tr><td>
3138 foo
3139 </td></tr></table>
3140
3141 <ul><li>
3142 foo
3143 </li></ul>
3144
3145 !! html
3146 <p>
3147 foo
3148 </p>
3149 <div>
3150 <pre>foo
3151 </pre>
3152 </div>
3153 <center>
3154 <pre>foo
3155 </pre>
3156 </center>
3157 <blockquote>
3158 <p> foo
3159 </p>
3160 </blockquote>
3161 <blockquote>
3162 <pre>
3163 foo
3164 </pre>
3165 </blockquote>
3166 <table><tr><td>
3167 <pre>foo
3168 </pre>
3169 </td></tr></table>
3170 <ul><li>
3171 foo
3172 </li></ul>
3173
3174 !!end
3175
3176 !!test
3177 4. Indent-Pre and extension tags
3178 !! wikitext
3179 a <gallery>
3180 File:foobar.jpg
3181 </gallery>
3182 !! html
3183 a <ul class="gallery mw-gallery-traditional">
3184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3185 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3186 <div class="gallerytext">
3187 </div>
3188 </div></li>
3189 </ul>
3190
3191 !! html+tidy
3192 <p>a</p>
3193 <ul class="gallery mw-gallery-traditional">
3194 <li class="gallerybox" style="width: 155px">
3195 <div style="width: 155px">
3196 <div class="thumb" style="width: 150px;">
3197 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3198 </div>
3199 <div class="gallerytext"></div>
3200 </div>
3201 </li>
3202 </ul>
3203 !!end
3204
3205 !! test
3206 Table wikitext syntax outside wiki-tables
3207 !! wikitext
3208 a
3209 ! not a table heading
3210 |- not a table row
3211 | not a table cell
3212 | class="foo bar" | baz
3213 b
3214 |}
3215 |-
3216 c
3217 !! html
3218 <p>a
3219 ! not a table heading
3220 |- not a table row
3221 | not a table cell
3222 | class="foo bar" | baz
3223 b
3224 |}
3225 |-
3226 c
3227 </p>
3228 !! end
3229
3230 !!test
3231 Render paragraphs when indent-pre is suppressed in blocklevels
3232 !! wikitext
3233 <blockquote>
3234 foo
3235
3236 bar
3237 </blockquote>
3238 !! html
3239 <blockquote>
3240 <p> foo
3241 </p><p> bar
3242 </p>
3243 </blockquote>
3244
3245 !!end
3246
3247 !!test
3248 4. Multiple spaces at start-of-line
3249 !! wikitext
3250 <p> foo </p>
3251 foo
3252 {|
3253 |foo
3254 |}
3255 !! html
3256 <p> foo </p>
3257 <pre> foo
3258 </pre>
3259 <table>
3260 <tr>
3261 <td>foo
3262 </td></tr></table>
3263
3264 !!end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5a. White-space in indent-pre
3269 !! wikitext
3270 a<br />
3271
3272 b
3273 !! html
3274 <pre>a<br />
3275
3276 b
3277 </pre>
3278 !! end
3279
3280 ## NOTE: the leading white-space chars on empty line are significant
3281 !! test
3282 5b. White-space in indent-pre
3283 !! wikitext
3284 a
3285
3286 b
3287
3288
3289 c
3290 !! html
3291 <pre>a
3292
3293 b
3294
3295
3296 c
3297 </pre>
3298 !! end
3299
3300 !! test
3301 5c. White-space in indent-pre
3302 !! wikitext
3303 ''a''
3304 ''b''
3305 ''c''
3306 !! html
3307 <pre><i>a</i>
3308 <i>b</i>
3309 <i>c</i>
3310 </pre>
3311 !! end
3312
3313 !! test
3314 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3315 !! wikitext
3316 a
3317
3318 <!-- continue -->
3319 b
3320
3321 c
3322
3323 d
3324 !! html
3325 <pre>a
3326
3327 b
3328 </pre>
3329 <pre>c
3330
3331 </pre>
3332 <p>d
3333 </p>
3334 !! end
3335
3336 !! test
3337 7a. Indent-pre and category links
3338 !! options
3339 parsoid=wt2html,wt2wt
3340 !! wikitext
3341 [[Category:foo]] <!-- No pre-wrapping -->
3342 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3343 !! html/php+tidy
3344 !! html/parsoid
3345 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3346 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3347 !! end
3348
3349 ## We used to, but no longer wt2wt this test since the default serializer
3350 ## will normalize all categories to serialize on their own line.
3351 ## This wikitext usage is going to be fairly uncommon in production and
3352 ## selser will take care of preserving formatting in those scenarios.
3353 !! test
3354 7b. Indent-pre and category links
3355 !! options
3356 parsoid=wt2html
3357 !! wikitext
3358 [[Category:foo]] a
3359 [[Category:foo]] {{echo|b}}
3360 !! html/parsoid
3361 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3362 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3363 !! end
3364
3365 !! test
3366 Indent-Pre: Newlines in comments shouldn't affect sol state
3367 !! wikitext
3368 a <!--
3369 foo
3370 --> b
3371 !! html/php+tidy
3372 <p>a b</p>
3373 !! html/parsoid
3374 <p>a <!--
3375 foo
3376 --> b</p>
3377 !! end
3378
3379 ###
3380 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3381 ###
3382
3383 !!test
3384 HTML-pre: 1. embedded newlines
3385 !! wikitext
3386 <pre>foo</pre>
3387
3388 <pre>
3389 foo
3390 </pre>
3391
3392 <pre>
3393
3394 foo
3395 </pre>
3396
3397 <pre>
3398
3399
3400 foo
3401 </pre>
3402 !! html/php+tidy
3403 <pre>
3404 foo
3405 </pre>
3406 <pre>
3407 foo
3408 </pre>
3409 <pre>
3410
3411 foo
3412 </pre>
3413 <pre>
3414
3415
3416 foo
3417 </pre>
3418 !! html/parsoid
3419 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3420
3421 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3422 foo
3423 </pre>
3424
3425 <pre data-parsoid='{"stx":"html"}'>
3426
3427 foo
3428 </pre>
3429
3430 <pre data-parsoid='{"stx":"html"}'>
3431
3432
3433 foo
3434 </pre>
3435 !!end
3436
3437 !! test
3438 HTML-pre: big spaces
3439 !! wikitext
3440 <pre>
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 haha
3451
3452
3453
3454
3455 </pre>
3456 !! html/php+tidy
3457 <pre>
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 haha
3468
3469
3470
3471
3472 </pre>
3473 !! html/parsoid
3474 <pre data-parsoid='{"stx":"html"}'>
3475
3476
3477
3478
3479 haha
3480
3481
3482
3483
3484 haha
3485
3486
3487
3488
3489 </pre>
3490 !! end
3491
3492 !!test
3493 HTML-pre: 2: indented text
3494 !! wikitext
3495 <pre>
3496 foo
3497 </pre>
3498 !! html
3499 <pre>
3500 foo
3501 </pre>
3502
3503 !!end
3504
3505 !!test
3506 HTML-pre: 3: other wikitext
3507 !! wikitext
3508 <pre>
3509 * foo
3510 # bar
3511 = no-h =
3512 '' no-italic ''
3513 [[ NoLink ]]
3514 </pre>
3515 !! html/php
3516 <pre>
3517 * foo
3518 # bar
3519 = no-h =
3520 '' no-italic ''
3521 [[ NoLink ]]
3522 </pre>
3523
3524 !! html/parsoid
3525 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3526 # bar
3527 = no-h =
3528 '' no-italic ''
3529 [[ NoLink ]]
3530 </pre>
3531 !!end
3532
3533 ###
3534 ### Definition lists
3535 ###
3536 !! test
3537 Simple definition
3538 !! wikitext
3539 ; name : Definition
3540 !! html
3541 <dl><dt> name&#160;</dt>
3542 <dd> Definition</dd></dl>
3543
3544 !! end
3545
3546 !! test
3547 Definition list for indentation only
3548 !! wikitext
3549 : Indented text
3550 !! html
3551 <dl><dd> Indented text</dd></dl>
3552
3553 !! end
3554
3555 !! test
3556 Definition list with no space
3557 !! wikitext
3558 ;name:Definition
3559 !! html
3560 <dl><dt>name</dt>
3561 <dd>Definition</dd></dl>
3562
3563 !!end
3564
3565 !! test
3566 Definition list with URL link
3567 !! wikitext
3568 ; http://example.com/ : definition
3569 !! html
3570 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3571 <dd> definition</dd></dl>
3572
3573 !! end
3574
3575 !! test
3576 Definition list with bracketed URL link
3577 !! wikitext
3578 ;[http://www.example.com/ Example]:Something about it
3579 !! html
3580 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3581 <dd>Something about it</dd></dl>
3582
3583 !! end
3584
3585 !! test
3586 Definition list with wikilink containing colon
3587 !! wikitext
3588 ; [[Help:FAQ]]: The least-read page on Wikipedia
3589 !! html
3590 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3591 <dd> The least-read page on Wikipedia</dd></dl>
3592
3593 !! end
3594
3595 # At Brion's and JeLuF's insistence... :)
3596 !! test
3597 Definition list with news link containing colon
3598 !! wikitext
3599 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3600 !! html/php
3601 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3602 <dd> This isn't even a real newsgroup!</dd></dl>
3603
3604 !! html/parsoid
3605 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3606 !! end
3607
3608 !! test
3609 Malformed definition list with colon
3610 !! wikitext
3611 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3612 !! html
3613 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3614
3615 !! end
3616
3617 !! test
3618 Definition lists: colon in external link text
3619 !! wikitext
3620 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3621 !! html
3622 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3623 <dd> OK, I made that up</dd></dl>
3624
3625 !! end
3626
3627 !! test
3628 Definition lists: colon in HTML attribute
3629 !! wikitext
3630 ;<b style="display: inline">bold</b>
3631 !! html
3632 <dl><dt><b style="display: inline">bold</b></dt></dl>
3633
3634 !! end
3635
3636 !! test
3637 Definition lists: self-closed tag
3638 !! wikitext
3639 ;one<br/>two : two-line fun
3640 !! html
3641 <dl><dt>one<br />two&#160;</dt>
3642 <dd> two-line fun</dd></dl>
3643
3644 !! end
3645
3646 !! test
3647 Bug 11748: Literal closing tags
3648 !! wikitext
3649 <dl>
3650 <dt>test 1</dt>
3651 <dd>test test test test test</dd>
3652 <dt>test 2</dt>
3653 <dd>test test test test test</dd>
3654 </dl>
3655 !! html
3656 <dl>
3657 <dt>test 1</dt>
3658 <dd>test test test test test</dd>
3659 <dt>test 2</dt>
3660 <dd>test test test test test</dd>
3661 </dl>
3662
3663 !! end
3664
3665 !! test
3666 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3667 !! wikitext
3668 <ul><li>
3669 ; term : description
3670 * unordered
3671 </li></ul>
3672 !! html
3673 <ul><li>
3674 <dl><dt> term&#160;</dt>
3675 <dd> description</dd></dl>
3676 <ul><li> unordered</li></ul>
3677 </li></ul>
3678
3679 !! end
3680
3681 !! test
3682
3683 Definition list with empty definition and following paragraph
3684 !! wikitext
3685 ; term:
3686 Paragraph text
3687 !! html
3688 <dl><dt> term</dt>
3689 <dd></dd></dl>
3690 <p>Paragraph text
3691 </p>
3692 !! end
3693
3694 !! test
3695 Nested definition lists using html syntax
3696 !! wikitext
3697 <dl><dt>x</dt>
3698 <dd>a</dd>
3699 <dd>b</dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: No nesting: Multiple dd's
3705 !! wikitext
3706 ;x
3707 :a
3708 :b
3709 !! html
3710 <dl><dt>x</dt>
3711 <dd>a</dd>
3712 <dd>b</dd></dl>
3713
3714 !! end
3715
3716 !! test
3717 Definition Lists: Indentation: Regular
3718 !! wikitext
3719 :i1
3720 ::i2
3721 :::i3
3722 !! html
3723 <dl><dd>i1
3724 <dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Missing 1st level
3731 !! wikitext
3732 ::i2
3733 :::i3
3734 !! html
3735 <dl><dd><dl><dd>i2
3736 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3737
3738 !! end
3739
3740 !! test
3741 Definition Lists: Indentation: Multi-level indent
3742 !! wikitext
3743 :::i3
3744 !! html
3745 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3746
3747 !! end
3748
3749 !! test
3750 Definition Lists: Hacky use to indent tables
3751 !! wikitext
3752 ::{|
3753 |foo
3754 |bar
3755 |}
3756 this text
3757 should be left alone
3758 !! html
3759 <dl><dd><dl><dd><table>
3760 <tr>
3761 <td>foo
3762 </td>
3763 <td>bar
3764 </td></tr></table></dd></dl></dd></dl>
3765 <p>this text
3766 should be left alone
3767 </p>
3768 !! end
3769
3770 !! test
3771 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3772 !! wikitext
3773 <!-- foo -->
3774 ::{|
3775 |foo
3776 |bar
3777 |}<!-- bar -->
3778 this text
3779 should be left alone
3780 !! html/parsoid
3781 <!-- foo -->
3782 <dl><dd><dl><dd><table><tr>
3783 <td>foo</td>
3784 <td>bar</td>
3785 </tr></table><!-- bar --></dd></dl></dd></dl>
3786 <p>this text
3787 should be left alone</p>
3788 !! end
3789
3790 !! test
3791 Definition Lists: Hacky use to indent tables, with comment before table
3792 !! wikitext
3793 ::<!-- foo -->{|
3794 |foo
3795 |}
3796 !! html/parsoid
3797 <dl><dd><dl><dd><!-- foo --><table><tr>
3798 <td>foo</td>
3799 </tr></table></dd></dl></dd></dl>
3800 !! end
3801
3802 # The trailing whitespace in this test is to catch a regression in
3803 # Parsoid after T54473.
3804 !! test
3805 Definition Lists: Hacky use to indent tables (WS-insensitive)
3806 !! wikitext
3807 : {|
3808 |a
3809 |}
3810 !! html/php
3811 <dl><dd><table>
3812 <tr>
3813 <td>a
3814 </td></tr></table></dd></dl>
3815
3816 !! html/parsoid
3817 <dl><dd> <table>
3818 <tbody><tr><td>a</td></tr>
3819 </tbody></table> </dd></dl>
3820 !! end
3821
3822 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3823 ## as an empty dt item. It also ignores all but the last ";" when followed
3824 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3825 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3826 ## ";"s.
3827 ##
3828 ## Ex: ";;t2 ::d2" is transformed into:
3829 ##
3830 ## <dl>
3831 ## <dt>t2 </dt>
3832 ## <dd>
3833 ## <dl>
3834 ## <dt></dt>
3835 ## <dd>d2</dd>
3836 ## </dl>
3837 ## </dd>
3838 ## </dl>
3839 ##
3840 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3841 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3842 ##
3843 ## <dl>
3844 ## <dt>
3845 ## <dl>
3846 ## <dt>t2 </dt>
3847 ## <dd>:d2</dd>
3848 ## </dl>
3849 ## </dt>
3850 ## </dl>
3851 ##
3852 ## All Parsoid only definition list tests have this difference.
3853 ##
3854 ## See also: https://phabricator.wikimedia.org/T8569
3855 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3856
3857 !! test
3858 Table / list interaction: indented table with lists in table contents
3859 !! wikitext
3860 :{|
3861 |-
3862 | a
3863 * b
3864 |-
3865 | c
3866 * d
3867 |}
3868 !! html
3869 <dl><dd><table>
3870
3871 <tr>
3872 <td> a
3873 <ul><li> b</li></ul>
3874 </td></tr>
3875 <tr>
3876 <td> c
3877 <ul><li> d</li></ul>
3878 </td></tr></table></dd></dl>
3879
3880 !! end
3881
3882 !!test
3883 Table / list interaction: lists nested in tables nested in indented lists
3884 !! wikitext
3885 :{|
3886 |
3887 :a
3888 :b
3889 |
3890 *c
3891 *d
3892 |}
3893
3894 *e
3895 *f
3896 !! html
3897 <dl><dd><table>
3898 <tr>
3899 <td>
3900 <dl><dd>a</dd>
3901 <dd>b</dd></dl>
3902 </td>
3903 <td>
3904 <ul><li>c</li>
3905 <li>d</li></ul>
3906 </td></tr></table></dd></dl>
3907 <ul><li>e</li>
3908 <li>f</li></ul>
3909
3910 !!end
3911
3912 !! test
3913 Definition Lists: Nesting: Multi-level (Parsoid only)
3914 !! options
3915 parsoid
3916 !! wikitext
3917 ;t1 :d1
3918 ;;t2 ::d2
3919 ;;;t3 :::d3
3920 !! html
3921 <dl>
3922 <dt>t1 </dt>
3923 <dd>d1</dd>
3924 <dt>
3925 <dl>
3926 <dt>t2 </dt>
3927 <dd>:d2</dd>
3928 <dt>
3929 <dl>
3930 <dt>t3 </dt>
3931 <dd>::d3</dd>
3932 </dl>
3933 </dt>
3934 </dl>
3935 </dt>
3936 </dl>
3937
3938
3939 !! end
3940
3941
3942 !! test
3943 Definition Lists: Nesting: Test 2 (Parsoid only)
3944 !! wikitext
3945 ;t1
3946 ::d2
3947 !! html/php+tidy
3948 <dl>
3949 <dt>t1</dt>
3950 <dd>
3951 <dl>
3952 <dd>d2</dd>
3953 </dl>
3954 </dd>
3955 </dl>
3956 !! html/parsoid
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965
3966 !! end
3967
3968
3969 !! test
3970 Definition Lists: Nesting: Test 3 (Parsoid only)
3971 !! wikitext
3972 :;t1
3973 ::::d2
3974 !! html/php+tidy
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dt>t1</dt>
3979 <dd>
3980 <dl>
3981 <dd>
3982 <dl>
3983 <dd>d2</dd>
3984 </dl>
3985 </dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 </dd>
3990 </dl>
3991 !! html/parsoid
3992 <dl>
3993 <dd>
3994 <dl>
3995 <dt>t1</dt>
3996 <dd>
3997 <dl>
3998 <dd>
3999 <dl>
4000 <dd>d2</dd>
4001 </dl>
4002 </dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 </dd>
4007 </dl>
4008
4009 !! end
4010
4011
4012 !! test
4013 Definition Lists: Nesting: Test 4
4014 !! wikitext
4015 ::;t3
4016 :::d3
4017 !! html
4018 <dl><dd><dl><dd><dl><dt>t3</dt>
4019 <dd>d3</dd></dl></dd></dl></dd></dl>
4020
4021 !! end
4022
4023
4024 ## The Parsoid team believes the following three test exposes a
4025 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4026 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4027 ## It also exposes a "misfeature" in tidy, which doesn't like
4028 ## <dl> tags with a single <dt> child; it converts the <dt> into
4029 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4030 !! test
4031 Definition Lists: Mixed Lists: Test 1
4032 !! wikitext
4033 :;* foo
4034 ::* bar
4035 :; baz
4036 !! html/php
4037 <dl><dd><dl><dt><ul><li> foo</li>
4038 <li> bar</li></ul></dt></dl>
4039 <dl><dt> baz</dt></dl></dd></dl>
4040
4041 !! html/php+tidy
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dd>
4046 <ul>
4047 <li>foo</li>
4048 <li>bar</li>
4049 </ul>
4050 </dd>
4051 </dl>
4052 <dl>
4053 <dt>baz</dt>
4054 </dl>
4055 </dd>
4056 </dl>
4057 !! html/parsoid
4058 <dl>
4059 <dd><dl>
4060 <dt><ul>
4061 <li> foo
4062 </li>
4063 </ul></dt>
4064 <dd><ul>
4065 <li> bar
4066 </li>
4067 </ul></dd>
4068 <dt> baz</dt>
4069 </dl></dd>
4070 </dl>
4071 !! end
4072
4073 !! test
4074 Definition Lists: Mixed Lists: Test 2
4075 !! wikitext
4076 *: d1
4077 *: d2
4078 !! html
4079 <ul><li><dl><dd> d1</dd>
4080 <dd> d2</dd></dl></li></ul>
4081
4082 !! end
4083
4084
4085 !! test
4086 Definition Lists: Mixed Lists: Test 3
4087 !! wikitext
4088 *::: d1
4089 *::: d2
4090 !! html
4091 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4092 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 4
4099 !! wikitext
4100 *;d1 :d2
4101 *;d3 :d4
4102 !! html
4103 <ul><li><dl><dt>d1&#160;</dt>
4104 <dd>d2</dd>
4105 <dt>d3&#160;</dt>
4106 <dd>d4</dd></dl></li></ul>
4107
4108 !! end
4109
4110
4111 !! test
4112 Definition Lists: Mixed Lists: Test 5
4113 !! wikitext
4114 *:d1
4115 *:: d2
4116 !! html
4117 <ul><li><dl><dd>d1
4118 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4119
4120 !! end
4121
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 6
4125 !! wikitext
4126 #*:d1
4127 #*::: d3
4128 !! html
4129 <ol><li><ul><li><dl><dd>d1
4130 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 7
4137 !! wikitext
4138 :* d1
4139 :* d2
4140 !! html
4141 <dl><dd><ul><li> d1</li>
4142 <li> d2</li></ul></dd></dl>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 8
4149 !! wikitext
4150 :* d1
4151 ::* d2
4152 !! html
4153 <dl><dd><ul><li> d1</li></ul>
4154 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 9
4161 !! wikitext
4162 *;foo :bar
4163 !! html
4164 <ul><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ul>
4166
4167 !! end
4168
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 10
4172 !! wikitext
4173 *#;foo :bar
4174 !! html
4175 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4176 <dd>bar</dd></dl></li></ol></li></ul>
4177
4178 !! end
4179
4180 # The Parsoid team disagrees with the PHP parser's seemingly-random
4181 # rules regarding dd/dt on the next two tests. Parsoid is more
4182 # consistent, and recognizes the shared nesting and keeps the
4183 # still-open tags around until the nesting is complete.
4184 # (And tidy again converts <dt> to <dd> before 'bar'.)
4185
4186 !! test
4187 Definition Lists: Mixed Lists: Test 11
4188 !! wikitext
4189 *#*#;*;;foo :bar
4190 *#*#;boo :baz
4191 !! html/php
4192 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4193 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4194 <dl><dt>boo&#160;</dt>
4195 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4196
4197 !! html/php+tidy
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>foo&#160;</dt>
4208 <dd>
4209 <ul>
4210 <li>
4211 <dl>
4212 <dd>
4213 <dl>
4214 <dt>bar</dt>
4215 </dl>
4216 </dd>
4217 </dl>
4218 </li>
4219 </ul>
4220 </dd>
4221 </dl>
4222 <dl>
4223 <dt>boo&#160;</dt>
4224 <dd>baz</dd>
4225 </dl>
4226 </li>
4227 </ol>
4228 </li>
4229 </ul>
4230 </li>
4231 </ol>
4232 </li>
4233 </ul>
4234 !! html/parsoid
4235 <ul>
4236 <li>
4237 <ol>
4238 <li>
4239 <ul>
4240 <li>
4241 <ol>
4242 <li>
4243 <dl>
4244 <dt>
4245 <ul>
4246 <li>
4247 <dl>
4248 <dt>
4249 <dl>
4250 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4251 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4252 </dl></dt>
4253 </dl></li>
4254 </ul></dt>
4255 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4256 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4257 </dl></li>
4258 </ol></li>
4259 </ul></li>
4260 </ol></li>
4261 </ul>
4262 !! end
4263
4264
4265 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4266 # From whitelist:
4267 # * The test is wrong, there are two colons where there should be :;
4268 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4269 !! test
4270 Definition Lists: Weird Ones: Test 1
4271 !! wikitext
4272 *#;*::;; foo : bar (who uses this?)
4273 !! html/php
4274 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4275 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4276
4277 !! html/php+tidy
4278 <ul>
4279 <li>
4280 <ol>
4281 <li>
4282 <dl>
4283 <dt>foo&#160;</dt>
4284 <dd>
4285 <ul>
4286 <li>
4287 <dl>
4288 <dd>
4289 <dl>
4290 <dd>
4291 <dl>
4292 <dd>
4293 <dl>
4294 <dt>bar (who uses this?)</dt>
4295 </dl>
4296 </dd>
4297 </dl>
4298 </dd>
4299 </dl>
4300 </dd>
4301 </dl>
4302 </li>
4303 </ul>
4304 </dd>
4305 </dl>
4306 </li>
4307 </ol>
4308 </li>
4309 </ul>
4310 !! html/parsoid
4311 <ul>
4312 <li>
4313 <ol>
4314 <li>
4315 <dl>
4316 <dt>
4317 <ul>
4318 <li>
4319 <dl>
4320 <dd>
4321 <dl>
4322 <dd>
4323 <dl>
4324 <dt>
4325 <dl>
4326 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4327 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4328 </dl></dt>
4329 </dl></dd>
4330 </dl></dd>
4331 </dl></li>
4332 </ul></dt>
4333 </dl></li>
4334 </ol></li>
4335 </ul>
4336 !! end
4337
4338 !! test
4339 Definition Lists: colons occurring in tags
4340 !! wikitext
4341 ;a:b
4342 ;'''a:b'''
4343 ;<i>a:b</i>
4344 ;<span>a:b</span>
4345 ;<div>a:b</div>
4346 ;<div>a
4347 :b</div>
4348 ;{{echo|a:b}}
4349 ;{{echo|''a:b''}}
4350 ;;;''a:b''
4351 !! html+tidy
4352 <dl>
4353 <dt>a</dt>
4354 <dd>b</dd>
4355 <dt><b>a:b</b></dt>
4356 <dt><i>a:b</i></dt>
4357 <dt><span>a:b</span></dt>
4358 <dd>
4359 <div>a:b</div>
4360 </dd>
4361 <dd>
4362 <div>a
4363 <dl>
4364 <dd>b</dd>
4365 </dl>
4366 </div>
4367 </dd>
4368 <dt>a</dt>
4369 <dd>b</dd>
4370 <dt><i>a:b</i></dt>
4371 </dl>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dd>
4376 <dl>
4377 <dt><i>a:b</i></dt>
4378 </dl>
4379 </dd>
4380 </dl>
4381 </dd>
4382 </dl>
4383 !! html/parsoid
4384 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4385 <dt><b>a:b</b></dt>
4386 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4387 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4388 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4389 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4390 <dd>b</dd>
4391 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4392 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4393 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4394 !! end
4395
4396 !! test
4397 Definition Lists: colons and tables 1
4398 !! wikitext
4399 :{|
4400 | x
4401 |}
4402 :{|
4403 | y
4404 |}
4405 !! html
4406 <dl><dd><table>
4407 <tr>
4408 <td> x
4409 </td></tr></table></dd></dl>
4410 <dl><dd><table>
4411 <tr>
4412 <td> y
4413 </td></tr></table></dd></dl>
4414
4415 !! end
4416
4417 # Parsoid's output (as documented below) differs from php's in this case.
4418 # This is probably a bug. If we fixup parsoid to match php's output, the
4419 # above test should pass and the below test case can be removed. It is
4420 # unclear which output is more desirable.
4421
4422 !! test
4423 Definition Lists: colons and tables 2
4424 !! wikitext
4425 :{|
4426 | x
4427 |}
4428 :{|
4429 | y
4430 |}
4431 !! html/parsoid
4432 <dl><dd><table>
4433 <tr>
4434 <td> x
4435 </td></tr></table></dd>
4436 <dd><table>
4437 <tr>
4438 <td> y
4439 </td></tr></table></dd></dl>
4440 !! end
4441
4442 !! test
4443 Definition Lists: template interaction
4444 !! wikitext
4445 ::{{definition_list}}
4446
4447 :one
4448 ::{{definition_list}}
4449 :::two
4450 :::three
4451 ::four
4452 !! html/parsoid
4453 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4454 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4455
4456 <dl><dd data-parsoid='{}'>one
4457 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4458 </span><dd about="#mwt2">two
4459 <dl><dd>two</dd>
4460 <dd>three</dd></dl></dd>
4461 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4462 !! end
4463
4464
4465 ###
4466 ### External links
4467 ###
4468 !! test
4469 External links: non-bracketed
4470 !! wikitext
4471 Non-bracketed: http://example.com
4472 !! html
4473 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4474 </p>
4475 !! end
4476
4477 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4478 !! test
4479 External links: numbered
4480 !! wikitext
4481 Numbered: [http://example.com]
4482 Numbered: [http://example.net]
4483 Numbered: [http://example.com]
4484 !! html/php
4485 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4486 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4487 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4488 </p>
4489 !! html/parsoid
4490 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4491 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4492 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4493 !!end
4494
4495 !! test
4496 External links: specified text
4497 !! wikitext
4498 Specified text: [http://example.com link]
4499 !! html
4500 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4501 </p>
4502 !!end
4503
4504 !! test
4505 External links: trail
4506 !! wikitext
4507 Linktrails should not work for external links: [http://example.com link]s
4508 !! html
4509 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4510 </p>
4511 !! end
4512
4513 !! test
4514 External links: dollar sign in URL
4515 !! wikitext
4516 http://example.com/1$2345
4517 !! html
4518 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4519 </p>
4520 !! end
4521
4522 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4523 !! test
4524 External links: dollar sign in URL (autonumber)
4525 !! wikitext
4526 [http://example.com/1$2345]
4527 !! html/php
4528 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4529 </p>
4530 !! html/parsoid
4531 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4532 !!end
4533
4534 !! test
4535 External links: open square bracket forbidden in URL (bug 4377)
4536 !! options
4537 parsoid=wt2html,wt2wt,html2html
4538 !! wikitext
4539 http://example.com/1[2345
4540 !! html/php
4541 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4542 </p>
4543 !! html/parsoid
4544 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4545 !! end
4546
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 !! options
4550 parsoid=wt2html,html2html
4551 !! wikitext
4552 [http://example.com/1[2345]
4553 !! html/php
4554 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4555 </p>
4556 !! html/parsoid
4557 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4558 !!end
4559
4560 # parsoid adds a space before the link name
4561 !! test
4562 External links: open square bracket forbidden in URL (named) (bug 4377)
4563 Parsoid variant.
4564 !! wikitext
4565 [http://example.com/1 [2345]
4566 !! html
4567 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4568 </p>
4569 !!end
4570
4571 !! test
4572 External links: nowiki in URL link text (bug 6230)
4573 !! wikitext
4574 [http://example.com/ <nowiki>''example site''</nowiki>]
4575 !! html
4576 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4577 </p>
4578 !! end
4579
4580 !! test
4581 External links: newline forbidden in text (bug 6230 regression check)
4582 !! wikitext
4583 [http://example.com/ first
4584 second]
4585 !! html
4586 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4587 second]
4588 </p>
4589 !!end
4590
4591 !! test
4592 External links: Pipe char between url and text
4593 !! wikitext
4594 [http://example.com | link]
4595 !! html
4596 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4597 </p>
4598 !!end
4599
4600 !! test
4601 External links: protocol-relative URL in brackets
4602 !! wikitext
4603 [//example.com/ Test]
4604 !! html
4605 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4606 </p>
4607 !! end
4608
4609 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4610 !! test
4611 External links: protocol-relative URL in brackets without text
4612 !! wikitext
4613 [//example.com]
4614 !! html/php
4615 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4616 </p>
4617 !! html/parsoid
4618 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4619 !! end
4620
4621 !! test
4622 External links: protocol-relative URL in free text is left alone
4623 !! wikitext
4624 //example.com/Foo
4625 !! html
4626 <p>//example.com/Foo
4627 </p>
4628 !!end
4629
4630 !! test
4631 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4632 !! wikitext
4633 foo//example.com/Foo
4634 !! html
4635 <p>foo//example.com/Foo
4636 </p>
4637 !! end
4638
4639 !! test
4640 External links: with no contents
4641 !! wikitext
4642 [http://en.wikipedia.org/wiki/Foo]
4643
4644 [[wikipedia:Foo|Bar]]
4645
4646 [[wikipedia:Foo|<span>Bar</span>]]
4647 !! html/php
4648 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4649 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4650 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4651 </p>
4652 !! html/parsoid
4653 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4654 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4655 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4656 !! end
4657
4658 !! test
4659 External links: Free with trailing punctuation
4660 !! wikitext
4661 http://example.com,
4662 http://example.com;
4663 http://example.com\
4664 http://example.com.
4665 http://example.com:
4666 http://example.com!
4667 http://example.com?
4668 http://example.com)
4669 http://example.com/url_with_(brackets)
4670 (http://example.com/url_without_brackets)
4671 http://example.com/url_with_entity&amp;
4672 http://example.com/url_with_entity&#x26;
4673 http://example.com/url_with_entity&#038;
4674 http://example.com/url_with_entity&nbsp;
4675 http://example.com/url_with_entity&#xA0;
4676 http://example.com/url_with_entity&#160;
4677 http://example.com/url_with_entity&lt;
4678 http://example.com/url_with_entity&#x3C;
4679 http://example.com/url_with_entity&#60;
4680 !! html/php
4681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4682 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4684 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4685 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4686 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4687 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4688 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4690 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4691 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4692 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4694 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4695 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4697 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4698 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4699 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4700 </p>
4701 !! html/parsoid
4702 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4703 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4704 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4705 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4706 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4707 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4708 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4709 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4710 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4711 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4712 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4713 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4714 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4715 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4716 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4717 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4718 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4719 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4720 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4721 !! end
4722
4723 !! test
4724 External links: tricky Parsoid html2html case
4725 !! options
4726 parsoid=wt2html,wt2wt,html2html
4727 !! wikitext
4728 http://example.com/url_with_entity&amp;amp;
4729 !! html/php
4730 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4734 !! end
4735
4736 !! test
4737 External links: Free with trailing quotes (T113666)
4738 !! wikitext
4739 '''News:''' Stuff here
4740
4741 news:'a'b''c''d e
4742 !! html/php
4743 <p><b>News:</b> Stuff here
4744 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4745 </p>
4746 !! html/parsoid
4747 <p><b>News:</b> Stuff here</p>
4748 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4749 !! end
4750
4751 !! test
4752 External links: Lone protocols are never linked (T105697)
4753 !! wikitext
4754 http://
4755 http://;
4756 (http://)
4757 bitcoin:
4758 bitcoin:;
4759 (bitcoin:)
4760 !! html
4761 <p>http://
4762 http://;
4763 (http://)
4764 bitcoin:
4765 bitcoin:;
4766 (bitcoin:)
4767 </p>
4768 !! end
4769
4770 !! test
4771 External links: No preceding word characters allowed (bug 65278)
4772 !! wikitext
4773 NOPEhttp://example.com
4774 N0http://example.com
4775 ok:http://example.com
4776 ok-http://example.com
4777 !! html
4778 <p>NOPEhttp://example.com
4779 N0http://example.com
4780 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4781 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4782 </p>
4783 !! end
4784
4785 !! test
4786 External links: nofollow domain exception
4787 !! wikitext
4788 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4789 !! html
4790 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4791 </p>
4792 !!end
4793
4794 !! test
4795 External image
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4800 </p>
4801 !! end
4802
4803 !! test
4804 External image from https
4805 !! wikitext
4806 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4807 !! html
4808 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External image (when not allowed)
4814 !! options
4815 wgAllowExternalImages=0
4816 !! wikitext
4817 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4818 !! html
4819 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4820 </p>
4821 !! end
4822
4823 !! test
4824 Link to non-http image, no img tag
4825 !! wikitext
4826 Link to non-http image, no img tag: ftp://example.com/test.jpg
4827 !! html
4828 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: terminating separator
4834 !! wikitext
4835 Terminating separator: http://example.com/thing,
4836 !! html
4837 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4838 </p>
4839 !! end
4840
4841 !! test
4842 External links: intervening separator
4843 !! wikitext
4844 Intervening separator: http://example.com/1,2,3
4845 !! html
4846 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4847 </p>
4848 !! end
4849
4850 !! test
4851 External links: old bug with URL in query
4852 !! wikitext
4853 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4854 !! html
4855 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4856 </p>
4857 !! end
4858
4859 !! test
4860 External links: old URL-in-URL bug, mixed protocols
4861 !! wikitext
4862 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4863 !! html
4864 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4865 </p>
4866 !!end
4867
4868 !! test
4869 External links: URL in text
4870 !! wikitext
4871 URL in text: [http://example.com http://example.com]
4872 !! html
4873 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: Clickable images
4879 !! wikitext
4880 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4881 !! html/php
4882 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4883 </p>
4884 !! html/parsoid
4885 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4886 !! end
4887
4888 !! test
4889 External links: raw ampersand
4890 !! wikitext
4891 Old &amp; use: http://x&y
4892 !! html
4893 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4894 </p>
4895 !! end
4896
4897 !! test
4898 External links: encoded ampersand
4899 !! wikitext
4900 Old &amp; use: http://x&amp;y
4901 !! html/php
4902 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4903 </p>
4904 !! html/parsoid
4905 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4906 !! end
4907
4908 !! test
4909 External links: encoded equals (bug 6102)
4910 !! wikitext
4911 http://example.com/?foo&#61;bar
4912 !! html/php
4913 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4914 </p>
4915 !! html/parsoid
4916 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4917 !! end
4918
4919 ##
4920 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4921 ## does it number them. As discussed in bug 53505, we can identify
4922 ## autonumbered links via CSS.
4923 ##
4924
4925 !! test
4926 External links: [raw ampersand]
4927 !! wikitext
4928 Old &amp; use: [http://x&y]
4929 !! html/php
4930 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4931 </p>
4932 !! html/parsoid
4933 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4934 !! end
4935
4936 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4937 # mode will return the [raw ampersand] wikitext
4938 !! test
4939 External links: [encoded ampersand]
4940 !! options
4941 parsoid=wt2html,wt2wt,html2html
4942 !! wikitext
4943 Old &amp; use: [http://x&amp;y]
4944 !! html/php
4945 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4946 </p>
4947 !! html/parsoid
4948 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4949 !! end
4950
4951 !! test
4952 External links: [raw equals]
4953 !! wikitext
4954 [http://example.com/?foo=bar]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4960 !! end
4961
4962 # note that parsoid html is identical to [raw equals] case; so html2wt
4963 # mode will return the [raw equals] wikitext
4964 !! test
4965 External links: [encoded equals] (bug 6102)
4966 !! options
4967 parsoid=wt2html,wt2wt,html2html
4968 !! wikitext
4969 [http://example.com/?foo&#61;bar]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4975 !! end
4976
4977 # xxx parsoid strips the IDN character, so the round-trip tests will
4978 # obviously fail and are disabled. --cscott
4979 !! test
4980 External links: [IDN ignored character reference in hostname; strip it right off]
4981 !! options
4982 parsoid=wt2html,wt2wt,html2html
4983 !! wikitext
4984 [http://e&zwnj;xample.com/]
4985 !! html/php
4986 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4990 !! end
4991
4992 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4993 # Where an external link could easily circumvent the sanitization of the text of
4994 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4995 # test demands a higher standard. That's a bit strange.
4996 #
4997 # Example:
4998 #
4999 # http://e‌xample.com -> [http://example.com|http://example.com]
5000 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5001 #
5002 # The first example is sanitized, but the second is not. Any security benefits
5003 # from this production are trivial to circumvent. Either remove this test and
5004 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5005 # the test accordingly.
5006 #
5007 # All our love,
5008 # The Parsoid team.
5009 # xxx parsoid strips the IDN character, so the round-trip tests will
5010 # obviously fail and are disabled. --cscott
5011 !! test
5012 External links: IDN ignored character reference in hostname; strip it right off
5013 !! options
5014 parsoid=wt2html,html2html
5015 !! wikitext
5016 http://e&zwnj;xample.com/
5017 !! html/php
5018 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5019 </p>
5020 !! html/parsoid
5021 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5022 !! end
5023
5024 !! test
5025 External links: www.jpeg.org (bug 554)
5026 !! wikitext
5027 http://www.jpeg.org
5028 !! html
5029 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5030 </p>
5031 !! end
5032
5033 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5034 !! test
5035 External links: URL within URL (original bug 2)
5036 !! wikitext
5037 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5038 !! html/php
5039 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5040 </p>
5041 !! html/parsoid
5042 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5043 !! end
5044
5045 !! test
5046 BUG 361: URL inside bracketed URL
5047 !! wikitext
5048 [http://www.example.com/foo http://www.example.com/bar]
5049 !! html
5050 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5051 </p>
5052 !! end
5053
5054 !! test
5055 BUG 361: URL within URL, not bracketed
5056 !! wikitext
5057 http://www.example.com/foo?=http://www.example.com/bar
5058 !! html
5059 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5060 </p>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in URL-tail
5065 !! wikitext
5066 http://www.example.com/<hello>
5067 !! html
5068 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in URL-tail
5074 !! wikitext
5075 http://www.example.com/<b>html</b>
5076 !! html/php
5077 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5078 </p>
5079 !! html/parsoid
5080 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5081 !! end
5082
5083 !! test
5084 BUG 289: ">"-token in bracketed URL
5085 !! wikitext
5086 [http://www.example.com/<hello> stuff]
5087 !! html
5088 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5089 </p>
5090 !!end
5091
5092 !! test
5093 BUG 289: literal ">"-token in bracketed URL
5094 !! wikitext
5095 [http://www.example.com/<b>html</b> stuff]
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5098 </p>
5099 !!end
5100
5101 !! test
5102 BUG 289: literal double quote at end of URL
5103 !! wikitext
5104 http://www.example.com/"hello"
5105 !! html
5106 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5107 </p>
5108 !!end
5109
5110 !! test
5111 BUG 289: literal double quote in bracketed URL
5112 !! wikitext
5113 [http://www.example.com/"hello" stuff]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5116 </p>
5117 !!end
5118
5119 !! test
5120 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5121 !! wikitext
5122 [http://www.example.com test]
5123 !! html
5124 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 External links: link text with spaces
5130 !! wikitext
5131 [http://www.example.com a b c]
5132 [http://www.example.com ''a'' ''b'']
5133 !! html
5134 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5135 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5136 </p>
5137 !! end
5138
5139 !! test
5140 External links: wiki links within external link (Bug 3695)
5141 !! options
5142 parsoid=wt2html,html2html
5143 !! wikitext
5144 [http://example.com [[wikilink]] embedded in ext link]
5145 !! html/php
5146 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5147 </p>
5148 !! html/parsoid
5149 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5150 !! end
5151
5152 !! test
5153 BUG 787: Links with one slash after the url protocol are invalid
5154 !! wikitext
5155 http:/example.com
5156
5157 [http:/example.com title]
5158 !! html
5159 <p>http:/example.com
5160 </p><p>[http:/example.com title]
5161 </p>
5162 !! end
5163
5164 !! test
5165 Bracketed external links with template-generated invalid target
5166 !! wikitext
5167 [{{echo|http:/example.com}} title]
5168 !! html
5169 <p>[http:/example.com title]
5170 </p>
5171 !! end
5172
5173 !! test
5174 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5175 !! wikitext
5176 ''[http://example.com text'']
5177 [http://example.com '''text]'''
5178 ''Something [http://example.com in italic'']
5179 ''Something [http://example.com mixed''''', even bold]'''
5180 '''''Now [http://example.com both''''']
5181 !! html
5182 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5183 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5184 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5185 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5186 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5187 </p>
5188 !! end
5189
5190
5191 !! test
5192 Bug 4781: %26 in URL
5193 !! wikitext
5194 http://www.example.com/?title=AT%26T
5195 !! html/php
5196 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5200 !! end
5201
5202 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5203 # % is actually legal in HTML5. Any change in output would need testing though.
5204 !! test
5205 Bug 4781, 5267: %25 in URL
5206 !! wikitext
5207 http://www.example.com/?title=100%25_Bran
5208 !! html/php
5209 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %28, %29 in URL
5217 !! wikitext
5218 http://www.example.com/?title=Ben-Hur_%281959_film%29
5219 !! html/php
5220 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5224 !! end
5225
5226
5227 !! test
5228 Bug 4781: %26 in autonumber URL
5229 !! wikitext
5230 [http://www.example.com/?title=AT%26T]
5231 !! html/php
5232 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5233 </p>
5234 !! html/parsoid
5235 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5236 !! end
5237
5238 !! test
5239 Bug 4781, 5267: %26 in autonumber URL
5240 !! wikitext
5241 [http://www.example.com/?title=100%25_Bran]
5242 !! html/php
5243 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %28, %29 in autonumber URL
5251 !! wikitext
5252 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5253 !! html/php
5254 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5255 </p>
5256 !! html/parsoid
5257 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5258 !! end
5259
5260
5261 !! test
5262 Bug 4781: %26 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=AT%26T link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %25 in bracketed URL
5274 !! wikitext
5275 [http://www.example.com/?title=100%25_Bran link]
5276 !! html
5277 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5278 </p>
5279 !! end
5280
5281 !! test
5282 Bug 4781, 5267: %28, %29 in bracketed URL
5283 !! wikitext
5284 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5285 !! html/php
5286 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5287 </p>
5288 !! html/parsoid
5289 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5290 !! end
5291
5292 !! test
5293 External link containing a period in the anchor. (bug 63947)
5294 !! wikitext
5295 [//foo.org/bar#baz. bang]
5296
5297 [//foo.org/bar. bang]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5300 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5304 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5305 !! end
5306
5307 !! test
5308 External link containing a single quote. (bug 63947)
5309 !! wikitext
5310 [//foo.org/bar'baz]
5311
5312 [//foo.org/bar'baz bang]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5315 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5316 </p>
5317 !! html/parsoid
5318 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5319 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5320 !! end
5321
5322 !! test
5323 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5324 !! wikitext
5325 Some [http://example.com/ pretty ''italics'' and stuff]!
5326 !! html
5327 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5328 </p>
5329 !! end
5330
5331 !! test
5332 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5333 !! wikitext
5334 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5335 !! html
5336 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5337 </p>
5338 !! end
5339
5340 !! test
5341 External link containing double-single-quotes with no space separating the url from text in italics
5342 !! wikitext
5343 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5344 !! html/php
5345 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5346 </p>
5347 !! html/php+tidy
5348 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5349 !! html/parsoid
5350 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5351 !! end
5352
5353 !! test
5354 External link with comments in link text
5355 !! wikitext
5356 [http://www.google.com Google <!-- comment -->]
5357 !! html/php
5358 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5359 </p>
5360 !! html/parsoid
5361 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5362 !! end
5363
5364 !! test
5365 External link to bare IPv4 address
5366 !! wikitext
5367 [http://192.168.0.1 Link]
5368 !! html/php
5369 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5370 </p>
5371 !! html/parsoid
5372 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5373 !! end
5374
5375 !! test
5376 URL-encoding in URL functions (single parameter)
5377 !! wikitext
5378 {{localurl:Some page|amp=&}}
5379 !! html
5380 <p>/index.php?title=Some_page&amp;amp=&amp;
5381 </p>
5382 !! end
5383
5384 !! test
5385 URL-encoding in URL functions (multiple parameters)
5386 !! wikitext
5387 {{localurl:Some page|q=?&amp=&}}
5388 !! html
5389 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5390 </p>
5391 !! end
5392
5393 !! test
5394 Brackets in urls
5395 !! wikitext
5396 http://example.com/index.php?foozoid%5B%5D=bar
5397
5398 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5399 !! html/php
5400 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5401 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5405
5406 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5407 !! end
5408
5409 !! test
5410 IPv6 urls, autolink format (T23261)
5411 !! wikitext
5412 http://[2404:130:0:1000::187:2]/index.php
5413
5414 Examples from RFC 2373, section 2.2:
5415 * http://[1080::8:800:200C:417A]/unicast
5416 * http://[FF01::101]/multicast
5417 * http://[::1]/loopback
5418 * http://[::]/unspecified
5419 * http://[::13.1.68.3]/ipv4compat
5420 * http://[::FFFF:129.144.52.38]/ipv4compat
5421
5422 Examples from RFC 2732, section 2:
5423 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5424 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5425 * http://[3ffe:2a00:100:7031::1]
5426 * http://[1080::8:800:200C:417A]/foo
5427 * http://[::192.9.5.5]/ipng
5428 * http://[::FFFF:129.144.52.38]:80/index.html
5429 * http://[2010:836B:4179::836B:4179]
5430
5431 !! html/php
5432 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5433 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5434 </p>
5435 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5442 </p>
5443 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5444 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5445 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5449 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450
5451 !! html/parsoid
5452 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5453
5454 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5455 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5461
5462 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5463 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5465 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5467 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5468 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5469 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5470 !! end
5471
5472 !! test
5473 IPv6 urls, bracketed format (T23261)
5474 !! wikitext
5475 [http://[2404:130:0:1000::187:2]/index.php test]
5476
5477 Examples from RFC 2373, section 2.2:
5478 * [http://[1080::8:800:200C:417A] unicast]
5479 * [http://[FF01::101] multicast]
5480 * [http://[::1]/ loopback]
5481 * [http://[::] unspecified]
5482 * [http://[::13.1.68.3] ipv4compat]
5483 * [http://[::FFFF:129.144.52.38] ipv4compat]
5484
5485 Examples from RFC 2732, section 2:
5486 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5487 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5488 * [http://[3ffe:2a00:100:7031::1] 3]
5489 * [http://[1080::8:800:200C:417A]/foo 4]
5490 * [http://[::192.9.5.5]/ipng 5]
5491 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5492 * [http://[2010:836B:4179::836B:4179] 7]
5493
5494 !! html/php
5495 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5496 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5497 </p>
5498 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5505 </p>
5506 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5516
5517 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5518 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5524
5525 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5526 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5528 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5529 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5530 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5531 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5532 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5533 !! end
5534
5535 !! test
5536 Non-extlinks in brackets
5537 !! wikitext
5538 [foo]
5539 [foo bar]
5540 [foo ''bar'']
5541 [fool's] errand
5542 [fool's errand]
5543 [{{echo|foo}}]
5544 [{{echo|foo}} bar]
5545 [{{echo|foo}} ''bar'']
5546 [{{echo|foo}}l's] errand
5547 [{{echo|foo}}l's errand]
5548 [url={{echo|foo}}]
5549 [url=http://example.com]
5550 [http:// bare protocols don't count]
5551 !! html/php
5552 <p>[foo]
5553 [foo bar]
5554 [foo <i>bar</i>]
5555 [fool's] errand
5556 [fool's errand]
5557 [foo]
5558 [foo bar]
5559 [foo <i>bar</i>]
5560 [fool's] errand
5561 [fool's errand]
5562 [url=foo]
5563 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5564 [http:// bare protocols don't count]
5565 </p>
5566 !! html/parsoid
5567 <p>[foo]
5568 [foo bar]
5569 [foo <i>bar</i>]
5570 [fool's] errand
5571 [fool's errand]
5572 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5573 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5574 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5575 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5576 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5577 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5578 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5579 [http:// bare protocols don't count]</p>
5580 !! end
5581
5582 !! test
5583 Percent encoding in external links
5584 !! wikitext
5585 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5586 !! html/php
5587 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5588 </p>
5589 !! html/parsoid
5590 <p><a rel="mw:ExtLink"
5591 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5592 !! end
5593
5594 !! test
5595 Use url link syntax for links where the content is equal the link target
5596 !! wikitext
5597 http://example.com
5598 !! html/php
5599 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5600 </p>
5601 !! html/parsoid
5602 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5603 !! end
5604
5605 !! test
5606 Parenthesis in external links, especially URL links
5607 !! wikitext
5608 http://example.com)
5609
5610 http://example.com/test)
5611
5612 http://example.com/(test)
5613
5614 http://example.com/((test)
5615
5616 (http://example.com/(test))
5617
5618 (http://example.com/(test)))))
5619
5620 http://example.com/a)b
5621
5622 [http://example.com) foo]
5623 !! html/php
5624 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5625 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5626 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5627 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5628 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5630 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5631 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5632 </p>
5633 !! html/parsoid
5634 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5635 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5636 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5637 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5638 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5639 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5640 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5641 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5642 !! end
5643
5644 !! test
5645 Parenthesis in external links, w/ transclusion or comment
5646 !! wikitext
5647 (http://example.com/{{echo|hi}})
5648
5649 (http://example.com<!-- hi -->)
5650 !! html/php
5651 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5652 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5653 </p>
5654 !! html/parsoid
5655 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5656
5657 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5658 !! end
5659
5660 !! test
5661 Serialize <a> tags with invalid link targets as plain text
5662 !! options
5663 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5664 !! html/parsoid
5665 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5666 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5667 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5668 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5669 !! wikitext
5670 text
5671 <nowiki>*</nowiki>text
5672 <nowiki>[[foo]]</nowiki>
5673 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5674 !! end
5675
5676 !! test
5677 mw:ExtLink -vs- mw:WikiLink (T94723)
5678 !! options
5679 parsoid=html2wt
5680 !! html/parsoid
5681 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5682 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5683 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5684 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5685 <p>
5686 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5687 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5688 </p>
5689 !! wikitext
5690 [[Foo|Bar]]
5691 [[Foo|Bar]]
5692 [[wikipedia:Foo|Bar]]
5693 [[wikipedia:Foo|Bar]]
5694
5695 [[wikipedia:European_Robin|European Robin]]
5696 [[wikipedia:European_Robin|European Robin]]
5697 !! end
5698
5699 !! test
5700 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5701 !! options
5702 parsoid=wt2wt
5703 !! wikitext
5704 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5705 !! html/parsoid
5706 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5707 !! end
5708
5709
5710 ###
5711 ### Quotes
5712 ###
5713
5714 !! test
5715 Quotes
5716 !! wikitext
5717 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5718
5719 Normal text. '''''Bold italic text.''''' Normal text.
5720 !! html
5721 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5722 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5723 </p>
5724 !! end
5725
5726
5727 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5728 # parser strips. The wikitext contains just the first half of the bold
5729 # quote pair.
5730 !! test
5731 Unclosed and unmatched quotes
5732 !! wikitext
5733 '''''Bold italic text '''with bold deactivated''' in between.'''''
5734
5735 '''''Bold italic text ''with italic deactivated'' in between.'''''
5736
5737 '''Bold text..
5738
5739 ..spanning two paragraphs (should not work).'''
5740
5741 '''Bold tag left open
5742
5743 ''Italic tag left open
5744
5745 Normal text.
5746
5747 <!-- Unmatching number of opening, closing tags: -->
5748 '''This year''''s election ''should'' beat '''last year''''s.
5749
5750 ''Tom'''s car is bigger than ''Susan'''s.
5751
5752 Plain ''italic'''s plain
5753 !! html/php
5754 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5755 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5756 </p><p><b>Bold text..</b>
5757 </p><p>..spanning two paragraphs (should not work).
5758 </p><p><b>Bold tag left open</b>
5759 </p><p><i>Italic tag left open</i>
5760 </p><p>Normal text.
5761 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5762 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5763 </p><p>Plain <i>italic'</i>s plain
5764 </p>
5765 !! html/parsoid
5766 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5767 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5768 </p><p><b>Bold text..</b>
5769 </p><p>..spanning two paragraphs (should not work).<b></b>
5770 </p><p><b>Bold tag left open</b>
5771 </p><p><i>Italic tag left open</i>
5772 </p><p>Normal text.
5773 </p>
5774 <!-- Unmatching number of opening, closing tags: -->
5775 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5776 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5777 </p><p>Plain <i>italic'</i>s plain
5778 </p>
5779 !! end
5780
5781 ###
5782 ### Tables
5783 ###
5784 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5785 ###
5786
5787 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5788 # is the bare minimum required by the spec, see:
5789 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5790 # Parsoid team replies: empty table tags are legal in HTML5
5791 !! test
5792 A table with no data.
5793 !! options
5794 parsoid=wt2html
5795 !! wikitext
5796 {||}
5797 !! html/php
5798
5799 !! html/parsoid
5800 <table></table>
5801
5802 !! end
5803
5804 !! test
5805 A table with stray table end tags on start tag line (wt2html)
5806 !! options
5807 parsoid=wt2html
5808 !! wikitext
5809 {|style="color: red;"|}
5810
5811 {|style="color: red;" |}
5812 |foo
5813 |}
5814
5815 {|style="color: red;"|} id="foo"
5816 |foo
5817 |}
5818
5819 {|style="color: red;" |} id="foo"
5820 |foo
5821 |}
5822 !! html
5823 <table style="color: red;"></table>
5824
5825 <table style="color: red;">
5826 <tbody><tr>
5827 <td>foo</td>
5828 </tr></tbody>
5829 </table>
5830
5831 <table style="color: red;" id="foo">
5832 <tbody><tr>
5833 <td>foo</td>
5834 </tr></tbody>
5835 </table>
5836
5837 <table style="color: red;" id="foo">
5838 <tbody><tr>
5839 <td>foo</td>
5840 </tr></tbody>
5841 </table>
5842
5843 !! end
5844
5845 !! test
5846 A table with no data (take 2)
5847 !! wikitext
5848 {|
5849 |}
5850 !! html/parsoid
5851 <table></table>
5852 !! end
5853
5854 # A table with nothing but a caption is invalid XHTML, we might want to render
5855 # this as <p>caption</p>
5856 # Parsoid team replies: table with only a caption is legal in HTML5
5857 !! test
5858 A table with nothing but a caption
5859 !! wikitext
5860 {|
5861 |+ caption
5862 |}
5863 !! html/php
5864 <table>
5865 <caption> caption
5866 </caption><tr><td></td></tr></table>
5867
5868 !! html/parsoid
5869 <table><caption> caption</caption></table>
5870 !! end
5871
5872 !! test
5873 A table with caption with default-spaced attributes and a table row
5874 !! wikitext
5875 {|
5876 |+ style="color: red;" | caption1
5877 |-
5878 | foo
5879 |}
5880 !! html
5881 <table>
5882 <caption style="color: red;"> caption1
5883 </caption>
5884 <tr>
5885 <td> foo
5886 </td></tr></table>
5887
5888 !! end
5889
5890 !! test
5891 A table with captions with non-default spaced attributes and a table row
5892 !! wikitext
5893 {|
5894 |+style="color: red;"|caption2
5895 |+ style="color: red;"| caption3
5896 |-
5897 | foo
5898 |}
5899 !! html
5900 <table>
5901 <caption style="color: red;">caption2
5902 </caption>
5903 <caption style="color: red;"> caption3
5904 </caption>
5905 <tr>
5906 <td> foo
5907 </td></tr></table>
5908
5909 !! end
5910
5911 !! test
5912 Table td-cell syntax variations
5913 !! wikitext
5914 {|
5915 | foo bar foo | baz
5916 | foo bar foo || baz
5917 | style='color:red;' | baz
5918 | style='color:red;' || baz
5919 |}
5920 !! html
5921 <table>
5922 <tr>
5923 <td> baz
5924 </td>
5925 <td> foo bar foo </td>
5926 <td> baz
5927 </td>
5928 <td style="color:red;"> baz
5929 </td>
5930 <td> style='color:red;' </td>
5931 <td> baz
5932 </td></tr></table>
5933
5934 !! end
5935
5936 !! test
5937 Simple table
5938 !! wikitext
5939 {|
5940 | 1 || 2
5941 |-
5942 | 3 || 4
5943 |}
5944 !! html
5945 <table>
5946 <tr>
5947 <td> 1 </td>
5948 <td> 2
5949 </td></tr>
5950 <tr>
5951 <td> 3 </td>
5952 <td> 4
5953 </td></tr></table>
5954
5955 !! end
5956
5957 !! test
5958 Simple table but with multiple dashes for row wikitext
5959 !! wikitext
5960 {|
5961 | foo
5962 |-----
5963 | bar
5964 |}
5965 !! html
5966 <table>
5967 <tr>
5968 <td> foo
5969 </td></tr>
5970 <tr>
5971 <td> bar
5972 </td></tr></table>
5973
5974 !! end
5975
5976 !! test
5977 Multiplication table
5978 !! wikitext
5979 {| border="1" cellpadding="2"
5980 |+Multiplication table
5981 |-
5982 ! &times; !! 1 !! 2 !! 3
5983 |-
5984 ! 1
5985 | 1 || 2 || 3
5986 |-
5987 ! 2
5988 | 2 || 4 || 6
5989 |-
5990 ! 3
5991 | 3 || 6 || 9
5992 |-
5993 ! 4
5994 | 4 || 8 || 12
5995 |-
5996 ! 5
5997 | 5 || 10 || 15
5998 |}
5999 !! html
6000 <table border="1" cellpadding="2">
6001 <caption>Multiplication table
6002 </caption>
6003 <tr>
6004 <th> &#215; </th>
6005 <th> 1 </th>
6006 <th> 2 </th>
6007 <th> 3
6008 </th></tr>
6009 <tr>
6010 <th> 1
6011 </th>
6012 <td> 1 </td>
6013 <td> 2 </td>
6014 <td> 3
6015 </td></tr>
6016 <tr>
6017 <th> 2
6018 </th>
6019 <td> 2 </td>
6020 <td> 4 </td>
6021 <td> 6
6022 </td></tr>
6023 <tr>
6024 <th> 3
6025 </th>
6026 <td> 3 </td>
6027 <td> 6 </td>
6028 <td> 9
6029 </td></tr>
6030 <tr>
6031 <th> 4
6032 </th>
6033 <td> 4 </td>
6034 <td> 8 </td>
6035 <td> 12
6036 </td></tr>
6037 <tr>
6038 <th> 5
6039 </th>
6040 <td> 5 </td>
6041 <td> 10 </td>
6042 <td> 15
6043 </td></tr></table>
6044
6045 !! end
6046
6047 !! test
6048 Accept "||" in table headings
6049 !! wikitext
6050 {|
6051 !h1 || h2
6052 |}
6053 !! html
6054 <table>
6055 <tr>
6056 <th>h1 </th>
6057 <th> h2
6058 </th></tr></table>
6059
6060 !! end
6061
6062 !! test
6063 Accept "!!" in table data
6064 !! wikitext
6065 {|
6066 | Foo!! ||
6067 |}
6068 !! html
6069 <table>
6070 <tr>
6071 <td> Foo!! </td>
6072 <td>
6073 </td></tr></table>
6074
6075 !! html/parsoid
6076 <table>
6077 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6078 </tbody></table>
6079 !! end
6080
6081 !! test
6082 Accept "||" in indented table headings
6083 !! wikitext
6084 :{|
6085 !h1 || h2
6086 |}
6087 !! html
6088 <dl><dd><table>
6089 <tr>
6090 <th>h1 </th>
6091 <th> h2
6092 </th></tr></table></dd></dl>
6093
6094 !! end
6095
6096 !! test
6097 Accept "!!" in templates
6098 !! wikitext
6099 {|
6100 !a {{echo|b!!c}}
6101 |}
6102 !! html/php
6103 <table>
6104 <tr>
6105 <th>a b</th>
6106 <th>c
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6112 !! end
6113
6114 !! test
6115 Accept "!!" in table headings after newline
6116 !! wikitext
6117 {|
6118 !a
6119 b!!c
6120 |}
6121 !! html/php
6122 <table>
6123 <tr>
6124 <th>a
6125 <p>b!!c
6126 </p>
6127 </th></tr></table>
6128
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a
6132 <p>b!!c</p></th></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept "!!" in table data of mixed wikitext / html syntax
6138 !! wikitext
6139 {|
6140 !a
6141 <tr><td>b!!c</td></tr>
6142 |}
6143 !! html+tidy
6144 <table>
6145 <tr>
6146 <th>a</th>
6147 </tr>
6148 <tr>
6149 <td>b!!c</td>
6150 </tr>
6151 </table>
6152 !! html/parsoid
6153 <table>
6154 <tbody><tr><th>a</th></tr>
6155 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6156 </tbody></table>
6157 !! end
6158
6159 !! test
6160 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6161 !! wikitext
6162 {|
6163 !| h1
6164 || a
6165 |}
6166 !! html
6167 <table>
6168 <tr>
6169 <th> h1
6170 </th>
6171 <td> a
6172 </td></tr></table>
6173
6174 !! end
6175
6176 !!test
6177 Accept "| !" at start of line in tables (ignore !-attribute)
6178 !! wikitext
6179 {|
6180 |-
6181 | !style="color:red" | bar
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td> bar
6188 </td></tr></table>
6189
6190 !!end
6191
6192 !!test
6193 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6194 !! wikitext
6195 {|
6196 |-
6197 |style='color:red;'|+1
6198 |style='color:blue;'|-1
6199 |-
6200 | 1 || 2 || 3
6201 | 1 ||+2 ||-3
6202 |-
6203 | +1
6204 | -1
6205 |}
6206 !! html
6207 <table>
6208
6209 <tr>
6210 <td style="color:red;">+1
6211 </td>
6212 <td style="color:blue;">-1
6213 </td></tr>
6214 <tr>
6215 <td> 1 </td>
6216 <td> 2 </td>
6217 <td> 3
6218 </td>
6219 <td> 1 </td>
6220 <td>+2 </td>
6221 <td>-3
6222 </td></tr>
6223 <tr>
6224 <td> +1
6225 </td>
6226 <td> -1
6227 </td></tr></table>
6228
6229 !!end
6230
6231 !! test
6232 Table rowspan
6233 !! wikitext
6234 {| border=1
6235 | Cell 1, row 1
6236 |rowspan=2| Cell 2, row 1 (and 2)
6237 | Cell 3, row 1
6238 |-
6239 | Cell 1, row 2
6240 | Cell 3, row 2
6241 |}
6242 !! html
6243 <table border="1">
6244 <tr>
6245 <td> Cell 1, row 1
6246 </td>
6247 <td rowspan="2"> Cell 2, row 1 (and 2)
6248 </td>
6249 <td> Cell 3, row 1
6250 </td></tr>
6251 <tr>
6252 <td> Cell 1, row 2
6253 </td>
6254 <td> Cell 3, row 2
6255 </td></tr></table>
6256
6257 !! end
6258
6259 !! test
6260 Nested table
6261 !! wikitext
6262 {| border=1
6263 | &alpha;
6264 |
6265 {| bgcolor=#ABCDEF border=2
6266 |nested
6267 |-
6268 |table
6269 |}
6270 |the original table again
6271 |}
6272 !! html
6273 <table border="1">
6274 <tr>
6275 <td> &#945;
6276 </td>
6277 <td>
6278 <table bgcolor="#ABCDEF" border="2">
6279 <tr>
6280 <td>nested
6281 </td></tr>
6282 <tr>
6283 <td>table
6284 </td></tr></table>
6285 </td>
6286 <td>the original table again
6287 </td></tr></table>
6288
6289 !! end
6290
6291 !! test
6292 Invalid attributes in table cell (bug 1830)
6293 !! wikitext
6294 {|
6295 |Cell:|broken
6296 |}
6297 !! html
6298 <table>
6299 <tr>
6300 <td>broken
6301 </td></tr></table>
6302
6303 !! end
6304
6305 !! test
6306 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6307 !! wikitext
6308 {|
6309 | title="foo" |bar
6310 | title="foo<nowiki>|</nowiki>" |bar
6311 | title="foo<nowiki>|</nowiki>" bar
6312 |}
6313 !! html/php
6314 <table>
6315 <tr>
6316 <td title="foo">bar
6317 </td>
6318 <td title="foo&#124;">bar
6319 </td>
6320 <td> title="foo|" bar
6321 </td></tr></table>
6322
6323 !! html/parsoid
6324 <table>
6325 <tbody><tr><td title="foo">bar</td>
6326 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6327 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6328 </tbody></table>
6329 !! end
6330
6331 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6332 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6333 # *2wt modes will fail.
6334 !! test
6335 Table security: embedded pipes
6336 !! options
6337 parsoid=wt2html,html2html
6338 !! wikitext
6339 {|
6340 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6341 !! html/php
6342 <table>
6343 <tr>
6344 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6345 <td>]" onmouseover="alert(document.cookie)"&gt;test
6346 </td>
6347 </tr>
6348 </table>
6349
6350 !! html/parsoid
6351 <table><tbody>
6352 <tr>
6353 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6354 !! end
6355
6356 !! test
6357 Element attributes with double ! should not be broken up by <th>
6358 !! wikitext
6359 {|
6360 ! hi <div class="!!">ha</div> ho
6361 |}
6362 !! html/php
6363 <table>
6364 <tr>
6365 <th> hi <div class="!!">ha</div> ho
6366 </th></tr></table>
6367
6368 !! html/parsoid
6369 <table>
6370 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6371 </tbody></table>
6372 !! end
6373
6374 !! test
6375 ! and || in element attributes should not be parsed as <th>/<td>
6376 !! wikitext
6377 {|
6378 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6379 |}
6380 !! html/php
6381 <table>
6382 <tr>
6383 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6384 </td></tr></table>
6385
6386 !! html/parsoid
6387 <table>
6388 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6389 </tbody></table>
6390 !! end
6391
6392 # FIXME: The output seems broken. Filed as T110268.
6393 !! test
6394 ! and || in td attributes should not be parsed as <th>/<td>
6395 !! options
6396 parsoid=wt2html
6397 !! wikitext
6398 {|
6399 | style="color: red !important;" data-contrived="put this here ||" | foo
6400 |}
6401 !! html/php
6402 <table>
6403 <tr>
6404 <td> style="color: red !important;" data-contrived="put this here </td>
6405 <td> foo
6406 </td></tr></table>
6407
6408 !! html/parsoid
6409 <table>
6410 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6411 </tbody></table>
6412 !! end
6413
6414 !! test
6415 Break on | in element attribute in template
6416 !! options
6417 parsoid=wt2html,html2html
6418 !! wikitext
6419 {{echo|1=<div class="hi|ho">ha</div>}}
6420 !! html/php
6421 <p>ho"&gt;ha&lt;/div&gt;
6422 </p>
6423 !! html/parsoid
6424 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6425 !! end
6426
6427 !! test
6428 Indented table markup mixed with indented pre content (proposed in bug 6200)
6429 !! wikitext
6430 <table>
6431 <tr>
6432 <td>
6433 Text that should be rendered preformatted
6434 </td>
6435 </tr>
6436 </table>
6437 !! html
6438 <table>
6439 <tr>
6440 <td>
6441 <pre>Text that should be rendered preformatted
6442 </pre>
6443 </td>
6444 </tr>
6445 </table>
6446
6447 !! end
6448
6449 !! test
6450 1. Template-generated table cell attributes and cell content
6451 !! wikitext
6452 {|
6453 |{{table_attribs}}
6454 | {{table_attribs}}
6455 || {{table_attribs_5}}
6456 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6457 |align=center {{table_attribs}}
6458 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td style="color:red;">Foo
6464 </td>
6465 <td style="color:red;">Foo
6466 </td>
6467 <td> style="color:red;"</td>
6468 <td>Bar
6469 </td>
6470 <td style="color:red;">Foo
6471 </td>
6472 <td align="center" style="color:red;">Foo
6473 </td>
6474 <td align="center" style="color:red;">Foo
6475 </td></tr></table>
6476
6477 !! end
6478
6479 !! test
6480 2. Template-generated table cell attributes and cell content
6481 !! wikitext
6482 {|
6483 |{{table_attribs_2}}
6484 |}
6485 !! html/php
6486 <table>
6487 <tr>
6488 <td style="color:red;">Foo
6489 </td>
6490 <td>Bar</td>
6491 <td>Baz
6492 </td></tr></table>
6493
6494 !! html/parsoid
6495 <table>
6496 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6497 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 3. Template-generated table cell attributes and cell content
6503 !! wikitext
6504 {|
6505 !align=center {{table_header_cells}}
6506 |-
6507 |align=center {{table_cells}}
6508 |}
6509 !! html/php
6510 <table>
6511 <tr>
6512 <th align="center" style="color:red;">Foo</th>
6513 <th style="color:red;"><i>Bar</i></th>
6514 <th style="color:brown;"><i>Foo</i> and Baz
6515 </th></tr>
6516 <tr>
6517 <td align="center" style="color:red;">Foo</td>
6518 <td style="color:red;"><i>Bar</i></td>
6519 <td style="color:brown;"><i>Foo</i> and Baz
6520 </td></tr></table>
6521
6522 !! html/parsoid
6523 <table>
6524 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6525 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6526 </tbody></table>
6527 !! end
6528
6529 !! test
6530 4. Template-generated table cell attributes and cell content inside a templated table
6531 !! wikitext
6532 {{tbl-start}}
6533 !align=center {{table_header_cells}}
6534 |-
6535 |align=center {{table_cells}}
6536 {{tbl-end}}
6537 !! html/php
6538 <table>
6539 <tr>
6540 <th align="center" style="color:red;">Foo</th>
6541 <th style="color:red;"><i>Bar</i></th>
6542 <th style="color:brown;"><i>Foo</i> and Baz
6543 </th></tr>
6544 <tr>
6545 <td align="center" style="color:red;">Foo</td>
6546 <td style="color:red;"><i>Bar</i></td>
6547 <td style="color:brown;"><i>Foo</i> and Baz
6548 </td></tr></table>
6549
6550 !! html/parsoid
6551 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6552 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6553 <tr>
6554 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6555 </tbody></table>
6556 !! end
6557
6558 ## Edge case fix to prevent future regressions
6559 !! test
6560 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6561 !! wikitext
6562 {|
6563 |{{table_attribs_7}}
6564 |}
6565 <references />
6566 !! html/parsoid
6567 <table>
6568 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6569 </tbody></table>
6570 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6571 !! end
6572
6573 !! test
6574 Table with row followed by newlines and table heading
6575 !! wikitext
6576 {|
6577 |-
6578
6579 ! foo
6580 |}
6581 !! html
6582 <table>
6583
6584
6585 <tr>
6586 <th> foo
6587 </th></tr></table>
6588
6589 !! end
6590
6591 !! test
6592 Table with empty line following the start tag
6593 !! wikitext
6594 {|
6595
6596 |-
6597 | foo
6598 |}
6599 !! html
6600 <table>
6601
6602
6603 <tr>
6604 <td> foo
6605 </td></tr></table>
6606
6607 !! end
6608
6609 !! test
6610 Table attributes with empty value
6611 !! options
6612 parsoid=wt2html,html2html
6613 !! wikitext
6614 {|
6615 | style=| hello
6616 |}
6617 !! html/php
6618 <table>
6619 <tr>
6620 <td style=""> hello
6621 </td></tr></table>
6622
6623 !! html/parsoid
6624 <table>
6625 <tbody><tr><td style=""> hello</td></tr>
6626 </tbody></table>
6627 !! end
6628
6629 !! test
6630 Wikitext table with a lot of comments
6631 !! wikitext
6632 {|
6633 <!-- c0 -->
6634 | foo
6635 <!-- c1 -->
6636 |-<!-- c2 -->
6637 <!-- c3 -->
6638 |<!-- c4 -->
6639 <!-- c5 -->
6640 |}
6641 !! html
6642 <table>
6643 <tr>
6644 <td> foo
6645 </td></tr>
6646 <tr>
6647 <td>
6648 </td></tr></table>
6649
6650 !! end
6651
6652 !! test
6653 Wikitext table comments represented in parsoid dom
6654 !! wikitext
6655 {|<!--c1--><!--c2-->
6656 |-<!--c3-->
6657 | x
6658 |}
6659 !! html/php+tidy
6660 <table>
6661 <tr>
6662 <td>x</td>
6663 </tr>
6664 </table>
6665 !! html/parsoid
6666 <table><!--c1--><!--c2-->
6667 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6668 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6669 </tbody></table>
6670 !! end
6671
6672 !! test
6673 Wikitext table with double-line table cell
6674 !! wikitext
6675 {|
6676 |a
6677 b
6678 |}
6679 !! html
6680 <table>
6681 <tr>
6682 <td>a
6683 <p>b
6684 </p>
6685 </td></tr></table>
6686
6687 !! end
6688
6689 !! test
6690 Table cell with a single comment
6691 !! wikitext
6692 {|
6693 | <!-- c1 -->
6694 | a
6695 |}
6696 !! html
6697 <table>
6698 <tr>
6699 <td>
6700 </td>
6701 <td> a
6702 </td></tr></table>
6703
6704 !! end
6705
6706 !! test
6707 Table-cell after a comment-only-empty-line
6708 !! wikitext
6709 {|
6710 |a
6711 <!--c1-->
6712 <!--c2-->| b
6713 |}
6714 !! html
6715 <table>
6716 <tr>
6717 <td>a
6718 </td>
6719 <td> b
6720 </td></tr></table>
6721
6722 !! html/parsoid
6723 <table>
6724 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6725 <!--c1-->
6726 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6727 </tbody></table>
6728
6729 !! end
6730
6731 !! test
6732 Build table with {{!}}
6733 !! wikitext
6734 {{{!}} class="wikitable"
6735 ! header
6736 ! second header
6737 {{!}}- style="color:red;"
6738 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6739 {{!}}}
6740 !! html
6741 <table class="wikitable">
6742 <tr>
6743 <th> header
6744 </th>
6745 <th> second header
6746 </th></tr>
6747 <tr style="color:red;">
6748 <td> data </td>
6749 <td style="color:red;"> second data
6750 </td></tr></table>
6751
6752 !! end
6753
6754 !! test
6755 Build table with pipe as data
6756 !! wikitext
6757 {| class="wikitable"
6758 ! header
6759 ! second header
6760 |- style="color:red;"
6761 | data || style="color:red;" | second data
6762 |-
6763 | style="color:red;" | data with | || style="color:red;" | second data with |
6764 |-
6765 || data with | ||| second data with |
6766 |}
6767 !! html
6768 <table class="wikitable">
6769 <tr>
6770 <th> header
6771 </th>
6772 <th> second header
6773 </th></tr>
6774 <tr style="color:red;">
6775 <td> data </td>
6776 <td style="color:red;"> second data
6777 </td></tr>
6778 <tr>
6779 <td style="color:red;"> data with | </td>
6780 <td style="color:red;"> second data with |
6781 </td></tr>
6782 <tr>
6783 <td> data with | </td>
6784 <td> second data with |
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Build table with wikilink
6791 !! wikitext
6792 {| class="wikitable"
6793 ! header || second header
6794 |- style="color:red;"
6795 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6796 |-
6797 | data || second data [[Main Page|link|text with pipe]]
6798 |}
6799 !! html
6800 <table class="wikitable">
6801 <tr>
6802 <th> header </th>
6803 <th> second header
6804 </th></tr>
6805 <tr style="color:red;">
6806 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6807 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6808 </td></tr>
6809 <tr>
6810 <td> data </td>
6811 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6812 </td></tr></table>
6813
6814 !! end
6815
6816 # The expected HTML structure in this test is debatable. The PHP parser does
6817 # not parse this kind of table at all. The main focus for Parsoid is on
6818 # round-tripping, so this output is ok for now. TODO: revisit!
6819 !! test
6820 Wikitext table with html-syntax row
6821 !! wikitext
6822 {|
6823 |-
6824 <td>foo</td>
6825 |}
6826 !! html/parsoid
6827 <table>
6828 <tbody>
6829 <tr>
6830 <td>foo</td></tr></tbody></table>
6831 !! end
6832
6833 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6834 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6835 ## PHP parser, which tidy then compounds by fostering the content
6836 ## entirely out of the table. Parsoid recognizes the table context
6837 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6838 ## depends on PHP's treatment of broken table markup!
6839 !! test
6840 Implicit <td> after a |-
6841 !! options
6842 parsoid=wt2html,html2html
6843 !! wikitext
6844 {|
6845 |-
6846 a
6847 |}
6848 !! html/php
6849 <table>
6850
6851 a
6852 </table>
6853
6854 !! html/php+tidy
6855 <p>a</p>
6856 !! html/parsoid
6857 <table>
6858 <tr><td>a</td></tr>
6859 </table>
6860 !! end
6861
6862 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6863 !! test
6864 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6865 !! options
6866 parsoid=wt2html,html2html
6867 !! wikitext
6868 {|
6869 |-
6870 |
6871 a
6872 |-
6873 b
6874 |}
6875 !! html/php
6876 <table>
6877
6878 <tr>
6879 <td>
6880 <pre>a
6881 </pre>
6882 </td></tr>
6883 b
6884 </table>
6885
6886 !! html/php+tidy
6887 <p>b</p>
6888 <table>
6889 <tr>
6890 <td>
6891 <pre>
6892 a
6893 </pre></td>
6894 </tr>
6895 </table>
6896 !! html/parsoid
6897 <table>
6898 <tbody>
6899 <tr><td><pre>a</pre></td></tr>
6900 <tr><td> b</td></tr>
6901 </tbody>
6902 </table>
6903 !! end
6904
6905 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6906 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6907 !! test
6908 Lists should be recognized in an implicit <td> context
6909 !! options
6910 parsoid=wt2html,html2html
6911 !! wikitext
6912 {|
6913 |-
6914 *a
6915 |}
6916 !! html/php
6917 <table>
6918
6919 <ul><li>a</li></ul>
6920 </table>
6921
6922 !! html/php+tidy
6923 <ul>
6924 <li>a</li>
6925 </ul>
6926 !! html/parsoid
6927 <table>
6928 <tr>
6929 <td><ul>
6930 <li>a</li>
6931 </ul></td>
6932 </tr>
6933 </table>
6934 !! end
6935
6936 !! test
6937 Table cells not properly parsed in an implicit-td context
6938 !! wikitext
6939 {|
6940 |-
6941 {{table_attribs_4}} || a || b
6942 |}
6943 !! html/php+tidy
6944 <table>
6945 <tr>
6946 <td style="background-color:#DC241f;" width="10px"></td>
6947 <td>a</td>
6948 <td>b</td>
6949 </tr>
6950 </table>
6951 !! html/parsoid
6952 <table>
6953 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6954 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6955 </tbody></table>
6956 !! end
6957
6958 !! test
6959 Parsoid: Round-trip tables directly followed by content (bug 51219)
6960 !! options
6961 parsoid=wt2html,wt2wt
6962 !! wikitext
6963 {|
6964 |foo
6965 |} bar
6966
6967 {|
6968 |baz
6969 |}<b>quux</b>
6970 !! html+tidy
6971 <table>
6972 <tr>
6973 <td>foo</td>
6974 </tr>
6975 </table>
6976 <p>bar</p>
6977 <table>
6978 <tr>
6979 <td>baz</td>
6980 </tr>
6981 </table>
6982 <p><b>quux</b></p>
6983 !! end
6984
6985 !! test
6986 Parsoid: Default to a newline after tables in new content (bug 51219)
6987 !! options
6988 parsoid=html2wt
6989 !! html/parsoid
6990 <table><tbody>
6991 <tr><td>foo</td></tr></tbody></table> bar
6992 <table><tbody>
6993 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6994 !! wikitext
6995 {|
6996 |foo
6997 |}
6998 <nowiki> </nowiki>bar
6999 {|
7000 |baz
7001 |}
7002 '''quux'''
7003 !! end
7004
7005 !! test
7006 Parsoid: newline inducing block nodes don't suppress <nowiki>
7007 !! options
7008 parsoid=html2wt
7009 !! html/parsoid
7010 a<h1>foo</h1>
7011 !! wikitext
7012 <nowiki> </nowiki>a
7013
7014 = foo =
7015 !! end
7016
7017 !! test
7018 Parsoid: Row-syntax table headings followed by comment & table cells
7019 !! options
7020 parsoid=wt2html,wt2wt
7021 !! wikitext
7022 {|
7023 ! foo || bar
7024 <!-- foo --> || baz || quux
7025 |}
7026 !! html/php
7027 <table>
7028 <tr>
7029 <th> foo </th>
7030 <th> bar
7031 </th>
7032 <td> baz </td>
7033 <td> quux
7034 </td></tr></table>
7035
7036 !! html/parsoid
7037 <table>
7038 <tbody><tr><th> foo </th><th> bar
7039 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7040 </tbody></table>
7041 !! end
7042
7043 !!test
7044 Parsoid: Recover better from broken table attributes
7045 !!options
7046 parsoid=wt2html
7047 !!wikitext
7048 {| class="foo
7049 | class="bar" |
7050 foo
7051 |}
7052 !!html/php+tidy
7053 <table class="foo">
7054 <tr>
7055 <td class="bar">
7056 <p>foo</p>
7057 </td>
7058 </tr>
7059 </table>
7060 !!html/parsoid
7061 <table class="foo">
7062 <tr>
7063 <td class="bar">
7064 <p>foo</p></td></tr>
7065 </tbody></table>
7066 !!end
7067
7068 !! test
7069 Tables: Digest broken attributes on table and tr tag
7070 !! options
7071 parsoid=wt2html
7072 !! wikitext
7073 {| || |} ++
7074 |- || || ++ --
7075 |- > [
7076 |}
7077 !! html
7078 <table>
7079 <tbody>
7080 <tr></tr>
7081 <tr></tr>
7082 </tbody></table>
7083 !! end
7084
7085 !! test
7086 Strip unsupported table tags
7087 !! options
7088 parsoid=html2wt
7089 !! html/parsoid
7090 <table>
7091 <thead>
7092 <tr>
7093 <th>Month</th>
7094 <th>Savings</th>
7095 </tr>
7096 </thead>
7097 <tbody>
7098 <tr>
7099 <td>January</td>
7100 <td>$100</td>
7101 </tr>
7102 <tr>
7103 <td>February</td>
7104 <td>$80</td>
7105 </tr>
7106 </tbody>
7107 <tfoot>
7108 <tr>
7109 <td>Sum</td>
7110 <td>$180</td>
7111 </tr>
7112 </tfoot>
7113 </table>
7114 !! wikitext
7115 {|
7116
7117 !Month
7118 !Savings
7119
7120 |January
7121 |$100
7122
7123 |-
7124 |February
7125 |$80
7126
7127 |Sum
7128 |$180
7129
7130 |}
7131 !! end
7132
7133 !! test
7134 Testing serialization after deletion in references
7135 !! options
7136 parsoid={
7137 "modes": ["wt2wt"],
7138 "changes": [
7139 ["#x", "remove"]
7140 ]
7141 }
7142 !! wikitext
7143 hi <ref><div id="x">ho</div></ref>
7144
7145 <references />
7146 !! wikitext/edited
7147 hi <ref></ref>
7148
7149 <references />
7150 !! end
7151
7152 !!test
7153 Testing serialization after deletion of table cells
7154 !!options
7155 parsoid={
7156 "modes": ["wt2wt", "selser"],
7157 "changes": [
7158 ["#x", "remove"]
7159 ]
7160 }
7161 !!wikitext
7162 {|
7163 !h1 !!h2 !!h3
7164 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7165 |}
7166 !! wikitext/edited
7167 {|
7168 !h1 !!h2 !!h3
7169 |c2 |||c3
7170 |}
7171 !!end
7172
7173 ###
7174 ### Internal links
7175 ###
7176 !! test
7177 Plain link, capitalized
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 Plain link, uncapitalized
7187 !! wikitext
7188 [[main Page]]
7189 !! html
7190 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7191 </p>
7192 !! end
7193
7194 !! test
7195 Piped link
7196 !! wikitext
7197 [[Main Page|The Main 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 comment in link text
7205 !! wikitext
7206 [[Main Page|The Main<!--front--> Page]]
7207 !! html
7208 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7209 </p>
7210 !! end
7211
7212 !! test
7213 Piped link with multiple pipe characters in link text
7214 !! wikitext
7215 [[Main Page||The|Main|Page|]]
7216 !! html/php
7217 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7218 </p>
7219 !! html/parsoid
7220 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7221 !! end
7222
7223 !! test
7224 Piped link with no link text
7225 !! wikitext
7226 [[Thomas Bek (bishop of St David's)|]]
7227 !! html/php
7228 <p>[[Thomas Bek (bishop of St David's)|]]
7229 </p>
7230 !! html/parsoid
7231 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7232 !! end
7233
7234 !! test
7235 Broken link
7236 !! wikitext
7237 [[Zigzagzogzagzig]]
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</a>
7240 </p>
7241 !! end
7242
7243 !! test
7244 Broken link with fragment
7245 !! wikitext
7246 [[Zigzagzogzagzig#zug]]
7247 !! html
7248 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7249 </p>
7250 !! end
7251
7252 !! test
7253 Special page link with fragment
7254 !! wikitext
7255 [[Special:Version#anchor]]
7256 !! html
7257 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7258 </p>
7259 !! end
7260
7261 !! test
7262 Nonexistent special page link with fragment
7263 !! wikitext
7264 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7265 !! html
7266 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7267 </p>
7268 !! end
7269
7270 !! test
7271 Link with prefix
7272 !! wikitext
7273 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7274 !! html
7275 <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>
7276 </p>
7277 !! end
7278
7279 !! test
7280 Link with suffix
7281 !! wikitext
7282 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7283 !! html
7284 <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>!!!
7285 </p>
7286 !! end
7287
7288 !! article
7289 prefixed article
7290 !! text
7291 Some text
7292 !! endarticle
7293
7294 !! test
7295 Bug 43661: Piped links with identical prefixes
7296 !! wikitext
7297 [[prefixed article|prefixed articles with spaces]]
7298
7299 [[prefixed article|prefixed articlesaoeu]]
7300
7301 [[Main Page|Main Page test]]
7302 !! html
7303 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7304 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7305 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7306 </p>
7307 !! end
7308
7309
7310 !! test
7311 Link with HTML entity in suffix / tail
7312 !! wikitext
7313 [[Main Page]]&quot;, [[Main Page]]&#97;
7314 !! html/php
7315 <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;
7316 </p>
7317 !! html/parsoid
7318 <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>
7319 !! end
7320
7321 !! test
7322 Link with 3 brackets
7323 !! wikitext
7324 [[[Main Page]]]
7325 Foo [[[Main Page]]]
7326 !! html
7327 <p>[[[Main Page]]]
7328 Foo [[[Main Page]]]
7329 </p>
7330 !! end
7331
7332 !! test
7333 Link with 4 brackets
7334 !! wikitext
7335 [[[[Main Page]]]]
7336 !! html
7337 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7338 </p>
7339 !! end
7340
7341 !! test
7342 Piped link with 3 brackets
7343 !! wikitext
7344 [[[main page|the main page]]]
7345 !! html
7346 <p>[[[main page|the main page]]]
7347 </p>
7348 !! end
7349
7350 !! test
7351 Piped link with extlink-like text
7352 !! wikitext
7353 [[Main Page|[bar]]]
7354 [[Main Page|This is a [bar]]]
7355 !! html/php
7356 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7357 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7358 </p>
7359 !! html/parsoid
7360 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7361 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7362 !! end
7363
7364 !! test
7365 Link with multiple pipes
7366 !! wikitext
7367 [[Main Page|The|Main|Page]]
7368 !! html
7369 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7370 </p>
7371 !! end
7372
7373 # Note that parsoid does not munge anchor text; all non-space
7374 # characters are valid in HTML5 ids.
7375 !! test
7376 Anchor containing a #. (bug 63430)
7377 !! wikitext
7378 [[Main Page#And#Link]]
7379 !! html/php
7380 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7381 </p>
7382 !! html/parsoid
7383 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7384 !! end
7385
7386 !! test
7387 Link to namespaces
7388 !! wikitext
7389 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7390 !! html
7391 <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>
7392 </p>
7393 !! end
7394
7395 !! test
7396 Link with space in namespace
7397 !! wikitext
7398 [[User talk:Foo bar]]
7399 !! html
7400 <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>
7401 </p>
7402 !! end
7403
7404 !! article
7405 MemoryAlpha:AlphaTest
7406 !! text
7407 This is an article in the MemoryAlpha namespace
7408 (which shadows the memoryalpha interwiki link).
7409 !! endarticle
7410
7411 !! test
7412 Namespace takes precedence over interwiki link (bug 51680)
7413 !! wikitext
7414 [[MemoryAlpha:AlphaTest]]
7415 !! html
7416 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7417 </p>
7418 !! end
7419
7420 # The previous test doesn't work correctly in html2*, due to not recognizing the
7421 # link as an internal one. This one checks for the correct behavior.
7422 !! test
7423 Link to namespace preferred over interwiki with correct rel attribute
7424 !! options
7425 parsoid=html2wt,html2html
7426 !! html/parsoid
7427 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7428 !! wikitext
7429 [[MemoryAlpha:AlphaTest]]
7430 !! end
7431
7432 !! test
7433 Piped link to namespace
7434 !! wikitext
7435 [[Meta:Disclaimers|The disclaimers]]
7436 !! html
7437 <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>
7438 </p>
7439 !! end
7440
7441 !! test
7442 Link containing }
7443 !! wikitext
7444 [[Usually caused by a typo (oops}]]
7445 !! html
7446 <p>[[Usually caused by a typo (oops}]]
7447 </p>
7448 !! end
7449
7450 !! article
7451 7% Solution
7452 !! text
7453 Just a test of an article title containing a percent.
7454 !! endarticle
7455
7456 !! test
7457 Link containing % (not as a hex sequence)
7458 !! wikitext
7459 [[7% Solution]]
7460 !! html/php
7461 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7462 </p>
7463 !! html/parsoid
7464 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7465 !! end
7466
7467 # note that the parsoid HTML is identical to the previous test output,
7468 # so the previous test ensures that the html2wt mode will generate the
7469 # "not as a hex sequence" wikitext.
7470 !! test
7471 Link containing % as a single hex sequence interpreted to char
7472 !! options
7473 parsoid=wt2wt,wt2html,html2html
7474 !! wikitext
7475 [[7%25 Solution]]
7476 !! html/php
7477 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7478 </p>
7479 !! html/parsoid
7480 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7481 !!end
7482
7483 !! test
7484 Link containing % as a double hex sequence interpreted to hex sequence
7485 !! wikitext
7486 [[7%2525 Solution]]
7487 !! html
7488 <p>[[7%2525 Solution]]
7489 </p>
7490 !!end
7491
7492 # note that parsoid does not munge anchor text; all non-space
7493 # characters are valid in HTML5 anchors.
7494 !! test
7495 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7496 Example for such a section: == < ==
7497 !! wikitext
7498 [[%23%3c]][[%23%3e]]
7499 !! html/php
7500 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7501 </p>
7502 !! html/parsoid
7503 <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>
7504 !! end
7505
7506 !! test
7507 Link containing "<#" and ">#" as a hex sequences
7508 !! wikitext
7509 [[%3c%23]][[%3e%23]]
7510 !! html
7511 <p>[[%3c%23]][[%3e%23]]
7512 </p>
7513 !! end
7514
7515 !! test
7516 Link containing an equals sign
7517 !! wikitext
7518 [[Special:BookSources/isbn=4-00-026157-6]]
7519 !! html/php
7520 <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>
7521 </p>
7522 !! html/parsoid
7523 <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>
7524 !! end
7525
7526 !! article
7527 Foo~bar
7528 !! text
7529 Just a test of an article title containing a tilde.
7530 !! endarticle
7531
7532 # note that links containing signatures, like [[Foo~~~~]], are
7533 # massaged by the pre-save transform (PST) and so the tildes are never
7534 # seen by the parser.
7535 !! test
7536 Link containing a tilde
7537 !! wikitext
7538 [[Foo~bar]]
7539 !! html/php
7540 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7541 </p>
7542 !! html/parsoid
7543 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7544 !! end
7545
7546 !! test
7547 Link containing double-single-quotes '' (bug 4598)
7548 !! wikitext
7549 [[Lista d''e paise d''o munno]]
7550 !! html/php
7551 <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>
7552 </p>
7553 !! html/parsoid
7554 <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>
7555 !! end
7556
7557 !! test
7558 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7559 !! wikitext
7560 Some [[Link|pretty ''italics'' and stuff]]!
7561 !! html/php
7562 <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>!
7563 </p>
7564 !! html/parsoid
7565 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7566 !! end
7567
7568 !! test
7569 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7570 !! wikitext
7571 ''Some [[Link|pretty ''italics'' and stuff]]!''
7572 !! html
7573 <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>
7574 </p>
7575 !! end
7576
7577 !! test
7578 Link with double quotes in title part (literal) and alternate part (interpreted)
7579 !! wikitext
7580 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7581
7582 [[''Pentecoste'']]
7583
7584 [[''Pentecoste''|Pentecoste]]
7585
7586 [[''Pentecoste''|''Pentecoste'']]
7587 !! html/php
7588 <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>
7589 </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>
7590 </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>
7591 </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>
7592 </p>
7593 !! html/parsoid
7594 <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>
7595 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7596 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7597 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7598 !! end
7599
7600 !! test
7601 Broken image links with HTML captions (bug 39700)
7602 !! wikitext
7603 [[File:Nonexistent|<script></script>]]
7604 [[File:Nonexistent|100x100px|<script></script>]]
7605 [[File:Nonexistent|&lt;]]
7606 [[File:Nonexistent|a<i>b</i>c]]
7607 !! html/php
7608 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7609 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7610 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7611 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7612 </p>
7613 !! html/parsoid
7614 <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>
7615 <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>
7616 <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>
7617 <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>
7618 !! end
7619
7620 !! test
7621 Plain link to URL
7622 !! wikitext
7623 [[http://www.example.com]]
7624 !! html/php
7625 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7626 </p>
7627 !! html/parsoid
7628 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7629 !! end
7630
7631 !! test
7632 Plain link to URL with link text
7633 !! wikitext
7634 [[http://www.example.com Link text]]
7635 !! html
7636 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7637 </p>
7638 !! end
7639
7640 !! test
7641 Plain link to protocol-relative URL
7642 !! wikitext
7643 [[//www.example.com]]
7644 !! html/php
7645 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7646 </p>
7647 !! html/parsoid
7648 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7649 !! end
7650
7651 !! test
7652 Plain link to protocol-relative URL with link text
7653 !! wikitext
7654 [[//www.example.com Link text]]
7655 !! html
7656 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7657 </p>
7658 !! end
7659
7660 !! test
7661 Plain link to page with question mark in title
7662 !! wikitext
7663 [[A?b]]
7664
7665 [[A?b|Baz]]
7666 !! html
7667 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7668 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7669 </p>
7670 !! end
7671
7672
7673 # I'm fairly sure the expected result here is wrong.
7674 # We want these to be URL links, not pseudo-pages with URLs for titles....
7675 # However the current output is also pretty screwy.
7676 #
7677 # ----
7678 # I'm changing it to match the current output--it arguably makes more
7679 # sense in the light of the test above. Old expected result was:
7680 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7681 #</p>
7682 # But I think this test is bordering on "garbage in, garbage out" anyway.
7683 # -- wtm
7684 !! test
7685 Piped link to URL
7686 !! wikitext
7687 Piped link to URL: [[http://www.example.com|an example URL]]
7688 !! html/php
7689 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7690 </p>
7691 !! html/parsoid
7692 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7693 !! end
7694
7695 !! test
7696 BUG 2: [[page|http://url/]] should link to page, not http://url/
7697 !! wikitext
7698 [[Main Page|http://url/]]
7699 !! html/php
7700 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7701 </p>
7702 !! html/parsoid
7703 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7704 !! end
7705
7706 # Parsoid does not mark self-links, by design.
7707 !! test
7708 BUG 337: Escaped self-links should be bold
7709 !! options
7710 title=[[Bug462]]
7711 !! wikitext
7712 [[Bu&#103;462]] [[Bug462]]
7713 !! html/php
7714 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7715 </p>
7716 !! html/php+tidy
7717 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7718 !! html/parsoid
7719 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7720 !! end
7721
7722 !! test
7723 Self-link to section should not be bold
7724 !! options
7725 title=[[Main Page]]
7726 !! wikitext
7727 [[Main Page#section]]
7728 !! html
7729 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7730 </p>
7731 !! end
7732
7733 !! article
7734 00
7735 !! text
7736 This is 00.
7737 !! endarticle
7738
7739 !!test
7740 Self-link to numeric title
7741 !!options
7742 title=[[0]]
7743 !! wikitext
7744 [[0]]
7745 !! html
7746 <p><strong class="selflink">0</strong>
7747 </p>
7748 !!end
7749
7750 !!test
7751 Link to numeric-equivalent title
7752 !!options
7753 title=[[0]]
7754 !! wikitext
7755 [[00]]
7756 !! html
7757 <p><a href="/wiki/00" title="00">00</a>
7758 </p>
7759 !!end
7760
7761 !! test
7762 <nowiki> inside a link
7763 !! wikitext
7764 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7765 !! html
7766 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7767 </p>
7768 !! end
7769
7770 !! test
7771 Non-breaking spaces in title
7772 !! wikitext
7773 [[&nbsp; Main &nbsp; Page &nbsp;]]
7774 !! html
7775 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7776 </p>
7777 !!end
7778
7779 !! test
7780 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7781 !! options
7782 language=ca
7783 !! wikitext
7784 '''[[Main Page]]'''
7785 !! html
7786 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7787 </p>
7788 !! end
7789
7790 !! test
7791 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7792 !! options
7793 language=ca
7794 !! wikitext
7795 ''[[Main Page]]''
7796 !! html
7797 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7798 </p>
7799 !! end
7800
7801 !! test
7802 Internal link with en linktrail: no apostrophes (bug 27473)
7803 !! options
7804 language=en
7805 !! wikitext
7806 [[Something]]'nice
7807 !! html
7808 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7809 </p>
7810 !! end
7811
7812 !! test
7813 Internal link with ca linktrail with apostrophes (bug 27473)
7814 !! options
7815 language=ca
7816 !! wikitext
7817 [[Something]]'nice
7818 !! html
7819 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7820 </p>
7821 !! end
7822
7823 !! test
7824 Internal link with kaa linktrail with apostrophes (bug 27473)
7825 !! options
7826 language=kaa
7827 !! wikitext
7828 [[Something]]'nice
7829 !! html
7830 <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>
7831 </p>
7832 !! end
7833
7834 !! test
7835 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7836 !! wikitext
7837 [[User:Foo/Test/63636:Bar|Test]]
7838 !! html/php
7839 <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>
7840 </p>
7841 !! html/parsoid
7842 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7843 !! end
7844
7845 !! test
7846 Purely hash wikilink
7847 !! options
7848 title=[[User:test/123]]
7849 !! wikitext
7850 [[#a|b]]
7851 !! html/php
7852 <p><a href="#a">b</a>
7853 </p>
7854 !! html/parsoid
7855 <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>
7856 !! end
7857
7858 !! test
7859 1. Interaction of linktrail and template encapsulation
7860 !! options
7861 parsoid
7862 !! wikitext
7863 {{echo|[[Foo]]}}l
7864 !! html
7865 <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>
7866 !! end
7867
7868 !! test
7869 2. Interaction of linktrail and template encapsulation
7870 !! options
7871 parsoid
7872 !! wikitext
7873 {{echo|Some [[Fool]]}}s
7874 !! html
7875 <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>
7876 !! end
7877
7878 !! test
7879 3. Interaction of linktrail and template encapsulation
7880 !! options
7881 parsoid
7882 !! wikitext
7883 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7884 !! html
7885 <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>
7886 !! end
7887
7888 !! article
7889 Söfnuður
7890 !! text
7891 Test.
7892 !! endarticle
7893
7894 !! test
7895 Internal link with is link prefix
7896 !! options
7897 language=is
7898 !! wikitext
7899 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7900 !! html
7901 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7902 </p>
7903 !! end
7904
7905 !! article
7906 Mótmælendatrú
7907 !! text
7908 Test.
7909 !! endarticle
7910
7911 !! test
7912 Internal link with is link trail and link prefix
7913 !! options
7914 language=is
7915 !! wikitext
7916 [[mótmælendatrú|xxx]]ar
7917 [[mótmælendatrú]]ar
7918 mótmælenda[[söfnuður]]
7919 mótmælenda[[söfnuður|söfnuðir]]
7920 mótmælenda[[söfnuður|söfnuðir]]xxx
7921 !! html
7922 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7923 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7924 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7925 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7926 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Parsoid link trail escaping
7932 !! options
7933 parsoid=html2wt,html2html
7934 !! html/parsoid
7935 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7936 !! wikitext
7937 [[apple]]<nowiki/>s
7938 !! end
7939
7940 !! test
7941 Parsoid link prefix escaping
7942 !! options
7943 language=is
7944 parsoid=html2wt,html2html
7945 !! html/parsoid
7946 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7947 !! wikitext
7948 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7949 !! end
7950
7951 !! test
7952 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7953 !! wikitext
7954 [[Foo| bar]]
7955
7956 [[Foo| ''bar'']]
7957
7958 [http://wp.org foo]
7959
7960 [http://wp.org ''foo'']
7961 !! html
7962 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7963 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7964 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7965 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7966 </p>
7967 !! end
7968
7969 !! test
7970 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7971 !! options
7972 parsoid
7973 !! wikitext
7974 [[Foo|{{echo|a}} b {{echo|c}}]]
7975 !! html
7976 <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>
7977 !! end
7978
7979 !! test
7980 Link with angle bracket after anchor
7981 !! wikitext
7982 [[Foo#<bar>]]
7983 !! html/php
7984 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7985 </p>
7986 !! html/parsoid
7987 <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>
7988 !! end
7989
7990 ###
7991 ### Interwiki links (see maintenance/interwiki.sql)
7992 ###
7993
7994 !! test
7995 Inline interwiki link
7996 !! options
7997 parsoid=wt2html,wt2wt,html2html
7998 !! wikitext
7999 [[MeatBall:SoftSecurity]]
8000 !! html/php
8001 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8002 </p>
8003 !! html/parsoid
8004 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8005 !! end
8006
8007 !! test
8008 Inline interwiki link with empty title (bug 2372)
8009 !! options
8010 parsoid=wt2html,wt2wt,html2html
8011 !! wikitext
8012 [[MeatBall:]]
8013 !! html/php
8014 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8015 </p>
8016 !! html/parsoid
8017 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8018 !! end
8019
8020 !! test
8021 Interwiki link encoding conversion (bug 1636)
8022 !! wikitext
8023 *[[Wikipedia:ro:Olteni&#0355;a]]
8024 *[[Wikipedia:ro:Olteni&#355;a]]
8025 !! html
8026 <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>
8027 <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>
8028
8029 !! html+tidy
8030 <ul>
8031 <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>
8032 <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>
8033 </ul>
8034 !! end
8035
8036 !! test
8037 Interwiki link with fragment (bug 2130)
8038 !! wikitext
8039 [[MeatBall:SoftSecurity#foo]]
8040 !! html
8041 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8042 </p>
8043 !! end
8044
8045 # Ideally the wikipedia: prefix here should be proto-relative too
8046 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8047 # define the 'en' prefix, and originally the test used 'wikipedia',
8048 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8049 # article.
8050 !! test
8051 Different interwiki prefixes mapping to the same URL
8052 !! wikitext
8053 [[:en:Foo]]
8054
8055 [[:en:Foo|Foo]]
8056
8057 [[wikipedia:Foo]]
8058
8059 [[:wikipedia:Foo|Foo]]
8060
8061 [[wikipedia:en:Foo]]
8062
8063 [[:wikipedia:en:Foo]]
8064
8065 [[ wikiPEdia :Foo]]
8066 !! html/parsoid
8067 <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>
8068
8069 <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>
8070
8071 <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>
8072
8073 <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>
8074
8075 <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>
8076
8077 <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>
8078
8079 <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>
8080 !! end
8081
8082 !! test
8083 Interwiki links that cannot be represented in wiki syntax
8084 !! wikitext
8085 [[meatball:ok]]
8086 [[meatball:ok#foo|ok with fragment]]
8087 [[meatball:ok_as_well?|ok ending with ? mark]]
8088 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8089 [http://de.wikipedia.org/wiki/#foo is just fragment]
8090
8091 !! html/php
8092 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8093 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8094 <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>
8095 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8096 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8097 </p>
8098 !! html/parsoid
8099 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8100 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8101 <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>
8102 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8103 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8104 !! end
8105
8106 !! test
8107 Interwiki links: trail
8108 !! wikitext
8109 [[wikipedia:Foo|Ba]]r
8110 !! html/php
8111 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8112 </p>
8113 !! html/parsoid
8114 <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>
8115 !! end
8116
8117 !! test
8118 Local interwiki link
8119 !! options
8120 parsoid=wt2html,wt2wt,html2html
8121 !! wikitext
8122 [[local:Template:Foo]]
8123 !! html/php
8124 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8125 </p>
8126 !! html/parsoid
8127 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8128 !! end
8129
8130 # Parsoid does not mark self-links, by design.
8131 !! test
8132 Local interwiki link: self-link to current page
8133 !! options
8134 title=[[Main Page]]
8135 parsoid=wt2html,wt2wt,html2html
8136 !! wikitext
8137 [[local:Main Page]]
8138 !! html/php
8139 <p><strong class="selflink">local:Main Page</strong>
8140 </p>
8141 !! html/parsoid
8142 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8143 !! end
8144
8145 !! test
8146 Local interwiki link: prefix only (bug 64167)
8147 !! options
8148 parsoid=wt2html,wt2wt,html2html
8149 !! wikitext
8150 [[local:]]
8151 !! html/php
8152 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8153 </p>
8154 !! html/parsoid
8155 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8156 !! end
8157
8158 !! test
8159 Local interwiki link: with additional interwiki prefix (bug 61357)
8160 !! options
8161 parsoid=wt2html,wt2wt,html2html
8162 !! wikitext
8163 [[local:meatball:Hello]]
8164 !! html/php
8165 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8166 </p>
8167 !! html/parsoid
8168 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8169 !! end
8170
8171 !! test
8172 Multiple local interwiki link prefixes
8173 !! wikitext
8174 [[local:local:local:local:mi:local:Foo]]
8175 !! options
8176 parsoid=wt2html,wt2wt,html2html
8177 !! html/php
8178 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8179 </p>
8180 !! html/parsoid
8181 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8182 !! end
8183
8184 ###
8185 ### Interlanguage links
8186 ### Language links (so that searching for '### language' matches..)
8187 ###
8188
8189 !! test
8190 Interlanguage link
8191 !! options
8192 parsoid=wt2html,wt2wt,html2html
8193 !! wikitext
8194 Blah blah blah
8195 [[zh:Chinese]]
8196 !! html/php
8197 <p>Blah blah blah
8198 </p>
8199 !! html/parsoid
8200 <p>Blah blah blah</p>
8201 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8202 !! end
8203
8204 !! test
8205 Interlanguage link with spacing
8206 !! options
8207 parsoid=wt2html,wt2wt,html2html
8208 !! wikitext
8209 Blah blah blah
8210 [[ zh : Chinese ]]
8211 !! html/php
8212 <p>Blah blah blah
8213 </p>
8214 !! html/parsoid
8215 <p>Blah blah blah</p>
8216 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8217 !! end
8218
8219 !! test
8220 Double interlanguage link
8221 !! options
8222 parsoid=wt2html,wt2wt,html2html
8223 !! wikitext
8224 Blah blah blah
8225 [[es:Spanish]]
8226 [[zh:Chinese]]
8227 !! html/php
8228 <p>Blah blah blah
8229 </p>
8230 !! html/parsoid
8231 <p>Blah blah blah</p>
8232 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8233 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8234 !! end
8235
8236 !! test
8237 Interlanguage link variations
8238 !! options
8239 parsoid=wt2html,wt2wt,html2html
8240 !! wikitext
8241 Blah blah blah
8242 [[ es :Spanish]]
8243 [[ ZH :Chinese]]
8244 [[es:Foo_bar]]
8245 !! html/php
8246 <p>Blah blah blah
8247 </p>
8248 !! html/parsoid
8249 <p>Blah blah blah</p>
8250 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8251 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8252 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8253 !! end
8254
8255 !! test
8256 Space and question mark encoding in interlanguage links (T95473)
8257 !! options
8258 parsoid=wt2html,wt2wt,html2html
8259 !! wikitext
8260 Blah blah blah
8261 [[es:Foo bar?]]
8262 !! html/php
8263 <p>Blah blah blah
8264 </p>
8265 !! html/parsoid
8266 <p>Blah blah blah</p>
8267 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8268 !! end
8269
8270 !! test
8271 Interlanguage link, with prefix links
8272 !! options
8273 language=ln
8274 !! wikitext
8275 Blah blah blah
8276 [[zh:Chinese]]
8277 !! html/php
8278 <p>Blah blah blah
8279 </p>
8280 !! html/parsoid
8281 <p>Blah blah blah</p>
8282 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8283 !! end
8284
8285 !! test
8286 Double interlanguage link, with prefix links (bug 8897)
8287 !! options
8288 language=ln
8289 !! wikitext
8290 Blah blah blah
8291 [[es:Spanish]]
8292 [[zh:Chinese]]
8293 !! html/php
8294 <p>Blah blah blah
8295 </p>
8296 !! html/parsoid
8297 <p>Blah blah blah</p>
8298 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8299 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8300 !! end
8301
8302 !! test
8303 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8304 !! wikitext
8305 Blah blah blah
8306 [[mul:Article]]
8307 !! html/php
8308 <p>Blah blah blah
8309 </p>
8310 !! html/parsoid
8311 <p>Blah blah blah</p>
8312 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8313 !! end
8314
8315 !! test
8316 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8317 !! options
8318 language=ln
8319 !! wikitext
8320 [[WW&nbsp;II]]
8321 !! html
8322 <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>
8323 </p>
8324 !! end
8325
8326 !! test
8327 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8328 !! options
8329 parsoid=html2wt
8330 !! html/parsoid
8331 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8332 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8333 !! wikitext
8334 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8335
8336 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8337 !! end
8338
8339 !! test
8340 Parsoid: handle constructor well
8341 !! wikitext
8342 [[constructor]]
8343
8344 [[constructor:foo]]
8345 !! html/php
8346 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8347 </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>
8348 </p>
8349 !! html/parsoid
8350 <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>
8351
8352 <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>
8353 !! end
8354
8355 !! article
8356 ko:
8357 !! text
8358 Test.
8359 !! endarticle
8360
8361 # Note that `ko` isn't a known interlanguage prefix
8362 !! test
8363 Parsoid: recognize interlanguage links without a target page
8364 !! options
8365 ill
8366 !! wikitext
8367 [[es:]]
8368
8369 [[ko:]]
8370 !! html/php
8371 es:
8372 !! html/parsoid
8373 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8374
8375 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8376 !! end
8377
8378 # Note that `ko` isn't a known interwiki prefix
8379 !! test
8380 Parsoid: recognize interwiki links without a target page
8381 !! options
8382 parsoid=wt2html,wt2wt,html2html
8383 !! wikitext
8384 [[:es:]]
8385
8386 [[:ko:]]
8387 !! html/php
8388 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8389 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8390 </p>
8391 !! html/parsoid
8392 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8393 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8394 !! end
8395
8396 !! test
8397 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8398 !! wikitext
8399 [[mi:Foo]]
8400 !! html/php
8401 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8402 </p>
8403 !! html/parsoid
8404 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8405 !! end
8406
8407 !! test
8408 Interlanguage link with preceding local interwiki link (bug 68085)
8409 !! options
8410 parsoid=wt2html,wt2wt,html2html
8411 !! wikitext
8412 Blah blah blah
8413 [[local:es:Spanish]]
8414 !! html/php
8415 <p>Blah blah blah
8416 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8417 </p>
8418 !! html/parsoid
8419 <p>Blah blah blah
8420 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8421 !! end
8422
8423 !! test
8424 Looks like an interlanguage link, but is actually a local interwiki
8425 !! options
8426 parsoid=wt2html,wt2wt,html2html
8427 !! wikitext
8428 Blah blah blah
8429 [[mi:Template:Foo]]
8430 !! html/php
8431 <p>Blah blah blah
8432 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8433 </p>
8434 !! html/parsoid
8435 <p>Blah blah blah
8436 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8437 !! end
8438
8439 ###
8440 ### Redirects, Parsoid-only
8441 ###
8442
8443 !! test
8444 1. Simple redirect to page
8445 !! wikitext
8446 #REDIRECT [[Main Page]]
8447 !! html/parsoid
8448 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8449 !! end
8450
8451 !! test
8452 2. Other redirect variants
8453 !! wikitext
8454 #REDIRECT [[Main_Page]]
8455 !! html/parsoid
8456 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8457 !! end
8458
8459 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8460 # This tests the Parsoid bail-out code.
8461 !! test
8462 3. Other redirect variants
8463 !! wikitext
8464 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8465 !! html/parsoid
8466 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8467 !! end
8468
8469 !! test
8470 4. Redirect to a templated destination
8471 !! wikitext
8472 #REDIRECT [[{{echo|Foo}}bar]]
8473 !! html/parsoid
8474 <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"}]]}'/>
8475 !! end
8476
8477 !! test
8478 Empty redirect
8479 !! options
8480 parsoid=wt2html,wt2wt
8481 !! wikitext
8482 #REDIRECT [[]]
8483 !! html/parsoid
8484 <ol>
8485 <li>REDIRECT [[]]</li></ol>
8486 !! end
8487
8488 !! test
8489 Optional colon in #REDIRECT
8490 !! options
8491 # the colon is archaic syntax. we support it for wt2html, but we
8492 # don't care that it roundtrips back to the modern syntax.
8493 parsoid=wt2html,html2html
8494 !! wikitext
8495 #REDIRECT:[[Main Page]]
8496 !! html/parsoid
8497 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8498 !! end
8499
8500 !! test
8501 Whitespace in #REDIRECT with optional colon
8502 !! options
8503 # the colon and gratuitous whitespace is archaic syntax. we support
8504 # it for wt2html, but we don't care that it roundtrips back to the
8505 # modern syntax (without extra whitespace)
8506 parsoid=wt2html,html2html
8507 !! wikitext
8508
8509 #REDIRECT
8510 :
8511 [[Main Page]]
8512 !! html/parsoid
8513 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8514 !! end
8515
8516 !! test
8517 Piped link in #REDIRECT
8518 !! options
8519 # content after piped link is ignored. we support this syntax,
8520 # but don't care that the piped link is lost when we roundtrip this.
8521 parsoid=wt2html
8522 !! wikitext
8523 #REDIRECT [[Main Page|bar]]
8524 !! html/parsoid
8525 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8526 !! end
8527
8528 !! test
8529 Redirect to category (T104502)
8530 !! options
8531 parsoid=wt2html,wt2wt
8532 !! wikitext
8533 #REDIRECT [[Category:Foo]]
8534 !! html/parsoid
8535 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8536 !! end
8537
8538 !! test
8539 Redirect to category with URL encoding (T104502)
8540 !! options
8541 parsoid=wt2html
8542 !! wikitext
8543 #REDIRECT [[Category%3AFoo]]
8544 !! html/parsoid
8545 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8546 !! end
8547
8548 !! test
8549 Redirect to category page
8550 !! wikitext
8551 #REDIRECT [[:Category:Foo]]
8552 !! html/parsoid
8553 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8554 !! end
8555
8556 !! test
8557 Redirect to image page (1)
8558 !! wikitext
8559 #REDIRECT [[File:Wiki.png]]
8560 !! html/parsoid
8561 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8562 !! end
8563
8564 !! test
8565 Redirect to image page (2)
8566 !! wikitext
8567 #REDIRECT [[Image:Wiki.png]]
8568 !! html/parsoid
8569 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8570 !! end
8571
8572 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8573 # Next test confirms this.
8574 !! test
8575 Redirect to language (1) (T104918)
8576 !! options
8577 parsoid=wt2html,wt2wt,html2html
8578 !! wikitext
8579 #REDIRECT [[en:File:Wiki.png]]
8580 !! html/parsoid
8581 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8582 !! end
8583
8584 !! test
8585 Redirect to language (2) (T104918)
8586 !! wikitext
8587 #REDIRECT [[:en:File:Wiki.png]]
8588 !! html/parsoid
8589 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8590 !! end
8591
8592 !! test
8593 Redirect to interwiki (T104918)
8594 !! wikitext
8595 #REDIRECT [[meatball:File:Wiki.png]]
8596 !! html/parsoid
8597 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8598 !! end
8599
8600 !! test
8601 Non-English #REDIRECT
8602 !! options
8603 language=is
8604 !! wikitext
8605 #TILVÍSUN [[Main Page]]
8606 !! html/parsoid
8607 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8608 !! end
8609
8610 !! test
8611 Redirect syntax under text isn't considered a redirect
8612 !! wikitext
8613 some text
8614 #redirect [[Main Page]]
8615 !! html/parsoid
8616 <p>some text</p>
8617 <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>
8618 !! end
8619
8620 # FIXME: Should hoist the redirect to the top of the page and ensure there
8621 # is only one.
8622 !! test
8623 New redirect
8624 !! options
8625 parsoid=html2wt
8626 !! html/parsoid
8627 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8628 !! wikitext
8629 Foo
8630 #REDIRECT [[Foo]]
8631 !! end
8632
8633 ##
8634 ## XHTML tidiness
8635 ###
8636
8637 !! test
8638 <br> to <br />
8639 !! wikitext
8640 1<br>2<br />3
8641 !! html
8642 <p>1<br />2<br />3
8643 </p>
8644 !! end
8645
8646 !! test
8647 Broken br tag sanitization
8648 !! wikitext
8649 </br>
8650 !! html/php
8651 <p>&lt;/br&gt;
8652 </p>
8653 !! end
8654
8655 # TODO: Fix html2html mode (bug 51055)!
8656 !! test
8657 Parsoid: Broken br tag recognition
8658 !! options
8659 parsoid=wt2html
8660 !! wikitext
8661 </br>
8662
8663 <br/ >
8664 !! html+tidy
8665 <p><br /></p>
8666 <p><br /></p>
8667 !! end
8668
8669 !! test
8670 Incorrecly removing closing slashes from correctly formed XHTML
8671 !! wikitext
8672 <br style="clear:both;" />
8673 !! html
8674 <p><br style="clear:both;" />
8675 </p>
8676 !! end
8677
8678 !! test
8679 Failing to transform badly formed HTML into correct XHTML
8680 !! wikitext
8681 <br style="clear: left;">
8682 <br style="clear: right;">
8683 <br style="clear: both;">
8684 !! html
8685 <p><br style="clear: left;" />
8686 <br style="clear: right;" />
8687 <br style="clear: both;" />
8688 </p>
8689 !!end
8690
8691 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8692 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8693 !! test
8694 Handling html with a div self-closing tag
8695 !! wikitext
8696 <div title />
8697 <div title/>
8698 <div title/ >
8699 <div title=bar />
8700 <div title=bar/>
8701 <div title=bar/ >
8702 !! html/php
8703 <p>&lt;div title /&gt;
8704 &lt;div title/&gt;
8705 </p>
8706 <div>
8707 <p>&lt;div title=bar /&gt;
8708 &lt;div title=bar/&gt;
8709 </p>
8710 <div title="bar/"></div>
8711 </div>
8712
8713 !! html/parsoid
8714 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8715 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8716 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8717 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8718 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8719 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8720 !! end
8721
8722 !! test
8723 Handling html with a br self-closing tag
8724 !! wikitext
8725 <br title />
8726 <br title/>
8727 <br title/ >
8728 <br title=bar />
8729 <br title=bar/>
8730 <br title=bar/ >
8731 !! html/php
8732 <p><br title="" />
8733 <br title="" />
8734 <br />
8735 <br title="bar" />
8736 <br title="bar" />
8737 <br title="bar/" />
8738 </p>
8739 !! html/parsoid
8740 <p><br title="" />
8741 <br title="" />
8742 <br title="" />
8743 <br title="bar" />
8744 <br title="bar" />
8745 <br title="bar/" />
8746 </p>
8747 !! end
8748
8749 !! test
8750 Horizontal ruler (should it add that extra space?)
8751 !! wikitext
8752 <hr>
8753 <hr >
8754 foo <hr
8755 > bar
8756 !! html+tidy
8757 <hr />
8758 <hr />
8759 <p>foo</p>
8760 <hr />
8761 <p>bar</p>
8762 !! end
8763
8764 !! test
8765 Horizontal ruler -- 4+ dashes render hr
8766 !! wikitext
8767 ----
8768 !! html
8769 <hr />
8770
8771 !! end
8772
8773 !! test
8774 Horizontal ruler -- eats additional dashes on the same line
8775 !! wikitext
8776 ---------
8777 !! html
8778 <hr />
8779
8780 !! end
8781
8782 !! test
8783 Horizontal ruler -- does not collapse dashes on consecutive lines
8784 !! wikitext
8785 ----
8786 ----
8787 !! html
8788 <hr />
8789 <hr />
8790
8791 !! end
8792
8793 !! test
8794 Horizontal ruler -- <4 dashes render as plain text
8795 !! wikitext
8796 ---
8797 !! html
8798 <p>---
8799 </p>
8800 !! end
8801
8802 !! test
8803 Horizontal ruler -- Supports content following dashes on same line
8804 !! wikitext
8805 ---- Foo
8806 !! html
8807 <hr /> Foo
8808
8809 !! html+tidy
8810 <hr />
8811 <p>Foo</p>
8812 !! end
8813
8814 ###
8815 ### Block-level elements
8816 ###
8817 !! test
8818 Common list
8819 !! wikitext
8820 *Common list
8821 * item 2
8822 *item 3
8823 !! html
8824 <ul><li>Common list</li>
8825 <li> item 2</li>
8826 <li>item 3</li></ul>
8827
8828 !! end
8829
8830 !! test
8831 Numbered list
8832 !! wikitext
8833 #Numbered list
8834 #item 2
8835 # item 3
8836 !! html
8837 <ol><li>Numbered list</li>
8838 <li>item 2</li>
8839 <li> item 3</li></ol>
8840
8841 !! end
8842
8843 !! test
8844 Mixed list
8845 !! wikitext
8846 *Mixed list
8847 *# with numbers
8848 ** and bullets
8849 *# and numbers
8850 *bullets again
8851 **bullet level 2
8852 ***bullet level 3
8853 ***#Number on level 4
8854 **bullet level 2
8855 **#Number on level 3
8856 **#Number on level 3
8857 *#number level 2
8858 *Level 1
8859 *** Level 3
8860 #** Level 3, but ordered
8861 !! html
8862 <ul><li>Mixed list
8863 <ol><li> with numbers</li></ol>
8864 <ul><li> and bullets</li></ul>
8865 <ol><li> and numbers</li></ol></li>
8866 <li>bullets again
8867 <ul><li>bullet level 2
8868 <ul><li>bullet level 3
8869 <ol><li>Number on level 4</li></ol></li></ul></li>
8870 <li>bullet level 2
8871 <ol><li>Number on level 3</li>
8872 <li>Number on level 3</li></ol></li></ul>
8873 <ol><li>number level 2</li></ol></li>
8874 <li>Level 1
8875 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8876 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8877
8878 !! end
8879
8880 !! test
8881 1. Nested mixed wikitext and html list
8882 !! wikitext
8883 * hi
8884 * <ul><li>ho</li></ul>
8885 * hi
8886 ** ho
8887 !! html/php
8888 <ul><li> hi</li>
8889 <li> <ul><li>ho</li></ul></li>
8890 <li> hi
8891 <ul><li> ho</li></ul></li></ul>
8892
8893 !! html/parsoid
8894 <ul><li> hi</li>
8895 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8896 <li> hi
8897 <ul><li> ho</li></ul></li></ul>
8898 !! end
8899
8900 !! test
8901 2. Nested mixed wikitext and html list (incompatible)
8902 !! wikitext
8903 ; hi
8904 : {{echo|<li>ho</li>}}
8905 !! html/php
8906 <dl><dt> hi</dt>
8907 <dd> <li>ho</li></dd></dl>
8908
8909 !! html/parsoid
8910 <dl><dt> hi</dt>
8911 <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>
8912 !! end
8913
8914 !! test
8915 Nested lists 1
8916 !! wikitext
8917 *foo
8918 **bar
8919 !! html
8920 <ul><li>foo
8921 <ul><li>bar</li></ul></li></ul>
8922
8923 !! end
8924
8925 !! test
8926 Nested lists 2
8927 !! wikitext
8928 **foo
8929 *bar
8930 !! html
8931 <ul><li><ul><li>foo</li></ul></li>
8932 <li>bar</li></ul>
8933
8934 !! end
8935
8936 !! test
8937 Nested lists 3 (first element empty)
8938 !! wikitext
8939 *
8940 **bar
8941 !! html
8942 <ul><li>
8943 <ul><li>bar</li></ul></li></ul>
8944
8945 !! end
8946
8947 !! test
8948 Nested lists 4 (first element empty)
8949 !! wikitext
8950 **
8951 *bar
8952 !! html
8953 <ul><li><ul><li></li></ul></li>
8954 <li>bar</li></ul>
8955
8956 !! end
8957
8958 !! test
8959 Nested lists 5 (both elements empty)
8960 !! wikitext
8961 **
8962 *
8963 !! html
8964 <ul><li><ul><li></li></ul></li>
8965 <li></li></ul>
8966
8967 !! end
8968
8969 !! test
8970 Nested lists 6 (both elements empty)
8971 !! wikitext
8972 *
8973 **
8974 !! html
8975 <ul><li>
8976 <ul><li></li></ul></li></ul>
8977
8978 !! end
8979
8980 !! test
8981 Nested lists 7 (skip initial nesting levels)
8982 !! wikitext
8983 *** foo
8984 !! html
8985 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8986
8987 !! end
8988
8989 !! test
8990 Nested lists 8 (multiple nesting transitions)
8991 !! wikitext
8992 * foo
8993 *** bar
8994 ** baz
8995 * boo
8996 !! html
8997 <ul><li> foo
8998 <ul><li><ul><li> bar</li></ul></li>
8999 <li> baz</li></ul></li>
9000 <li> boo</li></ul>
9001
9002 !! end
9003
9004 !! test
9005 Nested lists 9 (extension interaction)
9006 !! options
9007 parsoid
9008 !! wikitext
9009 *<references />
9010 !! html/parsoid
9011 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9012 !! end
9013
9014 !! test
9015 1. Lists with start-of-line-transparent tokens before bullets: Comments
9016 !! wikitext
9017 *foo
9018 *<!--cmt-->bar
9019 <!--cmt-->*baz
9020 !! html
9021 <ul><li>foo</li>
9022 <li>bar</li>
9023 <li>baz</li></ul>
9024
9025 !! end
9026
9027 !! test
9028 2. Lists with start-of-line-transparent tokens before bullets: Template close
9029 !! wikitext
9030 *foo {{echo|bar
9031 }}*baz
9032 !! html
9033 <ul><li>foo bar</li>
9034 <li>baz</li></ul>
9035
9036 !! end
9037
9038 !! test
9039 List items are not parsed correctly following a <pre> block (bug 785)
9040 !! wikitext
9041 * <pre>foo</pre>
9042 * <pre>bar</pre>
9043 * zar
9044 !! html/php
9045 <ul><li> <pre>foo</pre></li>
9046 <li> <pre>bar</pre></li>
9047 <li> zar</li></ul>
9048
9049 !! html/parsoid
9050 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9051 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9052 <li> zar</li></ul>
9053 !! end
9054
9055 !! test
9056 List items from template
9057 !! wikitext
9058
9059 {{inner list}}
9060 * item 2
9061
9062 * item 0
9063 {{inner list}}
9064 * item 2
9065
9066 * item 0
9067 * notSOL{{inner list}}
9068 * item 2
9069 !! html
9070 <ul><li> item 1</li>
9071 <li> item 2</li></ul>
9072 <ul><li> item 0</li>
9073 <li> item 1</li>
9074 <li> item 2</li></ul>
9075 <ul><li> item 0</li>
9076 <li> notSOL</li>
9077 <li> item 1</li>
9078 <li> item 2</li></ul>
9079
9080 !! end
9081
9082 !! test
9083 List interrupted by empty line or heading
9084 !! wikitext
9085 * foo
9086
9087 ** bar
9088 == A heading ==
9089 * Another list item
9090 !! html
9091 <ul><li> foo</li></ul>
9092 <ul><li><ul><li> bar</li></ul></li></ul>
9093 <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>
9094 <ul><li> Another list item</li></ul>
9095
9096 !!end
9097
9098 !!test
9099 Multiple list tags generated by templates
9100 !! wikitext
9101 {{echo|<li>}}a
9102 {{echo|<li>}}b
9103 {{echo|<li>}}c
9104 !! html
9105 <li>a
9106 <li>b
9107 <li>c</li>
9108 </li>
9109 </li>
9110
9111 !! html+tidy
9112 <ul>
9113 <li>a</li>
9114 <li>b</li>
9115 <li>c</li>
9116 </ul>
9117 !!end
9118
9119 !!test
9120 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9121 !! wikitext
9122 *a
9123 <!--This line will NOT split the list-->
9124 *b
9125 <!--This line will NOT split the list either-->
9126 *c
9127 <!--foo--> <!----> <!--This line NOT split the list either-->
9128 *d
9129 !! html
9130 <ul><li>a</li>
9131 <li>b</li>
9132 <li>c</li>
9133 <li>d</li></ul>
9134
9135 !!end
9136
9137 !!test
9138 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9139 !! wikitext
9140 *a
9141 <!--This line will NOT split the list-->
9142 *b
9143 <!--This line will NOT split the list either-->
9144 *c
9145 <!--foo--> <!----> <!--This line NOT split the list
9146 either-->
9147 *d
9148 !! html
9149 <ul><li>a</li>
9150 <li>b</li>
9151 <li>c</li>
9152 <li>d</li></ul>
9153
9154 !!end
9155
9156 !!test
9157 Test the li-hack
9158 (The PHP parser relies on Tidy for the hack)
9159 !!options
9160 parsoid=wt2html,wt2wt
9161 !! wikitext
9162 * foo
9163 * <li>li-hack
9164 * {{echo|<li>templated li-hack}}
9165 * <!--foo--> <li> unsupported li-hack with preceding comments
9166
9167 <ul>
9168 <li><li>not a li-hack
9169 </li>
9170 </ul>
9171 !! html+tidy
9172 <ul>
9173 <li>foo</li>
9174 <li>li-hack</li>
9175 <li>templated li-hack</li>
9176 <li>unsupported li-hack with preceding comments</li>
9177 </ul>
9178 <ul>
9179 <li>not a li-hack</li>
9180 </ul>
9181 !!end
9182
9183 !! test
9184 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9185 !! options
9186 parsoid
9187 !! wikitext
9188 # foo
9189 ## bar
9190 * foo
9191 ** bar
9192 : foo
9193 :: bar
9194 !! html
9195 <ol>
9196 <li> foo<ol>
9197 <li> bar</li>
9198 </ol></li>
9199 </ol><ul>
9200 <li> foo<ul>
9201 <li> bar</li>
9202 </ul></li>
9203 </ul><dl>
9204 <dd> foo<dl>
9205 <dd> bar</dd>
9206 </dl></dd>
9207 </dl>
9208 !! end
9209
9210 !! test
9211 Parsoid: Test of whitespace serialization with Templated bullets
9212 !! options
9213 parsoid
9214 !! wikitext
9215 * {{bullet}}
9216 !! html
9217 <ul>
9218 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9219 </ul>
9220 !! end
9221
9222 # ------------------------------------------------------------------------
9223 # The next set of tests are about Parsoid's ability to handle badly nested
9224 # tags (parse, minimize scope of fixup, and roundtrip back)
9225 # ------------------------------------------------------------------------
9226
9227 !! test
9228 Unbalanced closing block tags break a list
9229 (php parser relies on Tidy to fix up)
9230 !! wikitext
9231 <div>
9232 *a</div><div>
9233 *b</div>
9234 !! html+tidy
9235 <div>
9236 <ul>
9237 <li>a</li>
9238 </ul>
9239 </div>
9240 <div>
9241 <ul>
9242 <li>b</li>
9243 </ul>
9244 </div>
9245 !! end
9246
9247 # Parsoid fails this test, but it might be tricky to support properly.
9248 # See bug 68395.
9249 !! test
9250 Unbalanced closing non-block tags don't break a list
9251 (php parser relies on Tidy to fix up)
9252 !! wikitext
9253 <span>
9254 *a</span><span>
9255 *b</span>
9256 !! html/php+tidy
9257 <ul>
9258 <li><span>a</span></li>
9259 <li><span>b</span></li>
9260 </ul>
9261 !! html/parsoid
9262 <span>
9263 <ul>
9264 <li>a<span></span>
9265 </li>
9266 <li>b
9267 </li>
9268 </ul>
9269 </span>
9270 !! end
9271
9272 !! test
9273 Unclosed formatting tags that straddle lists are closed and reopened
9274 (php parser relies on Tidy to fix up)
9275 !! options
9276 parsoid=wt2html,wt2wt,html2html
9277 !! wikitext
9278 # <s> a
9279 # b </s>
9280 !! html/php+tidy
9281 <ol>
9282 <li><s>a</s></li>
9283 <li><s>b</s></li>
9284 </ol>
9285 !! html/parsoid
9286 <ol><li> <s> a</s></li>
9287 <li><s> b </s></li></ol>
9288 !! end
9289
9290 # See bug 68395.
9291 !!test
9292 1. List embedded in a formatting tag
9293 !! wikitext
9294 <small>
9295 * foo
9296 </small>
9297 !! html/php+tidy
9298 <ul>
9299 <li><small>foo</small></li>
9300 </ul>
9301 !! html/parsoid
9302 <small>
9303 <ul>
9304 <li> foo</li>
9305 </ul>
9306 </small>
9307 !!end
9308
9309 ## Ugly Parsoid output here
9310 ## Not sure what the right output is.
9311 !!test
9312 2. List embedded in a formatting tag
9313 !! wikitext
9314 <small>
9315 *a
9316 *b</small>
9317 !! html/php+tidy
9318 <ul>
9319 <li><small>a</small></li>
9320 <li><small>b</small></li>
9321 </ul>
9322 !! html/parsoid
9323 <small></small>
9324 <ul><small>
9325 <li>a</li>
9326 </small>
9327 <li><small>b</small></li>
9328 </ul>
9329 !!end
9330
9331 # Ugly Parsoid and PHP parser output here
9332 # Not sure if we want to make this a test!
9333 #
9334 ## !!test
9335 ## 3. Unclosed formatting tags in list elements
9336 ## !! wikitext
9337 ## *<small>a
9338 ## *<small>b
9339 ## !! html/php+tidy
9340 ## <ul>
9341 ## <li><small>a</small></li>
9342 ## <li><small><small>b</small></small></li>
9343 ## </ul>
9344 ## !! html/parsoid
9345 ## <ul>
9346 ## <li><small>a</small></li>
9347 ## <small>
9348 ## <li><small>b</small></li>
9349 ## </small></ul>
9350 ## !!end
9351
9352 # This is a bug in the PHP parser + tidy combination.
9353 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9354 # and then fostered out of the table by tidy.)
9355 # We believe the Parsoid output to be correct.
9356 !! test
9357 Table with missing opening <tr> tag
9358 !! options
9359 parsoid=wt2html,wt2wt
9360 !! wikitext
9361 <table>
9362 <td>foo</td>
9363 </tr>
9364 </table>
9365 !! html+tidy
9366 <table>
9367 <tr>
9368 <td>foo</td>
9369 </tr>
9370 </table>
9371 !! end
9372
9373 ###
9374 ### Magic Words
9375 ###
9376
9377 # Note that the current date is hard-coded as
9378 # 1970-01-01T00:02:03Z (a Thursday)
9379 # when running parser tests. The timezone is also fixed to GMT, so
9380 # local date will be identical to current date.
9381
9382 !! test
9383 Magic Word: {{CURRENTDAY}}
9384 !! wikitext
9385 {{CURRENTDAY}}
9386 !! html
9387 <p>1
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{CURRENTDAY2}}
9393 !! wikitext
9394 {{CURRENTDAY2}}
9395 !! html
9396 <p>01
9397 </p>
9398 !! end
9399
9400 !! test
9401 Magic Word: {{CURRENTDAYNAME}}
9402 !! wikitext
9403 {{CURRENTDAYNAME}}
9404 !! html
9405 <p>Thursday
9406 </p>
9407 !! end
9408
9409 !! test
9410 Magic Word: {{CURRENTDOW}}
9411 !! wikitext
9412 {{CURRENTDOW}}
9413 !! html
9414 <p>4
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic Word: {{CURRENTMONTH}}
9420 !! wikitext
9421 {{CURRENTMONTH}}
9422 !! html
9423 <p>01
9424 </p>
9425 !! end
9426
9427 !! test
9428 Magic Word: {{CURRENTMONTH1}}
9429 !! wikitext
9430 {{CURRENTMONTH1}}
9431 !! html
9432 <p>1
9433 </p>
9434 !! end
9435
9436 !! test
9437 Magic Word: {{CURRENTMONTHABBREV}}
9438 !! wikitext
9439 {{CURRENTMONTHABBREV}}
9440 !! html
9441 <p>Jan
9442 </p>
9443 !! end
9444
9445 !! test
9446 Magic Word: {{CURRENTMONTHNAME}}
9447 !! wikitext
9448 {{CURRENTMONTHNAME}}
9449 !! html
9450 <p>January
9451 </p>
9452 !! end
9453
9454 !! test
9455 Magic Word: {{CURRENTMONTHNAMEGEN}}
9456 !! wikitext
9457 {{CURRENTMONTHNAMEGEN}}
9458 !! html
9459 <p>January
9460 </p>
9461 !! end
9462
9463 !! test
9464 Magic Word: {{CURRENTTIME}}
9465 !! wikitext
9466 {{CURRENTTIME}}
9467 !! html
9468 <p>00:02
9469 </p>
9470 !! end
9471
9472 !! test
9473 Magic Word: {{CURRENTHOUR}}
9474 !! wikitext
9475 {{CURRENTHOUR}}
9476 !! html
9477 <p>00
9478 </p>
9479 !! end
9480
9481 !! test
9482 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9483 !! wikitext
9484 {{CURRENTWEEK}}
9485 !! html
9486 <p>1
9487 </p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{CURRENTYEAR}}
9492 !! wikitext
9493 {{CURRENTYEAR}}
9494 !! html
9495 <p>1970
9496 </p>
9497 !! end
9498
9499 !! test
9500 Magic Word: {{CURRENTTIMESTAMP}}
9501 !! wikitext
9502 {{CURRENTTIMESTAMP}}
9503 !! html
9504 <p>19700101000203
9505 </p>
9506 !! end
9507
9508 !! test
9509 Magic Words LOCAL (UTC)
9510 !! wikitext
9511 * {{LOCALMONTH}}
9512 * {{LOCALMONTH1}}
9513 * {{LOCALMONTHNAME}}
9514 * {{LOCALMONTHNAMEGEN}}
9515 * {{LOCALMONTHABBREV}}
9516 * {{LOCALDAY}}
9517 * {{LOCALDAY2}}
9518 * {{LOCALDAYNAME}}
9519 * {{LOCALYEAR}}
9520 * {{LOCALTIME}}
9521 * {{LOCALHOUR}}
9522 * {{LOCALWEEK}}
9523 * {{LOCALDOW}}
9524 * {{LOCALTIMESTAMP}}
9525 !! html
9526 <ul><li> 01</li>
9527 <li> 1</li>
9528 <li> January</li>
9529 <li> January</li>
9530 <li> Jan</li>
9531 <li> 1</li>
9532 <li> 01</li>
9533 <li> Thursday</li>
9534 <li> 1970</li>
9535 <li> 00:02</li>
9536 <li> 00</li>
9537 <li> 1</li>
9538 <li> 4</li>
9539 <li> 19700101000203</li></ul>
9540
9541 !! end
9542
9543 !! test
9544 Magic Word: {{FULLPAGENAME}}
9545 !! options
9546 title=[[User:Ævar Arnfjörð Bjarmason]]
9547 !! wikitext
9548 {{FULLPAGENAME}}
9549 !! html
9550 <p>User:Ævar Arnfjörð Bjarmason
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{FULLPAGENAMEE}}
9556 !! options
9557 title=[[User:Ævar Arnfjörð Bjarmason]]
9558 !! wikitext
9559 {{FULLPAGENAMEE}}
9560 !! html
9561 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9562 </p>
9563 !! end
9564
9565 !! test
9566 Magic Word: {{TALKSPACE}}
9567 !! options
9568 title=[[User:Ævar Arnfjörð Bjarmason]]
9569 !! wikitext
9570 {{TALKSPACE}}
9571 !! html
9572 <p>User talk
9573 </p>
9574 !! end
9575
9576 !! test
9577 Magic Word: {{TALKSPACE}}, same namespace
9578 !! options
9579 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9580 !! wikitext
9581 {{TALKSPACE}}
9582 !! html
9583 <p>User talk
9584 </p>
9585 !! end
9586
9587 !! test
9588 Magic Word: {{TALKSPACE}}, main namespace
9589 !! options
9590 title=[[Parser Test]]
9591 !! wikitext
9592 {{TALKSPACE}}
9593 !! html
9594 <p>Talk
9595 </p>
9596 !! end
9597
9598 !! test
9599 Magic Word: {{TALKSPACEE}}
9600 !! options
9601 title=[[User:Ævar Arnfjörð Bjarmason]]
9602 !! wikitext
9603 {{TALKSPACEE}}
9604 !! html
9605 <p>User_talk
9606 </p>
9607 !! end
9608
9609 !! test
9610 Magic Word: {{SUBJECTSPACE}}
9611 !! options
9612 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9613 !! wikitext
9614 {{SUBJECTSPACE}}
9615 !! html
9616 <p>User
9617 </p>
9618 !! end
9619
9620 !! test
9621 Magic Word: {{SUBJECTSPACE}}, same namespace
9622 !! options
9623 title=[[User:Ævar Arnfjörð Bjarmason]]
9624 !! wikitext
9625 {{SUBJECTSPACE}}
9626 !! html
9627 <p>User
9628 </p>
9629 !! end
9630
9631 !! test
9632 Magic Word: {{SUBJECTSPACE}}, main namespace
9633 !! options
9634 title=[[Parser Test]]
9635 !! wikitext
9636 {{SUBJECTSPACE}}
9637 !! html
9638
9639 !! end
9640
9641 !! test
9642 Magic Word: {{SUBJECTSPACEE}}
9643 !! options
9644 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9645 !! wikitext
9646 {{SUBJECTSPACEE}}
9647 !! html
9648 <p>User
9649 </p>
9650 !! end
9651
9652 !! test
9653 Magic Word: {{NAMESPACE}}
9654 !! options
9655 title=[[User:Ævar Arnfjörð Bjarmason]]
9656 !! wikitext
9657 {{NAMESPACE}}
9658 !! html
9659 <p>User
9660 </p>
9661 !! end
9662
9663 !! test
9664 Magic Word: {{NAMESPACEE}}
9665 !! options
9666 title=[[User:Ævar Arnfjörð Bjarmason]]
9667 !! wikitext
9668 {{NAMESPACEE}}
9669 !! html
9670 <p>User
9671 </p>
9672 !! end
9673
9674 !! test
9675 Magic Word: {{NAMESPACENUMBER}}
9676 !! options
9677 title=[[User:Ævar Arnfjörð Bjarmason]]
9678 !! wikitext
9679 {{NAMESPACENUMBER}}
9680 !! html
9681 <p>2
9682 </p>
9683 !! end
9684
9685 !! test
9686 Magic Word: {{SUBPAGENAME}}
9687 !! options
9688 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9689 !! wikitext
9690 {{SUBPAGENAME}}
9691 !! html
9692 <p>sub ö
9693 </p>
9694 !! end
9695
9696 !! test
9697 Magic Word: {{SUBPAGENAMEE}}
9698 !! options
9699 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9700 !! wikitext
9701 {{SUBPAGENAMEE}}
9702 !! html
9703 <p>sub_%C3%B6
9704 </p>
9705 !! end
9706
9707 !! test
9708 Magic Word: {{ROOTPAGENAME}}
9709 !! options
9710 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9711 !! wikitext
9712 {{ROOTPAGENAME}}
9713 !! html
9714 <p>Ævar Arnfjörð Bjarmason
9715 </p>
9716 !! end
9717
9718 !! test
9719 Magic Word: {{ROOTPAGENAMEE}}
9720 !! options
9721 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9722 !! wikitext
9723 {{ROOTPAGENAMEE}}
9724 !! html
9725 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9726 </p>
9727 !! end
9728
9729 !! test
9730 Magic Word: {{BASEPAGENAME}}
9731 !! options
9732 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9733 !! wikitext
9734 {{BASEPAGENAME}}
9735 !! html
9736 <p>Ævar Arnfjörð Bjarmason
9737 </p>
9738 !! end
9739
9740 !! test
9741 Magic Word: {{BASEPAGENAMEE}}
9742 !! options
9743 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9744 !! wikitext
9745 {{BASEPAGENAMEE}}
9746 !! html
9747 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9748 </p>
9749 !! end
9750
9751 !! test
9752 Magic Word: {{TALKPAGENAME}}
9753 !! options
9754 title=[[User:Ævar Arnfjörð Bjarmason]]
9755 !! wikitext
9756 {{TALKPAGENAME}}
9757 !! html
9758 <p>User talk:Ævar Arnfjörð Bjarmason
9759 </p>
9760 !! end
9761
9762 !! test
9763 Magic Word: {{TALKPAGENAMEE}}
9764 !! options
9765 title=[[User:Ævar Arnfjörð Bjarmason]]
9766 !! wikitext
9767 {{TALKPAGENAMEE}}
9768 !! html
9769 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9770 </p>
9771 !! end
9772
9773 !! test
9774 Magic Word: {{SUBJECTPAGENAME}}
9775 !! options
9776 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9777 !! wikitext
9778 {{SUBJECTPAGENAME}}
9779 !! html
9780 <p>User:Ævar Arnfjörð Bjarmason
9781 </p>
9782 !! end
9783
9784 !! test
9785 Magic Word: {{SUBJECTPAGENAMEE}}
9786 !! options
9787 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9788 !! wikitext
9789 {{SUBJECTPAGENAMEE}}
9790 !! html
9791 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9792 </p>
9793 !! end
9794
9795 !! test
9796 Magic Word: {{NUMBEROFFILES}}
9797 !! wikitext
9798 {{NUMBEROFFILES}}
9799 !! html
9800 <p>6
9801 </p>
9802 !! end
9803
9804 !! test
9805 Magic Word: {{PAGENAME}}
9806 !! options
9807 title=[[User:Ævar Arnfjörð Bjarmason]]
9808 !! wikitext
9809 {{PAGENAME}}
9810 !! html
9811 <p>Ævar Arnfjörð Bjarmason
9812 </p>
9813 !! end
9814
9815 !! test
9816 Magic Word: {{PAGENAME}} with metacharacters
9817 !! options
9818 title=[['foo & bar = baz']]
9819 !! wikitext
9820 ''{{PAGENAME}}''
9821 !! html/php
9822 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9823 </p>
9824 !! html+tidy
9825 <p><i>'foo &amp; bar = baz'</i></p>
9826 !! end
9827
9828 !! test
9829 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9830 !! options
9831 title=[[*RFC 1234 http://example.com/]]
9832 !! wikitext
9833 {{PAGENAME}}
9834 !! html/php
9835 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9836 </p>
9837 !! html+tidy
9838 <p>*RFC 1234 http://example.com/</p>
9839 !! end
9840
9841 !! test
9842 Magic Word: {{PAGENAMEE}}
9843 !! options
9844 title=[[User:Ævar Arnfjörð Bjarmason]]
9845 !! wikitext
9846 {{PAGENAMEE}}
9847 !! html
9848 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9849 </p>
9850 !! end
9851
9852 !! test
9853 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9854 !! options
9855 title=[[*RFC 1234 http://example.com/]]
9856 !! wikitext
9857 {{PAGENAMEE}}
9858 !! html/php
9859 <p>&#42;RFC_1234_http&#58;//example.com/
9860 </p>
9861 !! html+tidy
9862 <p>*RFC_1234_http://example.com/</p>
9863 !! end
9864
9865 !! test
9866 Magic Word: {{REVISIONID}}
9867 !! wikitext
9868 {{REVISIONID}}
9869 !! html
9870 <p>1337
9871 </p>
9872 !! end
9873
9874 !! test
9875 Magic Word: {{SCRIPTPATH}}
9876 !! wikitext
9877 {{SCRIPTPATH}}
9878 !! html
9879
9880 !! end
9881
9882 !! test
9883 Magic Word: {{STYLEPATH}}
9884 !! wikitext
9885 {{STYLEPATH}}
9886 !! html
9887 <p>/skins
9888 </p>
9889 !! end
9890
9891 !! test
9892 Magic Word: {{SERVER}}
9893 !! wikitext
9894 {{SERVER}}
9895 !! html
9896 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9897 </p>
9898 !! end
9899
9900 !! test
9901 Magic Word: {{SERVERNAME}}
9902 !! wikitext
9903 {{SERVERNAME}}
9904 !! html
9905 <p>example.org
9906 </p>
9907 !! end
9908
9909 !! test
9910 Magic Word: {{SITENAME}}
9911 !! wikitext
9912 {{SITENAME}}
9913 !! html
9914 <p>MediaWiki
9915 </p>
9916 !! end
9917
9918 !! test
9919 Case-sensitive magic words, when cased differently, should just be template transclusions
9920 !! wikitext
9921 {{CurrentMonth}}
9922 {{currentday}}
9923 {{cURreNTweEK}}
9924 {{currentHour}}
9925 !! html
9926 <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>
9927 <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>
9928 <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>
9929 <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>
9930 </p>
9931 !! end
9932
9933 !! test
9934 Case-insensitive magic words should still work with weird casing.
9935 !! wikitext
9936 {{sErVeRNaMe}}
9937 {{LCFirst:AOEU}}
9938 {{ucFIRST:aoeu}}
9939 {{SERver}}
9940 !! html
9941 <p>example.org
9942 aOEU
9943 Aoeu
9944 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9945 </p>
9946 !! end
9947
9948 # From plwiki:PLOS_ONE
9949 !! test
9950 Parsoid: Page property magic word with magic word contents
9951 !! wikitext
9952 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9953 !! html/parsoid
9954 <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>"}]]}'/>
9955 !! end
9956
9957 !! test
9958 Parsoid: Template-generated DISPLAYTITLE
9959 !! wikitext
9960 {{{{echo|DISPLAYTITLE}}:Foo}}
9961 !! html/parsoid
9962 <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}}]}'/>
9963 !! end
9964
9965 !! test
9966 Namespace 1 {{ns:1}}
9967 !! wikitext
9968 {{ns:1}}
9969 !! html
9970 <p>Talk
9971 </p>
9972 !! end
9973
9974 !! test
9975 Namespace 1 {{ns:01}}
9976 !! wikitext
9977 {{ns:01}}
9978 !! html
9979 <p>Talk
9980 </p>
9981 !! end
9982
9983 !! test
9984 Namespace 0 {{ns:0}} (bug 4783)
9985 !! wikitext
9986 {{ns:0}}
9987 !! html
9988
9989 !! end
9990
9991 !! test
9992 Namespace 0 {{ns:00}} (bug 4783)
9993 !! wikitext
9994 {{ns:00}}
9995 !! html
9996
9997 !! end
9998
9999 !! test
10000 Namespace -1 {{ns:-1}}
10001 !! wikitext
10002 {{ns:-1}}
10003 !! html
10004 <p>Special
10005 </p>
10006 !! end
10007
10008 !! test
10009 Namespace User {{ns:User}}
10010 !! wikitext
10011 {{ns:User}}
10012 !! html
10013 <p>User
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 User talk {{ns:uSeR tAlK}}
10028 !! wikitext
10029 {{ns:uSeR tAlK}}
10030 !! html
10031 <p>User talk
10032 </p>
10033 !! end
10034
10035 !! test
10036 Namespace File {{ns:File}}
10037 !! wikitext
10038 {{ns:File}}
10039 !! html
10040 <p>File
10041 </p>
10042 !! end
10043
10044 !! test
10045 Namespace File {{ns:Image}}
10046 !! wikitext
10047 {{ns:Image}}
10048 !! html
10049 <p>File
10050 </p>
10051 !! end
10052
10053 !! test
10054 Namespace (lang=de) Benutzer {{ns:User}}
10055 !! options
10056 language=de
10057 !! wikitext
10058 {{ns:User}}
10059 !! html
10060 <p>Benutzer
10061 </p>
10062 !! end
10063
10064 !! test
10065 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10066 !! options
10067 language=de
10068 !! wikitext
10069 {{ns:3}}
10070 !! html
10071 <p>Benutzer Diskussion
10072 </p>
10073 !! end
10074
10075
10076 !! test
10077 Urlencode
10078 !! wikitext
10079 {{urlencode:hi world?!}}
10080 {{urlencode:hi world?!|WIKI}}
10081 {{urlencode:hi world?!|PATH}}
10082 {{urlencode:hi world?!|QUERY}}
10083 !! html
10084 <p>hi+world%3F%21
10085 hi_world%3F!
10086 hi%20world%3F%21
10087 hi+world%3F%21
10088 </p>
10089 !! end
10090
10091 !! test
10092 Magic Word: prioritize type info over data-parsoid
10093 !! options
10094 parsoid=html2wt
10095 !! html/parsoid
10096 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10097 !! wikitext
10098 __FORCETOC__
10099 !! end
10100
10101 !! test
10102 Magic Word: serialize on separate line (parsoid)
10103 !! options
10104 parsoid=wt2wt,html2wt
10105 !! wikitext
10106 foo
10107 __NOTOC__
10108 bar
10109 !! html/parsoid
10110 foo<meta property="mw:PageProp/notoc"/>bar
10111 !! end
10112
10113 !! test
10114 Magic Word: rt non-english wikis
10115 !! options
10116 parsoid=wt2wt
10117 language=de
10118 !! wikitext
10119 __NOEDITSECTION__
10120 !! html/parsoid
10121 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10122 !! end
10123
10124 !!test
10125 __proto__ is treated as normal wikitext (T105997)
10126 !!wikitext
10127 __proto__
10128 !!html
10129 <p>__proto__
10130 </p>
10131 !!end
10132
10133 ###
10134 ### Magic links
10135 ###
10136 !! test
10137 Magic links: internal link to RFC (bug 479)
10138 !! wikitext
10139 [[RFC 123]]
10140 !! html/php
10141 <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>
10142 </p>
10143 !! html/parsoid
10144 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10145 !! end
10146
10147 !! test
10148 Magic links: RFC (bug 479)
10149 !! wikitext
10150 RFC 822
10151 !! html/php
10152 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10153 </p>
10154 !! html/parsoid
10155 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10156 !! end
10157
10158 !! test
10159 Magic links: RFC (bug 65278)
10160 !! wikitext
10161 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10162 !! html/php
10163 <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.
10164 </p>
10165 !! html/parsoid
10166 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10167 !! end
10168
10169 !! test
10170 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10171 !! wikitext
10172 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10173 RFC
10174 822
10175 !! html/php
10176 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10177 RFC
10178 822
10179 </p>
10180 !! html/parsoid
10181 <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>
10182 RFC
10183 822</p>
10184 !! end
10185
10186 !! test
10187 Magic links: ISBN (bug 1937)
10188 !! wikitext
10189 ISBN 0-306-40615-2
10190 !! html/php
10191 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10192 </p>
10193 !! html/parsoid
10194 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10195 !! end
10196
10197 !! test
10198 Magic links: ISBN (bug 65278)
10199 !! wikitext
10200 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10201 !! html/php
10202 <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.
10203 </p>
10204 !! html/parsoid
10205 <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>
10206 !! end
10207
10208 !! test
10209 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10210 !! wikitext
10211 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10212 ISBN
10213 9780316098113
10214 ISBN 978
10215 0316098113
10216 !! html/php
10217 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10218 ISBN
10219 9780316098113
10220 ISBN 978
10221 0316098113
10222 </p>
10223 !! html/parsoid
10224 <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>
10225 ISBN
10226 9780316098113
10227 ISBN 978
10228 0316098113</p>
10229 !! end
10230
10231 !! test
10232 Magic links: PMID incorrectly converts space to underscore
10233 !! wikitext
10234 PMID 1234
10235 !! html/php
10236 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10237 </p>
10238 !! html/parsoid
10239 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10240 !! end
10241
10242 !! test
10243 Magic links: PMID (bug 65278)
10244 !! wikitext
10245 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10246 !! html/php
10247 <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.
10248 </p>
10249 !! html/parsoid
10250 <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>
10251 !! end
10252
10253 !! test
10254 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10255 !! wikitext
10256 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10257 PMID
10258 1234
10259 !! html/php
10260 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10261 PMID
10262 1234
10263 </p>
10264 !! html/parsoid
10265 <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>
10266 PMID
10267 1234</p>
10268 !! end
10269
10270 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10271 # since these are ExtLinkText, not MagicLinkText
10272 !! test
10273 Magic links: use appropriate serialization for "almost" magic links.
10274 !! wikitext
10275 X[[Special:BookSources/0978739256|foo]]
10276
10277 X[//tools.ietf.org/html/rfc1234 foo]
10278 !! html/php
10279 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10280 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10281 </p>
10282 !! html/parsoid
10283 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10284 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10285 !! end
10286
10287 ###
10288 ### Templates
10289 ####
10290
10291 !! test
10292 Nonexistent template
10293 !! wikitext
10294 {{thistemplatedoesnotexist}}
10295 !! html
10296 <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>
10297 </p>
10298 !! end
10299
10300 !! test
10301 Template with invalid target containing tags
10302 !! wikitext
10303 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10304 !! html
10305 <p>{{a<b>b</b>|foo|a=b|a = b}}
10306 </p>
10307 !! end
10308
10309 !! test
10310 Template with invalid target containing unclosed tag
10311 !! wikitext
10312 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10313 !! html
10314 <p>{{a<b>|foo|a=b|a = b}}</b>
10315 </p>
10316 !! end
10317
10318 !! test
10319 Template with invalid target containing wikilink
10320 !! wikitext
10321 {{[[Main Page]]}}
10322 !! html/php
10323 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10324 </p>
10325 !! html/parsoid
10326 <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>
10327 !! end
10328
10329 !! test
10330 Template with just whitespace in it, bug #68421
10331 !! wikitext
10332 {{echo|{{ }}}}
10333 !! html/parsoid
10334 <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>
10335 !! end
10336
10337 !! article
10338 Template:test
10339 !! text
10340 This is a test template
10341 !! endarticle
10342
10343 !! test
10344 Simple template
10345 !! wikitext
10346 {{test}}
10347 !! html
10348 <p>This is a test template
10349 </p>
10350 !! end
10351
10352 !! test
10353 Template with explicit namespace
10354 !! wikitext
10355 {{Template:test}}
10356 !! html
10357 <p>This is a test template
10358 </p>
10359 !! end
10360
10361
10362 !! article
10363 Template:paramtest
10364 !! text
10365 This is a test template with parameter {{{param}}}
10366 !! endarticle
10367
10368 !! test
10369 Template parameter
10370 !! wikitext
10371 {{paramtest|param=foo}}
10372 !! html
10373 <p>This is a test template with parameter foo
10374 </p>
10375 !! end
10376
10377 !! article
10378 Template:paramtestnum
10379 !! text
10380 [[{{{1}}}|{{{2}}}]]
10381 !! endarticle
10382
10383 !! test
10384 Template unnamed parameter
10385 !! wikitext
10386 {{paramtestnum|Main Page|the main page}}
10387 !! html
10388 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10389 </p>
10390 !! end
10391
10392 !! article
10393 Template:templatesimple
10394 !! text
10395 (test)
10396 !! endarticle
10397
10398 !! article
10399 Template:templateredirect
10400 !! text
10401 #redirect [[Template:templatesimple]]
10402 !! endarticle
10403
10404 !! article
10405 Template:templateasargtestnum
10406 !! text
10407 {{{{{1}}}}}
10408 !! endarticle
10409
10410 !! article
10411 Template:templateasargtest
10412 !! text
10413 {{template{{{templ}}}}}
10414 !! endarticle
10415
10416 !! article
10417 Template:templateasargtest2
10418 !! text
10419 {{{{{templ}}}}}
10420 !! endarticle
10421
10422 !! test
10423 Template with template name as unnamed argument
10424 !! wikitext
10425 {{templateasargtestnum|templatesimple}}
10426 !! html
10427 <p>(test)
10428 </p>
10429 !! end
10430
10431 !! test
10432 Template with template name as argument
10433 !! wikitext
10434 {{templateasargtest|templ=simple}}
10435 !! html
10436 <p>(test)
10437 </p>
10438 !! end
10439
10440 !! test
10441 Template with template name as argument (2)
10442 !! wikitext
10443 {{templateasargtest2|templ=templatesimple}}
10444 !! html
10445 <p>(test)
10446 </p>
10447 !! end
10448
10449 !! article
10450 Template:templateasargtestdefault
10451 !! text
10452 {{{{{templ|templatesimple}}}}}
10453 !! endarticle
10454
10455 !! article
10456 Template:templa
10457 !! text
10458 '''templ'''
10459 !! endarticle
10460
10461 !! test
10462 Template with default value
10463 !! wikitext
10464 {{templateasargtestdefault}}
10465 !! html
10466 <p>(test)
10467 </p>
10468 !! end
10469
10470 !! test
10471 Template with default value (value set)
10472 !! wikitext
10473 {{templateasargtestdefault|templ=templa}}
10474 !! html
10475 <p><b>templ</b>
10476 </p>
10477 !! end
10478
10479 !! test
10480 Template redirect
10481 !! wikitext
10482 {{templateredirect}}
10483 !! html/php
10484 <p>(test)
10485 </p>
10486 !! html/parsoid
10487 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10488 !! end
10489
10490 !! test
10491 Template with argument in separate line
10492 !! wikitext
10493 {{ templateasargtest |
10494 templ = simple }}
10495 !! html
10496 <p>(test)
10497 </p>
10498 !! end
10499
10500 !! test
10501 Template with complex template as argument
10502 !! wikitext
10503 {{paramtest|
10504 param ={{ templateasargtest |
10505 templ = simple }}}}
10506 !! html
10507 <p>This is a test template with parameter (test)
10508 </p>
10509 !! end
10510
10511 !! test
10512 Template with thumb image (with link in description)
10513 !! wikitext
10514 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10515 !! html/php
10516 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>
10517
10518 !! html+tidy
10519 <p>This is a test template with parameter</p>
10520 <div class="thumb tright">
10521 <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>
10522 <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>
10523 </div>
10524 </div>
10525 !! html/parsoid
10526 <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>
10527 !! end
10528
10529 !! article
10530 Template:complextemplate
10531 !! text
10532 {{{1}}} {{paramtest|
10533 param ={{{param}}}}}
10534 !! endarticle
10535
10536 !! test
10537 Template with complex arguments
10538 !! wikitext
10539 {{complextemplate|
10540 param ={{ templateasargtest |
10541 templ = simple }}|[[Template:complextemplate|link]]}}
10542 !! html
10543 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10544 </p>
10545 !! end
10546
10547 !! test
10548 BUG 553: link with two variables in a piped link
10549 !! wikitext
10550 {|
10551 |[[{{{1}}}|{{{2}}}]]
10552 |}
10553 !! html/php
10554 <table>
10555 <tr>
10556 <td>[[{{{1}}}|{{{2}}}]]
10557 </td></tr></table>
10558
10559 !! html/parsoid
10560 <table>
10561 <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>
10562 !! end
10563
10564 # See: T2553
10565 !! test
10566 Abort table cell attribute parsing on wikilink
10567 !! wikitext
10568 {|
10569 | testing [[one|two]] | three || four
10570 | testing one two | three || four
10571 | testing="[[one|two]]" | three || four
10572 |}
10573 !! html/php
10574 <table>
10575 <tr>
10576 <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>
10577 <td> four
10578 </td>
10579 <td> three </td>
10580 <td> four
10581 </td>
10582 <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>
10583 <td> four
10584 </td></tr></table>
10585
10586 !! html/parsoid
10587 <table>
10588 <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>
10589 <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>
10590 <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>
10591 </tbody></table>
10592 !! end
10593
10594 !! test
10595 Don't abort table cell attribute parsing if wikilink is found in template arg
10596 !! wikitext
10597 {|
10598 | Test {{#tag:ref|One two "[[three]]" four}}
10599 |}
10600 !! html/parsoid
10601 <table>
10602 <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>
10603 </tbody></table>
10604 !! end
10605
10606 !! test
10607 Magic variable as template parameter
10608 !! wikitext
10609 {{paramtest|param={{SITENAME}}}}
10610 !! html
10611 <p>This is a test template with parameter MediaWiki
10612 </p>
10613 !! end
10614
10615 !! article
10616 Template:linktest
10617 !! text
10618 [[{{{param}}}|link]]
10619 !! endarticle
10620
10621 !! test
10622 Template parameter as link source
10623 !! wikitext
10624 {{linktest|param=Main Page}}
10625 !! html
10626 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10627 </p>
10628 !! end
10629
10630 !!article
10631 Template:paramtest2
10632 !! text
10633 including another template, {{paramtest|param={{{arg}}}}}
10634 !! endarticle
10635
10636 !! test
10637 Template passing argument to another template
10638 !! wikitext
10639 {{paramtest2|arg='hmm'}}
10640 !! html
10641 <p>including another template, This is a test template with parameter 'hmm'
10642 </p>
10643 !! end
10644
10645 !! article
10646 Template:Linktest2
10647 !! text
10648 Main Page
10649 !! endarticle
10650
10651 !! test
10652 Template as link source
10653 !! wikitext
10654 [[{{linktest2}}]]
10655
10656 [[{{linktest2}}|Main Page]]
10657
10658 [[{{linktest2}}]]Page
10659 !! html
10660 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10661 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10662 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10663 </p>
10664 !! end
10665
10666
10667 !! article
10668 Template:loop1
10669 !! text
10670 {{loop2}}
10671 !! endarticle
10672
10673 !! article
10674 Template:loop2
10675 !! text
10676 {{loop1}}
10677 !! endarticle
10678
10679 !! test
10680 Template infinite loop
10681 !! wikitext
10682 {{loop1}}
10683 !! html
10684 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10685 </p>
10686 !! end
10687
10688 !! test
10689 Template from main namespace
10690 !! wikitext
10691 {{:Main Page}}
10692 !! html
10693 <p>blah blah
10694 </p>
10695 !! end
10696
10697 !! article
10698 Template:table
10699 !! text
10700 {|
10701 | 1 || 2
10702 |-
10703 | 3 || 4
10704 |}
10705 !! endarticle
10706
10707 !! test
10708 BUG 529: Template with table, not included at beginning of line
10709 !! wikitext
10710 foo {{table}}
10711 !! html
10712 <p>foo
10713 </p>
10714 <table>
10715 <tr>
10716 <td> 1 </td>
10717 <td> 2
10718 </td></tr>
10719 <tr>
10720 <td> 3 </td>
10721 <td> 4
10722 </td></tr></table>
10723
10724 !! end
10725
10726 !! test
10727 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10728 !! wikitext
10729 foo
10730 {{table}}
10731 !! html
10732 <p>foo
10733 </p>
10734 <table>
10735 <tr>
10736 <td> 1 </td>
10737 <td> 2
10738 </td></tr>
10739 <tr>
10740 <td> 3 </td>
10741 <td> 4
10742 </td></tr></table>
10743
10744 !! end
10745
10746 !! test
10747 BUG 41: Template parameters shown as broken links
10748 !! wikitext
10749 {{{parameter}}}
10750 !! html
10751 <p>{{{parameter}}}
10752 </p>
10753 !! end
10754
10755 !! test
10756 Template with targets containing wikilinks
10757 !! wikitext
10758 {{[[foo]]}}
10759
10760 {{[[{{echo|foo}}]]}}
10761
10762 {{{{echo|[[foo}}]]}}
10763 !! html
10764 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10765 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10766 </p><p>{{[[foo}}]]
10767 </p>
10768 !! end
10769
10770 !! article
10771 Template:''
10772 !! text
10773 bar
10774 !! endarticle
10775
10776 !! test
10777 Templates: Double quotes as template target
10778 !! wikitext
10779 foo {{''}} baz
10780 !! html/php
10781 <p>foo bar baz
10782 </p>
10783 !! html/parsoid
10784 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10785 </p>
10786 !! end
10787
10788 ## This test is about making sure Parsoid's data-mw is well formed in the
10789 ## face of multiple templates with intersecting and overlapping ranges. The
10790 ## wikitext itself is wretched.
10791 !! test
10792 Templates with intersecting and overlapping ranges
10793 !! wikitext
10794 {|{{echo|
10795 <p>ha</p>}}
10796 {|{{echo|
10797 <p>ho</p>}}
10798 {{echo|{{!}}hi}}
10799 |}
10800 !! html/php+tidy
10801 <p>ha</p>
10802 <p>ho</p>
10803 <table>
10804 <tr>
10805 <td></td>
10806 </tr>
10807 <tr>
10808 <td>hi</td>
10809 </tr>
10810 </table>
10811 <table>
10812 <tr>
10813 <td></td>
10814 </tr>
10815 </table>
10816 !! html/parsoid
10817 <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":""}]]}'>
10818
10819 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10820
10821 <tbody><tr><td>hi</td></tr>
10822 </tbody></table>
10823 !! end
10824
10825 !! article
10826 Template:MSGNW test
10827 !! text
10828 ''None'' of '''this''' should be
10829 * interpreted
10830 but rather passed unmodified
10831 {{test}}
10832 <gallery>
10833 File:Foobar.jpg
10834 </gallery>
10835 <!-- comment -->
10836 !! endarticle
10837
10838 # hmm, fix this or just deprecate msgnw and document its behavior?
10839 !! test
10840 msgnw keyword
10841 !! wikitext
10842 {{msgnw:MSGNW test}}
10843 !! html/php
10844 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10845 &#42; interpreted
10846 &#32;but rather passed unmodified
10847 &#123;&#123;test&#125;&#125;
10848 &#60;gallery&#62;
10849 File:Foobar.jpg
10850 &#60;/gallery&#62;
10851 &#60;!-- comment --&#62;
10852 </p>
10853 !! end
10854
10855 !! test
10856 int keyword
10857 !! wikitext
10858 {{int:youhavenewmessages|lots of money|not!}}
10859 !! html
10860 <p>You have lots of money (not!).
10861 </p>
10862 !! end
10863
10864 !! test
10865 int keyword - non-existing message
10866 !! wikitext
10867 {{int:var}}
10868 !! html
10869 <p>&lt;var&gt;
10870 </p>
10871 !! end
10872
10873 !! article
10874 Template:Includes
10875 !! text
10876 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10877 !! endarticle
10878
10879 !! test
10880 <includeonly> and <noinclude> being included
10881 !! wikitext
10882 {{Includes}}
10883 !! html
10884 <p>Foobar
10885 </p>
10886 !! end
10887
10888 !! article
10889 Template:Includes2
10890 !! text
10891 <onlyinclude>Foo</onlyinclude>bar
10892 !! endarticle
10893
10894 !! test
10895 <onlyinclude> being included
10896 !! wikitext
10897 {{Includes2}}
10898 !! html
10899 <p>Foo
10900 </p>
10901 !! end
10902
10903
10904 !! article
10905 Template:Includes3
10906 !! text
10907 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10908 !! endarticle
10909
10910 !! test
10911 <onlyinclude> and <includeonly> being included
10912 !! wikitext
10913 {{Includes3}}
10914 !! html
10915 <p>Foo
10916 </p>
10917 !! end
10918
10919 !! test
10920 <includeonly> and <noinclude> on a page
10921 !! wikitext
10922 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10923 !! html
10924 <p>Foozar
10925 </p>
10926 !! end
10927
10928 !! test
10929 Un-closed <noinclude>
10930 !! wikitext
10931 <noinclude>
10932 !! html
10933 !! end
10934
10935 !! test
10936 <onlyinclude> on a page
10937 !! wikitext
10938 <onlyinclude>Foo</onlyinclude>bar
10939 !! html
10940 <p>Foobar
10941 </p>
10942 !! end
10943
10944 !! test
10945 Un-closed <onlyinclude>
10946 !! wikitext
10947 <onlyinclude>
10948 !! html
10949 !! end
10950
10951 !!test
10952 Self-closed noinclude, includeonly, onlyinclude tags
10953 !! wikitext
10954 <noinclude />
10955 <includeonly />
10956 <onlyinclude />
10957 !! html
10958 <p><br />
10959 </p>
10960 !!end
10961
10962 !!test
10963 Unbalanced includeonly and noinclude tags
10964 !! wikitext
10965 {|
10966 |a</noinclude>
10967 |b</noinclude></noinclude>
10968 |c</noinclude></includeonly>
10969 |d</includeonly></includeonly>
10970 |}
10971 !! html
10972 <table>
10973 <tr>
10974 <td>a
10975 </td>
10976 <td>b
10977 </td>
10978 <td>c&lt;/includeonly&gt;
10979 </td>
10980 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10981 </td></tr></table>
10982
10983 !!end
10984
10985 !! article
10986 Template:Includeonly section
10987 !! text
10988 <includeonly>
10989 ==Includeonly section==
10990 </includeonly>
10991 ==Section T-1==
10992 !!endarticle
10993
10994 !! test
10995 Bug 6563: Edit link generation for section shown by <includeonly>
10996 !! wikitext
10997 {{includeonly section}}
10998 !! html
10999 <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>
11000 <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>
11001
11002 !! end
11003
11004 # Uses same input as the contents of [[Template:Includeonly section]]
11005 !! test
11006 Bug 6563: Section extraction for section shown by <includeonly>
11007 !! options
11008 section=T-2
11009 !! wikitext
11010 <includeonly>
11011 ==Includeonly section==
11012 </includeonly>
11013 ==Section T-2==
11014 !! html
11015 ==Section T-2==
11016 !! end
11017
11018 !! test
11019 Bug 6563: Edit link generation for section suppressed by <includeonly>
11020 !! wikitext
11021 <includeonly>
11022 ==Includeonly section==
11023 </includeonly>
11024 ==Section 1==
11025 !! html
11026 <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>
11027
11028 !! end
11029
11030 !! test
11031 Bug 6563: Section extraction for section suppressed by <includeonly>
11032 !! options
11033 section=1
11034 !! wikitext
11035 <includeonly>
11036 ==Includeonly section==
11037 </includeonly>
11038 ==Section 1==
11039 !! html
11040 ==Section 1==
11041 !! end
11042
11043 !! test
11044 Un-closed <includeonly>
11045 !! wikitext
11046 <includeonly>
11047 !! html/php
11048 !! html/parsoid
11049 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11050 !! end
11051
11052 ## We used to, but no longer wt2wt this test since the default serializer
11053 ## will normalize the include directives to serialize on their own line.
11054 ## Selser will take care of preserving formatting in scenarios where they
11055 ## intermingled with other wikitext.
11056 !! test
11057 Includes and comments at SOL
11058 !! options
11059 parsoid=wt2html,html2html
11060 !! wikitext
11061 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11062
11063 <noinclude>
11064 some
11065 </noinclude>* stuff
11066 * here
11067
11068 <includeonly>can have stuff</includeonly>=== here ===
11069
11070 !! html/php
11071 <h2><span class="mw-headline" id="hu">hu</span></h2>
11072 <p>some
11073 </p>
11074 <ul><li> stuff</li>
11075 <li> here</li></ul>
11076 <h3><span class="mw-headline" id="here">here</span></h3>
11077
11078 !! html/parsoid
11079 <!-- 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>
11080
11081 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11082 <p>some</p>
11083 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11084 <li> here</li></ul>
11085
11086 <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>
11087
11088 !! end
11089
11090 # TODO: test with DOM fragment reuse!
11091 !! test
11092 Parsoid: DOM fragment reuse
11093 !! options
11094 parsoid=wt2wt,wt2html
11095 !! wikitext
11096 a{{echo|b<table></table>c}}d
11097
11098 a{{echo|b
11099 <table></table>
11100 c}}d
11101
11102 {{echo|a
11103
11104 <table></table>
11105
11106 b}}
11107 !! html
11108 <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>
11109
11110 <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">
11111 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11112 </span><p about="#mwt2">cd</p>
11113
11114 <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">
11115
11116 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11117
11118 </span><p about="#mwt3">b</p>
11119 !! end
11120
11121 !! test
11122 Parsoid: Merge double tds (T52603)
11123 !! options
11124 parsoid
11125 !! wikitext
11126 {|
11127 |{{echo|{{!}} foo}}
11128 |}
11129 !! html
11130 <table><tbody>
11131 <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>
11132 </tbody></table>
11133 !! end
11134
11135 !! test
11136 Parsoid: Merge double tds in nested transclusion content (T52603)
11137 !! options
11138 parsoid
11139 !! wikitext
11140 {{echo|<div>}}
11141 {|
11142 |{{echo|{{!}} foo}}
11143 |}
11144 {{echo|</div>}}
11145 !! html
11146 <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}}]}'>
11147 <table><tbody>
11148 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11149 </tbody></table>
11150 </div>
11151 !! end
11152
11153 ###
11154 ### <includeonly> and <noinclude> in attributes
11155 ###
11156 !!test
11157 0. includeonly around the entire attribute
11158 !! wikitext
11159 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11160 !! html
11161 <p><span id="v2">bar</span>
11162 </p>
11163 !!end
11164
11165 !!test
11166 1. includeonly in html attr key
11167 !! wikitext
11168 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11169 !! html
11170 <p><span id="foo">bar</span>
11171 </p>
11172 !!end
11173
11174 !!test
11175 2. includeonly in html attr value
11176 !! wikitext
11177 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11178 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11179 !! html
11180 <p><span id="v1">bar</span>
11181 <span id="v1">bar</span>
11182 </p>
11183 !!end
11184
11185 !!test
11186 3. includeonly in part of an attr value
11187 !! wikitext
11188 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11189 !! html
11190 <p><span style="color:red;">bar</span>
11191 </p>
11192 !!end
11193
11194 !!test
11195 4. includeonly in table attributes
11196 !! wikitext
11197 {|
11198 |- <noinclude>
11199 |-
11200 |a
11201 </noinclude>
11202 |- <includeonly>
11203 |-
11204 |b
11205 </includeonly>
11206 |}
11207 !! html
11208 <table>
11209
11210
11211 <tr>
11212 <td>a
11213 </td></tr>
11214 </table>
11215
11216 !!end
11217
11218 ###
11219 ### Token Stream Patcher tests
11220 ###
11221 ### These tests won't always pass wt2wt and other modes because
11222 ### on serialization, the table will be output on a new line.
11223 ### For now, we are blacklisting them, and using this to test selser.
11224 ###
11225
11226 !!test
11227 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11228 !!options
11229 parsoid=wt2html,wt2wt
11230 !!wikitext
11231 {{echo|}}{| width = '100%'
11232 |foo
11233 |}
11234 !!html/parsoid
11235 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11236 <tbody><tr><td>foo</td></tr>
11237 </tbody></table>
11238 !!end
11239
11240 ## We used to, but no longer wt2wt this test since the default serializer
11241 ## will normalize the include directives to serialize on their own line.
11242 ## Selser will take care of preserving formatting in scenarios where they
11243 ## intermingled with other wikitext.
11244 !!test
11245 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11246 !!options
11247 parsoid=wt2html
11248 !!wikitext
11249 <includeonly>a</includeonly>{| {{{b}}}
11250 |c
11251 |}
11252 !!html/parsoid
11253 <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":""}]]}'>
11254 <tbody><tr><td>c</td></tr>
11255 </tbody></table>
11256 !!end
11257
11258 ###
11259 ### Testing parsing of templates where a template arg
11260 ### has the same name as the template itself.
11261 ###
11262
11263 !! article
11264 Template:quote
11265 !! text
11266 {{{quote|{{{1}}}}}}
11267 !! endarticle
11268
11269 !!test
11270 Templates: Template Name/Arg clash: 1. Use of positional param
11271 !! wikitext
11272 {{quote|foo}}
11273 !! html
11274 <p>foo
11275 </p>
11276 !!end
11277
11278 !!test
11279 Templates: Template Name/Arg clash: 2. Use of named param
11280 !! wikitext
11281 {{quote|quote=foo}}
11282 !! html
11283 <p>foo
11284 </p>
11285 !!end
11286
11287 !!test
11288 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11289 !! wikitext
11290 {{quote|quote}}
11291 !! html
11292 <p>quote
11293 </p>
11294 !!end
11295
11296 ###
11297 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11298 ###
11299
11300 !!test
11301 Templates: 1. Simple use
11302 !! wikitext
11303 {{echo|Foo}}
11304 !! html
11305 <p>Foo
11306 </p>
11307 !!end
11308
11309 !!test
11310 Templates: 2. Inside a block tag
11311 !! wikitext
11312 <div>{{echo|Foo}}</div>
11313 <blockquote>{{echo|Foo}}</blockquote>
11314 !! html
11315 <div>Foo</div>
11316 <blockquote>Foo</blockquote>
11317
11318 !! html+tidy
11319 <div>Foo</div>
11320 <blockquote>
11321 <p>Foo</p>
11322 </blockquote>
11323 !!end
11324
11325 !!test
11326 Templates: P-wrapping: 1a. Templates on consecutive lines
11327 !! wikitext
11328 {{echo|Foo}}
11329 {{echo|bar}}
11330 !! html
11331 <p>Foo
11332 bar
11333 </p>
11334 !!end
11335
11336 !!test
11337 Templates: P-wrapping: 1b. Templates on consecutive lines
11338 !! wikitext
11339 Foo
11340
11341 {{echo|bar}}
11342 {{echo|baz}}
11343 !! html
11344 <p>Foo
11345 </p><p>bar
11346 baz
11347 </p>
11348 !!end
11349
11350 !!test
11351 Templates: P-wrapping: 1c. Templates on consecutive lines
11352 !! wikitext
11353 {{echo|Foo}}
11354 {{echo|bar}} <div>baz</div>
11355 !! html
11356 <p>Foo
11357 </p>
11358 bar <div>baz</div>
11359
11360 !! html+tidy
11361 <p>Foo</p>
11362 <p>bar</p>
11363 <div>baz</div>
11364 !! end
11365
11366 !!test
11367 Templates: P-wrapping: 1d. Template preceded by comment-only line
11368 !!options
11369 parsoid
11370 !! wikitext
11371 <!-- foo -->
11372 {{echo|Bar}}
11373 !! html
11374 <!-- foo -->
11375
11376 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11377 !!end
11378
11379 !!test
11380 Templates: Inline Text: 1. Multiple template uses
11381 !! wikitext
11382 {{echo|Foo}}bar{{echo|baz}}
11383 !! html
11384 <p>Foobarbaz
11385 </p>
11386 !!end
11387
11388 !!test
11389 Templates: Inline Text: 2. Back-to-back template uses
11390 !! wikitext
11391 {{echo|Foo}}{{echo|bar}}
11392 !! html
11393 <p>Foobar
11394 </p>
11395 !!end
11396
11397 !!test
11398 Templates: Block Tags: 1. Multiple template uses
11399 !! wikitext
11400 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11401 !! html
11402 <div>Foo</div><div>bar</div><div>baz</div>
11403
11404 !!end
11405
11406 !!test
11407 Templates: Block Tags: 2. Back-to-back template uses
11408 !! wikitext
11409 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11410 !! html
11411 <div>Foo</div><div>bar</div>
11412
11413 !!end
11414
11415 # This is an edge case relating to paragraph wrapping.
11416 !!test
11417 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11418 !! wikitext
11419 {{echo|a
11420 b</p>}}
11421 !! html/parsoid
11422 <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
11423 b</p>
11424 !!end
11425
11426 !!test
11427 Templates: Links: 1. Simple example
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: 2. Generation of link href
11437 !! wikitext
11438 [[{{echo|Foo}}|bar]]
11439 !! html
11440 <p><a href="/wiki/Foo" title="Foo">bar</a>
11441 </p>
11442 !!end
11443
11444 !!test
11445 Templates: Links: 3. Generation of part of a link href
11446 !! wikitext
11447 [[Fo{{echo|o}}|bar]]
11448
11449 [[Foo{{echo|bar}}]]
11450
11451 [[Foo{{echo|bar}}baz]]
11452
11453 [[Foo{{echo|bar}}|bar]]
11454
11455 [[:Foo{{echo|bar}}]]
11456
11457 [[:Foo{{echo|bar}}|bar]]
11458 !! html
11459 <p><a href="/wiki/Foo" title="Foo">bar</a>
11460 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11461 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11462 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11463 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11464 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11465 </p>
11466 !!end
11467
11468 !!test
11469 Templates: Links: 4. Multiple templates generating link href
11470 !! wikitext
11471 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11472 !! html
11473 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11474 </p>
11475 !!end
11476
11477 !!test
11478 Templates: Links: 5. Generation of link text
11479 !! wikitext
11480 [[Foo|{{echo|bar}}]]
11481 !! html
11482 <p><a href="/wiki/Foo" title="Foo">bar</a>
11483 </p>
11484 !!end
11485
11486 !!test
11487 Templates: Links: 5. Nested templates (only outermost template should be marked)
11488 !! wikitext
11489 {{echo|[[{{echo|Foo}}|bar]]}}
11490 !! html
11491 <p><a href="/wiki/Foo" title="Foo">bar</a>
11492 </p>
11493 !!end
11494
11495 !!test
11496 Templates: HTML Tag: 1. Generation of HTML attr. key
11497 !! wikitext
11498 <div {{echo|style}}="color:red;">foo</div>
11499 !! html
11500 <div style="color:red;">foo</div>
11501
11502 !!end
11503
11504 !!test
11505 Templates: HTML Tag: 2. Generation of HTML attr. value
11506 !! wikitext
11507 <div 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: 3. Generation of HTML attr key and value
11515 !! wikitext
11516 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11517 !! html
11518 <div style="color:red;">foo</div>
11519
11520 !!end
11521
11522 !!test
11523 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11524 !! wikitext
11525 <div title="{{echo|This is a long title}} with just 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: 5. Generation of middle piece of HTML attr value
11533 !! wikitext
11534 <div title="This is a long title with just {{echo|one piece}} 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 !!test
11541 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11542 !! wikitext
11543 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11544 !! html
11545 <div title="This is a long title with just one piece templated">foo</div>
11546
11547 !!end
11548
11549 # SSS FIXME: While it is great we added support for all this,
11550 # do we want to make this part of the spec? Maybe we want to
11551 # deprecate this kind of usage in the future?
11552 !!test
11553 Templates: HTML Tag: 7. Generation of partial attribute key string
11554 !! wikitext
11555 <div st{{echo|yle}}="color:red;">foo</div>
11556 !! html
11557 <div style="color:red;">foo</div>
11558
11559 !!end
11560
11561 !! test
11562 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11563 !! wikitext
11564 <div {{echo|1=id="v1"}}>bar</div>
11565 !! html
11566 <div id="v1">bar</div>
11567
11568 !!end
11569
11570 !! test
11571 Templates: HTML Tag: 9. Multiple template-generated attributes
11572 !! wikitext
11573 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11574 !! html
11575 <div id="v1" title="foo">bar</div>
11576
11577 !!end
11578
11579 !! test
11580 Templates: Support for templates generating attributes and content
11581 !! wikitext
11582 {| {{mixed_attr_content_template}}
11583 |-
11584 |bar
11585 |}
11586 !! html/php
11587 <table style="color:red;" title="T48811">
11588
11589 <tr>
11590 <td>foo
11591 </td></tr>
11592 <tr>
11593 <td>bar
11594 </td></tr></table>
11595
11596 !! html/parsoid
11597 <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|}"]}'>
11598 <tbody><tr>
11599 <td>foo</td></tr>
11600 <tr>
11601 <td>bar</td></tr>
11602 </tbody></table>
11603 !!end
11604
11605 !! test
11606 1. Entities and nowikis inside templated attributes should be handled correctly
11607 !! wikitext
11608 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11609 !! html/php
11610 <div style="background:#f9f9f9;">foo</div>
11611
11612 !! html/parsoid
11613 <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>
11614 !! end
11615
11616 !! test
11617 2. Entities and nowikis inside templated attributes should be handled correctly
11618 !! wikitext
11619 {|
11620 |{{table_attribs_3}}
11621 |}
11622 !! html/php
11623 <table>
11624 <tr>
11625 <td style="background:#f9f9f9;">Foo
11626 </td></tr></table>
11627
11628 !! html/parsoid
11629 <table>
11630 <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>
11631 </tbody></table>
11632 !! end
11633
11634 !! test
11635 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11636 !! wikitext
11637 {{tbl-start}}
11638 |{{table_attribs_3}}
11639 {{tbl-end}}
11640 !! html/php
11641 <table>
11642 <tr>
11643 <td style="background:#f9f9f9;">Foo
11644 </td></tr></table>
11645
11646 !! html/parsoid
11647 <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}}]}'>
11648 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11649 </tbody></table>
11650 !! end
11651
11652 # T107622
11653 !! test
11654 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11655 !! wikitext
11656 {|
11657 | {{table_attribs_6}} hi
11658 |}
11659 !! html/php
11660 <table>
11661 <tr>
11662 <td style="background: red;"> hi
11663 </td></tr></table>
11664
11665 !! html/parsoid
11666 <table>
11667 <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>
11668 </tbody></table>
11669 !! end
11670
11671 !!test
11672 Templates: HTML Tables: 1. Generating start of a HTML table
11673 !! wikitext
11674 {{echo|<table><tr><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: 2a. Generating middle of a HTML table
11682 !! wikitext
11683 <table><tr>{{echo|<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: 2b. Generating middle of a HTML table
11691 !! wikitext
11692 <table>{{echo|<tr><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: 3. Generating end of a HTML table
11700 !! wikitext
11701 <table><tr>{{echo|<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: 4a. Generating a single tag of a HTML table
11709 !! wikitext
11710 {{echo|<table>}}<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: 4b. Generating a single tag of a HTML table
11718 !! wikitext
11719 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
11727 !! wikitext
11728 <table><tr>{{echo|<td>}}foo</td></tr></table>
11729 !! html
11730 <table><tr><td>foo</td></tr></table>
11731
11732 !!end
11733
11734 !!test
11735 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11736 !! wikitext
11737 <table><tr><td>foo{{echo|</td>}}</tr></table>
11738 !! html
11739 <table><tr><td>foo</td></tr></table>
11740
11741 !!end
11742
11743 !!test
11744 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11745 !! wikitext
11746 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11747 !! html
11748 <table><tr><td>foo</td></tr></table>
11749
11750 !!end
11751
11752 !!test
11753 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11754 !! wikitext
11755 <table><tr><td>foo</td></tr>{{echo|</table>}}
11756 !! html
11757 <table><tr><td>foo</td></tr></table>
11758
11759 !!end
11760
11761 !!test
11762 Templates: HTML Tables: 5. Proper fostering of categories from inside
11763 !!options
11764 parsoid=wt2html,wt2wt
11765 !! wikitext
11766 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11767 <!--Two categories (Bug 50330)-->
11768 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11769 !! html
11770 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11771 <!--Two categories (Bug 50330)-->
11772 <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>
11773 !!end
11774
11775 !!test
11776 Templates: Wiki Tables: 1a. Fostering of entire template content
11777 !! wikitext
11778 {|
11779 {{echo|a}}
11780 |}
11781 !! html
11782 <table>
11783 a
11784 <tr><td></td></tr></table>
11785
11786 !! html+tidy
11787 <p>a</p>
11788 <table>
11789 <tr>
11790 <td></td>
11791 </tr>
11792 </table>
11793 !! end
11794
11795 !!test
11796 Templates: Wiki Tables: 1b. Fostering of entire template content
11797 !! wikitext
11798 {|
11799 {{echo|<div>}}
11800 foo
11801 {{echo|</div>}}
11802 |}
11803 !! html
11804 <table>
11805 <div>
11806 <p>foo
11807 </p>
11808 </div>
11809 <tr><td></td></tr></table>
11810
11811 !! html+tidy
11812 <div>
11813 <p>foo</p>
11814 </div>
11815 <table>
11816 <tr>
11817 <td></td>
11818 </tr>
11819 </table>
11820 !! end
11821
11822 !!test
11823 Templates: Wiki Tables: 2. Fostering of partial template content
11824 !! wikitext
11825 {|
11826 {{echo|a
11827 <div>b</div>}}
11828 |}
11829 !! html
11830 <table>
11831 a
11832 <div>b</div>
11833 <tr><td></td></tr></table>
11834
11835 !! html+tidy
11836 <p>a</p>
11837 <div>b</div>
11838 <table>
11839 <tr>
11840 <td></td>
11841 </tr>
11842 </table>
11843 !! end
11844
11845 !!test
11846 Templates: Wiki Tables: 3. td-content via multiple templates
11847 !! wikitext
11848 {|
11849 {{echo|{{pipe}}a}}{{echo|b}}
11850 |}
11851 !! html
11852 <table>
11853 <tr>
11854 <td>ab
11855 </td></tr></table>
11856
11857 !!end
11858
11859 !!test
11860 Templates: Wiki Tables: 4. Templated tags, no content
11861 !! wikitext
11862 {{tbl-start}}
11863 {{tbl-end}}
11864 !! html
11865 <table>
11866 <tr><td></td></tr></table>
11867
11868 !!end
11869
11870 !!test
11871 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11872 !! wikitext
11873 {{tbl-start}}
11874 |foo
11875 {{tbl-end}}
11876 !! html
11877 <table>
11878 <tr>
11879 <td>foo
11880 </td></tr></table>
11881
11882 !!end
11883
11884 !!test
11885 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11886 !! wikitext
11887 {{tbl-start}}
11888 {{!}}foo
11889 {{tbl-end}}
11890 !! html
11891 <table>
11892 <tr>
11893 <td>foo
11894 </td></tr></table>
11895
11896 !!end
11897
11898 ## This test case is very specific to Parsoid's internals
11899 ## and is hence only tested for Parsoid's code. Parsoid uses
11900 ## a <meta> marker tag for <ref> tags and they are expanded
11901 ## much later. We are verifying that this <meta> tag usage
11902 ## doesn't prevent foster parenting.
11903 !!test
11904 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11905 !!wikitext
11906 {{PartialTable}}<ref>foo</ref>
11907 |}
11908
11909 <references />
11910 !!html/parsoid
11911 <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">
11912 <tbody>
11913 </tbody></table>
11914
11915 <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>
11916 !!end
11917
11918 !! test
11919 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11920 !! wikitext
11921 {{echo|
11922 {{{!}}
11923 {{!}}-}}
11924 <onlyinclude>
11925 |foo
11926 </onlyinclude>
11927 {{!}}}
11928 !! html/parsoid
11929 <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{{!}}}"]}'>
11930 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11931 <tbody><tr>
11932
11933 <td>foo
11934 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11935 </tbody></table>
11936 !! end
11937
11938 !!test
11939 Templates: Lists: Multi-line list-items via templates
11940 !! wikitext
11941 *{{echo|a {{nonexistent|
11942 unused}}}}
11943 *{{echo|b {{nonexistent|
11944 unused}}}}
11945 !! html
11946 <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>
11947 <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>
11948
11949 !!end
11950
11951 !!test
11952 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11953 !! wikitext
11954 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11955 !! html
11956 <p><i>ab</i>c<i>d</i>e
11957 </p>
11958 !!end
11959
11960 !!test
11961 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11962 (PHP parser generates misnested html)
11963 !! wikitext
11964 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11965 !! html/parsoid
11966 <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>
11967 !!end
11968
11969 !!test
11970 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11971 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11972 !! options
11973 parsoid=wt2html,wt2wt
11974 !! wikitext
11975 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11976 !! html
11977 <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>
11978 <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>
11979 <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>
11980 !!end
11981
11982 !!test
11983 Templates: Ugly nesting: 4. Divs opened/closed across templates
11984 !! wikitext
11985 a<div>b{{echo|c</div>d}}e
11986 !! html
11987 a<div>bc</div>de
11988
11989 !! html+tidy
11990 <p>a</p>
11991 <div>bc</div>
11992 <p>de</p>
11993 !! end
11994
11995 !!test
11996 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11997 (Parsoid-centric)
11998 !! options
11999 parsoid
12000 !! wikitext
12001 {|
12002 |{{echo|foo</table>}}
12003 |bar
12004 |}
12005 !! html
12006 <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|}"]}'>
12007
12008 <tbody>
12009 <tr>
12010 <td>foo</td></tr></tbody></table><span about="#mwt1">
12011 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12012 |}</span>
12013 !!end
12014
12015 !!test
12016 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12017 (Parsoid-centric)
12018 !! options
12019 parsoid
12020 !! wikitext
12021 <table>
12022 <tr>
12023 <td>
12024 <table>
12025 <tr>
12026 <td>1. {{echo|foo </table>}}</td>
12027 <td> bar </td>
12028 <td>2. {{echo|baz </table>}}</td>
12029 </tr>
12030 <tr>
12031 <td>abc</td>
12032 </tr>
12033 </table>
12034 </td>
12035 </tr>
12036 <tr>
12037 <td>xyz</td>
12038 </tr>
12039 </table>
12040 !! html
12041 <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>"]}'>
12042 <tbody><tr>
12043 <td>
12044 <table>
12045 <tbody><tr>
12046 <td>1. foo </td></tr></tbody></table></td>
12047 <td> bar </td>
12048 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12049 </span><span about="#mwt2">
12050 </span><span about="#mwt2">
12051 </span><span about="#mwt2">abc</span><span about="#mwt2">
12052 </span><span about="#mwt2">
12053 </span><span about="#mwt2">
12054 </span><span about="#mwt2">
12055 </span><span about="#mwt2">
12056 </span><span about="#mwt2">
12057 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12058 </span><span about="#mwt2">
12059 </span>
12060 !!end
12061
12062 !! test
12063 Templates: Ugly templates: 3. newline-only template parameter
12064 !! wikitext
12065 foo {{echo|
12066 }}
12067 !! html
12068 <p>foo
12069 </p>
12070 !! end
12071
12072 # This looks like a bug: a single newline triggers p/br for some reason.
12073 !! test
12074 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12075 !! wikitext
12076 {{echo|
12077 }}
12078 !! html
12079 <p><br />
12080 </p>
12081 !! end
12082
12083 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12084 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12085 !! test
12086 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12087 !! wikitext
12088 {{echo|<table>}}
12089 {{echo|<div>foo}}
12090 {{echo|</table>}}
12091 !! html/parsoid
12092 <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
12093 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12094 </table>
12095 !! end
12096
12097 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12098 # that are "identical" and generate nesting cycles in the algorithm
12099 !! test
12100 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12101 !! wikitext
12102 {{echo|<table><tr><td><table>}}
12103 {{echo|<div>}}
12104 {{echo|</div>}}
12105 !! html/parsoid
12106 <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"}'>
12107 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12108 </table></td></tr></tbody></table>
12109 !! end
12110
12111 !! test
12112 Templates: Parameters substituted at the top-level
12113 !! wikitext
12114 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12115 !! html/php
12116 <p><i>who</i> me? <b>never!</b>
12117 </p>
12118 !! html/parsoid
12119 <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>
12120 !! end
12121
12122 !!test
12123 Parser Functions: 1. Simple example
12124 !! wikitext
12125 {{uc:foo}}
12126 !! html
12127 <p>FOO
12128 </p>
12129 !!end
12130
12131 !!test
12132 Parser Functions: 2. Nested use (only outermost should be marked up)
12133 !! wikitext
12134 {{uc:{{lc:FOO}}}}
12135 !! html
12136 <p>FOO
12137 </p>
12138 !!end
12139
12140 ###
12141 ### Pre-save transform tests
12142 ###
12143 !! test
12144 pre-save transform: subst:
12145 !! options
12146 pst
12147 !! wikitext
12148 {{subst:test}}
12149 !! html/php
12150 This is a test template
12151 !! end
12152
12153 !! test
12154 pre-save transform: normal template
12155 !! options
12156 pst
12157 !! wikitext
12158 {{test}}
12159 !! html/php
12160 {{test}}
12161 !! end
12162
12163 !! test
12164 pre-save transform: nonexistent template
12165 !! options
12166 pst
12167 !! wikitext
12168 {{thistemplatedoesnotexist}}
12169 !! html/php
12170 {{thistemplatedoesnotexist}}
12171 !! end
12172
12173 !! test
12174 pre-save transform: subst magic variables
12175 !! options
12176 pst
12177 !! wikitext
12178 {{subst:SITENAME}}
12179 !! html/php
12180 MediaWiki
12181 !! end
12182
12183 # This is bug 89, which I fixed. -- wtm
12184 !! test
12185 pre-save transform: subst: templates with parameters
12186 !! options
12187 pst
12188 !! wikitext
12189 {{subst:paramtest|param="something else"}}
12190 !! html/php
12191 This is a test template with parameter "something else"
12192 !! end
12193
12194 !! article
12195 Template:nowikitest
12196 !! text
12197 <nowiki>'''not wiki'''</nowiki>
12198 !! endarticle
12199
12200 !! test
12201 pre-save transform: nowiki in subst (bug 1188)
12202 !! options
12203 pst
12204 !! wikitext
12205 {{subst:nowikitest}}
12206 !! html/php
12207 <nowiki>'''not wiki'''</nowiki>
12208 !! end
12209
12210 !! article
12211 Template:commenttest
12212 !! text
12213 This template has <!-- a comment --> in it.
12214 !! endarticle
12215
12216 !! test
12217 pre-save transform: comment in subst (bug 1936)
12218 !! options
12219 pst
12220 !! wikitext
12221 {{subst:commenttest}}
12222 !! html/php
12223 This template has <!-- a comment --> in it.
12224 !! end
12225
12226 !! test
12227 pre-save transform: unclosed tag
12228 !! options
12229 pst
12230 !! wikitext
12231 <nowiki>'''not wiki'''
12232 !! html/php
12233 <nowiki>'''not wiki'''
12234 !! end
12235
12236 !! test
12237 pre-save transform: mixed tag case
12238 !! options
12239 pst
12240 !! wikitext
12241 <NOwiki>'''not wiki'''</noWIKI>
12242 !! html/php
12243 <NOwiki>'''not wiki'''</noWIKI>
12244 !! end
12245
12246 !! test
12247 pre-save transform: unclosed comment in <nowiki>
12248 !! options
12249 pst
12250 !! wikitext
12251 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12252 !! html/php
12253 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12254 !!end
12255
12256 # Leading @ in this template definition works around a limitation
12257 # in parsoid's parserTests which otherwise strips the <span> from the
12258 # result (confusing it for a template wrapper)
12259 !! article
12260 Template:dangerous
12261 !!text
12262 @<span onmouseover="alert('crap')">Oh no</span>
12263 !!endarticle
12264
12265 !!test
12266 (confirming safety of fix for subst bug 1936)
12267 !! wikitext
12268 {{Template:dangerous}}
12269 !! html
12270 <p>@<span>Oh no</span>
12271 </p>
12272 !! end
12273
12274 !! test
12275 pre-save transform: comment containing gallery (bug 5024)
12276 !! options
12277 pst
12278 !! wikitext
12279 <!-- <gallery>data</gallery> -->
12280 !! html/php
12281 <!-- <gallery>data</gallery> -->
12282 !!end
12283
12284 !! test
12285 pre-save transform: comment containing extension
12286 !! options
12287 pst
12288 !! wikitext
12289 <!-- <tag>data</tag> -->
12290 !! html/php
12291 <!-- <tag>data</tag> -->
12292 !!end
12293
12294 !! test
12295 pre-save transform: comment containing nowiki
12296 !! options
12297 pst
12298 !! wikitext
12299 <!-- <nowiki>data</nowiki> -->
12300 !! html/php
12301 <!-- <nowiki>data</nowiki> -->
12302 !!end
12303
12304 !! test
12305 pre-save transform: <noinclude> in subst (bug 3298)
12306 !! options
12307 pst
12308 !! wikitext
12309 {{subst:Includes}}
12310 !! html/php
12311 Foobar
12312 !! end
12313
12314 !! test
12315 pre-save transform: <onlyinclude> in subst (bug 3298)
12316 !! options
12317 pst
12318 !! wikitext
12319 {{subst:Includes2}}
12320 !! html/php
12321 Foo
12322 !! end
12323
12324 !! article
12325 Template:SubstTest
12326 !!text
12327 {{<includeonly>subst:</includeonly>Includes}}
12328 !! endarticle
12329
12330 !! article
12331 Template:SafeSubstTest
12332 !! text
12333 {{<includeonly>safesubst:</includeonly>Includes}}
12334 !! endarticle
12335
12336 !! test
12337 bug 22297: safesubst: works during PST
12338 !! options
12339 pst
12340 !! wikitext
12341 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12342 !! html/php
12343 FoobarFoobar
12344 !! end
12345
12346 !! test
12347 bug 22297: safesubst: works during normal parse
12348 !! wikitext
12349 {{SafeSubstTest}}
12350 !! html
12351 <p>Foobar
12352 </p>
12353 !! end
12354
12355 !! test
12356 subst: does not work during normal parse
12357 !! wikitext
12358 {{SubstTest}}
12359 !! html
12360 <p>{{subst:Includes}}
12361 </p>
12362 !! end
12363
12364 !! test
12365 pre-save transform: context links ("pipe trick")
12366 !! options
12367 pst
12368 !! wikitext
12369 [[Article (context)|]]
12370 [[Bar:Article|]]
12371 [[:Bar:Article|]]
12372 [[Bar:Article (context)|]]
12373 [[:Bar:Article (context)|]]
12374 [[|Article]]
12375 [[|Article (context)]]
12376 [[Bar:X (Y) Z|]]
12377 [[:Bar:X (Y) Z|]]
12378 !! html/php
12379 [[Article (context)|Article]]
12380 [[Bar:Article|Article]]
12381 [[:Bar:Article|Article]]
12382 [[Bar:Article (context)|Article]]
12383 [[:Bar:Article (context)|Article]]
12384 [[Article]]
12385 [[Article (context)]]
12386 [[Bar:X (Y) Z|X (Y) Z]]
12387 [[:Bar:X (Y) Z|X (Y) Z]]
12388 !! end
12389
12390 !! test
12391 pre-save transform: context links ("pipe trick") with interwiki prefix
12392 !! options
12393 pst
12394 !! wikitext
12395 [[interwiki:Article|]]
12396 [[:interwiki:Article|]]
12397 [[interwiki:Bar:Article|]]
12398 [[:interwiki:Bar:Article|]]
12399 !! html/php
12400 [[interwiki:Article|Article]]
12401 [[:interwiki:Article|Article]]
12402 [[interwiki:Bar:Article|Bar:Article]]
12403 [[:interwiki:Bar:Article|Bar:Article]]
12404 !! end
12405
12406 !! test
12407 pre-save transform: context links ("pipe trick") with parens in title
12408 !! options
12409 pst title=[[Somearticle (context)]]
12410 !! wikitext
12411 [[|Article]]
12412 !! html/php
12413 [[Article (context)|Article]]
12414 !! end
12415
12416 !! test
12417 pre-save transform: context links ("pipe trick") with comma in title
12418 !! options
12419 pst title=[[Someplace, Somewhere]]
12420 !! wikitext
12421 [[|Otherplace]]
12422 [[Otherplace, Elsewhere|]]
12423 [[Otherplace, Elsewhere, Anywhere|]]
12424 !! html/php
12425 [[Otherplace, Somewhere|Otherplace]]
12426 [[Otherplace, Elsewhere|Otherplace]]
12427 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12428 !! end
12429
12430 !! test
12431 pre-save transform: context links ("pipe trick") with parens and comma
12432 !! options
12433 pst title=[[Someplace (IGNORED), Somewhere]]
12434 !! wikitext
12435 [[|Otherplace]]
12436 [[Otherplace (place), Elsewhere|]]
12437 !! html/php
12438 [[Otherplace, Somewhere|Otherplace]]
12439 [[Otherplace (place), Elsewhere|Otherplace]]
12440 !! end
12441
12442 !! test
12443 pre-save transform: context links ("pipe trick") with comma and parens
12444 !! options
12445 pst title=[[Who, me? (context)]]
12446 !! wikitext
12447 [[|Yes, you.]]
12448 [[Me, Myself, and I (1937 song)|]]
12449 !! html/php
12450 [[Yes, you. (context)|Yes, you.]]
12451 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12452 !! end
12453
12454 !! test
12455 pre-save transform: context links ("pipe trick") with namespace
12456 !! options
12457 pst title=[[Ns:Somearticle]]
12458 !! wikitext
12459 [[|Article]]
12460 !! html/php
12461 [[Ns:Article|Article]]
12462 !! end
12463
12464 !! test
12465 pre-save transform: context links ("pipe trick") with namespace and parens
12466 !! options
12467 pst title=[[Ns:Somearticle (context)]]
12468 !! wikitext
12469 [[|Article]]
12470 !! html/php
12471 [[Ns:Article (context)|Article]]
12472 !! end
12473
12474 !! test
12475 pre-save transform: context links ("pipe trick") with namespace and comma
12476 !! options
12477 pst title=[[Ns:Somearticle, Context, Whatever]]
12478 !! wikitext
12479 [[|Article]]
12480 !! html/php
12481 [[Ns:Article, Context, Whatever|Article]]
12482 !! end
12483
12484 !! test
12485 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12486 !! options
12487 pst title=[[Ns:Somearticle, Context (context)]]
12488 !! wikitext
12489 [[|Article]]
12490 !! html/php
12491 [[Ns:Article (context)|Article]]
12492 !! end
12493
12494 !! test
12495 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12496 !! options
12497 pst title=[[Ns:Somearticle (IGNORED), Context]]
12498 !! wikitext
12499 [[|Article]]
12500 !! html/php
12501 [[Ns:Article, Context|Article]]
12502 !! end
12503
12504 !! test
12505 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12506 !! options
12507 pst
12508 !! wikitext
12509 [[Article(context)|]]
12510 [[Bar:Article(context)|]]
12511 [[:Bar:Article(context)|]]
12512 [[|Article(context)]]
12513 [[Bar:X(Y)Z|]]
12514 [[:Bar:X(Y)Z|]]
12515 !! html/php
12516 [[Article(context)|Article]]
12517 [[Bar:Article(context)|Article]]
12518 [[:Bar:Article(context)|Article]]
12519 [[Article(context)]]
12520 [[Bar:X(Y)Z|X(Y)Z]]
12521 [[:Bar:X(Y)Z|X(Y)Z]]
12522 !! end
12523
12524 !! test
12525 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12526 !! options
12527 pst
12528 !! wikitext
12529 [[Article (context)|]]
12530 [[Bar:Article (context)|]]
12531 [[:Bar:Article (context)|]]
12532 [[|Article (context)]]
12533 [[Bar:X (Y) Z|]]
12534 [[:Bar:X (Y) Z|]]
12535 !! html/php
12536 [[Article (context)|Article]]
12537 [[Bar:Article (context)|Article]]
12538 [[:Bar:Article (context)|Article]]
12539 [[Article (context)]]
12540 [[Bar:X (Y) Z|X (Y) Z]]
12541 [[:Bar:X (Y) Z|X (Y) Z]]
12542 !! end
12543
12544 !! test
12545 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12546 !! options
12547 pst
12548 !! wikitext
12549 [[Article(context)|]]
12550 [[Bar:Article(context)|]]
12551 [[:Bar:Article(context)|]]
12552 [[|Article(context)]]
12553 [[Bar:X(Y)Z|]]
12554 [[:Bar:X(Y)Z|]]
12555 !! html/php
12556 [[Article(context)|Article]]
12557 [[Bar:Article(context)|Article]]
12558 [[:Bar:Article(context)|Article]]
12559 [[Article(context)]]
12560 [[Bar:X(Y)Z|X(Y)Z]]
12561 [[:Bar:X(Y)Z|X(Y)Z]]
12562 !! end
12563
12564 !! test
12565 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12566 !! options
12567 pst
12568 !! wikitext
12569 [[Article (context), context|]]
12570 [[Article (context),context|]]
12571 [[Bar:Article (context), context|]]
12572 [[Bar:Article (context),context|]]
12573 [[:Bar:Article (context), context|]]
12574 [[:Bar:Article (context),context|]]
12575 !! html/php
12576 [[Article (context), context|Article]]
12577 [[Article (context),context|Article]]
12578 [[Bar:Article (context), context|Article]]
12579 [[Bar:Article (context),context|Article]]
12580 [[:Bar:Article (context), context|Article]]
12581 [[:Bar:Article (context),context|Article]]
12582 !! end
12583
12584 !! test
12585 pre-save transform: trim trailing empty lines
12586 !! options
12587 pst
12588 !! wikitext
12589 Empty lines are trimmed
12590
12591
12592
12593
12594 !! html/php
12595 Empty lines are trimmed
12596 !! end
12597
12598 !! test
12599 pre-save transform: Signature expansion
12600 !! options
12601 pst
12602 !! wikitext
12603 * ~~~
12604 * <noinclude>~~~</noinclude>
12605 * <includeonly>~~~</includeonly>
12606 * <onlyinclude>~~~</onlyinclude>
12607 !! html/php
12608 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12609 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12610 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12611 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12612 !! end
12613
12614
12615 !! test
12616 pre-save transform: Signature expansion in nowiki tags (bug 93)
12617 !! options
12618 pst disabled
12619 !! wikitext
12620 Shall not expand:
12621
12622 <nowiki>~~~~</nowiki>
12623
12624 <includeonly><nowiki>~~~~</nowiki></includeonly>
12625
12626 <noinclude><nowiki>~~~~</nowiki></noinclude>
12627
12628 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12629
12630 {{subst:Foo}} shall be converted to FOO
12631
12632 As well as inside noinclude/onlyinclude
12633 <noinclude>{{subst:Foo}}</noinclude>
12634 <onlyinclude>{{subst:Foo}}</onlyinclude>
12635
12636 But not inside includeonly
12637 <includeonly>{{subst:Foo}}</includeonly>
12638 !! html/php
12639 Shall not expand:
12640
12641 <nowiki>~~~~</nowiki>
12642
12643 <includeonly><nowiki>~~~~</nowiki></includeonly>
12644
12645 <noinclude><nowiki>~~~~</nowiki></noinclude>
12646
12647 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12648
12649 FOO shall be converted to FOO
12650
12651 As well as inside noinclude/onlyinclude
12652 <noinclude>FOO</noinclude>
12653 <onlyinclude>FOO</onlyinclude>
12654
12655 But not inside includeonly
12656 <includeonly>{{subst:Foo}}</includeonly>
12657 !! end
12658
12659 !! test
12660 Parsoid: Recognize nowiki with trailing space in tags
12661 !! options
12662 parsoid=wt2html
12663 !! wikitext
12664 <nowiki ><div>[[foo]]</nowiki >
12665
12666 a<nowiki / >b
12667
12668 c<nowiki />d
12669
12670 e<nowiki/ >f
12671 !! html
12672 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12673 <p>ab</p>
12674 <p>cd</p>
12675 <p>ef</p>
12676 !! end
12677
12678 !! test
12679 Parsoid: Recognize nowiki with odd capitalization
12680 !! options
12681 parsoid=wt2html
12682 !! wikitext
12683 <noWikI ><div>[[foo]]</Nowiki >
12684 !! html
12685 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12686 !! end
12687
12688
12689 !! test
12690 Parsoid: Escape nowiki with trailing space in tags
12691 !! options
12692 parsoid=html2wt
12693 !! html/parsoid
12694 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12695 <p>a&lt;nowiki /&gt;b</p>
12696 <p>c&lt;nowiki/ &gt;d</p>
12697 !! wikitext
12698 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12699
12700 a&lt;nowiki /&gt;b
12701
12702 c&lt;nowiki/ &gt;d
12703 !! end
12704
12705 !! test
12706 Parsoid: Escape weird noWikI capitalizations
12707 !! options
12708 parsoid=html2wt
12709 !! html/parsoid
12710 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12711 !! wikitext
12712 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12713 !! end
12714
12715 ###
12716 ### Message transform tests
12717 ###
12718 !! test
12719 message transform: magic variables
12720 !! options
12721 msg
12722 !! wikitext
12723 {{SITENAME}}
12724 !! html
12725 MediaWiki
12726 !! end
12727
12728 !! test
12729 message transform: should not transform wiki markup
12730 !! options
12731 msg
12732 !! wikitext
12733 ''test''
12734 !! html
12735 ''test''
12736 !! end
12737
12738 !! test
12739 message transform: <noinclude> in transcluded template (bug 4926)
12740 !! options
12741 msg
12742 !! wikitext
12743 {{Includes}}
12744 !! html
12745 Foobar
12746 !! end
12747
12748 !! test
12749 message transform: <onlyinclude> in transcluded template (bug 4926)
12750 !! options
12751 msg
12752 !! wikitext
12753 {{Includes2}}
12754 !! html
12755 Foo
12756 !! end
12757
12758 !! test
12759 {{#special:}} page name, known
12760 !! options
12761 msg
12762 !! wikitext
12763 {{#special:Recentchanges}}
12764 !! html
12765 Special:RecentChanges
12766 !! end
12767
12768 !! test
12769 {{#special:}} page name with subpage, known
12770 !! options
12771 msg
12772 !! wikitext
12773 {{#special:Recentchanges/param}}
12774 !! html
12775 Special:RecentChanges/param
12776 !! end
12777
12778 !! test
12779 {{#special:}} page name, unknown
12780 !! options
12781 msg
12782 !! wikitext
12783 {{#special:foobar nonexistent}}
12784 !! html
12785 Special:Foobar nonexistent
12786 !! end
12787
12788 !! test
12789 {{#speciale:}} page name, known
12790 !! options
12791 msg
12792 !! wikitext
12793 {{#speciale:Recentchanges}}
12794 !! html
12795 Special:RecentChanges
12796 !! end
12797
12798 !! test
12799 {{#speciale:}} page name with subpage, known
12800 !! options
12801 msg
12802 !! wikitext
12803 {{#speciale:Recentchanges/param}}
12804 !! html
12805 Special:RecentChanges/param
12806 !! end
12807
12808 !! test
12809 {{#speciale:}} page name, unknown
12810 !! options
12811 msg
12812 !! wikitext
12813 {{#speciale:foobar nonexistent}}
12814 !! html
12815 Special:Foobar_nonexistent
12816 !! end
12817
12818 ###
12819 ### Images
12820 ###
12821 ### For Parsoid-specific tests, see
12822 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12823
12824 !! test
12825 Simple image
12826 !! options
12827 parsoid=wt2html,wt2wt,html2html
12828 !! wikitext
12829 [[Image:foobar.jpg]]
12830 !! html/php
12831 <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>
12832 </p>
12833 !! html/parsoid
12834 <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>
12835 !! end
12836
12837 !! test
12838 Simple image (using File: namespace, now canonical)
12839 !! wikitext
12840 [[File:Foobar.jpg]]
12841 !! html/php
12842 <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>
12843 </p>
12844 !! html/parsoid
12845 <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>
12846 !! end
12847
12848 !! test
12849 Right-aligned image
12850 !! wikitext
12851 [[File:Foobar.jpg|right]]
12852 !! html/php
12853 <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>
12854
12855 !! html/parsoid
12856 <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>
12857 !! end
12858
12859 !! test
12860 Image with caption
12861 !! wikitext
12862 [[File:Foobar.jpg|right|Caption text]]
12863 !! html/php
12864 <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>
12865
12866 !! html/parsoid
12867 <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>
12868 !! end
12869
12870 !! test
12871 Image with caption, bug 53312 #1
12872 !! wikitext
12873 [[File:Foobar.jpg|right|Caption page stuff]]
12874 !! html/php
12875 <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>
12876
12877 !! html/parsoid
12878 <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>
12879 !! end
12880
12881 !! test
12882 Image with caption, bug 53312 #2
12883 !! wikitext
12884 [[File:Foobar.jpg|right|Caption page=]]
12885 !! html/php
12886 <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>
12887
12888 !! html/parsoid
12889 <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>
12890 !! end
12891
12892 !! test
12893 Image with caption, bug 53312 #3
12894 !! wikitext
12895 [[File:Foobar.jpg|right|Caption page=stuff]]
12896 !! html/php
12897 <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>
12898
12899 !! html/parsoid
12900 <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>
12901 !! end
12902
12903 !! test
12904 Allow empty links in image captions (Bug 60753)
12905 !! options
12906 thumbsize=220
12907 !! wikitext
12908 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12909 [[]]
12910 [[Link2]]
12911 ]]
12912 !! html/php
12913 <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>
12914
12915 !! html/parsoid
12916 <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>
12917 [[]]
12918 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12919 </figcaption></figure>
12920 !! end
12921
12922 !! test
12923 Titles in unlinked images (T23454)
12924 !! wikitext
12925 [[File:Foobar.jpg|link=|stuff]]
12926 !! html/php
12927 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12928 </p>
12929 !! end
12930
12931 !! test
12932 Link with empty target
12933 !! wikitext
12934 [[]]
12935 !! html
12936 <p>[[]]
12937 </p>
12938 !! end
12939
12940 !! test
12941 Image with link trail
12942 !! wikitext
12943 Linktrails should not work for images: [[File:Foobar.jpg]]s
12944 !! html/php
12945 <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
12946 </p>
12947 !! html/parsoid
12948 <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>
12949 !! end
12950
12951 !! test
12952 Image with empty attribute
12953 !! options
12954 parsoid=wt2html,wt2wt,html2html
12955 !! wikitext
12956 [[File:Foobar.jpg|right||Caption text]]
12957 !! html/php
12958 <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>
12959
12960 !! html/parsoid
12961 <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>
12962 !! end
12963
12964 !! test
12965 1. Block image with individual attributes from templates
12966 !! wikitext
12967 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12968 !! html/php
12969 <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>
12970
12971 !! html/parsoid
12972 <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>
12973 !! end
12974
12975 !! test
12976 2. Block Image with individual attributes from templates
12977 !! wikitext
12978 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12979 !! html/php
12980 <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>
12981
12982 !! html/parsoid
12983 <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>
12984 !! end
12985
12986 !! test
12987 3. Inline image with individual attributes from templates
12988 !! wikitext
12989 [[File:Foobar.jpg|{{echo|50px}}]]
12990 !! html/php
12991 <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>
12992 </p>
12993 !! html/parsoid
12994 <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>
12995 !! end
12996
12997 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12998 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12999 !! test
13000 Image with multiple attributes from the same template
13001 !! wikitext
13002 [[File:Foobar.jpg|{{image_attribs}}]]
13003 !! html/php
13004 <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>
13005
13006 !! html/parsoid
13007 <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>
13008 !! end
13009
13010 !! test
13011 Image with link tails
13012 !! options
13013 thumbsize=220
13014 !! wikitext
13015 123[[File:Foobar.jpg]]456
13016 123[[File:Foobar.jpg|right]]456
13017 123[[File:Foobar.jpg|thumb]]456
13018 !! html/php
13019 <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
13020 </p>
13021 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
13022 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
13023
13024 !! html/php+tidy
13025 <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>
13026 <p>123</p>
13027 <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>
13028 <p>456 123</p>
13029 <div class="thumb tright">
13030 <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>
13031 <div class="thumbcaption">
13032 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13033 </div>
13034 </div>
13035 </div>
13036 <p>456</p>
13037 !! html/parsoid
13038 <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>
13039 <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>
13040 <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>
13041 !! end
13042
13043 !! test
13044 Image with multiple captions -- only last one is accepted
13045 !! wikitext
13046 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13047 !! html/php
13048 <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>
13049
13050 !! html/parsoid
13051 <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>
13052 !! end
13053
13054 !! test
13055 Image with multiple widths -- use last
13056 !! wikitext
13057 [[File:Foobar.jpg|200px|300px|caption]]
13058 !! html/php
13059 <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>
13060 </p>
13061 !! html/parsoid
13062 <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>
13063 !! end
13064
13065 !! test
13066 Image with multiple alignments -- use first (bug 48664)
13067 !! options
13068 thumbsize=220
13069 !! wikitext
13070 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13071
13072 [[File:Foobar.jpg|middle|text-top|caption]]
13073 !! html/php
13074 <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>
13075 <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>
13076 </p>
13077 !! html/parsoid
13078 <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>
13079 <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>
13080 !! end
13081
13082 !! test
13083 Image with width attribute at different positions
13084 !! wikitext
13085 [[File:Foobar.jpg|200px|right|Caption]]
13086 [[File:Foobar.jpg|right|200px|Caption]]
13087 [[File:Foobar.jpg|right|Caption|200px]]
13088 !! html/php
13089 <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>
13090 <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>
13091 <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>
13092
13093 !! html/parsoid
13094 <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>
13095 <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>
13096 <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>
13097 !! end
13098
13099 # a sad bit of backward-compatibility
13100 !! test
13101 Image with size specified with pxpx (bug 13500, 51628)
13102 !! options
13103 parsoid=wt2html,wt2wt,html2html
13104 !! wikitext
13105 [[File:Foobar.jpg|20pxpx]]
13106 [[File:Foobar.jpg|200x20pxpx]]
13107 !! html/php
13108 <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>
13109 <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>
13110 </p>
13111 !! html/parsoid
13112 <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>
13113 !! end
13114
13115 !! test
13116 Image with link parameter, wiki target
13117 !! wikitext
13118 [[File:Foobar.jpg|link=Main Page]]
13119 !! html/php
13120 <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>
13121 </p>
13122 !! html/parsoid
13123 <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>
13124 !! end
13125
13126 # parsoid bug 49293 (part 1)
13127 !! test
13128 Image with link parameter, URL target
13129 !! wikitext
13130 [[File:Foobar.jpg|link=http://example.com/]]
13131 !! html/php
13132 <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>
13133 </p>
13134 !! html/parsoid
13135 <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>
13136 !! end
13137
13138 # parsoid bug 49293 (part 2)
13139 !! test
13140 Image with link parameter, protocol-less URL target
13141 !! wikitext
13142 [[File:Foobar.jpg|link=//example.com/]]
13143 !! html/php
13144 <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>
13145 </p>
13146 !! html/parsoid
13147 <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>
13148 !! end
13149
13150 !! test
13151 Escaping non-block captions (T107435)
13152 !! options
13153 parsoid={
13154 "modes": ["wt2wt"],
13155 "changes": [
13156 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13157 ]
13158 }
13159 !! wikitext
13160 [[Image:Foobar.jpg|caption]]
13161 !! wikitext/edited
13162 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13163 !! end
13164
13165 # wgExternalLinkTarget not supported by Parsoid
13166 !! test
13167 Image with link parameter, wgExternalLinkTarget
13168 !! wikitext
13169 [[Image:foobar.jpg|link=http://example.com/]]
13170 !! config
13171 wgExternalLinkTarget='foobar'
13172 !! html/php
13173 <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>
13174 </p>
13175 !! end
13176
13177 !! test
13178 Image with link parameter, wgNoFollowLinks set to false
13179 !! wikitext
13180 [[Image:foobar.jpg|link=http://example.com/]]
13181 !! config
13182 wgNoFollowLinks=false
13183 !! html
13184 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13185 </p>
13186 !! end
13187
13188 !! test
13189 Image with link parameter, wgNoFollowDomainExceptions
13190 !! wikitext
13191 [[Image:foobar.jpg|link=http://example.com/]]
13192 !! config
13193 wgNoFollowDomainExceptions='example.com'
13194 !! html
13195 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13196 </p>
13197 !! end
13198
13199 # wgExternalLinkTarget not supported by Parsoid
13200 !! test
13201 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13202 !! wikitext
13203 [[Image:foobar.jpg|link=http://example.com/|Title]]
13204 !! config
13205 wgExternalLinkTarget='foobar'
13206 !! html/php
13207 <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>
13208 </p>
13209 !! end
13210
13211 !! test
13212 Image with empty link parameter
13213 !! wikitext
13214 [[File:Foobar.jpg|link=]]
13215 !! html/php
13216 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13217 </p>
13218 !! html/parsoid
13219 <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>
13220 !! end
13221
13222 !! test
13223 Image with link parameter (wiki target) and unnamed parameter
13224 !! wikitext
13225 [[File:Foobar.jpg|link=Main_Page|Title]]
13226 !! html/php
13227 <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>
13228 </p>
13229 !! html/parsoid
13230 <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>
13231 !! end
13232
13233 !! test
13234 Image with link parameter (URL target) and unnamed parameter
13235 !! wikitext
13236 [[File:Foobar.jpg|link=http://example.com/|Title]]
13237 !! html/php
13238 <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>
13239 </p>
13240 !! html/parsoid
13241 <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>
13242 !! end
13243
13244 !! test
13245 Thumbnail image with link parameter
13246 !! options
13247 thumbsize=220
13248 parsoid=wt2html,wt2wt,html2html
13249 !! wikitext
13250 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13251 !! html/php
13252 <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>
13253
13254 !! html/parsoid
13255 <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>
13256 !! end
13257
13258 !! test
13259 Manually-specified thumbnail image
13260 !! options
13261 thumbsize=220
13262 !! wikitext
13263 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13264 !! html/php
13265 <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>
13266
13267 !! html/parsoid
13268 <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>
13269 !! end
13270
13271 !! test
13272 Manually-specified thumbnail image with explicit link to wiki page
13273 !! options
13274 thumbsize=220
13275 parsoid=wt2html,wt2wt,html2html
13276 !! wikitext
13277 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13278 !! html/php
13279 <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>
13280
13281 !! html/parsoid
13282 <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>
13283 !! end
13284
13285 !! test
13286 Manually-specified thumbnail image with explicit link to url
13287 !! options
13288 thumbsize=220
13289 parsoid=wt2html,wt2wt,html2html
13290 !! wikitext
13291 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13292 !! html/php
13293 <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>
13294
13295 !! html/parsoid
13296 <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>
13297 !! end
13298
13299 !! test
13300 Manually-specified thumbnail image with explicit no link
13301 !! options
13302 thumbsize=220
13303 parsoid=wt2html,wt2wt,html2html
13304 !! wikitext
13305 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13306 !! html/php
13307 <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>
13308
13309 !! html/parsoid
13310 <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>
13311 !! end
13312
13313 !! test
13314 Manually-specified thumbnail image with explicit link and alt text
13315 !! options
13316 thumbsize=220
13317 parsoid=wt2html,wt2wt,html2html
13318 !! wikitext
13319 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13320 !! html/php
13321 <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>
13322
13323 !! html/parsoid
13324 <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>
13325 !! end
13326
13327 !! test
13328 Image with frame and link
13329 !! options
13330 parsoid=wt2html,wt2wt,html2html
13331 !! wikitext
13332 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13333 !! html/php
13334 <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>
13335
13336 !! html/parsoid
13337 <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>
13338 !! end
13339
13340 !! test
13341 Image with frame and link and explicit alt
13342 !! options
13343 parsoid=wt2html,wt2wt,html2html
13344 !! wikitext
13345 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13346 !! html/php
13347 <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>
13348
13349 !! html/parsoid
13350 <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>
13351 !! end
13352
13353 !! test
13354 Image with wiki markup in implicit alt
13355 !! wikitext
13356 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13357
13358 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13359 !! html/php
13360 <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>
13361 </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>
13362 </p>
13363 !! html/parsoid
13364 <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>
13365
13366 <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>
13367 !! end
13368
13369 !! test
13370 Alt image option should handle most kinds of wikitext without barfing
13371 !! wikitext
13372 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13373 !! html/php
13374 <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>
13375
13376 !! html/parsoid
13377 <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>
13378 !! end
13379
13380 ###################
13381 # Conflicting image format options.
13382 # First option specified should 'win'.
13383 # All three cases in each test should be identical.
13384
13385 !! test
13386 Image with 'frameless' first.
13387 !! options
13388 parsoid=wt2html,wt2wt,html2html
13389 !! wikitext
13390 [[File:Foobar.jpg|frameless|caption]]
13391
13392 [[File:Foobar.jpg|frameless|frame|caption]]
13393
13394 [[File:Foobar.jpg|frameless|thumb|caption]]
13395 !! html/php
13396 <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>
13397 </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>
13398 </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>
13399 </p>
13400 !! html/parsoid
13401 <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>
13402 <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>
13403 <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>
13404 !! end
13405
13406 !! test
13407 Image with 'frame' first.
13408 !! options
13409 parsoid=wt2html,wt2wt,html2html
13410 !! wikitext
13411 [[File:Foobar.jpg|frame|caption]]
13412 [[File:Foobar.jpg|frame|frameless|caption]]
13413 [[File:Foobar.jpg|frame|thumb|caption]]
13414 !! html/php
13415 <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>
13416 <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>
13417 <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>
13418
13419 !! html/parsoid
13420 <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>
13421 <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>
13422 <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>
13423 !! end
13424
13425 !! test
13426 Image with 'thumb' first.
13427 !! options
13428 parsoid=wt2html,wt2wt,html2html
13429 !! wikitext
13430 [[File:Foobar.jpg|thumb|caption]]
13431 [[File:Foobar.jpg|thumb|frameless|caption]]
13432 [[File:Foobar.jpg|thumb|frame|caption]]
13433 !! html/php
13434 <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>
13435 <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>
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 <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>
13441 <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>
13442 !! end
13443
13444 ###################
13445 # Image sizing.
13446 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13447 # and https://phabricator.wikimedia.org/T64258
13448 # Foobar has actual size of 1941x220
13449 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13450 # a scalable format.
13451 # 2. Framed images always ignore size options; always render at default size.
13452 # 3. "Unspecified format" and border are the only types which can be
13453 # enlarged.
13454
13455 !! test
13456 Image: "unspecified format" and border enlarge
13457 !! options
13458 parsoid=wt2html,wt2wt,html2html
13459 !! wikitext
13460 [[File:Foobar.jpg|2000px]]
13461
13462 [[File:Foobar.jpg|border|2000px]]
13463 !! html/php
13464 <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>
13465 </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>
13466 </p>
13467 !! html/parsoid
13468 <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>
13469 <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>
13470 !! end
13471
13472 !! test
13473 Image: "unspecified format" and border reduce
13474 !! options
13475 parsoid=wt2html,wt2wt,html2html
13476 !! wikitext
13477 [[File:Foobar.jpg|1000px]]
13478
13479 [[File:Foobar.jpg|border|1000px]]
13480 !! html/php
13481 <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>
13482 </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>
13483 </p>
13484 !! html/parsoid
13485 <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>
13486 <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>
13487 !! end
13488
13489 !! test
13490 Image: thumbs reduce
13491 !! options
13492 parsoid=wt2html,wt2wt,html2html
13493 !! wikitext
13494 [[File:Foobar.jpg|thumb|50px]]
13495 !! html/php
13496 <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>
13497
13498 !! html/parsoid
13499 <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>
13500 !! end
13501
13502 !! test
13503 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13504 !! options
13505 parsoid=wt2html,wt2wt,html2html
13506 !! wikitext
13507 [[File:Foobar.jpg|thumb|2000px]]
13508
13509 [[File:Foobar.svg|thumb|2000px]]
13510 !! html/php
13511 <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>
13512 <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>
13513
13514 !! html/parsoid
13515 <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>
13516 <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>
13517 !! end
13518
13519 !! test
13520 Image: frameless can reduce in size
13521 !! options
13522 parsoid=wt2html,wt2wt,html2html
13523 !! wikitext
13524 [[File:Foobar.jpg|frameless|50px]]
13525 !! html/php
13526 <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>
13527 </p>
13528 !! html/parsoid
13529 <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>
13530 !! end
13531
13532 !! test
13533 Image: bitmap frameless can't be enlarged past original size, but vector can
13534 !! options
13535 parsoid=wt2html,wt2wt,html2html
13536 !! wikitext
13537 [[File:Foobar.jpg|frameless|2000px]]
13538
13539 [[File:Foobar.svg|frameless|2000px]]
13540 !! html/php
13541 <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>
13542 </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>
13543 </p>
13544 !! html/parsoid
13545 <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>
13546 <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>
13547 !! end
13548
13549 !! test
13550 Image: framed images are always unscaled.
13551 !! options
13552 parsoid=wt2html,wt2wt,html2html
13553 !! wikitext
13554 [[File:Foobar.jpg|frame]]
13555
13556 [[File:Foobar.jpg|frame|50px]]
13557
13558 [[File:Foobar.jpg|frame|50x50px]]
13559
13560 [[File:Foobar.jpg|frame|2000px]]
13561 !! html/php
13562 <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>
13563 <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>
13564 <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>
13565 <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>
13566
13567 !! html/parsoid
13568 <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>
13569 <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>
13570 <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>
13571 <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>
13572 !! end
13573
13574 ###################
13575
13576 !! test
13577 Link to image page- image page normally doesn't exists, hence edit link
13578 Add test with existing image page
13579 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13580 !! wikitext
13581 [[:Image:test]]
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)">Image:test</a>
13584 </p>
13585 !! end
13586
13587 !! test
13588 bug 18784 Link to non-existent image page with caption should use caption as link text
13589 !! wikitext
13590 [[:Image:test|caption]]
13591 !! html
13592 <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>
13593 </p>
13594 !! end
13595
13596 !! test
13597 Frameless image caption with a free URL
13598 !! wikitext
13599 [[File:Foobar.jpg|http://example.com]]
13600 !! html/php
13601 <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>
13602 </p>
13603 !! html/parsoid
13604 <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>
13605 !! end
13606
13607 !! test
13608 Thumbnail image caption with a free URL
13609 !! options
13610 thumbsize=220
13611 !! wikitext
13612 [[File:Foobar.jpg|thumb|http://example.com]]
13613 !! html/php
13614 <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>
13615
13616 !! html/parsoid
13617 <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>
13618 !! end
13619
13620 !! test
13621 Thumbnail image caption with a free URL and explicit alt
13622 !! options
13623 thumbsize=220
13624 parsoid=wt2html,wt2wt,html2html
13625 !! wikitext
13626 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13627 !! html/php
13628 <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>
13629
13630 !! html/parsoid
13631 <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>
13632 !! end
13633
13634 !! test
13635 SVG thumbnails with no language set
13636 !! options
13637 !! wikitext
13638 [[File:Foobar.svg|thumb|caption]]
13639 !! html/php
13640 <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>
13641
13642 !! html/parsoid
13643 <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>
13644 !! end
13645
13646 !! test
13647 SVG thumbnails with language de
13648 !! options
13649 parsoid=wt2html,wt2wt,html2html
13650 !! wikitext
13651 [[File:Foobar.svg|thumb|caption|lang=de]]
13652 !! html/php
13653 <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>
13654
13655 !! html/parsoid
13656 <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>
13657 !! end
13658
13659 !! test
13660 SVG thumbnails with invalid language code
13661 !! options
13662 parsoid=wt2html,wt2wt,html2html
13663 !! wikitext
13664 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13665 !! html/php
13666 <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>
13667
13668 !! html/parsoid
13669 <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>
13670 !! end
13671
13672 !! test
13673 BUG 1887: A ISBN with a thumbnail
13674 !! wikitext
13675 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13676 !! html/php
13677 <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>
13678
13679 !! html/parsoid
13680 <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>
13681 !! end
13682
13683 !! test
13684 BUG 1887: A RFC with a thumbnail
13685 !! wikitext
13686 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13687 !! html/php
13688 <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>
13689
13690 !! html/parsoid
13691 <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>
13692 !! end
13693
13694 !! test
13695 BUG 1887: A mailto link with a thumbnail
13696 !! wikitext
13697 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13698 !! html/php
13699 <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>
13700
13701 !! html/parsoid
13702 <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>
13703 !! end
13704
13705 # Pending resolution to bug 368
13706 !! test
13707 BUG 648: Frameless image caption with a link
13708 !! wikitext
13709 [[File:Foobar.jpg|text with a [[link]] in it]]
13710 !! html/php
13711 <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>
13712 </p>
13713 !! html/parsoid
13714 <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>
13715 !! end
13716
13717 !! test
13718 BUG 648: Frameless image caption with a link (suffix)
13719 !! wikitext
13720 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13721 !! html/php
13722 <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>
13723 </p>
13724 !! html/parsoid
13725 <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>
13726 !! end
13727
13728 !! test
13729 BUG 648: Frameless image caption with an interwiki link
13730 !! wikitext
13731 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13732 !! html/php
13733 <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>
13734 </p>
13735 !! html/parsoid
13736 <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>
13737 !! end
13738
13739 !! test
13740 BUG 648: Frameless image caption with a piped interwiki link
13741 !! wikitext
13742 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13743 !! html/php
13744 <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>
13745 </p>
13746 !! html/parsoid
13747 <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>
13748 !! end
13749
13750 !! test
13751 T107474: Frameless image caption with <nowiki>
13752 !! wikitext
13753 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13754 !! html/parsoid
13755 <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>
13756 !! end
13757
13758 !! test
13759 Escape HTML special chars in image alt text
13760 !! wikitext
13761 [[File:Foobar.jpg|& < > "]]
13762 !! html/php
13763 <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>
13764 </p>
13765 !! html/parsoid
13766 <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>
13767 !! end
13768
13769 !! test
13770 BUG 499: Alt text should have &#1234;, not &amp;1234;
13771 !! wikitext
13772 [[File:Foobar.jpg|&#9792;]]
13773 !! html/php
13774 <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>
13775 </p>
13776 !! html/parsoid
13777 <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>
13778 !! end
13779
13780 !! test
13781 Broken image caption with link
13782 !! options
13783 parsoid=wt2html,wt2wt,html2html
13784 !! wikitext
13785 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13786 !! html/php
13787 <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.
13788 </p>
13789 !! html/parsoid
13790 <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>
13791 !! end
13792
13793 !! test
13794 Image caption containing another image
13795 !! wikitext
13796 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13797 !! html/php
13798 <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>
13799
13800 !! html/parsoid
13801 <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>
13802 !! end
13803
13804 !! test
13805 Image: caption containing a newline
13806 !! wikitext
13807 [[File:Foobar.jpg|This
13808 *is some text]]
13809 !! html/php
13810 <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>
13811 </p>
13812 !! html/parsoid
13813 <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>
13814 !!end
13815
13816 !!test
13817 Image: caption containing leading space
13818 (The leading space should not trigger nowiki escaping in wt2wt mode)
13819 !! wikitext
13820 [[File:Foobar.jpg|thumb| bar]]
13821 !! html/php
13822 <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>
13823
13824 !! html/parsoid
13825 <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>
13826 !!end
13827
13828 !! test
13829 Image: caption containing a table
13830 !! options
13831 parsoid=wt2html,wt2wt,html2html
13832 !! wikitext
13833 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13834 {|
13835 ! Foo !! Bar
13836 |-
13837 | Foo1 || Bar1
13838 |}
13839 and some more text.]]
13840 !! html/php
13841 <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>
13842
13843 !! html/parsoid
13844 <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
13845 <table>
13846 <tbody>
13847 <tr><th>Foo </th><th>Bar</th></tr>
13848 <tr>
13849 <td>Foo1 </td>
13850 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13851 !! end
13852
13853 !! test
13854 Bug 3090: External links other than http: in image captions
13855 !! wikitext
13856 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13857 !! html/php
13858 <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>
13859
13860 !! html/parsoid
13861 <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>
13862 !! end
13863
13864 !! test
13865 Custom class
13866 !! options
13867 parsoid=wt2html,wt2wt,html2html
13868 !! wikitext
13869 [[Image:foobar.jpg|a|class=b]]
13870 !! html/php
13871 <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>
13872 </p>
13873 !! html/parsoid
13874 <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>
13875 !! end
13876
13877 !! test
13878 Localized image handling (1).
13879 !! options
13880 parsoid=wt2html,wt2wt,html2html
13881 language=es
13882 !! wikitext
13883 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13884 !! html/php
13885 <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>
13886
13887 !! html/parsoid
13888 <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>
13889 !! end
13890
13891 !! test
13892 Localized image handling (2).
13893 !! options
13894 thumbsize=220
13895 parsoid=wt2html,wt2wt,html2html
13896 language=es
13897 !! wikitext
13898 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13899 !! html/php
13900 <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>
13901
13902 !! html/parsoid
13903 <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>
13904 !! end
13905
13906 !! test
13907 Localized image handling (3).
13908 !! options
13909 language=fa
13910 parsoid=html2wt
13911 !! html/parsoid
13912 <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>
13913 !! wikitext
13914 [[File:Foobar.jpg|بندانگشتی]]
13915 !! end
13916
13917 !! test
13918 "border", "frameless" and "class" attributes on an image.
13919 !! options
13920 thumbsize=220
13921 parsoid=wt2html,wt2wt,html2html
13922 !! wikitext
13923 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13924 !! html/php
13925 <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>
13926 </p>
13927 !! html/parsoid
13928 <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>
13929 !! end
13930
13931 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13932 !! test
13933 Invalid image attributes (bug 62500)
13934 !! options
13935 thumbsize=220
13936 parsoid=wt2html,wt2wt,html2html
13937 !! wikitext
13938 [[File:Foobar.jpg|thumb|float|left|caption]]
13939
13940 [[File:Foobar.jpg|thumb|righ|caption]]
13941
13942 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13943 !! html/php
13944 <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>
13945 <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>
13946 <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>
13947
13948 !! html/parsoid
13949 <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>
13950 <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>
13951 <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>
13952 !! end
13953
13954 !! article
13955 File:Barfoo.jpg
13956 !! text
13957 #REDIRECT [[File:Barfoo.jpg]]
13958 !! endarticle
13959
13960 # FIXME: Parsoid should run this test -- but we'd need to teach the
13961 # mockAPI about the redirected Barfoo.jpg image.
13962 !! test
13963 Redirected image
13964 !! wikitext
13965 [[Image:Barfoo.jpg]]
13966 !! html/php
13967 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13968 </p>
13969 !! end
13970
13971 !! test
13972 Missing image with uploads disabled
13973 !! options
13974 wgEnableUploads=0
13975 !! wikitext
13976 [[File:Foobaz.jpg]]
13977 !! html/php
13978 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13979 </p>
13980 !! html/parsoid
13981 <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>
13982 !! end
13983
13984 # Parsoid-specific testing for images
13985 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13986 # Currently imperfect due to a flaw in the Parsoid testrunner
13987 # Work in progress
13988 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13989 # image tests.
13990
13991 !! test
13992 Parsoid-specific image handling - simple image with size and middle alignment
13993 !! wikitext
13994 [[File:Foobar.jpg|middle|50px]]
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 Parsoid-specific image handling - simple image with size, middle alignment,
14001 non-standard namespace alias
14002 !! options
14003 parsoid=wt2wt,wt2html,html2html
14004 !! wikitext
14005 [[Image:Foobar.jpg|middle|50px]]
14006 !! html/parsoid
14007 <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>
14008 !! end
14009
14010 !! test
14011 Parsoid-specific image handling - simple image with size and middle alignment
14012 (existing content)
14013 !! wikitext
14014 [[File:Foobar.jpg|50px|middle]]
14015 !! html/parsoid
14016 <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>
14017 !! end
14018
14019 !! test
14020 Parsoid-specific image handling - simple image with size and middle alignment
14021 and non-standard namespace name
14022 !! options
14023 parsoid=wt2html,wt2wt,html2html
14024 !! wikitext
14025 [[Image:Foobar.jpg|50px|middle]]
14026 !! html/parsoid
14027 <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>
14028 !! end
14029
14030 !! test
14031 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14032 !! wikitext
14033 [[File:Foobar.jpg|500x10px|baseline|caption]]
14034 !! html/parsoid
14035 <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>
14036 !! end
14037
14038 !! test
14039 Parsoid-specific image handling - simple image with border and size spec
14040 !! wikitext
14041 [[File:Foobar.jpg|50px|border|caption]]
14042 !! html/parsoid
14043 <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>
14044 !! end
14045
14046 !! test
14047 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14048 !! wikitext
14049 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14050 !! html/parsoid
14051 <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>
14052 !! end
14053
14054 !! test
14055 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14056 (existing content)
14057 !! wikitext
14058 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14059 !! html/parsoid
14060 <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>
14061 !! end
14062
14063 !! test
14064 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14065 !! wikitext
14066 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14067 !! html/parsoid
14068 <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>
14069 !! end
14070
14071 !! test
14072 Parsoid-specific image handling - thumbnail with specific size, halign,
14073 valign, and caption (existing content)
14074 !! wikitext
14075 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14076 !! html/parsoid
14077 <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>
14078 !! end
14079
14080 !! test
14081 Parsoid-specific image handling - framed image with specific size and caption
14082 (size is ignored)
14083 !! options
14084 parsoid=wt2html,wt2wt,html2html
14085 !! wikitext
14086 [[File:Foobar.jpg|frame|500x50px|caption]]
14087 !! html/parsoid
14088 <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>
14089 !! end
14090
14091 !! test
14092 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14093 (size is ignored)
14094 !! options
14095 parsoid=wt2html,wt2wt,html2html
14096 !! wikitext
14097 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14098 !! html/parsoid
14099 <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>
14100 !! end
14101
14102 !! test
14103 Parsoid-specific image handling - frameless image with specific size, border, and caption
14104 !! wikitext
14105 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14106 !! html/parsoid
14107 <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>
14108 !! end
14109
14110 !! test
14111 Parsoid-specific image handling - simple image with a formatted caption
14112 !! wikitext
14113 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14114 !! html/parsoid
14115 <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>
14116 !! end
14117
14118 !! test
14119 Parsoid-specific image handling - caption with a template in it
14120 !! wikitext
14121 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14122 !! html/parsoid
14123 <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>
14124 !! end
14125
14126 !! test
14127 Parsoid-specific image handling - caption with unbalanced tags in it
14128 !! options
14129 parsoid=wt2html,wt2wt,html2html
14130 !! wikitext
14131 foo
14132 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14133 bar
14134 !! html/parsoid
14135 <p>foo</p>
14136 <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>
14137 <p>bar</p>
14138 !! end
14139
14140 !! test
14141 Parsoid-specific image handling - empty caption (1)
14142 !! options
14143 parsoid=wt2html,wt2wt
14144 !! wikitext
14145 [[File:Foobar.jpg|thumb|]]
14146 !! html/parsoid
14147 <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>
14148 !! end
14149
14150 # empty captions don't get serialized unless we're in the "round trip" case
14151 !! test
14152 Parsoid-specific image handling - empty caption (2)
14153 !! options
14154 parsoid=html2wt
14155 !! html/parsoid
14156 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14157 <a href="./File:Foobar.jpg">
14158 <img resource="./File:Foobar.jpg"
14159 src="//example.com/images/3/3a/Foobar.jpg"
14160 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14161 height="25" width="220"/>
14162 </a>
14163 <figcaption></figcaption>
14164 </figure>
14165 !! wikitext
14166 [[File:Foobar.jpg|thumb]]
14167 !! end
14168
14169 !! test
14170 Parsoid-specific image handling - whitespace caption
14171 !! wikitext
14172 [[File:Foobar.jpg|thumb| ]]
14173 !! html/parsoid
14174 <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>
14175 !! end
14176
14177 !! test
14178 Parsoid-specific image handling - lang option
14179 !! wikitext
14180 foo
14181 [[File:Foobar.svg|lang=de|caption]]
14182 bar
14183 !! html/parsoid
14184 <p>foo
14185 <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>
14186 bar</p>
14187 !! end
14188
14189 ## Edge case bugs in Parsoid from T93580
14190 !! test
14191 T93580: 1. Templated <ref> inside block images
14192 !! wikitext
14193 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14194
14195 <references />
14196 !! html/parsoid
14197 <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>
14198
14199 <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>
14200 !! end
14201
14202 !! test
14203 T93580: 2. <ref> inside inline images
14204 !! wikitext
14205 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14206
14207 <references />
14208 !! html/parsoid
14209 <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>
14210
14211 <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>
14212 !! end
14213
14214 !! test
14215 T93580: 3. Templated <ref> inside inline images
14216 !! wikitext
14217 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14218
14219 <references />
14220 !! html/parsoid
14221 <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>
14222
14223 <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>
14224 !! end
14225
14226 ###
14227 ### Subpages
14228 ###
14229 !! article
14230 Subpage test/subpage
14231 !! text
14232 foo
14233 !! endarticle
14234
14235 !! test
14236 Subpage link
14237 !! options
14238 subpage title=[[Subpage test]]
14239 !! wikitext
14240 [[/subpage]]
14241 !! html
14242 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14243 </p>
14244 !! end
14245
14246 !! test
14247 Subpage noslash link
14248 !! options
14249 subpage title=[[Subpage test]]
14250 !! wikitext
14251 [[/subpage/]]
14252 !! html
14253 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14254 </p>
14255 !! end
14256
14257 !! article
14258 Subpage test/1/2/subpage
14259 !! text
14260 blah
14261 !! endarticle
14262
14263 !! test
14264 Relative subpage noslash link
14265 !! options
14266 parsoid=wt2wt,wt2html,html2html
14267 subpage title=[[Subpage test/1/2/3/4]]
14268 !! wikitext
14269 [[../../subpage/]]
14270
14271 [[../../subpage]]
14272 !! html/php
14273 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14274 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14275 </p>
14276 !! html/parsoid
14277 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14278 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14279 !! end
14280
14281 !! test
14282 Parsoid: dot-slash prefixed wikilinks
14283 !! wikitext
14284 [[./foo]]
14285
14286 [[././bar]]
14287
14288 [[././baz/]]
14289 !! html/php
14290 <p>[[./foo]]
14291 </p><p>[[././bar]]
14292 </p><p>[[././baz/]]
14293 </p>
14294 !! html/parsoid
14295 <p>[[./foo]]
14296 </p><p>[[././bar]]
14297 </p><p>[[././baz/]]
14298 </p>
14299 !! end
14300
14301 !! test
14302 Render invalid page names as plain text (bug 51090)
14303 !! wikitext
14304 [[./../foo|bar]]
14305 [[foo�|bar]]
14306 [[foo/.|bar]]
14307 [[foo/..|bar]]
14308 [[foo~~~bar]]
14309 [[foo>bar]]
14310 [[foo[bar]]
14311 [[.]]
14312 [[..]]
14313 [[foo././bar]]
14314
14315 [[{{echo|./../foo}}|bar]]
14316 [[{{echo|foo/.}}|bar]]
14317 [[{{echo|foo/..}}|bar]]
14318 [[{{echo|foo~~~~bar}}]]
14319 [[{{echo|foo>bar}}]]
14320 [[{{echo|foo././bar}}]]
14321 [[{{echo|foo{bar}}]]
14322 [[{{echo|foo}bar}}]]
14323 [[{{echo|foo[bar}}]]
14324 [[{{echo|foo]bar}}]]
14325 [[{{echo|foo<bar}}]]
14326 !!html/php
14327 <p>[[./../foo|bar]]
14328 [[foo�|bar]]
14329 [[foo/.|bar]]
14330 [[foo/..|bar]]
14331 [[foo~~~bar]]
14332 [[foo&gt;bar]]
14333 [[foo[bar]]
14334 [[.]]
14335 [[..]]
14336 [[foo././bar]]
14337 </p><p>[[./../foo|bar]]
14338 [[foo/.|bar]]
14339 [[foo/..|bar]]
14340 [[foo~~~~bar]]
14341 [[foo&gt;bar]]
14342 [[foo././bar]]
14343 [[foo{bar]]
14344 [[foo}bar]]
14345 [[foo[bar]]
14346 [[foo]bar]]
14347 [[foo&lt;bar]]
14348 </p>
14349 !!html/parsoid
14350 <p>[[./../foo|bar]]
14351 [[foo�|bar]]
14352 [[foo/.|bar]]
14353 [[foo/..|bar]]
14354 [[foo~~~bar]]
14355 [[foo>bar]]
14356 [[foo[bar]]
14357 [[.]]
14358 [[..]]
14359 [[foo././bar]]</p>
14360
14361 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14362 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14363 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14364 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14365 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14366 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14367 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14368 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14369 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14370 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14371 [[<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>
14372 !!end
14373
14374 !! test
14375 Disabled subpages
14376 !! wikitext
14377 [[/subpage]]
14378 !! html
14379 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14380 </p>
14381 !! end
14382
14383 !! test
14384 BUG 561: {{/Subpage}}
14385 !! options
14386 subpage title=[[Page]]
14387 !! wikitext
14388 {{/Subpage}}
14389 !! html
14390 <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>
14391 </p>
14392 !! end
14393
14394 ###
14395 ### Categories
14396 ###
14397 !! article
14398 Category:MediaWiki User's Guide
14399 !! text
14400 blah
14401 !! endarticle
14402
14403 !! test
14404 Link to category
14405 !! wikitext
14406 [[:Category:MediaWiki User's Guide]]
14407 !! html
14408 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14409 </p>
14410 !! end
14411
14412 !! test
14413 Simple category
14414 !! options
14415 cat
14416 !! wikitext
14417 [[Category:MediaWiki User's Guide]]
14418 !! html
14419 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14420 !! end
14421
14422 !! test
14423 PAGESINCATEGORY invalid title fatal (r33546 fix)
14424 !! wikitext
14425 {{PAGESINCATEGORY:<bogus>}}
14426 !! html
14427 <p>0
14428 </p>
14429 !! end
14430
14431 !! test
14432 Category with different sort key
14433 !! options
14434 cat
14435 !! wikitext
14436 [[Category:MediaWiki User's Guide|Foo]]
14437 !! html
14438 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14439 !! end
14440
14441 !! test
14442 Category with identical sort key
14443 !! options
14444 cat
14445 !! wikitext
14446 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14447 !! html
14448 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14449 !! end
14450
14451 !! test
14452 Category with empty sort key
14453 !! options
14454 cat
14455 pst
14456 !! wikitext
14457 [[Category:MediaWiki User's Guide|]]
14458 !! html/php
14459 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14460 !! end
14461
14462 !! test
14463 Category with empty sort key and parentheses
14464 !! options
14465 cat
14466 pst
14467 !! wikitext
14468 [[Category:Foo (bar)|]]
14469 !! html/php
14470 [[Category:Foo (bar)|Foo]]
14471 !! end
14472
14473 ## We used to, but no longer wt2wt this test since the default serializer
14474 ## will normalize all categories to serialize on their own line.
14475 ## This wikitext usage is going to be fairly uncommon in production and
14476 ## selser will take care of preserving formatting in those scenarios.
14477 !! test
14478 Category with link tail
14479 !! options
14480 cat
14481 pst
14482 parsoid=wt2html
14483 !! wikitext
14484 123[[Category:Foo]]456
14485 !! html/php
14486 123[[Category:Foo]]456
14487 !! html/parsoid
14488 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14489 !! end
14490
14491 !! test
14492 Category with template
14493 !! options
14494 cat
14495 pst
14496 !! wikitext
14497 [[Category:{{echo|Foo}}]]
14498 !! html/php
14499 [[Category:{{echo|Foo}}]]
14500 !! end
14501
14502 !! test
14503 Category with template in sort key
14504 !! options
14505 cat
14506 pst
14507 !! wikitext
14508 [[Category:Foo|{{echo|Bar}}]]
14509 !! html/php
14510 [[Category:Foo|{{echo|Bar}}]]
14511 !! end
14512
14513 !! test
14514 Category with template in sort key and title
14515 !! options
14516 cat
14517 pst
14518 !! wikitext
14519 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14520 !! html/php
14521 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14522 !! end
14523
14524 ## We used to, but no longer wt2wt this test since the default serializer
14525 ## will normalize all categories to serialize on their own line.
14526 ## This wikitext usage is going to be fairly uncommon in production and
14527 ## selser will take care of preserving formatting in those scenarios.
14528 !! test
14529 Category / paragraph interactions
14530 !! options
14531 parsoid=wt2html
14532 !! wikitext
14533 Foo [[Category:Baz]] Bar
14534
14535 Foo [[Category:Baz]]
14536 Bar
14537
14538 Foo
14539 [[Category:Baz]]
14540 Bar
14541
14542 Foo
14543 [[Category:Baz]] Bar
14544
14545 Foo
14546 [[Category:Baz]]
14547 [[Category:Baz]]
14548 [[Category:Baz]]
14549 Bar
14550
14551 [[Category:Baz]]
14552 [[Category:Baz]]
14553 [[Category:Baz]]
14554
14555 [[Category:Baz]]
14556 {{echo|[[Category:Baz]]}}
14557 [[Category:Baz]]
14558 !! html/php
14559 <p>Foo Bar
14560 </p><p>Foo
14561 Bar
14562 </p><p>Foo
14563 Bar
14564 </p><p>Foo Bar
14565 </p><p>Foo
14566 Bar
14567 </p>
14568 !! html/parsoid
14569 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14570 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14571 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14572 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14573 <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>
14574 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14575 !! end
14576
14577 ## We used to, but no longer wt2wt this test since the default serializer
14578 ## will normalize all categories to serialize on their own line.
14579 ## This wikitext usage is going to be fairly uncommon in production and
14580 ## selser will take care of preserving formatting in those scenarios.
14581 ##
14582 ## The whitespace on the empty line is part of the test. Please do not delete
14583 !! test
14584 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14585 !! options
14586 parsoid=wt2html
14587 !! wikitext
14588 This
14589
14590 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14591
14592 {{echo|[[Category:Foo]] and so should this!}}
14593 !! html/php
14594 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14595 </p>
14596 !! html/parsoid
14597 <p>This
14598
14599 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14600
14601 <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>
14602 !! end
14603
14604 ## Parsoid will not try to wt2wt this while preserving newlines because
14605 ## it suppresses excess newlines within list items -- and we don't want to
14606 ## introduce a special case just for categories, which is, in reality somewhat
14607 ## odd behavior -- categories are unlikely to be used in list items like this
14608 ## in top-level pages and are only likely to show up in template-generated
14609 ## list items where this RT-ing is a non-issue.
14610 ##
14611 ## The whitespace on the empty line is part of the test. Please do not delete
14612 !! test
14613 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14614 !! options
14615 parsoid=wt2html
14616 !! wikitext
14617 * This
14618
14619 [[Category:Foo]] and this should be part of the same list item
14620 * So should this
14621
14622 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14623 !! html
14624 <ul><li>This and this should be part of the same list item</li>
14625 <li>So should this and this should be part of the same list item</li></ul>
14626 !! html/parsoid
14627 <ul>
14628 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14629 <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>
14630 </ul>
14631 !! end
14632
14633 ## Newlines and categories that follow the last item of a list
14634 ## are treated differently because this (list followed by categories)
14635 ## is an extremely common pattern on wikis.
14636 !! test
14637 3. Categories and newlines: newline suppression for last list item should RT properly
14638 !! wikitext
14639 * a
14640 * b
14641
14642 [[Category:Foo]]
14643
14644 [[Category:Bar]]
14645 [[Category:Baz]]
14646 !! html/parsoid
14647 <ul><li> a</li>
14648 <li> b</li></ul>
14649
14650 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14651
14652 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14653 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14654 !! end
14655
14656 !! test
14657 4. Categories and newlines: newline suppression for last list item should RT properly
14658 !! wikitext
14659 * a
14660 **** b
14661
14662 [[Category:Foo]]
14663 !! html/parsoid
14664 <ul><li> a
14665 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14666
14667 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14668 !! end
14669
14670 ## only wt2html for this to make sure the algo only applies to the rightmost path
14671 !! test
14672 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14673 !! options
14674 parsoid=wt2html
14675 !! wikitext
14676 * a
14677 ** b
14678 [[Category:Foo]]
14679 * c
14680 ** d
14681 [[Category:Foo]]
14682 !! html/parsoid
14683 <ul><li> a
14684 <ul><li> b
14685 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14686 <li> c
14687 <ul><li> d</li></ul></li></ul>
14688 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14689 !! end
14690
14691 ## We used to, but no longer wt2wt this test since the default serializer
14692 ## will normalize all categories to serialize on their own line.
14693 ## This wikitext usage is going to be fairly uncommon in production and
14694 ## selser will take care of preserving formatting in those scenarios.
14695 !! test
14696 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14697 !! options
14698 parsoid=wt2html
14699 !! wikitext
14700 * a [[Category:Foo]]
14701 !! html/parsoid
14702 <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>
14703 !! end
14704
14705 # This test also demonstrates because of newline+category tunneling
14706 # through the list hander, template wrapping doesn't expand to the
14707 # containing list when the list item swallows the category.
14708 !! test
14709 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14710 !! wikitext
14711 * {{echo|a
14712 [[Category:Foo]]}}
14713 !! html/parsoid
14714 <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
14715 </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>
14716 !! end
14717
14718 !! test
14719 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14720 !! wikitext
14721 * a
14722
14723 {{echo|[[Category:Foo]]
14724 [[Category:Bar]]}}
14725 [[Category:Baz]]
14726 !! html/parsoid
14727 <ul><li> a</li></ul>
14728
14729 <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">
14730 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14731 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14732 !! end
14733
14734 !! test
14735 Parsoid: Serialize link to category page with colon escape
14736 !! options
14737 parsoid
14738 !! wikitext
14739
14740 [[:Category:Foo]]
14741 [[:Category:Foo|Bar]]
14742 !! html
14743 <p>
14744 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14745 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14746 </p>
14747 !! end
14748
14749 # We used to, but no longer wt2wt this test since the default serializer
14750 # will normalize all categories to serialize on their own line.
14751 # This wikitext usage is going to be fairly uncommon in production and
14752 # selser will take care of preventing whitespace insertion if this
14753 # occurs in an article.
14754 #
14755 # html2html disabled for the same reason (whitespace insertion between
14756 # x and y).
14757 #
14758 # html2wt disabled because it localizes the "Category" namespace.
14759 !! test
14760 Link prefix/suffixes aren't applied to category links
14761 !! options
14762 parsoid=wt2html
14763 language=is
14764 !! wikitext
14765 x[[Category:Foo]]y
14766 !! html/php
14767 <p>xy
14768 </p>
14769 !! html/parsoid
14770 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14771 !! end
14772
14773 !! test
14774 Parsoid: Serialize link to file page with colon escape
14775 !! options
14776 parsoid
14777 !! wikitext
14778
14779 [[:File:Foo.png]]
14780 [[:File:Foo.png|Bar]]
14781 !! html
14782 <p>
14783 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14784 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14785 </p>
14786 !! end
14787
14788 !! test
14789 Parsoid: Serialize a genuine category link without colon escape
14790 !! options
14791 parsoid
14792 !! wikitext
14793 [[Category:Foo]]
14794 [[Category:Foo|Bar]]
14795 !! html
14796 <link rel="mw:PageProp/Category" href="./Category:Foo">
14797 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14798 !! end
14799
14800 !! test
14801 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14802 !! options
14803 parsoid=html2wt
14804 !! html/parsoid
14805 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14806 !! wikitext
14807 [[Category:Toxine bactérienne]]
14808 !! end
14809
14810 !! test
14811 Parsoid: Defaultsort
14812 !! wikitext
14813 {{DEFAULTSORT:Foo}}
14814 !! html/parsoid
14815 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14816 !! end
14817
14818 !! test
14819 Parsoid: Defaultsort (template-generated)
14820 !! wikitext
14821 {{{{echo|DEFAULTSORT}}:Foo}}
14822 !! html/parsoid
14823 <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}}]}'/>
14824 !! end
14825
14826 ###
14827 ### Inter-language links
14828 ###
14829 !! test
14830 Interlanguage links
14831 !! options
14832 ill
14833 !! wikitext
14834 [[es:Alimento]]
14835 [[fr:Nourriture]]
14836 [[zh:食品]]
14837 !! html/php
14838 es:Alimento fr:Nourriture zh:食品
14839 !! html/parsoid
14840 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14841 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14842 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14843 !! end
14844
14845 !! test
14846 Duplicate interlanguage links (bug 24502)
14847 !! options
14848 ill
14849 !! wikitext
14850 [[es:1]]
14851 [[es:2]]
14852 [[fr:1]]
14853 [[fr:2]]
14854 !! html/php
14855 es:1 fr:1
14856 !! html/parsoid
14857 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14858 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14859 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14860 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14861 !! end
14862
14863 ###
14864 ### Sections
14865 ###
14866 !! test
14867 Basic section headings
14868 !! wikitext
14869 == Headline 1 ==
14870 Some text
14871
14872 ==Headline 2==
14873 More
14874 ===Smaller headline===
14875 Blah blah
14876 !! html
14877 <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>
14878 <p>Some text
14879 </p>
14880 <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>
14881 <p>More
14882 </p>
14883 <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>
14884 <p>Blah blah
14885 </p>
14886 !! end
14887
14888 !! test
14889 Section headings with TOC
14890 !! wikitext
14891 == Headline 1 ==
14892 === Subheadline 1 ===
14893 ===== Skipping a level =====
14894 ====== Skipping a level ======
14895
14896 == Headline 2 ==
14897 Some text
14898 ===Another headline===
14899 !! html
14900 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14901 <ul>
14902 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14903 <ul>
14904 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14905 <ul>
14906 <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>
14907 <ul>
14908 <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>
14909 </ul>
14910 </li>
14911 </ul>
14912 </li>
14913 </ul>
14914 </li>
14915 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14916 <ul>
14917 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14918 </ul>
14919 </li>
14920 </ul>
14921 </div>
14922
14923 <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>
14924 <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>
14925 <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>
14926 <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>
14927 <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>
14928 <p>Some text
14929 </p>
14930 <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>
14931
14932 !! end
14933
14934 !! test
14935 TOC anchors don't collide
14936 !! wikitext
14937 __FORCETOC__
14938 == Headline 2 ==
14939 == Headline ==
14940 == Headline 2 ==
14941 == Headline ==
14942 !! html/php
14943 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14944 <ul>
14945 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14946 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14947 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14948 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14949 </ul>
14950 </div>
14951
14952 <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>
14953 <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>
14954 <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>
14955 <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>
14956
14957 !! end
14958
14959 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14960 !! test
14961 Handling of sections up to level 6 and beyond
14962 !! wikitext
14963 = Level 1 Heading=
14964 == Level 2 Heading==
14965 === Level 3 Heading===
14966 ==== Level 4 Heading====
14967 ===== Level 5 Heading=====
14968 ====== Level 6 Heading======
14969 ======= Level 7 Heading=======
14970 ======== Level 8 Heading========
14971 ========= Level 9 Heading=========
14972 ========== Level 10 Heading==========
14973 !! html
14974 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14975 <ul>
14976 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14977 <ul>
14978 <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>
14979 <ul>
14980 <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>
14981 <ul>
14982 <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>
14983 <ul>
14984 <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>
14985 <ul>
14986 <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>
14987 <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>
14988 <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>
14989 <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>
14990 <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>
14991 </ul>
14992 </li>
14993 </ul>
14994 </li>
14995 </ul>
14996 </li>
14997 </ul>
14998 </li>
14999 </ul>
15000 </li>
15001 </ul>
15002 </div>
15003
15004 <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>
15005 <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>
15006 <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>
15007 <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>
15008 <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>
15009 <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>
15010 <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>
15011 <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>
15012 <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>
15013 <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>
15014
15015 !! end
15016
15017 !! test
15018 TOC regression (T11764)
15019 !! wikitext
15020 == title 1 ==
15021 === title 1.1 ===
15022 ==== title 1.1.1 ====
15023 === title 1.2 ===
15024 == title 2 ==
15025 === title 2.1 ===
15026 !! html
15027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15028 <ul>
15029 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15030 <ul>
15031 <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>
15032 <ul>
15033 <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>
15034 </ul>
15035 </li>
15036 <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>
15037 </ul>
15038 </li>
15039 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15040 <ul>
15041 <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>
15042 </ul>
15043 </li>
15044 </ul>
15045 </div>
15046
15047 <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>
15048 <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>
15049 <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>
15050 <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>
15051 <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>
15052 <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>
15053
15054 !! end
15055
15056 !! test
15057 TOC for heading containing <span id="..."></span> (T96153)
15058 !! wikitext
15059 __FORCETOC__
15060 ==<span id="old-anchor"></span>New title==
15061 !! html/php
15062 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15063 <ul>
15064 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15065 </ul>
15066 </div>
15067
15068 <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>
15069
15070 !! end
15071
15072 !! test
15073 TOC with wgMaxTocLevel=3 (bug 6204)
15074 !! options
15075 wgMaxTocLevel=3
15076 !! wikitext
15077 == title 1 ==
15078 === title 1.1 ===
15079 ==== title 1.1.1 ====
15080 === title 1.2 ===
15081 == title 2 ==
15082 === title 2.1 ===
15083 !! html
15084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15085 <ul>
15086 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15087 <ul>
15088 <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>
15089 <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>
15090 </ul>
15091 </li>
15092 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15093 <ul>
15094 <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>
15095 </ul>
15096 </li>
15097 </ul>
15098 </div>
15099
15100 <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>
15101 <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>
15102 <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>
15103 <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>
15104 <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>
15105 <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>
15106
15107 !! end
15108
15109 !! test
15110 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15111 !! options
15112 wgMaxTocLevel=3
15113 !! wikitext
15114 ==Section 1==
15115 ===Section 1.1===
15116 ====Section 1.1.1====
15117 ====Section 1.1.1.1====
15118 ==Section 2==
15119 !! html
15120 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15121 <ul>
15122 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15123 <ul>
15124 <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>
15125 </ul>
15126 </li>
15127 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15128 </ul>
15129 </div>
15130
15131 <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>
15132 <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>
15133 <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>
15134 <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>
15135 <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>
15136
15137 !! end
15138
15139
15140 !! test
15141 Resolving duplicate section names
15142 !! wikitext
15143 == Foo bar ==
15144 == Foo bar ==
15145 !! html
15146 <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>
15147 <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>
15148
15149 !! end
15150
15151 !! test
15152 Resolving duplicate section names with differing case (bug 10721)
15153 !! wikitext
15154 == Foo bar ==
15155 == Foo Bar ==
15156 !! html
15157 <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>
15158 <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>
15159
15160 !! end
15161
15162 !! article
15163 Template:sections
15164 !! text
15165 ===Section 1===
15166 ==Section 2==
15167 !! endarticle
15168
15169 !! test
15170 Template with sections, __NOTOC__
15171 !! wikitext
15172 __NOTOC__
15173 ==Section 0==
15174 {{sections}}
15175 ==Section 4==
15176 !! html
15177 <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>
15178 <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>
15179 <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>
15180 <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>
15181
15182 !! end
15183
15184 !! test
15185 __NOEDITSECTION__ keyword
15186 !! wikitext
15187 __NOEDITSECTION__
15188 ==Section 1==
15189 ==Section 2==
15190 !! html
15191 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15192 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15193
15194 !! end
15195
15196 !! test
15197 Link inside a section heading
15198 !! wikitext
15199 ==Section with a [[Main Page|link]] in it==
15200 !! html
15201 <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>
15202
15203 !! end
15204
15205 !! test
15206 TOC regression (T14077)
15207 !! wikitext
15208 __TOC__
15209 == title 1 ==
15210 === title 1.1 ===
15211 == title 2 ==
15212 !! html
15213 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15214 <ul>
15215 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15216 <ul>
15217 <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>
15218 </ul>
15219 </li>
15220 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15221 </ul>
15222 </div>
15223
15224 <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>
15225 <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>
15226 <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>
15227
15228 !! end
15229
15230 !! test
15231 BUG 1219 URL next to image (good)
15232 !! wikitext
15233 http://example.com [[File:Foobar.jpg]]
15234 !! html/php
15235 <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>
15236 </p>
15237 !! html/parsoid
15238 <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>
15239 !!end
15240
15241 !! test
15242 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15243 !! wikitext
15244 ===
15245 The line above must have a trailing space!
15246 === <!--
15247 --> <!-- -->
15248 But just in case it doesn't...
15249 !! html
15250 <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>
15251 <p>The line above must have a trailing space!
15252 </p>
15253 <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>
15254 <p>But just in case it doesn't...
15255 </p>
15256 !! end
15257
15258 !! test
15259 Header with special characters (bug 25462)
15260 !! wikitext
15261 The tooltips shall not show entities to the user (ie. be double escaped)
15262
15263 == text > text ==
15264 section 1
15265
15266 == text < text ==
15267 section 2
15268
15269 == text & text ==
15270 section 3
15271
15272 == text ' text ==
15273 section 4
15274
15275 == text " text ==
15276 section 5
15277 !! html
15278 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15279 </p>
15280 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15281 <ul>
15282 <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>
15283 <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>
15284 <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>
15285 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15286 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15287 </ul>
15288 </div>
15289
15290 <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>
15291 <p>section 1
15292 </p>
15293 <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>
15294 <p>section 2
15295 </p>
15296 <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>
15297 <p>section 3
15298 </p>
15299 <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>
15300 <p>section 4
15301 </p>
15302 <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>
15303 <p>section 5
15304 </p>
15305 !! end
15306
15307 !! test
15308 Header with space, plus and underscore as entity
15309 !! wikitext
15310 Id should not contain + for spaces
15311
15312 == Space between Text ==
15313 section 1
15314
15315 == Space-Entity&#32;between&#32;Text ==
15316 section 2
15317
15318 == Plus+between+Text ==
15319 section 3
15320
15321 == Plus-Entity&#43;between&#43;Text ==
15322 section 4
15323
15324 == Underscore_between_Text ==
15325 section 5
15326
15327 == Underscore-Entity&#95;between&#95;Text ==
15328 section 6
15329
15330 [[#Space between Text]]
15331 [[#Space-Entity&#32;between&#32;Text]]
15332 [[#Plus+between+Text]]
15333 [[#Plus-Entity&#43;between&#43;Text]]
15334 [[#Underscore_between_Text]]
15335 [[#Underscore-Entity&#95;between&#95;Text]]
15336 !! html
15337 <p>Id should not contain + for spaces
15338 </p>
15339 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15340 <ul>
15341 <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>
15342 <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>
15343 <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>
15344 <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>
15345 <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>
15346 <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>
15347 </ul>
15348 </div>
15349
15350 <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>
15351 <p>section 1
15352 </p>
15353 <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>
15354 <p>section 2
15355 </p>
15356 <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>
15357 <p>section 3
15358 </p>
15359 <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>
15360 <p>section 4
15361 </p>
15362 <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>
15363 <p>section 5
15364 </p>
15365 <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>
15366 <p>section 6
15367 </p><p><a href="#Space_between_Text">#Space between Text</a>
15368 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15369 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15370 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15371 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15372 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15373 </p>
15374 !! end
15375
15376 !! test
15377 Headers with excess '=' characters
15378 (Are similar tests necessary beyond the 1st level?)
15379 !! wikitext
15380 =foo==
15381 ==foo=
15382 =''italic'' heading==
15383 ==''italic'' heading=
15384 !! html
15385 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15386 <ul>
15387 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15388 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15389 <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>
15390 <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>
15391 </ul>
15392 </div>
15393
15394 <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>
15395 <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>
15396 <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>
15397 <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>
15398
15399 !! end
15400
15401 !! test
15402 HTML headers vs TOC (bug 23393)
15403 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15404 !! wikitext
15405 <h1>Header 1</h1>
15406 == Header 1.1 ==
15407 == Header 1.2 ==
15408
15409 <h1>Header 2
15410 </h1>
15411 == Header 2.1 ==
15412 == Header 2.2 ==
15413 __NOEDITSECTION__
15414 !! html
15415 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15416 <ul>
15417 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15418 <ul>
15419 <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>
15420 <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>
15421 </ul>
15422 </li>
15423 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15424 <ul>
15425 <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>
15426 <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>
15427 </ul>
15428 </li>
15429 </ul>
15430 </div>
15431
15432 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15433 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15434 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15435 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15436 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15437 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15438
15439 !! end
15440
15441 !! test
15442 Single-line or multiline-comments can follow headings
15443 !! options
15444 parsoid=wt2html,wt2wt
15445 !! wikitext
15446 ==foo==<!---->
15447 ==bar==<!--c1-->
15448 ==baz==<!--
15449 c2
15450 c3-->
15451 !! html
15452 <h2><span class="mw-headline" id="foo">foo</span></h2>
15453 <h2><span class="mw-headline" id="bar">bar</span></h2>
15454 <h2><span class="mw-headline" id="baz">baz</span></h2>
15455
15456 !! end
15457
15458 !! test
15459 BUG 1219 URL next to image (broken)
15460 !! wikitext
15461 http://example.com[[File:Foobar.jpg]]
15462 !! html/php
15463 <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>
15464 </p>
15465 !! html/parsoid
15466 <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>
15467 !!end
15468
15469 !! test
15470 Bug 1186 news: in the middle of text
15471 !! wikitext
15472 http://en.wikinews.org/wiki/Wikinews:Workplace
15473 !! html
15474 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15475 </p>
15476 !!end
15477
15478
15479 !! test
15480 Namespaced link must have a title
15481 !! wikitext
15482 [[Project:]]
15483 !! html
15484 <p>[[Project:]]
15485 </p>
15486 !!end
15487
15488 !! test
15489 Namespaced link must have a title (bad fragment version)
15490 !! wikitext
15491 [[Project:#fragment]]
15492 !! html
15493 <p>[[Project:#fragment]]
15494 </p>
15495 !!end
15496
15497
15498 ###
15499 ### HTML tags and HTML attributes
15500 ###
15501
15502 !! test
15503 div with no attributes
15504 !! wikitext
15505 <div>HTML rocks</div>
15506 !! html
15507 <div>HTML rocks</div>
15508
15509 !! end
15510
15511 !! test
15512 div with double-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 single-quoted 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 unquoted attribute
15531 !! wikitext
15532 <div id=rock>HTML rocks</div>
15533 !! html
15534 <div id="rock">HTML rocks</div>
15535
15536 !! end
15537
15538 !! test
15539 div with illegal double attributes
15540 !! wikitext
15541 <div id="a" id="b">HTML rocks</div>
15542 !! html
15543 <div id="b">HTML rocks</div>
15544
15545 !!end
15546
15547 !! test
15548 div with empty attribute value, space before equals
15549 !! options
15550 parsoid=wt2html,html2html
15551 !! wikitext
15552 <div class =>HTML rocks</div>
15553 !! html/php
15554 <div class="">HTML rocks</div>
15555
15556 !! html/parsoid
15557 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15558 !! end
15559
15560 !! test
15561 div with multiple empty attribute values
15562 !! options
15563 parsoid=wt2html,html2html
15564 !! wikitext
15565 <div id= title=>HTML rocks</div>
15566 !! html/php
15567 <div id="title.3D">HTML rocks</div>
15568
15569 !! html/parsoid
15570 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15571 !! end
15572
15573 !! test
15574 table with multiple empty attribute values
15575 !! options
15576 parsoid=wt2html,html2html
15577 !! wikitext
15578 {| title= id=
15579 | hi
15580 |}
15581 !! html/php
15582 <table title="id=">
15583 <tr>
15584 <td> hi
15585 </td></tr></table>
15586
15587 !! html/parsoid
15588 <table title="id=">
15589 <tbody><tr><td> hi</td></tr>
15590 </tbody></table>
15591 !! end
15592
15593 !! test
15594 div with braces in attribute value
15595 !! wikitext
15596 <div title="{}">Foo</div>
15597 !! html/php
15598 <div title="&#123;}">Foo</div>
15599
15600 !! html/parsoid
15601 <div title="{}">Foo</div>
15602 !! end
15603
15604 !! test
15605 div with empty attribute value, no space before equals
15606 !! options
15607 parsoid=wt2html,html2html
15608 !! wikitext
15609 <div class=>HTML rocks</div>
15610 !! html/php
15611 <div class="">HTML rocks</div>
15612
15613 !! html/parsoid
15614 <div class="">HTML rocks</div>
15615 !! end
15616
15617 !! test
15618 HTML multiple attributes correction
15619 !! wikitext
15620 <p class="error" class="awesome">Awesome!</p>
15621 !! html
15622 <p class="awesome">Awesome!</p>
15623
15624 !!end
15625
15626 !! test
15627 Table multiple attributes correction
15628 !! wikitext
15629 {|
15630 !+ class="error" class="awesome"| status
15631 |}
15632 !! html
15633 <table>
15634 <tr>
15635 <th class="awesome"> status
15636 </th></tr></table>
15637
15638 !!end
15639
15640 !! test
15641 DIV IN UPPERCASE
15642 !! wikitext
15643 <DIV ID="x">HTML ROCKS</DIV>
15644 !! html
15645 <div id="x">HTML ROCKS</div>
15646
15647 !!end
15648
15649 !! test
15650 Non-ASCII pseudo-tags are rendered as text
15651 !! wikitext
15652 <khyô>
15653 !! html
15654 <p>&lt;khyô&gt;
15655 </p>
15656 !! end
15657
15658 !! test
15659 Pseudo-tag with URL 'name' renders as url link
15660 !! wikitext
15661 <http://example.com/>
15662 !! html
15663 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15664 </p>
15665 !! end
15666
15667 !! test
15668 text with amp in the middle of nowhere
15669 !! wikitext
15670 Remember AT&T?
15671 !! html
15672 <p>Remember AT&amp;T?
15673 </p>
15674 !! end
15675
15676 !! test
15677 text with character entity: eacute
15678 !! wikitext
15679 I always thought &eacute; was a cute letter.
15680 !! html
15681 <p>I always thought &#233; was a cute letter.
15682 </p>
15683 !! html+tidy
15684 <p>I always thought é was a cute letter.</p>
15685 !! end
15686
15687 !! test
15688 text with entity-escaped character entity-like string: eacute
15689 !! wikitext
15690 I always thought &amp;eacute; was a cute letter.
15691 !! html
15692 <p>I always thought &amp;eacute; was a cute letter.
15693 </p>
15694 !! end
15695
15696 !! test
15697 text with undefined character entity: xacute
15698 !! wikitext
15699 I always thought &xacute; was a cute letter.
15700 !! html
15701 <p>I always thought &amp;xacute; was a cute letter.
15702 </p>
15703 !! end
15704
15705 !! test
15706 HTML5 tags
15707 !! wikitext
15708 <data value="5">five</data>
15709 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15710 <mark>This highlighted text</mark>
15711 !! html
15712 <p><data value="5">five</data>
15713 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15714 <mark>This highlighted text</mark>
15715 </p>
15716 !! end
15717
15718 !! test
15719 HTML tag with leading space is parsed as text
15720 !! wikitext
15721 < div>foo< /div>
15722 !! html
15723 <p>&lt; div&gt;foo&lt; /div&gt;
15724 </p>
15725 !! end
15726
15727 ###
15728 ### Nesting tests (see bug 41545, 50604, 51081)
15729 ###
15730
15731 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15732 # Note that html2wt is considerably more difficult if we use <b> in
15733 # the test case, instead of <big>
15734 !! test
15735 Ensure that HTML adoption agency algorithm is properly implemented.
15736 !! wikitext
15737 <big>X<big>Y</big>Z</big>
15738 !! html
15739 <p><big>X<big>Y</big>Z</big>
15740 </p>
15741 !! end
15742
15743 # This was bug 41545 in the PHP parser.
15744 # Note that tidy doesn't handle this correctly.
15745 !! test
15746 Nesting of <kbd>
15747 !! wikitext
15748 <kbd>X<kbd>Y</kbd>Z</kbd>
15749 !! html
15750 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15751 </p>
15752 !! end
15753
15754 # The following cases were bug 51081 in the PHP parser.
15755 # Note that there are some other nestable tags (b, i, etc) which are
15756 # not covered; see bug 51081 for discussion.
15757
15758 # Note that tidy doesn't handle this correctly.
15759 !! test
15760 Nesting of <em>
15761 !! wikitext
15762 <em>X<em>Y</em>Z</em>
15763 !! html
15764 <p><em>X<em>Y</em>Z</em>
15765 </p>
15766 !! end
15767
15768 # Note that tidy doesn't handle this correctly.
15769 !! test
15770 Nesting of <strong>
15771 !! wikitext
15772 <strong>X<strong>Y</strong>Z</strong>
15773 !! html
15774 <p><strong>X<strong>Y</strong>Z</strong>
15775 </p>
15776 !! end
15777
15778 !! test
15779 Nesting of <q>
15780 !! wikitext
15781 <q>X<q>Y</q>Z</q>
15782 !! html+tidy
15783 <p><q>X<q>Y</q>Z</q></p>
15784 !! end
15785
15786 # Note that tidy doesn't handle this correctly.
15787 !! test
15788 Nesting of <ruby>
15789 !! wikitext
15790 <ruby>X<ruby>Y</ruby>Z</ruby>
15791 !! html
15792 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15793 </p>
15794 !! end
15795
15796 # Note that tidy doesn't handle this correctly.
15797 !! test
15798 Nesting of <bdo>
15799 !! wikitext
15800 <bdo>X<bdo>Y</bdo>Z</bdo>
15801 !! html
15802 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15803 </p>
15804 !! end
15805
15806
15807 ###
15808 ### Media links
15809 ###
15810
15811 !! test
15812 Media link
15813 !! wikitext
15814 [[Media:Foobar.jpg]]
15815 !! html
15816 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15817 </p>
15818 !! end
15819
15820 !! test
15821 Media link with text
15822 !! wikitext
15823 [[Media:Foobar.jpg|A neat file to look at]]
15824 !! html
15825 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15826 </p>
15827 !! end
15828
15829 # FIXME: this is still bad HTML tag nesting
15830 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15831 !! test
15832 Media link with nasty text
15833 !! wikitext
15834 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15835 !! html
15836 <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>
15837
15838 !! html+tidy
15839 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15840 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15841 !! end
15842
15843 !! test
15844 Media link to nonexistent file (bug 1702)
15845 !! wikitext
15846 [[Media:No such.jpg]]
15847 !! html
15848 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15849 </p>
15850 !! end
15851
15852 !! test
15853 Image link to nonexistent file (bug 1850 - good)
15854 !! wikitext
15855 [[File:No_such.jpg]]
15856 !! html/php
15857 <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>
15858 </p>
15859 !! html/parsoid
15860 <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>
15861 !! end
15862
15863 !! test
15864 :Image link to nonexistent file (bug 1850 - bad)
15865 !! wikitext
15866 [[:Image:No such.jpg]]
15867 !! html/php
15868 <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>
15869 </p>
15870 !! html/parsoid
15871 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15872 !! end
15873
15874
15875
15876 !! test
15877 Character reference normalization in link text (bug 1938)
15878 !! wikitext
15879 [[Main Page|this&that]]
15880 !! html
15881 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15882 </p>
15883 !!end
15884
15885 !! article
15886 אַ
15887 !! text
15888 Test for unicode normalization
15889
15890 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15891 !! endarticle
15892
15893 !! test
15894 (bug 19451) Links should refer to the normalized form.
15895 !! wikitext
15896 [[&#xFB2E;]]
15897 [[&#x5d0;&#x5b7;]]
15898 [[&#x5d0;ַ]]
15899 [[א&#x5b7;]]
15900 [[אַ]]
15901 !! html
15902 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15903 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15904 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15905 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15906 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15907 </p>
15908 !! end
15909
15910 !! test
15911 Empty attribute crash test (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 Empty attribute crash test single-quotes (bug 2067)
15921 !! wikitext
15922 <font color=''>foo</font>
15923 !! html
15924 <p><font color="">foo</font>
15925 </p>
15926 !! end
15927
15928 !! test
15929 Attribute test: equals, then nothing
15930 !! options
15931 parsoid=wt2html,html2html
15932 !! wikitext
15933 <font color=>foo</font>
15934 !! html/php
15935 <p><font color="">foo</font>
15936 </p>
15937 !! html/parsoid
15938 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15939 !! end
15940
15941 !! test
15942 Attribute test: unquoted value
15943 !! options
15944 parsoid=wt2html,html2html
15945 !! wikitext
15946 <font color=x>foo</font>
15947 !! html/php
15948 <p><font color="x">foo</font>
15949 </p>
15950 !! html/parsoid
15951 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15952 !! end
15953
15954 !! test
15955 Attribute test: unquoted but illegal value (hash)
15956 !! wikitext
15957 <font color=#x>foo</font>
15958 !! html
15959 <p><font color="#x">foo</font>
15960 </p>
15961 !! end
15962
15963 # Parsoid does not serialize to empty attribute syntax,
15964 # so wt2wt and html2wt cases are skipped
15965 !! test
15966 Attribute test: no value (T54330)
15967 !! options
15968 parsoid=wt2html,html2html
15969 !! wikitext
15970 <font color>foo</font>
15971 !! html/php
15972 <p><font color="">foo</font>
15973 </p>
15974 !! html/parsoid
15975 <p><font color="">foo</font></p>
15976 !! end
15977
15978 !! test
15979 Bug 2095: link with three closing brackets
15980 !! wikitext
15981 [[Main Page]]]
15982 !! html/php
15983 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15984 </p>
15985 !! html/parsoid
15986 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15987 !! end
15988
15989 !! test
15990 Bug 2095: link with pipe and three closing brackets
15991 !! wikitext
15992 [[Main Page|link]]]
15993 !! html/php
15994 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15995 </p>
15996 !! html/parsoid
15997 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15998 !! end
15999
16000 !! test
16001 Bug 2095: link with pipe and three closing brackets, version 2
16002 !! wikitext
16003 [[Main Page|[http://example.com/]]]
16004 !! html/php
16005 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16006 </p>
16007 !! html/parsoid
16008 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16009 !! end
16010
16011
16012 ###
16013 ### Safety
16014 ###
16015
16016 !! article
16017 Template:Dangerous attribute
16018 !! text
16019 " onmouseover="alert(document.cookie)
16020 !! endarticle
16021
16022 !! article
16023 Template:Dangerous style attribute
16024 !! text
16025 border-size: expression(alert(document.cookie))
16026 !! endarticle
16027
16028 !! article
16029 Template:Div style
16030 !! text
16031 <div style="float: right; {{{1}}}">Magic div</div>
16032 !! endarticle
16033
16034 !! test
16035 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16036 !! wikitext
16037 <div title="{{test}}"></div>
16038 !! html
16039 <div title="This is a test template"></div>
16040
16041 !! end
16042
16043 # Parsoid has enough context to handle this case
16044 !! test
16045 Bug 2304: HTML attribute safety (dangerous template; 2309)
16046 !! wikitext
16047 <div title="{{dangerous attribute}}"></div>
16048 !! html/php
16049 <div title=""></div>
16050
16051 !! html/parsoid
16052 <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>
16053 !! end
16054
16055 !! test
16056 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16057 !! wikitext
16058 <div style="{{dangerous style attribute}}"></div>
16059 !! html
16060 <div style="/* insecure input */"></div>
16061
16062 !! end
16063
16064 !! test
16065 Bug 2304: HTML attribute safety (safe parameter; 2309)
16066 !! wikitext
16067 {{div style|width: 200px}}
16068 !! html
16069 <div style="float: right; width: 200px">Magic div</div>
16070
16071 !! end
16072
16073 !! test
16074 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16075 !! wikitext
16076 {{div style|width: expression(alert(document.cookie))}}
16077 !! html
16078 <div style="/* insecure input */">Magic div</div>
16079
16080 !! end
16081
16082 !! test
16083 Bug 2304: HTML attribute safety (unsafe breakout parameter; 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 (unsafe breakout parameter 2; 2309)
16093 !! wikitext
16094 {{div style|" ><script>alert(document.cookie)</script>}}
16095 !! html
16096 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16097
16098 !! end
16099
16100 !! test
16101 Bug 2304: HTML attribute safety (link)
16102 !! wikitext
16103 <div title="[[Main Page]]"></div>
16104 !! html
16105 <div title="&#91;&#91;Main Page]]"></div>
16106
16107 !! end
16108
16109 !! test
16110 Bug 2304: HTML attribute safety (italics)
16111 !! wikitext
16112 <div title="''foobar''"></div>
16113 !! html
16114 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16115
16116 !! end
16117
16118 !! test
16119 Bug 2304: HTML attribute safety (bold)
16120 !! wikitext
16121 <div title="'''foobar'''"></div>
16122 !! html
16123 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16124
16125 !! end
16126
16127
16128 !! test
16129 Bug 2304: HTML attribute safety (ISBN)
16130 !! wikitext
16131 <div title="ISBN 1234567890"></div>
16132 !! html
16133 <div title="&#73;SBN 1234567890"></div>
16134
16135 !! end
16136
16137 !! test
16138 Bug 2304: HTML attribute safety (RFC)
16139 !! wikitext
16140 <div title="RFC 1234"></div>
16141 !! html
16142 <div title="&#82;FC 1234"></div>
16143
16144 !! end
16145
16146 !! test
16147 Bug 2304: HTML attribute safety (PMID)
16148 !! wikitext
16149 <div title="PMID 1234567890"></div>
16150 !! html
16151 <div title="&#80;MID 1234567890"></div>
16152
16153 !! end
16154
16155 !! test
16156 Bug 2304: HTML attribute safety (web link)
16157 !! wikitext
16158 <div title="http://example.com/"></div>
16159 !! html
16160 <div title="http&#58;//example.com/"></div>
16161
16162 !! end
16163
16164 !! test
16165 Bug 2304: HTML attribute safety (named web link)
16166 !! wikitext
16167 <div title="[http://example.com/ link]"></div>
16168 !! html
16169 <div title="&#91;http&#58;//example.com/ link]"></div>
16170
16171 !! end
16172
16173 !! test
16174 Bug 3244: HTML attribute safety (extension; safe)
16175 !! wikitext
16176 <div style="<nowiki>background:blue</nowiki>"></div>
16177 !! html
16178 <div style="background:blue"></div>
16179
16180 !! end
16181
16182 !! test
16183 Bug 3244: HTML attribute safety (extension; unsafe)
16184 !! wikitext
16185 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16186 !! html
16187 <div style="/* insecure input */"></div>
16188
16189 !! end
16190
16191 # More MSIE fun discovered by Tom Gilder
16192
16193 !! test
16194 MSIE CSS safety test: spurious slash
16195 !! wikitext
16196 <div style="background-image:u\rl(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: hex code
16204 !! wikitext
16205 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16206 !! html
16207 <div style="/* insecure input */">evil</div>
16208
16209 !! end
16210
16211 !! test
16212 MSIE CSS safety test: comment in url
16213 !! wikitext
16214 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16215 !! html
16216 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16217
16218 !! end
16219
16220 !! test
16221 MSIE CSS safety test: comment in expression
16222 !! wikitext
16223 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16224 !! html
16225 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16226
16227 !! end
16228
16229 !! test
16230 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16231 !! wikitext
16232 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16233 !! html
16234 <p style="/* invalid control char */">A</p>
16235
16236 !! end
16237
16238 !! test
16239 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16240 !! wikitext
16241 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16242 <div style="top:EXPRESSION(alert())">B</div>
16243 !! html
16244 <p style="/* insecure input */">A</p>
16245 <div style="/* insecure input */">B</div>
16246
16247 !! end
16248
16249 !! test
16250 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16251 !! wikitext
16252 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16253 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16254 !! html
16255 <div style="/* insecure input */">A</div>
16256 <p style="/* insecure input */">B</p>
16257
16258 !! end
16259
16260 !! test
16261 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16262 !! wikitext
16263 <div style="background-image:url⁽javascript:alert())">A</div>
16264 <div style="background-image:url₍javascript:alert())">B</div>
16265 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16266 !! html
16267 <div style="/* insecure input */">A</div>
16268 <div style="/* insecure input */">B</div>
16269 <p style="/* insecure input */">C</p>
16270
16271 !! end
16272
16273 # FIXME: Parsoid fails to sanitize this! See T58846.
16274 !! test
16275 Opera -o-link CSS
16276 !! wikitext
16277 <div
16278 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;"
16279 style="-o-link:attr(title);-o-link-source:current">X</div>
16280 !! html
16281 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16282
16283 !! end
16284
16285 !! test
16286 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16287 !! wikitext
16288 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16289 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16290 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16291 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16292 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16293 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16294 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16295 !! html
16296 <p style="/* insecure input */">A</p>
16297 <p style="/* insecure input */">B</p>
16298 <p style="/* insecure input */">C</p>
16299 <p style="/* insecure input */">D</p>
16300 <p style="/* insecure input */">E</p>
16301 <p style="/* insecure input */">F</p>
16302 <p style="/* insecure input */">G</p>
16303
16304 !! end
16305
16306 !! test
16307 Table attribute legitimate extension
16308 !! wikitext
16309 {|
16310 !+ style="<nowiki>color:blue</nowiki>"| status
16311 |}
16312 !! html
16313 <table>
16314 <tr>
16315 <th style="color:blue"> status
16316 </th></tr></table>
16317
16318 !!end
16319
16320 !! test
16321 Table attribute safety
16322 !! wikitext
16323 {|
16324 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16325 |}
16326 !! html
16327 <table>
16328 <tr>
16329 <th style="/* insecure input */"> status
16330 </th></tr></table>
16331
16332 !! end
16333
16334 !! test
16335 CSS line continuation 1
16336 !! wikitext
16337 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16338 !! html
16339 <div style="/* insecure input */"></div>
16340
16341 !! end
16342
16343 !! test
16344 CSS line continuation 2
16345 !! wikitext
16346 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16347 !! html
16348 <div style="/* invalid control char */"></div>
16349
16350 !! end
16351
16352 !! article
16353 Template:Identity
16354 !! text
16355 {{{1}}}
16356 !! endarticle
16357
16358 !! test
16359 Expansion of multi-line templates in attribute values (bug 6255)
16360 !! wikitext
16361 <div style="background: {{identity|#00FF00}}">-</div>
16362 !! html
16363 <div style="background: #00FF00">-</div>
16364
16365 !! end
16366
16367
16368 !! test
16369 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16370 !! wikitext
16371 <div style="background:
16372 #00FF00">-</div>
16373 !! html/php
16374 <div style="background: #00FF00">-</div>
16375
16376 !! html/parsoid
16377 <div style="background:
16378 #00FF00">-</div>
16379 !! end
16380
16381 !! test
16382 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16383 !! wikitext
16384 <div style="background: &#10;#00FF00">-</div>
16385 !! html
16386 <div style="background: &#10;#00FF00">-</div>
16387
16388 !! end
16389
16390 !! test
16391 evil <math>-wiki-tags without Extension:Math enabled
16392 !! wikitext
16393 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16394 !! html+tidy
16395 <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>
16396 !! end
16397
16398 ###
16399 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16400 ###
16401 !! test
16402 Parser hook: empty input
16403 !! wikitext
16404 <tag></tag>
16405 !! html/php
16406 <pre>
16407 ''
16408 array (
16409 )
16410 </pre>
16411
16412 !! html/parsoid
16413 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16414 !! end
16415
16416 ## Don't expect parsoid to rt this form.
16417 !! test
16418 Parser hook: empty input using terminated empty elements
16419 !! options
16420 parsoid=wt2html,html2html
16421 !! wikitext
16422 <tag/>
16423 !! html/php
16424 <pre>
16425 NULL
16426 array (
16427 )
16428 </pre>
16429
16430 !! html/parsoid
16431 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16432 !! end
16433
16434 !! test
16435 Parser hook: empty input using terminated empty elements (space before)
16436 !! wikitext
16437 <tag />
16438 !! html/php
16439 <pre>
16440 NULL
16441 array (
16442 )
16443 </pre>
16444
16445 !! html/parsoid
16446 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16447 !! end
16448
16449 !! test
16450 Parser hook: basic input
16451 !! wikitext
16452 <tag>input</tag>
16453 !! html/php
16454 <pre>
16455 'input'
16456 array (
16457 )
16458 </pre>
16459
16460 !! html/parsoid
16461 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16462 !! end
16463
16464 ## Don't expect parsoid to rt this form.
16465 !! test
16466 Parser hook: case insensitive
16467 !! options
16468 parsoid=wt2html,html2html
16469 !! wikitext
16470 <TAG>input</TAG>
16471 !! html/php
16472 <pre>
16473 'input'
16474 array (
16475 )
16476 </pre>
16477
16478 !! html/parsoid
16479 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16480 !! end
16481
16482 ## Don't expect parsoid to rt this form.
16483 !! test
16484 Parser hook: case insensitive, redux
16485 !! options
16486 parsoid=wt2html,html2html
16487 !! wikitext
16488 <TaG>input</TAg>
16489 !! html/php
16490 <pre>
16491 'input'
16492 array (
16493 )
16494 </pre>
16495
16496 !! html/parsoid
16497 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16498 !! end
16499
16500 !! test
16501 Parser hook: nested tags
16502 !! wikitext
16503 <tag><tag></tag></tag>
16504 !! html/php
16505 <pre>
16506 '<tag>'
16507 array (
16508 )
16509 </pre>&lt;/tag&gt;
16510
16511 !! html/parsoid
16512 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16513 !! end
16514
16515 !! test
16516 Parser hook: basic arguments
16517 !! wikitext
16518 <tag width="200" height="100" depth="50" square=""></tag>
16519 !! html/php
16520 <pre>
16521 ''
16522 array (
16523 'width' => '200',
16524 'height' => '100',
16525 'depth' => '50',
16526 'square' => '',
16527 )
16528 </pre>
16529
16530 !! html/parsoid
16531 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16532 !! end
16533
16534 ## Don't expect parsoid to rt this form.
16535 !! test
16536 Parser hook: basic arguments, variations
16537 !! options
16538 parsoid=wt2html,html2html
16539 !! wikitext
16540 <tag width=200 height = "100" depth = '50' square></tag>
16541 !! html/php
16542 <pre>
16543 ''
16544 array (
16545 'width' => '200',
16546 'height' => '100',
16547 'depth' => '50',
16548 'square' => '',
16549 )
16550 </pre>
16551
16552 !! html/parsoid
16553 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16554 !! end
16555
16556 !! test
16557 Parser hook: argument containing a forward slash (bug 5344)
16558 !! wikitext
16559 <tag filename="/tmp/bla"></tag>
16560 !! html/php
16561 <pre>
16562 ''
16563 array (
16564 'filename' => '/tmp/bla',
16565 )
16566 </pre>
16567
16568 !! html/parsoid
16569 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16570 !! end
16571
16572 ## Don't expect parsoid to rt this form.
16573 !! test
16574 Parser hook: empty input using terminated empty elements (bug 2374)
16575 !! options
16576 parsoid=wt2html,html2html
16577 !! wikitext
16578 <tag foo=bar/>text
16579 !! html/php
16580 <pre>
16581 NULL
16582 array (
16583 'foo' => 'bar',
16584 )
16585 </pre>text
16586
16587 !! html/parsoid
16588 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16589 !! end
16590
16591 ## </tag> should be output literally since there is no matching tag that begins it
16592 ## Don't expect parsoid to rt this form.
16593 !! test
16594 Parser hook: basic arguments using terminated empty elements (bug 2374)
16595 !! options
16596 parsoid=wt2html
16597 !! wikitext
16598 <tag width=200 height = "100" depth = '50' square/>
16599 other stuff
16600 </tag>
16601 !! html/php
16602 <pre>
16603 NULL
16604 array (
16605 'width' => '200',
16606 'height' => '100',
16607 'depth' => '50',
16608 'square' => '',
16609 )
16610 </pre>
16611 <p>other stuff
16612 &lt;/tag&gt;
16613 </p>
16614 !! html/parsoid
16615 <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
16616 &lt;/tag></p>
16617 !! end
16618
16619 ## Don't expect parsoid to rt this form.
16620 !! test
16621 Parser hook: Don't allow unclosed extension tags
16622 !! options
16623 parsoid=wt2html
16624 !! wikitext
16625 test <tag>123
16626
16627 this is a '''test'''
16628 !! html/php
16629 <p>test &lt;tag&gt;123
16630 </p><p>this is a <b>test</b>
16631 </p>
16632 !! html/parsoid
16633 <p>test &lt;tag>123</p>
16634
16635 <p>this is a <b>test</b></p>
16636 !! end
16637
16638 ###
16639 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16640 ###
16641
16642 !! test
16643 Parser hook: static parser hook not inside a comment
16644 !! wikitext
16645 <statictag>hello, world</statictag>
16646
16647 <statictag action="flush" />
16648 !! html/php
16649 <p><br />
16650 hello, world
16651 </p>
16652 !! html/parsoid
16653 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16654 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16655 !! end
16656
16657 !! test
16658 Parser hook: static parser hook inside a comment
16659 !! wikitext
16660 <!-- <statictag>hello, world</statictag> -->
16661 <statictag action="flush" />
16662 !! html/php
16663 <p><br />
16664 </p>
16665 !! html/parsoid
16666 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16667 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16668 !! end
16669
16670 # Nested template calls; this case was broken by Parser.php rev 1.506,
16671 # since reverted.
16672
16673 !! article
16674 Template:One-parameter
16675 !! text
16676 (My parameter is: {{{1}}})
16677 !! endarticle
16678
16679 !! article
16680 Template:Map-one-parameter
16681 !! text
16682 {{{{{1}}}|{{{2}}}}}
16683 !! endarticle
16684
16685 !! test
16686 Nested template calls
16687 !! wikitext
16688 {{Map-one-parameter|One-parameter|param}}
16689 !! html
16690 <p>(My parameter is: param)
16691 </p>
16692 !! end
16693
16694
16695 ###
16696 ### Sanitizer
16697 ###
16698
16699 # HTML+Tidy effectively strips out the empty tags completely
16700 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16701 # which Tidy would have done for the PHP parser had there been content inside it.
16702 !! test
16703 Sanitizer: Closing of open tags
16704 !! wikitext
16705 <s></s><table></table>
16706 !! html
16707 <s></s><table></table>
16708
16709 !! html/parsoid
16710 <p><s></s></p><table></table>
16711 !! end
16712
16713 !! test
16714 Sanitizer: Closing of open but not closed tags
16715 !! wikitext
16716 <s>foo
16717 !! html
16718 <p><s>foo</s>
16719 </p>
16720 !! end
16721
16722 !! test
16723 Sanitizer: Closing of closed but not open tags
16724 !! options
16725 parsoid=wt2html
16726 !! wikitext
16727 </s>
16728 !! html/php+tidy
16729 !! html/parsoid
16730 !! end
16731
16732 !! test
16733 Sanitizer: Closing of closed but not open table tags
16734 !! options
16735 parsoid=wt2html
16736 !! wikitext
16737 Table not started</td></tr></table>
16738 !! html/php+tidy
16739 <p>Table not started</p>
16740 !! html/parsoid
16741 <p>Table not started</p>
16742 !! end
16743
16744 !! test
16745 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16746 !! wikitext
16747 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16748 !! html
16749 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16750 </p>
16751 !! end
16752
16753 # In HTML5, the restrictions are that id must contain at least one character,
16754 # and must not contain any space characters.
16755 !! test
16756 Sanitizer: Validating the contents of the id attribute (bug 4515)
16757 !! options
16758 disabled
16759 !! wikitext
16760 <br id="" /><br id="a space" />
16761 !! html
16762 Something ...
16763 !! end
16764
16765 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16766 !! test
16767 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16768 !! options
16769 disabled
16770 !! wikitext
16771 <br id="foo" /><br id="foo" />
16772 !! html
16773 Something need to be done. foo-2 ?
16774 !! end
16775
16776 !! test
16777 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16778 !! wikitext
16779 <div itemscope>
16780 <meta itemprop="hello" content="world">
16781 <meta http-equiv="refresh" content="5">
16782 <meta itemprop="hello" http-equiv="refresh" content="5">
16783 <link itemprop="hello" href="{{SERVER}}">
16784 <link rel="stylesheet" href="{{SERVER}}">
16785 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16786 </div>
16787 !! html
16788 <div itemscope="">
16789 <p> <meta itemprop="hello" content="world" />
16790 &lt;meta http-equiv="refresh" content="5"&gt;
16791 <meta itemprop="hello" content="5" />
16792 </p>
16793 <link itemprop="hello" href="http&#58;//example.org" />
16794 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16795 <link itemprop="hello" href="http&#58;//example.org" />
16796 </div>
16797
16798 !! end
16799
16800 !! test
16801 Language converter: output gets cut off unexpectedly (bug 5757)
16802 !! options
16803 language=zh
16804 !! wikitext
16805 this bit is safe: }-
16806
16807 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16808
16809 then we get cut off here: }-
16810
16811 all additional text is vanished
16812 !! html
16813 <p>this bit is safe: }-
16814 </p><p>but if we add a conversion instance: xxx
16815 </p><p>then we get cut off here: }-
16816 </p><p>all additional text is vanished
16817 </p>
16818 !! end
16819
16820 !! test
16821 Self closed html pairs (bug 5487)
16822 !! options
16823 !! wikitext
16824 <center><font id="bug" />Centered text</center>
16825 <div><font id="bug2" />In div text</div>
16826 !! html
16827 <center>&lt;font id="bug" /&gt;Centered text</center>
16828 <div>&lt;font id="bug2" /&gt;In div text</div>
16829
16830 !! end
16831
16832 #
16833 #
16834 #
16835
16836 !! test
16837 Punctuation: nbsp before exclamation
16838 !! wikitext
16839 C'est grave !
16840 !! html
16841 <p>C'est grave&#160;!
16842 </p>
16843 !! end
16844
16845 !! test
16846 Punctuation: CSS !important (bug 11874)
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 Punctuation: CSS ! important (bug 11874; with space after)
16856 !! wikitext
16857 <div style="width:50% ! important">important</div>
16858 !! html
16859 <div style="width:50% ! important">important</div>
16860
16861 !!end
16862
16863 !! test
16864 HTML bullet list, closed tags (bug 5497)
16865 !! wikitext
16866 <ul>
16867 <li>One</li>
16868 <li>Two</li>
16869 </ul>
16870 !! html/php
16871 <ul>
16872 <li>One</li>
16873 <li>Two</li>
16874 </ul>
16875
16876 !! html/parsoid
16877 <ul data-parsoid='{"stx":"html"}'>
16878 <li data-parsoid='{"stx":"html"}'>One</li>
16879 <li data-parsoid='{"stx":"html"}'>Two</li>
16880 </ul>
16881
16882 !! end
16883
16884 !! test
16885 HTML bullet list, unclosed tags (bug 5497)
16886 !! wikitext
16887 <ul>
16888 <li>One
16889 <li>Two
16890 </ul>
16891 !! html/php+tidy
16892 <ul>
16893 <li>One</li>
16894 <li>Two</li>
16895 </ul>
16896 !! html/parsoid
16897 <ul data-parsoid='{"stx":"html"}'>
16898 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16899 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16900 </ul>
16901
16902 !! end
16903
16904 !! test
16905 HTML ordered list, closed tags (bug 5497)
16906 !! wikitext
16907 <ol>
16908 <li>One</li>
16909 <li>Two</li>
16910 </ol>
16911 !! html/php
16912 <ol>
16913 <li>One</li>
16914 <li>Two</li>
16915 </ol>
16916
16917 !! html/parsoid
16918 <ol data-parsoid='{"stx":"html"}'>
16919 <li data-parsoid='{"stx":"html"}'>One</li>
16920 <li data-parsoid='{"stx":"html"}'>Two</li>
16921 </ol>
16922
16923 !! end
16924
16925 !! test
16926 HTML ordered list, unclosed tags (bug 5497)
16927 !! options
16928 !! wikitext
16929 <ol>
16930 <li>One
16931 <li>Two
16932 </ol>
16933 !! html/php+tidy
16934 <ol>
16935 <li>One</li>
16936 <li>Two</li>
16937 </ol>
16938 !! html/parsoid
16939 <ol data-parsoid='{"stx":"html"}'>
16940 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16941 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16942 </ol>
16943
16944 !! end
16945
16946 !! test
16947 HTML nested bullet list, closed tags (bug 5497)
16948 !! wikitext
16949 <ul>
16950 <li>One</li>
16951 <li>Two:
16952 <ul>
16953 <li>Sub-one</li>
16954 <li>Sub-two</li>
16955 </ul>
16956 </li>
16957 </ul>
16958 !! html/php
16959 <ul>
16960 <li>One</li>
16961 <li>Two:
16962 <ul>
16963 <li>Sub-one</li>
16964 <li>Sub-two</li>
16965 </ul>
16966 </li>
16967 </ul>
16968
16969 !! html/parsoid
16970 <ul data-parsoid='{"stx":"html"}'>
16971 <li data-parsoid='{"stx":"html"}'>One</li>
16972 <li data-parsoid='{"stx":"html"}'>Two:
16973 <ul data-parsoid='{"stx":"html"}'>
16974 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
16975 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
16976 </ul>
16977 </li>
16978 </ul>
16979 !! end
16980
16981 !! test
16982 HTML nested bullet list, open tags (bug 5497)
16983 !! wikitext
16984 <ul>
16985 <li>One
16986 <li>Two:
16987 <ul>
16988 <li>Sub-one
16989 <li>Sub-two
16990 </ul>
16991 </ul>
16992 !! html/php+tidy
16993 <ul>
16994 <li>One</li>
16995 <li>Two:
16996 <ul>
16997 <li>Sub-one</li>
16998 <li>Sub-two</li>
16999 </ul>
17000 </li>
17001 </ul>
17002 !! html/parsoid
17003 <ul>
17004 <li>One
17005 </li>
17006 <li>Two:
17007 <ul>
17008 <li>Sub-one
17009 </li>
17010 <li>Sub-two
17011 </li>
17012 </ul>
17013 </li>
17014 </ul>
17015
17016 !! end
17017
17018 !! test
17019 HTML nested ordered list, closed tags (bug 5497)
17020 !! wikitext
17021 <ol>
17022 <li>One</li>
17023 <li>Two:
17024 <ol>
17025 <li>Sub-one</li>
17026 <li>Sub-two</li>
17027 </ol>
17028 </li>
17029 </ol>
17030 !! html
17031 <ol>
17032 <li>One</li>
17033 <li>Two:
17034 <ol>
17035 <li>Sub-one</li>
17036 <li>Sub-two</li>
17037 </ol>
17038 </li>
17039 </ol>
17040
17041 !! end
17042
17043 !! test
17044 HTML nested ordered list, open tags (bug 5497)
17045 !! wikitext
17046 <ol>
17047 <li>One
17048 <li>Two:
17049 <ol>
17050 <li>Sub-one
17051 <li>Sub-two
17052 </ol>
17053 </ol>
17054 !! html/php
17055 <ol>
17056 <li>One
17057 <li>Two:
17058 <ol>
17059 <li>Sub-one
17060 <li>Sub-two
17061 </ol>
17062 </ol>
17063
17064 !! html/parsoid
17065 <ol>
17066 <li>One
17067 </li>
17068 <li>Two:
17069 <ol>
17070 <li>Sub-one
17071 </li>
17072 <li>Sub-two
17073 </li>
17074 </ol>
17075 </li>
17076 </ol>
17077
17078 !! end
17079
17080 !! test
17081 HTML ordered list item with parameters oddity
17082 !! wikitext
17083 <ol><li id="fragment">One</li>
17084 </ol>
17085 !! html
17086 <ol><li id="fragment">One</li>
17087 </ol>
17088
17089 !! end
17090
17091 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17092 !!test
17093 bug 5918: autonumbering
17094 !! wikitext
17095 [http://first/] [http://second] [ftp://ftp]
17096
17097 ftp://inlineftp
17098
17099 [mailto:enclosed@mail.tld With target]
17100
17101 [mailto:enclosed@mail.tld]
17102
17103 mailto:inline@mail.tld
17104 !! html/php
17105 <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>
17106 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17107 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17108 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17109 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17110 </p>
17111 !! html/parsoid
17112 <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>
17113 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17114 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17115 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17116 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17117 !! end
17118
17119
17120 #
17121 # Security and HTML correctness
17122 # From Nick Jenkins' fuzz testing
17123 #
17124
17125 !! test
17126 Fuzz testing: Parser13
17127 !! wikitext
17128 {|
17129 | http://a|
17130 !! html
17131 <table>
17132 <tr>
17133 <td>
17134 </td>
17135 </tr>
17136 </table>
17137
17138 !! end
17139
17140 !! test
17141 Fuzz testing: Parser14
17142 !! wikitext
17143 == onmouseover= ==
17144 http://__TOC__
17145 !! html
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 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17148 <ul>
17149 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17150 </ul>
17151 </div>
17152
17153
17154 !! html+tidy
17155 <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>
17156 <p>http://</p>
17157 <div id="toc" class="toc">
17158 <div id="toctitle">
17159 <h2>Contents</h2>
17160 </div>
17161 <ul>
17162 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17163 </ul>
17164 </div>
17165 <p></p>
17166 !! end
17167
17168 !! test
17169 Fuzz testing: Parser14-table
17170 !! options
17171 parsoid=wt2html,html2html
17172 !! wikitext
17173 ==a==
17174 {| STYLE=__TOC__
17175 !! html
17176 <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>
17177 <table style="&#95;_TOC&#95;_">
17178 <tr><td></td></tr>
17179 </table>
17180
17181 !! html+tidy
17182 <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>
17183 <table style="__TOC__">
17184 <tr>
17185 <td></td>
17186 </tr>
17187 </table>
17188 !! html/parsoid
17189 <h2>a</h2>
17190 <table style="__TOC__"></table>
17191 !! end
17192
17193 # Known to produce bogus xml (extra </td>)
17194 !! test
17195 Fuzz testing: Parser16
17196 !! wikitext
17197 {|
17198 !https://||||||
17199 !! html
17200 <table>
17201 <tr>
17202 <th>https://</th>
17203 <th></th>
17204 <th></th>
17205 <th>
17206 </td>
17207 </tr>
17208 </table>
17209
17210 !! html+tidy
17211 <table>
17212 <tr>
17213 <th>https://</th>
17214 <th></th>
17215 <th></th>
17216 <th></th>
17217 </tr>
17218 </table>
17219 !! end
17220
17221 !! test
17222 Fuzz testing: Parser21
17223 !! wikitext
17224 {|
17225 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17226 |
17227 !! html
17228 <table>
17229 <tr>
17230 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17231 </th>
17232 <td>
17233 </td>
17234 </tr>
17235 </table>
17236
17237 !! end
17238
17239 !! test
17240 Fuzz testing: Parser22
17241 !! wikitext
17242 http://===r:::https://b
17243
17244 {|
17245 !! html
17246 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17247 </p>
17248 <table>
17249 <tr><td></td></tr>
17250 </table>
17251
17252 !! end
17253
17254 # Known to produce bad XML for now
17255 !! test
17256 Fuzz testing: Parser24
17257 !! wikitext
17258 {|
17259 {{{|
17260 <u CLASS=
17261 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17262 <br style="onmouseover='alert(document.cookie);' " />
17263
17264 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17265 |
17266 !! html
17267 <table>
17268 {{{|
17269 <u class="&#124;">}}}} &gt;
17270 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17271
17272 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17273 <tr>
17274 <td></u>
17275 </td>
17276 </tr>
17277 </table>
17278
17279 !! end
17280
17281 # Note: the current result listed for this is not what the original one was,
17282 # but the original bug was JavaScript injection, which is fixed in any case.
17283 # It's not clear that the original result listed was any more correct than the
17284 # current one. Original result:
17285 # <p>{{{|
17286 # </p>
17287 # <li class="&#124;&#124;">
17288 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17289 !!test
17290 Fuzz testing: Parser25 (bug 6055)
17291 !! wikitext
17292 {{{
17293 |
17294 <LI CLASS=||
17295 >
17296 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17297 !! html
17298 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17299 </p>
17300 !! end
17301
17302 !!test
17303 Fuzz testing: URL adjacent extension (with space, clean)
17304 !! wikitext
17305 http://example.com <nowiki>junk</nowiki>
17306 !! html/php
17307 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17308 </p>
17309 !! html/parsoid
17310 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17311 !! end
17312
17313 !!test
17314 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17315 !! wikitext
17316 http://example.com<nowiki>junk</nowiki>
17317 !! html/php
17318 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17319 </p>
17320 !! html/parsoid
17321 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17322 !! end
17323
17324 !!test
17325 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17326 !! wikitext
17327 http://example.com<pre>junk</pre>
17328 !! html/php
17329 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17330
17331 !! html/php+tidy
17332 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17333 <pre>
17334 junk
17335 </pre>
17336 !! html/parsoid
17337 <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>
17338 !!end
17339
17340 !!test
17341 Fuzz testing: image with bogus manual thumbnail
17342 !! wikitext
17343 [[Image:foobar.jpg|thumbnail= ]]
17344 !! html/php
17345 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17346
17347 !! html/parsoid
17348 <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>
17349 !!end
17350
17351 !! test
17352 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17353 !! wikitext
17354 <pre dir="&#10;"></pre>
17355 !! html
17356 <pre dir="&#10;"></pre>
17357
17358 !! end
17359
17360 !! test
17361 Parsing optional HTML elements (Bug 6171)
17362 !! options
17363 !! wikitext
17364 <table>
17365 <tr>
17366 <td> Some tabular data</td>
17367 <td> More tabular data ...
17368 <td> And yet som tabular data</td>
17369 </tr>
17370 </table>
17371 !! html
17372 <table>
17373 <tr>
17374 <td> Some tabular data</td>
17375 <td> More tabular data ...
17376 </td><td> And yet som tabular data</td>
17377 </tr>
17378 </table>
17379
17380 !! end
17381
17382 !! test
17383 Correct handling of <td>, <tr> (Bug 6171)
17384 !! options
17385 !! wikitext
17386 <table>
17387 <tr>
17388 <td> Some tabular data</td>
17389 <td> More tabular data ...</td>
17390 <td> And yet som tabular data</td>
17391 </tr>
17392 </table>
17393 !! html
17394 <table>
17395 <tr>
17396 <td> Some tabular data</td>
17397 <td> More tabular data ...</td>
17398 <td> And yet som tabular data</td>
17399 </tr>
17400 </table>
17401
17402 !! end
17403
17404
17405 !! test
17406 Parsing crashing regression (fr:JavaScript)
17407 !! wikitext
17408 </body></x>
17409 !! html
17410 <p>&lt;/body&gt;&lt;/x&gt;
17411 </p>
17412 !! end
17413
17414 !! test
17415 Inline wiki vs wiki block nesting
17416 !! wikitext
17417 '''Bold paragraph
17418
17419 New wiki paragraph
17420 !! html
17421 <p><b>Bold paragraph</b>
17422 </p><p>New wiki paragraph
17423 </p>
17424 !! end
17425
17426 # FIXME: The current php output is documented
17427 # and desired output is the parsoid target.
17428 !! test
17429 Inline HTML vs wiki block nesting
17430 !! wikitext
17431 <b>Bold paragraph
17432
17433 New wiki paragraph
17434 !! html/php
17435 <p><b>Bold paragraph
17436 </p><p>New wiki paragraph</b>
17437 </p>
17438 !! html/parsoid
17439 <p><b>Bold paragraph</b>
17440 </p><p>New wiki paragraph
17441 </p>
17442 !! end
17443
17444 # Original result was this:
17445 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17446 # </p>
17447 # While that might be marginally more intuitive, maybe, the six-apostrophe
17448 # construct is clearly pathological and the result stated here (which is what
17449 # the parser actually does) is about as reasonable as anything.
17450 !!test
17451 Mixing markup for italics and bold
17452 !! options
17453 !! wikitext
17454 '''bold''''''bold''bolditalics'''''
17455 !! html
17456 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17457 </p>
17458 !! end
17459
17460
17461 !! article
17462 Xyzzyx
17463 !! text
17464 Article for special page transclusion test
17465 !! endarticle
17466
17467 !! test
17468 Special page transclusion
17469 !! options
17470 !! wikitext
17471 {{Special:Prefixindex/Xyzzyx}}
17472 !! html
17473 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17474 </ul>
17475
17476 !! end
17477
17478 !! test
17479 Special page transclusion twice (bug 5021)
17480 !! options
17481 !! wikitext
17482 {{Special:Prefixindex/Xyzzyx}}
17483 {{Special:Prefixindex/Xyzzyx}}
17484 !! html
17485 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17486 </ul>
17487 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17488 </ul>
17489
17490 !! end
17491
17492 !! test
17493 Transclusion of default MediaWiki message
17494 !! wikitext
17495 {{MediaWiki:Mainpage}}
17496 !! html
17497 <p>Main Page
17498 </p>
17499 !! end
17500
17501 !! test
17502 Transclusion of nonexistent MediaWiki message
17503 !! wikitext
17504 {{MediaWiki:Mainpagexxx}}
17505 !! html
17506 <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>
17507 </p>
17508 !! end
17509
17510 !! test
17511 Transclusion of MediaWiki message with underscore
17512 !! wikitext
17513 {{MediaWiki:history_short}}
17514 !! html
17515 <p>History
17516 </p>
17517 !! end
17518
17519 !! test
17520 Transclusion of MediaWiki message with space
17521 !! wikitext
17522 {{MediaWiki:history short}}
17523 !! html
17524 <p>History
17525 </p>
17526 !! end
17527
17528 !! test
17529 Invalid header with following text
17530 !! wikitext
17531 = x = y
17532 !! html
17533 <p>= x = y
17534 </p>
17535 !! end
17536
17537
17538 !! test
17539 Section extraction test (section 0)
17540 !! options
17541 section=0
17542 !! wikitext
17543 start
17544 ==a==
17545 ===aa===
17546 ====aaa====
17547 ==b==
17548 ===ba===
17549 ===bb===
17550 ====bba====
17551 ===bc===
17552 ==c==
17553 ===ca===
17554 !! html/php
17555 start
17556 !! end
17557
17558 !! test
17559 Section extraction test (section 1)
17560 !! options
17561 section=1
17562 !! wikitext
17563 start
17564 ==a==
17565 ===aa===
17566 ====aaa====
17567 ==b==
17568 ===ba===
17569 ===bb===
17570 ====bba====
17571 ===bc===
17572 ==c==
17573 ===ca===
17574 !! html/php
17575 ==a==
17576 ===aa===
17577 ====aaa====
17578 !! end
17579
17580 !! test
17581 Section extraction test (section 2)
17582 !! options
17583 section=2
17584 !! wikitext
17585 start
17586 ==a==
17587 ===aa===
17588 ====aaa====
17589 ==b==
17590 ===ba===
17591 ===bb===
17592 ====bba====
17593 ===bc===
17594 ==c==
17595 ===ca===
17596 !! html/php
17597 ===aa===
17598 ====aaa====
17599 !! end
17600
17601 !! test
17602 Section extraction test (section 3)
17603 !! options
17604 section=3
17605 !! wikitext
17606 start
17607 ==a==
17608 ===aa===
17609 ====aaa====
17610 ==b==
17611 ===ba===
17612 ===bb===
17613 ====bba====
17614 ===bc===
17615 ==c==
17616 ===ca===
17617 !! html/php
17618 ====aaa====
17619 !! end
17620
17621 !! test
17622 Section extraction test (section 4)
17623 !! options
17624 section=4
17625 !! wikitext
17626 start
17627 ==a==
17628 ===aa===
17629 ====aaa====
17630 ==b==
17631 ===ba===
17632 ===bb===
17633 ====bba====
17634 ===bc===
17635 ==c==
17636 ===ca===
17637 !! html/php
17638 ==b==
17639 ===ba===
17640 ===bb===
17641 ====bba====
17642 ===bc===
17643 !! end
17644
17645 !! test
17646 Section extraction test (section 5)
17647 !! options
17648 section=5
17649 !! wikitext
17650 start
17651 ==a==
17652 ===aa===
17653 ====aaa====
17654 ==b==
17655 ===ba===
17656 ===bb===
17657 ====bba====
17658 ===bc===
17659 ==c==
17660 ===ca===
17661 !! html/php
17662 ===ba===
17663 !! end
17664
17665 !! test
17666 Section extraction test (section 6)
17667 !! options
17668 section=6
17669 !! wikitext
17670 start
17671 ==a==
17672 ===aa===
17673 ====aaa====
17674 ==b==
17675 ===ba===
17676 ===bb===
17677 ====bba====
17678 ===bc===
17679 ==c==
17680 ===ca===
17681 !! html/php
17682 ===bb===
17683 ====bba====
17684 !! end
17685
17686 !! test
17687 Section extraction test (section 7)
17688 !! options
17689 section=7
17690 !! wikitext
17691 start
17692 ==a==
17693 ===aa===
17694 ====aaa====
17695 ==b==
17696 ===ba===
17697 ===bb===
17698 ====bba====
17699 ===bc===
17700 ==c==
17701 ===ca===
17702 !! html/php
17703 ====bba====
17704 !! end
17705
17706 !! test
17707 Section extraction test (section 8)
17708 !! options
17709 section=8
17710 !! wikitext
17711 start
17712 ==a==
17713 ===aa===
17714 ====aaa====
17715 ==b==
17716 ===ba===
17717 ===bb===
17718 ====bba====
17719 ===bc===
17720 ==c==
17721 ===ca===
17722 !! html/php
17723 ===bc===
17724 !! end
17725
17726 !! test
17727 Section extraction test (section 9)
17728 !! options
17729 section=9
17730 !! wikitext
17731 start
17732 ==a==
17733 ===aa===
17734 ====aaa====
17735 ==b==
17736 ===ba===
17737 ===bb===
17738 ====bba====
17739 ===bc===
17740 ==c==
17741 ===ca===
17742 !! html/php
17743 ==c==
17744 ===ca===
17745 !! end
17746
17747 !! test
17748 Section extraction test (section 10)
17749 !! options
17750 section=10
17751 !! wikitext
17752 start
17753 ==a==
17754 ===aa===
17755 ====aaa====
17756 ==b==
17757 ===ba===
17758 ===bb===
17759 ====bba====
17760 ===bc===
17761 ==c==
17762 ===ca===
17763 !! html/php
17764 ===ca===
17765 !! end
17766
17767 !! test
17768 Section extraction test (nonexistent section 11)
17769 !! options
17770 section=11
17771 !! wikitext
17772 start
17773 ==a==
17774 ===aa===
17775 ====aaa====
17776 ==b==
17777 ===ba===
17778 ===bb===
17779 ====bba====
17780 ===bc===
17781 ==c==
17782 ===ca===
17783 !! html/php
17784 !! end
17785
17786 !! test
17787 Section extraction test with bogus heading (section 1)
17788 !! options
17789 section=1
17790 !! wikitext
17791 ==a==
17792 ==bogus== not a legal section
17793 ==b==
17794 !! html/php
17795 ==a==
17796 ==bogus== not a legal section
17797 !! end
17798
17799 !! test
17800 Section extraction test with bogus heading (section 2)
17801 !! options
17802 section=2
17803 !! wikitext
17804 ==a==
17805 ==bogus== not a legal section
17806 ==b==
17807 !! html/php
17808 ==b==
17809 !! end
17810
17811 !! test
17812 Section extraction test with comment after heading (section 1)
17813 !! options
17814 section=1
17815 !! wikitext
17816 ==a==
17817 ==b== <!-- -->
17818 ==c==
17819 !! html/php
17820 ==a==
17821 !! end
17822
17823 !! test
17824 Section extraction test with comment after heading (section 2)
17825 !! options
17826 section=2
17827 !! wikitext
17828 ==a==
17829 ==b== <!-- -->
17830 ==c==
17831 !! html/php
17832 ==b== <!-- -->
17833 !! end
17834
17835 !! test
17836 Section extraction test with bogus <nowiki> heading (section 1)
17837 !! options
17838 section=1
17839 !! wikitext
17840 ==a==
17841 ==bogus== <nowiki>not a legal section</nowiki>
17842 ==b==
17843 !! html/php
17844 ==a==
17845 ==bogus== <nowiki>not a legal section</nowiki>
17846 !! end
17847
17848 !! test
17849 Section extraction test with bogus <nowiki> heading (section 2)
17850 !! options
17851 section=2
17852 !! wikitext
17853 ==a==
17854 ==bogus== <nowiki>not a legal section</nowiki>
17855 ==b==
17856 !! html/php
17857 ==b==
17858 !! end
17859
17860 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17861 # instead of respecting commented sections
17862 !! test
17863 Section extraction prefixed by comment (section 1)
17864 !! options
17865 section=1
17866 !! wikitext
17867 <!-- -->==sec1==
17868 ==sec2==
17869 !! html/php
17870 ==sec2==
17871 !!end
17872
17873 !! test
17874 Section extraction prefixed by comment (section 2)
17875 !! options
17876 section=2
17877 !! wikitext
17878 <!-- -->==sec1==
17879 ==sec2==
17880 !! html/php
17881
17882 !!end
17883
17884 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17885 # instead of respecting HTML-style headings
17886 !! test
17887 Section extraction, mixed wiki and html (section 1)
17888 !! options
17889 section=1
17890 !! wikitext
17891 <h2>unmarked</h2>
17892 unmarked
17893 ==1==
17894 one
17895 ==2==
17896 two
17897 !! html/php
17898 ==1==
17899 one
17900 !! end
17901
17902 !! test
17903 Section extraction, mixed wiki and html (section 2)
17904 !! options
17905 section=2
17906 !! wikitext
17907 <h2>unmarked</h2>
17908 unmarked
17909 ==1==
17910 one
17911 ==2==
17912 two
17913 !! html/php
17914 ==2==
17915 two
17916 !! end
17917
17918
17919 # Formerly testing for bug 3342
17920 !! test
17921 Section extraction, heading surrounded by <noinclude>
17922 !! options
17923 section=1
17924 !! wikitext
17925 <noinclude>==unmarked==</noinclude>
17926 ==marked==
17927 !! html/php
17928 ==marked==
17929 !!end
17930
17931 # Test behavior of bug 19910
17932 !! test
17933 Sectiion with all-equals
17934 !! options
17935 section=2
17936 !! wikitext
17937 ===
17938 The line above must have a trailing space
17939 === <!--
17940 --> <!-- -->
17941 But just in case it doesn't...
17942 !! html/php
17943 === <!--
17944 --> <!-- -->
17945 But just in case it doesn't...
17946 !! end
17947
17948 !! test
17949 Section replacement test (section 0)
17950 !! options
17951 replace=0,"xxx"
17952 !! wikitext
17953 start
17954 ==a==
17955 ===aa===
17956 ====aaa====
17957 ==b==
17958 ===ba===
17959 ===bb===
17960 ====bba====
17961 ===bc===
17962 ==c==
17963 ===ca===
17964 !! html/php
17965 xxx
17966
17967 ==a==
17968 ===aa===
17969 ====aaa====
17970 ==b==
17971 ===ba===
17972 ===bb===
17973 ====bba====
17974 ===bc===
17975 ==c==
17976 ===ca===
17977 !! end
17978
17979 !! test
17980 Section replacement test (section 1)
17981 !! options
17982 replace=1,"xxx"
17983 !! wikitext
17984 start
17985 ==a==
17986 ===aa===
17987 ====aaa====
17988 ==b==
17989 ===ba===
17990 ===bb===
17991 ====bba====
17992 ===bc===
17993 ==c==
17994 ===ca===
17995 !! html/php
17996 start
17997 xxx
17998
17999 ==b==
18000 ===ba===
18001 ===bb===
18002 ====bba====
18003 ===bc===
18004 ==c==
18005 ===ca===
18006 !! end
18007
18008 !! test
18009 Section replacement test (section 2)
18010 !! options
18011 replace=2,"xxx"
18012 !! wikitext
18013 start
18014 ==a==
18015 ===aa===
18016 ====aaa====
18017 ==b==
18018 ===ba===
18019 ===bb===
18020 ====bba====
18021 ===bc===
18022 ==c==
18023 ===ca===
18024 !! html/php
18025 start
18026 ==a==
18027 xxx
18028
18029 ==b==
18030 ===ba===
18031 ===bb===
18032 ====bba====
18033 ===bc===
18034 ==c==
18035 ===ca===
18036 !! end
18037
18038 !! test
18039 Section replacement test (section 3)
18040 !! options
18041 replace=3,"xxx"
18042 !! wikitext
18043 start
18044 ==a==
18045 ===aa===
18046 ====aaa====
18047 ==b==
18048 ===ba===
18049 ===bb===
18050 ====bba====
18051 ===bc===
18052 ==c==
18053 ===ca===
18054 !! html/php
18055 start
18056 ==a==
18057 ===aa===
18058 xxx
18059
18060 ==b==
18061 ===ba===
18062 ===bb===
18063 ====bba====
18064 ===bc===
18065 ==c==
18066 ===ca===
18067 !! end
18068
18069 !! test
18070 Section replacement test (section 4)
18071 !! options
18072 replace=4,"xxx"
18073 !! wikitext
18074 start
18075 ==a==
18076 ===aa===
18077 ====aaa====
18078 ==b==
18079 ===ba===
18080 ===bb===
18081 ====bba====
18082 ===bc===
18083 ==c==
18084 ===ca===
18085 !! html/php
18086 start
18087 ==a==
18088 ===aa===
18089 ====aaa====
18090 xxx
18091
18092 ==c==
18093 ===ca===
18094 !! end
18095
18096 !! test
18097 Section replacement test (section 5)
18098 !! options
18099 replace=5,"xxx"
18100 !! wikitext
18101 start
18102 ==a==
18103 ===aa===
18104 ====aaa====
18105 ==b==
18106 ===ba===
18107 ===bb===
18108 ====bba====
18109 ===bc===
18110 ==c==
18111 ===ca===
18112 !! html/php
18113 start
18114 ==a==
18115 ===aa===
18116 ====aaa====
18117 ==b==
18118 xxx
18119
18120 ===bb===
18121 ====bba====
18122 ===bc===
18123 ==c==
18124 ===ca===
18125 !! end
18126
18127 !! test
18128 Section replacement test (section 6)
18129 !! options
18130 replace=6,"xxx"
18131 !! wikitext
18132 start
18133 ==a==
18134 ===aa===
18135 ====aaa====
18136 ==b==
18137 ===ba===
18138 ===bb===
18139 ====bba====
18140 ===bc===
18141 ==c==
18142 ===ca===
18143 !! html/php
18144 start
18145 ==a==
18146 ===aa===
18147 ====aaa====
18148 ==b==
18149 ===ba===
18150 xxx
18151
18152 ===bc===
18153 ==c==
18154 ===ca===
18155 !! end
18156
18157 !! test
18158 Section replacement test (section 7)
18159 !! options
18160 replace=7,"xxx"
18161 !! wikitext
18162 start
18163 ==a==
18164 ===aa===
18165 ====aaa====
18166 ==b==
18167 ===ba===
18168 ===bb===
18169 ====bba====
18170 ===bc===
18171 ==c==
18172 ===ca===
18173 !! html/php
18174 start
18175 ==a==
18176 ===aa===
18177 ====aaa====
18178 ==b==
18179 ===ba===
18180 ===bb===
18181 xxx
18182
18183 ===bc===
18184 ==c==
18185 ===ca===
18186 !! end
18187
18188 !! test
18189 Section replacement test (section 8)
18190 !! options
18191 replace=8,"xxx"
18192 !! wikitext
18193 start
18194 ==a==
18195 ===aa===
18196 ====aaa====
18197 ==b==
18198 ===ba===
18199 ===bb===
18200 ====bba====
18201 ===bc===
18202 ==c==
18203 ===ca===
18204 !! html/php
18205 start
18206 ==a==
18207 ===aa===
18208 ====aaa====
18209 ==b==
18210 ===ba===
18211 ===bb===
18212 ====bba====
18213 xxx
18214
18215 ==c==
18216 ===ca===
18217 !!end
18218
18219 !! test
18220 Section replacement test (section 9)
18221 !! options
18222 replace=9,"xxx"
18223 !! wikitext
18224 start
18225 ==a==
18226 ===aa===
18227 ====aaa====
18228 ==b==
18229 ===ba===
18230 ===bb===
18231 ====bba====
18232 ===bc===
18233 ==c==
18234 ===ca===
18235 !! html/php
18236 start
18237 ==a==
18238 ===aa===
18239 ====aaa====
18240 ==b==
18241 ===ba===
18242 ===bb===
18243 ====bba====
18244 ===bc===
18245 xxx
18246 !! end
18247
18248 !! test
18249 Section replacement test (section 10)
18250 !! options
18251 replace=10,"xxx"
18252 !! wikitext
18253 start
18254 ==a==
18255 ===aa===
18256 ====aaa====
18257 ==b==
18258 ===ba===
18259 ===bb===
18260 ====bba====
18261 ===bc===
18262 ==c==
18263 ===ca===
18264 !! html/php
18265 start
18266 ==a==
18267 ===aa===
18268 ====aaa====
18269 ==b==
18270 ===ba===
18271 ===bb===
18272 ====bba====
18273 ===bc===
18274 ==c==
18275 xxx
18276 !! end
18277
18278 !! test
18279 Section replacement test with initial whitespace (bug 13728)
18280 !! options
18281 replace=2,"xxx"
18282 !! wikitext
18283 Preformatted initial line
18284 ==a==
18285 ===a===
18286 !! html/php
18287 Preformatted initial line
18288 ==a==
18289 xxx
18290 !! end
18291
18292
18293 !! test
18294 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18295 !! options
18296 section=1
18297 !! wikitext
18298 ==a==
18299 a
18300 !! html/php
18301 ==a==
18302 a
18303 !! end
18304
18305 !! test
18306 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18307 !! options
18308 section=1
18309 !! wikitext
18310 ==a==
18311 a
18312 !! html/php
18313 ==a==
18314 a
18315 !! end
18316
18317
18318 !! test
18319 Section extraction, <pre> around bogus header (bug 10309)
18320 !! options
18321 section=2
18322 !! wikitext
18323 == Section One ==
18324 <pre>
18325 =======
18326 </pre>
18327
18328 == Section Two ==
18329 stuff
18330 !! html/php
18331 == Section Two ==
18332 stuff
18333 !! end
18334
18335 !! test
18336 Section replacement, <pre> around bogus header (bug 10309)
18337 !! options
18338 replace=2,"xxx"
18339 !! wikitext
18340 == Section One ==
18341 <pre>
18342 =======
18343 </pre>
18344
18345 == Section Two ==
18346 stuff
18347 !! html/php
18348 == Section One ==
18349 <pre>
18350 =======
18351 </pre>
18352
18353 xxx
18354 !! end
18355
18356
18357 !! test
18358 Handling of &#x0A; in URLs
18359 !! wikitext
18360 ** irc://&#x0A;a
18361 !! html/php
18362 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18363
18364 !! html/parsoid
18365 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18366 a">irc://
18367 a</a></li></ul></li></ul>
18368 !! end
18369
18370 !! test
18371 Handling of %0A in URLs
18372 !! wikitext
18373 ** irc://%0Aa
18374 !! html/php
18375 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18376
18377 !! html/parsoid
18378 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18379 !! end
18380
18381
18382 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18383 !! test
18384 5 quotes, code coverage +1 line
18385 !! options
18386 parsoid=wt2html
18387 !! wikitext
18388 '''''
18389 !! html/php
18390 !! html/parsoid
18391 <p><b><i></i></b></p>
18392 !! end
18393
18394 # same html as previous, but wikitext adjusted to match parsoid html2wt
18395 # note that wt2html and html2html will put the <i> before the <b>
18396 !! test
18397 5 quotes, code coverage +1 line w/ nowiki (1)
18398 !! options
18399 parsoid=wt2wt,html2wt
18400 !! wikitext
18401 '''''<nowiki/>'''''
18402 !! html/php
18403 <p><i></i>
18404 </p>
18405 !! html/parsoid
18406 <p><b><i></i></b></p>
18407 !! end
18408
18409 # same as previous, just swapping the <i> and <b>
18410 !! test
18411 5 quotes, code coverage +1 line w/ nowiki (2)
18412 !! wikitext
18413 '''''<nowiki/>'''''
18414 !! html/php
18415 <p><i></i>
18416 </p>
18417 !! html/parsoid
18418 <p><i><b></b></i></p>
18419 !! end
18420
18421 !! test
18422 Special:Search page linking.
18423 !! wikitext
18424 {{Special:search}}
18425 !! html
18426 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18427 </p>
18428 !! end
18429
18430 !! test
18431 {{!}} is a magic word
18432 !! wikitext
18433 {{!}} is a magic word there and {{!}} is still a magic word here
18434 | is not a magic word here but {{!}} is still a magic word here
18435 !! html/php
18436 <p>| is a magic word there and | is still a magic word here
18437 | is not a magic word here but | is still a magic word here
18438 </p>
18439 !! html/parsoid
18440 <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
18441 | 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>
18442
18443 !! end
18444
18445 !! test
18446 Say the magic word
18447 !! options
18448 title=[[Parser test]]
18449 !! wikitext
18450 * {{PAGENAME}}
18451 * {{PAGENAMEE}}
18452 * {{FULLPAGENAME}}
18453 * {{FULLPAGENAMEE}}
18454 * {{BASEPAGENAME}}
18455 * {{BASEPAGENAMEE}}
18456 * {{SUBPAGENAME}}
18457 * {{SUBPAGENAMEE}}
18458 * {{ROOTPAGENAME}}
18459 * {{ROOTPAGENAMEE}}
18460 * {{TALKPAGENAME}}
18461 * {{TALKPAGENAMEE}}
18462 * {{SUBJECTPAGENAME}}
18463 * {{SUBJECTPAGENAMEE}}
18464 * {{NAMESPACEE}}
18465 * {{NAMESPACE}}
18466 * {{NAMESPACENUMBER}}
18467 * {{TALKSPACE}}
18468 * {{TALKSPACEE}}
18469 * {{SUBJECTSPACE}}
18470 * {{SUBJECTSPACEE}}
18471 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18472 !! html
18473 <ul><li> Parser test</li>
18474 <li> Parser_test</li>
18475 <li> Parser test</li>
18476 <li> Parser_test</li>
18477 <li> Parser test</li>
18478 <li> Parser_test</li>
18479 <li> Parser test</li>
18480 <li> Parser_test</li>
18481 <li> Parser test</li>
18482 <li> Parser_test</li>
18483 <li> Talk:Parser test</li>
18484 <li> Talk:Parser_test</li>
18485 <li> Parser test</li>
18486 <li> Parser_test</li>
18487 <li> </li>
18488 <li> </li>
18489 <li> 0</li>
18490 <li> Talk</li>
18491 <li> Talk</li>
18492 <li> </li>
18493 <li> </li>
18494 <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>
18495
18496 !! end
18497 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18498
18499 !! test
18500 Gallery
18501 !! wikitext
18502 <gallery>
18503 image1.png |
18504 image2.gif|||||
18505
18506 image3|
18507 image4 |300px| centre
18508 image5.svg| http://///////
18509 [[x|xx]]]]
18510 * image6
18511 </gallery>
18512 !! html
18513 <ul class="gallery mw-gallery-traditional">
18514 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18515 <div class="thumb" style="height: 150px;">Image1.png</div>
18516 <div class="gallerytext">
18517 </div>
18518 </div></li>
18519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18520 <div class="thumb" style="height: 150px;">Image2.gif</div>
18521 <div class="gallerytext">
18522 </div>
18523 </div></li>
18524 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18525 <div class="thumb" style="height: 150px;">Image3</div>
18526 <div class="gallerytext">
18527 </div>
18528 </div></li>
18529 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18530 <div class="thumb" style="height: 150px;">Image4</div>
18531 <div class="gallerytext">
18532 <pre>centre
18533 </pre>
18534 </div>
18535 </div></li>
18536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18537 <div class="thumb" style="height: 150px;">Image5.svg</div>
18538 <div class="gallerytext">
18539 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18540 </p>
18541 </div>
18542 </div></li>
18543 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18544 <div class="thumb" style="height: 150px;">* image6</div>
18545 <div class="gallerytext">
18546 </div>
18547 </div></li>
18548 </ul>
18549
18550 !! end
18551
18552 !! test
18553 Gallery (with options)
18554 !! wikitext
18555 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18556 File:Nonexistent.jpg|caption
18557 File:Nonexistent.jpg
18558 image:foobar.jpg|some '''caption''' [[Main Page]]
18559 image:foobar.jpg
18560 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18561 </gallery>
18562 !! html
18563 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18564 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18565 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18566 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18567 <div class="gallerytext">
18568 <p>caption
18569 </p>
18570 </div>
18571 </div></li>
18572 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18573 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18574 <div class="gallerytext">
18575 </div>
18576 </div></li>
18577 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18578 <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>
18579 <div class="gallerytext">
18580 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18581 </p>
18582 </div>
18583 </div></li>
18584 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18585 <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>
18586 <div class="gallerytext">
18587 </div>
18588 </div></li>
18589 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18590 <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>
18591 <div class="gallerytext">
18592 <p>blabla.
18593 </p>
18594 </div>
18595 </div></li>
18596 </ul>
18597
18598 !! end
18599
18600 !! test
18601 Gallery with link that has fragment
18602 !! wikitext
18603 <gallery>
18604 image:foobar.jpg|link=Main_Page
18605 image:foobar.jpg|link=Main_Page#section
18606 image:foobar.jpg|link=Main Page#section|caption
18607 </gallery>
18608 !! html
18609 <ul class="gallery mw-gallery-traditional">
18610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18611 <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>
18612 <div class="gallerytext">
18613 </div>
18614 </div></li>
18615 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18616 <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>
18617 <div class="gallerytext">
18618 </div>
18619 </div></li>
18620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18621 <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>
18622 <div class="gallerytext">
18623 <p>caption
18624 </p>
18625 </div>
18626 </div></li>
18627 </ul>
18628
18629 !! end
18630
18631 !! test
18632 Gallery with wikitext inside caption
18633 !! wikitext
18634 <gallery>
18635 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18636 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18637 </gallery>
18638 !! html
18639 <ul class="gallery mw-gallery-traditional">
18640 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18641 <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>
18642 <div class="gallerytext">
18643 <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>
18644 </p>
18645 </div>
18646 </div></li>
18647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18648 <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>
18649 <div class="gallerytext">
18650 <p>This is a test template
18651 </p>
18652 </div>
18653 </div></li>
18654 </ul>
18655
18656 !! end
18657
18658 !! test
18659 gallery (with showfilename option)
18660 !! wikitext
18661 <gallery showfilename>
18662 File:Nonexistent.jpg|caption
18663 File:Nonexistent.jpg
18664 image:foobar.jpg|some '''caption''' [[Main Page]]
18665 File:Foobar.jpg
18666 </gallery>
18667 !! html
18668 <ul class="gallery mw-gallery-traditional">
18669 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18670 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18671 <div class="gallerytext">
18672 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18673 caption
18674 </p>
18675 </div>
18676 </div></li>
18677 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18678 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18679 <div class="gallerytext">
18680 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18681 </p>
18682 </div>
18683 </div></li>
18684 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18685 <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>
18686 <div class="gallerytext">
18687 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18688 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18689 </p>
18690 </div>
18691 </div></li>
18692 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18693 <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>
18694 <div class="gallerytext">
18695 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18696 </p>
18697 </div>
18698 </div></li>
18699 </ul>
18700
18701 !! end
18702
18703 !! test
18704 Gallery (with namespace-less filenames)
18705 !! wikitext
18706 <gallery>
18707 File:Nonexistent.jpg
18708 Nonexistent.jpg
18709 image:foobar.jpg
18710 foobar.jpg
18711 </gallery>
18712 !! html
18713 <ul class="gallery mw-gallery-traditional">
18714 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18715 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18716 <div class="gallerytext">
18717 </div>
18718 </div></li>
18719 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18720 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18721 <div class="gallerytext">
18722 </div>
18723 </div></li>
18724 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18725 <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>
18726 <div class="gallerytext">
18727 </div>
18728 </div></li>
18729 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18730 <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>
18731 <div class="gallerytext">
18732 </div>
18733 </div></li>
18734 </ul>
18735
18736 !! end
18737
18738 !! test
18739 HTML Hex character encoding (spells the word "JavaScript")
18740 !! options
18741 parsoid=wt2html,wt2wt,html2html
18742 !! wikitext
18743 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18744 !! html/php
18745 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18746 </p>
18747 !! html/php+tidy
18748 <p>JavaScript</p>
18749 !! html/parsoid
18750 <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>
18751 !! end
18752
18753 !! test
18754 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18755 !! wikitext
18756 &#xsee;&#XSEE;
18757 !! html/php
18758 <p>&amp;#xsee;&amp;#XSEE;
18759 </p>
18760 !! html/parsoid
18761 <p>&amp;#xsee;&amp;#XSEE;</p>
18762 !! end
18763
18764 !! test
18765 HTML Hex character encoding mixed case
18766 !! options
18767 parsoid=wt2html,wt2wt,html2html
18768 !! wikitext
18769 &#xEE;&#Xee;
18770 !! html/php
18771 <p>&#xee;&#xee;
18772 </p>
18773 !! html/php+tidy
18774 <p>îî</p>
18775 !! html/parsoid
18776 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18777 !! end
18778
18779 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18780 # Note that U+000C (form feed) is not a valid XML character, so
18781 # it is banned even though allowed in HTML5.
18782 !! test
18783 Illegal character references (T106578)
18784 !! wikitext
18785 ; Null: &#00;
18786 ; FF: &#xC;
18787 ; CR: &#xD;
18788 ; Control (low): &#8;
18789 ; Control (high): &#x7F; &#x9F;
18790 ; Surrogate: &#xD83D;&#xDCA9;
18791 ; This is an okay astral character: &#x1F4A9;
18792 !! html+tidy
18793 <dl>
18794 <dt>Null</dt>
18795 <dd>&amp;#00;</dd>
18796 <dt>FF</dt>
18797 <dd>&amp;#xC;</dd>
18798 <dt>CR</dt>
18799 <dd>&amp;#xD;</dd>
18800 <dt>Control (low)</dt>
18801 <dd>&amp;#8;</dd>
18802 <dt>Control (high)</dt>
18803 <dd>&amp;#x7F; &amp;#x9F;</dd>
18804 <dt>Surrogate</dt>
18805 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18806 <dt>This is an okay astral character</dt>
18807 <dd>💩</dd>
18808 </dl>
18809 !! end
18810
18811 !! test
18812 __FORCETOC__ override
18813 !! wikitext
18814 __NEWSECTIONLINK__
18815 __FORCETOC__
18816 !! html/php
18817 <p><br />
18818 </p>
18819 !! end
18820
18821 !! test
18822 ISBN code coverage
18823 !! wikitext
18824 ISBN 978-0-1234-56&#x20;789
18825 !! html
18826 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18827 </p>
18828 !! html+tidy
18829 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18830 !! html/parsoid
18831 <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>
18832 !! end
18833
18834 !! test
18835 ISBN followed by 5 spaces
18836 !! wikitext
18837 ISBN
18838 !! html
18839 <p>ISBN
18840 </p>
18841 !! end
18842
18843 !! test
18844 Double ISBN
18845 !! wikitext
18846 ISBN ISBN 1234567890
18847 !! html/php
18848 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18849 </p>
18850 !! html/parsoid
18851 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18852 !! end
18853
18854 # Uppercase X and lowercase x as well
18855 !! test
18856 ISBN with an X
18857 !! wikitext
18858 ISBN 3-462-04561-X
18859 ISBN 3-462-04561-x
18860 ISBN 080442957X
18861 ISBN 080442957x
18862 ISBN 978080442957X
18863 ISBN 978080442957x
18864 !! html/php
18865 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18866 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18867 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18868 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18869 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18870 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18871 </p>
18872 !! html/parsoid
18873 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18874 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18875 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18876 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18877 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18878 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18879 !! end
18880
18881 !! test
18882 ISBN with empty prefix (parsoid test)
18883 !! wikitext
18884 ISBN 1234567890
18885 !! html/php
18886 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18887 </p>
18888 !! html/parsoid
18889 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18890 !! end
18891
18892 !! test
18893 Bug 22905: <abbr> followed by ISBN followed by </a>
18894 !! wikitext
18895 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18896 !! html/php
18897 <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>
18898 </p>
18899 !! html/parsoid
18900 <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>
18901 !! end
18902
18903 !! test
18904 Double RFC
18905 !! wikitext
18906 RFC RFC 1234
18907 !! html
18908 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18909 </p>
18910 !! end
18911
18912 !! test
18913 Double RFC with a wiki link
18914 !! wikitext
18915 RFC [[RFC 1234]]
18916 !! html
18917 <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>
18918 </p>
18919 !! end
18920
18921 !! test
18922 RFC code coverage
18923 !! wikitext
18924 RFC 983&#x20;987
18925 !! html
18926 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18927 </p>
18928 !! html+tidy
18929 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18930 !! end
18931
18932 !! test
18933 Centre-aligned image
18934 !! wikitext
18935 [[Image:foobar.jpg|centre]]
18936 !! html
18937 <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>
18938
18939 !!end
18940
18941 !! test
18942 None-aligned image
18943 !! wikitext
18944 [[Image:foobar.jpg|none]]
18945 !! html
18946 <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>
18947
18948 !!end
18949
18950 !! test
18951 Width + Height sized image (using px) (height is ignored)
18952 !! wikitext
18953 [[Image:foobar.jpg|640x480px]]
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, no following whitespace)
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 following 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 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18979 !! wikitext
18980 [[Image:foobar.jpg| 640px]]
18981 !! html
18982 <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>
18983 </p>
18984 !!end
18985
18986 !! test
18987 Image with page parameter
18988 !! options
18989 djvu
18990 !! wikitext
18991 [[File:LoremIpsum.djvu|page=2]]
18992 !! html/php
18993 <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>
18994 </p>
18995 !! html/parsoid
18996 <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>
18997 !! end
18998
18999 !! test
19000 Another italics / bold test
19001 !! wikitext
19002 ''' ''x'
19003 !! html
19004 <pre>'<i> </i>x'
19005 </pre>
19006 !!end
19007
19008 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19009 !! test
19010 dt/dd/dl test
19011 !! wikitext
19012 :;;;::
19013 !! html/php
19014 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19015
19016 !! html/parsoid
19017 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19018
19019 !!end
19020
19021
19022 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19023 !! test
19024 Images with the "|" character in the comment
19025 !! wikitext
19026 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19027 !! html/php
19028 <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>
19029
19030 !! html/parsoid
19031 <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>
19032 !! end
19033
19034 !! test
19035 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19036 !! wikitext
19037 <html><script>alert(1);</script></html>
19038 !! html
19039 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19040 </p>
19041 !! end
19042
19043 !! test
19044 HTML with raw HTML ($wgRawHtml==true)
19045 !! options
19046 wgRawHtml=1
19047 !! wikitext
19048 <html><script>alert(1);</script></html>
19049 !! html
19050 <p><script>alert(1);</script>
19051 </p>
19052 !! end
19053
19054 !! test
19055 Parents of subpages, one level up
19056 !! options
19057 subpage title=[[Subpage test/L1/L2/L3]]
19058 !! wikitext
19059 [[../|L2]]
19060 !! html
19061 <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>
19062 </p>
19063 !! end
19064
19065
19066 !! test
19067 Parents of subpages, one level up, not named
19068 !! options
19069 subpage title=[[Subpage test/L1/L2/L3]]
19070 !! wikitext
19071 [[../]]
19072 !! html
19073 <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>
19074 </p>
19075 !! end
19076
19077
19078
19079 !! test
19080 Parents of subpages, two levels up
19081 !! options
19082 subpage title=[[Subpage test/L1/L2/L3]]
19083 !! wikitext
19084 [[../../|L1]]2
19085
19086 [[../../|L1]]l
19087 !! html
19088 <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
19089 </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>
19090 </p>
19091 !! end
19092
19093 !! test
19094 Parents of subpages, two levels up, without trailing slash or name.
19095 !! options
19096 subpage title=[[Subpage test/L1/L2/L3]]
19097 !! wikitext
19098 [[../..]]
19099 !! html
19100 <p>[[../..]]
19101 </p>
19102 !! end
19103
19104 !! test
19105 Parents of subpages, two levels up, with lots of extra trailing slashes.
19106 !! options
19107 subpage title=[[Subpage test/L1/L2/L3]]
19108 !! wikitext
19109 [[../../////]]
19110 !! html
19111 <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>
19112 </p>
19113 !! end
19114
19115 !! article
19116 Subpage test/L1/L2/L3Sibling
19117 !! text
19118 Sibling article
19119 !! endarticle
19120
19121 !! test
19122 Transclusion of a sibling page (one level up)
19123 !! options
19124 subpage title=[[Subpage test/L1/L2/L3]]
19125 !! wikitext
19126 {{../L3Sibling}}
19127 !! html
19128 <p>Sibling article
19129 </p>
19130 !! end
19131
19132 !! test
19133 Transclusion of a child page
19134 !! options
19135 subpage title=[[Subpage test/L1/L2]]
19136 !! wikitext
19137 {{/L3Sibling}}
19138 !! html
19139 <p>Sibling article
19140 </p>
19141 !! end
19142
19143 !! test
19144 Non-transclusion because of too many up levels
19145 !! options
19146 subpage title=[[Subpage test/L1/L2/L3]]
19147 !! wikitext
19148 {{../../../../More than parent}}
19149 !! html
19150 <p>{{../../../../More than parent}}
19151 </p>
19152 !! end
19153
19154 !! test
19155 Definition list code coverage
19156 !! wikitext
19157 ; title : def
19158 ; title : def
19159 ;title: def
19160 !! html/php
19161 <dl><dt> title &#160;</dt>
19162 <dd> def</dd>
19163 <dt> title&#160;</dt>
19164 <dd> def</dd>
19165 <dt>title</dt>
19166 <dd> def</dd></dl>
19167
19168 !! html/parsoid
19169 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19170 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19171 <dt>title</dt><dd> def</dd></dl>
19172 !! end
19173
19174 !! test
19175 Don't fall for the self-closing div
19176 !! wikitext
19177 <div>hello world</div/>
19178 !! html
19179 <div>hello world</div>
19180
19181 !! end
19182
19183 !! test
19184 MSGNW magic word
19185 !! wikitext
19186 {{MSGNW:msg}}
19187 !! html/php
19188 <p>&#91;&#91;:Template:Msg&#93;&#93;
19189 </p>
19190 !! end
19191
19192 !! test
19193 RAW magic word
19194 !! wikitext
19195 {{RAW:QUERTY}}
19196 !! html
19197 <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>
19198 </p>
19199 !! end
19200
19201 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19202 !! test
19203 Always escape literal '>' in output, not just after '<'
19204 !! wikitext
19205 ><>
19206 !! html
19207 <p>&gt;&lt;&gt;
19208 </p>
19209 !! end
19210
19211 !! test
19212 Template caching
19213 !! wikitext
19214 {{Test}}
19215 {{Test}}
19216 !! html
19217 <p>This is a test template
19218 This is a test template
19219 </p>
19220 !! end
19221
19222
19223 !! article
19224 MediaWiki:Fake
19225 !! text
19226 ==header==
19227 !! endarticle
19228
19229 !! test
19230 Inclusion of !userCanEdit() content
19231 !! wikitext
19232 {{MediaWiki:Fake}}
19233 !! html
19234 <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>
19235
19236 !! end
19237
19238
19239 !! test
19240 Out-of-order TOC heading levels
19241 !! wikitext
19242 ==2==
19243 ======6======
19244 ===3===
19245 =1=
19246 =====5=====
19247 ==2==
19248 !! html
19249 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19250 <ul>
19251 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19252 <ul>
19253 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19254 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19255 </ul>
19256 </li>
19257 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19258 <ul>
19259 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19260 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19261 </ul>
19262 </li>
19263 </ul>
19264 </div>
19265
19266 <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>
19267 <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>
19268 <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>
19269 <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>
19270 <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>
19271 <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>
19272
19273 !! end
19274
19275
19276 !! test
19277 ISBN with a dummy number
19278 !! wikitext
19279 ISBN ---
19280 !! html
19281 <p>ISBN ---
19282 </p>
19283 !! end
19284
19285
19286 !! test
19287 ISBN with space-delimited number
19288 !! wikitext
19289 ISBN 92 9017 032 8
19290 !! html
19291 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19292 </p>
19293 !! end
19294
19295
19296 !! test
19297 ISBN with multiple spaces, no number
19298 !! wikitext
19299 ISBN foo
19300 !! html
19301 <p>ISBN foo
19302 </p>
19303 !! end
19304
19305
19306 !! test
19307 ISBN length
19308 !! wikitext
19309 ISBN 123456789
19310
19311 ISBN 1234567890
19312
19313 ISBN 12345678901
19314 !! html
19315 <p>ISBN 123456789
19316 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19317 </p><p>ISBN 12345678901
19318 </p>
19319 !! end
19320
19321
19322 !! test
19323 ISBN with trailing year (bug 8110)
19324 !! wikitext
19325 ISBN 1-234-56789-0 - 2006
19326
19327 ISBN 1 234 56789 0 - 2006
19328 !! html
19329 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19330 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19331 </p>
19332 !! end
19333
19334
19335 !! test
19336 anchorencode
19337 !! wikitext
19338 {{anchorencode:foo bar©#%n}}
19339 !! html
19340 <p>foo_bar.C2.A9.23.25n
19341 </p>
19342 !! end
19343
19344 !! test
19345 anchorencode trims spaces
19346 !! wikitext
19347 {{anchorencode: __pretty__please__}}
19348 !! html
19349 <p>pretty_please
19350 </p>
19351 !! end
19352
19353 !! test
19354 anchorencode deals with links
19355 !! wikitext
19356 {{anchorencode: [[hello|world]] [[hi]]}}
19357 !! html
19358 <p>world_hi
19359 </p>
19360 !! end
19361
19362 !! test
19363 anchorencode deals with templates
19364 !! wikitext
19365 {{anchorencode: {{Foo}} }}
19366 !! html
19367 <p>FOO
19368 </p>
19369 !! end
19370
19371 !! test
19372 anchorencode encodes like the TOC generator: (bug 18431)
19373 !! wikitext
19374 === _ +:.3A%3A&&amp;]] ===
19375 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19376 __NOEDITSECTION__
19377 !! html
19378 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19379 <p>.2B:.3A.253A.26.26.5D.5D
19380 </p>
19381 !! end
19382
19383 !! test
19384 Bug 6200: blockquotes and paragraph formatting
19385 !! wikitext
19386 <blockquote>
19387 foo
19388 </blockquote>
19389
19390 bar
19391
19392 baz
19393 !! html
19394 <blockquote>
19395 <p>foo
19396 </p>
19397 </blockquote>
19398 <p>bar
19399 </p>
19400 <pre>baz
19401 </pre>
19402 !! end
19403
19404 !! test
19405 Bug 8293: Use of center tag ruins paragraph formatting
19406 !! wikitext
19407 <center>
19408 foo
19409 </center>
19410
19411 bar
19412
19413 baz
19414 !! html
19415 <center>
19416 <p>foo
19417 </p>
19418 </center>
19419 <p>bar
19420 </p>
19421 <pre>baz
19422 </pre>
19423 !! end
19424
19425 !!test
19426 Parsing of overlapping (improperly nested) inline html tags
19427 !! wikitext
19428 <span><s>x</span></s>
19429 !! html/php
19430 <p><span><s>x&lt;/span&gt;</s></span>
19431 </p>
19432 !! html/parsoid
19433 <p><span><s>x</s></span>
19434 </p>
19435 !!end
19436
19437 ###
19438 ### Language variants related tests
19439 ###
19440 !! test
19441 Self-link in language variants
19442 !! options
19443 title=[[Dunav]] language=sr
19444 !! wikitext
19445 Both [[Dunav]] and [[Дунав]] are names for this river.
19446 !! html
19447 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19448 </p>
19449 !!end
19450
19451 !! article
19452 Дуна
19453 !! text
19454 content
19455 !! endarticle
19456
19457 !! test
19458 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19459 !! options
19460 title=[[Duna]] language=sr
19461 !! wikitext
19462 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19463 !! html
19464 <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.
19465 </p>
19466 !! end
19467
19468 !! test
19469 Link to a section of a variant of this title shouldn't be parsed as self-link
19470 !! options
19471 title=[[Duna]] language=sr
19472 !! wikitext
19473 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19474 !! html
19475 <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.
19476 </p>
19477 !! end
19478
19479 !! test
19480 Link to pages in language variants
19481 !! options
19482 language=sr
19483 !! wikitext
19484 Main Page can be written as [[Маин Паге]]
19485 !! html
19486 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19487 </p>
19488 !!end
19489
19490
19491 !! test
19492 Multiple links to pages in language variants
19493 !! options
19494 language=sr
19495 !! wikitext
19496 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19497 !! html
19498 <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>.
19499 </p>
19500 !!end
19501
19502
19503 !! test
19504 Simple template in language variants
19505 !! options
19506 language=sr
19507 !! wikitext
19508 {{тест}}
19509 !! html
19510 <p>This is a test template
19511 </p>
19512 !! end
19513
19514
19515 !! test
19516 Template with explicit namespace in language variants
19517 !! options
19518 language=sr
19519 !! wikitext
19520 {{Template:тест}}
19521 !! html
19522 <p>This is a test template
19523 </p>
19524 !! end
19525
19526
19527 !! test
19528 Basic test for template parameter in language variants
19529 !! options
19530 language=sr
19531 !! wikitext
19532 {{парамтест|param=foo}}
19533 !! html
19534 <p>This is a test template with parameter foo
19535 </p>
19536 !! end
19537
19538
19539 !! test
19540 Simple category in language variants
19541 !! options
19542 language=sr cat
19543 !! wikitext
19544 [[Category:МедиаWики Усер'с Гуиде]]
19545 !! html
19546 <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>
19547 !! end
19548
19549
19550 !! article
19551 Category:分类
19552 !! text
19553 blah
19554 !! endarticle
19555
19556 !! article
19557 Category:分類
19558 !! text
19559 blah
19560 !! endarticle
19561
19562 ## We used to, but no longer wt2wt this test since the default serializer
19563 ## will normalize all categories to serialize on their own line.
19564 ## This wikitext usage is going to be fairly uncommon in production and
19565 ## selser will take care of preserving formatting in those scenarios.
19566 !! test
19567 Don't convert blue categorylinks to another variant (bug 33210)
19568 !! options
19569 cat
19570 language=zh
19571 parsoid=wt2html
19572 !! wikitext
19573 [[A]][[Category:分类]]
19574 !! html/php
19575 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19576 !! html/parsoid
19577 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19578 <link rel="mw:PageProp/Category" href="Category:分类"/>
19579 !! end
19580
19581 !! test
19582 Stripping -{}- tags (language variants)
19583 !! options
19584 language=sr
19585 !! wikitext
19586 Latin proverb: -{Ne nuntium necare}-
19587 !! html
19588 <p>Latin proverb: Ne nuntium necare
19589 </p>
19590 !! end
19591
19592
19593 !! test
19594 Prevent conversion with -{}- tags (language variants)
19595 !! options
19596 language=sr variant=sr-ec
19597 !! wikitext
19598 Latinski: -{Ne nuntium necare}-
19599 !! html
19600 <p>Латински: Ne nuntium necare
19601 </p>
19602 !! end
19603
19604
19605 !! test
19606 Prevent conversion of text with -{}- tags (language variants)
19607 !! options
19608 language=sr variant=sr-ec
19609 !! wikitext
19610 Latinski: -{Ne nuntium necare}-
19611 !! html
19612 <p>Латински: Ne nuntium necare
19613 </p>
19614 !! end
19615
19616
19617 !! test
19618 Prevent conversion of links with -{}- tags (language variants)
19619 !! options
19620 language=sr variant=sr-ec
19621 !! wikitext
19622 -{[[Main Page]]}-
19623 !! html
19624 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19625 </p>
19626 !! end
19627
19628
19629 !! test
19630 -{}- tags within headlines (within html for parserConvert())
19631 !! options
19632 language=sr variant=sr-ec
19633 !! wikitext
19634 == -{Naslov}- ==
19635 !! html
19636 <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>
19637
19638 !! end
19639
19640
19641 !! test
19642 Explicit definition of language variant alternatives
19643 !! options
19644 language=zh variant=zh-tw
19645 !! wikitext
19646 -{zh:China;zh-tw:Taiwan}-, not China
19647 !! html
19648 <p>Taiwan, not China
19649 </p>
19650 !! end
19651
19652
19653 !! test
19654 Conversion around HTML tags
19655 !! options
19656 language=sr variant=sr-ec
19657 !! wikitext
19658 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19659 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19660 !! html
19661 <p>
19662 <span title="ЛаCтин">ски</span>
19663 </p>
19664 !! end
19665
19666
19667 !! test
19668 Explicit session-wise language variant mapping (A flag and - flag)
19669 !! options
19670 language=zh variant=zh-tw
19671 !! wikitext
19672 Taiwan is not China.
19673 But -{A|zh:China;zh-tw:Taiwan}- is China,
19674 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19675 and -{China}- is China.
19676 !! html
19677 <p>Taiwan is not China.
19678 But Taiwan is Taiwan,
19679 (This should be stripped!)
19680 and China is China.
19681 </p>
19682 !! end
19683
19684 !! test
19685 Explicit session-wise language variant mapping (H flag for hide)
19686 !! options
19687 language=zh variant=zh-tw
19688 !! wikitext
19689 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19690 Taiwan is China.
19691 !! html
19692 <p>(This should be stripped!)
19693 Taiwan is Taiwan.
19694 </p>
19695 !! end
19696
19697 !! test
19698 Adding explicit conversion rule for title (T flag)
19699 !! options
19700 language=zh variant=zh-tw showtitle
19701 !! wikitext
19702 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19703 !! html
19704 Taiwan
19705 <p>Should be stripped!
19706 </p>
19707 !! end
19708
19709 !! test
19710 Testing that changing the language variant here in the tests actually works
19711 !! options
19712 language=zh variant=zh showtitle
19713 !! wikitext
19714 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19715 !! html
19716 China
19717 <p>Should be stripped!
19718 </p>
19719 !! end
19720
19721 !! test
19722 Recursive conversion of alt and title attrs shouldn't clear converter state
19723 !! options
19724 language=zh variant=zh-cn showtitle
19725 !! wikitext
19726 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19727 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19728 !! html
19729 China
19730 <p>
19731 Should be stripped<span title="Exclamation">!</span>
19732 </p>
19733 !! end
19734
19735 !! test
19736 Bug 24072: more test on conversion rule for title
19737 !! options
19738 language=zh variant=zh-tw showtitle
19739 !! wikitext
19740 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19741 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19742 !! html
19743 Taiwan
19744 <p>This should be stripped!
19745 This won't take interferes with the title rule.
19746 </p>
19747 !! end
19748
19749 !! test
19750 Partly disable title conversion if variant == main language code
19751 !! options
19752 language=zh variant=zh title=[[ZH]] showtitle
19753 !! wikitext
19754 -{T|zh-cn:CN;zh-tw:TW}-
19755 !! html
19756 ZH
19757 <p>
19758 </p>
19759 !! end
19760
19761 !! test
19762 Partly disable title conversion if variant == main language code, more
19763 !! options
19764 language=zh variant=zh title=[[ZH]] showtitle
19765 !! wikitext
19766 -{T|TW}-
19767 !! html
19768 ZH
19769 <p>
19770 </p>
19771 !! end
19772
19773 !! test
19774 Raw output of variant escape tags (R flag)
19775 !! options
19776 language=zh variant=zh-tw
19777 !! wikitext
19778 Raw: -{R|zh:China;zh-tw:Taiwan}-
19779 !! html
19780 <p>Raw: zh:China;zh-tw:Taiwan
19781 </p>
19782 !! end
19783
19784 !! test
19785 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19786 !! options
19787 language=zh variant=zh-cn
19788 !! input
19789 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19790 !! result
19791 <p>0
19792 </p>
19793 !! end
19794
19795 !! test
19796 Conversion rules from [numeric-only string] to [something else] (T48634)
19797 !! options
19798 language=zh variant=zh-cn
19799 !! input
19800 -{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
19801 !! result
19802 <p>D12345EE12345
19803 </p>
19804 !! end
19805
19806 !! test
19807 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19808 !! options
19809 language=zh variant=zh-cn
19810 !! input
19811 -{H|zh-cn:foo;zh-tw:;}-foobar
19812 !! result
19813 <p>foobar
19814 </p>
19815 !! end
19816
19817 !! test
19818 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19819 !! options
19820 language=zh variant=zh-cn
19821 !! input
19822 -{H|=>zh-cn:foo;}-foobar
19823 !! result
19824 <p>foobar
19825 </p>
19826 !! end
19827
19828 !! test
19829 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19830 !! options
19831 language=zh variant=zh-cn
19832 !! input
19833 -{H|}-foobar
19834 !! result
19835 <p>foobar
19836 </p>
19837 !! end
19838
19839 !! test
19840 Nested using of manual convert syntax
19841 !! options
19842 language=zh variant=zh-hk
19843 !! wikitext
19844 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19845 !! html
19846 <p>Nested: Hello Hong Kong!
19847 </p>
19848 !! end
19849
19850 !! test
19851 Proper conversion of text in external links
19852 !! options
19853 language=sr variant=sr-ec
19854 !! wikitext
19855 http://www.google.com
19856 gopher://www.google.com
19857 [http://www.google.com http://www.google.com]
19858 [gopher://www.google.com gopher://www.google.com]
19859 [https://www.google.com irc://www.google.com]
19860 [ftp://www.google.com www.google.com/ftp://dir]
19861 [//www.google.com www.google.com]
19862 !! html
19863 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19864 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19865 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19866 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19867 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19868 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19869 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19870 </p>
19871 !! end
19872
19873 !! test
19874 Do not convert roman numbers to language variants
19875 !! options
19876 language=sr variant=sr-ec
19877 !! wikitext
19878 Fridrih IV je car.
19879 !! html
19880 <p>Фридрих IV је цар.
19881 </p>
19882 !! end
19883
19884 !! test
19885 Unclosed language converter markup "-{"
19886 !! options
19887 language=sr
19888 !! wikitext
19889 -{T|hello
19890 !! html
19891 <p>-{T|hello
19892 </p>
19893 !! end
19894
19895 !! test
19896 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19897 !! options
19898 language=sr
19899 !! wikitext
19900 -{R|=&gt;}-
19901 !! html
19902 <p>=&gt;
19903 </p>
19904 !!end
19905
19906 !! test
19907 Don't break link parsing if language converter markup is in the caption.
19908 !! options
19909 language=sr variant=sr-ec
19910 !! wikitext
19911 [[Main Page|-{R|main page}-]]
19912 !! html
19913 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19914 </p>
19915 !! end
19916
19917 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19918 !! test
19919 Don't break image parsing if language converter markup is in the caption.
19920 !! options
19921 language=sr
19922 !! wikitext
19923 [[File:Foobar.jpg|-{R|caption}-]]
19924 !! html/parsoid
19925 <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>
19926 </p>
19927 !! end
19928
19929 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19930 !! test
19931 Don't break list handling if language converter markup is in the item.
19932 !! options
19933 language=zh variant=zh-cn
19934 !! wikitext
19935 ;-{zh-cn:AAA;zh-tw:BBB}-
19936 !! html/php
19937 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19938
19939 !! html/parsoid
19940 <dl><dt>AAA
19941 </dt></dl>
19942 !! end
19943
19944 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19945 !! test
19946 Don't break table handling if language converter markup is in the cell.
19947 !! options
19948 language=sr variant=sr-ec
19949 !! wikitext
19950 {|
19951 |-
19952 | -{R|B}-
19953 |}
19954 !! html/php
19955 <table>
19956
19957 <tr>
19958 <td>Б}-
19959 </td></tr></table>
19960
19961 !! html/parsoid
19962 <table>
19963
19964 <tr>
19965 <td> B
19966 </td></tr></table>
19967
19968 !! end
19969
19970 !! test
19971 Bug 529: Uncovered bullet
19972 !! wikitext
19973 * Foo {{bullet}}
19974 !! html
19975 <ul><li> Foo </li>
19976 <li> Bar</li></ul>
19977
19978 !! end
19979
19980 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19981 # Templates in Wikipedia rely on this behavior, as tidy has always been
19982 # enabled there. These tests are normally run *without* tidy, so specify the
19983 # full output here.
19984 # To test realistic parsing behavior, apply a tidy-like transformation to both
19985 # the expected output and your parser's output.
19986 !! test
19987 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19988 !! wikitext
19989 ******* Foo {{bullet}}
19990 !! html
19991 <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>
19992 <li> Bar</li></ul>
19993
19994 !! end
19995
19996 !! test
19997 Bug 529: Uncovered table already at line-start
19998 !! wikitext
19999 x
20000
20001 {{table}}
20002 y
20003 !! html
20004 <p>x
20005 </p>
20006 <table>
20007 <tr>
20008 <td> 1 </td>
20009 <td> 2
20010 </td></tr>
20011 <tr>
20012 <td> 3 </td>
20013 <td> 4
20014 </td></tr></table>
20015 <p>y
20016 </p>
20017 !! end
20018
20019 !! test
20020 Bug 529: Uncovered bullet in parser function result
20021 !! wikitext
20022 * Foo {{lc:{{bullet}} }}
20023 !! html
20024 <ul><li> Foo </li>
20025 <li> bar</li></ul>
20026
20027 !! end
20028
20029 !! test
20030 Bug 5678: Double-parsed template argument
20031 !! wikitext
20032 {{lc:{{{1}}}|hello}}
20033 !! html
20034 <p>{{{1}}}
20035 </p>
20036 !! end
20037
20038 !! test
20039 Bug 5678: Double-parsed template invocation
20040 !! wikitext
20041 {{lc:{{paramtest {{!}} param = hello }} }}
20042 !! html
20043 <p>{{paramtest | param = hello }}
20044 </p>
20045 !! end
20046
20047 !! test
20048 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20049 !! options
20050 language=cs
20051 title=[[Main Page]]
20052 !! wikitext
20053 {{PRVNÍVELKÉ:ěščř}}
20054 {{prvnívelké:ěščř}}
20055 {{PRVNÍMALÉ:ěščř}}
20056 {{prvnímalé:ěščř}}
20057 {{MALÁ:ěščř}}
20058 {{malá:ěščř}}
20059 {{VELKÁ:ěščř}}
20060 {{velká:ěščř}}
20061 !! html
20062 <p>Ěščř
20063 Ěščř
20064 ěščř
20065 ěščř
20066 ěščř
20067 ěščř
20068 ĚŠČŘ
20069 ĚŠČŘ
20070 </p>
20071 !! end
20072
20073 !! test
20074 Morwen/13: Unclosed link followed by heading
20075 !! wikitext
20076 [[link
20077 ==heading==
20078 !! html
20079 <p>[[link
20080 </p>
20081 <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>
20082
20083 !! end
20084
20085 !! test
20086 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20087 !! wikitext
20088 {{foo|
20089 =heading=
20090 !! html
20091 <p>{{foo|
20092 </p>
20093 <h1><span class="mw-headline" id="heading">heading</span></h1>
20094
20095 !! end
20096
20097 !! test
20098 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20099 !! wikitext
20100 {{foo|
20101 ==heading==
20102 !! html
20103 <p>{{foo|
20104 </p>
20105 <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>
20106
20107 !! end
20108
20109 !! test
20110 Tildes in comments
20111 !! options
20112 pst
20113 !! wikitext
20114 <!-- ~~~~ -->
20115 !! html/php
20116 <!-- ~~~~ -->
20117 !! end
20118
20119 !! test
20120 Paragraphs inside divs (no extra line breaks)
20121 !! wikitext
20122 <div>Line one
20123
20124 Line two</div>
20125 !! html
20126 <div>Line one
20127 Line two</div>
20128
20129 !! end
20130
20131 !! test
20132 Paragraphs inside divs (extra line break on open)
20133 !! wikitext
20134 <div>
20135 Line one
20136
20137 Line two</div>
20138 !! html
20139 <div>
20140 <p>Line one
20141 </p>
20142 Line two</div>
20143
20144 !! end
20145
20146 !! test
20147 Paragraphs inside divs (extra line break on close)
20148 !! wikitext
20149 <div>Line one
20150
20151 Line two
20152 </div>
20153 !! html
20154 <div>Line one
20155 <p>Line two
20156 </p>
20157 </div>
20158
20159 !! end
20160
20161 !! test
20162 Paragraphs inside divs (extra line break on open and close)
20163 !! wikitext
20164 <div>
20165 Line one
20166
20167 Line two
20168 </div>
20169 !! html
20170 <div>
20171 <p>Line one
20172 </p><p>Line two
20173 </p>
20174 </div>
20175
20176 !! end
20177
20178 !! test
20179 Nesting tags, paragraphs on lines which begin with <div>
20180 !! wikitext
20181 <div></div><strong>A
20182 B</strong>
20183 !! html/php+tidy
20184 <p><strong>A</strong></p>
20185 <p><strong>B</strong></p>
20186 !! html/parsoid
20187 <div></div>
20188 <p><strong>A
20189 B</strong>
20190 </p>
20191 !! end
20192
20193 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20194 !! test
20195 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20196 !! wikitext
20197 <blockquote>Line one
20198
20199 Line two</blockquote>
20200 !! html
20201 <blockquote>Line one
20202 Line two</blockquote>
20203
20204 !! html+tidy
20205 <blockquote>
20206 <p>Line one Line two</p>
20207 </blockquote>
20208 !! end
20209
20210 !! test
20211 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20212 !! wikitext
20213 <blockquote>
20214 Line one
20215
20216 Line two</blockquote>
20217 !! html
20218 <blockquote>
20219 <p>Line one
20220 </p>
20221 Line two</blockquote>
20222
20223 !! html+tidy
20224 <blockquote>
20225 <p>Line one</p>
20226 Line two</blockquote>
20227 !! end
20228
20229 !! test
20230 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20231 !! wikitext
20232 <blockquote>Line one
20233
20234 Line two
20235 </blockquote>
20236 !! html
20237 <blockquote>Line one
20238 <p>Line two
20239 </p>
20240 </blockquote>
20241
20242 !! html+tidy
20243 <blockquote>
20244 <p>Line one</p>
20245 <p>Line two</p>
20246 </blockquote>
20247 !! end
20248
20249 !! test
20250 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20251 !! wikitext
20252 <blockquote>
20253 Line one
20254
20255 Line two
20256 </blockquote>
20257 !! html
20258 <blockquote>
20259 <p>Line one
20260 </p><p>Line two
20261 </p>
20262 </blockquote>
20263
20264 !! html+tidy
20265 <blockquote>
20266 <p>Line one</p>
20267 <p>Line two</p>
20268 </blockquote>
20269 !! end
20270
20271 !! test
20272 Paragraphs inside blockquotes/divs (no extra line breaks)
20273 !! wikitext
20274 <blockquote><div>Line one
20275
20276 Line two</div></blockquote>
20277 !! html
20278 <blockquote><div>Line one
20279 Line two</div></blockquote>
20280
20281 !! end
20282
20283 !! test
20284 Paragraphs inside blockquotes/divs (extra line break on open)
20285 !! wikitext
20286 <blockquote><div>
20287 Line one
20288
20289 Line two</div></blockquote>
20290 !! html
20291 <blockquote><div>
20292 <p>Line one
20293 </p>
20294 Line two</div></blockquote>
20295
20296 !! end
20297
20298 !! test
20299 Paragraphs inside blockquotes/divs (extra line break on close)
20300 !! wikitext
20301 <blockquote><div>Line one
20302
20303 Line two
20304 </div></blockquote>
20305 !! html
20306 <blockquote><div>Line one
20307 <p>Line two
20308 </p>
20309 </div></blockquote>
20310
20311 !! end
20312
20313 !! test
20314 Paragraphs inside blockquotes/divs (extra line break on open and close)
20315 !! wikitext
20316 <blockquote><div>
20317 Line one
20318
20319 Line two
20320 </div></blockquote>
20321 !! html
20322 <blockquote><div>
20323 <p>Line one
20324 </p><p>Line two
20325 </p>
20326 </div></blockquote>
20327
20328 !! end
20329
20330 !! test
20331 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20332 !! options
20333 wgLinkHolderBatchSize=0
20334 !! wikitext
20335 [[meatball:1]]
20336 [[meatball:2]]
20337 [[meatball:3]]
20338 !! html
20339 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20340 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20341 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20342 </p>
20343 !! end
20344
20345 !! test
20346 Free external link invading image caption
20347 !! wikitext
20348 [[Image:Foobar.jpg|thumb|http://x|hello]]
20349 !! html
20350 <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>
20351
20352 !! end
20353
20354 !! test
20355 Bug 15196: localised external link numbers
20356 !! options
20357 language=fa
20358 !! wikitext
20359 [http://en.wikipedia.org/]
20360 !! html/php
20361 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20362 </p>
20363 !! html/parsoid
20364 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20365 !! end
20366
20367 !! test
20368 Multibyte character in padleft
20369 !! wikitext
20370 {{padleft:-Hello|7|Æ}}
20371 !! html
20372 <p>Æ-Hello
20373 </p>
20374 !! end
20375
20376 !! test
20377 Multibyte character in padright
20378 !! wikitext
20379 {{padright:Hello-|7|Æ}}
20380 !! html
20381 <p>Hello-Æ
20382 </p>
20383 !! end
20384
20385 !!test
20386 formatdate parser function
20387 !! wikitext
20388 {{#formatdate:2009-03-24}}
20389 !! html
20390 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20391 </p>
20392 !! end
20393
20394 !!test
20395 formatdate parser function, with default format
20396 !! wikitext
20397 {{#formatdate:2009-03-24|mdy}}
20398 !! html
20399 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20400 </p>
20401 !! end
20402
20403 !! test
20404 Spacing of numbers in formatted dates
20405 !! wikitext
20406 {{#formatdate:January 15}}
20407 !! html
20408 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20409 </p>
20410 !! end
20411
20412 !! test
20413 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
20414 !! options
20415 language=nl title=[[MediaWiki:Common.css]]
20416 !! wikitext
20417 {{#formatdate:2009-03-24|dmy}}
20418 !! html
20419 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20420 </p>
20421 !! end
20422
20423 #
20424 #
20425 #
20426
20427 #
20428 # Edit comments
20429 #
20430
20431 !! test
20432 Edit comment with link
20433 !! options
20434 comment
20435 !! wikitext
20436 I like the [[Main Page]] a lot
20437 !! html/php
20438 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20439 !!end
20440
20441 !! test
20442 Edit comment with link and link text
20443 !! options
20444 comment
20445 !! wikitext
20446 I like the [[Main Page|best pages]] a lot
20447 !! html/php
20448 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20449 !!end
20450
20451 !! test
20452 Edit comment with link and link text with suffix
20453 !! options
20454 comment
20455 !! wikitext
20456 I like the [[Main Page|best page]]s a lot
20457 !! html/php
20458 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20459 !!end
20460
20461 !! test
20462 Edit comment with section link (non-local, eg in history list)
20463 !! options
20464 comment title=[[Main Page]]
20465 !! wikitext
20466 /* External links */ removed bogus entries
20467 !! html/php
20468 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20469 !!end
20470
20471 !! test
20472 Edit comment with section link and text before it (non-local, eg in history list)
20473 !! options
20474 comment title=[[Main Page]]
20475 !! wikitext
20476 pre-comment text /* External links */ removed bogus entries
20477 !! html/php
20478 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>
20479 !!end
20480
20481 !! test
20482 Edit comment with section link (local, eg in diff view)
20483 !! options
20484 comment local title=[[Main Page]]
20485 !! wikitext
20486 /* External links */ removed bogus entries
20487 !! html/php
20488 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20489 !!end
20490
20491 !! test
20492 Edit comment with subpage link (bug 14080)
20493 !! options
20494 comment
20495 subpage
20496 title=[[Subpage test]]
20497 !! wikitext
20498 Poked at a [[/subpage]] here...
20499 !! html/php
20500 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20501 !!end
20502
20503 !! test
20504 Edit comment with subpage link and link text (bug 14080)
20505 !! options
20506 comment
20507 subpage
20508 title=[[Subpage test]]
20509 !! wikitext
20510 Poked at a [[/subpage|neat little page]] here...
20511 !! html/php
20512 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20513 !!end
20514
20515 !! test
20516 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20517 !! options
20518 comment
20519 title=[[Subpage test]]
20520 !! wikitext
20521 Poked at a [[/subpage]] here...
20522 !! html/php
20523 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...
20524 !!end
20525
20526 !! test
20527 Edit comment with bare anchor link (local, as on diff)
20528 !! options
20529 comment
20530 local
20531 title=[[Main Page]]
20532 !! wikitext
20533 [[#section]]
20534 !! html/php
20535 <a href="#section">#section</a>
20536 !! end
20537
20538 !! test
20539 Edit comment with bare anchor link (non-local, as on history)
20540 !! options
20541 comment
20542 title=[[Main Page]]
20543 !! wikitext
20544 [[#section]]
20545 !! html/php
20546 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20547 !! end
20548
20549 !! test
20550 Anchor starting with underscore
20551 !! options
20552 title=[[Foo]]
20553 !! wikitext
20554 [[#_ref|One]]
20555 !! html/php
20556 <p><a href="#_ref">One</a>
20557 </p>
20558 !! html/parsoid
20559 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20560 !! end
20561
20562 !! test
20563 Id starting with underscore
20564 !! wikitext
20565 <div id="_ref"></div>
20566 !! html/*
20567 <div id="_ref"></div>
20568
20569 !! end
20570
20571 !! test
20572 Space normalisation on autocomment (bug 22784)
20573 !! options
20574 comment
20575 title=[[Main Page]]
20576 !! wikitext
20577 /* __hello__world__ */
20578 !! html/php
20579 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20580 !! end
20581
20582 !! test
20583 percent-encoding and + signs in comments (Bug 26410)
20584 !! options
20585 comment
20586 !! wikitext
20587 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20588 !! html/php
20589 <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>
20590 !! end
20591
20592 # Parsoid doesn't support this yet: see bug 73581
20593 # but it *should* omit the 'src' attribute if the image is bad.
20594 # PHP side of tests was disabled in
20595 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20596 # because of issues in the PHP parserTests infrastructure
20597 # (but the output below is indeed what the PHP side emits)
20598 !! test
20599 Bad images - basic functionality
20600 !! wikitext
20601 [[File:Bad.jpg]]
20602 !! DISABLED/html/php
20603 !! html/parsoid
20604 <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>
20605 !! end
20606
20607 !! test
20608 Bad images - bug 16039: text after bad image disappears
20609 !! wikitext
20610 Foo bar
20611 [[File:Bad.jpg]]
20612 Bar foo
20613 !! DISABLED/html/php
20614 <p>Foo bar
20615 </p><p>Bar foo
20616 </p>
20617 !! html/parsoid
20618 <p>Foo bar
20619 <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>
20620 Bar foo</p>
20621 !! end
20622
20623 !! test
20624 Verify that displaytitle works (bug #22501) no displaytitle
20625 !! options
20626 showtitle
20627 !! config
20628 wgAllowDisplayTitle=true
20629 wgRestrictDisplayTitle=false
20630 !! wikitext
20631 this is not the the title
20632 !! html/php
20633 Parser test
20634 <p>this is not the the title
20635 </p>
20636 !! end
20637
20638 !! test
20639 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20640 !! options
20641 showtitle
20642 title=[[Screen]]
20643 !! config
20644 wgAllowDisplayTitle=true
20645 wgRestrictDisplayTitle=false
20646 !! wikitext
20647 this is not the the title
20648 {{DISPLAYTITLE:whatever}}
20649 !! html/php
20650 whatever
20651 <p>this is not the the title
20652 </p>
20653 !! end
20654
20655 !! test
20656 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20657 !! options
20658 showtitle
20659 title=[[Screen]]
20660 !! config
20661 wgAllowDisplayTitle=true
20662 wgRestrictDisplayTitle=true
20663 !! wikitext
20664 this is not the the title
20665 {{DISPLAYTITLE:whatever}}
20666 !! html/php
20667 Screen
20668 <p>this is not the the title
20669 <span class="error"><strong>Warning:</strong> Display title "whatever" was ignored since it is not equivalent to the page's actual title.</span>
20670 </p>
20671 !! end
20672
20673 !! test
20674 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20675 !! options
20676 showtitle
20677 title=[[Screen]]
20678 !! config
20679 wgAllowDisplayTitle=true
20680 wgRestrictDisplayTitle=true
20681 !! wikitext
20682 this is not the the title
20683 {{DISPLAYTITLE:screen}}
20684 !! html/php
20685 screen
20686 <p>this is not the the title
20687 </p>
20688 !! end
20689
20690 !! test
20691 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20692 !! options
20693 showtitle
20694 title=[[Screen]]
20695 !! config
20696 wgAllowDisplayTitle=false
20697 !! wikitext
20698 this is not the the title
20699 {{DISPLAYTITLE:screen}}
20700 !! html/php
20701 Screen
20702 <p>this is not the the title
20703 <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>
20704 </p>
20705 !! end
20706
20707 !! test
20708 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20709 !! options
20710 showtitle
20711 title=[[Screen]]
20712 !! config
20713 wgAllowDisplayTitle=false
20714 !! wikitext
20715 this is not the the title
20716 !! html/php
20717 Screen
20718 <p>this is not the the title
20719 </p>
20720 !! end
20721
20722 !! test
20723 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20724 !! options
20725 showtitle
20726 title=[[Screen]]
20727 !! config
20728 wgAllowDisplayTitle=true
20729 wgRestrictDisplayTitle=true
20730 !! wikitext
20731 this is not the the title
20732 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20733 !! html/php
20734 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20735 <p>this is not the the title
20736 </p>
20737 !! end
20738
20739 !! test
20740 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20741 !! options
20742 showtitle
20743 title=[[Screen]]
20744 !! config
20745 wgAllowDisplayTitle=true
20746 wgRestrictDisplayTitle=true
20747 !! wikitext
20748 this is not the the title
20749 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20750 !! html/php
20751 <span style="color: red;">s</span>creen
20752 <p>this is not the the title
20753 </p>
20754 !! end
20755
20756 !! test
20757 Page status indicators: Empty name is invalid
20758 !! options
20759 showindicators
20760 !! wikitext
20761 <indicator name=" "></indicator>
20762 <indicator></indicator>
20763 !! html
20764 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20765 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20766 </p>
20767 !! end
20768
20769 !! test
20770 Page status indicators: Weird syntaxes that are okay
20771 !! options
20772 showindicators
20773 !! wikitext
20774 <indicator name="empty" />
20775 <indicator name="name"></indicator>
20776 !! html
20777 empty=
20778 name=
20779 <p><br />
20780 </p>
20781 !! end
20782
20783 !! test
20784 Page status indicators: Torture test
20785 !! options
20786 showindicators
20787 !! wikitext
20788 <indicator name="01">hello world</indicator>
20789 <indicator name="02">[[Main Page]]</indicator>
20790 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20791 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20792 <indicator name="05">* foo
20793 * bar</indicator>
20794 <indicator name="06"><nowiki>foo</nowiki></indicator>
20795 <indicator name="07"> Preformatted</indicator>
20796 <indicator name="08"><div>Broken tag</indicator>
20797 <indicator name="09">{| class=wikitable
20798 | cell
20799 |}</indicator>
20800 <indicator name="10">Two
20801
20802 paragraphs</indicator>
20803 !! html
20804 01=hello world
20805 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20806 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" />
20807 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>
20808 05=<ul><li> foo</li>
20809 <li> bar</li></ul>
20810
20811 06=foo
20812 07=<pre>Preformatted
20813 </pre>
20814 08=<div>Broken tag</div>
20815
20816 09=<table class="wikitable">
20817 <tr>
20818 <td> cell
20819 </td></tr></table>
20820
20821 10=<p>Two
20822 </p><p>paragraphs
20823 </p>
20824 <p><br />
20825 </p><p><br />
20826 </p><p><br />
20827 </p><p><br />
20828 </p><p><br />
20829 </p>
20830 !! end
20831
20832 !! test
20833 preload: check <noinclude> and <includeonly>
20834 !! options
20835 preload
20836 !! wikitext
20837 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20838 !! html/php
20839 Hello kind world.
20840 !! end
20841
20842 !! test
20843 preload: check <onlyinclude>
20844 !! options
20845 preload
20846 !! wikitext
20847 Goodbye <onlyinclude>Hello world</onlyinclude>
20848 !! html/php
20849 Hello world
20850 !! end
20851
20852 !! test
20853 preload: can pass tags through if we want to
20854 !! options
20855 preload
20856 !! wikitext
20857 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20858 !! html/php
20859 <includeonly>Hello world</includeonly>
20860 !! end
20861
20862 !! test
20863 preload: check that it doesn't try to do tricks
20864 !! options
20865 preload
20866 !! wikitext
20867 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20868 !! html/php
20869 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20870 !! end
20871
20872 !! test
20873 Play a bit with r67090 and bug 3158
20874 !! wikitext
20875 <div style="width:50% !important">&nbsp;</div>
20876 <div style="width:50%&nbsp;!important">&nbsp;</div>
20877 <div style="width:50%&#160;!important">&nbsp;</div>
20878 <div style="border : solid;">&nbsp;</div>
20879 !! html/php
20880 <div style="width:50% !important">&#160;</div>
20881 <div style="width:50% !important">&#160;</div>
20882 <div style="width:50% !important">&#160;</div>
20883 <div style="border&#160;: solid;">&#160;</div>
20884
20885 !! html/parsoid
20886 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20887 <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>
20888 <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>
20889 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20890
20891 !! end
20892
20893 !! test
20894 HTML5 data attributes
20895 !! wikitext
20896 <span data-foo="bar">Baz</span>
20897 <p data-abc-def_hij="">Quuz</p>
20898 !! html/php
20899 <p><span data-foo="bar">Baz</span>
20900 </p>
20901 <p data-abc-def_hij="">Quuz</p>
20902
20903 !! html/parsoid
20904 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20905 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20906 !! end
20907
20908 !! test
20909 Strip reserved data attributes
20910 !! wikitext
20911 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20912 !! html/php
20913 <div data-ok="fred">d</div>
20914
20915 !! html/parsoid
20916 <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>
20917 !! end
20918
20919 !! test
20920 percent-encoding and + signs in internal links (Bug 26410)
20921 !! wikitext
20922 [[User:+%]] [[Page+title%]]
20923 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20924 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20925 [[%33%45]] [[%33%45+]]
20926 !! html/php
20927 <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>
20928 <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>
20929 <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>
20930 <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>
20931 </p>
20932 !! html/parsoid
20933 <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>
20934 <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>
20935 <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>
20936 <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>
20937 !! end
20938
20939 !! test
20940 Special characters in embedded file links (bug 27679)
20941 !! wikitext
20942 [[File:Contains & ampersand.jpg]]
20943 [[File:Does not exist.jpg|Title with & ampersand]]
20944 !! html/php
20945 <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>
20946 <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>
20947 </p>
20948 !! html/parsoid
20949 <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>
20950 <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>
20951 !! end
20952
20953 !! test
20954 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20955 !! wikitext
20956 Text&apos;s been normalized?
20957 !! html
20958 <p>Text&#39;s been normalized?
20959 </p>
20960 !! end
20961
20962 !! test
20963 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20964 !! wikitext
20965 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20966 !! html
20967 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20968 </p>
20969 !! end
20970
20971 !! test
20972 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20973 !! wikitext
20974 [http://www.example.org/ ideograms]
20975 !! html
20976 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20977 </p>
20978 !! end
20979
20980 !! test
20981 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20982 !! wikitext
20983 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20984 !! html
20985 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20986 </p>
20987 !! end
20988
20989 !! article
20990 Mediawiki:loop1
20991 !! text
20992 {{Identical|A}}
20993 !! endarticle
20994
20995 !! article
20996 Mediawiki:loop2
20997 !! text
20998 {{Identical|B}}
20999 !! endarticle
21000
21001 !! article
21002 Template:Identical
21003 !! text
21004 {{int:loop1}}
21005 {{int:loop2}}
21006 !! endarticle
21007
21008 !! test
21009 Bug 31098 Template which includes system messages which includes the template
21010 !! wikitext
21011 {{Identical}}
21012 !! html
21013 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21014 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21015 </p>
21016 !! end
21017
21018 !! test
21019 Bug31490 Turkish: ucfirst 'blah'
21020 !! options
21021 language=tr
21022 !! wikitext
21023 {{ucfirst:blah}}
21024 !! html
21025 <p>Blah
21026 </p>
21027 !! end
21028
21029 !! test
21030 Bug31490 Turkish: ucfirst 'ix'
21031 !! options
21032 language=tr
21033 !! wikitext
21034 {{ucfirst:ix}}
21035 !! html
21036 <p>İx
21037 </p>
21038 !! end
21039
21040 !! test
21041 Bug31490 Turkish: lcfirst 'BLAH'
21042 !! options
21043 language=tr
21044 !! wikitext
21045 {{lcfirst:BLAH}}
21046 !! html
21047 <p>bLAH
21048 </p>
21049 !! end
21050
21051 !! test
21052 Bug31490 Turkish: ucfırst (with a dotless i)
21053 !! options
21054 language=tr
21055 !! wikitext
21056 {{ucfırst:blah}}
21057 !! html
21058 <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>
21059 </p>
21060 !! end
21061
21062 !! test
21063 Bug31490 ucfırst (with a dotless i) with English language
21064 !! options
21065 language=en
21066 !! wikitext
21067 {{ucfırst:blah}}
21068 !! html
21069 <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>
21070 </p>
21071 !! end
21072
21073 !! test
21074 Bug 26375: TOC with italics
21075 !! options
21076 title=[[Main Page]]
21077 !! wikitext
21078 __TOC__
21079 == ''Lost'' episodes ==
21080 !! html
21081 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21082 <ul>
21083 <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>
21084 </ul>
21085 </div>
21086
21087 <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>
21088
21089 !! end
21090
21091 !! test
21092 Bug 26375: TOC with bold
21093 !! options
21094 title=[[Main Page]]
21095 !! wikitext
21096 __TOC__
21097 == '''should be bold''' then normal text ==
21098 !! html
21099 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21100 <ul>
21101 <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>
21102 </ul>
21103 </div>
21104
21105 <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>
21106
21107 !! end
21108
21109 !! test
21110 Bug 33845: Headings become cursive in TOC when they contain an image
21111 !! options
21112 title=[[Main Page]]
21113 !! wikitext
21114 __TOC__
21115 == Image [[Image:foobar.jpg]] ==
21116 !! html
21117 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21118 <ul>
21119 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21120 </ul>
21121 </div>
21122
21123 <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>
21124
21125 !! end
21126
21127 !! test
21128 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21129 !! options
21130 title=[[Main Page]]
21131 !! wikitext
21132 __TOC__
21133 == <blockquote>Quote</blockquote> ==
21134 !! html
21135 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21136 <ul>
21137 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21138 </ul>
21139 </div>
21140
21141 <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>
21142
21143 !! html+tidy
21144 <p></p>
21145 <div id="toc" class="toc">
21146 <div id="toctitle">
21147 <h2>Contents</h2>
21148 </div>
21149 <ul>
21150 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21151 </ul>
21152 </div>
21153 <p></p>
21154 <h2><span class="mw-headline" id="Quote"></span></h2>
21155 <blockquote>
21156 <p><span class="mw-headline" id="Quote">Quote</span></p>
21157 </blockquote>
21158 <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>
21159 !! end
21160
21161 !! test
21162 Unclosed tags in TOC
21163 !! options
21164 title=[[Main Page]]
21165 !! wikitext
21166 __TOC__
21167 == Proof: 2 < 3 ==
21168 <small>Hanc marginis exiguitas non caperet.</small>
21169 QED
21170 !! html
21171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21172 <ul>
21173 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
21174 </ul>
21175 </div>
21176
21177 <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>
21178 <p><small>Hanc marginis exiguitas non caperet.</small>
21179 QED
21180 </p>
21181 !! end
21182
21183 !! test
21184 Multiple tags in TOC
21185 !! wikitext
21186 __TOC__
21187 == <i>Foo</i> <b>Bar</b> ==
21188
21189 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21190 !! html
21191 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21192 <ul>
21193 <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>
21194 <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>
21195 </ul>
21196 </div>
21197
21198 <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>
21199 <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>
21200
21201 !! html+tidy
21202 <p></p>
21203 <div id="toc" class="toc">
21204 <div id="toctitle">
21205 <h2>Contents</h2>
21206 </div>
21207 <ul>
21208 <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>
21209 <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>
21210 </ul>
21211 </div>
21212 <p></p>
21213 <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>
21214 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21215 <blockquote>
21216 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21217 </blockquote>
21218 <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>
21219 !! end
21220
21221 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21222 # html5 tag parsing.
21223 !! test
21224 Tags with parameters in TOC
21225 !! options
21226 parsoid=wt2html
21227 !! wikitext
21228 __TOC__
21229 == <sup class="in-h2">Hello</sup> ==
21230
21231 == <sup class="a > b">Evilbye</sup> ==
21232 !! html/php
21233 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21234 <ul>
21235 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21236 <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>
21237 </ul>
21238 </div>
21239
21240 <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>
21241 <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>
21242
21243 !! html/parsoid
21244 <meta property="mw:PageProp/toc" />
21245 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21246
21247 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21248 !! end
21249
21250 !! test
21251 span tags with directionality in TOC
21252 !! wikitext
21253 __TOC__
21254 == <span dir="ltr">C++</span> ==
21255
21256 == <span dir="rtl">זבנג!</span> ==
21257
21258 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21259
21260 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21261
21262 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21263 !! html
21264 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21265 <ul>
21266 <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>
21267 <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>
21268 <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>
21269 <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>
21270 <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>
21271 </ul>
21272 </div>
21273
21274 <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>
21275 <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>
21276 <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>
21277 <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>
21278 <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>
21279
21280 !! end
21281
21282 !! test
21283 Bug 72884: bdi element in ToC
21284 !! wikitext
21285 __TOC__
21286 == <bdi>test</bdi> ==
21287 !! html
21288 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21289 <ul>
21290 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21291 </ul>
21292 </div>
21293
21294 <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>
21295
21296 !! end
21297
21298 # Note that the html output does not have the <p></p>, but the
21299 # html+tidy output *does*. This is because the empty <p></p> is
21300 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21301 !! test
21302 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21303 !! wikitext
21304 __TOC__
21305 == x ==
21306 !! html
21307 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21308 <ul>
21309 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21310 </ul>
21311 </div>
21312
21313 <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>
21314
21315 !! html+tidy
21316 <p></p>
21317 <div id="toc" class="toc">
21318 <div id="toctitle">
21319 <h2>Contents</h2>
21320 </div>
21321 <ul>
21322 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21323 </ul>
21324 </div>
21325 <p></p>
21326 <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>
21327 !! end
21328
21329 !! article
21330 MediaWiki:Bug32057
21331 !! text
21332 == {{int:headline_sample}} ==
21333 !! endarticle
21334
21335 !! test
21336 Bug 32057: Title needed when expanding <h> nodes.
21337 !! options
21338 title=[[Main Page]]
21339 !! wikitext
21340 {{int:Bug32057}}
21341 !! html
21342 <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>
21343
21344 !! end
21345
21346 !! test
21347 Strip marker in urlencode
21348 !! wikitext
21349 {{urlencode:x<nowiki/>y}}
21350 {{urlencode:x<nowiki/>y|wiki}}
21351 {{urlencode:x<nowiki/>y|path}}
21352 {{urlencode:x<pre id="one">two</pre>y}}
21353 !! html
21354 <p>xy
21355 xy
21356 xy
21357 xy
21358 </p>
21359 !! end
21360
21361 !! test
21362 Strip marker in lc
21363 !! wikitext
21364 {{lc:x<nowiki/>y}}
21365 !! html
21366 <p>xy
21367 </p>
21368 !! end
21369
21370 !! test
21371 Strip marker in uc
21372 !! wikitext
21373 {{uc:x<nowiki/>y}}
21374 !! html
21375 <p>XY
21376 </p>
21377 !! end
21378
21379 !! test
21380 Strip marker in formatNum
21381 !! wikitext
21382 {{formatnum:1<nowiki/>2}}
21383 {{formatnum:1<nowiki/>2|R}}
21384 !! html
21385 <p>12
21386 12
21387 </p>
21388 !! end
21389
21390 !! test
21391 Check noCommafy in formatNum
21392 !! options
21393 language=be-tarask
21394 !! wikitext
21395 {{formatnum:123456.78}}
21396 {{formatnum:123456.78|NOSEP}}
21397 !! html
21398 <p>123 456,78
21399 123456.78
21400 </p>
21401 !! end
21402
21403 !! test
21404 Wrong option for formatNum (bug 56199)
21405 !! wikitext
21406 {{formatnum:1,234.56|Random}}
21407 {{formatnum:1,234.56|EVERYTHING}}
21408 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21409 !! html
21410 <p>1,234.56
21411 1,234.56
21412 1,234.56
21413 </p>
21414 !! end
21415
21416 !! test
21417 Strip marker in grammar
21418 !! options
21419 language=fi
21420 !! wikitext
21421 {{grammar:elative|foo<nowiki/>bar}}
21422 !! html
21423 <p>foobarista
21424 </p>
21425 !! end
21426
21427 !! test
21428 Strip marker in padleft
21429 !! wikitext
21430 {{padleft:|2|x<nowiki/>y}}
21431 !! html
21432 <p>xy
21433 </p>
21434 !! end
21435
21436 !! test
21437 Strip marker in padright
21438 !! wikitext
21439 {{padright:|2|x<nowiki/>y}}
21440 !! html
21441 <p>xy
21442 </p>
21443 !! end
21444
21445 !! test
21446 Strip marker in anchorencode
21447 !! wikitext
21448 {{anchorencode:x<nowiki/>y}}
21449 !! html
21450 <p>xy
21451 </p>
21452 !! end
21453
21454 !! test
21455 nowiki inside link inside heading (bug 18295)
21456 !! wikitext
21457 ==[[foo|x<nowiki>y</nowiki>z]]==
21458 !! html
21459 <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>
21460
21461 !! end
21462
21463 !! test
21464 new support for bdi element (bug 31817)
21465 !! wikitext
21466 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21467 !! html
21468 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21469
21470 !!end
21471
21472 !! test
21473 Ignore pipe between table row attributes
21474 !! wikitext
21475 {|
21476 | quux
21477 |- id=foo | style='color: red'
21478 | bar
21479 |}
21480 !! html
21481 <table>
21482 <tr>
21483 <td> quux
21484 </td></tr>
21485 <tr id="foo" style="color: red">
21486 <td> bar
21487 </td></tr></table>
21488
21489 !! end
21490
21491 !!test
21492 Gallery override link with WikiLink (bug 34852)
21493 !! wikitext
21494 <gallery>
21495 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21496 </gallery>
21497 !! html
21498 <ul class="gallery mw-gallery-traditional">
21499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21500 <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>
21501 <div class="gallerytext">
21502 <p>caption
21503 </p>
21504 </div>
21505 </div></li>
21506 </ul>
21507
21508 !! end
21509
21510 !!test
21511 Gallery override link with absolute external link (bug 34852)
21512 !! wikitext
21513 <gallery>
21514 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21515 </gallery>
21516 !! html
21517 <ul class="gallery mw-gallery-traditional">
21518 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21519 <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>
21520 <div class="gallerytext">
21521 <p>caption
21522 </p>
21523 </div>
21524 </div></li>
21525 </ul>
21526
21527 !! end
21528
21529 !!test
21530 Gallery override link with malicious javascript (bug 34852)
21531 !! wikitext
21532 <gallery>
21533 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21534 </gallery>
21535 !! html
21536 <ul class="gallery mw-gallery-traditional">
21537 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21538 <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>
21539 <div class="gallerytext">
21540 <p>caption
21541 </p>
21542 </div>
21543 </div></li>
21544 </ul>
21545
21546 !! end
21547
21548 !!test
21549 Gallery with invalid title as link (bug 43964)
21550 !! wikitext
21551 <gallery>
21552 File:foobar.jpg|link=<
21553 </gallery>
21554 !! html
21555 <ul class="gallery mw-gallery-traditional">
21556 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21557 <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>
21558 <div class="gallerytext">
21559 </div>
21560 </div></li>
21561 </ul>
21562
21563 !! end
21564
21565 !!test
21566 Language parser function
21567 !! wikitext
21568 {{#language:ar}}
21569 !! html
21570 <p>العربية
21571 </p>
21572 !! end
21573
21574 !!test
21575 Padleft and padright as substr
21576 !! wikitext
21577 {{padleft:|3|abcde}}
21578 {{padright:|3|abcde}}
21579 !! html
21580 <p>abc
21581 abc
21582 </p>
21583 !! end
21584
21585 !!test
21586 Special parser function
21587 !! wikitext
21588 {{#special:RandomPage}}
21589 {{#special:BaDtItLe}}
21590 {{#special:Foobar}}
21591 !! html
21592 <p>Special:Random
21593 Special:Badtitle
21594 Special:Foobar
21595 </p>
21596 !! end
21597
21598 !!test
21599 Bug 34939 - Case insensitive link parsing ([HttP://])
21600 !! wikitext
21601 [HttP://MediaWiki.Org/]
21602 !! html/php
21603 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21604 </p>
21605 !! html/parsoid
21606 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21607 !! end
21608
21609 !!test
21610 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21611 !! wikitext
21612 [HttP://MediaWiki.Org/ MediaWiki]
21613 !! html
21614 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21615 </p>
21616 !! end
21617
21618 !!test
21619 Bug 34939 - Case insensitive link parsing (HttP://)
21620 !! wikitext
21621 HttP://MediaWiki.Org/
21622 !! html/php
21623 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21624 </p>
21625 !! html/parsoid
21626 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21627 !! end
21628
21629 !!test
21630 Disable TOC
21631 !! options
21632 notoc
21633 !! wikitext
21634 Lead
21635 == Section 1 ==
21636 == Section 2 ==
21637 == Section 3 ==
21638 == Section 4 ==
21639 == Section 5 ==
21640 !! html
21641 <p>Lead
21642 </p>
21643
21644 <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>
21645 <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>
21646 <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>
21647 <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>
21648 <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>
21649
21650 !! end
21651
21652
21653 ###
21654 ### Parsoid-specific tests
21655 ### Parsoid-PHP parser incompatibilities
21656 ###
21657 !!test
21658 1. SOL-sensitive wikitext tokens as template-args
21659 !!options
21660 parsoid=wt2html,wt2wt
21661 !! wikitext
21662 {{echo|*a}}
21663 {{echo|#a}}
21664 {{echo|:a}}
21665 !! html
21666 <span about="#mwt1" typeof="mw:Transclusion">
21667 </span><ul about="#mwt1"><li>a</li>
21668 </ul>
21669 <span about="#mwt2" typeof="mw:Transclusion">
21670 </span><ol about="#mwt2"><li>a</li>
21671 </ol>
21672 <span about="#mwt3" typeof="mw:Transclusion">
21673 </span><dl about="#mwt3"><dd>a</dd>
21674 </dl>
21675 !!end
21676
21677 #### -----------------------------------------------------------------
21678 #### Parsoid-specific functionality tests
21679 #### -----------------------------------------------------------------
21680
21681 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21682 # We know wt2wt will fail, but we expect selser to pass.
21683 # Due to the nature of our testing, wt2wt and selser tests will enter the
21684 # blacklist and we'll catch selser regressions based on changes to the
21685 # blacklist entries for selser tests.
21686 !! test
21687 1. Bad treebuilder fixup of formatting elt is cleaned up
21688 !! options
21689 parsoid=wt2html,wt2wt
21690 !! wikitext
21691 {|
21692 |
21693 <small>
21694 [[Image:Foobar.jpg|right|Test]]
21695 </small>
21696 |}
21697 !! html/parsoid
21698 <table>
21699 <tbody><tr><td>
21700 <small>
21701 <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>
21702 </small>
21703 </td></tr>
21704 </tbody></table>
21705 !! end
21706
21707 !! test
21708 2. Bad treebuilder fixup of formatting elt is cleaned up
21709 !! options
21710 parsoid=wt2html,wt2wt
21711 !! wikitext
21712 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21713
21714 <small>[[Image:Foobar.jpg|right|300px]]</small>
21715 !! html/parsoid
21716
21717 <p><b>foo</b></p>
21718 <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>
21719 <p><b>bar</b></p>
21720 <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>
21721 !! end
21722
21723 !! test
21724 3. Bad treebuilder fixup of formatting elt is cleaned up
21725 !! options
21726 parsoid=wt2html,wt2wt
21727 !! wikitext
21728 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21729 !! html/parsoid
21730 <p><small><b>foo</b></small></p>
21731 <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>
21732 <p><small><b>bar</b></small></p>
21733 !! end
21734
21735 !! test
21736 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21737 !! options
21738 parsoid=wt2html,wt2wt
21739 !! wikitext
21740 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21741 !! html/parsoid
21742 <p><b><small></small></b></p>
21743 <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>
21744 <p></p>
21745 !! end
21746
21747 #### ----------------------------------------------------------------
21748 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21749 #### tags. Parsoid's output for these tags differs from that of the
21750 #### PHP parser.
21751 #### ----------------------------------------------------------------
21752
21753 !!test
21754 Ref: 1. ref-location should be replaced with an index span
21755 !! wikitext
21756 A <ref>foo</ref>
21757 B <ref name="x">foo</ref>
21758 C <ref name="y" />
21759 <references />
21760 !! html/parsoid
21761 <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>
21762 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>
21763 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>
21764 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21765 <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>
21766 <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>
21767 <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>
21768 </ol>
21769 !!end
21770
21771 !!test
21772 Ref: 2. ref-tags with identical names should all get the same index
21773 !! wikitext
21774 A <ref name="x">foo</ref>
21775 B <ref name="x" />
21776 <references />
21777 !! html/parsoid
21778 <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>
21779 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>
21780 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21781 <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>
21782 </ol>
21783 !!end
21784
21785 !!test
21786 Ref: 3. spaces in ref-names should be ignored
21787 !! wikitext
21788 A <ref name="x">foo</ref>
21789 B <ref name=" x " />
21790 C <ref name= x />
21791 <references />
21792 !! html/parsoid
21793 <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>
21794 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>
21795 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>
21796 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21797 <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>
21798 </ol>
21799 !!end
21800
21801 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21802 !!test
21803 Ref: 4. 'constructor' should be accepted as a valid ref-name
21804 !! wikitext
21805 A <ref name="constructor">foo</ref>
21806 <references />
21807 !! html/parsoid
21808 <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>
21809 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21810 <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>
21811 </ol>
21812 !!end
21813
21814 !!test
21815 Ref: 5. body should accept generic wikitext
21816 !! wikitext
21817 A <ref>
21818 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21819 </ref>
21820
21821 <references />
21822 !! html/parsoid
21823 <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>
21824
21825 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21826 <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>
21827 </span></li>
21828 </ol>
21829 !!end
21830
21831 !!test
21832 Ref: 6. indent-pres should not be output in ref-body
21833 !! wikitext
21834 A <ref>
21835 foo
21836 bar
21837 baz
21838 </ref>
21839
21840 <references />
21841 !! html/parsoid
21842 <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>
21843
21844 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21845 <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
21846 bar
21847 baz
21848 </span></li>
21849 </ol>
21850 !!end
21851
21852 !!test
21853 Ref: 7. No p-wrapping in ref-body
21854 !! wikitext
21855 A <ref>
21856 foo
21857
21858 bar
21859
21860
21861 baz
21862
21863
21864
21865 booz
21866 </ref>
21867
21868 <references />
21869 !! html/parsoid
21870 <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>
21871
21872 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21873 <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
21874
21875 bar
21876
21877
21878 baz
21879
21880
21881
21882 booz
21883 </span></li>
21884 </ol>
21885 !!end
21886
21887 !!test
21888 Ref: 8. transclusion wikitext has lower precedence
21889 !! wikitext
21890 A <ref> foo {{echo|</ref> B C}}
21891
21892 <references />
21893 !! html/parsoid
21894 <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>
21895 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21896 <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>
21897 </ol>
21898 !!end
21899
21900 !!test
21901 Ref: 9. unclosed comments should not leak out of ref-body
21902 !! wikitext
21903 A <ref> foo <!--</ref> B C
21904 <references />
21905 !! html/parsoid
21906 <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>
21907 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21908 <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>
21909 </ol>
21910 !!end
21911
21912 !!test
21913 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21914 !! wikitext
21915 A <ref> <b> foo </ref> B C
21916
21917 <references />
21918 !! html/parsoid
21919 <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>
21920
21921
21922 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21923 <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>
21924 </ol>
21925 !!end
21926
21927 !!test
21928 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21929 !! wikitext
21930 A <ref>foo</ref> B
21931 C <ref>bar</ref> D
21932 <references />
21933 !! html/parsoid
21934 <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
21935 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>
21936 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21937 <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>
21938 <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>
21939 </ol>
21940 !!end
21941
21942 !!test
21943 Ref: 12. ref-tags act as trailing newline migration barrier
21944 !! wikitext
21945 <!--the newline at the end of this line moves out of the p tag-->a
21946
21947 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21948 <ref />
21949
21950 c
21951 <references />
21952 !! html/parsoid
21953 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21954
21955
21956 <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>
21957 <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>
21958
21959 <p>c</p>
21960 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21961 <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>
21962 <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>
21963 !!end
21964
21965 !!test
21966 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21967 !! wikitext
21968 <ref>foo</ref> A
21969 <ref>bar
21970 </ref> B
21971 <references />
21972 !! html/parsoid
21973 <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
21974 <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>
21975 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21976 <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>
21977 <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
21978 </span></li>
21979 </ol>
21980 !!end
21981
21982 !!test
21983 Ref: 14. A nested ref-tag should be emitted as plain text
21984 !! wikitext
21985 <ref>foo <ref>bar</ref> baz</ref>
21986
21987 <references />
21988 !! html/parsoid
21989 <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>
21990 </p>
21991 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21992 <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>
21993 </ol>
21994 !!end
21995
21996 !!test
21997 Ref: 15. ref-tags with identical names should get identical indexes
21998 !! wikitext
21999 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22000 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22001
22002 <references />
22003 !! html/parsoid
22004 <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>
22005 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>
22006
22007 <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>
22008 </ol>
22009 !!end
22010
22011 ## We don't bother wt2wt-ing non-standard whitespace
22012 !!test
22013 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22014 !!options
22015 parsoid=wt2html
22016 !! wikitext
22017 A <ref >foo</ref >
22018
22019 <references />
22020 !! html/parsoid
22021 <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>
22022 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22023 <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>
22024 !!end
22025
22026 !!test
22027 Ref: 17. Generate valid HTML5 id/about attributes
22028 !!wikitext
22029 <ref name="a b">foo</ref>
22030
22031 <references />
22032 !!html/parsoid
22033 <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>
22034 </p>
22035
22036 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22037 <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>
22038 </ol>
22039 !!end
22040
22041 !!test
22042 Ref: 18. T58916: Extension attributes should be parsed as plain text
22043 !!wikitext
22044 <ref name="{{echo|a}}">foo</ref>
22045
22046 <references />
22047 !!html/parsoid
22048 <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>
22049 </p>
22050
22051 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22052 <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>
22053 </ol>
22054 !!end
22055
22056 !!test
22057 Ref: 19. ref-tags with identical name encodings should get identical indexes
22058 !! wikitext
22059 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22060
22061 <references />
22062 !! html/parsoid
22063 <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>
22064 </p>
22065 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22066 <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>
22067 </ol>
22068 !!end
22069
22070 !!test
22071 Ref: 20. ref-tags with identical names but different content should keep it
22072 !! wikitext
22073 A <ref name="foo">Foo one</ref>
22074 B <ref name="foo">Foo two</ref>
22075 C <ref name="foo" />
22076
22077 <references />
22078 !! html/parsoid
22079 <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>
22080 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>
22081 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>
22082
22083 <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>
22084 </ol>
22085 !!end
22086
22087 !!test
22088 References: 1. references tag without any refs should be handled properly
22089 !! wikitext
22090 <references />
22091 !! html/parsoid
22092 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22093 !!end
22094
22095 !!test
22096 References: 2. references tag with group only outputs references from that group
22097 !! wikitext
22098 A <ref group="a">foo</ref>
22099 B <ref group="b">bar</ref>
22100 C <ref>baz</ref>
22101
22102 <references group="a" />
22103 <references />
22104 <references group="b" />
22105 !! html/parsoid
22106 <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>
22107 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>
22108 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>
22109
22110 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22111 <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>
22112 </ol>
22113 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22114 <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>
22115 </ol>
22116 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22117 <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>
22118 </ol>
22119 !!end
22120
22121 !!test
22122 References: 3. ref list should be cleared after processing references
22123 !! wikitext
22124 A <ref>foo</ref>
22125
22126 <references />
22127
22128 B <ref>bar</ref>
22129
22130 <references />
22131 !! html/parsoid
22132 <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>
22133
22134 <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>
22135 </ol>
22136
22137 <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>
22138
22139 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22140 <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>
22141 </ol>
22142 !!end
22143
22144 !!test
22145 References: 4. only referenced group should be cleared after processing references
22146 !! wikitext
22147 A <ref group="a">afoo</ref>
22148 B <ref>bfoo</ref>
22149
22150 <references group="a" />
22151
22152 C <ref>cfoo</ref>
22153
22154 <references />
22155 !! html/parsoid
22156 <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>
22157 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>
22158
22159 <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>
22160 </ol>
22161
22162 <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>
22163
22164 <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>
22165 </ol>
22166 !!end
22167
22168 ## Don't expect this to rt since we're dropping content
22169 !! test
22170 References: 5. ref tags in references should be processed while ignoring all other content
22171 !! options
22172 parsoid=wt2html,html2html
22173 !! wikitext
22174 A <ref name="a" />
22175 B <ref name="b">bar</ref>
22176
22177 <references>
22178 <ref name="a">foo</ref>
22179 This should just get lost.
22180 </references>
22181 !! html/parsoid
22182 <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>
22183 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>
22184
22185
22186 <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>
22187 </ol>
22188 !! end
22189
22190 !! test
22191 References: 6. <references /> from a transclusion
22192 !! wikitext
22193 <ref>Foo</ref> {{echo|<references />}}
22194 !! html/parsoid
22195 <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>
22196 </ol>
22197 !! end
22198
22199 !! test
22200 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22201 !! wikitext
22202 A <ref>foo bar for a</ref>
22203 B <ref group="X" name="b" />
22204
22205 <references />
22206
22207 <references group="X">
22208 <ref name="b">foo</ref>
22209 </references>
22210 !! html/parsoid
22211 <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>
22212 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>
22213 </p>
22214
22215 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22216 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
22217 </ol>
22218
22219 <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"}}'>
22220 <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>
22221 </ol>
22222 !! end
22223
22224 !! test
22225 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22226 !! wikitext
22227 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22228 <references />
22229 !! html/parsoid
22230 <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>
22231 <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>
22232 </ol>
22233 !!end
22234
22235 # This test only works in wt2html now as the <references /> are always generated
22236 # unless selser is active. Once T72722 is fixed, we should add a changes test
22237 # here to ensure that unrelated changes don't add the new <references />
22238 # when selser is active.
22239 !! test
22240 References: 9. Generate missing references list at the end
22241 !! wikitext
22242 A <ref>foo</ref>
22243 B <ref group="inexistent">bar</ref>
22244 !! html/parsoid
22245 <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>
22246 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22247 <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>
22248 </ol>
22249 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22250 <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>
22251 </ol>
22252 !! end
22253
22254 !! test
22255 References: 10. New <references/> shouldn't be added for unrelated edits.
22256 !! options
22257 parsoid={
22258 "modes": ["selser"],
22259 "changes": [["#x", "remove"]],
22260 "selser": "noauto"
22261 }
22262 !! wikitext
22263 Unrelated text<span id="x"> that's going to disappear</span>.
22264 A <ref>foo</ref>
22265 !! wikitext/edited
22266 Unrelated text.
22267 A <ref>foo</ref>
22268 !!end
22269
22270 !! test
22271 Entities in ref name
22272 !! wikitext
22273 <ref name="test &amp; me">hi</ref>
22274 <references />
22275 !! html/parsoid
22276 <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>
22277 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22278 <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>
22279 </ol>
22280 !! end
22281
22282 ## The output here may look funny, but it's what the php parser will do. The
22283 ## unclosed references tag becomes escaped text, and then a new references
22284 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22285 ## nowiki tags, and the auto-generated references tag is only dropped in
22286 ## rtTestMode.
22287 !! test
22288 Generate references for unclosed references tag
22289 !! options
22290 parsoid=wt2html
22291 !! wikitext
22292 a<ref>foo</ref>
22293
22294 <references>
22295 !! html/parsoid
22296 <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>
22297
22298 <p>&lt;references></p>
22299 <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>
22300 !! end
22301
22302 !! test
22303 New reference serializes on its own line
22304 !! options
22305 parsoid=wt2wt,html2wt
22306 !! wikitext
22307 foo
22308 <references />
22309 !! html/parsoid
22310 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22311 !! end
22312
22313 #### ----------------------------------------------------------------
22314 #### Parsoid-only testing of Parsoid's impl of LST
22315 #### Not implemented yet, see
22316 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22317 #### ----------------------------------------------------------------
22318
22319 !! test
22320 LST Sections: 1. Simple section start and end
22321 !! options
22322 parsoid={ "suppressErrors": true }
22323 !! wikitext
22324 <section begin="2011-05-16" />
22325 <section end="2014-04-10 (MW 1.23wmf22)" />
22326 !! html/parsoid
22327 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22328 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22329 !! end
22330
22331 #--------- Test stripping of empty nodes in template content ----------
22332 !!test
22333 Empty LI and TR nodes should be stripped from template content
22334 !!wikitext
22335 {{EmptyLITest}}
22336 {{EmptyTRTest}}
22337 !!html/parsoid
22338 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22339 <li>a</li>
22340 <li>b</li>
22341 </ul>
22342 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22343 <tbody>
22344 <tr>
22345 <td>foo</td>
22346 </tr>
22347 <tr>
22348 <td>bar</td>
22349 </tr>
22350 </tbody>
22351 </table>
22352 !!end
22353
22354 !!test
22355 Empty LI and TR nodes should not be stripped from top-level content
22356 !!wikitext
22357 * a
22358 *
22359 * b
22360 {|
22361 |-
22362 |-
22363 |foo
22364 |}
22365 !!html/parsoid
22366 <ul>
22367 <li> a</li>
22368 <li></li>
22369 <li> b</li>
22370 </ul>
22371 <table>
22372 <tbody>
22373 <tr></tr>
22374 <tr>
22375 <td>foo</td>
22376 </tr>
22377 </tbody>
22378 </table>
22379 !!end
22380
22381 !!test
22382 Empty TR nodes should not be stripped if they have any attributes set
22383 !!wikitext
22384 {{EmptyTRWithHTMLAttrTest}}
22385 !!html/parsoid
22386 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22387 <tr align="center"></tr>
22388 <tr><td>foo</td></tr>
22389 <tr align="center"></tr>
22390 <tr><td>bar</td></tr>
22391 </table>
22392 !!end
22393
22394 #### ----------------------------------------------------------------
22395 #### The following section of tests are primarily to test
22396 #### wikitext escaping capabilities of Parsoid. Given that
22397 #### escaping can be done any number of ways, the wikitext (input)
22398 #### is always adjusted to reflect how Parsoid adds nowiki
22399 #### escape tags.
22400 ####
22401 #### We are marking several tests as parsoid-only since the
22402 #### HTML in the result section is different from what the
22403 #### PHP parser generates for it.
22404 #### ----------------------------------------------------------------
22405
22406
22407 #### --------------- Headings ---------------
22408 #### 0. Unnested
22409 #### 1. Nested inside html <h1>=foo=</h1>
22410 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22411 #### 3. Nested inside html with wikitext split by html tags
22412 #### 4. No escape needed
22413 #### 5. Empty headings <h1></h1>
22414 #### 6. Heading chars in SOL context
22415 #### ----------------------------------------
22416 !! test
22417 Headings: 0. Unnested
22418 !! options
22419 parsoid=html2wt
22420 !! html/parsoid
22421 <p>=foo=</p>
22422
22423 <p> =foo=
22424 <!--cmt-->
22425 =foo=</p>
22426
22427 <p>=foo<i>a</i>=</p>
22428 !! wikitext
22429 <nowiki>=foo=</nowiki>
22430
22431 <nowiki> </nowiki>=foo=
22432 <!--cmt-->
22433 <nowiki>=foo=</nowiki>
22434
22435 =foo''a''<nowiki>=</nowiki>
22436 !!end
22437
22438 # New headings and existing headings are handled differently
22439 !! test
22440 Headings: 1. Nested inside html
22441 !! options
22442 parsoid=html2wt
22443 !! html/parsoid
22444 <h1>=foo=</h1>
22445 <h2>=foo=</h2>
22446 <h3>=foo=</h3>
22447
22448 <h1 data-parsoid=''>=foo=</h1>
22449 <h2 data-parsoid=''>=foo=</h2>
22450 <h3 data-parsoid=''>=foo=</h3>
22451 <h4 data-parsoid=''>=foo=</h4>
22452 <h5 data-parsoid=''>=foo=</h5>
22453 <h6 data-parsoid=''>=foo=</h6>
22454 !! wikitext
22455 = =foo= =
22456
22457 == =foo= ==
22458
22459 === =foo= ===
22460
22461 =<nowiki>=foo=</nowiki>=
22462 ==<nowiki>=foo=</nowiki>==
22463 ===<nowiki>=foo=</nowiki>===
22464 ====<nowiki>=foo=</nowiki>====
22465 =====<nowiki>=foo=</nowiki>=====
22466 ======<nowiki>=foo=</nowiki>======
22467
22468 !!end
22469
22470 !! test
22471 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22472 !! options
22473 parsoid=html2wt
22474 !! html/parsoid
22475 <h1>foo</h1>*bar
22476 <h1>foo</h1>=bar
22477 <h1>foo</h1>=bar=
22478 !! wikitext
22479 = foo =
22480 <nowiki>*</nowiki>bar
22481
22482 = foo =
22483 =bar
22484
22485 = foo =
22486 <nowiki>=bar=</nowiki>
22487 !!end
22488
22489 !! test
22490 Headings: 3. Nested inside html with wikitext split by html tags
22491 !! options
22492 parsoid=html2wt
22493 !! html/parsoid
22494 <h1>=<b>bold</b>foo=</h1>
22495 !! wikitext
22496 = ='''bold'''foo= =
22497 !!end
22498
22499 !! test
22500 Headings: 4a. No escaping needed (testing just h1 and h2)
22501 !! options
22502 parsoid=html2wt
22503 !! html/parsoid
22504 <h1>=foo</h1>
22505 <h1>foo=</h1>
22506 <h1> =foo= </h1>
22507 <h1>=foo= bar</h1>
22508 <h2>=foo</h2>
22509 <h2>foo=</h2>
22510 <h1>=</h1>
22511 <h1><i>=</i>foo=</h1>
22512 !! wikitext
22513 = =foo =
22514
22515 = foo= =
22516
22517 = =foo= =
22518
22519 = =foo= bar =
22520
22521 == =foo ==
22522
22523 == foo= ==
22524
22525 = = =
22526
22527 = ''=''foo= =
22528 !!end
22529
22530 !! test
22531 Headings: 4b. No escaping needed (inside p-tags)
22532 !! options
22533 parsoid=html2wt
22534 !! html/parsoid
22535 <p>===
22536 =foo= x
22537 =foo= <s></s>
22538 </p>
22539 !! wikitext
22540 ===
22541 =foo= x
22542 =foo= <s></s>
22543 !!end
22544
22545 !! test
22546 Headings: 5. Empty headings
22547 !! options
22548 parsoid=html2wt
22549 !! html/parsoid
22550 <h1 data-parsoid='{}'></h1>
22551
22552 <h2 data-parsoid='{}'></h2>
22553
22554 <h3 data-parsoid='{}'></h3>
22555
22556 <h4 data-parsoid='{}'></h4>
22557
22558 <h5 data-parsoid='{}'></h5>
22559
22560 <h6 data-parsoid='{}'></h6>
22561 !! wikitext
22562 =<nowiki/>=
22563
22564 ==<nowiki/>==
22565
22566 ===<nowiki/>===
22567
22568 ====<nowiki/>====
22569
22570 =====<nowiki/>=====
22571
22572 ======<nowiki/>======
22573 !!end
22574
22575 !! test
22576 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22577 !! options
22578 parsoid=html2wt
22579 !! html/parsoid
22580 <p>=a=</p>
22581
22582 <p>=a=</p>
22583
22584 <p>=a=</p>
22585 !! wikitext
22586 <nowiki>=a=</nowiki>
22587
22588 <nowiki>=a=</nowiki>
22589
22590 <nowiki>=a=</nowiki>
22591 !!end
22592
22593 !! test
22594 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22595 !! options
22596 parsoid=html2wt
22597 !! html/parsoid
22598 <p>=a=
22599 b</p>
22600
22601 <p>=a=
22602 b</p>
22603
22604 <p>=a=
22605 b</p>
22606 !! wikitext
22607 <nowiki>=a=</nowiki>
22608 b
22609
22610 <nowiki>=a=</nowiki>
22611 b
22612
22613 <nowiki>=a=</nowiki>
22614 b
22615 !!end
22616
22617 !! test
22618 Headings: 6c. Heading chars in SOL context (leading newline break)
22619 !! options
22620 parsoid=html2wt
22621 !! html/parsoid
22622 <p>a
22623 =b=</p>
22624 !! wikitext
22625 a
22626 <nowiki>=b=</nowiki>
22627 !!end
22628
22629 !! test
22630 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22631 !! options
22632 parsoid=html2wt
22633 !! html/parsoid
22634 <!--c0--><p>=a=</p>
22635
22636 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22637 !! wikitext
22638 <!--c0--><nowiki>=a=</nowiki>
22639
22640 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22641 !!end
22642
22643 !! test
22644 Headings: 6d. Heading chars in SOL context (No escaping needed)
22645 !! options
22646 parsoid=html2wt
22647 !! html/parsoid
22648 =a=<div>b</div>
22649 !! wikitext
22650 =a=<div>b</div>
22651 !!end
22652
22653 !! test
22654 Headings: 7. Insert a newline between new content and headings
22655 !! options
22656 parsoid=html2wt
22657 !! html/parsoid
22658 <h2>NEW</h2>
22659 <p>new</p>
22660 <h2 data-parsoid='{}'>A</h2>
22661 <p data-parsoid='{}'>a</p>
22662 !! wikitext
22663 == NEW ==
22664 new
22665
22666 ==A==
22667 a
22668
22669 !! end
22670
22671 #### --------------- Lists ---------------
22672 #### 0. Outside nests (*foo, etc.)
22673 #### 1. Nested inside html <ul><li>*foo</li></ul>
22674 #### 2. Inside definition lists
22675 #### 3. Only bullets at start should be escaped
22676 #### 4. No escapes needed
22677 #### 5. No unnecessary escapes
22678 #### 6. Escape bullets in SOL position
22679 #### 7. Escape bullets in a multi-line context
22680 #### ----------------------------------------
22681
22682 !! test
22683 Lists: 0. Outside nests
22684 !! options
22685 parsoid=html2wt
22686 !! html/parsoid
22687 <p>*foo</p>
22688
22689 <p>#foo</p>
22690
22691 <p>;Foo:bar</p>
22692 !! wikitext
22693 <nowiki>*</nowiki>foo
22694
22695 <nowiki>#</nowiki>foo
22696
22697 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22698 !!end
22699
22700 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22701 ## to test wikitext escaping, and insignificant whitespace diffs
22702 ## cause PHP parser tests to barf
22703 !! test
22704 Lists: 1. Nested inside html (No unnecessary escapes)
22705 !! options
22706 parsoid=html2wt
22707 !! html/parsoid
22708 <ul>
22709 <li>*foo</li>
22710 <li>#foo</li>
22711 <li>:foo</li>
22712 <li>;foo</li>
22713 <li data-parsoid='{}'>*foo</li>
22714 <li data-parsoid='{}'>#foo</li>
22715 <li data-parsoid='{}'>:foo</li>
22716 <li data-parsoid='{}'>;foo</li>
22717 </ul>
22718
22719 <ol>
22720 <li>*foo</li>
22721 <li>#foo</li>
22722 <li>:foo</li>
22723 <li>;foo</li>
22724 <li data-parsoid='{}'>*foo</li>
22725 <li data-parsoid='{}'>#foo</li>
22726 <li data-parsoid='{}'>:foo</li>
22727 <li data-parsoid='{}'>;foo</li>
22728 </ol>
22729 !! wikitext
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
22739 # *foo
22740 # #foo
22741 # :foo
22742 # ;foo
22743 #<nowiki>*foo</nowiki>
22744 #<nowiki>#foo</nowiki>
22745 #<nowiki>:foo</nowiki>
22746 #<nowiki>;foo</nowiki>
22747 !!end
22748
22749 !! test
22750 Lists: 2. Inside definition lists
22751 !! options
22752 parsoid=html2wt
22753 !! html/parsoid
22754 <dl><dt>;foo</dt></dl>
22755 <dl><dt>:foo</dt></dl>
22756 <dl><dt>:foo</dt>
22757 <dd>bar</dd></dl>
22758 <dl><dd>:foo</dd></dl>
22759 !! wikitext
22760 ; ;foo
22761
22762 ; <nowiki>:foo</nowiki>
22763
22764 ; <nowiki>:foo</nowiki>
22765 : bar
22766
22767 : :foo
22768 !!end
22769
22770 !! test
22771 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22772 !! options
22773 parsoid=html2wt
22774 !! html/parsoid
22775 <ul>
22776 <li>*foo*bar</li>
22777 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22778 </ul>
22779 !! wikitext
22780 * *foo*bar
22781 *<nowiki>*foo</nowiki>''it''*bar
22782 !!end
22783
22784 !! test
22785 Lists: 4. No escapes needed
22786 !! options
22787 parsoid=html2wt
22788 !! html/parsoid
22789 <ul>
22790 <li>foo*bar
22791 </li>
22792 </ul>
22793 <ul>
22794 <li><i>foo</i>*bar
22795 </li>
22796 </ul>
22797 <ul>
22798 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22799 </li>
22800 </ul>
22801 <ul>
22802 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22803 </li>
22804 </ul>
22805 !! wikitext
22806 *foo*bar
22807
22808 *''foo''*bar
22809
22810 *[[Foo]]: bar
22811
22812 *[[Foo]]*bar
22813 !!end
22814
22815 !! test
22816 Lists: 5. No unnecessary escapes
22817 !! options
22818 parsoid=html2wt
22819 !! html/parsoid
22820 <ul><li> bar <span>[[foo]]</span></li></ul>
22821 <ul><li> =bar <span>[[foo]]</span></li></ul>
22822 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22823 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22824 <ul><li> =bar <span>foo]]</span>=</li></ul>
22825 <ul><li> <s></s>: a</li></ul>
22826 <ul><li> <i>* foo</i></li></ul>
22827
22828 !! wikitext
22829 * bar <span><nowiki>[[foo]]</nowiki></span>
22830
22831 * =bar <span><nowiki>[[foo]]</nowiki></span>
22832
22833 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22834
22835 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22836
22837 * =bar <span>foo]]</span>=
22838
22839 * <s></s>: a
22840
22841 * ''* foo''
22842 !!end
22843
22844 !! test
22845 Lists: 6. Escape bullets in SOL position
22846 !! options
22847 parsoid=html2wt
22848 !! html/parsoid
22849 <p><!--cmt-->*foo</p>
22850 !! wikitext
22851 <!--cmt--><nowiki>*</nowiki>foo
22852 !!end
22853
22854 !! test
22855 Lists: 7. Escape bullets in a multi-line context
22856 !! options
22857 parsoid=html2wt
22858 !! html/parsoid
22859 <p>a
22860 *b
22861 </p>
22862 !! wikitext
22863 a
22864 <nowiki>*</nowiki>b
22865 !!end
22866
22867 !! test
22868 Lists: 8. Escape colons only if not present in tags
22869 !! options
22870 parsoid=html2wt
22871 !! html/parsoid
22872 <dl><dt>a:b<i>c:d</i></dt></dl>
22873 !! wikitext
22874 ; <nowiki>a:b</nowiki>''c:d''
22875 !! end
22876
22877 #### --------------- HRs ---------------
22878 #### 1. Single line
22879 #### -----------------------------------
22880
22881 !! test
22882 HRs: 1. Single line
22883 !! options
22884 parsoid=html2wt
22885 !! html/parsoid
22886 <hr />----
22887 <hr />=foo=
22888 <hr />*foo
22889 !! wikitext
22890 ----<nowiki>----</nowiki>
22891 ----=foo=
22892 ----*foo
22893 !! end
22894
22895 #### --------------- Tables ---------------
22896 #### 1a. Simple example
22897 #### 1b. No escaping needed (!foo)
22898 #### 1c. No escaping needed (|foo)
22899 #### 1d. No escaping needed (|}foo)
22900 ####
22901 #### 2a. Nested in td (<td>foo|bar</td>)
22902 #### 2b. Nested in td (<td>foo||bar</td>)
22903 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22904 ####
22905 #### 3a. Nested in th (<th>foo!bar</th>)
22906 #### 3b. Nested in th (<th>foo!!bar</th>)
22907 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22908 ####
22909 #### 4a. Escape -
22910 #### 4b. Escape +
22911 #### 4c. No escaping needed
22912 #### --------------------------------------
22913
22914 !! test
22915 Tables: 1a. Simple example
22916 !! options
22917 parsoid=html2wt
22918 !! html/parsoid
22919 <p>{|
22920 |}
22921 </p>
22922 !! wikitext
22923 <nowiki>{|</nowiki>
22924 |}
22925 !! end
22926
22927 !! test
22928 Tables: 1b. No escaping needed
22929 !! options
22930 parsoid=html2wt
22931 !! html/parsoid
22932 <p>!foo
22933 </p>
22934 !! wikitext
22935 !foo
22936 !! end
22937
22938 !! test
22939 Tables: 1c. No escaping needed
22940 !! options
22941 parsoid=html2wt
22942 !! html/parsoid
22943 <p>|foo
22944 </p>
22945 !! wikitext
22946 |foo
22947 !! end
22948
22949 !! test
22950 Tables: 1d. No escaping needed
22951 !! options
22952 parsoid=html2wt
22953 !! html/parsoid
22954 <p>|}foo
22955 </p>
22956 !! wikitext
22957 |}foo
22958 !! end
22959
22960 !! test
22961 Tables: 2a. Nested in td
22962 !! options
22963 parsoid=html2wt
22964 !! html/parsoid
22965 <table><tbody><tr>
22966 <td>foo|bar</td></tr>
22967 <tr><td>x<div>a|b</div></td>
22968 </tbody></table>
22969 !! wikitext
22970 {|
22971 |<nowiki>foo|bar</nowiki>
22972 |-
22973 |x<div><nowiki>a|b</nowiki></div>
22974 |}
22975 !! html/php+tidy
22976 <table>
22977 <tr>
22978 <td>foo|bar</td>
22979 </tr>
22980 <tr>
22981 <td>x
22982 <div>a|b</div>
22983 </td>
22984 </tr>
22985 </table>
22986 !! end
22987
22988 !! test
22989 Tables: 2b. Nested in td
22990 !! options
22991 parsoid=html2wt
22992 !! html/parsoid
22993 <table><tbody><tr>
22994 <td>foo||bar</td>
22995 <td>a<i>b||c</i></td>
22996 <td>a<i><div>b||c</div></i></td>
22997 </tr></tbody></table>
22998 !! wikitext
22999 {|
23000 |<nowiki>foo||bar</nowiki>
23001 |a''<nowiki>b||c</nowiki>''
23002 |a''<div><nowiki>b||c</nowiki></div>''
23003 |}
23004 !! html/php
23005 <table>
23006 <tr>
23007 <td>foo||bar
23008 </td>
23009 <td>a<i>b||c</i>
23010 </td>
23011 <td>a<i><div>b||c</div></i>
23012 </td></tr></table>
23013
23014 !! end
23015
23016 !! test
23017 Tables: 2c. Nested in td -- no escaping needed
23018 !! options
23019 parsoid=html2wt
23020 !! html/*
23021 <table>
23022
23023 <tr>
23024 <td>foo!!bar
23025 </td></tr></table>
23026
23027 !! wikitext
23028 {|
23029
23030 |foo!!bar
23031 |}
23032 !! end
23033
23034 !! test
23035 Tables: 3a. Nested in th
23036 !! options
23037 parsoid=html2wt
23038 !! html/*
23039 <table>
23040
23041 <tr>
23042 <th>foo!bar
23043 </th></tr></table>
23044
23045 !! wikitext
23046 {|
23047
23048 !foo!bar
23049 |}
23050 !! end
23051
23052 !! test
23053 Tables: 3b. Nested in th
23054 !! options
23055 parsoid=html2wt
23056 !! html/parsoid
23057 <table><tbody>
23058 <tr><th>foo!!bar</th>
23059 <th><i>foo|bar</i></th>
23060 <th><i>foo!!bar</i></th>
23061 <th><i><span>foo!!bar</span></i></th>
23062 </tr></tbody></table>
23063 !! wikitext
23064 {|
23065 !<nowiki>foo!!bar</nowiki>
23066 !''<nowiki>foo|bar</nowiki>''
23067 !''<nowiki>foo!!bar</nowiki>''
23068 !''<span><nowiki>foo!!bar</nowiki></span>''
23069 |}
23070 !! html/php
23071 <table>
23072 <tr>
23073 <th>foo!!bar
23074 </th>
23075 <th><i>foo|bar</i>
23076 </th>
23077 <th><i>foo!!bar</i>
23078 </th>
23079 <th><i><span>foo!!bar</span></i>
23080 </th></tr></table>
23081
23082 !! end
23083
23084 !! test
23085 Tables: 3c. Nested in th
23086 !! options
23087 parsoid=html2wt
23088 !! html/parsoid
23089 <table><tbody>
23090 <tr><th>foo||bar</th>
23091 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23092 </tr></tbody></table>
23093 !! wikitext
23094 {|
23095 !<nowiki>foo||bar</nowiki>
23096 !<nowiki>foo||bar</nowiki>
23097 |}
23098 !! html/php
23099 <table>
23100 <tr>
23101 <th>foo||bar
23102 </th>
23103 <th>foo||bar
23104 </th></tr></table>
23105
23106 !! end
23107
23108 !! test
23109 Tables: 4a. Escape -
23110 !! options
23111 parsoid=html2wt
23112 !! html/*
23113 <table>
23114
23115 <tr>
23116 <th>-bar
23117 </th></tr>
23118 <tr>
23119 <td>-bar
23120 </td></tr></table>
23121
23122 !! wikitext
23123 {|
23124
23125 !-bar
23126
23127 |-
23128 |<nowiki>-bar</nowiki>
23129 |}
23130 !! end
23131
23132 !! test
23133 Tables: 4b. Escape +
23134 !! options
23135 parsoid=html2wt
23136 !! html/*
23137 <table>
23138
23139 <tr>
23140 <th>+bar
23141 </th></tr>
23142 <tr>
23143 <td>+bar
23144 </td></tr></table>
23145
23146 !! wikitext
23147 {|
23148
23149 !+bar
23150
23151 |-
23152 |<nowiki>+bar</nowiki>
23153 |}
23154 !! end
23155
23156 !! test
23157 Tables: 4c. No escaping needed
23158 !! options
23159 parsoid=html2wt
23160 !! html/parsoid
23161 <table><tbody>
23162 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23163 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23164 <tr><td>foo
23165 <p>bar|baz
23166 +bar
23167 -bar</p></td></tr>
23168 <tr><td>x
23169 <div>a|b</div></td>
23170 </tbody></table>
23171 !! wikitext
23172 {|
23173 |foo-bar
23174 |foo+bar
23175 |-
23176 |''foo''-bar
23177 |''foo''+bar
23178 |-
23179 |foo
23180 bar|baz
23181 +bar
23182 -bar
23183 |-
23184 |x
23185 <div>a|b</div>
23186 |}
23187 !! html/php
23188 <table>
23189 <tr>
23190 <td>foo-bar
23191 </td>
23192 <td>foo+bar
23193 </td></tr>
23194 <tr>
23195 <td><i>foo</i>-bar
23196 </td>
23197 <td><i>foo</i>+bar
23198 </td></tr>
23199 <tr>
23200 <td>foo
23201 <p>bar|baz
23202 +bar
23203 -bar
23204 </p>
23205 </td></tr>
23206 <tr>
23207 <td>x
23208 <div>a|b</div>
23209 </td></tr></table>
23210
23211 !! end
23212
23213 !! test
23214 Tables: 4d. No escaping needed
23215 !! options
23216 parsoid=html2wt
23217 !! html/parsoid
23218 <table>
23219 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23220 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23221 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23222 </tbody></table>
23223 !! wikitext
23224 {|
23225 |[[Foo]]-bar
23226 ||+1
23227 ||-2
23228 |}
23229 !! html/php
23230 <table>
23231 <tr>
23232 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23233 </td>
23234 <td>+1
23235 </td>
23236 <td>-2
23237 </td></tr></table>
23238
23239 !! end
23240
23241 !! test
23242 T97430: Don't emit empty nowiki pairs around marker meta tags
23243 !! options
23244 parsoid=html2wt
23245 !! html/parsoid
23246 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23247 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23248 !! wikitext
23249 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23250 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23251 !! end
23252
23253 !! test
23254 Unclosed xmlish element in table line shouldn't eat end delimiters
23255 !! options
23256 parsoid=html2wt
23257 !! html/parsoid
23258 <table>
23259 <tbody><tr><td> &lt;foo</td>
23260 <td> bar></td></tr>
23261 </tbody></table>
23262 !! wikitext
23263 {|
23264 | <foo
23265 | bar>
23266 |}
23267 !! html/php
23268 <table>
23269 <tr>
23270 <td> &lt;foo
23271 </td>
23272 <td> bar&gt;
23273 </td></tr></table>
23274
23275 !! end
23276
23277 #### --------------- Links ----------------
23278 #### 1. Quote marks in link text
23279 #### 2. Wikilinks: Escapes needed
23280 #### 3. Wikilinks: No escapes needed
23281 #### 4. Extlinks: Escapes needed
23282 #### 5. Extlinks: No escapes needed
23283 #### --------------------------------------
23284 !! test
23285 Links 1. WikiLinks: No escapes needed
23286 !! options
23287 parsoid=html2wt
23288 !! html/parsoid
23289 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23290 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23291 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23292 !! wikitext
23293 [[Foo|Foo''boo'']]
23294 [[Foo|[Foobar]]]
23295 [[Foo|x [Foobar] x]]
23296 !! html/php
23297 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23298 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23299 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23300 </p>
23301 !! end
23302
23303 !! test
23304 Links 2. WikiLinks: Escapes needed
23305 !! options
23306 parsoid=html2wt
23307 !! html/parsoid
23308 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23309 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23310 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23311 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23312 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23313 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23314 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23315 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23316 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23317 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23318 !! wikitext
23319 [[Foo|<nowiki>Foobar]</nowiki>]]
23320 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23321 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23322 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23323 [[Foo|<nowiki>|Bar</nowiki>]]
23324 [[Foo|<nowiki>]]bar</nowiki>]]
23325 [[Foo|<nowiki>[[bar</nowiki>]]
23326 [[Foo|<nowiki>x [[ y</nowiki>]]
23327 [[Foo|<nowiki>x ]] y</nowiki>]]
23328 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23329 !! html/php
23330 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23331 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23332 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23333 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23334 <a href="/wiki/Foo" title="Foo">|Bar</a>
23335 <a href="/wiki/Foo" title="Foo">]]bar</a>
23336 <a href="/wiki/Foo" title="Foo">[[bar</a>
23337 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23338 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23339 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23340 </p>
23341 !! end
23342
23343 !! test
23344 Links 3. WikiLinks: No escapes needed
23345 !! options
23346 parsoid=html2wt
23347 !! html/parsoid
23348 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23349 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23350 !! wikitext
23351 [[Foo|[Foobar]]
23352 [[Foo|foo|bar]]
23353 !! html/php
23354 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23355 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23356 </p>
23357 !! end
23358
23359 !! test
23360 Links 4. ExtLinks: Escapes needed
23361 !! options
23362 parsoid=html2wt
23363 !! html/parsoid
23364 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23365 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23366 <p>[http://google.com]</p>
23367 <p>[http://google.com google]</p>
23368 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23369 <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>
23370 !! wikitext
23371 [http://google.com <nowiki>[google]</nowiki>]
23372 [http://google.com <nowiki>google]</nowiki>]
23373
23374 <nowiki>[http://google.com]</nowiki>
23375
23376 <nowiki>[http://google.com google]</nowiki>
23377
23378 [http://google.com<nowiki>]</nowiki>
23379
23380 [{{echo|http://google.com}}<nowiki>]</nowiki>
23381 !! html/php
23382 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23383 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23384 </p><p>[http://google.com]
23385 </p><p>[http://google.com google]
23386 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23387 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23388 </p>
23389 !! end
23390
23391 !! test
23392 Links 5. ExtLinks: No escapes needed
23393 !! options
23394 parsoid=html2wt
23395 !! html/parsoid
23396 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23397 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23398 !! wikitext
23399 [http://google.com [google]
23400
23401 [[http://google.com]]
23402 !! html/php
23403 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23404 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23405 </p>
23406 !! end
23407
23408 !! test
23409 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23410 !! options
23411 parsoid=html2wt
23412 !! html/parsoid
23413 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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>&amp;x
23416 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23417 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23418 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23419 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23420 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23421 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23422 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23423 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23424 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23425 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23426 </p>
23427 !! wikitext
23428 x<nowiki/>http://example.com<nowiki/>y
23429 http://example.com<nowiki/>?x
23430 http://example.com<nowiki/>&x
23431 http://example.com<nowiki/>'x
23432 http://example.com<nowiki/>,x
23433 http://example.com<nowiki/>.x
23434 http://example.com<nowiki/>;x
23435 http://example.com<nowiki/>:x
23436 http://example.com<nowiki/>;x
23437 http://example.com<nowiki/>!x
23438 http://example.com<nowiki/>=x
23439 http://example.com<nowiki/>(x)
23440 http://example.com(x<nowiki/>)
23441 !! end
23442
23443 !! test
23444 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23445 !! options
23446 parsoid=html2wt
23447 !! html/parsoid
23448 <p>x
23449 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23450 y
23451 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23452 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23453 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23454 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23455 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23456 </p>
23457 !! wikitext
23458 x
23459 http://example.com
23460 y
23461 "http://example.com"
23462 (http://example.com)
23463 (http://example.com) foo
23464 http://example.com,
23465 http://example.com, foo
23466 !! html/php
23467 <p>x
23468 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23469 y
23470 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23471 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23472 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23473 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23474 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23475 </p>
23476 !! end
23477
23478 !! test
23479 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23480 !! options
23481 parsoid=html2wt
23482 !! html/parsoid
23483 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23484 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23485 !! wikitext
23486 http://example.com.,;:!?\
23487 -http://example.com:
23488 !! html/php
23489 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23490 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23491 </p>
23492 !! end
23493
23494 !! test
23495 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23496 !! options
23497 parsoid=html2wt
23498 !! html/parsoid
23499 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23500 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23501 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23502 !! wikitext
23503 RFC 123<nowiki/>4
23504 RFC 123<nowiki/>y
23505 X<nowiki/>RFC 123<nowiki/>y
23506 !! end
23507
23508 !! test
23509 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23510 !! options
23511 parsoid=html2wt
23512 !! html/parsoid
23513 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23514 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23515 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23516 </p>
23517 !! wikitext
23518 RFC 123?foo
23519 RFC 123&foo
23520 -RFC 123-
23521 !! html/php
23522 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23523 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23524 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23525 </p>
23526 !! end
23527
23528 !! test
23529 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23530 !! options
23531 parsoid=html2wt
23532 !! html/parsoid
23533 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23534 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23535 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23536 !! wikitext
23537 PMID 123<nowiki/>4
23538 PMID 123<nowiki/>y
23539 X<nowiki/>PMID 123<nowiki/>y
23540 !! end
23541
23542 !! test
23543 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23544 !! options
23545 parsoid=html2wt
23546 !! html/parsoid
23547 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23548 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23549 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23550 </p>
23551 !! wikitext
23552 PMID 123?foo
23553 PMID 123&foo
23554 -PMID 123-
23555 !! html/php
23556 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23557 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23558 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23559 </p>
23560 !! end
23561
23562 !! test
23563 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23564 !! options
23565 parsoid=html2wt
23566 !! html/parsoid
23567 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23568 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23569 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23570 </p>
23571 !! wikitext
23572 ISBN 1234567890<nowiki/>1
23573 ISBN 1234567890<nowiki/>x
23574 a<nowiki/>ISBN 1234567890<nowiki/>b
23575 !! end
23576
23577 !! test
23578 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23579 !! options
23580 parsoid=html2wt
23581 !! html/parsoid
23582 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23583 !! wikitext
23584 -ISBN 1234567890's
23585 !! html/php
23586 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23587 </p>
23588 !! end
23589
23590 !! test
23591 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23592 !! options
23593 parsoid=html2wt
23594 !! html/*
23595 <p>this is not a link: http://example.com
23596 </p>
23597 !! wikitext
23598 this is not a link: <nowiki>http://example.com</nowiki>
23599 !! end
23600
23601 !! test
23602 Links 15. Link trails can't become link prefixes.
23603 !! options
23604 language=is
23605 parsoid=html2wt
23606 !! html/parsoid
23607 <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>
23608 !! wikitext
23609 [[Söfnuður]]-[[00]]
23610 !! html/php
23611 <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>
23612 </p>
23613 !! end
23614
23615 #### --------------- Quotes ---------------
23616 #### 1. Quotes inside <b> and <i>
23617 #### 2. Link fragments separated by <i> and <b> tags
23618 #### 3. Link fragments inside <i> and <b>
23619 #### 4. No escaping needed
23620 #### --------------------------------------
23621 !! test
23622 1a. Quotes inside <b> and <i>
23623 !! options
23624 parsoid=html2wt
23625 !! html/*
23626 <p><i>'foo'</i>
23627 <i>''foo''</i>
23628 <i>'''foo'''</i>
23629 <i>foo</i>'s
23630 <b>'foo'</b>
23631 <b>''foo''</b>
23632 <b>'''foo'''</b>
23633 <b>foo'<i>bar'</i>baz</b>
23634 <b>foo</b>'s
23635 '<i>foo</i>
23636 <i>foo</i>'
23637 <i>foo'</i>'
23638 '<i>foo</i>'
23639 '<b>foo</b>
23640 <b>foo</b>'
23641 '<b>foo</b>'
23642 <i>fools'<span> errand</span></i>
23643 <i><span>fool</span>'s errand</i>
23644 '<i>foo</i> bar '<i>baz</i>
23645 a|!*#-:;+-~[]{}b'<i>x</i>
23646 </p>
23647 !! wikitext
23648 ''<nowiki/>'foo'''
23649 ''<nowiki>''foo''</nowiki>''
23650 ''<nowiki>'''foo'''</nowiki>''
23651 ''foo''<nowiki/>'s
23652 '''<nowiki/>'foo''''
23653 '''<nowiki>''foo''</nowiki>'''
23654 '''<nowiki>'''foo'''</nowiki>'''
23655 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23656 '''foo'''<nowiki/>'s
23657 '''foo''
23658 ''foo''<nowiki/>'
23659 ''foo'''<nowiki/>'
23660 '''foo''<nowiki/>'
23661 ''''foo'''
23662 '''foo'''<nowiki/>'
23663 ''''foo'''<nowiki/>'
23664 ''fools'<span> errand</span>''
23665 ''<span>fool</span>'s errand''
23666 '<nowiki/>''foo'' bar '''baz''
23667 a|!*#-:;+-~[]{}b'''x''
23668 !! end
23669
23670 !! test
23671 1b. Quotes inside <b> and <i> with other tags on same line
23672 !! options
23673 parsoid=html2wt
23674 !! html/parsoid
23675 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23676 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23677 <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>
23678 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23679 '<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>
23680 '<i>foo</i> <div title="name">test</div>
23681 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23682 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23683 <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>
23684 </ol>
23685 !! wikitext
23686 '''a'' foo ''[[bar]]''
23687 ''a''' foo ''[[bar]]''
23688 ''a''' foo '''{{echo|[[bar]]}}'''
23689 [[foo]] x'''[[bar]]''
23690 '''foo'' <ref>test</ref>
23691 '''foo'' <div title="name">test</div>
23692 '''foo'' and <br> bar
23693 <references />
23694 !! end
23695
23696 !! test
23697 2. Link fragments separated by <i> and <b> tags
23698 !! options
23699 parsoid=html2wt
23700 !! html/parsoid
23701 <p>[[<i>foo</i>hello]]</p>
23702 <p>[[<b>foo</b>hello]]</p>
23703 !! wikitext
23704 [[''foo''<nowiki>hello]]</nowiki>
23705
23706 [['''foo'''<nowiki>hello]]</nowiki>
23707 !! end
23708
23709 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23710 # this is one of the shortcomings of this format
23711 !! test
23712 3. Link fragments inside <i> and <b>
23713 !! options
23714 parsoid=html2wt
23715 !! html/parsoid
23716 <p><i>[[foo</i>]]</p>
23717 <p><b>[[foo</b>]]</p>
23718 !! wikitext
23719 ''[[foo''<nowiki>]]</nowiki>
23720
23721 '''[[foo'''<nowiki>]]</nowiki>
23722 !! end
23723
23724 !! test
23725 4. No escaping needed
23726 !! options
23727 options=html2wt
23728 !! html/parsoid
23729 <p>'<span><i>bar</i></span>'
23730 '<span><b>bar</b></span>'
23731 'a:b'foo
23732 </p>
23733 !! wikitext
23734 '<span>''bar''</span>'
23735 '<span>'''bar'''</span>'
23736 'a:b'foo
23737 !! end
23738
23739 #### ----------- Paragraphs ---------------
23740 #### 1. No unnecessary escapes
23741 #### --------------------------------------
23742
23743 !! test
23744 1. No unnecessary escapes
23745 !! options
23746 parsoid=html2wt
23747 !! html/parsoid
23748 <p>bar <span>[[foo]]</span>
23749 </p><p>=bar <span>[[foo]]</span>
23750 </p><p>[[bar <span>[[foo]]</span>
23751 </p><p>]]bar <span>[[foo]]</span>
23752 </p><p>=bar <span>foo]]</span>=
23753 </p>
23754 !! wikitext
23755 bar <span><nowiki>[[foo]]</nowiki></span>
23756
23757 =bar <span><nowiki>[[foo]]</nowiki></span>
23758
23759 [[bar <span><nowiki>[[foo]]</nowiki></span>
23760
23761 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23762
23763 =bar <span>foo]]</span><nowiki>=</nowiki>
23764 !!end
23765
23766 #### ----------------------- PRE --------------------------
23767 #### 1. Leading whitespace in SOL context should be escaped
23768 #### ------------------------------------------------------
23769 !! test
23770 1. Leading whitespace in SOL context should be escaped
23771 !! options
23772 parsoid=html2wt
23773 !! html/parsoid
23774 <p> a</p>
23775
23776 <p> a</p>
23777
23778 <p> a(tab)</p>
23779
23780 <p> a
23781 <!--cmt-->
23782 a</p>
23783
23784 <p>a
23785 b</p>
23786
23787 <p>a
23788 b</p>
23789
23790 <p>a
23791 b</p>
23792 !! wikitext
23793 <nowiki> </nowiki>a
23794
23795 <nowiki> </nowiki> a
23796
23797 a(tab)
23798
23799 <nowiki> </nowiki> a
23800 <!--cmt-->
23801 <nowiki> </nowiki>a
23802
23803 a
23804 <nowiki> </nowiki>b
23805
23806 a
23807 b
23808
23809 a
23810 b
23811 !! html/php
23812 <p> a
23813 </p><p> a
23814 </p><p> a(tab)
23815 </p><p> a
23816 a
23817 </p><p>a
23818 b
23819 </p><p>a
23820 b
23821 </p><p>a
23822 b
23823 </p>
23824 !! end
23825
23826 !! test
23827 2. Leading whitespace in non-indent-pre contexts should not be escaped
23828 !! options
23829 parsoid=html2wt
23830 !! html/parsoid
23831 <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>
23832 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23833 <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>
23834 b</span></li>
23835 </ol>
23836 !! wikitext
23837 foo <ref>''a''
23838 b</ref>
23839 <references />
23840 !! end
23841
23842 !! test
23843 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23844 !! options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 <blockquote>
23848 <p>
23849 a
23850 <span>b</span>
23851 c</p>
23852 </blockquote>
23853 !! wikitext
23854 <blockquote>
23855 a
23856 <span>b</span>
23857 c
23858 </blockquote>
23859 !! end
23860
23861 !! test
23862 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23863 !! options
23864 options=html2wt
23865 !! html/parsoid
23866 <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>
23867 !! wikitext
23868 [[File:Foobar.jpg|thumb|caption]]
23869 !! end
23870
23871 !! test
23872 5. Nowiki escaping should account for indent-pres
23873 !! options
23874 parsoid=html2wt
23875 !! html/parsoid
23876 <pre>==foo==</pre>
23877 !! wikitext
23878 ==foo==
23879 !! end
23880
23881 !!test
23882 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23883 !! options
23884 parsoid=html2wt
23885 !! html/parsoid
23886 <pre>
23887 * foo
23888 * bar
23889 </pre>
23890 !! wikitext
23891 * foo
23892 * bar
23893 !! end
23894
23895 #### --------------- Behavior Switches --------------------
23896
23897 !! test
23898 1. Valid behavior switches should be escaped
23899 !! options
23900 parsoid=html2wt
23901 !! html/parsoid
23902 __TOC__
23903 <i>__TOC__</i>
23904 !! wikitext
23905 <nowiki>__TOC__</nowiki>
23906 ''<nowiki>__TOC__</nowiki>''
23907 !! end
23908
23909 !! test
23910 2. Invalid behavior switches should not be escaped
23911 !! options
23912 parsoid=html2wt
23913 !! html/parsoid
23914 __TOO__
23915 __|__
23916 !! wikitext
23917 __TOO__
23918 __|__
23919 !! end
23920
23921 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23922 !! test
23923 Behavior switches should be SOL-transparent
23924 !! options
23925 parsoid=html2wt
23926 !! html/parsoid
23927 <meta property="mw:PageProp/toc" />
23928
23929 <!-- this one's bogus -->
23930 <pre>__TOO__</pre>
23931
23932 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23933
23934 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23935 !! wikitext
23936 __TOC__
23937
23938 <!-- this one's bogus -->
23939 __TOO__
23940
23941 __TOC__ foo
23942
23943 __TOC__
23944 bar
23945 !! end
23946
23947 #### --------------- HTML tags ---------------
23948 #### 1. a tags
23949 #### 2. other tags
23950 #### 3. multi-line html tag
23951 #### 4. extension tags
23952 #### -----------------------------------------
23953 !! test
23954 1. a tags
23955 !! options
23956 parsoid=html2wt
23957 !! html/parsoid
23958 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23959 !! wikitext
23960 <a href="http://google.com">google</a>
23961 !! end
23962
23963 !! test
23964 2. other tags
23965 !! options
23966 parsoid=html2wt
23967 !! html/parsoid
23968 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23969 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23970 <li> &lt;td&gt;</li></ul>
23971
23972 !! wikitext
23973 * <nowiki><div>foo</div></nowiki>
23974 * <nowiki><div style="color:red">foo</div></nowiki>
23975 * <nowiki><td></nowiki>
23976 !! end
23977
23978 !! test
23979 3. multi-line html tag
23980 !! options
23981 parsoid=html2wt
23982 !! html/parsoid
23983 <p>&lt;div
23984 &gt;foo&lt;/div
23985 &gt;
23986 </p>
23987 !! wikitext
23988 <nowiki><div
23989 >foo</div
23990 ></nowiki>
23991 !! end
23992
23993 !! test
23994 4. extension tags
23995 !! options
23996 parsoid=html2wt
23997 !! html/parsoid
23998 <p>&lt;ref&gt;foo&lt;/ref&gt;
23999 </p><p>&lt;ref&gt;bar
24000 </p><p>baz&lt;/ref&gt;
24001 </p>
24002 !! wikitext
24003 <nowiki><ref>foo</ref></nowiki>
24004
24005 <nowiki><ref>bar</nowiki>
24006
24007 baz<nowiki></ref></nowiki>
24008 !! end
24009
24010 #### --------------- Others ---------------
24011 !! test
24012 Escaping nowikis
24013 !! options
24014 parsoid=html2wt
24015 !! html/parsoid
24016 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24017 </p>
24018 !! wikitext
24019 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24020 !! end
24021
24022 ## The quote-char in the input is necessary for triggering the bug
24023 !! test
24024 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24025 !! options
24026 parsoid=html2wt
24027 !! html/parsoid
24028 <p>foo's bar :</p>
24029 !! wikitext
24030 foo's bar :
24031 !! end
24032
24033 #----------- End of wikitext escaping tests --------------
24034
24035 !! test
24036
24037 Tag-like HTML structures are passed through as text
24038 !! wikitext
24039 <x y>
24040
24041 <x.y>
24042
24043 <x-y>
24044
24045 1>2
24046
24047 x<y
24048
24049 a>b
24050
24051 1<d e>f
24052 !! html
24053 <p>&lt;x y&gt;
24054 </p><p>&lt;x.y&gt;
24055 </p><p>&lt;x-y&gt;
24056 </p><p>1&gt;2
24057 </p><p>x&lt;y
24058 </p><p>a&gt;b
24059 </p><p>1&lt;d e&gt;f
24060 </p>
24061 !! end
24062
24063 !! test
24064 HTML tag with necessary entities in attributes
24065 !! wikitext
24066 <span title="&amp;amp;">foo</span>
24067 !! html
24068 <p><span title="&amp;amp;">foo</span>
24069 </p>
24070 !! end
24071
24072 !! test
24073 HTML tag with 'unnecessary' entity encoding in attributes
24074 !! wikitext
24075 <span title="&amp;">foo</span>
24076 !! html
24077 <p><span title="&amp;">foo</span>
24078 </p>
24079 !! end
24080
24081 !! test
24082 HTML tag with broken attribute value quoting
24083 !! options
24084 parsoid=wt2html,html2html
24085 !! wikitext
24086 <span title="Hello world>Foo</span>
24087 !! html/php
24088 <p><span title="Hello world">Foo</span>
24089 </p>
24090 !! html/parsoid
24091 <p><span title="Hello world">Foo</span></p>
24092 !! end
24093
24094 !! test
24095 Self-closed tag with broken attribute value quoting
24096 !! options
24097 parsoid=wt2html,html2html
24098 !! wikitext
24099 <div title="Hello world />Foo
24100 !! html/php+tidy
24101 <div title="Hello world"></div>
24102 <p>Foo</p>
24103 !! html/parsoid
24104 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24105 !! end
24106
24107 !! test
24108 Table with broken attribute value quoting
24109 !! options
24110 parsoid=wt2html,html2html
24111 !! wikitext
24112 {|
24113 | title="Hello world|Foo
24114 |}
24115 !! html/php
24116 <table>
24117 <tr>
24118 <td title="Hello world">Foo
24119 </td></tr></table>
24120
24121 !! html/parsoid
24122 <table>
24123 <tr>
24124 <td title="Hello world">Foo
24125 </td></tr></table>
24126
24127 !! end
24128
24129 !! test
24130 Table with broken attribute value quoting on consecutive lines
24131 !! options
24132 parsoid=wt2html,html2html
24133 !! wikitext
24134 {|
24135 | title="Hello world|Foo
24136 | style="color:red|Bar
24137 |}
24138 !! html/php
24139 <table>
24140 <tr>
24141 <td title="Hello world">Foo
24142 </td>
24143 <td style="color:red">Bar
24144 </td></tr></table>
24145
24146 !! html/parsoid
24147 <table><tbody>
24148 <tr>
24149 <td title="Hello world">Foo
24150 </td><td style="color: red">Bar
24151 </td></tr></tbody></table>
24152
24153 !! end
24154
24155 !!test
24156 Accept empty td cell attribute
24157 !! wikitext
24158 {|
24159 | align="center" | foo || |
24160 |}
24161 !! html
24162 <table>
24163 <tr>
24164 <td align="center"> foo </td>
24165 <td>
24166 </td></tr></table>
24167
24168 !!end
24169
24170 !!test
24171 Non-empty attributes in th-cells
24172 !! wikitext
24173 {|
24174 ! Foo !! style="color: red" | Bar
24175 |}
24176 !! html
24177 <table>
24178 <tr>
24179 <th> Foo </th>
24180 <th style="color: red"> Bar
24181 </th></tr></table>
24182
24183 !!end
24184
24185 !!test
24186 Accept empty attributes in th-cells
24187 !! wikitext
24188 {|
24189 !| foo !!| bar
24190 |}
24191 !! html
24192 <table>
24193 <tr>
24194 <th> foo </th>
24195 <th> bar
24196 </th></tr></table>
24197
24198 !!end
24199
24200 !!test
24201 Empty table rows go away
24202 !! wikitext
24203 {|
24204 | Hello
24205 | there
24206 |- class="foo"
24207 |-
24208 |}
24209 !! html
24210 <table>
24211 <tr>
24212 <td> Hello
24213 </td>
24214 <td> there
24215 </td></tr>
24216
24217 </table>
24218
24219 !! end
24220
24221 ###
24222 ### Parsoid-centric tests for testing RTing of inter-element separators
24223 ### Edge cases not tested by existing parser tests and specific to
24224 ### Parsoid-specific serialization strategies.
24225 ###
24226
24227 !!test
24228 RT-ed inter-element separators should be valid separators
24229 !! wikitext
24230 {|
24231 |- [[foo]]
24232 |}
24233 !! html/php
24234 <table>
24235
24236 </table>
24237
24238 !! html/parsoid
24239 <table>
24240 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24241 </tbody></table>
24242 !!end
24243
24244 # Parsoid-only since PHP parser relies on Tidy for correct output
24245 !!test
24246 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24247 !!options
24248 parsoid
24249 !! wikitext
24250 {|
24251 |<small>foo
24252 bar
24253 |}
24254
24255 {|
24256 |<small>foo<small>
24257 |}
24258 !! html
24259 <table>
24260 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24261 <p>bar</p></small></td></tr>
24262 </tbody></table>
24263
24264 <table>
24265 <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>
24266 </tbody></table>
24267 !!end
24268
24269 # Note that the "style" attribute is really a template parameter here.
24270 # The = would have to be {{=}} if you wanted the literal.
24271 !!test
24272 Empty TD followed by TD with tpl-generated attribute
24273 !! wikitext
24274 {|
24275 |-
24276 |
24277 |{{echo|style='color:red'}}|foo
24278 |}
24279 !! html
24280 <table>
24281
24282 <tr>
24283 <td>
24284 </td>
24285 <td>foo
24286 </td></tr></table>
24287
24288 !!end
24289
24290 !!test
24291 Indented table with an empty td
24292 !! wikitext
24293 {|
24294 |-
24295 |
24296 |foo
24297 |}
24298 !! html
24299 <table>
24300
24301 <tr>
24302 <td>
24303 </td>
24304 <td>foo
24305 </td></tr></table>
24306
24307 !!end
24308
24309 ## We have some newline diffs RT-ing this edge case
24310 ## and it is not important enough -- we seem to be emitting
24311 ## at most 2 newlines after a </tr> and this is unrelated to
24312 ## the issue from T85627 that this is testing.
24313 !!test
24314 Indented table with blank lines in between (T85627)
24315 !! options
24316 parsoid=wt2html
24317 !! wikitext
24318 {|
24319 |foo
24320
24321
24322 |}
24323 !! html
24324 <table>
24325
24326 <tr>
24327 <td>foo
24328 </td></tr></table>
24329
24330 !!end
24331
24332 !!test
24333 Indented block & table
24334 !! wikitext
24335 <div>foo</div>
24336 {|
24337 |foo
24338 |}
24339 !! html/php
24340 <div>foo</div>
24341 <table>
24342 <tr>
24343 <td>foo
24344 </td></tr></table>
24345
24346 !! html/parsoid
24347 <div data-parsoid='{"stx":"html"}'>foo</div>
24348 <table><tbody>
24349 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24350 </tbody></table>
24351 !!end
24352
24353 !! test
24354 Indent and comment before table row
24355 !! wikitext
24356 {|
24357 <!--hi-->|-
24358 | there
24359 |}
24360 !! html/php
24361 <table>
24362
24363 <tr>
24364 <td> there
24365 </td></tr></table>
24366
24367 !! html/parsoid
24368 <table>
24369 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24370 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24371 </tbody></table>
24372 !! end
24373
24374 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24375 !!test
24376 Empty TR followed by a template-generated TR
24377 !!options
24378 parsoid
24379 !! wikitext
24380 {|
24381 |-
24382 {{echo|<tr><td>foo</td></tr>}}
24383 |}
24384 !! html
24385 <table>
24386 <tbody>
24387 <tr></tr>
24388 <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}}]}'>
24389 <td>foo</td></tr>
24390 </tbody></table>
24391 !!end
24392
24393 ## PHP and parsoid output differ for this, and since this is primarily
24394 ## for testing Parsoid's serializer, marking this Parsoid only
24395 !!test
24396 Empty TR followed by mixed-ws-comment line should RT correctly
24397 !!options
24398 parsoid
24399 !! wikitext
24400 {|
24401 |-
24402 <!--c-->
24403 |-
24404 <!--c--> <!--d-->
24405 |}
24406 !! html
24407 <table>
24408 <tbody>
24409 <tr></tr>
24410 <!--c-->
24411 <tr>
24412 <!--c--> </tr><!--d-->
24413 </tbody></table>
24414
24415 !!end
24416
24417 !!test
24418 Multi-line image caption generated by templates with/without trailing newlines
24419 !! wikitext
24420 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24421 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24422 !! html/parsoid
24423 <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>
24424 <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>
24425 !!end
24426
24427 !! test
24428 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24429 !! options
24430 parsoid=html2wt
24431 !! html/parsoid
24432 <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>
24433
24434 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24435 !! wikitext
24436 <includeonly>foo</includeonly>
24437 new para
24438
24439 [[Category:Foo]]
24440
24441 = new heading =
24442 !! end
24443
24444 ## PHP emits broken html for this, and since this is primarily
24445 ## a Parsoid serializer test, marking this Parsoid only
24446 !!test
24447 Improperly nested inline or quotes tags with whitespace in between
24448 !! wikitext
24449 <span> <s>x</span> </s>
24450 ''' ''x''' ''
24451 !! html/parsoid
24452 <p><span> <s>x</s></span><s> </s>
24453 <b> <i>x</i></b><i> </i>
24454 </p>
24455 !!end
24456
24457 !!test
24458 Encapsulate protected attributes from wt
24459 !! wikitext
24460 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24461 !! html/parsoid
24462 <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>
24463 </body>
24464 !!end
24465
24466 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24467 ## Having nested or stray pre tags results in the attempt to add duplicates,
24468 ## causing an assertion fail. This test tries to prevent that situation.
24469 !!test
24470 Ensure ParagraphWrapper can deal with stray closing pre tags
24471 !!options
24472 parsoid=wt2html
24473 !! wikitext
24474 plain text</pre>
24475 !! html/parsoid
24476 plain text
24477 !!end
24478
24479 !!test
24480 1. Ensure fostered text content is wrapped in element nodes
24481 !!options
24482 parsoid=wt2html
24483 !! wikitext
24484 <table>hi</table><table>ho</table>
24485 !! html/parsoid
24486 <p>hi</p>
24487 <table></table>
24488 <p>ho</p>
24489 <table></table>
24490 !!end
24491
24492 !!test
24493 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24494 !!options
24495 parsoid=wt2html,wt2wt
24496 !! wikitext
24497 <table>
24498 <tr> || ||
24499 <td> a
24500 </table>
24501 !! html/parsoid
24502 <p> || ||
24503 </p><table>
24504 <tbody><tr><td> a</td></tr>
24505 </tbody></table>
24506 !!end
24507
24508 !!test
24509 Encapsulation properly handles null DSR information from foster box
24510 !!options
24511 parsoid=wt2html,wt2wt
24512 !! wikitext
24513 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24514 !! html/parsoid
24515 <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>
24516 !!end
24517
24518 !!test
24519 1. Encapsulate foster-parented transclusion content
24520 !!options
24521 parsoid=wt2wt,wt2html
24522 !! wikitext
24523 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24524 !! html/parsoid
24525 <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>
24526 <tbody>
24527 <tr>
24528 <td>bar</td>
24529 </tr>
24530 </tbody>
24531 </table>
24532 !!end
24533
24534 !!test
24535 2. Encapsulate foster-parented transclusion content
24536 !!options
24537 parsoid=wt2wt,wt2html
24538 !! wikitext
24539 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24540 !! html/parsoid
24541 <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>
24542 <table>
24543 <tbody>
24544 <tr>
24545 <td>bar</td>
24546 </tr>
24547 </tbody>
24548 </table>
24549 !!end
24550
24551 !!test
24552 3. Encapsulate foster-parented transclusion content
24553 !!options
24554 parsoid=wt2wt,wt2html
24555 !! wikitext
24556 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24557 !! html/parsoid
24558 <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;]}">
24559 <p>foo</p>
24560 </div>
24561 <table>
24562 <tbody>
24563 <tr>
24564 <td>bar</td>
24565 </tr>
24566 </tbody>
24567 </table>
24568 !!end
24569
24570 !!test
24571 4. Encapsulate foster-parented transclusion content
24572 !!options
24573 parsoid=wt2wt,wt2html
24574 !! wikitext
24575 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24576 !! html/parsoid
24577 <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;]}">
24578 <p>foo</p>
24579 </div>
24580 <table>
24581 <tbody>
24582 <tr>
24583 <td>bar</td>
24584 </tr>
24585 </tbody>
24586 </table>
24587 !!end
24588
24589 !!test
24590 5. Encapsulate foster-parented transclusion content
24591 !!options
24592 parsoid=wt2wt,wt2html
24593 !! wikitext
24594 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24595 !! html/parsoid
24596 <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>
24597 <table>
24598 <tbody>
24599 <tr>
24600 <td>
24601 <div>
24602 <p>foo</p>
24603 </div>
24604 </td>
24605 </tr>
24606 </tbody>
24607 </table>
24608 !!end
24609
24610 !!test
24611 6. Encapsulate foster-parented transclusion content
24612 !!options
24613 parsoid=wt2wt,wt2html
24614 !! wikitext
24615 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24616 !! html/parsoid
24617 <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>
24618 <table>
24619 <tbody>
24620 <tr>
24621 <td>
24622 <div>
24623 <p>foo</p>
24624 </div>
24625 </td>
24626 </tr>
24627 </tbody>
24628 </table>
24629 <p>ok</p>
24630 !!end
24631
24632 !!test
24633 7. Encapsulate foster-parented transclusion content
24634 !!options
24635 parsoid=wt2wt,wt2html
24636 !! wikitext
24637 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24638 !! html/parsoid
24639 <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>
24640 <table>
24641 <tbody>
24642 <tr>
24643 <td>bar</td>
24644 </tr>
24645 </tbody>
24646 </table>
24647 !!end
24648
24649 # Note that the wt is broken on purpose: the = should be {{=}} if you
24650 # don't want it to be a template parameter key.
24651 !!test
24652 8. Encapsulate foster-parented transclusion content
24653 !!options
24654 parsoid=wt2wt,wt2html
24655 !! wikitext
24656 {{echo|a
24657 }}{|{{echo|style='color:red'}}
24658 |-
24659 |b
24660 |}
24661 !! html/parsoid
24662 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24663 <span> </span>
24664 <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>
24665 <table>
24666 <tbody>
24667 <tr>
24668 <td>b</td>
24669 </tr>
24670 </tbody>
24671 </table>
24672 !!end
24673
24674 !!test
24675 9. Encapsulate foster-parented transclusion content
24676 !!options
24677 parsoid=wt2wt,wt2html
24678 !! wikitext
24679 <table>{{echo|hi</table>hello}}
24680 !! html/parsoid
24681 <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>
24682 !!end
24683
24684 !!test
24685 Table in fosterable position
24686 !!options
24687 parsoid=wt2html
24688 !! wikitext
24689 {{OpenTable}}
24690 <div>
24691 {|
24692 |}
24693 </div>
24694 |}
24695 !! html/parsoid
24696 <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">
24697 </span>
24698 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24699
24700 <table>
24701 </table>
24702 !!end
24703
24704 # Parsoid only for bug 64747
24705 !! test
24706 Properly encapsulate empty-content transclusions in fosterable positions
24707 !! wikitext
24708 <table>
24709 {{#if:|
24710 <td>foo</td>
24711 }}
24712 </table>
24713 !! html/parsoid
24714 <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"}]]}'>
24715
24716 </table>
24717 !! end
24718
24719 !! test
24720 Always encapsulate foster box when template range is expanded to table
24721 !! options
24722 parsoid=wt2wt
24723 !! wikitext
24724 {|
24725 hello
24726 {{OpenTable}}
24727 |}
24728 !! html/parsoid
24729
24730 !! end
24731
24732 !! test
24733 T115289: Unclosed table
24734 !! wikitext
24735 {{echo|<table>}}<!--c-->[[Category:Two]]
24736 !! html/parsoid
24737 <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>
24738 !! end
24739
24740 !! test
24741 T115289: Don't migrate newlines out of tables with fostered content
24742 !! wikitext
24743 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24744 !! html/parsoid
24745 <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>
24746 !! end
24747
24748 !! test
24749 T73074: More fostering fun
24750 !! wikitext
24751 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24752 !! html/parsoid
24753 <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>
24754 !! end
24755
24756 !!test
24757 Support <object> element with .data attribute
24758 !!options
24759 parsoid=html2wt
24760 !! html/parsoid
24761 <object data="test.swf"></object>
24762 !! wikitext
24763 <object data="test.swf"></object>
24764 !!end
24765
24766 !! test
24767 Don't block XML namespace declaration
24768 !! wikitext
24769 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24770 !! html/php
24771 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24772 </p>
24773 !! html/parsoid
24774 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24775 !! end
24776
24777 # -----------------------------------------------------------------
24778 # The following section of tests are primarily to spec requirements
24779 # around serialization of new/edited content.
24780 #
24781 # All these tests are marked Parsoid html2wt and html2html only
24782 # ----------------------------------------------------------------
24783
24784 # 'mi' is a localinterwiki prefix as well as a language
24785 !! test
24786 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24787 !! options
24788 parsoid=html2wt
24789 !! html/parsoid
24790 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24791 !! wikitext
24792 [[Foo]]
24793 !! end
24794
24795 # See T93839
24796 !! test
24797 New wikilinks should be serialized properly
24798 !! options
24799 parsoid=html2wt
24800 !! html/parsoid
24801 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24802 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24803 !! wikitext
24804 [[Foo]]
24805 [[Foo]]
24806 !! end
24807
24808 !! test
24809 New wiki links (href variations)
24810 !! options
24811 parsoid=html2wt
24812 !! html/parsoid
24813 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24814 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24815 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24816 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24817 !! wikitext
24818 [[Foo_bar]]
24819 [[Foo_bar]]
24820 [[Foo_bar]]
24821 [[Toxine bactérienne]]
24822 !! end
24823
24824 !! test
24825 New wiki links (content string variations)
24826 !! options
24827 parsoid=html2wt
24828 !! html/parsoid
24829 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24830 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24831 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24832 !! wikitext
24833 [[Foo_bar]]
24834 [[Foo bar]]
24835 [[Foo_bar|./Foo_bar]]
24836 !! end
24837
24838 !! test
24839 New category links (href variations)
24840 !! options
24841 parsoid=html2wt
24842 !! html/parsoid
24843 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24844 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24845 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24846 !! wikitext
24847 [[Category:Toxine bactérienne]]
24848 [[Category:Toxine bactérienne]]
24849 [[Category:Toxine bactérienne]]
24850 !! end
24851
24852 !! test
24853 New sol transparent links don't need indent-pre nowiki protection
24854 !! options
24855 parsoid=html2wt
24856 language=de
24857 !! html/parsoid
24858 <link rel="mw:PageProp/redirect" href="./Main_Page">
24859 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24860 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24861 !! wikitext
24862 #WEITERLEITUNG [[Main Page]]
24863 <!-- this is good --> [[Category:Good]]
24864 <!-- this is great --> [[Kategorie:Great]]
24865 !! end
24866
24867 !! test
24868 New interlanguage links (href variations)
24869 !! options
24870 parsoid=html2wt
24871 !! html/parsoid
24872 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24873 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24874 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24875 !! wikitext
24876 [[es:Toxine bactérienne]]
24877 [[es:Toxine_bactérienne]]
24878 [[es:Toxine_bactérienne]]
24879 !! end
24880
24881 !! test
24882 Image: Modifying size of an image (1)
24883 !! options
24884 parsoid={
24885 "modes": ["wt2wt"],
24886 "changes": [
24887 ["img[height]", "attr", "height", "22"],
24888 ["img[width]", "attr", "width", "200"]
24889 ]
24890 }
24891 !! wikitext
24892 [[Image:Foobar.jpg|230x230px]]
24893 !! wikitext/edited
24894 [[Image:Foobar.jpg|200x200px]]
24895 !!end
24896
24897 !! test
24898 Image: Modifying size of an image (2)
24899 !! options
24900 parsoid={
24901 "modes": ["wt2wt"],
24902 "changes": [
24903 ["img[height]", "attr", "height", "100"],
24904 ["img[width]", "attr", "width", "500"]
24905 ]
24906 }
24907 !! wikitext
24908 [[Image:Foobar.jpg|230x230px]]
24909 !! wikitext/edited
24910 [[Image:Foobar.jpg|500x500px]]
24911 !!end
24912
24913 # Change in size is ignored so long as class='mw-default-size'
24914 !! test
24915 Image: Modifying size of an image (3)
24916 !! options
24917 parsoid={
24918 "modes": ["wt2wt"],
24919 "changes": [
24920 ["figure[class]", "removeClass", "mw-default-size"],
24921 ["figure img", "attr", "height", "19"],
24922 ["figure img", "attr", "width", "170"]
24923 ]
24924 }
24925 !! wikitext
24926 [[Image:Foobar.jpg|thumb]]
24927 !! wikitext/edited
24928 [[Image:Foobar.jpg|thumb|170x170px]]
24929 !!end
24930
24931 !! test
24932 Image: Modifying alignment of an image (bug 48665)
24933 !! options
24934 parsoid={
24935 "modes": ["wt2wt"],
24936 "changes": [
24937 ["figure[class]", "removeClass", "mw-halign-right"],
24938 ["figure[class]", "addClass", "mw-halign-left"]
24939 ]
24940 }
24941 !! wikitext
24942 [[Image:Foobar.jpg|thumb|caption|right]]
24943 !! wikitext/edited
24944 [[Image:Foobar.jpg|thumb|caption|left]]
24945 !! end
24946
24947 !! test
24948 Image: Modifying mw-default-size of an frameless image (bug 62805)
24949 !! options
24950 parsoid={
24951 "modes": ["wt2wt"],
24952 "changes": [
24953 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24954 ]
24955 }
24956 !! wikitext
24957 [[Image:Foobar.jpg|frameless|right]]
24958 !! wikitext/edited
24959 [[Image:Foobar.jpg|frameless|right|220x220px]]
24960 !! end
24961
24962 !! test
24963 Image: Modifying valign of an image (bug 49221)
24964 !! options
24965 parsoid={
24966 "modes": ["wt2wt"],
24967 "changes": [
24968 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24969 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24970 ]
24971 }
24972 !! wikitext
24973 [[File:Foobar.jpg|20px|middle]]
24974 !! wikitext/edited
24975 [[File:Foobar.jpg|20px|text-top]]
24976 !! end
24977
24978 !! test
24979 Image: Modifying alt attribute of an image (bug 56400)
24980 !! options
24981 parsoid={
24982 "modes": ["wt2wt"],
24983 "changes": [
24984 ["img[alt]", "attr", "alt", "some alternate edited text"]
24985 ]
24986 }
24987 !! wikitext
24988 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24989 !! wikitext/edited
24990 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24991 !!end
24992
24993 !! test
24994 Image: Modifying caption of an image
24995 !! options
24996 parsoid={
24997 "modes": ["wt2wt"],
24998 "changes": [
24999 ["figcaption", "text", "new caption"]
25000 ]
25001 }
25002 !! wikitext
25003 [[Image:Foobar.jpg|thumb|original caption]]
25004 !! wikitext/edited
25005 [[Image:Foobar.jpg|thumb|new caption]]
25006 !!end
25007
25008 !! test
25009 Image: empty alt attribute (bug 48924)
25010 !! options
25011 parsoid
25012 !! wikitext
25013 [[File:Foobar.jpg|thumb|alt=|bar]]
25014 !! html
25015 <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>
25016 !! end
25017
25018 !! test
25019 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25020 !! options
25021 parsoid=html2wt
25022 language=ar
25023 disabled
25024 !! html/parsoid
25025 <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>
25026 !! wikitext
25027 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25028 !! end
25029
25030 !! test
25031 Image: Block level image should have \n before and after
25032 !! wikitext
25033 123
25034 [[File:Foobar.jpg|right|thumb|150x150px]]
25035 456
25036 !! html/parsoid
25037 <p>123</p>
25038 <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>
25039 <p>456</p>
25040 !!end
25041
25042 !! test
25043 Image: New block level image should have \n before and after (existing content)
25044 !! wikitext
25045 123
25046 [[File:Foobar.jpg|right|thumb|150x150px]]
25047 456
25048 !! html/parsoid
25049 <p>123</p>
25050 <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>
25051 <p>456</p>
25052 !!end
25053
25054 !! test
25055 Image: upright option (parsoid)
25056 !! wikitext
25057 [[File:Foobar.jpg|thumb|upright|caption]]
25058 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25059 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25060 !! html/parsoid
25061 <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>
25062 <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>
25063 <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>
25064 !!end
25065
25066 !! test
25067 Image: upright option is ignored on inline and frame images (parsoid)
25068 !! wikitext
25069 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25070 !! html/parsoid
25071 <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>
25072 !!end
25073
25074 !! test
25075 Image: from basic HTML (1)
25076 !! options
25077 parsoid=html2wt
25078 !! html/parsoid
25079 <span typeof="mw:Image">
25080 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25081 </span>
25082 !! wikitext
25083 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25084 !! end
25085
25086 !! test
25087 Image: from basic HTML (2)
25088 !! options
25089 parsoid=html2wt
25090 !! html/parsoid
25091 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25092 !! wikitext
25093 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25094 !! end
25095
25096 !! test
25097 Image: from basic HTML (3)
25098 !! options
25099 parsoid=html2wt
25100 !! html/parsoid
25101 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25102 !! wikitext
25103 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25104 !! end
25105
25106 !! test
25107 Image: from basic HTML (4)
25108 !! options
25109 parsoid=html2wt
25110 !! html/parsoid
25111 <img src="./File:Foobar.jpg">
25112 !! wikitext
25113 [[File:Foobar.jpg|link=]]
25114 !! end
25115
25116 !! test
25117 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25118 !! options
25119 parsoid=html2wt
25120 !! html/parsoid
25121 <ul>
25122 <li><p>foo</p></li>
25123 </ul>
25124 !! wikitext
25125 * foo
25126 !! end
25127
25128 !! test
25129 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25130 !! options
25131 parsoid=html2wt
25132 !! html/parsoid
25133 <ul> <li>foo</li></ul>
25134 !! wikitext
25135 * foo
25136 !! end
25137
25138 !! test
25139 Don't strip leading whitespace when handling indent-pre suppressing tags
25140 !! options
25141 parsoid=html2wt
25142 !! html/parsoid
25143 <table>
25144 <tr><td> indented row</td></tr>
25145 </table>
25146 <blockquote><p>
25147 <b>This is very bold of you!</b>
25148 </p>
25149 <table><tr><td>
25150 indented cell (no pre-wrapping!)
25151 </td></tr></table>
25152 </blockquote>
25153 <p>foo</p>
25154 <div>bar</div>
25155 !! wikitext
25156 {|
25157 | indented row
25158 |}
25159 <blockquote>
25160 '''This is very bold of you!'''
25161
25162 {|
25163 |
25164 indented cell (no pre-wrapping!)
25165 |}
25166 </blockquote>
25167 foo
25168 <div>bar</div>
25169 !! end
25170
25171 !! test
25172 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25173 !! options
25174 parsoid=html2wt
25175 !! html/parsoid
25176 <p>foo</p>
25177 <span>bar</span>
25178
25179 <span>foo2
25180 </span>bar2
25181
25182 <div>foo</div>
25183 <span>bar</span>
25184
25185 <div>
25186 <span>foo</span>
25187 </div>
25188 !! wikitext
25189 foo
25190
25191 <span>bar</span>
25192
25193 <span>foo2
25194 <nowiki> </nowiki></span>bar2
25195
25196 <div>foo</div>
25197 <nowiki> </nowiki><span>bar</span>
25198
25199 <div>
25200 <nowiki> </nowiki><span>foo</span>
25201 </div>
25202 !! end
25203
25204 !! test
25205 Lists: Dont insert newlines in a serialized list item.
25206 !! options
25207 parsoid=html2wt
25208 !! html/parsoid
25209 <ul><li>a<br>b</li><li>c</li></ul>
25210 !! wikitext
25211 * a<br>b
25212 * c
25213 !! end
25214
25215 !! test
25216 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25217 !! options
25218 parsoid={
25219 "modes": ["html2wt"],
25220 "scrubWikitext": false
25221 }
25222 !! html/parsoid
25223 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25224 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25225
25226 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25227 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25228
25229 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25230
25231 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25232 !! wikitext
25233 == hello there [[Category:A1]] ==
25234
25235 == [[Category:A2]] hi pal ==
25236
25237 == <!--foo--> [[Category:A3]] how goes it ==
25238
25239 == it goes well [[Category:A4]] <!--bar--> ==
25240
25241 ==howdy [[Category:A5]]==
25242
25243 == __TOC__ ok ==
25244 !! end
25245
25246 !! test
25247 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25248 !! options
25249 parsoid={
25250 "modes": ["html2wt"],
25251 "scrubWikitext": true
25252 }
25253 !! html/parsoid
25254 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25255 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25256
25257 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25258 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25259
25260 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25261 !! wikitext
25262 == hello there ==
25263 [[Category:A1]]
25264 [[Category:A2]]
25265
25266 == hi pal ==
25267
25268 <!--foo--> [[Category:A3]]
25269
25270 == how goes it ==
25271
25272 == it goes well ==
25273 [[Category:A4]] <!--bar-->
25274
25275 __TOC__
25276
25277 == ok ==
25278 !! end
25279
25280 !! test
25281 Headings: Don't hoist metas that come from templates
25282 !! options
25283 parsoid={
25284 "modes": ["html2wt"],
25285 "scrubWikitext": true
25286 }
25287 !! html/parsoid
25288 <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>
25289 !! wikitext
25290 == {{echo|foo [[Category:Foo]]}} ==
25291 !! end
25292
25293 !! test
25294 Headings: Category in ref isn't hoisted
25295 !! options
25296 parsoid={
25297 "modes": ["html2wt"],
25298 "scrubWikitext": true
25299 }
25300 !! html/parsoid
25301 <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>
25302
25303 <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>
25304 !! wikitext
25305 == foo <ref>bar
25306 [[Category:Baz]] </ref> ==
25307
25308 <references />
25309 !! end
25310
25311 !! test
25312 Parsoid: Serialize positional parameters with = in them as named parameter
25313 !! options
25314 parsoid=html2wt
25315 !! html/parsoid
25316 <p about="#mwt1" typeof="mw:Transclusion"
25317 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25318
25319 <p about="#mwt1" typeof="mw:Transclusion"
25320 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25321
25322 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25323 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25324 <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>
25325 !! wikitext
25326 {{echo|1=f=oo}}
25327
25328 {{echo|1=f=oo|2=bar}}
25329
25330 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25331 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25332 {{echo|<nowiki>f=oo</nowiki>|bar}}
25333 !! end
25334
25335 !! test
25336 Parsoid: Serialize positional parameters with = in extlink as named parameter
25337 !! options
25338 parsoid=html2wt
25339 !! html/parsoid
25340 <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>
25341 !! wikitext
25342 {{echo|1=http://stuff?is=ok}}
25343 !! end
25344
25345 !! test
25346 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25347 !! options
25348 parsoid=html2wt
25349 !! html/parsoid
25350 <div>a<p>b</p></div>
25351 <div>a
25352 <p>b</p></div>
25353 <div>
25354 a
25355 <p>b</p></div>
25356 !! wikitext
25357 <div>a
25358 b
25359 </div>
25360 <div>a
25361 b
25362 </div>
25363 <div>
25364 a
25365
25366 b
25367 </div>
25368 !! end
25369
25370 !! test
25371 Substrings resembling wikitext in hrefs should not get nowiki escapes
25372 !! options
25373 parsoid=html2wt
25374 !! html/parsoid
25375 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25376 !! wikitext
25377 [[Foo''bar''baz]]
25378 !! end
25379
25380 !! test
25381 Enforce single-line context in the serializer
25382 !! options
25383 parsoid=html2wt
25384 !! html/parsoid
25385 <h2>testing
25386 123</h2>
25387
25388 <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">
25389 </span><span about="#mwt1">you</span> </h2>
25390
25391 <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>
25392
25393 <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
25394 there</span></li></ol>
25395
25396 <ul><li>asd
25397 sdf</li></ul>
25398
25399 <ul><li>foo
25400 bar
25401 baz</li>
25402 <li>foo <b>bar</b>
25403 baz</li></ul>
25404
25405 <dl><dt>hi
25406 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25407 ho</dd></dl>
25408
25409 <dl><dd> <table>
25410 <tbody><tr><td> ha
25411 ha
25412 ha</td></tr>
25413 </tbody></table></dd></dl>
25414 !! wikitext
25415 == testing 123 ==
25416
25417 == hi {{bogus|there
25418 you}} ==
25419
25420 == foo <ref>hello
25421 there</ref> ==
25422
25423 <references />
25424
25425 * asd sdf
25426
25427 * foo bar baz
25428 * foo '''bar''' baz
25429
25430 ; hi ho : hi ho
25431
25432 : {|
25433 | ha
25434 ha
25435 ha
25436 |}
25437 !! end
25438
25439 !! test
25440 Serialize new placeholder space without spans
25441 !! options
25442 parsoid=html2wt
25443 !! html/parsoid
25444 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25445
25446 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25447
25448 <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>
25449 !! wikitext
25450 foo : bar
25451
25452 foo : bar
25453
25454 <ref>foo : bar</ref>ok
25455 !! end
25456
25457
25458 #-----------------------
25459 # Tag minimization tests
25460 #-----------------------
25461
25462 !! test
25463 1. I/B quote minimization: wikitext-only tags should be combined
25464 !! options
25465 parsoid=html2wt
25466 !! html/parsoid
25467 <p><i>A</i><i>B</i></p>
25468 <p><b>A</b><b>B</b></p>
25469 <p><i>A</i><b><i>B</i></b></p>
25470 <p><b>A</b><i><b>B</b></i></p>
25471 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25472 <p><i><b>A</b></i><i><b>B</b></i></p>
25473 <p><i><b>A</b></i><b><i>B</i></b></p>
25474 <p><b><i>A</i></b><i><b>B</b></i></p>
25475 !! wikitext
25476 ''AB''
25477
25478 '''AB'''
25479
25480 ''A'''B'''''
25481
25482 '''A''B'''''
25483
25484 '''A''BC''D'''
25485
25486 '''''AB'''''
25487
25488 '''''AB'''''
25489
25490 '''''AB'''''
25491 !! end
25492
25493 !! test
25494 2. I/B quote minimization: wikitext and html tags should not be combined
25495 !! options
25496 parsoid=html2wt
25497 !! html/parsoid
25498 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25499 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25500 !! wikitext
25501 ''A''<i>B</i>
25502
25503 ''A''<nowiki/>'''<i>B</i>'''
25504 !! end
25505
25506 !! test
25507 3. I/B quote minimization: templated content stops minimization
25508 !! options
25509 parsoid=html2wt
25510 !! html/parsoid
25511 <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>
25512 <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>
25513 !! wikitext
25514 ''A''{{echo|''B''}}
25515
25516 ''A''{{echo|'''''B'''''}}
25517 !! end
25518
25519 !! test
25520 4. I/B quote minimization: new content should be mimimized with adjacent old content
25521 !! options
25522 parsoid=html2wt
25523 !! html/parsoid
25524 <p><i>A</i><i>B</i></p>
25525 <p><b>A</b><b>B</b></p>
25526 <p><i>A</i><b><i>B</i></b></p>
25527 !! wikitext
25528 ''AB''
25529
25530 '''AB'''
25531
25532 ''A'''B'''''
25533 !! end
25534
25535 !! test
25536 5a. Merge adjacent quote nodes if they've been edited
25537 !! options
25538 parsoid={
25539 "modes": ["wt2wt", "selser"],
25540 "changes": [
25541 ["p", "contents", "remove", ":contains('b')"]
25542 ]
25543 }
25544 !! wikitext
25545 ''a''b''c''
25546 !! wikitext/edited
25547 ''ac''
25548 !! end
25549
25550 !! test
25551 5b. Merge adjacent quote nodes if they've been edited
25552 !! options
25553 parsoid={
25554 "modes": ["wt2wt", "selser"],
25555 "changes": [
25556 ["#x", "remove"]
25557 ]
25558 }
25559 !! wikitext
25560 ''a''<span id="x">b</span>''c''
25561 !! wikitext/edited
25562 ''ac''
25563 !! end
25564
25565 !! test
25566 1. Merge adjacent link nodes as long as at least one element is new
25567 !! options
25568 parsoid={
25569 "modes": ["html2wt"],
25570 "scrubWikitext": true
25571 }
25572 !! html/parsoid
25573 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25574 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25575 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25576 !! wikitext
25577 [[Football]]
25578 [[Football]]
25579 [[Football|Foot]][[Football|ball]]
25580 !! end
25581
25582 !! test
25583 2. Merge adjacent link nodes and enable additional normalizations
25584 !! options
25585 parsoid={
25586 "modes": ["html2wt"],
25587 "scrubWikitext": true
25588 }
25589 !! html/parsoid
25590 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25591 !! wikitext
25592 [[Football|''Football'']]
25593 !! end
25594
25595 !! test
25596 3. Don't merge adjacent link nodes if scrubWikitext is false
25597 !! options
25598 parsoid={
25599 "modes": ["html2wt"],
25600 "scrubWikitext": false
25601 }
25602 !! html/parsoid
25603 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25604 !! wikitext
25605 [[Football|Foot]][[Football|ball]]
25606 !! end
25607
25608 #------------------------------
25609 # End of tag minimization tests
25610 #------------------------------
25611
25612 !!test
25613 Bug 54262: New entities
25614 !! options
25615 parsoid=html2wt
25616 !! html/parsoid
25617 <span typeof="mw:Entity">&nbsp;</span>
25618 !! wikitext
25619 &nbsp;
25620 !! end
25621
25622 ## Note that there is no wikitext output for 'unknownproperty' ##
25623 ## Unknown magic words are silently dropped ##
25624
25625 !! test
25626 Magic words
25627 !! options
25628 parsoid=html2wt
25629 !! html/parsoid
25630 <meta property='mw:PageProp/toc' />
25631 <meta property='mw:PageProp/notoc' />
25632 <meta property='mw:PageProp/forcetoc' />
25633 <meta property='mw:PageProp/index' />
25634 <meta property='mw:PageProp/noindex' />
25635 <meta property='mw:PageProp/nogallery' />
25636 <meta property='mw:PageProp/noeditsection' />
25637 <meta property='mw:PageProp/notitleconvert' />
25638 <meta property='mw:PageProp/nocontentconvert' />
25639 <meta property='mw:PageProp/unknownproperty' />
25640 !! wikitext
25641 __TOC__
25642 __NOTOC__
25643 __FORCETOC__
25644 __INDEX__
25645 __NOINDEX__
25646 __NOGALLERY__
25647 __NOEDITSECTION__
25648 __NOTITLECONVERT__
25649 __NOCONTENTCONVERT__
25650 !! end
25651
25652 !! test
25653 Consecutive <pre>s should not get merged
25654 !! options
25655 parsoid=html2wt,html2html
25656 !! html/parsoid
25657 <pre>a</pre><pre>b</pre>
25658
25659 <pre>c
25660 </pre><pre>
25661 d</pre>
25662
25663 <pre>e
25664
25665 </pre><pre>
25666
25667 f</pre>
25668 !! wikitext
25669 a
25670
25671 b
25672
25673 c
25674
25675 d
25676
25677 e
25678
25679
25680
25681 f
25682 !! end
25683
25684 !! test
25685 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25686 !! options
25687 parsoid=html2wt
25688 !! html/parsoid
25689 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25690 !! wikitext
25691 [[Special:BookSources/1234567890|ISBN 1234567895]]
25692 !! end
25693
25694 !! test
25695 Edited RFC links not serializable as RFC links should serialize as extlinks
25696 !! options
25697 parsoid=html2wt
25698 !! html/parsoid
25699 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25700 !! wikitext
25701 [//tools.ietf.org/html/rfc123 New RFC]
25702 !! end
25703
25704 !! test
25705 Edited PMID links not serializable as PMID links should serialize as extlinks
25706 !! options
25707 parsoid=html2wt
25708 !! html/parsoid
25709 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25710 !! wikitext
25711 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25712 !! end
25713
25714 !! test
25715 WTS of autolinks with trailing/surrounding context
25716 !! options
25717 parsoid=html2wt
25718 !! html/parsoid
25719 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25720 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25721 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25722 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25723 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25724 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25725 !! wikitext
25726 http://cscott.net'''foo'''
25727
25728 http://cscott.net<b>foo</b>
25729
25730 '''http://cscott.net'''
25731
25732 '''http://cscott.net '''
25733
25734 '''http://cscott.net<nowiki/>x'''
25735
25736 http://cscott.net<nowiki/>x
25737 !! end
25738
25739 !! test
25740 WTS of autolinks with nowikis (round-trip)
25741 !! wikitext
25742 x<nowiki/>http://cscott.net<nowiki/>x
25743 !! html/parsoid
25744 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25745 !! end
25746
25747 # this is the "easy" test because it leaves in place all the
25748 # data-parsoid information indicating this is an autolink
25749 !! test
25750 WTS of autolinks with escapes (editing)
25751 !! options
25752 parsoid={
25753 "modes": ["wt2wt"],
25754 "changes": [
25755 [ "meta", "remove" ]
25756 ]
25757 }
25758 !! wikitext
25759 x<nowiki/>http://cscott.net<nowiki/>x
25760 !! wikitext/edited
25761 x<nowiki/>http://cscott.net<nowiki/>x
25762 !! end
25763
25764 !! test
25765 WTS of edited autolink-like text (T103364)
25766 !! options
25767 parsoid={
25768 "modes": ["wt2wt"],
25769 "changes": [
25770 [ "span[typeof]", "removeAttr", "typeof" ]
25771 ]
25772 }
25773 !! wikitext
25774 Not a link: <nowiki>http://example.com</nowiki>.
25775 !! wikitext/edited
25776 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25777 !! end
25778
25779 !! test
25780 WTS of newly-authored autolink-like text (T103364)
25781 !! options
25782 parsoid=html2wt
25783 !! html/parsoid
25784 <p>http://example.com is not a link.</p>
25785 !! wikitext
25786 <nowiki>http://example.com</nowiki> is not a link.
25787 !! end
25788
25789 !! test
25790 WTS of autolink-like text after an autolink (T108563)
25791 !! options
25792 parsoid=html2wt
25793 !! html/parsoid
25794 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25795 !! wikitext
25796 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25797 !! end
25798
25799 !! test
25800 Magic links inside links (not autolinked)
25801 !! wikitext
25802 [[Foo|http://example.com]]
25803 [[Foo|RFC 1234]]
25804 [[Foo|PMID 1234]]
25805 [[Foo|ISBN 123456789x]]
25806
25807 [http://foo.com http://example.com]
25808 [http://foo.com RFC 1234]
25809 [http://foo.com PMID 1234]
25810 [http://foo.com ISBN 123456789x]
25811 !! html+tidy
25812 <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>
25813 <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>
25814 !! html/parsoid
25815 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25816 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25817 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25818 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25819
25820 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25821 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25822 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25823 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25824 !! end
25825
25826 !! test
25827 Magic links inside image captions (autolinked)
25828 !! wikitext
25829 [[File:Foobar.jpg|thumb|http://example.com]]
25830 [[File:Foobar.jpg|thumb|RFC 1234]]
25831 [[File:Foobar.jpg|thumb|PMID 1234]]
25832 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25833 !! html+tidy
25834 <div class="thumb tright">
25835 <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>
25836 <div class="thumbcaption">
25837 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25838 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25839 </div>
25840 </div>
25841 <div class="thumb tright">
25842 <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>
25843 <div class="thumbcaption">
25844 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25845 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25846 </div>
25847 </div>
25848 <div class="thumb tright">
25849 <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>
25850 <div class="thumbcaption">
25851 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25852 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25853 </div>
25854 </div>
25855 <div class="thumb tright">
25856 <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>
25857 <div class="thumbcaption">
25858 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25859 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25860 </div>
25861 </div>
25862 !! html/parsoid
25863 <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>
25864 <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>
25865 <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>
25866 <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>
25867 !! end
25868
25869 !! test
25870 WTS of magic word text (T109371)
25871 !! options
25872 parsoid=html2wt
25873 !! html/parsoid
25874 <p>RFC 1234</p>
25875 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25876 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25877 !! wikitext
25878 <nowiki>RFC 1234</nowiki>
25879
25880 [http://foo.com RFC 1234]
25881
25882 [[Foo|RFC 1234]]
25883 !! end
25884
25885 !! test
25886 Edited Redirect link should emit a non-piped wikitext link
25887 !! options
25888 parsoid=html2wt
25889 !! html/parsoid
25890 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25891 !! wikitext
25892 #REDIRECT [[Bar]]
25893 !! end
25894
25895 !! test
25896 T75121: Infer extension name from typeOf if data-mw is not present
25897 !! options
25898 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25899 !! html/parsoid
25900 <div typeOf="mw:Extension/foo"></div>
25901 !! wikitext
25902 <foo />
25903 !! end
25904
25905 # Note that the <p> wrapping isn't present in PHP parser output
25906 # The important thing for this test is that P-wrapping doesn't
25907 # interfere with the <nowiki> protection for leading - in <td>
25908 # (which isn't necessary for <th>).
25909 !! test
25910 T88318: p-wrapped dash in table.
25911 !! options
25912 parsoid=html2wt,wt2wt
25913 !! html/parsoid
25914 <table><tbody>
25915 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25916 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25917 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25918 </tbody></table>
25919 !! wikitext
25920 {|
25921 !-
25922 !-
25923 |-
25924 |<nowiki>-</nowiki>
25925 |<nowiki>- </nowiki>
25926 |-
25927 |<small>-</small>
25928 |<br>
25929 -
25930 |<br>
25931 -
25932 |}
25933 !! html/php+tidy
25934 <table>
25935 <tr>
25936 <th>-</th>
25937 <th>-</th>
25938 </tr>
25939 <tr>
25940 <td>-</td>
25941 <td>-</td>
25942 </tr>
25943 <tr>
25944 <td><small>-</small></td>
25945 <td><br />
25946 <p>-</p>
25947 </td>
25948 <td><br />
25949 <p>-</p>
25950 </td>
25951 </tr>
25952 </table>
25953 !! end
25954
25955 !! test
25956 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25957 !! options
25958 parsoid=html2wt
25959 !! html/parsoid
25960 <table id='mwAb'>
25961 <td id='mwAc'>foo</td>
25962 <td id='serialize-this'>bar</td>
25963 </table>
25964 !! wikitext
25965 {|
25966 |foo
25967 | id="serialize-this" |bar
25968 |}
25969 !! end
25970
25971 !! test
25972 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25973 !! options
25974 parsoid=html2wt
25975 !! html/parsoid
25976 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25977 !! wikitext
25978 <div id="hello">ok</div>
25979 !! end
25980
25981 !! test
25982 WTS change modes
25983 !! options
25984 parsoid={
25985 "modes": ["wt2wt"],
25986 "changes": [
25987 [ "#xyz", "before", "<b>before</b> stuff " ],
25988 [ "#xyz", "after", " stuff <i>after</i>" ],
25989 [ "#xyz", "html", "x <b>y</b> z" ]
25990 ]
25991 }
25992 !! wikitext
25993 <span id="xyz">hello</span>
25994 !! wikitext/edited
25995 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25996 !! end
25997
25998 !! test
25999 Never serialize a-tag as html, regardless of what data-parsoid has to say
26000 !! options
26001 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26002 !! html/parsoid
26003 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26004 !! wikitext
26005 [[Foo]]
26006 !! end
26007
26008 ## SSS FIXME: This is broken output nevertheless.
26009 ## What might be a reasonable non-broken output for this?
26010 ## This is an edge case unlikely to be seen in production
26011 ## that I am not wasting more time on this right now.
26012 !! test
26013 Never serialize a-tag as html, no matter what attributes it has
26014 !! options
26015 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26016 !! html/parsoid
26017 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26018 !! wikitext
26019 [http://boo.org http://boohoo.org]
26020 !! end
26021
26022 # Misnested is an indication that selser can reuse the source but these have
26023 # shown to sneak through on occasion. See T101768.
26024 # The original wikitext here is: [http://test.com [[one]] two three]
26025 !! test
26026 Strip span tags added to mark misnested links
26027 !! options
26028 parsoid=html2wt
26029 !! html/parsoid
26030 <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>
26031 !! wikitext
26032 [http://test.com][[one]] two three
26033 !! end
26034
26035 !! test
26036 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26037 !! options
26038 parsoid=html2wt
26039 !! html/parsoid
26040 <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|}"]}'>
26041 <tbody><tr><td>d
26042 </td></tr>
26043 </tbody></table>
26044 !! wikitext
26045 {{echo|a}}
26046 {|{{echo|c
26047 {{!}}d
26048 }}
26049 |}
26050 !! end
26051
26052 ## This test verifies the presence and computation of this attribute indirectly
26053 ## by making an edit and ensuring that the serialization is correct (which it would be
26054 ## only if firstWikitextNode is properly set).
26055 !! test
26056 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26057 !! options
26058 parsoid= {
26059 "modes": ["wt2wt"],
26060 "changes": [
26061 [ "div#x", "remove" ],
26062 [ "div", "before", "<div>new</div>" ]
26063 ]
26064 }
26065 !! wikitext
26066 <div id="x">foo</div>
26067 {|
26068 {{echo|<div>boo</div>
26069 {{!}}b}}
26070 |c
26071 |}
26072 !! wikitext/edited
26073
26074 <div>new</div>
26075 {|
26076 {{echo|<div>boo</div>
26077 {{!}}b}}
26078 |c
26079 |}
26080 !! end
26081
26082 # --------------------------------------------
26083 # Tests spec'ing wikitext serialization norms |
26084 # --------------------------------------------
26085
26086 !! test
26087 1. Categories should always be serialized on their own line
26088 !! options
26089 parsoid=html2wt
26090 !! html/parsoid
26091 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26092 !! wikitext
26093 foo
26094 [[Category:Foo]]
26095 bar
26096 !! end
26097
26098 !! test
26099 2. Categories that are part of templates should not introduce a line break
26100 !! wikitext
26101 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26102 !! html/parsoid
26103 <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>
26104 !! end
26105
26106 # Careful while editing these next 2 tests. There are \u200f characters
26107 # before and after the <link> tags in the HTML and following some
26108 # of the categories in wikitext
26109 # Do not remove these characters in edits.
26110 #
26111 # As part of the serialization, these bidi characters will get stripped.
26112 !! test
26113 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26114 !! options
26115 parsoid={
26116 "modes": ["html2wt"],
26117 "scrubWikitext": true
26118 }
26119 !! html/parsoid
26120 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26121 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26122 !! wikitext
26123 [[קטגוריה:טקסים]]
26124 [[קטגוריה: שיטות משפט]]
26125 !! end
26126
26127 !! test
26128 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26129 !! options
26130 parsoid={
26131 "modes": ["html2wt"],
26132 "scrubWikitext": true
26133 }
26134 !! html/parsoid
26135 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26136 !! wikitext
26137 [[קטגוריה:טקסים]]
26138 ‏y
26139 !! end
26140
26141 !! test
26142 Lists: Add space after bullets
26143 !! options
26144 parsoid=html2wt
26145 !! html/parsoid
26146 <ul>
26147 <li>foo</li>
26148 <li> bar</li>
26149 <li><span> baz</span></li>
26150 </ul>
26151 !! wikitext
26152 * foo
26153 * bar
26154 * <span> baz</span>
26155 !! end
26156
26157 !! test
26158 1. Headings: Add space before/after == (T53744)
26159 !! options
26160 parsoid=html2wt
26161 !! html/parsoid
26162 <h2>foo</h2>
26163 <h2> bar</h2>
26164 <h2>baz </h2>
26165 <h2><span> baz</span></h2>
26166 !! wikitext
26167 == foo ==
26168
26169 == bar ==
26170
26171 == baz ==
26172
26173 == <span> baz</span> ==
26174 !! end
26175
26176 !! test
26177 2. Headings: Add space before/after == even after hoisted content
26178 !! options
26179 parsoid={
26180 "modes": ["html2wt"],
26181 "scrubWikitext": true
26182 }
26183 !! html/parsoid
26184 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26185 !! wikitext
26186 [[Category:A2]]
26187
26188 == ok ==
26189 !! end
26190
26191 !! test
26192 1. Headings: suppress newly created empty headings
26193 !! options
26194 parsoid={
26195 "modes": ["html2wt"],
26196 "scrubWikitext": true
26197 }
26198 !! html/parsoid
26199 <h2></h2>
26200 !! wikitext
26201 !! end
26202
26203 !! test
26204 2. Headings: don't suppress empty headings if scrubWikitext is false
26205 !! options
26206 parsoid=html2wt
26207 !! html/parsoid
26208 <h2></h2>
26209 !! wikitext
26210 ==<nowiki/>==
26211 !! end
26212
26213 !! test
26214 3. Headings: suppress empty headings on edits
26215 !! options
26216 parsoid={
26217 "modes": ["selser"],
26218 "scrubWikitext": true,
26219 "changes": [
26220 [ "#x", "remove"]
26221 ]
26222 }
26223 !! wikitext
26224 ==<span id="x">foo</span>==
26225 !! wikitext/edited
26226 !! end
26227
26228 !! test
26229 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26230 !! options
26231 parsoid={
26232 "modes": ["html2wt"],
26233 "scrubWikitext": true
26234 }
26235 !! html/parsoid
26236 <h2>foo<br/>bar</h2>
26237 <h2>foo <span><br/>bar</span> baz</h2>
26238 !! wikitext
26239 == foo bar ==
26240
26241 == foo <span> bar</span> baz ==
26242 !! end
26243
26244 !! test
26245 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26246 !! options
26247 parsoid={
26248 "modes": ["html2wt"],
26249 "scrubWikitext": false
26250 }
26251 !! html/parsoid
26252 <h2>foo<br/>bar</h2>
26253 !! wikitext
26254 == foo<br> bar ==
26255 !! end
26256
26257 !! test
26258 1. WT Quote Tags: suppress newly created empty style tags
26259 !! options
26260 parsoid={
26261 "modes": ["html2wt"],
26262 "scrubWikitext": true
26263 }
26264 !! html/parsoid
26265 <i></i><b></b>
26266 !! wikitext
26267 !! end
26268
26269 !! test
26270 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26271 !! options
26272 parsoid=html2wt
26273 !! html/parsoid
26274 <i></i><b></b>
26275 !! wikitext
26276 ''<nowiki/>'''''<nowiki/>'''
26277 !! end
26278
26279 !! test
26280 3. WT Quote Tags: suppress empty style tags on edits
26281 !! options
26282 parsoid={
26283 "modes": ["selser"],
26284 "scrubWikitext": true,
26285 "changes": [
26286 [ "#x", "remove"]
26287 ]
26288 }
26289 !! wikitext
26290 '''<span id="x">foo</span>'''
26291 !! wikitext/edited
26292 !! end
26293
26294 !! test
26295 1. Anchors: suppress newly created empty anchors
26296 !! options
26297 parsoid={
26298 "modes": ["html2wt"],
26299 "scrubWikitext": true
26300 }
26301 !! html/parsoid
26302 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26303 !! wikitext
26304 !! end
26305
26306 !! test
26307 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26308 !! options
26309 parsoid={
26310 "modes": ["html2wt"],
26311 "scrubWikitext": false
26312 }
26313 !! html/parsoid
26314 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26315 !! wikitext
26316 [[Test|<nowiki/>]]
26317 !! end
26318
26319 !! test
26320 3. Anchors: suppress empty anchors on edits
26321 !! options
26322 parsoid={
26323 "modes": ["selser"],
26324 "scrubWikitext": true,
26325 "changes": [
26326 [ "#x", "remove"]
26327 ]
26328 }
26329 !! wikitext
26330 [[Test|<span id="x">foo</span>]]
26331 !! wikitext/edited
26332 !! end
26333
26334 !! test
26335 3a. Anchors: do not suppress numbered extlinks
26336 !! options
26337 parsoid={
26338 "modes": ["wt2wt"],
26339 "scrubWikitext": true
26340 }
26341 !! wikitext
26342 [http://foo.com]
26343 !! html/parsoid
26344 <a rel="mw:ExtLink" href="http://foo.com"></a>
26345 !! end
26346
26347 !! test
26348 3b. Anchors: do not suppress numbered extlinks
26349 !! options
26350 parsoid={
26351 "modes": ["wt2wt"],
26352 "scrubWikitext": true,
26353 "changes": [
26354 [ "#x", "remove"]
26355 ]
26356 }
26357 !! wikitext
26358 [http://foo.com <span id="x">foo</span>]
26359 !! wikitext/edited
26360 [http://foo.com]
26361 !! end
26362
26363 !!test
26364 Normalizations should be restricted to edited content
26365 !!options
26366 parsoid={
26367 "modes": ["selser"],
26368 "scrubWikitext": true,
26369 "changes": [
26370 [ "h1", "before", "<i></i>"]
26371 ]
26372 }
26373 !!wikitext
26374 a
26375 = =
26376 b
26377 !!wikitext/edited
26378 a
26379 = =
26380 b
26381 !!end
26382
26383 !! test
26384 1. Multiple normalizations (html2wt)
26385 !! options
26386 parsoid={
26387 "modes": ["html2wt"],
26388 "scrubWikitext": true
26389 }
26390 !! html
26391 <h2><i></i></h2>
26392 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26393 </a><b><i></i></b>x</p>
26394 !! wikitext
26395
26396 [[foo]]
26397 x
26398
26399 !! end
26400
26401 !! test
26402 2. Multiple normalizations (selser)
26403 !! options
26404 parsoid={
26405 "modes": ["selser"],
26406 "scrubWikitext": true,
26407 "changes": [
26408 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26409 ]
26410 }
26411 !! wikitext
26412 <span id="x">foo</span>
26413 !! wikitext/edited
26414 <span id="x">foo</span>
26415
26416 x
26417 !! end
26418
26419 !! test
26420 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26421 !! options
26422 parsoid={
26423 "modes": ["html2wt"],
26424 "scrubWikitext": true
26425 }
26426 !! html/parsoid
26427 <p> hi</p>
26428 <p> hello</p>
26429 !! wikitext
26430 hi
26431
26432 hello
26433 !! end
26434
26435 !! test
26436 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26437 !! options
26438 parsoid=html2wt
26439 !! html/parsoid
26440 <p> hi</p>
26441 <p> hello</p>
26442 !! wikitext
26443 <nowiki> </nowiki>hi
26444
26445 <nowiki> </nowiki> hello
26446 !! end
26447
26448 !! test
26449 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26450 !! options
26451 parsoid={
26452 "modes": ["html2wt"],
26453 "scrubWikitext": true
26454 }
26455 !! html/parsoid
26456 <p>Foo
26457 bar
26458 baz</p>
26459
26460 <table><tr><td>Foo
26461 bar
26462 baz bang</td></tr></table>
26463
26464 <p><!--boo--> foo
26465 bar</p>
26466
26467 <p> foo
26468 bar<span>boo</span></p>
26469 !! wikitext
26470 Foo
26471 bar
26472 baz
26473
26474 {|
26475 |Foo
26476 bar
26477 baz bang
26478 |}
26479
26480 <!--boo-->foo
26481 bar
26482
26483 foo
26484 bar<span>boo</span>
26485 !! end
26486
26487 !! test
26488 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26489 !! options
26490 parsoid={
26491 "modes": ["selser"],
26492 "scrubWikitext": true,
26493 "changes": [
26494 [ "p", "html", " a\n b" ]
26495 ]
26496 }
26497 !! wikitext
26498 xyz
26499 !! wikitext/edited
26500 a
26501 b
26502 !! end
26503
26504 !! test
26505 1. New links that end in spaces
26506 !! options
26507 parsoid={
26508 "modes": ["html2wt"],
26509 "scrubWikitext": false
26510 }
26511 !! html/parsoid
26512 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26513 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26514 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26515 !! wikitext
26516 [[Berlin ]]<nowiki/>is the capital of Germany.
26517
26518 [[Foo ]]'''bar'''
26519
26520 [[Boston ]] is a city.
26521 !! end
26522
26523 !! test
26524 2. New links that end in spaces
26525 !! options
26526 parsoid={
26527 "modes": ["html2wt"],
26528 "scrubWikitext": true
26529 }
26530 !! html/parsoid
26531 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26532 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26533 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26534 !! wikitext
26535 [[Berlin]] is the capital of Germany.
26536
26537 [[Foo]] '''bar'''
26538
26539 [[Boston]] is a city.
26540 !! end
26541
26542 !! test
26543 1. Table cells with escapable prefixes
26544 !! options
26545 parsoid={
26546 "modes": ["html2wt"],
26547 "scrubWikitext": false
26548 }
26549 !! html
26550 <table>
26551 <tr><td>a</td></tr>
26552 <tr><td>-</td></tr>
26553 <tr><td>+</td></tr>
26554 </table>
26555 !! wikitext
26556 {|
26557 |a
26558 |-
26559 |<nowiki>-</nowiki>
26560 |-
26561 |<nowiki>+</nowiki>
26562 |}
26563 !! end
26564
26565 !! test
26566 2. Table cells with escapable prefixes
26567 !! options
26568 parsoid={
26569 "modes": ["html2wt"],
26570 "scrubWikitext": true
26571 }
26572 !! html
26573 <table>
26574 <tr><td>a</td></tr>
26575 <tr><td>-</td></tr>
26576 <tr><td>+</td></tr>
26577 </table>
26578 !! wikitext
26579 {|
26580 |a
26581 |-
26582 | -
26583 |-
26584 | +
26585 |}
26586 !! end
26587
26588 !! test
26589 3a. Table cells with escapable prefixes after edits
26590 !! options
26591 parsoid={
26592 "modes": ["selser"],
26593 "scrubWikitext": true,
26594 "changes": [
26595 [ "table tbody tr:first-child td:first-child", "remove"]
26596 ]
26597 }
26598 !! wikitext
26599 {|
26600 |a||-
26601 |}
26602 !! wikitext/edited
26603 {|
26604 | -
26605 |}
26606 !! end
26607
26608 !! test
26609 3b. Table cells with escapable prefixes after edits
26610 !! options
26611 parsoid={
26612 "modes": ["selser"],
26613 "scrubWikitext": true,
26614 "changes": [
26615 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26616 [ "#x", "remove" ]
26617 ]
26618 }
26619 !! wikitext
26620 {|
26621 |pqr
26622 |<span id="x">foo</span>+
26623 |}
26624 !! wikitext/edited
26625 {|
26626 | -
26627 | +
26628 |}
26629 !! end
26630
26631 # FIXME: This test will fail because
26632 # normalization doesn't realize that the id attribute
26633 # will eliminate the escapable scenario
26634 !! test
26635 4a. Table cells without escapable prefixes after edits
26636 !! options
26637 parsoid={
26638 "modes": ["selser"],
26639 "scrubWikitext": true,
26640 "changes": [
26641 [ "#x", "html", "-" ]
26642 ]
26643 }
26644 !! wikitext
26645 {|
26646 | id="x" |abcd
26647 |}
26648 !! wikitext/edited
26649 {|
26650 | id="x" |-
26651 |}
26652 !! end
26653
26654 ## This tests normalizer's ability to discriminate between
26655 ## cells having identical content.
26656 !! test
26657 4b. Table cells without escapable prefixes after edits
26658 !! options
26659 parsoid={
26660 "modes": ["selser"],
26661 "scrubWikitext": true,
26662 "changes": [
26663 [ "td", "html", "-" ]
26664 ]
26665 }
26666 !! wikitext
26667 {|
26668 |a||b
26669 |}
26670 !! wikitext/edited
26671 {|
26672 | -||-
26673 |}
26674 !! end
26675
26676 ## This tests normalizer's ability to not be tripped by
26677 ## comments (and whitespace)
26678 !! test
26679 4c. Table cells without escapable prefixes after edits
26680 !! options
26681 parsoid={
26682 "modes": ["selser"],
26683 "scrubWikitext": true,
26684 "changes": [
26685 [ "table tbody tr td:first-child", "remove" ]
26686 ]
26687 }
26688 !! wikitext
26689 {|
26690 |-
26691 <!--foo--> |a||-
26692 |}
26693 !! wikitext/edited
26694 {|
26695 |-
26696 <!--foo--> | -
26697 |}
26698 !! end
26699
26700 ## This tests normalizer's ability to handle HTML cells
26701 !! test
26702 4d. Table cells without escapable prefixes after edits
26703 !! options
26704 parsoid={
26705 "modes": ["selser"],
26706 "scrubWikitext": true,
26707 "changes": [
26708 [ "td", "html", "-" ]
26709 ]
26710 }
26711 !! wikitext
26712 <table>
26713 <tr><td>a</td></tr>
26714 </table>
26715 !! wikitext/edited
26716 <table>
26717 <tr><td>-</td></tr>
26718 </table>
26719 !! end
26720
26721 ## T111151 Remove font elements without attributes
26722 !! test
26723 5a. font tags without attributes should be dropped in scrubWikitext mode
26724 !! options
26725 parsoid={
26726 "modes": ["html2wt"],
26727 "scrubWikitext": true
26728 }
26729 !! html
26730 <font>foo</font>
26731 <font><font>bar</font></font>
26732 <font class="x">boo</font>
26733 !! wikitext
26734 foo
26735 bar
26736 <font class="x">boo</font>
26737 !! end
26738
26739 !! test
26740 5b. font tags should not be dropped without scrubWikitext being enabled
26741 !! options
26742 parsoid={
26743 "modes": ["html2wt"],
26744 "scrubWikitext": false
26745 }
26746 !! html
26747 <font>foo</font>
26748 !! wikitext
26749 <font>foo</font>
26750 !! end
26751
26752 !! test
26753 Escape nowiki DOM elements
26754 !! options
26755 parsoid=html2wt
26756 !! html/parsoid
26757 <nowiki><i>foo</i></nowiki>
26758 !! wikitext
26759 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26760 !! end
26761
26762 # This is meant to be an interim fix while we go about figuring out
26763 # how to not introduce these trailing <nowiki/>s in the first place.
26764 !! test
26765 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26766 !! options
26767 parsoid=html2wt
26768 !! html/parsoid
26769 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26770 y</p>
26771 <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>
26772 <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>
26773 !! wikitext
26774 x
26775 y
26776
26777 {{echo|
26778 1 = <nowiki/>}}
26779
26780 {{echo|
26781 1 = <nowiki/>
26782 }}
26783 !! end
26784
26785 # ---------------------------------------------------
26786 # End of tests spec'ing wikitext serialization norms |
26787 # ---------------------------------------------------
26788
26789 # T104032
26790 !! test
26791 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26792 !! options
26793 parsoid=html2wt
26794 !! html/parsoid
26795 a<p>b</p>
26796 <b>c</b><p>d</p>
26797 <table><tr>
26798 <td>a<p>b</p></td>
26799 <td><b>c</b><p>d</p></td>
26800 </tr></table>
26801 !! wikitext
26802 a
26803
26804 b
26805
26806 '''c'''
26807
26808 d
26809 {|
26810 |a
26811 b
26812 |'''c'''
26813 d
26814 |}
26815 !! end
26816
26817 # -----------------------------------------------------------------
26818 # End of section for Parsoid-only html2wt tests for serialization
26819 # of new content
26820 # -----------------------------------------------------------------
26821
26822 # -----------------------------------------------------------------
26823 # The following section of tests are primarily to spec behavior of
26824 # the selective serializer. All these tests have manual selser
26825 # changes. The automated selser changes for all tests handle the
26826 # wide variation of changes, but these tests here capture specs
26827 # deterministically.
26828 # ----------------------------------------------------------------
26829
26830 ## T90517
26831 !! test
26832 Selser: New comments should not be lost
26833 !! options
26834 parsoid={
26835 "modes": ["selser"],
26836 "changes": [
26837 [ "#a", "after", "<!--c1-->" ],
26838 [ "#b", "before", "<!--c2-->" ]
26839 ]
26840 }
26841 !! wikitext
26842 <span id="a">a</span>
26843
26844 <span id="b">b</span>
26845 !! wikitext/edited
26846 <span id="a">a</span><!--c1-->
26847
26848 <!--c2--><span id="b">b</span>
26849 !! end
26850
26851 ## T89383
26852 !! test
26853 Selser: Check for validity of DSR before using it
26854 !! options
26855 parsoid={
26856 "modes": ["selser"],
26857 "changes": [
26858 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26859 ]
26860 }
26861 !! wikitext
26862 <span id="a">a</span>
26863 !! wikitext/edited
26864 {{DISPLAYTITLE:foo}}
26865 <span id="a">a</span>
26866 !! end
26867
26868 !! test
26869 1. DOMDiff: Changes to <ref> content should be looked up using id
26870 !! options
26871 parsoid={
26872 "modes": ["selser"],
26873 "changes": [
26874 ["#X", "after", "bar"],
26875 ["#Y", "after", "baz"]
26876 ]
26877 }
26878 !! wikitext
26879 X <ref><span id="X">foo</span></ref>
26880 Y <ref name="a" />
26881 <references>
26882 <ref name="a"><span id="Y">foo</span></ref>
26883 </references>
26884 !! wikitext/edited
26885 X <ref><span id="X">foo</span>bar</ref>
26886 Y <ref name="a" />
26887 <references>
26888 <ref name="a"><span id="Y">foo</span>baz</ref>
26889 </references>
26890 !! end
26891
26892 !! test
26893 2. DOMDiff: Changes to <ref> content should be looked up using id
26894 !! options
26895 parsoid={
26896 "modes": ["selser"],
26897 "changes": [
26898 ["#Z", "after", "bar"]
26899 ]
26900 }
26901 !! wikitext
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></ref>
26909 </references>
26910 !! wikitext/edited
26911 A <ref>foo bar for a</ref>
26912 B <ref group="X" name="b" />
26913
26914 <references />
26915
26916 <references group="X">
26917 <ref name="b"><span id="Z">foo</span>bar</ref>
26918 </references>
26919 !! end
26920
26921 !! test
26922 Empty LI (T49673)
26923 !! wikitext
26924 * a
26925 *
26926 *
26927 * b
26928 !! html/php+tidy
26929 <ul>
26930 <li>a</li>
26931 <li class="mw-empty-li"></li>
26932 <li class="mw-empty-li"></li>
26933 <li>b</li>
26934 </ul>
26935 !! end