691113db662f3e14044ddd5d89c62f0ba92b89c5
[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> and <pre> preference (first one wins)
2270 !! wikitext
2271 <pre>
2272 <nowiki>
2273 </pre>
2274 </nowiki>
2275 </pre>
2276
2277 <nowiki>
2278 <pre>
2279 <nowiki>
2280 </pre>
2281 </nowiki>
2282 </pre>
2283
2284 !! html/php
2285 <pre>
2286 &lt;nowiki&gt;
2287 </pre>
2288 <p>&lt;/nowiki&gt;
2289 &lt;/pre&gt;
2290 </p><p>
2291 &lt;pre&gt;
2292 &lt;nowiki&gt;
2293 &lt;/pre&gt;
2294
2295 &lt;/pre&gt;
2296 </p>
2297 !! html/parsoid
2298 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2299 </pre>
2300 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2301 &lt;/pre></p>
2302
2303 <p><span typeof="mw:Nowiki">
2304 &lt;pre>
2305 &lt;nowiki>
2306 &lt;/pre>
2307 </span>
2308 &lt;/pre></p>
2309 !! end
2310
2311 !! test
2312 </pre> inside nowiki
2313 !! wikitext
2314 <nowiki></pre></nowiki>
2315 !! html
2316 <p>&lt;/pre&gt;
2317 </p>
2318 !! end
2319
2320 # Parsoid doesn't strip empty tags, like Tidy does.
2321 !! test
2322 Empty pre; pre inside other HTML tags (bug 54946)
2323 !! options
2324 parsoid=wt2html,wt2wt
2325 !! wikitext
2326 a
2327
2328 <div><pre>
2329 foo
2330 </pre></div>
2331 <pre></pre>
2332 !! html/php
2333 <p>a
2334 </p>
2335 <div><pre>
2336 foo
2337 </pre></div>
2338 <pre></pre>
2339
2340 !! html/php+tidy
2341 <p>a</p>
2342 <div>
2343 <pre>
2344 foo
2345 </pre></div>
2346 !! html/parsoid
2347 <p>a</p>
2348
2349 <div><pre>foo
2350 </pre></div>
2351 <pre></pre>
2352 !! end
2353
2354 !! test
2355 HTML pre followed by indent-pre
2356 !! wikitext
2357 <pre>foo</pre>
2358 bar
2359 !! html
2360 <pre>foo</pre>
2361 <pre>bar
2362 </pre>
2363 !! end
2364
2365 # Note that tidy removes the empty <p> tags from the start and end.
2366 # Parsoid does not, by design.
2367 !!test
2368 Block tag pre
2369 !! wikitext
2370 <p><pre>foo</pre></p>
2371 !! html/php+tidy
2372 <pre>
2373 foo
2374 </pre>
2375 !! html/parsoid
2376 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2377 !!end
2378
2379 !!test
2380 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2381 !! wikitext
2382 {{echo|}}
2383 !! html
2384
2385 !!end
2386
2387 !!test
2388 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2389 !! wikitext
2390 {{echo|
2391 foo}}
2392 !! html
2393 <p>foo
2394 </p>
2395 !!end
2396
2397 !! test
2398 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2399 !! wikitext
2400 {{echo|a
2401 b}}
2402 !! html
2403 <pre>a
2404 </pre>
2405 <p>b
2406 </p>
2407 !!end
2408
2409 !! test
2410 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2411 !! wikitext
2412 {{echo|a
2413 b
2414 c
2415 d
2416 e
2417 }}
2418 !! html
2419 <pre>a
2420 </pre>
2421 <p>b
2422 c
2423 </p>
2424 <pre>d
2425 </pre>
2426 <p>e
2427 </p>
2428 !!end
2429
2430 !!test
2431 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2432 !! wikitext
2433 {{echo| foo}}
2434
2435 {{echo| foo}}{{echo| bar}}
2436
2437 {{echo| foo}}
2438 {{echo| bar}}
2439
2440 {{echo|<!--cmt--> foo}}
2441
2442 <!--cmt-->{{echo| foo}}
2443
2444 {{echo|{{echo| }}bar}}
2445 !! html
2446 <pre>foo
2447 </pre>
2448 <pre>foo bar
2449 </pre>
2450 <pre>foo
2451 bar
2452 </pre>
2453 <pre>foo
2454 </pre>
2455 <pre>foo
2456 </pre>
2457 <pre>bar
2458 </pre>
2459 !!end
2460
2461 !! test
2462 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2463 !! wikitext
2464 {{echo| }}a
2465
2466 {{echo|
2467 }}a
2468
2469 {{echo|
2470 b}}
2471
2472 {{echo|a
2473 }}b
2474
2475 {{echo|a
2476 }} b
2477 !! html
2478 <pre>a
2479 </pre>
2480 <p><br />
2481 </p>
2482 <pre>a
2483 </pre>
2484 <p><br />
2485 </p>
2486 <pre>b
2487 </pre>
2488 <p>a
2489 </p>
2490 <pre>b
2491 </pre>
2492 <p>a
2493 </p>
2494 <pre>b
2495 </pre>
2496 !!end
2497
2498 !! test
2499 Pres with newline attributes
2500 !! wikitext
2501 <pre class="one
2502 two">hi</pre>
2503 !! html/php
2504 <pre class="one two">hi</pre>
2505
2506 !! html/parsoid
2507 <pre class="one
2508 two" data-parsoid='{"stx":"html"}'>hi</pre>
2509 !! end
2510
2511 !! test
2512 Things that look like <pre> tags aren't treated as such
2513 !! wikitext
2514 Barack Obama <President> of the United States
2515 <President></President>
2516 !! html
2517 <p>Barack Obama &lt;President&gt; of the United States
2518 &lt;President&gt;&lt;/President&gt;
2519 </p>
2520 !! end
2521
2522 !! test
2523 Handle broken pre-like tags (bug 64025)
2524 !! options
2525 parsoid=wt2html
2526 !! wikitext
2527 {{echo|<pre <pre>x</pre>}}
2528
2529 <table><pre </table>
2530 !! html/php
2531 <pre>x</pre>
2532 <table>&lt;pre </table>
2533
2534 !! html/php+tidy
2535 <pre>
2536 x
2537 </pre>
2538 <p>&lt;pre</p>
2539 !! html/parsoid
2540 <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>
2541
2542
2543 <p>&lt;pre </p>
2544
2545 <table></table>
2546 !! end
2547
2548 !! test
2549 Parsoid: handle pre with space after attribute
2550 !! options
2551 parsoid=wt2html
2552 !! wikitext
2553 <pre style="width:50%;" >{{echo|foo}}</pre>
2554 !! html/php
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556
2557 !! html/parsoid
2558 <pre style="width:50%;">{{echo|foo}}</pre>
2559 !! end
2560
2561 # TODO / maybe: fix wt2wt for this
2562 !! test
2563 Parsoid: Don't paragraph-wrap fosterable content
2564 !! options
2565 parsoid=wt2html
2566 !! wikitext
2567 {|
2568 <td></td>
2569 <td></td>
2570
2571
2572
2573 |}
2574 !! html
2575 <table>
2576
2577 <tbody>
2578 <tr>
2579 <td></td>
2580
2581 <td></td></tr>
2582
2583
2584
2585 </tbody></table>
2586 !! end
2587
2588 !! test
2589 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2590 !! options
2591 parsoid=wt2html
2592 !! wikitext
2593 {|
2594 <td>
2595 <td>
2596 </td>
2597
2598
2599
2600 |}
2601 !! html
2602 <table>
2603
2604 <tbody>
2605 <tr>
2606 <td></td>
2607
2608 <td>
2609 </td></tr>
2610
2611
2612
2613 </tbody></table>
2614 !! end
2615
2616
2617 #--------------------------------------------------------------------
2618 # Transclusion parameter whitespace stripping tests
2619 # Behavior is different for positional and named parameters
2620 #--------------------------------------------------------------------
2621 !! test
2622 Templates: Strip leading and trailing whitespace from named-param values
2623 !! wikitext
2624 {{echo|1= a }}
2625
2626 {{echo|1= {{echo|b}} }}
2627
2628 {{echo| 1 =
2629 c }}
2630
2631 {{echo| 1 =
2632 * d
2633 }}
2634 !! html
2635 <p>a
2636 </p><p>b
2637 </p><p>c
2638 </p>
2639 <ul><li> d</li></ul>
2640
2641 !! end
2642
2643 !! test
2644 Templates: Don't strip whitespace from positional-param values
2645 !! wikitext
2646 {{echo|a }}
2647
2648 {{echo|{{echo|b}} }}
2649
2650 {{echo| c
2651 }}
2652
2653 {{echo| {{echo|d}}
2654 }}
2655
2656 {{echo|
2657 e}}
2658
2659 {{echo|
2660 * f}}
2661
2662 {{echo|
2663 }}g
2664 !! html
2665 <p>a
2666 </p><p>b
2667 </p>
2668 <pre>c
2669 </pre>
2670 <p><br />
2671 </p>
2672 <pre>d
2673 </pre>
2674 <p><br />
2675 </p>
2676 <pre>e
2677 </pre>
2678 <p><br />
2679 </p>
2680 <ul><li> f</li></ul>
2681 <p><br />
2682 </p>
2683 <pre>g
2684 </pre>
2685 !! end
2686
2687 !! test
2688 Templates: Handle empty comment-and-ws-only lines correctly
2689 !! wikitext
2690 {{echo|foo
2691 <!--should be ignored-->
2692 <!--should be ignored as well-->
2693 bar}}
2694 !! html
2695 <p>foo
2696 bar
2697 </p>
2698 !! end
2699
2700 !! test
2701 Templates: Handle comments in the target
2702 !! wikitext
2703 {{echo
2704 <!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->
2708 |foo}}
2709
2710 {{echo<!-- should be ignored -->|foo}}
2711
2712 {{<!-- should be ignored -->echo|foo}}
2713 !!html/parsoid
2714 <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>
2715
2716 <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>
2717
2718 <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>
2719
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2721 !!end
2722
2723 !! test
2724 Templates: Handle comments in parameter names (bug 67657)
2725 !! wikitext
2726 {{echo|1
2727 <!-- should be ignored -->
2728 =foo}}
2729
2730 {{echo|
2731 <!-- should be ignored -->
2732 1 = foo}}
2733
2734 {{echo|1<!-- should be ignored -->=foo}}
2735
2736 {{echo|<!-- should be ignored -->1=foo}}
2737 !!html/parsoid
2738 <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>
2739
2740 <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>
2741
2742 <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>
2743
2744 <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>
2745 !!end
2746
2747 !! test
2748 Templates: Other wikitext in parameter names (bug 67657)
2749 !! wikitext
2750 {{echo|''1''=foo}}
2751 !!html/parsoid
2752 <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>
2753 !!html/php
2754 <p>{{{1}}}
2755 </p>
2756 !!end
2757
2758 #--------------------------------------------------------------------
2759 # Transclusion parameter escaping tests
2760 #--------------------------------------------------------------------
2761 !! test
2762 Templates: Parsoid parameter escaping test 1
2763 !! wikitext
2764 {{echo|[foo]|{{echo|[bar]}}}}
2765 !! html/php+tidy
2766 <p>[foo]</p>
2767 !! html/parsoid
2768 <p about="#mwt1" typeof="mw:Transclusion"
2769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipes in external links in template parameter
2774 !! wikitext
2775 {{echo|[{{echo|http://example.com}} link]}}
2776 !! html/php+tidy
2777 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2778 !! html/parsoid
2779 <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>
2780 !! end
2781
2782 !! test
2783 Parsoid: pipe in transclusion parameter
2784 !! wikitext
2785 {{echo|http://foo.com/a&#124;b}}
2786 !! html/php+tidy
2787 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2788 !! html/parsoid
2789 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2790 typeof="mw:Transclusion"
2791 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>
2792 !! end
2793
2794 !! test
2795 Parsoid: Pipe in external link target and content in template parameter
2796 !! options
2797 parsoid=html2wt,wt2wt
2798 !! wikitext
2799 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2800 !! html/php+tidy
2801 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2802 !! html/parsoid
2803 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2804 typeof="mw:Transclusion"
2805 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2806 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2807 !! end
2808
2809 !! test
2810 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2811 !! options
2812 parsoid
2813 !! wikitext
2814 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2815 !! html
2816 <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>
2817 !! end
2818
2819 !! test
2820 Templates: Don't escape already nowiki-escaped text in template parameters
2821 !! options
2822 parsoid=html2wt,wt2wt
2823 !! wikitext
2824 {{echo|foo<nowiki>|</nowiki>bar}}
2825 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2826 {{echo|<nowiki></nowiki>}}
2827 !! html/php+tidy
2828 <p>foo|bar &lt;div&gt;</p>
2829 !! html/parsoid
2830 <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>
2831 <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>
2832 <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>
2833 </p>
2834 !! end
2835
2836 ## Bug 52824
2837 !! test
2838 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2839 !! options
2840 parsoid=html2wt,wt2wt
2841 !! wikitext
2842 {{echo|{{echo|1=bar}}}}
2843 !! html/php+tidy
2844 <p>bar</p>
2845 !! html/parsoid
2846 <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>
2847 !! end
2848
2849 ## Bug 56733
2850 !! test
2851 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2852 !! wikitext
2853 {{echo|a : b}}
2854 !! html/php+tidy
2855 <p>a&#160;: b</p>
2856 !! html/parsoid
2857 <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>
2858 !! end
2859
2860 ## Bug T73412
2861 !! test
2862 Templates: Preserve blank parameter names
2863 !! wikitext
2864 {{echo|=foo}}
2865 !! html/php+tidy
2866 <p>{{{1}}}</p>
2867 !! html/parsoid
2868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2869 !! end
2870
2871 !! test
2872 Templates: Preserve blank parameter names in other positions
2873 !! wikitext
2874 {{blank_param|bar|=foo}}
2875 !! html/php+tidy
2876 <p>bar foo</p>
2877 !! html/parsoid
2878 <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
2879 foo</p>
2880 !! end
2881
2882 ###
2883 ### Parsoid-centric tests for testing RT edge cases for pre
2884 ###
2885
2886 !!test
2887 1a. Indent-Pre and Comments
2888 !! wikitext
2889 a
2890 <!--a-->
2891 c
2892 !! html
2893 <pre>a
2894 </pre>
2895 <p>c
2896 </p>
2897 !!end
2898
2899 !!test
2900 1b. Indent-Pre and Comments
2901 !! wikitext
2902 a
2903 <!--a-->
2904 c
2905 !! html
2906 <pre>a
2907 </pre>
2908 <p>c
2909 </p>
2910 !!end
2911
2912 !!test
2913 1c. Indent-Pre and Comments
2914 !! wikitext
2915 <!--a--> a
2916
2917 <!--a--> a
2918 !! html
2919 <pre> a
2920 </pre>
2921 <pre> a
2922 </pre>
2923 !!end
2924
2925 !!test
2926 1d. Indent-Pre and Comments
2927 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2928 !! wikitext
2929 <!--a--> a
2930
2931 <!--b-->b
2932 !! html
2933 <pre>a
2934 </pre>
2935 <pre>b
2936 </pre>
2937 !!end
2938
2939 !!test
2940 2a. Indent-Pre and tables
2941 !! wikitext
2942 {|
2943 |-
2944 !h1!!h2
2945 |foo||bar
2946 |}
2947 !! html
2948 <table>
2949
2950 <tr>
2951 <th>h1</th>
2952 <th>h2
2953 </th>
2954 <td>foo</td>
2955 <td>bar
2956 </td></tr></table>
2957
2958 !!end
2959
2960 !!test
2961 2b. Indent-Pre and tables
2962 !! wikitext
2963 {|
2964 |-
2965 |foo
2966 |}
2967 !! html
2968 <table>
2969
2970 <tr>
2971 <td>foo
2972 </td></tr></table>
2973
2974 !!end
2975
2976 !!test
2977 2c. Indent-Pre and tables (bug 42252)
2978 !! wikitext
2979 {|
2980 |+ foo
2981 ! | bar
2982 |}
2983 !! html
2984 <table>
2985 <caption> foo
2986 </caption>
2987 <tr>
2988 <th> bar
2989 </th></tr></table>
2990
2991 !!end
2992
2993 !!test
2994 2d. Indent-Pre and tables
2995 !! wikitext
2996 a
2997 {|
2998 | b
2999 |}
3000 !! html/php
3001 <pre>a
3002 </pre>
3003 <table>
3004 <tr>
3005 <td> b
3006 </td></tr></table>
3007
3008 !! html/parsoid
3009 <pre>a</pre>
3010 <table>
3011 <tbody><tr><td> b</td></tr>
3012 </tbody></table>
3013 !!end
3014
3015 !!test
3016 2e. Indent-Pre and table-line syntax
3017 !! wikitext
3018 a
3019 | b
3020 | c
3021 !! html/php
3022 <pre>a
3023 | b
3024 | c
3025 </pre>
3026 !!end
3027
3028 !!test
3029 2f. Indent-pre started by table-line syntax
3030 !! wikitext
3031 a
3032 | b
3033 | c
3034 !! html/php
3035 <p>a
3036 </p>
3037 <pre>| b
3038 | c
3039 </pre>
3040 !! html/parsoid
3041 <p>a</p>
3042 <pre>
3043 | b
3044 | c</pre>
3045 !!end
3046
3047 !!test
3048 3a. Indent-Pre and block tags (single-line html)
3049 !! wikitext
3050 a <p> foo </p>
3051 b <div> foo </div>
3052 c <blockquote> foo </blockquote>
3053 <span> foo </span>
3054 !! html
3055 a <p> foo </p>
3056 b <div> foo </div>
3057 c <blockquote> foo </blockquote>
3058 <pre><span> foo </span>
3059 </pre>
3060 !! html/parsoid
3061 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3062 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3063 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3064 <pre><span> foo </span>
3065 </pre>
3066 !! html+tidy
3067 <p>a</p>
3068 <p>foo</p>
3069 <p>b</p>
3070 <div>foo</div>
3071 <p>c</p>
3072 <blockquote>
3073 <p>foo</p>
3074 </blockquote>
3075 <pre>
3076 <span> foo </span>
3077 </pre>
3078 !! end
3079
3080 !!test
3081 3b. Indent-Pre and block tags (multi-line html)
3082 !! wikitext
3083 a <span>foo</span>
3084 b <div> foo </div>
3085 !! html
3086 <pre>a <span>foo</span>
3087 </pre>
3088 b <div> foo </div>
3089
3090 !! html/parsoid
3091 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3092 b <div data-parsoid='{"stx":"html"}'> foo </div>
3093 !! html+tidy
3094 <pre>
3095 a <span>foo</span>
3096 </pre>
3097 <p>b</p>
3098 <div>foo</div>
3099 !!end
3100
3101 !!test
3102 3c. Indent-Pre and block tags (pre-content on separate line)
3103 !! wikitext
3104 <p>
3105 foo
3106 </p>
3107
3108 <div>
3109 foo
3110 </div>
3111
3112 <center>
3113 foo
3114 </center>
3115
3116 <blockquote>
3117 foo
3118 </blockquote>
3119
3120 <blockquote>
3121 <pre>
3122 foo
3123 </pre>
3124 </blockquote>
3125
3126 <table><tr><td>
3127 foo
3128 </td></tr></table>
3129
3130 <ul><li>
3131 foo
3132 </li></ul>
3133
3134 !! html
3135 <p>
3136 foo
3137 </p>
3138 <div>
3139 <pre>foo
3140 </pre>
3141 </div>
3142 <center>
3143 <pre>foo
3144 </pre>
3145 </center>
3146 <blockquote>
3147 <p> foo
3148 </p>
3149 </blockquote>
3150 <blockquote>
3151 <pre>
3152 foo
3153 </pre>
3154 </blockquote>
3155 <table><tr><td>
3156 <pre>foo
3157 </pre>
3158 </td></tr></table>
3159 <ul><li>
3160 foo
3161 </li></ul>
3162
3163 !!end
3164
3165 !!test
3166 4. Indent-Pre and extension tags
3167 !! wikitext
3168 a <gallery>
3169 File:foobar.jpg
3170 </gallery>
3171 !! html
3172 a <ul class="gallery mw-gallery-traditional">
3173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3174 <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>
3175 <div class="gallerytext">
3176 </div>
3177 </div></li>
3178 </ul>
3179
3180 !! html+tidy
3181 <p>a</p>
3182 <ul class="gallery mw-gallery-traditional">
3183 <li class="gallerybox" style="width: 155px">
3184 <div style="width: 155px">
3185 <div class="thumb" style="width: 150px;">
3186 <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>
3187 </div>
3188 <div class="gallerytext"></div>
3189 </div>
3190 </li>
3191 </ul>
3192 !!end
3193
3194 !! test
3195 Table wikitext syntax outside wiki-tables
3196 !! wikitext
3197 a
3198 ! not a table heading
3199 |- not a table row
3200 | not a table cell
3201 | class="foo bar" | baz
3202 b
3203 |}
3204 |-
3205 c
3206 !! html
3207 <p>a
3208 ! not a table heading
3209 |- not a table row
3210 | not a table cell
3211 | class="foo bar" | baz
3212 b
3213 |}
3214 |-
3215 c
3216 </p>
3217 !! end
3218
3219 !!test
3220 Render paragraphs when indent-pre is suppressed in blocklevels
3221 !! wikitext
3222 <blockquote>
3223 foo
3224
3225 bar
3226 </blockquote>
3227 !! html
3228 <blockquote>
3229 <p> foo
3230 </p><p> bar
3231 </p>
3232 </blockquote>
3233
3234 !!end
3235
3236 !!test
3237 4. Multiple spaces at start-of-line
3238 !! wikitext
3239 <p> foo </p>
3240 foo
3241 {|
3242 |foo
3243 |}
3244 !! html
3245 <p> foo </p>
3246 <pre> foo
3247 </pre>
3248 <table>
3249 <tr>
3250 <td>foo
3251 </td></tr></table>
3252
3253 !!end
3254
3255 ## NOTE: the leading white-space chars on empty line are significant
3256 !! test
3257 5a. White-space in indent-pre
3258 !! wikitext
3259 a<br />
3260
3261 b
3262 !! html
3263 <pre>a<br />
3264
3265 b
3266 </pre>
3267 !! end
3268
3269 ## NOTE: the leading white-space chars on empty line are significant
3270 !! test
3271 5b. White-space in indent-pre
3272 !! wikitext
3273 a
3274
3275 b
3276
3277
3278 c
3279 !! html
3280 <pre>a
3281
3282 b
3283
3284
3285 c
3286 </pre>
3287 !! end
3288
3289 !! test
3290 5c. White-space in indent-pre
3291 !! wikitext
3292 ''a''
3293 ''b''
3294 ''c''
3295 !! html
3296 <pre><i>a</i>
3297 <i>b</i>
3298 <i>c</i>
3299 </pre>
3300 !! end
3301
3302 !! test
3303 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3304 !! wikitext
3305 a
3306
3307 <!-- continue -->
3308 b
3309
3310 c
3311
3312 d
3313 !! html
3314 <pre>a
3315
3316 b
3317 </pre>
3318 <pre>c
3319
3320 </pre>
3321 <p>d
3322 </p>
3323 !! end
3324
3325 !! test
3326 7a. Indent-pre and category links
3327 !! options
3328 parsoid=wt2html,wt2wt
3329 !! wikitext
3330 [[Category:foo]] <!-- No pre-wrapping -->
3331 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3332 !! html/php+tidy
3333 !! html/parsoid
3334 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3335 <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 -->
3336 !! end
3337
3338 ## We used to, but no longer wt2wt this test since the default serializer
3339 ## will normalize all categories to serialize on their own line.
3340 ## This wikitext usage is going to be fairly uncommon in production and
3341 ## selser will take care of preserving formatting in those scenarios.
3342 !! test
3343 7b. Indent-pre and category links
3344 !! options
3345 parsoid=wt2html
3346 !! wikitext
3347 [[Category:foo]] a
3348 [[Category:foo]] {{echo|b}}
3349 !! html/parsoid
3350 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3351 <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>
3352 !! end
3353
3354 !! test
3355 Indent-Pre: Newlines in comments shouldn't affect sol state
3356 !! wikitext
3357 a <!--
3358 foo
3359 --> b
3360 !! html/php+tidy
3361 <p>a b</p>
3362 !! html/parsoid
3363 <p>a <!--
3364 foo
3365 --> b</p>
3366 !! end
3367
3368 ###
3369 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3370 ###
3371
3372 !!test
3373 HTML-pre: 1. embedded newlines
3374 !! wikitext
3375 <pre>foo</pre>
3376
3377 <pre>
3378 foo
3379 </pre>
3380
3381 <pre>
3382
3383 foo
3384 </pre>
3385
3386 <pre>
3387
3388
3389 foo
3390 </pre>
3391 !! html/php+tidy
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396 foo
3397 </pre>
3398 <pre>
3399
3400 foo
3401 </pre>
3402 <pre>
3403
3404
3405 foo
3406 </pre>
3407 !! html/parsoid
3408 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3409
3410 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3411 foo
3412 </pre>
3413
3414 <pre data-parsoid='{"stx":"html"}'>
3415
3416 foo
3417 </pre>
3418
3419 <pre data-parsoid='{"stx":"html"}'>
3420
3421
3422 foo
3423 </pre>
3424 !!end
3425
3426 !! test
3427 HTML-pre: big spaces
3428 !! wikitext
3429 <pre>
3430
3431
3432
3433
3434 haha
3435
3436
3437
3438
3439 haha
3440
3441
3442
3443
3444 </pre>
3445 !! html/php+tidy
3446 <pre>
3447
3448
3449
3450
3451 haha
3452
3453
3454
3455
3456 haha
3457
3458
3459
3460
3461 </pre>
3462 !! html/parsoid
3463 <pre data-parsoid='{"stx":"html"}'>
3464
3465
3466
3467
3468 haha
3469
3470
3471
3472
3473 haha
3474
3475
3476
3477
3478 </pre>
3479 !! end
3480
3481 !!test
3482 HTML-pre: 2: indented text
3483 !! wikitext
3484 <pre>
3485 foo
3486 </pre>
3487 !! html
3488 <pre>
3489 foo
3490 </pre>
3491
3492 !!end
3493
3494 !!test
3495 HTML-pre: 3: other wikitext
3496 !! wikitext
3497 <pre>
3498 * foo
3499 # bar
3500 = no-h =
3501 '' no-italic ''
3502 [[ NoLink ]]
3503 </pre>
3504 !! html/php
3505 <pre>
3506 * foo
3507 # bar
3508 = no-h =
3509 '' no-italic ''
3510 [[ NoLink ]]
3511 </pre>
3512
3513 !! html/parsoid
3514 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3515 # bar
3516 = no-h =
3517 '' no-italic ''
3518 [[ NoLink ]]
3519 </pre>
3520 !!end
3521
3522 ###
3523 ### Definition lists
3524 ###
3525 !! test
3526 Simple definition
3527 !! wikitext
3528 ; name : Definition
3529 !! html
3530 <dl><dt> name&#160;</dt>
3531 <dd> Definition</dd></dl>
3532
3533 !! end
3534
3535 !! test
3536 Definition list for indentation only
3537 !! wikitext
3538 : Indented text
3539 !! html
3540 <dl><dd> Indented text</dd></dl>
3541
3542 !! end
3543
3544 !! test
3545 Definition list with no space
3546 !! wikitext
3547 ;name:Definition
3548 !! html
3549 <dl><dt>name</dt>
3550 <dd>Definition</dd></dl>
3551
3552 !!end
3553
3554 !! test
3555 Definition list with URL link
3556 !! wikitext
3557 ; http://example.com/ : definition
3558 !! html
3559 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3560 <dd> definition</dd></dl>
3561
3562 !! end
3563
3564 !! test
3565 Definition list with bracketed URL link
3566 !! wikitext
3567 ;[http://www.example.com/ Example]:Something about it
3568 !! html
3569 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3570 <dd>Something about it</dd></dl>
3571
3572 !! end
3573
3574 !! test
3575 Definition list with wikilink containing colon
3576 !! wikitext
3577 ; [[Help:FAQ]]: The least-read page on Wikipedia
3578 !! html
3579 <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>
3580 <dd> The least-read page on Wikipedia</dd></dl>
3581
3582 !! end
3583
3584 # At Brion's and JeLuF's insistence... :)
3585 !! test
3586 Definition list with news link containing colon
3587 !! wikitext
3588 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3589 !! html/php
3590 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3591 <dd> This isn't even a real newsgroup!</dd></dl>
3592
3593 !! html/parsoid
3594 <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>
3595 !! end
3596
3597 !! test
3598 Malformed definition list with colon
3599 !! wikitext
3600 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3601 !! html
3602 <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>
3603
3604 !! end
3605
3606 !! test
3607 Definition lists: colon in external link text
3608 !! wikitext
3609 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3610 !! html
3611 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3612 <dd> OK, I made that up</dd></dl>
3613
3614 !! end
3615
3616 !! test
3617 Definition lists: colon in HTML attribute
3618 !! wikitext
3619 ;<b style="display: inline">bold</b>
3620 !! html
3621 <dl><dt><b style="display: inline">bold</b></dt></dl>
3622
3623 !! end
3624
3625 !! test
3626 Definition lists: self-closed tag
3627 !! wikitext
3628 ;one<br/>two : two-line fun
3629 !! html
3630 <dl><dt>one<br />two&#160;</dt>
3631 <dd> two-line fun</dd></dl>
3632
3633 !! end
3634
3635 !! test
3636 Bug 11748: Literal closing tags
3637 !! wikitext
3638 <dl>
3639 <dt>test 1</dt>
3640 <dd>test test test test test</dd>
3641 <dt>test 2</dt>
3642 <dd>test test test test test</dd>
3643 </dl>
3644 !! html
3645 <dl>
3646 <dt>test 1</dt>
3647 <dd>test test test test test</dd>
3648 <dt>test 2</dt>
3649 <dd>test test test test test</dd>
3650 </dl>
3651
3652 !! end
3653
3654 !! test
3655 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3656 !! wikitext
3657 <ul><li>
3658 ; term : description
3659 * unordered
3660 </li></ul>
3661 !! html
3662 <ul><li>
3663 <dl><dt> term&#160;</dt>
3664 <dd> description</dd></dl>
3665 <ul><li> unordered</li></ul>
3666 </li></ul>
3667
3668 !! end
3669
3670 !! test
3671
3672 Definition list with empty definition and following paragraph
3673 !! wikitext
3674 ; term:
3675 Paragraph text
3676 !! html
3677 <dl><dt> term</dt>
3678 <dd></dd></dl>
3679 <p>Paragraph text
3680 </p>
3681 !! end
3682
3683 !! test
3684 Nested definition lists using html syntax
3685 !! wikitext
3686 <dl><dt>x</dt>
3687 <dd>a</dd>
3688 <dd>b</dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: No nesting: Multiple dd's
3694 !! wikitext
3695 ;x
3696 :a
3697 :b
3698 !! html
3699 <dl><dt>x</dt>
3700 <dd>a</dd>
3701 <dd>b</dd></dl>
3702
3703 !! end
3704
3705 !! test
3706 Definition Lists: Indentation: Regular
3707 !! wikitext
3708 :i1
3709 ::i2
3710 :::i3
3711 !! html
3712 <dl><dd>i1
3713 <dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Missing 1st level
3720 !! wikitext
3721 ::i2
3722 :::i3
3723 !! html
3724 <dl><dd><dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Multi-level indent
3731 !! wikitext
3732 :::i3
3733 !! html
3734 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition Lists: Hacky use to indent tables
3740 !! wikitext
3741 ::{|
3742 |foo
3743 |bar
3744 |}
3745 this text
3746 should be left alone
3747 !! html
3748 <dl><dd><dl><dd><table>
3749 <tr>
3750 <td>foo
3751 </td>
3752 <td>bar
3753 </td></tr></table></dd></dl></dd></dl>
3754 <p>this text
3755 should be left alone
3756 </p>
3757 !! end
3758
3759 !! test
3760 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3761 !! wikitext
3762 <!-- foo -->
3763 ::{|
3764 |foo
3765 |bar
3766 |}<!-- bar -->
3767 this text
3768 should be left alone
3769 !! html/parsoid
3770 <!-- foo -->
3771 <dl><dd><dl><dd><table><tr>
3772 <td>foo</td>
3773 <td>bar</td>
3774 </tr></table><!-- bar --></dd></dl></dd></dl>
3775 <p>this text
3776 should be left alone</p>
3777 !! end
3778
3779 !! test
3780 Definition Lists: Hacky use to indent tables, with comment before table
3781 !! wikitext
3782 ::<!-- foo -->{|
3783 |foo
3784 |}
3785 !! html/parsoid
3786 <dl><dd><dl><dd><!-- foo --><table><tr>
3787 <td>foo</td>
3788 </tr></table></dd></dl></dd></dl>
3789 !! end
3790
3791 # The trailing whitespace in this test is to catch a regression in
3792 # Parsoid after T54473.
3793 !! test
3794 Definition Lists: Hacky use to indent tables (WS-insensitive)
3795 !! wikitext
3796 : {|
3797 |a
3798 |}
3799 !! html/php
3800 <dl><dd><table>
3801 <tr>
3802 <td>a
3803 </td></tr></table></dd></dl>
3804
3805 !! html/parsoid
3806 <dl><dd> <table>
3807 <tbody><tr><td>a</td></tr>
3808 </tbody></table> </dd></dl>
3809 !! end
3810
3811 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3812 ## as an empty dt item. It also ignores all but the last ";" when followed
3813 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3814 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3815 ## ";"s.
3816 ##
3817 ## Ex: ";;t2 ::d2" is transformed into:
3818 ##
3819 ## <dl>
3820 ## <dt>t2 </dt>
3821 ## <dd>
3822 ## <dl>
3823 ## <dt></dt>
3824 ## <dd>d2</dd>
3825 ## </dl>
3826 ## </dd>
3827 ## </dl>
3828 ##
3829 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3830 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3831 ##
3832 ## <dl>
3833 ## <dt>
3834 ## <dl>
3835 ## <dt>t2 </dt>
3836 ## <dd>:d2</dd>
3837 ## </dl>
3838 ## </dt>
3839 ## </dl>
3840 ##
3841 ## All Parsoid only definition list tests have this difference.
3842 ##
3843 ## See also: https://phabricator.wikimedia.org/T8569
3844 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3845
3846 !! test
3847 Table / list interaction: indented table with lists in table contents
3848 !! wikitext
3849 :{|
3850 |-
3851 | a
3852 * b
3853 |-
3854 | c
3855 * d
3856 |}
3857 !! html
3858 <dl><dd><table>
3859
3860 <tr>
3861 <td> a
3862 <ul><li> b</li></ul>
3863 </td></tr>
3864 <tr>
3865 <td> c
3866 <ul><li> d</li></ul>
3867 </td></tr></table></dd></dl>
3868
3869 !! end
3870
3871 !!test
3872 Table / list interaction: lists nested in tables nested in indented lists
3873 !! wikitext
3874 :{|
3875 |
3876 :a
3877 :b
3878 |
3879 *c
3880 *d
3881 |}
3882
3883 *e
3884 *f
3885 !! html
3886 <dl><dd><table>
3887 <tr>
3888 <td>
3889 <dl><dd>a</dd>
3890 <dd>b</dd></dl>
3891 </td>
3892 <td>
3893 <ul><li>c</li>
3894 <li>d</li></ul>
3895 </td></tr></table></dd></dl>
3896 <ul><li>e</li>
3897 <li>f</li></ul>
3898
3899 !!end
3900
3901 !! test
3902 Definition Lists: Nesting: Multi-level (Parsoid only)
3903 !! options
3904 parsoid
3905 !! wikitext
3906 ;t1 :d1
3907 ;;t2 ::d2
3908 ;;;t3 :::d3
3909 !! html
3910 <dl>
3911 <dt>t1 </dt>
3912 <dd>d1</dd>
3913 <dt>
3914 <dl>
3915 <dt>t2 </dt>
3916 <dd>:d2</dd>
3917 <dt>
3918 <dl>
3919 <dt>t3 </dt>
3920 <dd>::d3</dd>
3921 </dl>
3922 </dt>
3923 </dl>
3924 </dt>
3925 </dl>
3926
3927
3928 !! end
3929
3930
3931 !! test
3932 Definition Lists: Nesting: Test 2 (Parsoid only)
3933 !! wikitext
3934 ;t1
3935 ::d2
3936 !! html/php+tidy
3937 <dl>
3938 <dt>t1</dt>
3939 <dd>
3940 <dl>
3941 <dd>d2</dd>
3942 </dl>
3943 </dd>
3944 </dl>
3945 !! html/parsoid
3946 <dl>
3947 <dt>t1</dt>
3948 <dd>
3949 <dl>
3950 <dd>d2</dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954
3955 !! end
3956
3957
3958 !! test
3959 Definition Lists: Nesting: Test 3 (Parsoid only)
3960 !! wikitext
3961 :;t1
3962 ::::d2
3963 !! html/php+tidy
3964 <dl>
3965 <dd>
3966 <dl>
3967 <dt>t1</dt>
3968 <dd>
3969 <dl>
3970 <dd>
3971 <dl>
3972 <dd>d2</dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976 </dd>
3977 </dl>
3978 </dd>
3979 </dl>
3980 !! html/parsoid
3981 <dl>
3982 <dd>
3983 <dl>
3984 <dt>t1</dt>
3985 <dd>
3986 <dl>
3987 <dd>
3988 <dl>
3989 <dd>d2</dd>
3990 </dl>
3991 </dd>
3992 </dl>
3993 </dd>
3994 </dl>
3995 </dd>
3996 </dl>
3997
3998 !! end
3999
4000
4001 !! test
4002 Definition Lists: Nesting: Test 4
4003 !! wikitext
4004 ::;t3
4005 :::d3
4006 !! html
4007 <dl><dd><dl><dd><dl><dt>t3</dt>
4008 <dd>d3</dd></dl></dd></dl></dd></dl>
4009
4010 !! end
4011
4012
4013 ## The Parsoid team believes the following three test exposes a
4014 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4015 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4016 ## It also exposes a "misfeature" in tidy, which doesn't like
4017 ## <dl> tags with a single <dt> child; it converts the <dt> into
4018 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4019 !! test
4020 Definition Lists: Mixed Lists: Test 1
4021 !! wikitext
4022 :;* foo
4023 ::* bar
4024 :; baz
4025 !! html/php
4026 <dl><dd><dl><dt><ul><li> foo</li>
4027 <li> bar</li></ul></dt></dl>
4028 <dl><dt> baz</dt></dl></dd></dl>
4029
4030 !! html/php+tidy
4031 <dl>
4032 <dd>
4033 <dl>
4034 <dd>
4035 <ul>
4036 <li>foo</li>
4037 <li>bar</li>
4038 </ul>
4039 </dd>
4040 </dl>
4041 <dl>
4042 <dt>baz</dt>
4043 </dl>
4044 </dd>
4045 </dl>
4046 !! html/parsoid
4047 <dl>
4048 <dd><dl>
4049 <dt><ul>
4050 <li> foo
4051 </li>
4052 </ul></dt>
4053 <dd><ul>
4054 <li> bar
4055 </li>
4056 </ul></dd>
4057 <dt> baz</dt>
4058 </dl></dd>
4059 </dl>
4060 !! end
4061
4062 !! test
4063 Definition Lists: Mixed Lists: Test 2
4064 !! wikitext
4065 *: d1
4066 *: d2
4067 !! html
4068 <ul><li><dl><dd> d1</dd>
4069 <dd> d2</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 3
4076 !! wikitext
4077 *::: d1
4078 *::: d2
4079 !! html
4080 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4081 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 4
4088 !! wikitext
4089 *;d1 :d2
4090 *;d3 :d4
4091 !! html
4092 <ul><li><dl><dt>d1&#160;</dt>
4093 <dd>d2</dd>
4094 <dt>d3&#160;</dt>
4095 <dd>d4</dd></dl></li></ul>
4096
4097 !! end
4098
4099
4100 !! test
4101 Definition Lists: Mixed Lists: Test 5
4102 !! wikitext
4103 *:d1
4104 *:: d2
4105 !! html
4106 <ul><li><dl><dd>d1
4107 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4108
4109 !! end
4110
4111
4112 !! test
4113 Definition Lists: Mixed Lists: Test 6
4114 !! wikitext
4115 #*:d1
4116 #*::: d3
4117 !! html
4118 <ol><li><ul><li><dl><dd>d1
4119 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Mixed Lists: Test 7
4126 !! wikitext
4127 :* d1
4128 :* d2
4129 !! html
4130 <dl><dd><ul><li> d1</li>
4131 <li> d2</li></ul></dd></dl>
4132
4133 !! end
4134
4135
4136 !! test
4137 Definition Lists: Mixed Lists: Test 8
4138 !! wikitext
4139 :* d1
4140 ::* d2
4141 !! html
4142 <dl><dd><ul><li> d1</li></ul>
4143 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 9
4150 !! wikitext
4151 *;foo :bar
4152 !! html
4153 <ul><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ul>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 10
4161 !! wikitext
4162 *#;foo :bar
4163 !! html
4164 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ol></li></ul>
4166
4167 !! end
4168
4169 # The Parsoid team disagrees with the PHP parser's seemingly-random
4170 # rules regarding dd/dt on the next two tests. Parsoid is more
4171 # consistent, and recognizes the shared nesting and keeps the
4172 # still-open tags around until the nesting is complete.
4173 # (And tidy again converts <dt> to <dd> before 'bar'.)
4174
4175 !! test
4176 Definition Lists: Mixed Lists: Test 11
4177 !! wikitext
4178 *#*#;*;;foo :bar
4179 *#*#;boo :baz
4180 !! html/php
4181 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4182 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4183 <dl><dt>boo&#160;</dt>
4184 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4185
4186 !! html/php+tidy
4187 <ul>
4188 <li>
4189 <ol>
4190 <li>
4191 <ul>
4192 <li>
4193 <ol>
4194 <li>
4195 <dl>
4196 <dt>foo&#160;</dt>
4197 <dd>
4198 <ul>
4199 <li>
4200 <dl>
4201 <dd>
4202 <dl>
4203 <dt>bar</dt>
4204 </dl>
4205 </dd>
4206 </dl>
4207 </li>
4208 </ul>
4209 </dd>
4210 </dl>
4211 <dl>
4212 <dt>boo&#160;</dt>
4213 <dd>baz</dd>
4214 </dl>
4215 </li>
4216 </ol>
4217 </li>
4218 </ul>
4219 </li>
4220 </ol>
4221 </li>
4222 </ul>
4223 !! html/parsoid
4224 <ul>
4225 <li>
4226 <ol>
4227 <li>
4228 <ul>
4229 <li>
4230 <ol>
4231 <li>
4232 <dl>
4233 <dt>
4234 <ul>
4235 <li>
4236 <dl>
4237 <dt>
4238 <dl>
4239 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4240 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4241 </dl></dt>
4242 </dl></li>
4243 </ul></dt>
4244 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4245 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4246 </dl></li>
4247 </ol></li>
4248 </ul></li>
4249 </ol></li>
4250 </ul>
4251 !! end
4252
4253
4254 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4255 # From whitelist:
4256 # * The test is wrong, there are two colons where there should be :;
4257 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4258 !! test
4259 Definition Lists: Weird Ones: Test 1
4260 !! wikitext
4261 *#;*::;; foo : bar (who uses this?)
4262 !! html/php
4263 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4264 <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>
4265
4266 !! html/php+tidy
4267 <ul>
4268 <li>
4269 <ol>
4270 <li>
4271 <dl>
4272 <dt>foo&#160;</dt>
4273 <dd>
4274 <ul>
4275 <li>
4276 <dl>
4277 <dd>
4278 <dl>
4279 <dd>
4280 <dl>
4281 <dd>
4282 <dl>
4283 <dt>bar (who uses this?)</dt>
4284 </dl>
4285 </dd>
4286 </dl>
4287 </dd>
4288 </dl>
4289 </dd>
4290 </dl>
4291 </li>
4292 </ul>
4293 </dd>
4294 </dl>
4295 </li>
4296 </ol>
4297 </li>
4298 </ul>
4299 !! html/parsoid
4300 <ul>
4301 <li>
4302 <ol>
4303 <li>
4304 <dl>
4305 <dt>
4306 <ul>
4307 <li>
4308 <dl>
4309 <dd>
4310 <dl>
4311 <dd>
4312 <dl>
4313 <dt>
4314 <dl>
4315 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4316 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4317 </dl></dt>
4318 </dl></dd>
4319 </dl></dd>
4320 </dl></li>
4321 </ul></dt>
4322 </dl></li>
4323 </ol></li>
4324 </ul>
4325 !! end
4326
4327 !! test
4328 Definition Lists: colons occurring in tags
4329 !! wikitext
4330 ;a:b
4331 ;'''a:b'''
4332 ;<i>a:b</i>
4333 ;<span>a:b</span>
4334 ;<div>a:b</div>
4335 ;<div>a
4336 :b</div>
4337 ;{{echo|a:b}}
4338 ;{{echo|''a:b''}}
4339 ;;;''a:b''
4340 !! html+tidy
4341 <dl>
4342 <dt>a</dt>
4343 <dd>b</dd>
4344 <dt><b>a:b</b></dt>
4345 <dt><i>a:b</i></dt>
4346 <dt><span>a:b</span></dt>
4347 <dd>
4348 <div>a:b</div>
4349 </dd>
4350 <dd>
4351 <div>a
4352 <dl>
4353 <dd>b</dd>
4354 </dl>
4355 </div>
4356 </dd>
4357 <dt>a</dt>
4358 <dd>b</dd>
4359 <dt><i>a:b</i></dt>
4360 </dl>
4361 <dl>
4362 <dd>
4363 <dl>
4364 <dd>
4365 <dl>
4366 <dt><i>a:b</i></dt>
4367 </dl>
4368 </dd>
4369 </dl>
4370 </dd>
4371 </dl>
4372 !! html/parsoid
4373 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4374 <dt><b>a:b</b></dt>
4375 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4376 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4377 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4378 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4379 <dd>b</dd>
4380 <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>
4381 <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>
4382 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4383 !! end
4384
4385 !! test
4386 Definition Lists: colons and tables 1
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd></dl>
4399 <dl><dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403
4404 !! end
4405
4406 # Parsoid's output (as documented below) differs from php's in this case.
4407 # This is probably a bug. If we fixup parsoid to match php's output, the
4408 # above test should pass and the below test case can be removed. It is
4409 # unclear which output is more desirable.
4410
4411 !! test
4412 Definition Lists: colons and tables 2
4413 !! wikitext
4414 :{|
4415 | x
4416 |}
4417 :{|
4418 | y
4419 |}
4420 !! html/parsoid
4421 <dl><dd><table>
4422 <tr>
4423 <td> x
4424 </td></tr></table></dd>
4425 <dd><table>
4426 <tr>
4427 <td> y
4428 </td></tr></table></dd></dl>
4429 !! end
4430
4431 !! test
4432 Definition Lists: template interaction
4433 !! wikitext
4434 ::{{definition_list}}
4435
4436 :one
4437 ::{{definition_list}}
4438 :::two
4439 :::three
4440 ::four
4441 !! html/parsoid
4442 <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">
4443 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4444
4445 <dl><dd data-parsoid='{}'>one
4446 <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">
4447 </span><dd about="#mwt2">two
4448 <dl><dd>two</dd>
4449 <dd>three</dd></dl></dd>
4450 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4451 !! end
4452
4453
4454 ###
4455 ### External links
4456 ###
4457 !! test
4458 External links: non-bracketed
4459 !! wikitext
4460 Non-bracketed: http://example.com
4461 !! html
4462 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4463 </p>
4464 !! end
4465
4466 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4467 !! test
4468 External links: numbered
4469 !! wikitext
4470 Numbered: [http://example.com]
4471 Numbered: [http://example.net]
4472 Numbered: [http://example.com]
4473 !! html/php
4474 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4475 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4476 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4477 </p>
4478 !! html/parsoid
4479 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4480 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4481 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4482 !!end
4483
4484 !! test
4485 External links: specified text
4486 !! wikitext
4487 Specified text: [http://example.com link]
4488 !! html
4489 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4490 </p>
4491 !!end
4492
4493 !! test
4494 External links: trail
4495 !! wikitext
4496 Linktrails should not work for external links: [http://example.com link]s
4497 !! html
4498 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4499 </p>
4500 !! end
4501
4502 !! test
4503 External links: dollar sign in URL
4504 !! wikitext
4505 http://example.com/1$2345
4506 !! html
4507 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4508 </p>
4509 !! end
4510
4511 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4512 !! test
4513 External links: dollar sign in URL (autonumber)
4514 !! wikitext
4515 [http://example.com/1$2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4521 !!end
4522
4523 !! test
4524 External links: open square bracket forbidden in URL (bug 4377)
4525 !! options
4526 parsoid=wt2html,wt2wt,html2html
4527 !! wikitext
4528 http://example.com/1[2345
4529 !! html/php
4530 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4531 </p>
4532 !! html/parsoid
4533 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4534 !! end
4535
4536 !! test
4537 External links: open square bracket forbidden in URL (named) (bug 4377)
4538 !! options
4539 parsoid=wt2html,html2html
4540 !! wikitext
4541 [http://example.com/1[2345]
4542 !! html/php
4543 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4544 </p>
4545 !! html/parsoid
4546 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4547 !!end
4548
4549 # parsoid adds a space before the link name
4550 !! test
4551 External links: open square bracket forbidden in URL (named) (bug 4377)
4552 Parsoid variant.
4553 !! wikitext
4554 [http://example.com/1 [2345]
4555 !! html
4556 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4557 </p>
4558 !!end
4559
4560 !! test
4561 External links: nowiki in URL link text (bug 6230)
4562 !! wikitext
4563 [http://example.com/ <nowiki>''example site''</nowiki>]
4564 !! html
4565 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4566 </p>
4567 !! end
4568
4569 !! test
4570 External links: newline forbidden in text (bug 6230 regression check)
4571 !! wikitext
4572 [http://example.com/ first
4573 second]
4574 !! html
4575 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4576 second]
4577 </p>
4578 !!end
4579
4580 !! test
4581 External links: Pipe char between url and text
4582 !! wikitext
4583 [http://example.com | link]
4584 !! html
4585 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4586 </p>
4587 !!end
4588
4589 !! test
4590 External links: protocol-relative URL in brackets
4591 !! wikitext
4592 [//example.com/ Test]
4593 !! html
4594 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4595 </p>
4596 !! end
4597
4598 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4599 !! test
4600 External links: protocol-relative URL in brackets without text
4601 !! wikitext
4602 [//example.com]
4603 !! html/php
4604 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4608 !! end
4609
4610 !! test
4611 External links: protocol-relative URL in free text is left alone
4612 !! wikitext
4613 //example.com/Foo
4614 !! html
4615 <p>//example.com/Foo
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4621 !! wikitext
4622 foo//example.com/Foo
4623 !! html
4624 <p>foo//example.com/Foo
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: with no contents
4630 !! wikitext
4631 [http://en.wikipedia.org/wiki/Foo]
4632
4633 [[wikipedia:Foo|Bar]]
4634
4635 [[wikipedia:Foo|<span>Bar</span>]]
4636 !! html/php
4637 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4638 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4639 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4640 </p>
4641 !! html/parsoid
4642 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4643 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4644 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4645 !! end
4646
4647 !! test
4648 External links: Free with trailing punctuation
4649 !! wikitext
4650 http://example.com,
4651 http://example.com;
4652 http://example.com\
4653 http://example.com.
4654 http://example.com:
4655 http://example.com!
4656 http://example.com?
4657 http://example.com)
4658 http://example.com/url_with_(brackets)
4659 (http://example.com/url_without_brackets)
4660 http://example.com/url_with_entity&amp;
4661 http://example.com/url_with_entity&#x26;
4662 http://example.com/url_with_entity&#038;
4663 http://example.com/url_with_entity&nbsp;
4664 http://example.com/url_with_entity&#xA0;
4665 http://example.com/url_with_entity&#160;
4666 http://example.com/url_with_entity&lt;
4667 http://example.com/url_with_entity&#x3C;
4668 http://example.com/url_with_entity&#60;
4669 !! html/php
4670 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4675 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4677 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4679 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4687 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4689 </p>
4690 !! html/parsoid
4691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4696 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4697 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4698 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4700 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <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>
4705 <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>
4706 <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>
4707 <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>
4708 <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>
4709 <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>
4710 !! end
4711
4712 !! test
4713 External links: tricky Parsoid html2html case
4714 !! options
4715 parsoid=wt2html,wt2wt,html2html
4716 !! wikitext
4717 http://example.com/url_with_entity&amp;amp;
4718 !! html/php
4719 <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>;
4720 </p>
4721 !! html/parsoid
4722 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4723 !! end
4724
4725 !! test
4726 External links: Free with trailing quotes (T113666)
4727 !! wikitext
4728 '''News:''' Stuff here
4729
4730 news:'a'b''c''d e
4731 !! html/php
4732 <p><b>News:</b> Stuff here
4733 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4734 </p>
4735 !! html/parsoid
4736 <p><b>News:</b> Stuff here</p>
4737 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4738 !! end
4739
4740 !! test
4741 External links: Lone protocols are never linked (T105697)
4742 !! wikitext
4743 http://
4744 http://;
4745 (http://)
4746 bitcoin:
4747 bitcoin:;
4748 (bitcoin:)
4749 !! html
4750 <p>http://
4751 http://;
4752 (http://)
4753 bitcoin:
4754 bitcoin:;
4755 (bitcoin:)
4756 </p>
4757 !! end
4758
4759 !! test
4760 External links: No preceding word characters allowed (bug 65278)
4761 !! wikitext
4762 NOPEhttp://example.com
4763 N0http://example.com
4764 ok:http://example.com
4765 ok-http://example.com
4766 !! html
4767 <p>NOPEhttp://example.com
4768 N0http://example.com
4769 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4770 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4771 </p>
4772 !! end
4773
4774 !! test
4775 External image
4776 !! wikitext
4777 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4778 !! html
4779 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4780 </p>
4781 !! end
4782
4783 !! test
4784 External image from https
4785 !! wikitext
4786 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4787 !! html
4788 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4789 </p>
4790 !! end
4791
4792 !! test
4793 External image (when not allowed)
4794 !! options
4795 wgAllowExternalImages=0
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <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>
4800 </p>
4801 !! end
4802
4803 !! test
4804 Link to non-http image, no img tag
4805 !! wikitext
4806 Link to non-http image, no img tag: ftp://example.com/test.jpg
4807 !! html
4808 <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>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External links: terminating separator
4814 !! wikitext
4815 Terminating separator: http://example.com/thing,
4816 !! html
4817 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4818 </p>
4819 !! end
4820
4821 !! test
4822 External links: intervening separator
4823 !! wikitext
4824 Intervening separator: http://example.com/1,2,3
4825 !! html
4826 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4827 </p>
4828 !! end
4829
4830 !! test
4831 External links: old bug with URL in query
4832 !! wikitext
4833 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4834 !! html
4835 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4836 </p>
4837 !! end
4838
4839 !! test
4840 External links: old URL-in-URL bug, mixed protocols
4841 !! wikitext
4842 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4843 !! html
4844 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4845 </p>
4846 !!end
4847
4848 !! test
4849 External links: URL in text
4850 !! wikitext
4851 URL in text: [http://example.com http://example.com]
4852 !! html
4853 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4854 </p>
4855 !! end
4856
4857 !! test
4858 External links: Clickable images
4859 !! wikitext
4860 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4861 !! html/php
4862 <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>
4863 </p>
4864 !! html/parsoid
4865 <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>
4866 !! end
4867
4868 !! test
4869 External links: raw ampersand
4870 !! wikitext
4871 Old &amp; use: http://x&y
4872 !! html
4873 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: encoded ampersand
4879 !! wikitext
4880 Old &amp; use: http://x&amp;y
4881 !! html/php
4882 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4883 </p>
4884 !! html/parsoid
4885 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4886 !! end
4887
4888 !! test
4889 External links: encoded equals (bug 6102)
4890 !! wikitext
4891 http://example.com/?foo&#61;bar
4892 !! html/php
4893 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4894 </p>
4895 !! html/parsoid
4896 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4897 !! end
4898
4899 ##
4900 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4901 ## does it number them. As discussed in bug 53505, we can identify
4902 ## autonumbered links via CSS.
4903 ##
4904
4905 !! test
4906 External links: [raw ampersand]
4907 !! wikitext
4908 Old &amp; use: [http://x&y]
4909 !! html/php
4910 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4911 </p>
4912 !! html/parsoid
4913 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4914 !! end
4915
4916 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4917 # mode will return the [raw ampersand] wikitext
4918 !! test
4919 External links: [encoded ampersand]
4920 !! options
4921 parsoid=wt2html,wt2wt,html2html
4922 !! wikitext
4923 Old &amp; use: [http://x&amp;y]
4924 !! html/php
4925 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4926 </p>
4927 !! html/parsoid
4928 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4929 !! end
4930
4931 !! test
4932 External links: [raw equals]
4933 !! wikitext
4934 [http://example.com/?foo=bar]
4935 !! html/php
4936 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4937 </p>
4938 !! html/parsoid
4939 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4940 !! end
4941
4942 # note that parsoid html is identical to [raw equals] case; so html2wt
4943 # mode will return the [raw equals] wikitext
4944 !! test
4945 External links: [encoded equals] (bug 6102)
4946 !! options
4947 parsoid=wt2html,wt2wt,html2html
4948 !! wikitext
4949 [http://example.com/?foo&#61;bar]
4950 !! html/php
4951 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4952 </p>
4953 !! html/parsoid
4954 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4955 !! end
4956
4957 # xxx parsoid strips the IDN character, so the round-trip tests will
4958 # obviously fail and are disabled. --cscott
4959 !! test
4960 External links: [IDN ignored character reference in hostname; strip it right off]
4961 !! options
4962 parsoid=wt2html,wt2wt,html2html
4963 !! wikitext
4964 [http://e&zwnj;xample.com/]
4965 !! html/php
4966 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4967 </p>
4968 !! html/parsoid
4969 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4970 !! end
4971
4972 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4973 # Where an external link could easily circumvent the sanitization of the text of
4974 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4975 # test demands a higher standard. That's a bit strange.
4976 #
4977 # Example:
4978 #
4979 # http://e‌xample.com -> [http://example.com|http://example.com]
4980 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4981 #
4982 # The first example is sanitized, but the second is not. Any security benefits
4983 # from this production are trivial to circumvent. Either remove this test and
4984 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4985 # the test accordingly.
4986 #
4987 # All our love,
4988 # The Parsoid team.
4989 # xxx parsoid strips the IDN character, so the round-trip tests will
4990 # obviously fail and are disabled. --cscott
4991 !! test
4992 External links: IDN ignored character reference in hostname; strip it right off
4993 !! options
4994 parsoid=wt2html,html2html
4995 !! wikitext
4996 http://e&zwnj;xample.com/
4997 !! html/php
4998 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4999 </p>
5000 !! html/parsoid
5001 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5002 !! end
5003
5004 !! test
5005 External links: www.jpeg.org (bug 554)
5006 !! wikitext
5007 http://www.jpeg.org
5008 !! html
5009 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5010 </p>
5011 !! end
5012
5013 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5014 !! test
5015 External links: URL within URL (original bug 2)
5016 !! wikitext
5017 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5018 !! html/php
5019 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5020 </p>
5021 !! html/parsoid
5022 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5023 !! end
5024
5025 !! test
5026 BUG 361: URL inside bracketed URL
5027 !! wikitext
5028 [http://www.example.com/foo http://www.example.com/bar]
5029 !! html
5030 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5031 </p>
5032 !! end
5033
5034 !! test
5035 BUG 361: URL within URL, not bracketed
5036 !! wikitext
5037 http://www.example.com/foo?=http://www.example.com/bar
5038 !! html
5039 <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>
5040 </p>
5041 !! end
5042
5043 !! test
5044 BUG 289: ">"-token in URL-tail
5045 !! wikitext
5046 http://www.example.com/<hello>
5047 !! html
5048 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5049 </p>
5050 !!end
5051
5052 !! test
5053 BUG 289: literal ">"-token in URL-tail
5054 !! wikitext
5055 http://www.example.com/<b>html</b>
5056 !! html/php
5057 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5058 </p>
5059 !! html/parsoid
5060 <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>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in bracketed URL
5065 !! wikitext
5066 [http://www.example.com/<hello> stuff]
5067 !! html
5068 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in bracketed URL
5074 !! wikitext
5075 [http://www.example.com/<b>html</b> stuff]
5076 !! html
5077 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5078 </p>
5079 !!end
5080
5081 !! test
5082 BUG 289: literal double quote at end of URL
5083 !! wikitext
5084 http://www.example.com/"hello"
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5087 </p>
5088 !!end
5089
5090 !! test
5091 BUG 289: literal double quote in bracketed URL
5092 !! wikitext
5093 [http://www.example.com/"hello" stuff]
5094 !! html
5095 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5096 </p>
5097 !!end
5098
5099 !! test
5100 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5101 !! wikitext
5102 [http://www.example.com test]
5103 !! html
5104 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5105 </p>
5106 !! end
5107
5108 !! test
5109 External links: link text with spaces
5110 !! wikitext
5111 [http://www.example.com a b c]
5112 [http://www.example.com ''a'' ''b'']
5113 !! html
5114 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5115 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5116 </p>
5117 !! end
5118
5119 !! test
5120 External links: wiki links within external link (Bug 3695)
5121 !! options
5122 parsoid=wt2html,html2html
5123 !! wikitext
5124 [http://example.com [[wikilink]] embedded in ext link]
5125 !! html/php
5126 <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>
5127 </p>
5128 !! html/parsoid
5129 <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>
5130 !! end
5131
5132 !! test
5133 BUG 787: Links with one slash after the url protocol are invalid
5134 !! wikitext
5135 http:/example.com
5136
5137 [http:/example.com title]
5138 !! html
5139 <p>http:/example.com
5140 </p><p>[http:/example.com title]
5141 </p>
5142 !! end
5143
5144 !! test
5145 Bracketed external links with template-generated invalid target
5146 !! wikitext
5147 [{{echo|http:/example.com}} title]
5148 !! html
5149 <p>[http:/example.com title]
5150 </p>
5151 !! end
5152
5153 !! test
5154 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5155 !! wikitext
5156 ''[http://example.com text'']
5157 [http://example.com '''text]'''
5158 ''Something [http://example.com in italic'']
5159 ''Something [http://example.com mixed''''', even bold]'''
5160 '''''Now [http://example.com both''''']
5161 !! html
5162 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5163 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5164 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5165 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5166 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5167 </p>
5168 !! end
5169
5170
5171 !! test
5172 Bug 4781: %26 in URL
5173 !! wikitext
5174 http://www.example.com/?title=AT%26T
5175 !! html/php
5176 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5177 </p>
5178 !! html/parsoid
5179 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5180 !! end
5181
5182 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5183 # % is actually legal in HTML5. Any change in output would need testing though.
5184 !! test
5185 Bug 4781, 5267: %25 in URL
5186 !! wikitext
5187 http://www.example.com/?title=100%25_Bran
5188 !! html/php
5189 <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>
5190 </p>
5191 !! html/parsoid
5192 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5193 !! end
5194
5195 !! test
5196 Bug 4781, 5267: %28, %29 in URL
5197 !! wikitext
5198 http://www.example.com/?title=Ben-Hur_%281959_film%29
5199 !! html/php
5200 <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>
5201 </p>
5202 !! html/parsoid
5203 <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>
5204 !! end
5205
5206
5207 !! test
5208 Bug 4781: %26 in autonumber URL
5209 !! wikitext
5210 [http://www.example.com/?title=AT%26T]
5211 !! html/php
5212 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5213 </p>
5214 !! html/parsoid
5215 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5216 !! end
5217
5218 !! test
5219 Bug 4781, 5267: %26 in autonumber URL
5220 !! wikitext
5221 [http://www.example.com/?title=100%25_Bran]
5222 !! html/php
5223 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5224 </p>
5225 !! html/parsoid
5226 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5227 !! end
5228
5229 !! test
5230 Bug 4781, 5267: %28, %29 in autonumber URL
5231 !! wikitext
5232 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5233 !! html/php
5234 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5235 </p>
5236 !! html/parsoid
5237 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5238 !! end
5239
5240
5241 !! test
5242 Bug 4781: %26 in bracketed URL
5243 !! wikitext
5244 [http://www.example.com/?title=AT%26T link]
5245 !! html/php
5246 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5250 !! end
5251
5252 !! test
5253 Bug 4781, 5267: %25 in bracketed URL
5254 !! wikitext
5255 [http://www.example.com/?title=100%25_Bran link]
5256 !! html
5257 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5258 </p>
5259 !! end
5260
5261 !! test
5262 Bug 4781, 5267: %28, %29 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5270 !! end
5271
5272 !! test
5273 External link containing a period in the anchor. (bug 63947)
5274 !! wikitext
5275 [//foo.org/bar#baz. bang]
5276
5277 [//foo.org/bar. bang]
5278 !! html/php
5279 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5280 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5281 </p>
5282 !! html/parsoid
5283 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5284 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5285 !! end
5286
5287 !! test
5288 External link containing a single quote. (bug 63947)
5289 !! wikitext
5290 [//foo.org/bar'baz]
5291
5292 [//foo.org/bar'baz bang]
5293 !! html/php
5294 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5295 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5299 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5300 !! end
5301
5302 !! test
5303 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5304 !! wikitext
5305 Some [http://example.com/ pretty ''italics'' and stuff]!
5306 !! html
5307 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5308 </p>
5309 !! end
5310
5311 !! test
5312 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5313 !! wikitext
5314 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5315 !! html
5316 <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>
5317 </p>
5318 !! end
5319
5320 !! test
5321 External link containing double-single-quotes with no space separating the url from text in italics
5322 !! wikitext
5323 [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]].]
5324 !! html/php
5325 <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>
5326 </p>
5327 !! html/php+tidy
5328 <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>
5329 !! html/parsoid
5330 <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>
5331 !! end
5332
5333 !! test
5334 External link with comments in link text
5335 !! wikitext
5336 [http://www.google.com Google <!-- comment -->]
5337 !! html/php
5338 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5339 </p>
5340 !! html/parsoid
5341 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5342 !! end
5343
5344 !! test
5345 External link to bare IPv4 address
5346 !! wikitext
5347 [http://192.168.0.1 Link]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5350 </p>
5351 !! html/parsoid
5352 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5353 !! end
5354
5355 !! test
5356 URL-encoding in URL functions (single parameter)
5357 !! wikitext
5358 {{localurl:Some page|amp=&}}
5359 !! html
5360 <p>/index.php?title=Some_page&amp;amp=&amp;
5361 </p>
5362 !! end
5363
5364 !! test
5365 URL-encoding in URL functions (multiple parameters)
5366 !! wikitext
5367 {{localurl:Some page|q=?&amp=&}}
5368 !! html
5369 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5370 </p>
5371 !! end
5372
5373 !! test
5374 Brackets in urls
5375 !! wikitext
5376 http://example.com/index.php?foozoid%5B%5D=bar
5377
5378 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5379 !! html/php
5380 <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>
5381 </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>
5382 </p>
5383 !! html/parsoid
5384 <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>
5385
5386 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5387 !! end
5388
5389 !! test
5390 IPv6 urls, autolink format (T23261)
5391 !! wikitext
5392 http://[2404:130:0:1000::187:2]/index.php
5393
5394 Examples from RFC 2373, section 2.2:
5395 * http://[1080::8:800:200C:417A]/unicast
5396 * http://[FF01::101]/multicast
5397 * http://[::1]/loopback
5398 * http://[::]/unspecified
5399 * http://[::13.1.68.3]/ipv4compat
5400 * http://[::FFFF:129.144.52.38]/ipv4compat
5401
5402 Examples from RFC 2732, section 2:
5403 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5404 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5405 * http://[3ffe:2a00:100:7031::1]
5406 * http://[1080::8:800:200C:417A]/foo
5407 * http://[::192.9.5.5]/ipng
5408 * http://[::FFFF:129.144.52.38]:80/index.html
5409 * http://[2010:836B:4179::836B:4179]
5410
5411 !! html/php
5412 <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>
5413 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5414 </p>
5415 <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>
5416 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5418 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5419 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5420 <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>
5421 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5422 </p>
5423 <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>
5424 <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>
5425 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5428 <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>
5429 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5430
5431 !! html/parsoid
5432 <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>
5433
5434 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5435 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441
5442 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5443 <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>
5444 <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>
5445 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <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>
5449 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450 !! end
5451
5452 !! test
5453 IPv6 urls, bracketed format (T23261)
5454 !! wikitext
5455 [http://[2404:130:0:1000::187:2]/index.php test]
5456
5457 Examples from RFC 2373, section 2.2:
5458 * [http://[1080::8:800:200C:417A] unicast]
5459 * [http://[FF01::101] multicast]
5460 * [http://[::1]/ loopback]
5461 * [http://[::] unspecified]
5462 * [http://[::13.1.68.3] ipv4compat]
5463 * [http://[::FFFF:129.144.52.38] ipv4compat]
5464
5465 Examples from RFC 2732, section 2:
5466 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5467 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5468 * [http://[3ffe:2a00:100:7031::1] 3]
5469 * [http://[1080::8:800:200C:417A]/foo 4]
5470 * [http://[::192.9.5.5]/ipng 5]
5471 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5472 * [http://[2010:836B:4179::836B:4179] 7]
5473
5474 !! html/php
5475 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5476 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5477 </p>
5478 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5481 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5484 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5485 </p>
5486 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5493
5494 !! html/parsoid
5495 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5496
5497 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5498 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504
5505 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5506 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513 !! end
5514
5515 !! test
5516 Non-extlinks in brackets
5517 !! wikitext
5518 [foo]
5519 [foo bar]
5520 [foo ''bar'']
5521 [fool's] errand
5522 [fool's errand]
5523 [{{echo|foo}}]
5524 [{{echo|foo}} bar]
5525 [{{echo|foo}} ''bar'']
5526 [{{echo|foo}}l's] errand
5527 [{{echo|foo}}l's errand]
5528 [url={{echo|foo}}]
5529 [url=http://example.com]
5530 [http:// bare protocols don't count]
5531 !! html/php
5532 <p>[foo]
5533 [foo bar]
5534 [foo <i>bar</i>]
5535 [fool's] errand
5536 [fool's errand]
5537 [foo]
5538 [foo bar]
5539 [foo <i>bar</i>]
5540 [fool's] errand
5541 [fool's errand]
5542 [url=foo]
5543 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5544 [http:// bare protocols don't count]
5545 </p>
5546 !! html/parsoid
5547 <p>[foo]
5548 [foo bar]
5549 [foo <i>bar</i>]
5550 [fool's] errand
5551 [fool's errand]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5555 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5556 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5557 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5558 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5559 [http:// bare protocols don't count]</p>
5560 !! end
5561
5562 !! test
5563 Percent encoding in external links
5564 !! wikitext
5565 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5566 !! html/php
5567 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5568 </p>
5569 !! html/parsoid
5570 <p><a rel="mw:ExtLink"
5571 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5572 !! end
5573
5574 !! test
5575 Use url link syntax for links where the content is equal the link target
5576 !! wikitext
5577 http://example.com
5578 !! html/php
5579 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5580 </p>
5581 !! html/parsoid
5582 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5583 !! end
5584
5585 !! test
5586 Parenthesis in external links, especially URL links
5587 !! wikitext
5588 http://example.com)
5589
5590 http://example.com/test)
5591
5592 http://example.com/(test)
5593
5594 http://example.com/((test)
5595
5596 (http://example.com/(test))
5597
5598 (http://example.com/(test)))))
5599
5600 http://example.com/a)b
5601
5602 [http://example.com) foo]
5603 !! html/php
5604 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5605 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5606 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5608 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5609 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5610 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5611 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5612 </p>
5613 !! html/parsoid
5614 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5615 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5616 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5618 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5619 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5620 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5621 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5622 !! end
5623
5624 !! test
5625 Parenthesis in external links, w/ transclusion or comment
5626 !! wikitext
5627 (http://example.com/{{echo|hi}})
5628
5629 (http://example.com<!-- hi -->)
5630 !! html/php
5631 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5632 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5633 </p>
5634 !! html/parsoid
5635 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5636
5637 <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>
5638 !! end
5639
5640 !! test
5641 Serialize <a> tags with invalid link targets as plain text
5642 !! options
5643 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5644 !! html/parsoid
5645 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5646 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5647 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5648 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5649 !! wikitext
5650 text
5651 <nowiki>*</nowiki>text
5652 <nowiki>[[foo]]</nowiki>
5653 <nowiki>*a [[foo]]</nowiki>
5654 !! end
5655
5656 !! test
5657 mw:ExtLink -vs- mw:WikiLink (T94723)
5658 !! options
5659 parsoid=html2wt
5660 !! html/parsoid
5661 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5662 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5663 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5664 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5665 <p>
5666 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5667 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5668 </p>
5669 !! wikitext
5670 [[Foo|Bar]]
5671 [[Foo|Bar]]
5672 [[wikipedia:Foo|Bar]]
5673 [[wikipedia:Foo|Bar]]
5674
5675 [[wikipedia:European_Robin|European Robin]]
5676 [[wikipedia:European_Robin|European Robin]]
5677 !! end
5678
5679 !! test
5680 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5681 !! options
5682 parsoid=wt2wt
5683 !! wikitext
5684 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5685 !! html/parsoid
5686 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5687 !! end
5688
5689
5690 ###
5691 ### Quotes
5692 ###
5693
5694 !! test
5695 Quotes
5696 !! wikitext
5697 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5698
5699 Normal text. '''''Bold italic text.''''' Normal text.
5700 !! html
5701 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5702 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5703 </p>
5704 !! end
5705
5706
5707 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5708 # parser strips. The wikitext contains just the first half of the bold
5709 # quote pair.
5710 !! test
5711 Unclosed and unmatched quotes
5712 !! wikitext
5713 '''''Bold italic text '''with bold deactivated''' in between.'''''
5714
5715 '''''Bold italic text ''with italic deactivated'' in between.'''''
5716
5717 '''Bold text..
5718
5719 ..spanning two paragraphs (should not work).'''
5720
5721 '''Bold tag left open
5722
5723 ''Italic tag left open
5724
5725 Normal text.
5726
5727 <!-- Unmatching number of opening, closing tags: -->
5728 '''This year''''s election ''should'' beat '''last year''''s.
5729
5730 ''Tom'''s car is bigger than ''Susan'''s.
5731
5732 Plain ''italic'''s plain
5733 !! html/php
5734 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5735 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5736 </p><p><b>Bold text..</b>
5737 </p><p>..spanning two paragraphs (should not work).
5738 </p><p><b>Bold tag left open</b>
5739 </p><p><i>Italic tag left open</i>
5740 </p><p>Normal text.
5741 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5742 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5743 </p><p>Plain <i>italic'</i>s plain
5744 </p>
5745 !! html/parsoid
5746 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5747 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5748 </p><p><b>Bold text..</b>
5749 </p><p>..spanning two paragraphs (should not work).<b></b>
5750 </p><p><b>Bold tag left open</b>
5751 </p><p><i>Italic tag left open</i>
5752 </p><p>Normal text.
5753 </p>
5754 <!-- Unmatching number of opening, closing tags: -->
5755 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5756 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5757 </p><p>Plain <i>italic'</i>s plain
5758 </p>
5759 !! end
5760
5761 ###
5762 ### Tables
5763 ###
5764 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5765 ###
5766
5767 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5768 # is the bare minimum required by the spec, see:
5769 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5770 # Parsoid team replies: empty table tags are legal in HTML5
5771 !! test
5772 A table with no data.
5773 !! options
5774 parsoid=wt2html
5775 !! wikitext
5776 {||}
5777 !! html/php
5778
5779 !! html/parsoid
5780 <table></table>
5781
5782 !! end
5783
5784 !! test
5785 A table with stray table end tags on start tag line (wt2html)
5786 !! options
5787 parsoid=wt2html
5788 !! wikitext
5789 {|style="color: red;"|}
5790
5791 {|style="color: red;" |}
5792 |foo
5793 |}
5794
5795 {|style="color: red;"|} id="foo"
5796 |foo
5797 |}
5798
5799 {|style="color: red;" |} id="foo"
5800 |foo
5801 |}
5802 !! html
5803 <table style="color: red;"></table>
5804
5805 <table style="color: red;">
5806 <tbody><tr>
5807 <td>foo</td>
5808 </tr></tbody>
5809 </table>
5810
5811 <table style="color: red;" id="foo">
5812 <tbody><tr>
5813 <td>foo</td>
5814 </tr></tbody>
5815 </table>
5816
5817 <table style="color: red;" id="foo">
5818 <tbody><tr>
5819 <td>foo</td>
5820 </tr></tbody>
5821 </table>
5822
5823 !! end
5824
5825 !! test
5826 A table with no data (take 2)
5827 !! wikitext
5828 {|
5829 |}
5830 !! html/parsoid
5831 <table></table>
5832 !! end
5833
5834 # A table with nothing but a caption is invalid XHTML, we might want to render
5835 # this as <p>caption</p>
5836 # Parsoid team replies: table with only a caption is legal in HTML5
5837 !! test
5838 A table with nothing but a caption
5839 !! wikitext
5840 {|
5841 |+ caption
5842 |}
5843 !! html/php
5844 <table>
5845 <caption> caption
5846 </caption><tr><td></td></tr></table>
5847
5848 !! html/parsoid
5849 <table><caption> caption</caption></table>
5850 !! end
5851
5852 !! test
5853 A table with caption with default-spaced attributes and a table row
5854 !! wikitext
5855 {|
5856 |+ style="color: red;" | caption1
5857 |-
5858 | foo
5859 |}
5860 !! html
5861 <table>
5862 <caption style="color: red;"> caption1
5863 </caption>
5864 <tr>
5865 <td> foo
5866 </td></tr></table>
5867
5868 !! end
5869
5870 !! test
5871 A table with captions with non-default spaced attributes and a table row
5872 !! wikitext
5873 {|
5874 |+style="color: red;"|caption2
5875 |+ style="color: red;"| caption3
5876 |-
5877 | foo
5878 |}
5879 !! html
5880 <table>
5881 <caption style="color: red;">caption2
5882 </caption>
5883 <caption style="color: red;"> caption3
5884 </caption>
5885 <tr>
5886 <td> foo
5887 </td></tr></table>
5888
5889 !! end
5890
5891 !! test
5892 Table td-cell syntax variations
5893 !! wikitext
5894 {|
5895 | foo bar foo | baz
5896 | foo bar foo || baz
5897 | style='color:red;' | baz
5898 | style='color:red;' || baz
5899 |}
5900 !! html
5901 <table>
5902 <tr>
5903 <td> baz
5904 </td>
5905 <td> foo bar foo </td>
5906 <td> baz
5907 </td>
5908 <td style="color:red;"> baz
5909 </td>
5910 <td> style='color:red;' </td>
5911 <td> baz
5912 </td></tr></table>
5913
5914 !! end
5915
5916 !! test
5917 Simple table
5918 !! wikitext
5919 {|
5920 | 1 || 2
5921 |-
5922 | 3 || 4
5923 |}
5924 !! html
5925 <table>
5926 <tr>
5927 <td> 1 </td>
5928 <td> 2
5929 </td></tr>
5930 <tr>
5931 <td> 3 </td>
5932 <td> 4
5933 </td></tr></table>
5934
5935 !! end
5936
5937 !! test
5938 Simple table but with multiple dashes for row wikitext
5939 !! wikitext
5940 {|
5941 | foo
5942 |-----
5943 | bar
5944 |}
5945 !! html
5946 <table>
5947 <tr>
5948 <td> foo
5949 </td></tr>
5950 <tr>
5951 <td> bar
5952 </td></tr></table>
5953
5954 !! end
5955
5956 !! test
5957 Multiplication table
5958 !! wikitext
5959 {| border="1" cellpadding="2"
5960 |+Multiplication table
5961 |-
5962 ! &times; !! 1 !! 2 !! 3
5963 |-
5964 ! 1
5965 | 1 || 2 || 3
5966 |-
5967 ! 2
5968 | 2 || 4 || 6
5969 |-
5970 ! 3
5971 | 3 || 6 || 9
5972 |-
5973 ! 4
5974 | 4 || 8 || 12
5975 |-
5976 ! 5
5977 | 5 || 10 || 15
5978 |}
5979 !! html
5980 <table border="1" cellpadding="2">
5981 <caption>Multiplication table
5982 </caption>
5983 <tr>
5984 <th> &#215; </th>
5985 <th> 1 </th>
5986 <th> 2 </th>
5987 <th> 3
5988 </th></tr>
5989 <tr>
5990 <th> 1
5991 </th>
5992 <td> 1 </td>
5993 <td> 2 </td>
5994 <td> 3
5995 </td></tr>
5996 <tr>
5997 <th> 2
5998 </th>
5999 <td> 2 </td>
6000 <td> 4 </td>
6001 <td> 6
6002 </td></tr>
6003 <tr>
6004 <th> 3
6005 </th>
6006 <td> 3 </td>
6007 <td> 6 </td>
6008 <td> 9
6009 </td></tr>
6010 <tr>
6011 <th> 4
6012 </th>
6013 <td> 4 </td>
6014 <td> 8 </td>
6015 <td> 12
6016 </td></tr>
6017 <tr>
6018 <th> 5
6019 </th>
6020 <td> 5 </td>
6021 <td> 10 </td>
6022 <td> 15
6023 </td></tr></table>
6024
6025 !! end
6026
6027 !! test
6028 Accept "||" in table headings
6029 !! wikitext
6030 {|
6031 !h1 || h2
6032 |}
6033 !! html
6034 <table>
6035 <tr>
6036 <th>h1 </th>
6037 <th> h2
6038 </th></tr></table>
6039
6040 !! end
6041
6042 !! test
6043 Accept "!!" in table data
6044 !! wikitext
6045 {|
6046 | Foo!! ||
6047 |}
6048 !! html
6049 <table>
6050 <tr>
6051 <td> Foo!! </td>
6052 <td>
6053 </td></tr></table>
6054
6055 !! html/parsoid
6056 <table>
6057 <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>
6058 </tbody></table>
6059 !! end
6060
6061 !! test
6062 Accept "||" in indented table headings
6063 !! wikitext
6064 :{|
6065 !h1 || h2
6066 |}
6067 !! html
6068 <dl><dd><table>
6069 <tr>
6070 <th>h1 </th>
6071 <th> h2
6072 </th></tr></table></dd></dl>
6073
6074 !! end
6075
6076 !! test
6077 Accept "!!" in templates
6078 !! wikitext
6079 {|
6080 !a {{echo|b!!c}}
6081 |}
6082 !! html/php
6083 <table>
6084 <tr>
6085 <th>a b</th>
6086 <th>c
6087 </th></tr></table>
6088
6089 !! html/parsoid
6090 <table>
6091 <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>
6092 !! end
6093
6094 !! test
6095 Accept "!!" in table headings after newline
6096 !! wikitext
6097 {|
6098 !a
6099 b!!c
6100 |}
6101 !! html/php
6102 <table>
6103 <tr>
6104 <th>a
6105 <p>b!!c
6106 </p>
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th>a
6112 <p>b!!c</p></th></tr>
6113 </tbody></table>
6114 !! end
6115
6116 !! test
6117 Accept "!!" in table data of mixed wikitext / html syntax
6118 !! wikitext
6119 {|
6120 !a
6121 <tr><td>b!!c</td></tr>
6122 |}
6123 !! html+tidy
6124 <table>
6125 <tr>
6126 <th>a</th>
6127 </tr>
6128 <tr>
6129 <td>b!!c</td>
6130 </tr>
6131 </table>
6132 !! html/parsoid
6133 <table>
6134 <tbody><tr><th>a</th></tr>
6135 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6136 </tbody></table>
6137 !! end
6138
6139 !! test
6140 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6141 !! wikitext
6142 {|
6143 !| h1
6144 || a
6145 |}
6146 !! html
6147 <table>
6148 <tr>
6149 <th> h1
6150 </th>
6151 <td> a
6152 </td></tr></table>
6153
6154 !! end
6155
6156 !!test
6157 Accept "| !" at start of line in tables (ignore !-attribute)
6158 !! wikitext
6159 {|
6160 |-
6161 | !style="color:red" | bar
6162 |}
6163 !! html
6164 <table>
6165
6166 <tr>
6167 <td> bar
6168 </td></tr></table>
6169
6170 !!end
6171
6172 !!test
6173 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 +/-
6174 !! wikitext
6175 {|
6176 |-
6177 |style='color:red;'|+1
6178 |style='color:blue;'|-1
6179 |-
6180 | 1 || 2 || 3
6181 | 1 ||+2 ||-3
6182 |-
6183 | +1
6184 | -1
6185 |}
6186 !! html
6187 <table>
6188
6189 <tr>
6190 <td style="color:red;">+1
6191 </td>
6192 <td style="color:blue;">-1
6193 </td></tr>
6194 <tr>
6195 <td> 1 </td>
6196 <td> 2 </td>
6197 <td> 3
6198 </td>
6199 <td> 1 </td>
6200 <td>+2 </td>
6201 <td>-3
6202 </td></tr>
6203 <tr>
6204 <td> +1
6205 </td>
6206 <td> -1
6207 </td></tr></table>
6208
6209 !!end
6210
6211 !! test
6212 Table rowspan
6213 !! wikitext
6214 {| border=1
6215 | Cell 1, row 1
6216 |rowspan=2| Cell 2, row 1 (and 2)
6217 | Cell 3, row 1
6218 |-
6219 | Cell 1, row 2
6220 | Cell 3, row 2
6221 |}
6222 !! html
6223 <table border="1">
6224 <tr>
6225 <td> Cell 1, row 1
6226 </td>
6227 <td rowspan="2"> Cell 2, row 1 (and 2)
6228 </td>
6229 <td> Cell 3, row 1
6230 </td></tr>
6231 <tr>
6232 <td> Cell 1, row 2
6233 </td>
6234 <td> Cell 3, row 2
6235 </td></tr></table>
6236
6237 !! end
6238
6239 !! test
6240 Nested table
6241 !! wikitext
6242 {| border=1
6243 | &alpha;
6244 |
6245 {| bgcolor=#ABCDEF border=2
6246 |nested
6247 |-
6248 |table
6249 |}
6250 |the original table again
6251 |}
6252 !! html
6253 <table border="1">
6254 <tr>
6255 <td> &#945;
6256 </td>
6257 <td>
6258 <table bgcolor="#ABCDEF" border="2">
6259 <tr>
6260 <td>nested
6261 </td></tr>
6262 <tr>
6263 <td>table
6264 </td></tr></table>
6265 </td>
6266 <td>the original table again
6267 </td></tr></table>
6268
6269 !! end
6270
6271 !! test
6272 Invalid attributes in table cell (bug 1830)
6273 !! wikitext
6274 {|
6275 |Cell:|broken
6276 |}
6277 !! html
6278 <table>
6279 <tr>
6280 <td>broken
6281 </td></tr></table>
6282
6283 !! end
6284
6285 !! test
6286 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6287 !! wikitext
6288 {|
6289 | title="foo" |bar
6290 | title="foo<nowiki>|</nowiki>" |bar
6291 | title="foo<nowiki>|</nowiki>" bar
6292 |}
6293 !! html/php
6294 <table>
6295 <tr>
6296 <td title="foo">bar
6297 </td>
6298 <td title="foo&#124;">bar
6299 </td>
6300 <td> title="foo|" bar
6301 </td></tr></table>
6302
6303 !! html/parsoid
6304 <table>
6305 <tbody><tr><td title="foo">bar</td>
6306 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6307 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6308 </tbody></table>
6309 !! end
6310
6311 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6312 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6313 # *2wt modes will fail.
6314 !! test
6315 Table security: embedded pipes
6316 !! options
6317 parsoid=wt2html,html2html
6318 !! wikitext
6319 {|
6320 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6321 !! html/php
6322 <table>
6323 <tr>
6324 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6325 <td>]" onmouseover="alert(document.cookie)"&gt;test
6326 </td>
6327 </tr>
6328 </table>
6329
6330 !! html/parsoid
6331 <table><tbody>
6332 <tr>
6333 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6334 !! end
6335
6336 !! test
6337 ! and || in element attributes should not be parsed as <th>/<td>
6338 !! wikitext
6339 {|
6340 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6341 |}
6342 !! html/php
6343 <table>
6344 <tr>
6345 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6346 </td></tr></table>
6347
6348 !! html/parsoid
6349 <table>
6350 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6351 </tbody></table>
6352 !! end
6353
6354 # FIXME: The output seems broken. Filed as T110268.
6355 !! test
6356 ! and || in td attributes should not be parsed as <th>/<td>
6357 !! options
6358 parsoid=wt2html
6359 !! wikitext
6360 {|
6361 | style="color: red !important;" data-contrived="put this here ||" | foo
6362 |}
6363 !! html/php
6364 <table>
6365 <tr>
6366 <td> style="color: red !important;" data-contrived="put this here </td>
6367 <td> foo
6368 </td></tr></table>
6369
6370 !! html/parsoid
6371 <table>
6372 <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>
6373 </tbody></table>
6374 !! end
6375
6376 !! test
6377 Break on | in element attribute in template
6378 !! options
6379 parsoid=wt2html,html2html
6380 !! wikitext
6381 {{echo|1=<div class="hi|ho">ha</div>}}
6382 !! html/php
6383 <p>ho"&gt;ha&lt;/div&gt;
6384 </p>
6385 !! html/parsoid
6386 <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>
6387 !! end
6388
6389 !! test
6390 Indented table markup mixed with indented pre content (proposed in bug 6200)
6391 !! wikitext
6392 <table>
6393 <tr>
6394 <td>
6395 Text that should be rendered preformatted
6396 </td>
6397 </tr>
6398 </table>
6399 !! html
6400 <table>
6401 <tr>
6402 <td>
6403 <pre>Text that should be rendered preformatted
6404 </pre>
6405 </td>
6406 </tr>
6407 </table>
6408
6409 !! end
6410
6411 !! test
6412 1. Template-generated table cell attributes and cell content
6413 !! wikitext
6414 {|
6415 |{{table_attribs}}
6416 | {{table_attribs}}
6417 || {{table_attribs_5}}
6418 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6419 |align=center {{table_attribs}}
6420 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6421 |}
6422 !! html
6423 <table>
6424 <tr>
6425 <td style="color:red;">Foo
6426 </td>
6427 <td style="color:red;">Foo
6428 </td>
6429 <td> style="color:red;"</td>
6430 <td>Bar
6431 </td>
6432 <td style="color:red;">Foo
6433 </td>
6434 <td align="center" style="color:red;">Foo
6435 </td>
6436 <td align="center" style="color:red;">Foo
6437 </td></tr></table>
6438
6439 !! end
6440
6441 !! test
6442 2. Template-generated table cell attributes and cell content
6443 !! wikitext
6444 {|
6445 |{{table_attribs_2}}
6446 |}
6447 !! html/php
6448 <table>
6449 <tr>
6450 <td style="color:red;">Foo
6451 </td>
6452 <td>Bar</td>
6453 <td>Baz
6454 </td></tr></table>
6455
6456 !! html/parsoid
6457 <table>
6458 <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>
6459 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6460 </tbody></table>
6461 !! end
6462
6463 !! test
6464 3. Template-generated table cell attributes and cell content
6465 !! wikitext
6466 {|
6467 !align=center {{table_header_cells}}
6468 |-
6469 |align=center {{table_cells}}
6470 |}
6471 !! html/php
6472 <table>
6473 <tr>
6474 <th align="center" style="color:red;">Foo</th>
6475 <th style="color:red;"><i>Bar</i></th>
6476 <th style="color:brown;"><i>Foo</i> and Baz
6477 </th></tr>
6478 <tr>
6479 <td align="center" style="color:red;">Foo</td>
6480 <td style="color:red;"><i>Bar</i></td>
6481 <td style="color:brown;"><i>Foo</i> and Baz
6482 </td></tr></table>
6483
6484 !! html/parsoid
6485 <table>
6486 <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>
6487 <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>
6488 </tbody></table>
6489 !! end
6490
6491 !! test
6492 4. Template-generated table cell attributes and cell content inside a templated table
6493 !! wikitext
6494 {{tbl-start}}
6495 !align=center {{table_header_cells}}
6496 |-
6497 |align=center {{table_cells}}
6498 {{tbl-end}}
6499 !! html/php
6500 <table>
6501 <tr>
6502 <th align="center" style="color:red;">Foo</th>
6503 <th style="color:red;"><i>Bar</i></th>
6504 <th style="color:brown;"><i>Foo</i> and Baz
6505 </th></tr>
6506 <tr>
6507 <td align="center" style="color:red;">Foo</td>
6508 <td style="color:red;"><i>Bar</i></td>
6509 <td style="color:brown;"><i>Foo</i> and Baz
6510 </td></tr></table>
6511
6512 !! html/parsoid
6513 <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}}]}'>
6514 <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>
6515 <tr>
6516 <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>
6517 </tbody></table>
6518 !! end
6519
6520 ## Edge case fix to prevent future regressions
6521 !! test
6522 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6523 !! wikitext
6524 {|
6525 |{{table_attribs_7}}
6526 |}
6527 <references />
6528 !! html/parsoid
6529 <table>
6530 <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>
6531 </tbody></table>
6532 <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>
6533 !! end
6534
6535 !! test
6536 Table with row followed by newlines and table heading
6537 !! wikitext
6538 {|
6539 |-
6540
6541 ! foo
6542 |}
6543 !! html
6544 <table>
6545
6546
6547 <tr>
6548 <th> foo
6549 </th></tr></table>
6550
6551 !! end
6552
6553 !! test
6554 Table with empty line following the start tag
6555 !! wikitext
6556 {|
6557
6558 |-
6559 | foo
6560 |}
6561 !! html
6562 <table>
6563
6564
6565 <tr>
6566 <td> foo
6567 </td></tr></table>
6568
6569 !! end
6570
6571 !! test
6572 Table attributes with empty value
6573 !! options
6574 parsoid=wt2html,html2html
6575 !! wikitext
6576 {|
6577 | style=| hello
6578 |}
6579 !! html/php
6580 <table>
6581 <tr>
6582 <td style=""> hello
6583 </td></tr></table>
6584
6585 !! html/parsoid
6586 <table>
6587 <tbody><tr><td style=""> hello</td></tr>
6588 </tbody></table>
6589 !! end
6590
6591 !! test
6592 Wikitext table with a lot of comments
6593 !! wikitext
6594 {|
6595 <!-- c0 -->
6596 | foo
6597 <!-- c1 -->
6598 |-<!-- c2 -->
6599 <!-- c3 -->
6600 |<!-- c4 -->
6601 <!-- c5 -->
6602 |}
6603 !! html
6604 <table>
6605 <tr>
6606 <td> foo
6607 </td></tr>
6608 <tr>
6609 <td>
6610 </td></tr></table>
6611
6612 !! end
6613
6614 !! test
6615 Wikitext table comments represented in parsoid dom
6616 !! wikitext
6617 {|<!--c1--><!--c2-->
6618 |-<!--c3-->
6619 | x
6620 |}
6621 !! html/php+tidy
6622 <table>
6623 <tr>
6624 <td>x</td>
6625 </tr>
6626 </table>
6627 !! html/parsoid
6628 <table><!--c1--><!--c2-->
6629 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6630 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6631 </tbody></table>
6632 !! end
6633
6634 !! test
6635 Wikitext table with double-line table cell
6636 !! wikitext
6637 {|
6638 |a
6639 b
6640 |}
6641 !! html
6642 <table>
6643 <tr>
6644 <td>a
6645 <p>b
6646 </p>
6647 </td></tr></table>
6648
6649 !! end
6650
6651 !! test
6652 Table cell with a single comment
6653 !! wikitext
6654 {|
6655 | <!-- c1 -->
6656 | a
6657 |}
6658 !! html
6659 <table>
6660 <tr>
6661 <td>
6662 </td>
6663 <td> a
6664 </td></tr></table>
6665
6666 !! end
6667
6668 !! test
6669 Table-cell after a comment-only-empty-line
6670 !! wikitext
6671 {|
6672 |a
6673 <!--c1-->
6674 <!--c2-->| b
6675 |}
6676 !! html
6677 <table>
6678 <tr>
6679 <td>a
6680 </td>
6681 <td> b
6682 </td></tr></table>
6683
6684 !! html/parsoid
6685 <table>
6686 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6687 <!--c1-->
6688 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6689 </tbody></table>
6690
6691 !! end
6692
6693 !! test
6694 Build table with {{!}}
6695 !! wikitext
6696 {{{!}} class="wikitable"
6697 ! header
6698 ! second header
6699 {{!}}- style="color:red;"
6700 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6701 {{!}}}
6702 !! html
6703 <table class="wikitable">
6704 <tr>
6705 <th> header
6706 </th>
6707 <th> second header
6708 </th></tr>
6709 <tr style="color:red;">
6710 <td> data </td>
6711 <td style="color:red;"> second data
6712 </td></tr></table>
6713
6714 !! end
6715
6716 !! test
6717 Build table with pipe as data
6718 !! wikitext
6719 {| class="wikitable"
6720 ! header
6721 ! second header
6722 |- style="color:red;"
6723 | data || style="color:red;" | second data
6724 |-
6725 | style="color:red;" | data with | || style="color:red;" | second data with |
6726 |-
6727 || data with | ||| second data with |
6728 |}
6729 !! html
6730 <table class="wikitable">
6731 <tr>
6732 <th> header
6733 </th>
6734 <th> second header
6735 </th></tr>
6736 <tr style="color:red;">
6737 <td> data </td>
6738 <td style="color:red;"> second data
6739 </td></tr>
6740 <tr>
6741 <td style="color:red;"> data with | </td>
6742 <td style="color:red;"> second data with |
6743 </td></tr>
6744 <tr>
6745 <td> data with | </td>
6746 <td> second data with |
6747 </td></tr></table>
6748
6749 !! end
6750
6751 !! test
6752 Build table with wikilink
6753 !! wikitext
6754 {| class="wikitable"
6755 ! header || second header
6756 |- style="color:red;"
6757 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6758 |-
6759 | data || second data [[Main Page|link|text with pipe]]
6760 |}
6761 !! html
6762 <table class="wikitable">
6763 <tr>
6764 <th> header </th>
6765 <th> second header
6766 </th></tr>
6767 <tr style="color:red;">
6768 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6769 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6770 </td></tr>
6771 <tr>
6772 <td> data </td>
6773 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6774 </td></tr></table>
6775
6776 !! end
6777
6778 # The expected HTML structure in this test is debatable. The PHP parser does
6779 # not parse this kind of table at all. The main focus for Parsoid is on
6780 # round-tripping, so this output is ok for now. TODO: revisit!
6781 !! test
6782 Wikitext table with html-syntax row
6783 !! wikitext
6784 {|
6785 |-
6786 <td>foo</td>
6787 |}
6788 !! html/parsoid
6789 <table>
6790 <tbody>
6791 <tr>
6792 <td>foo</td></tr></tbody></table>
6793 !! end
6794
6795 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6796 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6797 ## PHP parser, which tidy then compounds by fostering the content
6798 ## entirely out of the table. Parsoid recognizes the table context
6799 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6800 ## depends on PHP's treatment of broken table markup!
6801 !! test
6802 Implicit <td> after a |-
6803 !! options
6804 parsoid=wt2html,html2html
6805 !! wikitext
6806 {|
6807 |-
6808 a
6809 |}
6810 !! html/php
6811 <table>
6812
6813 a
6814 </table>
6815
6816 !! html/php+tidy
6817 <p>a</p>
6818 !! html/parsoid
6819 <table>
6820 <tr><td>a</td></tr>
6821 </table>
6822 !! end
6823
6824 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6825 !! test
6826 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6827 !! options
6828 parsoid=wt2html,html2html
6829 !! wikitext
6830 {|
6831 |-
6832 |
6833 a
6834 |-
6835 b
6836 |}
6837 !! html/php
6838 <table>
6839
6840 <tr>
6841 <td>
6842 <pre>a
6843 </pre>
6844 </td></tr>
6845 b
6846 </table>
6847
6848 !! html/php+tidy
6849 <p>b</p>
6850 <table>
6851 <tr>
6852 <td>
6853 <pre>
6854 a
6855 </pre></td>
6856 </tr>
6857 </table>
6858 !! html/parsoid
6859 <table>
6860 <tbody>
6861 <tr><td><pre>a</pre></td></tr>
6862 <tr><td> b</td></tr>
6863 </tbody>
6864 </table>
6865 !! end
6866
6867 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6868 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6869 !! test
6870 Lists should be recognized in an implicit <td> context
6871 !! options
6872 parsoid=wt2html,html2html
6873 !! wikitext
6874 {|
6875 |-
6876 *a
6877 |}
6878 !! html/php
6879 <table>
6880
6881 <ul><li>a</li></ul>
6882 </table>
6883
6884 !! html/php+tidy
6885 <ul>
6886 <li>a</li>
6887 </ul>
6888 !! html/parsoid
6889 <table>
6890 <tr>
6891 <td><ul>
6892 <li>a</li>
6893 </ul></td>
6894 </tr>
6895 </table>
6896 !! end
6897
6898 !! test
6899 Table cells not properly parsed in an implicit-td context
6900 !! wikitext
6901 {|
6902 |-
6903 {{table_attribs_4}} || a || b
6904 |}
6905 !! html/php+tidy
6906 <table>
6907 <tr>
6908 <td style="background-color:#DC241f;" width="10px"></td>
6909 <td>a</td>
6910 <td>b</td>
6911 </tr>
6912 </table>
6913 !! html/parsoid
6914 <table>
6915 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6916 <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>
6917 </tbody></table>
6918 !! end
6919
6920 !! test
6921 Parsoid: Round-trip tables directly followed by content (bug 51219)
6922 !! options
6923 parsoid=wt2html,wt2wt
6924 !! wikitext
6925 {|
6926 |foo
6927 |} bar
6928
6929 {|
6930 |baz
6931 |}<b>quux</b>
6932 !! html+tidy
6933 <table>
6934 <tr>
6935 <td>foo</td>
6936 </tr>
6937 </table>
6938 <p>bar</p>
6939 <table>
6940 <tr>
6941 <td>baz</td>
6942 </tr>
6943 </table>
6944 <p><b>quux</b></p>
6945 !! end
6946
6947 !! test
6948 Parsoid: Default to a newline after tables in new content (bug 51219)
6949 !! options
6950 parsoid=html2wt
6951 !! html/parsoid
6952 <table><tbody>
6953 <tr><td>foo</td></tr></tbody></table> bar
6954 <table><tbody>
6955 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6956 !! wikitext
6957 {|
6958 |foo
6959 |}
6960 <nowiki> </nowiki>bar
6961 {|
6962 |baz
6963 |}
6964 '''quux'''
6965 !! end
6966
6967 !! test
6968 Parsoid: newline inducing block nodes don't suppress <nowiki>
6969 !! options
6970 parsoid=html2wt
6971 !! html/parsoid
6972 a<h1>foo</h1>
6973 !! wikitext
6974 <nowiki> </nowiki>a
6975
6976 = foo =
6977 !! end
6978
6979 !! test
6980 Parsoid: Row-syntax table headings followed by comment & table cells
6981 !! options
6982 parsoid=wt2html,wt2wt
6983 !! wikitext
6984 {|
6985 ! foo || bar
6986 <!-- foo --> || baz || quux
6987 |}
6988 !! html/php
6989 <table>
6990 <tr>
6991 <th> foo </th>
6992 <th> bar
6993 </th>
6994 <td> baz </td>
6995 <td> quux
6996 </td></tr></table>
6997
6998 !! html/parsoid
6999 <table>
7000 <tbody><tr><th> foo </th><th> bar
7001 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7002 </tbody></table>
7003 !! end
7004
7005 !!test
7006 Parsoid: Recover better from broken table attributes
7007 !!options
7008 parsoid=wt2html
7009 !!wikitext
7010 {| class="foo
7011 | class="bar" |
7012 foo
7013 |}
7014 !!html/php+tidy
7015 <table class="foo">
7016 <tr>
7017 <td class="bar">
7018 <p>foo</p>
7019 </td>
7020 </tr>
7021 </table>
7022 !!html/parsoid
7023 <table class="foo">
7024 <tr>
7025 <td class="bar">
7026 <p>foo</p></td></tr>
7027 </tbody></table>
7028 !!end
7029
7030 !! test
7031 Tables: Digest broken attributes on table and tr tag
7032 !! options
7033 parsoid=wt2html
7034 !! wikitext
7035 {| || |} ++
7036 |- || || ++ --
7037 |- > [
7038 |}
7039 !! html
7040 <table>
7041 <tbody>
7042 <tr></tr>
7043 <tr></tr>
7044 </tbody></table>
7045 !! end
7046
7047 !! test
7048 Strip unsupported table tags
7049 !! options
7050 parsoid=html2wt
7051 !! html/parsoid
7052 <table>
7053 <thead>
7054 <tr>
7055 <th>Month</th>
7056 <th>Savings</th>
7057 </tr>
7058 </thead>
7059 <tbody>
7060 <tr>
7061 <td>January</td>
7062 <td>$100</td>
7063 </tr>
7064 <tr>
7065 <td>February</td>
7066 <td>$80</td>
7067 </tr>
7068 </tbody>
7069 <tfoot>
7070 <tr>
7071 <td>Sum</td>
7072 <td>$180</td>
7073 </tr>
7074 </tfoot>
7075 </table>
7076 !! wikitext
7077 {|
7078
7079 !Month
7080 !Savings
7081
7082 |January
7083 |$100
7084
7085 |-
7086 |February
7087 |$80
7088
7089 |Sum
7090 |$180
7091
7092 |}
7093 !! end
7094
7095 !!test
7096 Testing serialization after deletion of table cells
7097 !!options
7098 parsoid={
7099 "modes": ["wt2wt", "selser"],
7100 "changes": [
7101 ["#x", "remove"]
7102 ]
7103 }
7104 !!wikitext
7105 {|
7106 !h1 !!h2 !!h3
7107 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7108 |}
7109 !! wikitext/edited
7110 {|
7111 !h1 !!h2 !!h3
7112 |c2 |||c3
7113 |}
7114 !!end
7115
7116 ###
7117 ### Internal links
7118 ###
7119 !! test
7120 Plain link, capitalized
7121 !! wikitext
7122 [[Main Page]]
7123 !! html
7124 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7125 </p>
7126 !! end
7127
7128 !! test
7129 Plain link, uncapitalized
7130 !! wikitext
7131 [[main Page]]
7132 !! html
7133 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7134 </p>
7135 !! end
7136
7137 !! test
7138 Piped link
7139 !! wikitext
7140 [[Main Page|The Main Page]]
7141 !! html
7142 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7143 </p>
7144 !! end
7145
7146 !! test
7147 Piped link with comment in link text
7148 !! wikitext
7149 [[Main Page|The Main<!--front--> Page]]
7150 !! html
7151 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7152 </p>
7153 !! end
7154
7155 !! test
7156 Piped link with multiple pipe characters in link text
7157 !! wikitext
7158 [[Main Page||The|Main|Page|]]
7159 !! html/php
7160 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7161 </p>
7162 !! html/parsoid
7163 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7164 !! end
7165
7166 !! test
7167 Piped link with no link text
7168 !! wikitext
7169 [[Thomas Bek (bishop of St David's)|]]
7170 !! html/php
7171 <p>[[Thomas Bek (bishop of St David's)|]]
7172 </p>
7173 !! html/parsoid
7174 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7175 !! end
7176
7177 !! test
7178 Broken link
7179 !! wikitext
7180 [[Zigzagzogzagzig]]
7181 !! html
7182 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7183 </p>
7184 !! end
7185
7186 !! test
7187 Broken link with fragment
7188 !! wikitext
7189 [[Zigzagzogzagzig#zug]]
7190 !! html
7191 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7192 </p>
7193 !! end
7194
7195 !! test
7196 Special page link with fragment
7197 !! wikitext
7198 [[Special:Version#anchor]]
7199 !! html
7200 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7201 </p>
7202 !! end
7203
7204 !! test
7205 Nonexistent special page link with fragment
7206 !! wikitext
7207 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7208 !! html
7209 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7210 </p>
7211 !! end
7212
7213 !! test
7214 Link with prefix
7215 !! wikitext
7216 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7217 !! html
7218 <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>
7219 </p>
7220 !! end
7221
7222 !! test
7223 Link with suffix
7224 !! wikitext
7225 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7226 !! html
7227 <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>!!!
7228 </p>
7229 !! end
7230
7231 !! article
7232 prefixed article
7233 !! text
7234 Some text
7235 !! endarticle
7236
7237 !! test
7238 Bug 43661: Piped links with identical prefixes
7239 !! wikitext
7240 [[prefixed article|prefixed articles with spaces]]
7241
7242 [[prefixed article|prefixed articlesaoeu]]
7243
7244 [[Main Page|Main Page test]]
7245 !! html
7246 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7247 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7248 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7249 </p>
7250 !! end
7251
7252
7253 !! test
7254 Link with HTML entity in suffix / tail
7255 !! wikitext
7256 [[Main Page]]&quot;, [[Main Page]]&#97;
7257 !! html/php
7258 <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;
7259 </p>
7260 !! html/parsoid
7261 <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>
7262 !! end
7263
7264 !! test
7265 Link with 3 brackets
7266 !! wikitext
7267 [[[Main Page]]]
7268 Foo [[[Main Page]]]
7269 !! html
7270 <p>[[[Main Page]]]
7271 Foo [[[Main Page]]]
7272 </p>
7273 !! end
7274
7275 !! test
7276 Link with 4 brackets
7277 !! wikitext
7278 [[[[Main Page]]]]
7279 !! html
7280 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7281 </p>
7282 !! end
7283
7284 !! test
7285 Piped link with 3 brackets
7286 !! wikitext
7287 [[[main page|the main page]]]
7288 !! html
7289 <p>[[[main page|the main page]]]
7290 </p>
7291 !! end
7292
7293 !! test
7294 Piped link with extlink-like text
7295 !! wikitext
7296 [[Main Page|[bar]]]
7297 [[Main Page|This is a [bar]]]
7298 !! html/php
7299 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7300 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7301 </p>
7302 !! html/parsoid
7303 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7304 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7305 !! end
7306
7307 !! test
7308 Link with multiple pipes
7309 !! wikitext
7310 [[Main Page|The|Main|Page]]
7311 !! html
7312 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7313 </p>
7314 !! end
7315
7316 # Note that parsoid does not munge anchor text; all non-space
7317 # characters are valid in HTML5 ids.
7318 !! test
7319 Anchor containing a #. (bug 63430)
7320 !! wikitext
7321 [[Main Page#And#Link]]
7322 !! html/php
7323 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7324 </p>
7325 !! html/parsoid
7326 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7327 !! end
7328
7329 !! test
7330 Link to namespaces
7331 !! wikitext
7332 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7333 !! html
7334 <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>
7335 </p>
7336 !! end
7337
7338 !! test
7339 Link with space in namespace
7340 !! wikitext
7341 [[User talk:Foo bar]]
7342 !! html
7343 <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>
7344 </p>
7345 !! end
7346
7347 !! article
7348 MemoryAlpha:AlphaTest
7349 !! text
7350 This is an article in the MemoryAlpha namespace
7351 (which shadows the memoryalpha interwiki link).
7352 !! endarticle
7353
7354 !! test
7355 Namespace takes precedence over interwiki link (bug 51680)
7356 !! wikitext
7357 [[MemoryAlpha:AlphaTest]]
7358 !! html
7359 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7360 </p>
7361 !! end
7362
7363 # The previous test doesn't work correctly in html2*, due to not recognizing the
7364 # link as an internal one. This one checks for the correct behavior.
7365 !! test
7366 Link to namespace preferred over interwiki with correct rel attribute
7367 !! options
7368 parsoid=html2wt,html2html
7369 !! html/parsoid
7370 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7371 !! wikitext
7372 [[MemoryAlpha:AlphaTest]]
7373 !! end
7374
7375 !! test
7376 Piped link to namespace
7377 !! wikitext
7378 [[Meta:Disclaimers|The disclaimers]]
7379 !! html
7380 <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>
7381 </p>
7382 !! end
7383
7384 !! test
7385 Link containing }
7386 !! wikitext
7387 [[Usually caused by a typo (oops}]]
7388 !! html
7389 <p>[[Usually caused by a typo (oops}]]
7390 </p>
7391 !! end
7392
7393 !! article
7394 7% Solution
7395 !! text
7396 Just a test of an article title containing a percent.
7397 !! endarticle
7398
7399 !! test
7400 Link containing % (not as a hex sequence)
7401 !! wikitext
7402 [[7% Solution]]
7403 !! html/php
7404 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7405 </p>
7406 !! html/parsoid
7407 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7408 !! end
7409
7410 # note that the parsoid HTML is identical to the previous test output,
7411 # so the previous test ensures that the html2wt mode will generate the
7412 # "not as a hex sequence" wikitext.
7413 !! test
7414 Link containing % as a single hex sequence interpreted to char
7415 !! options
7416 parsoid=wt2wt,wt2html,html2html
7417 !! wikitext
7418 [[7%25 Solution]]
7419 !! html/php
7420 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7421 </p>
7422 !! html/parsoid
7423 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7424 !!end
7425
7426 !! test
7427 Link containing % as a double hex sequence interpreted to hex sequence
7428 !! wikitext
7429 [[7%2525 Solution]]
7430 !! html
7431 <p>[[7%2525 Solution]]
7432 </p>
7433 !!end
7434
7435 # note that parsoid does not munge anchor text; all non-space
7436 # characters are valid in HTML5 anchors.
7437 !! test
7438 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7439 Example for such a section: == < ==
7440 !! wikitext
7441 [[%23%3c]][[%23%3e]]
7442 !! html/php
7443 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7444 </p>
7445 !! html/parsoid
7446 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7447 !! end
7448
7449 !! test
7450 Link containing "<#" and ">#" as a hex sequences
7451 !! wikitext
7452 [[%3c%23]][[%3e%23]]
7453 !! html
7454 <p>[[%3c%23]][[%3e%23]]
7455 </p>
7456 !! end
7457
7458 !! test
7459 Link containing an equals sign
7460 !! wikitext
7461 [[Special:BookSources/isbn=4-00-026157-6]]
7462 !! html/php
7463 <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>
7464 </p>
7465 !! html/parsoid
7466 <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>
7467 !! end
7468
7469 !! article
7470 Foo~bar
7471 !! text
7472 Just a test of an article title containing a tilde.
7473 !! endarticle
7474
7475 # note that links containing signatures, like [[Foo~~~~]], are
7476 # massaged by the pre-save transform (PST) and so the tildes are never
7477 # seen by the parser.
7478 !! test
7479 Link containing a tilde
7480 !! wikitext
7481 [[Foo~bar]]
7482 !! html/php
7483 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7484 </p>
7485 !! html/parsoid
7486 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7487 !! end
7488
7489 !! test
7490 Link containing double-single-quotes '' (bug 4598)
7491 !! wikitext
7492 [[Lista d''e paise d''o munno]]
7493 !! html/php
7494 <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>
7495 </p>
7496 !! html/parsoid
7497 <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>
7498 !! end
7499
7500 !! test
7501 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7502 !! wikitext
7503 Some [[Link|pretty ''italics'' and stuff]]!
7504 !! html/php
7505 <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>!
7506 </p>
7507 !! html/parsoid
7508 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7509 !! end
7510
7511 !! test
7512 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7513 !! wikitext
7514 ''Some [[Link|pretty ''italics'' and stuff]]!''
7515 !! html
7516 <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>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Link with double quotes in title part (literal) and alternate part (interpreted)
7522 !! wikitext
7523 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7524
7525 [[''Pentecoste'']]
7526
7527 [[''Pentecoste''|Pentecoste]]
7528
7529 [[''Pentecoste''|''Pentecoste'']]
7530 !! html/php
7531 <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>
7532 </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>
7533 </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>
7534 </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>
7535 </p>
7536 !! html/parsoid
7537 <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>
7538 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7539 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7540 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7541 !! end
7542
7543 !! test
7544 Broken image links with HTML captions (bug 39700)
7545 !! wikitext
7546 [[File:Nonexistent|<script></script>]]
7547 [[File:Nonexistent|100x100px|<script></script>]]
7548 [[File:Nonexistent|&lt;]]
7549 [[File:Nonexistent|a<i>b</i>c]]
7550 !! html/php
7551 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7552 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7553 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7554 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7555 </p>
7556 !! html/parsoid
7557 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7558 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7559 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7560 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7561 !! end
7562
7563 !! test
7564 Plain link to URL
7565 !! wikitext
7566 [[http://www.example.com]]
7567 !! html/php
7568 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7569 </p>
7570 !! html/parsoid
7571 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7572 !! end
7573
7574 !! test
7575 Plain link to URL with link text
7576 !! wikitext
7577 [[http://www.example.com Link text]]
7578 !! html
7579 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7580 </p>
7581 !! end
7582
7583 !! test
7584 Plain link to protocol-relative URL
7585 !! wikitext
7586 [[//www.example.com]]
7587 !! html/php
7588 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7589 </p>
7590 !! html/parsoid
7591 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7592 !! end
7593
7594 !! test
7595 Plain link to protocol-relative URL with link text
7596 !! wikitext
7597 [[//www.example.com Link text]]
7598 !! html
7599 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7600 </p>
7601 !! end
7602
7603 !! test
7604 Plain link to page with question mark in title
7605 !! wikitext
7606 [[A?b]]
7607
7608 [[A?b|Baz]]
7609 !! html
7610 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7611 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7612 </p>
7613 !! end
7614
7615
7616 # I'm fairly sure the expected result here is wrong.
7617 # We want these to be URL links, not pseudo-pages with URLs for titles....
7618 # However the current output is also pretty screwy.
7619 #
7620 # ----
7621 # I'm changing it to match the current output--it arguably makes more
7622 # sense in the light of the test above. Old expected result was:
7623 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7624 #</p>
7625 # But I think this test is bordering on "garbage in, garbage out" anyway.
7626 # -- wtm
7627 !! test
7628 Piped link to URL
7629 !! wikitext
7630 Piped link to URL: [[http://www.example.com|an example URL]]
7631 !! html/php
7632 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7633 </p>
7634 !! html/parsoid
7635 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7636 !! end
7637
7638 !! test
7639 BUG 2: [[page|http://url/]] should link to page, not http://url/
7640 !! wikitext
7641 [[Main Page|http://url/]]
7642 !! html/php
7643 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7644 </p>
7645 !! html/parsoid
7646 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7647 !! end
7648
7649 # Parsoid does not mark self-links, by design.
7650 !! test
7651 BUG 337: Escaped self-links should be bold
7652 !! options
7653 title=[[Bug462]]
7654 !! wikitext
7655 [[Bu&#103;462]] [[Bug462]]
7656 !! html/php
7657 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7658 </p>
7659 !! html/php+tidy
7660 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7661 !! html/parsoid
7662 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7663 !! end
7664
7665 !! test
7666 Self-link to section should not be bold
7667 !! options
7668 title=[[Main Page]]
7669 !! wikitext
7670 [[Main Page#section]]
7671 !! html
7672 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7673 </p>
7674 !! end
7675
7676 !! article
7677 00
7678 !! text
7679 This is 00.
7680 !! endarticle
7681
7682 !!test
7683 Self-link to numeric title
7684 !!options
7685 title=[[0]]
7686 !! wikitext
7687 [[0]]
7688 !! html
7689 <p><strong class="selflink">0</strong>
7690 </p>
7691 !!end
7692
7693 !!test
7694 Link to numeric-equivalent title
7695 !!options
7696 title=[[0]]
7697 !! wikitext
7698 [[00]]
7699 !! html
7700 <p><a href="/wiki/00" title="00">00</a>
7701 </p>
7702 !!end
7703
7704 !! test
7705 <nowiki> inside a link
7706 !! wikitext
7707 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7708 !! html
7709 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7710 </p>
7711 !! end
7712
7713 !! test
7714 Non-breaking spaces in title
7715 !! wikitext
7716 [[&nbsp; Main &nbsp; Page &nbsp;]]
7717 !! html
7718 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7719 </p>
7720 !!end
7721
7722 !! test
7723 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7724 !! options
7725 language=ca
7726 !! wikitext
7727 '''[[Main Page]]'''
7728 !! html
7729 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7730 </p>
7731 !! end
7732
7733 !! test
7734 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7735 !! options
7736 language=ca
7737 !! wikitext
7738 ''[[Main Page]]''
7739 !! html
7740 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7741 </p>
7742 !! end
7743
7744 !! test
7745 Internal link with en linktrail: no apostrophes (bug 27473)
7746 !! options
7747 language=en
7748 !! wikitext
7749 [[Something]]'nice
7750 !! html
7751 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7752 </p>
7753 !! end
7754
7755 !! test
7756 Internal link with ca linktrail with apostrophes (bug 27473)
7757 !! options
7758 language=ca
7759 !! wikitext
7760 [[Something]]'nice
7761 !! html
7762 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7763 </p>
7764 !! end
7765
7766 !! test
7767 Internal link with kaa linktrail with apostrophes (bug 27473)
7768 !! options
7769 language=kaa
7770 !! wikitext
7771 [[Something]]'nice
7772 !! html
7773 <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>
7774 </p>
7775 !! end
7776
7777 !! test
7778 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7779 !! wikitext
7780 [[User:Foo/Test/63636:Bar|Test]]
7781 !! html/php
7782 <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>
7783 </p>
7784 !! html/parsoid
7785 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7786 !! end
7787
7788 !! test
7789 Purely hash wikilink
7790 !! options
7791 title=[[User:test/123]]
7792 !! wikitext
7793 [[#a|b]]
7794 !! html/php
7795 <p><a href="#a">b</a>
7796 </p>
7797 !! html/parsoid
7798 <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>
7799 !! end
7800
7801 !! test
7802 1. Interaction of linktrail and template encapsulation
7803 !! options
7804 parsoid
7805 !! wikitext
7806 {{echo|[[Foo]]}}l
7807 !! html
7808 <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>
7809 !! end
7810
7811 !! test
7812 2. Interaction of linktrail and template encapsulation
7813 !! options
7814 parsoid
7815 !! wikitext
7816 {{echo|Some [[Fool]]}}s
7817 !! html
7818 <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>
7819 !! end
7820
7821 !! test
7822 3. Interaction of linktrail and template encapsulation
7823 !! options
7824 parsoid
7825 !! wikitext
7826 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7827 !! html
7828 <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>
7829 !! end
7830
7831 !! article
7832 Söfnuður
7833 !! text
7834 Test.
7835 !! endarticle
7836
7837 !! test
7838 Internal link with is link prefix
7839 !! options
7840 language=is
7841 !! wikitext
7842 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7843 !! html
7844 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7845 </p>
7846 !! end
7847
7848 !! article
7849 Mótmælendatrú
7850 !! text
7851 Test.
7852 !! endarticle
7853
7854 !! test
7855 Internal link with is link trail and link prefix
7856 !! options
7857 language=is
7858 !! wikitext
7859 [[mótmælendatrú|xxx]]ar
7860 [[mótmælendatrú]]ar
7861 mótmælenda[[söfnuður]]
7862 mótmælenda[[söfnuður|söfnuðir]]
7863 mótmælenda[[söfnuður|söfnuðir]]xxx
7864 !! html
7865 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7866 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7867 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7868 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7869 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7870 </p>
7871 !! end
7872
7873 !! test
7874 Parsoid link trail escaping
7875 !! options
7876 parsoid=html2wt,html2html
7877 !! html/parsoid
7878 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7879 !! wikitext
7880 [[apple]]<nowiki/>s
7881 !! end
7882
7883 !! test
7884 Parsoid link prefix escaping
7885 !! options
7886 language=is
7887 parsoid=html2wt,html2html
7888 !! html/parsoid
7889 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7890 !! wikitext
7891 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7892 !! end
7893
7894 !! test
7895 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7896 !! wikitext
7897 [[Foo| bar]]
7898
7899 [[Foo| ''bar'']]
7900
7901 [http://wp.org foo]
7902
7903 [http://wp.org ''foo'']
7904 !! html
7905 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7906 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7907 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7908 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7909 </p>
7910 !! end
7911
7912 !! test
7913 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7914 !! options
7915 parsoid
7916 !! wikitext
7917 [[Foo|{{echo|a}} b {{echo|c}}]]
7918 !! html
7919 <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>
7920 !! end
7921
7922 !! test
7923 Link with angle bracket after anchor
7924 !! wikitext
7925 [[Foo#<bar>]]
7926 !! html/php
7927 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7928 </p>
7929 !! html/parsoid
7930 <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>
7931 !! end
7932
7933 ###
7934 ### Interwiki links (see maintenance/interwiki.sql)
7935 ###
7936
7937 !! test
7938 Inline interwiki link
7939 !! options
7940 parsoid=wt2html,wt2wt,html2html
7941 !! wikitext
7942 [[MeatBall:SoftSecurity]]
7943 !! html/php
7944 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7945 </p>
7946 !! html/parsoid
7947 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7948 !! end
7949
7950 !! test
7951 Inline interwiki link with empty title (bug 2372)
7952 !! options
7953 parsoid=wt2html,wt2wt,html2html
7954 !! wikitext
7955 [[MeatBall:]]
7956 !! html/php
7957 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7958 </p>
7959 !! html/parsoid
7960 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7961 !! end
7962
7963 !! test
7964 Interwiki link encoding conversion (bug 1636)
7965 !! wikitext
7966 *[[Wikipedia:ro:Olteni&#0355;a]]
7967 *[[Wikipedia:ro:Olteni&#355;a]]
7968 !! html
7969 <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>
7970 <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>
7971
7972 !! html+tidy
7973 <ul>
7974 <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>
7975 <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>
7976 </ul>
7977 !! end
7978
7979 !! test
7980 Interwiki link with fragment (bug 2130)
7981 !! wikitext
7982 [[MeatBall:SoftSecurity#foo]]
7983 !! html
7984 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7985 </p>
7986 !! end
7987
7988 # Ideally the wikipedia: prefix here should be proto-relative too
7989 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7990 # define the 'en' prefix, and originally the test used 'wikipedia',
7991 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7992 # article.
7993 !! test
7994 Different interwiki prefixes mapping to the same URL
7995 !! wikitext
7996 [[:en:Foo]]
7997
7998 [[:en:Foo|Foo]]
7999
8000 [[wikipedia:Foo]]
8001
8002 [[:wikipedia:Foo|Foo]]
8003
8004 [[wikipedia:en:Foo]]
8005
8006 [[:wikipedia:en:Foo]]
8007
8008 [[ wikiPEdia :Foo]]
8009 !! html/parsoid
8010 <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>
8011
8012 <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>
8013
8014 <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>
8015
8016 <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>
8017
8018 <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>
8019
8020 <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>
8021
8022 <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>
8023 !! end
8024
8025 !! test
8026 Interwiki links that cannot be represented in wiki syntax
8027 !! wikitext
8028 [[meatball:ok]]
8029 [[meatball:ok#foo|ok with fragment]]
8030 [[meatball:ok_as_well?|ok ending with ? mark]]
8031 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8032 [http://de.wikipedia.org/wiki/#foo is just fragment]
8033
8034 !! html/php
8035 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8036 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8037 <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>
8038 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8039 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8040 </p>
8041 !! html/parsoid
8042 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8043 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8044 <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>
8045 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8046 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8047 !! end
8048
8049 !! test
8050 Interwiki links: trail
8051 !! wikitext
8052 [[wikipedia:Foo|Ba]]r
8053 !! html/php
8054 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8055 </p>
8056 !! html/parsoid
8057 <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>
8058 !! end
8059
8060 !! test
8061 Local interwiki link
8062 !! options
8063 parsoid=wt2html,wt2wt,html2html
8064 !! wikitext
8065 [[local:Template:Foo]]
8066 !! html/php
8067 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8068 </p>
8069 !! html/parsoid
8070 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8071 !! end
8072
8073 # Parsoid does not mark self-links, by design.
8074 !! test
8075 Local interwiki link: self-link to current page
8076 !! options
8077 title=[[Main Page]]
8078 parsoid=wt2html,wt2wt,html2html
8079 !! wikitext
8080 [[local:Main Page]]
8081 !! html/php
8082 <p><strong class="selflink">local:Main Page</strong>
8083 </p>
8084 !! html/parsoid
8085 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8086 !! end
8087
8088 !! test
8089 Local interwiki link: prefix only (bug 64167)
8090 !! options
8091 parsoid=wt2html,wt2wt,html2html
8092 !! wikitext
8093 [[local:]]
8094 !! html/php
8095 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8096 </p>
8097 !! html/parsoid
8098 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8099 !! end
8100
8101 !! test
8102 Local interwiki link: with additional interwiki prefix (bug 61357)
8103 !! options
8104 parsoid=wt2html,wt2wt,html2html
8105 !! wikitext
8106 [[local:meatball:Hello]]
8107 !! html/php
8108 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8109 </p>
8110 !! html/parsoid
8111 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8112 !! end
8113
8114 !! test
8115 Multiple local interwiki link prefixes
8116 !! wikitext
8117 [[local:local:local:local:mi:local:Foo]]
8118 !! options
8119 parsoid=wt2html,wt2wt,html2html
8120 !! html/php
8121 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8122 </p>
8123 !! html/parsoid
8124 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8125 !! end
8126
8127 ###
8128 ### Interlanguage links
8129 ### Language links (so that searching for '### language' matches..)
8130 ###
8131
8132 !! test
8133 Interlanguage link
8134 !! options
8135 parsoid=wt2html,wt2wt,html2html
8136 !! wikitext
8137 Blah blah blah
8138 [[zh:Chinese]]
8139 !! html/php
8140 <p>Blah blah blah
8141 </p>
8142 !! html/parsoid
8143 <p>Blah blah blah</p>
8144 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8145 !! end
8146
8147 !! test
8148 Interlanguage link with spacing
8149 !! options
8150 parsoid=wt2html,wt2wt,html2html
8151 !! wikitext
8152 Blah blah blah
8153 [[ zh : Chinese ]]
8154 !! html/php
8155 <p>Blah blah blah
8156 </p>
8157 !! html/parsoid
8158 <p>Blah blah blah</p>
8159 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8160 !! end
8161
8162 !! test
8163 Double interlanguage link
8164 !! options
8165 parsoid=wt2html,wt2wt,html2html
8166 !! wikitext
8167 Blah blah blah
8168 [[es:Spanish]]
8169 [[zh:Chinese]]
8170 !! html/php
8171 <p>Blah blah blah
8172 </p>
8173 !! html/parsoid
8174 <p>Blah blah blah</p>
8175 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8176 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8177 !! end
8178
8179 !! test
8180 Interlanguage link variations
8181 !! options
8182 parsoid=wt2html,wt2wt,html2html
8183 !! wikitext
8184 Blah blah blah
8185 [[ es :Spanish]]
8186 [[ ZH :Chinese]]
8187 [[es:Foo_bar]]
8188 !! html/php
8189 <p>Blah blah blah
8190 </p>
8191 !! html/parsoid
8192 <p>Blah blah blah</p>
8193 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8194 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8195 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8196 !! end
8197
8198 !! test
8199 Space and question mark encoding in interlanguage links (T95473)
8200 !! options
8201 parsoid=wt2html,wt2wt,html2html
8202 !! wikitext
8203 Blah blah blah
8204 [[es:Foo bar?]]
8205 !! html/php
8206 <p>Blah blah blah
8207 </p>
8208 !! html/parsoid
8209 <p>Blah blah blah</p>
8210 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8211 !! end
8212
8213 !! test
8214 Interlanguage link, with prefix links
8215 !! options
8216 language=ln
8217 !! wikitext
8218 Blah blah blah
8219 [[zh:Chinese]]
8220 !! html/php
8221 <p>Blah blah blah
8222 </p>
8223 !! html/parsoid
8224 <p>Blah blah blah</p>
8225 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8226 !! end
8227
8228 !! test
8229 Double interlanguage link, with prefix links (bug 8897)
8230 !! options
8231 language=ln
8232 !! wikitext
8233 Blah blah blah
8234 [[es:Spanish]]
8235 [[zh:Chinese]]
8236 !! html/php
8237 <p>Blah blah blah
8238 </p>
8239 !! html/parsoid
8240 <p>Blah blah blah</p>
8241 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8242 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8243 !! end
8244
8245 !! test
8246 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8247 !! wikitext
8248 Blah blah blah
8249 [[mul:Article]]
8250 !! html/php
8251 <p>Blah blah blah
8252 </p>
8253 !! html/parsoid
8254 <p>Blah blah blah</p>
8255 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8256 !! end
8257
8258 !! test
8259 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8260 !! options
8261 language=ln
8262 !! wikitext
8263 [[WW&nbsp;II]]
8264 !! html
8265 <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>
8266 </p>
8267 !! end
8268
8269 !! test
8270 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8271 !! options
8272 parsoid=html2wt
8273 !! html/parsoid
8274 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8275 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8276 !! wikitext
8277 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8278
8279 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8280 !! end
8281
8282 !! test
8283 Parsoid: handle constructor well
8284 !! wikitext
8285 [[constructor]]
8286
8287 [[constructor:foo]]
8288 !! html/php
8289 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8290 </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>
8291 </p>
8292 !! html/parsoid
8293 <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>
8294
8295 <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>
8296 !! end
8297
8298 !! article
8299 ko:
8300 !! text
8301 Test.
8302 !! endarticle
8303
8304 # Note that `ko` isn't a known interlanguage prefix
8305 !! test
8306 Parsoid: recognize interlanguage links without a target page
8307 !! options
8308 ill
8309 !! wikitext
8310 [[es:]]
8311
8312 [[ko:]]
8313 !! html/php
8314 es:
8315 !! html/parsoid
8316 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8317
8318 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8319 !! end
8320
8321 # Note that `ko` isn't a known interwiki prefix
8322 !! test
8323 Parsoid: recognize interwiki links without a target page
8324 !! options
8325 parsoid=wt2html,wt2wt,html2html
8326 !! wikitext
8327 [[:es:]]
8328
8329 [[:ko:]]
8330 !! html/php
8331 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8332 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8333 </p>
8334 !! html/parsoid
8335 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8336 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8337 !! end
8338
8339 !! test
8340 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8341 !! wikitext
8342 [[mi:Foo]]
8343 !! html/php
8344 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8345 </p>
8346 !! html/parsoid
8347 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8348 !! end
8349
8350 !! test
8351 Interlanguage link with preceding local interwiki link (bug 68085)
8352 !! options
8353 parsoid=wt2html,wt2wt,html2html
8354 !! wikitext
8355 Blah blah blah
8356 [[local:es:Spanish]]
8357 !! html/php
8358 <p>Blah blah blah
8359 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8360 </p>
8361 !! html/parsoid
8362 <p>Blah blah blah
8363 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8364 !! end
8365
8366 !! test
8367 Looks like an interlanguage link, but is actually a local interwiki
8368 !! options
8369 parsoid=wt2html,wt2wt,html2html
8370 !! wikitext
8371 Blah blah blah
8372 [[mi:Template:Foo]]
8373 !! html/php
8374 <p>Blah blah blah
8375 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8376 </p>
8377 !! html/parsoid
8378 <p>Blah blah blah
8379 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8380 !! end
8381
8382 ###
8383 ### Redirects, Parsoid-only
8384 ###
8385
8386 !! test
8387 1. Simple redirect to page
8388 !! wikitext
8389 #REDIRECT [[Main Page]]
8390 !! html/parsoid
8391 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8392 !! end
8393
8394 !! test
8395 2. Other redirect variants
8396 !! wikitext
8397 #REDIRECT [[Main_Page]]
8398 !! html/parsoid
8399 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8400 !! end
8401
8402 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8403 # This tests the Parsoid bail-out code.
8404 !! test
8405 3. Other redirect variants
8406 !! wikitext
8407 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8408 !! html/parsoid
8409 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8410 !! end
8411
8412 !! test
8413 4. Redirect to a templated destination
8414 !! wikitext
8415 #REDIRECT [[{{echo|Foo}}bar]]
8416 !! html/parsoid
8417 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8418 !! end
8419
8420 !! test
8421 Empty redirect
8422 !! options
8423 parsoid=wt2html,wt2wt
8424 !! wikitext
8425 #REDIRECT [[]]
8426 !! html/parsoid
8427 <ol>
8428 <li>REDIRECT [[]]</li></ol>
8429 !! end
8430
8431 !! test
8432 Optional colon in #REDIRECT
8433 !! options
8434 # the colon is archaic syntax. we support it for wt2html, but we
8435 # don't care that it roundtrips back to the modern syntax.
8436 parsoid=wt2html,html2html
8437 !! wikitext
8438 #REDIRECT:[[Main Page]]
8439 !! html/parsoid
8440 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8441 !! end
8442
8443 !! test
8444 Whitespace in #REDIRECT with optional colon
8445 !! options
8446 # the colon and gratuitous whitespace is archaic syntax. we support
8447 # it for wt2html, but we don't care that it roundtrips back to the
8448 # modern syntax (without extra whitespace)
8449 parsoid=wt2html,html2html
8450 !! wikitext
8451
8452 #REDIRECT
8453 :
8454 [[Main Page]]
8455 !! html/parsoid
8456 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8457 !! end
8458
8459 !! test
8460 Piped link in #REDIRECT
8461 !! options
8462 # content after piped link is ignored. we support this syntax,
8463 # but don't care that the piped link is lost when we roundtrip this.
8464 parsoid=wt2html
8465 !! wikitext
8466 #REDIRECT [[Main Page|bar]]
8467 !! html/parsoid
8468 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8469 !! end
8470
8471 !! test
8472 Redirect to category (T104502)
8473 !! options
8474 parsoid=wt2html,wt2wt
8475 !! wikitext
8476 #REDIRECT [[Category:Foo]]
8477 !! html/parsoid
8478 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8479 !! end
8480
8481 !! test
8482 Redirect to category with URL encoding (T104502)
8483 !! options
8484 parsoid=wt2html
8485 !! wikitext
8486 #REDIRECT [[Category%3AFoo]]
8487 !! html/parsoid
8488 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8489 !! end
8490
8491 !! test
8492 Redirect to category page
8493 !! wikitext
8494 #REDIRECT [[:Category:Foo]]
8495 !! html/parsoid
8496 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8497 !! end
8498
8499 !! test
8500 Redirect to image page (1)
8501 !! wikitext
8502 #REDIRECT [[File:Wiki.png]]
8503 !! html/parsoid
8504 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8505 !! end
8506
8507 !! test
8508 Redirect to image page (2)
8509 !! wikitext
8510 #REDIRECT [[Image:Wiki.png]]
8511 !! html/parsoid
8512 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8513 !! end
8514
8515 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8516 # Next test confirms this.
8517 !! test
8518 Redirect to language (1) (T104918)
8519 !! options
8520 parsoid=wt2html,wt2wt,html2html
8521 !! wikitext
8522 #REDIRECT [[en:File:Wiki.png]]
8523 !! html/parsoid
8524 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8525 !! end
8526
8527 !! test
8528 Redirect to language (2) (T104918)
8529 !! wikitext
8530 #REDIRECT [[:en:File:Wiki.png]]
8531 !! html/parsoid
8532 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8533 !! end
8534
8535 !! test
8536 Redirect to interwiki (T104918)
8537 !! wikitext
8538 #REDIRECT [[meatball:File:Wiki.png]]
8539 !! html/parsoid
8540 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8541 !! end
8542
8543 !! test
8544 Non-English #REDIRECT
8545 !! options
8546 language=is
8547 !! wikitext
8548 #TILVÍSUN [[Main Page]]
8549 !! html/parsoid
8550 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8551 !! end
8552
8553 !! test
8554 Redirect syntax under text isn't considered a redirect
8555 !! wikitext
8556 some text
8557 #redirect [[Main Page]]
8558 !! html/parsoid
8559 <p>some text</p>
8560 <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>
8561 !! end
8562
8563 # FIXME: Should hoist the redirect to the top of the page and ensure there
8564 # is only one.
8565 !! test
8566 New redirect
8567 !! options
8568 parsoid=html2wt
8569 !! html/parsoid
8570 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8571 !! wikitext
8572 Foo
8573 #REDIRECT [[Foo]]
8574 !! end
8575
8576 ##
8577 ## XHTML tidiness
8578 ###
8579
8580 !! test
8581 <br> to <br />
8582 !! wikitext
8583 1<br>2<br />3
8584 !! html
8585 <p>1<br />2<br />3
8586 </p>
8587 !! end
8588
8589 !! test
8590 Broken br tag sanitization
8591 !! wikitext
8592 </br>
8593 !! html/php
8594 <p>&lt;/br&gt;
8595 </p>
8596 !! end
8597
8598 # TODO: Fix html2html mode (bug 51055)!
8599 !! test
8600 Parsoid: Broken br tag recognition
8601 !! options
8602 parsoid=wt2html
8603 !! wikitext
8604 </br>
8605
8606 <br/ >
8607 !! html+tidy
8608 <p><br /></p>
8609 <p><br /></p>
8610 !! end
8611
8612 !! test
8613 Incorrecly removing closing slashes from correctly formed XHTML
8614 !! wikitext
8615 <br style="clear:both;" />
8616 !! html
8617 <p><br style="clear:both;" />
8618 </p>
8619 !! end
8620
8621 !! test
8622 Failing to transform badly formed HTML into correct XHTML
8623 !! wikitext
8624 <br style="clear: left;">
8625 <br style="clear: right;">
8626 <br style="clear: both;">
8627 !! html
8628 <p><br style="clear: left;" />
8629 <br style="clear: right;" />
8630 <br style="clear: both;" />
8631 </p>
8632 !!end
8633
8634 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8635 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8636 !! test
8637 Handling html with a div self-closing tag
8638 !! wikitext
8639 <div title />
8640 <div title/>
8641 <div title/ >
8642 <div title=bar />
8643 <div title=bar/>
8644 <div title=bar/ >
8645 !! html/php
8646 <p>&lt;div title /&gt;
8647 &lt;div title/&gt;
8648 </p>
8649 <div>
8650 <p>&lt;div title=bar /&gt;
8651 &lt;div title=bar/&gt;
8652 </p>
8653 <div title="bar/"></div>
8654 </div>
8655
8656 !! html/parsoid
8657 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8658 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8659 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8660 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8661 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8662 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8663 !! end
8664
8665 !! test
8666 Handling html with a br self-closing tag
8667 !! wikitext
8668 <br title />
8669 <br title/>
8670 <br title/ >
8671 <br title=bar />
8672 <br title=bar/>
8673 <br title=bar/ >
8674 !! html/php
8675 <p><br title="" />
8676 <br title="" />
8677 <br />
8678 <br title="bar" />
8679 <br title="bar" />
8680 <br title="bar/" />
8681 </p>
8682 !! html/parsoid
8683 <p><br title="" />
8684 <br title="" />
8685 <br title="" />
8686 <br title="bar" />
8687 <br title="bar" />
8688 <br title="bar/" />
8689 </p>
8690 !! end
8691
8692 !! test
8693 Horizontal ruler (should it add that extra space?)
8694 !! wikitext
8695 <hr>
8696 <hr >
8697 foo <hr
8698 > bar
8699 !! html+tidy
8700 <hr />
8701 <hr />
8702 <p>foo</p>
8703 <hr />
8704 <p>bar</p>
8705 !! end
8706
8707 !! test
8708 Horizontal ruler -- 4+ dashes render hr
8709 !! wikitext
8710 ----
8711 !! html
8712 <hr />
8713
8714 !! end
8715
8716 !! test
8717 Horizontal ruler -- eats additional dashes on the same line
8718 !! wikitext
8719 ---------
8720 !! html
8721 <hr />
8722
8723 !! end
8724
8725 !! test
8726 Horizontal ruler -- does not collapse dashes on consecutive lines
8727 !! wikitext
8728 ----
8729 ----
8730 !! html
8731 <hr />
8732 <hr />
8733
8734 !! end
8735
8736 !! test
8737 Horizontal ruler -- <4 dashes render as plain text
8738 !! wikitext
8739 ---
8740 !! html
8741 <p>---
8742 </p>
8743 !! end
8744
8745 !! test
8746 Horizontal ruler -- Supports content following dashes on same line
8747 !! wikitext
8748 ---- Foo
8749 !! html
8750 <hr /> Foo
8751
8752 !! html+tidy
8753 <hr />
8754 <p>Foo</p>
8755 !! end
8756
8757 ###
8758 ### Block-level elements
8759 ###
8760 !! test
8761 Common list
8762 !! wikitext
8763 *Common list
8764 * item 2
8765 *item 3
8766 !! html
8767 <ul><li>Common list</li>
8768 <li> item 2</li>
8769 <li>item 3</li></ul>
8770
8771 !! end
8772
8773 !! test
8774 Numbered list
8775 !! wikitext
8776 #Numbered list
8777 #item 2
8778 # item 3
8779 !! html
8780 <ol><li>Numbered list</li>
8781 <li>item 2</li>
8782 <li> item 3</li></ol>
8783
8784 !! end
8785
8786 !! test
8787 Mixed list
8788 !! wikitext
8789 *Mixed list
8790 *# with numbers
8791 ** and bullets
8792 *# and numbers
8793 *bullets again
8794 **bullet level 2
8795 ***bullet level 3
8796 ***#Number on level 4
8797 **bullet level 2
8798 **#Number on level 3
8799 **#Number on level 3
8800 *#number level 2
8801 *Level 1
8802 *** Level 3
8803 #** Level 3, but ordered
8804 !! html
8805 <ul><li>Mixed list
8806 <ol><li> with numbers</li></ol>
8807 <ul><li> and bullets</li></ul>
8808 <ol><li> and numbers</li></ol></li>
8809 <li>bullets again
8810 <ul><li>bullet level 2
8811 <ul><li>bullet level 3
8812 <ol><li>Number on level 4</li></ol></li></ul></li>
8813 <li>bullet level 2
8814 <ol><li>Number on level 3</li>
8815 <li>Number on level 3</li></ol></li></ul>
8816 <ol><li>number level 2</li></ol></li>
8817 <li>Level 1
8818 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8819 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8820
8821 !! end
8822
8823 !! test
8824 1. Nested mixed wikitext and html list
8825 !! wikitext
8826 * hi
8827 * <ul><li>ho</li></ul>
8828 * hi
8829 ** ho
8830 !! html/php
8831 <ul><li> hi</li>
8832 <li> <ul><li>ho</li></ul></li>
8833 <li> hi
8834 <ul><li> ho</li></ul></li></ul>
8835
8836 !! html/parsoid
8837 <ul><li> hi</li>
8838 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8839 <li> hi
8840 <ul><li> ho</li></ul></li></ul>
8841 !! end
8842
8843 !! test
8844 2. Nested mixed wikitext and html list (incompatible)
8845 !! wikitext
8846 ; hi
8847 : {{echo|<li>ho</li>}}
8848 !! html/php
8849 <dl><dt> hi</dt>
8850 <dd> <li>ho</li></dd></dl>
8851
8852 !! html/parsoid
8853 <dl><dt> hi</dt>
8854 <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>
8855 !! end
8856
8857 !! test
8858 Nested lists 1
8859 !! wikitext
8860 *foo
8861 **bar
8862 !! html
8863 <ul><li>foo
8864 <ul><li>bar</li></ul></li></ul>
8865
8866 !! end
8867
8868 !! test
8869 Nested lists 2
8870 !! wikitext
8871 **foo
8872 *bar
8873 !! html
8874 <ul><li><ul><li>foo</li></ul></li>
8875 <li>bar</li></ul>
8876
8877 !! end
8878
8879 !! test
8880 Nested lists 3 (first element empty)
8881 !! wikitext
8882 *
8883 **bar
8884 !! html
8885 <ul><li>
8886 <ul><li>bar</li></ul></li></ul>
8887
8888 !! end
8889
8890 !! test
8891 Nested lists 4 (first element empty)
8892 !! wikitext
8893 **
8894 *bar
8895 !! html
8896 <ul><li><ul><li></li></ul></li>
8897 <li>bar</li></ul>
8898
8899 !! end
8900
8901 !! test
8902 Nested lists 5 (both elements empty)
8903 !! wikitext
8904 **
8905 *
8906 !! html
8907 <ul><li><ul><li></li></ul></li>
8908 <li></li></ul>
8909
8910 !! end
8911
8912 !! test
8913 Nested lists 6 (both elements empty)
8914 !! wikitext
8915 *
8916 **
8917 !! html
8918 <ul><li>
8919 <ul><li></li></ul></li></ul>
8920
8921 !! end
8922
8923 !! test
8924 Nested lists 7 (skip initial nesting levels)
8925 !! wikitext
8926 *** foo
8927 !! html
8928 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8929
8930 !! end
8931
8932 !! test
8933 Nested lists 8 (multiple nesting transitions)
8934 !! wikitext
8935 * foo
8936 *** bar
8937 ** baz
8938 * boo
8939 !! html
8940 <ul><li> foo
8941 <ul><li><ul><li> bar</li></ul></li>
8942 <li> baz</li></ul></li>
8943 <li> boo</li></ul>
8944
8945 !! end
8946
8947 !! test
8948 Nested lists 9 (extension interaction)
8949 !! options
8950 parsoid
8951 !! wikitext
8952 *<references />
8953 !! html/parsoid
8954 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8955 !! end
8956
8957 !! test
8958 1. Lists with start-of-line-transparent tokens before bullets: Comments
8959 !! wikitext
8960 *foo
8961 *<!--cmt-->bar
8962 <!--cmt-->*baz
8963 !! html
8964 <ul><li>foo</li>
8965 <li>bar</li>
8966 <li>baz</li></ul>
8967
8968 !! end
8969
8970 !! test
8971 2. Lists with start-of-line-transparent tokens before bullets: Template close
8972 !! wikitext
8973 *foo {{echo|bar
8974 }}*baz
8975 !! html
8976 <ul><li>foo bar</li>
8977 <li>baz</li></ul>
8978
8979 !! end
8980
8981 !! test
8982 List items are not parsed correctly following a <pre> block (bug 785)
8983 !! wikitext
8984 * <pre>foo</pre>
8985 * <pre>bar</pre>
8986 * zar
8987 !! html/php
8988 <ul><li> <pre>foo</pre></li>
8989 <li> <pre>bar</pre></li>
8990 <li> zar</li></ul>
8991
8992 !! html/parsoid
8993 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8994 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8995 <li> zar</li></ul>
8996 !! end
8997
8998 !! test
8999 List items from template
9000 !! wikitext
9001
9002 {{inner list}}
9003 * item 2
9004
9005 * item 0
9006 {{inner list}}
9007 * item 2
9008
9009 * item 0
9010 * notSOL{{inner list}}
9011 * item 2
9012 !! html
9013 <ul><li> item 1</li>
9014 <li> item 2</li></ul>
9015 <ul><li> item 0</li>
9016 <li> item 1</li>
9017 <li> item 2</li></ul>
9018 <ul><li> item 0</li>
9019 <li> notSOL</li>
9020 <li> item 1</li>
9021 <li> item 2</li></ul>
9022
9023 !! end
9024
9025 !! test
9026 List interrupted by empty line or heading
9027 !! wikitext
9028 * foo
9029
9030 ** bar
9031 == A heading ==
9032 * Another list item
9033 !! html
9034 <ul><li> foo</li></ul>
9035 <ul><li><ul><li> bar</li></ul></li></ul>
9036 <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>
9037 <ul><li> Another list item</li></ul>
9038
9039 !!end
9040
9041 !!test
9042 Multiple list tags generated by templates
9043 !! wikitext
9044 {{echo|<li>}}a
9045 {{echo|<li>}}b
9046 {{echo|<li>}}c
9047 !! html
9048 <li>a
9049 <li>b
9050 <li>c</li>
9051 </li>
9052 </li>
9053
9054 !! html+tidy
9055 <ul>
9056 <li>a</li>
9057 <li>b</li>
9058 <li>c</li>
9059 </ul>
9060 !!end
9061
9062 !!test
9063 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9064 !! wikitext
9065 *a
9066 <!--This line will NOT split the list-->
9067 *b
9068 <!--This line will NOT split the list either-->
9069 *c
9070 <!--foo--> <!----> <!--This line NOT split the list either-->
9071 *d
9072 !! html
9073 <ul><li>a</li>
9074 <li>b</li>
9075 <li>c</li>
9076 <li>d</li></ul>
9077
9078 !!end
9079
9080 !!test
9081 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9082 !! wikitext
9083 *a
9084 <!--This line will NOT split the list-->
9085 *b
9086 <!--This line will NOT split the list either-->
9087 *c
9088 <!--foo--> <!----> <!--This line NOT split the list
9089 either-->
9090 *d
9091 !! html
9092 <ul><li>a</li>
9093 <li>b</li>
9094 <li>c</li>
9095 <li>d</li></ul>
9096
9097 !!end
9098
9099 !!test
9100 Test the li-hack
9101 (The PHP parser relies on Tidy for the hack)
9102 !!options
9103 parsoid=wt2html,wt2wt
9104 !! wikitext
9105 * foo
9106 * <li>li-hack
9107 * {{echo|<li>templated li-hack}}
9108 * <!--foo--> <li> unsupported li-hack with preceding comments
9109
9110 <ul>
9111 <li><li>not a li-hack
9112 </li>
9113 </ul>
9114 !! html+tidy
9115 <ul>
9116 <li>foo</li>
9117 <li>li-hack</li>
9118 <li>templated li-hack</li>
9119 <li>unsupported li-hack with preceding comments</li>
9120 </ul>
9121 <ul>
9122 <li>not a li-hack</li>
9123 </ul>
9124 !!end
9125
9126 !! test
9127 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9128 !! options
9129 parsoid
9130 !! wikitext
9131 # foo
9132 ## bar
9133 * foo
9134 ** bar
9135 : foo
9136 :: bar
9137 !! html
9138 <ol>
9139 <li> foo<ol>
9140 <li> bar</li>
9141 </ol></li>
9142 </ol><ul>
9143 <li> foo<ul>
9144 <li> bar</li>
9145 </ul></li>
9146 </ul><dl>
9147 <dd> foo<dl>
9148 <dd> bar</dd>
9149 </dl></dd>
9150 </dl>
9151 !! end
9152
9153 !! test
9154 Parsoid: Test of whitespace serialization with Templated bullets
9155 !! options
9156 parsoid
9157 !! wikitext
9158 * {{bullet}}
9159 !! html
9160 <ul>
9161 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9162 </ul>
9163 !! end
9164
9165 # ------------------------------------------------------------------------
9166 # The next set of tests are about Parsoid's ability to handle badly nested
9167 # tags (parse, minimize scope of fixup, and roundtrip back)
9168 # ------------------------------------------------------------------------
9169
9170 !! test
9171 Unbalanced closing block tags break a list
9172 (php parser relies on Tidy to fix up)
9173 !! wikitext
9174 <div>
9175 *a</div><div>
9176 *b</div>
9177 !! html+tidy
9178 <div>
9179 <ul>
9180 <li>a</li>
9181 </ul>
9182 </div>
9183 <div>
9184 <ul>
9185 <li>b</li>
9186 </ul>
9187 </div>
9188 !! end
9189
9190 # Parsoid fails this test, but it might be tricky to support properly.
9191 # See bug 68395.
9192 !! test
9193 Unbalanced closing non-block tags don't break a list
9194 (php parser relies on Tidy to fix up)
9195 !! wikitext
9196 <span>
9197 *a</span><span>
9198 *b</span>
9199 !! html/php+tidy
9200 <ul>
9201 <li><span>a</span></li>
9202 <li><span>b</span></li>
9203 </ul>
9204 !! html/parsoid
9205 <span>
9206 <ul>
9207 <li>a<span></span>
9208 </li>
9209 <li>b
9210 </li>
9211 </ul>
9212 </span>
9213 !! end
9214
9215 !! test
9216 Unclosed formatting tags that straddle lists are closed and reopened
9217 (php parser relies on Tidy to fix up)
9218 !! options
9219 parsoid=wt2html,wt2wt,html2html
9220 !! wikitext
9221 # <s> a
9222 # b </s>
9223 !! html/php+tidy
9224 <ol>
9225 <li><s>a</s></li>
9226 <li><s>b</s></li>
9227 </ol>
9228 !! html/parsoid
9229 <ol><li> <s> a</s></li>
9230 <li><s> b </s></li></ol>
9231 !! end
9232
9233 # See bug 68395.
9234 !!test
9235 1. List embedded in a formatting tag
9236 !! wikitext
9237 <small>
9238 * foo
9239 </small>
9240 !! html/php+tidy
9241 <ul>
9242 <li><small>foo</small></li>
9243 </ul>
9244 !! html/parsoid
9245 <small>
9246 <ul>
9247 <li> foo</li>
9248 </ul>
9249 </small>
9250 !!end
9251
9252 ## Ugly Parsoid output here
9253 ## Not sure what the right output is.
9254 !!test
9255 2. List embedded in a formatting tag
9256 !! wikitext
9257 <small>
9258 *a
9259 *b</small>
9260 !! html/php+tidy
9261 <ul>
9262 <li><small>a</small></li>
9263 <li><small>b</small></li>
9264 </ul>
9265 !! html/parsoid
9266 <small></small>
9267 <ul><small>
9268 <li>a</li>
9269 </small>
9270 <li><small>b</small></li>
9271 </ul>
9272 !!end
9273
9274 # Ugly Parsoid and PHP parser output here
9275 # Not sure if we want to make this a test!
9276 #
9277 ## !!test
9278 ## 3. Unclosed formatting tags in list elements
9279 ## !! wikitext
9280 ## *<small>a
9281 ## *<small>b
9282 ## !! html/php+tidy
9283 ## <ul>
9284 ## <li><small>a</small></li>
9285 ## <li><small><small>b</small></small></li>
9286 ## </ul>
9287 ## !! html/parsoid
9288 ## <ul>
9289 ## <li><small>a</small></li>
9290 ## <small>
9291 ## <li><small>b</small></li>
9292 ## </small></ul>
9293 ## !!end
9294
9295 # This is a bug in the PHP parser + tidy combination.
9296 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9297 # and then fostered out of the table by tidy.)
9298 # We believe the Parsoid output to be correct.
9299 !! test
9300 Table with missing opening <tr> tag
9301 !! options
9302 parsoid=wt2html,wt2wt
9303 !! wikitext
9304 <table>
9305 <td>foo</td>
9306 </tr>
9307 </table>
9308 !! html+tidy
9309 <table>
9310 <tr>
9311 <td>foo</td>
9312 </tr>
9313 </table>
9314 !! end
9315
9316 ###
9317 ### Magic Words
9318 ###
9319
9320 # Note that the current date is hard-coded as
9321 # 1970-01-01T00:02:03Z (a Thursday)
9322 # when running parser tests. The timezone is also fixed to GMT, so
9323 # local date will be identical to current date.
9324
9325 !! test
9326 Magic Word: {{CURRENTDAY}}
9327 !! wikitext
9328 {{CURRENTDAY}}
9329 !! html
9330 <p>1
9331 </p>
9332 !! end
9333
9334 !! test
9335 Magic Word: {{CURRENTDAY2}}
9336 !! wikitext
9337 {{CURRENTDAY2}}
9338 !! html
9339 <p>01
9340 </p>
9341 !! end
9342
9343 !! test
9344 Magic Word: {{CURRENTDAYNAME}}
9345 !! wikitext
9346 {{CURRENTDAYNAME}}
9347 !! html
9348 <p>Thursday
9349 </p>
9350 !! end
9351
9352 !! test
9353 Magic Word: {{CURRENTDOW}}
9354 !! wikitext
9355 {{CURRENTDOW}}
9356 !! html
9357 <p>4
9358 </p>
9359 !! end
9360
9361 !! test
9362 Magic Word: {{CURRENTMONTH}}
9363 !! wikitext
9364 {{CURRENTMONTH}}
9365 !! html
9366 <p>01
9367 </p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{CURRENTMONTH1}}
9372 !! wikitext
9373 {{CURRENTMONTH1}}
9374 !! html
9375 <p>1
9376 </p>
9377 !! end
9378
9379 !! test
9380 Magic Word: {{CURRENTMONTHABBREV}}
9381 !! wikitext
9382 {{CURRENTMONTHABBREV}}
9383 !! html
9384 <p>Jan
9385 </p>
9386 !! end
9387
9388 !! test
9389 Magic Word: {{CURRENTMONTHNAME}}
9390 !! wikitext
9391 {{CURRENTMONTHNAME}}
9392 !! html
9393 <p>January
9394 </p>
9395 !! end
9396
9397 !! test
9398 Magic Word: {{CURRENTMONTHNAMEGEN}}
9399 !! wikitext
9400 {{CURRENTMONTHNAMEGEN}}
9401 !! html
9402 <p>January
9403 </p>
9404 !! end
9405
9406 !! test
9407 Magic Word: {{CURRENTTIME}}
9408 !! wikitext
9409 {{CURRENTTIME}}
9410 !! html
9411 <p>00:02
9412 </p>
9413 !! end
9414
9415 !! test
9416 Magic Word: {{CURRENTHOUR}}
9417 !! wikitext
9418 {{CURRENTHOUR}}
9419 !! html
9420 <p>00
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9426 !! wikitext
9427 {{CURRENTWEEK}}
9428 !! html
9429 <p>1
9430 </p>
9431 !! end
9432
9433 !! test
9434 Magic Word: {{CURRENTYEAR}}
9435 !! wikitext
9436 {{CURRENTYEAR}}
9437 !! html
9438 <p>1970
9439 </p>
9440 !! end
9441
9442 !! test
9443 Magic Word: {{CURRENTTIMESTAMP}}
9444 !! wikitext
9445 {{CURRENTTIMESTAMP}}
9446 !! html
9447 <p>19700101000203
9448 </p>
9449 !! end
9450
9451 !! test
9452 Magic Words LOCAL (UTC)
9453 !! wikitext
9454 * {{LOCALMONTH}}
9455 * {{LOCALMONTH1}}
9456 * {{LOCALMONTHNAME}}
9457 * {{LOCALMONTHNAMEGEN}}
9458 * {{LOCALMONTHABBREV}}
9459 * {{LOCALDAY}}
9460 * {{LOCALDAY2}}
9461 * {{LOCALDAYNAME}}
9462 * {{LOCALYEAR}}
9463 * {{LOCALTIME}}
9464 * {{LOCALHOUR}}
9465 * {{LOCALWEEK}}
9466 * {{LOCALDOW}}
9467 * {{LOCALTIMESTAMP}}
9468 !! html
9469 <ul><li> 01</li>
9470 <li> 1</li>
9471 <li> January</li>
9472 <li> January</li>
9473 <li> Jan</li>
9474 <li> 1</li>
9475 <li> 01</li>
9476 <li> Thursday</li>
9477 <li> 1970</li>
9478 <li> 00:02</li>
9479 <li> 00</li>
9480 <li> 1</li>
9481 <li> 4</li>
9482 <li> 19700101000203</li></ul>
9483
9484 !! end
9485
9486 !! test
9487 Magic Word: {{FULLPAGENAME}}
9488 !! options
9489 title=[[User:Ævar Arnfjörð Bjarmason]]
9490 !! wikitext
9491 {{FULLPAGENAME}}
9492 !! html
9493 <p>User:Ævar Arnfjörð Bjarmason
9494 </p>
9495 !! end
9496
9497 !! test
9498 Magic Word: {{FULLPAGENAMEE}}
9499 !! options
9500 title=[[User:Ævar Arnfjörð Bjarmason]]
9501 !! wikitext
9502 {{FULLPAGENAMEE}}
9503 !! html
9504 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9505 </p>
9506 !! end
9507
9508 !! test
9509 Magic Word: {{TALKSPACE}}
9510 !! options
9511 title=[[User:Ævar Arnfjörð Bjarmason]]
9512 !! wikitext
9513 {{TALKSPACE}}
9514 !! html
9515 <p>User talk
9516 </p>
9517 !! end
9518
9519 !! test
9520 Magic Word: {{TALKSPACE}}, same namespace
9521 !! options
9522 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9523 !! wikitext
9524 {{TALKSPACE}}
9525 !! html
9526 <p>User talk
9527 </p>
9528 !! end
9529
9530 !! test
9531 Magic Word: {{TALKSPACE}}, main namespace
9532 !! options
9533 title=[[Parser Test]]
9534 !! wikitext
9535 {{TALKSPACE}}
9536 !! html
9537 <p>Talk
9538 </p>
9539 !! end
9540
9541 !! test
9542 Magic Word: {{TALKSPACEE}}
9543 !! options
9544 title=[[User:Ævar Arnfjörð Bjarmason]]
9545 !! wikitext
9546 {{TALKSPACEE}}
9547 !! html
9548 <p>User_talk
9549 </p>
9550 !! end
9551
9552 !! test
9553 Magic Word: {{SUBJECTSPACE}}
9554 !! options
9555 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9556 !! wikitext
9557 {{SUBJECTSPACE}}
9558 !! html
9559 <p>User
9560 </p>
9561 !! end
9562
9563 !! test
9564 Magic Word: {{SUBJECTSPACE}}, same namespace
9565 !! options
9566 title=[[User:Ævar Arnfjörð Bjarmason]]
9567 !! wikitext
9568 {{SUBJECTSPACE}}
9569 !! html
9570 <p>User
9571 </p>
9572 !! end
9573
9574 !! test
9575 Magic Word: {{SUBJECTSPACE}}, main namespace
9576 !! options
9577 title=[[Parser Test]]
9578 !! wikitext
9579 {{SUBJECTSPACE}}
9580 !! html
9581
9582 !! end
9583
9584 !! test
9585 Magic Word: {{SUBJECTSPACEE}}
9586 !! options
9587 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9588 !! wikitext
9589 {{SUBJECTSPACEE}}
9590 !! html
9591 <p>User
9592 </p>
9593 !! end
9594
9595 !! test
9596 Magic Word: {{NAMESPACE}}
9597 !! options
9598 title=[[User:Ævar Arnfjörð Bjarmason]]
9599 !! wikitext
9600 {{NAMESPACE}}
9601 !! html
9602 <p>User
9603 </p>
9604 !! end
9605
9606 !! test
9607 Magic Word: {{NAMESPACEE}}
9608 !! options
9609 title=[[User:Ævar Arnfjörð Bjarmason]]
9610 !! wikitext
9611 {{NAMESPACEE}}
9612 !! html
9613 <p>User
9614 </p>
9615 !! end
9616
9617 !! test
9618 Magic Word: {{NAMESPACENUMBER}}
9619 !! options
9620 title=[[User:Ævar Arnfjörð Bjarmason]]
9621 !! wikitext
9622 {{NAMESPACENUMBER}}
9623 !! html
9624 <p>2
9625 </p>
9626 !! end
9627
9628 !! test
9629 Magic Word: {{SUBPAGENAME}}
9630 !! options
9631 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9632 !! wikitext
9633 {{SUBPAGENAME}}
9634 !! html
9635 <p>sub ö
9636 </p>
9637 !! end
9638
9639 !! test
9640 Magic Word: {{SUBPAGENAMEE}}
9641 !! options
9642 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9643 !! wikitext
9644 {{SUBPAGENAMEE}}
9645 !! html
9646 <p>sub_%C3%B6
9647 </p>
9648 !! end
9649
9650 !! test
9651 Magic Word: {{ROOTPAGENAME}}
9652 !! options
9653 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9654 !! wikitext
9655 {{ROOTPAGENAME}}
9656 !! html
9657 <p>Ævar Arnfjörð Bjarmason
9658 </p>
9659 !! end
9660
9661 !! test
9662 Magic Word: {{ROOTPAGENAMEE}}
9663 !! options
9664 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9665 !! wikitext
9666 {{ROOTPAGENAMEE}}
9667 !! html
9668 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9669 </p>
9670 !! end
9671
9672 !! test
9673 Magic Word: {{BASEPAGENAME}}
9674 !! options
9675 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9676 !! wikitext
9677 {{BASEPAGENAME}}
9678 !! html
9679 <p>Ævar Arnfjörð Bjarmason
9680 </p>
9681 !! end
9682
9683 !! test
9684 Magic Word: {{BASEPAGENAMEE}}
9685 !! options
9686 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9687 !! wikitext
9688 {{BASEPAGENAMEE}}
9689 !! html
9690 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9691 </p>
9692 !! end
9693
9694 !! test
9695 Magic Word: {{TALKPAGENAME}}
9696 !! options
9697 title=[[User:Ævar Arnfjörð Bjarmason]]
9698 !! wikitext
9699 {{TALKPAGENAME}}
9700 !! html
9701 <p>User talk:Ævar Arnfjörð Bjarmason
9702 </p>
9703 !! end
9704
9705 !! test
9706 Magic Word: {{TALKPAGENAMEE}}
9707 !! options
9708 title=[[User:Ævar Arnfjörð Bjarmason]]
9709 !! wikitext
9710 {{TALKPAGENAMEE}}
9711 !! html
9712 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9713 </p>
9714 !! end
9715
9716 !! test
9717 Magic Word: {{SUBJECTPAGENAME}}
9718 !! options
9719 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9720 !! wikitext
9721 {{SUBJECTPAGENAME}}
9722 !! html
9723 <p>User:Ævar Arnfjörð Bjarmason
9724 </p>
9725 !! end
9726
9727 !! test
9728 Magic Word: {{SUBJECTPAGENAMEE}}
9729 !! options
9730 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9731 !! wikitext
9732 {{SUBJECTPAGENAMEE}}
9733 !! html
9734 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9735 </p>
9736 !! end
9737
9738 !! test
9739 Magic Word: {{NUMBEROFFILES}}
9740 !! wikitext
9741 {{NUMBEROFFILES}}
9742 !! html
9743 <p>6
9744 </p>
9745 !! end
9746
9747 !! test
9748 Magic Word: {{PAGENAME}}
9749 !! options
9750 title=[[User:Ævar Arnfjörð Bjarmason]]
9751 !! wikitext
9752 {{PAGENAME}}
9753 !! html
9754 <p>Ævar Arnfjörð Bjarmason
9755 </p>
9756 !! end
9757
9758 !! test
9759 Magic Word: {{PAGENAME}} with metacharacters
9760 !! options
9761 title=[['foo & bar = baz']]
9762 !! wikitext
9763 ''{{PAGENAME}}''
9764 !! html/php
9765 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9766 </p>
9767 !! html+tidy
9768 <p><i>'foo &amp; bar = baz'</i></p>
9769 !! end
9770
9771 !! test
9772 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9773 !! options
9774 title=[[*RFC 1234 http://example.com/]]
9775 !! wikitext
9776 {{PAGENAME}}
9777 !! html/php
9778 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9779 </p>
9780 !! html+tidy
9781 <p>*RFC 1234 http://example.com/</p>
9782 !! end
9783
9784 !! test
9785 Magic Word: {{PAGENAMEE}}
9786 !! options
9787 title=[[User:Ævar Arnfjörð Bjarmason]]
9788 !! wikitext
9789 {{PAGENAMEE}}
9790 !! html
9791 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9792 </p>
9793 !! end
9794
9795 !! test
9796 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9797 !! options
9798 title=[[*RFC 1234 http://example.com/]]
9799 !! wikitext
9800 {{PAGENAMEE}}
9801 !! html/php
9802 <p>&#42;RFC_1234_http&#58;//example.com/
9803 </p>
9804 !! html+tidy
9805 <p>*RFC_1234_http://example.com/</p>
9806 !! end
9807
9808 !! test
9809 Magic Word: {{REVISIONID}}
9810 !! wikitext
9811 {{REVISIONID}}
9812 !! html
9813 <p>1337
9814 </p>
9815 !! end
9816
9817 !! test
9818 Magic Word: {{SCRIPTPATH}}
9819 !! wikitext
9820 {{SCRIPTPATH}}
9821 !! html
9822
9823 !! end
9824
9825 !! test
9826 Magic Word: {{STYLEPATH}}
9827 !! wikitext
9828 {{STYLEPATH}}
9829 !! html
9830 <p>/skins
9831 </p>
9832 !! end
9833
9834 !! test
9835 Magic Word: {{SERVER}}
9836 !! wikitext
9837 {{SERVER}}
9838 !! html
9839 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9840 </p>
9841 !! end
9842
9843 !! test
9844 Magic Word: {{SERVERNAME}}
9845 !! wikitext
9846 {{SERVERNAME}}
9847 !! html
9848 <p>example.org
9849 </p>
9850 !! end
9851
9852 !! test
9853 Magic Word: {{SITENAME}}
9854 !! wikitext
9855 {{SITENAME}}
9856 !! html
9857 <p>MediaWiki
9858 </p>
9859 !! end
9860
9861 !! test
9862 Case-sensitive magic words, when cased differently, should just be template transclusions
9863 !! wikitext
9864 {{CurrentMonth}}
9865 {{currentday}}
9866 {{cURreNTweEK}}
9867 {{currentHour}}
9868 !! html
9869 <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>
9870 <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>
9871 <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>
9872 <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>
9873 </p>
9874 !! end
9875
9876 !! test
9877 Case-insensitive magic words should still work with weird casing.
9878 !! wikitext
9879 {{sErVeRNaMe}}
9880 {{LCFirst:AOEU}}
9881 {{ucFIRST:aoeu}}
9882 {{SERver}}
9883 !! html
9884 <p>example.org
9885 aOEU
9886 Aoeu
9887 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9888 </p>
9889 !! end
9890
9891 # From plwiki:PLOS_ONE
9892 !! test
9893 Parsoid: Page property magic word with magic word contents
9894 !! wikitext
9895 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9896 !! html/parsoid
9897 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9898 !! end
9899
9900 !! test
9901 Parsoid: Template-generated DISPLAYTITLE
9902 !! wikitext
9903 {{{{echo|DISPLAYTITLE}}:Foo}}
9904 !! html/parsoid
9905 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9906 !! end
9907
9908 !! test
9909 Namespace 1 {{ns:1}}
9910 !! wikitext
9911 {{ns:1}}
9912 !! html
9913 <p>Talk
9914 </p>
9915 !! end
9916
9917 !! test
9918 Namespace 1 {{ns:01}}
9919 !! wikitext
9920 {{ns:01}}
9921 !! html
9922 <p>Talk
9923 </p>
9924 !! end
9925
9926 !! test
9927 Namespace 0 {{ns:0}} (bug 4783)
9928 !! wikitext
9929 {{ns:0}}
9930 !! html
9931
9932 !! end
9933
9934 !! test
9935 Namespace 0 {{ns:00}} (bug 4783)
9936 !! wikitext
9937 {{ns:00}}
9938 !! html
9939
9940 !! end
9941
9942 !! test
9943 Namespace -1 {{ns:-1}}
9944 !! wikitext
9945 {{ns:-1}}
9946 !! html
9947 <p>Special
9948 </p>
9949 !! end
9950
9951 !! test
9952 Namespace User {{ns:User}}
9953 !! wikitext
9954 {{ns:User}}
9955 !! html
9956 <p>User
9957 </p>
9958 !! end
9959
9960 !! test
9961 Namespace User talk {{ns:User_talk}}
9962 !! wikitext
9963 {{ns:User_talk}}
9964 !! html
9965 <p>User talk
9966 </p>
9967 !! end
9968
9969 !! test
9970 Namespace User talk {{ns:uSeR tAlK}}
9971 !! wikitext
9972 {{ns:uSeR tAlK}}
9973 !! html
9974 <p>User talk
9975 </p>
9976 !! end
9977
9978 !! test
9979 Namespace File {{ns:File}}
9980 !! wikitext
9981 {{ns:File}}
9982 !! html
9983 <p>File
9984 </p>
9985 !! end
9986
9987 !! test
9988 Namespace File {{ns:Image}}
9989 !! wikitext
9990 {{ns:Image}}
9991 !! html
9992 <p>File
9993 </p>
9994 !! end
9995
9996 !! test
9997 Namespace (lang=de) Benutzer {{ns:User}}
9998 !! options
9999 language=de
10000 !! wikitext
10001 {{ns:User}}
10002 !! html
10003 <p>Benutzer
10004 </p>
10005 !! end
10006
10007 !! test
10008 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10009 !! options
10010 language=de
10011 !! wikitext
10012 {{ns:3}}
10013 !! html
10014 <p>Benutzer Diskussion
10015 </p>
10016 !! end
10017
10018
10019 !! test
10020 Urlencode
10021 !! wikitext
10022 {{urlencode:hi world?!}}
10023 {{urlencode:hi world?!|WIKI}}
10024 {{urlencode:hi world?!|PATH}}
10025 {{urlencode:hi world?!|QUERY}}
10026 !! html
10027 <p>hi+world%3F%21
10028 hi_world%3F!
10029 hi%20world%3F%21
10030 hi+world%3F%21
10031 </p>
10032 !! end
10033
10034 !! test
10035 Magic Word: prioritize type info over data-parsoid
10036 !! options
10037 parsoid=html2wt
10038 !! html/parsoid
10039 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10040 !! wikitext
10041 __FORCETOC__
10042 !! end
10043
10044 !! test
10045 Magic Word: serialize on separate line (parsoid)
10046 !! options
10047 parsoid=wt2wt,html2wt
10048 !! wikitext
10049 foo
10050 __NOTOC__
10051 bar
10052 !! html/parsoid
10053 foo<meta property="mw:PageProp/notoc"/>bar
10054 !! end
10055
10056 !! test
10057 Magic Word: rt non-english wikis
10058 !! options
10059 parsoid=wt2wt
10060 language=de
10061 !! wikitext
10062 __NOEDITSECTION__
10063 !! html/parsoid
10064 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10065 !! end
10066
10067 !!test
10068 __proto__ is treated as normal wikitext (T105997)
10069 !!wikitext
10070 __proto__
10071 !!html
10072 <p>__proto__
10073 </p>
10074 !!end
10075
10076 ###
10077 ### Magic links
10078 ###
10079 !! test
10080 Magic links: internal link to RFC (bug 479)
10081 !! wikitext
10082 [[RFC 123]]
10083 !! html/php
10084 <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>
10085 </p>
10086 !! html/parsoid
10087 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10088 !! end
10089
10090 !! test
10091 Magic links: RFC (bug 479)
10092 !! wikitext
10093 RFC 822
10094 !! html/php
10095 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10096 </p>
10097 !! html/parsoid
10098 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10099 !! end
10100
10101 !! test
10102 Magic links: RFC (bug 65278)
10103 !! wikitext
10104 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10105 !! html/php
10106 <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.
10107 </p>
10108 !! html/parsoid
10109 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10110 !! end
10111
10112 !! test
10113 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10114 !! wikitext
10115 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10116 RFC
10117 822
10118 !! html/php
10119 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10120 RFC
10121 822
10122 </p>
10123 !! html/parsoid
10124 <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>
10125 RFC
10126 822</p>
10127 !! end
10128
10129 !! test
10130 Magic links: ISBN (bug 1937)
10131 !! wikitext
10132 ISBN 0-306-40615-2
10133 !! html/php
10134 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10135 </p>
10136 !! html/parsoid
10137 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10138 !! end
10139
10140 !! test
10141 Magic links: ISBN (bug 65278)
10142 !! wikitext
10143 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10144 !! html/php
10145 <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.
10146 </p>
10147 !! html/parsoid
10148 <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>
10149 !! end
10150
10151 !! test
10152 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10153 !! wikitext
10154 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10155 ISBN
10156 9780316098113
10157 ISBN 978
10158 0316098113
10159 !! html/php
10160 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10161 ISBN
10162 9780316098113
10163 ISBN 978
10164 0316098113
10165 </p>
10166 !! html/parsoid
10167 <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>
10168 ISBN
10169 9780316098113
10170 ISBN 978
10171 0316098113</p>
10172 !! end
10173
10174 !! test
10175 Magic links: PMID incorrectly converts space to underscore
10176 !! wikitext
10177 PMID 1234
10178 !! html/php
10179 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10180 </p>
10181 !! html/parsoid
10182 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10183 !! end
10184
10185 !! test
10186 Magic links: PMID (bug 65278)
10187 !! wikitext
10188 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10189 !! html/php
10190 <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.
10191 </p>
10192 !! html/parsoid
10193 <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>
10194 !! end
10195
10196 !! test
10197 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10198 !! wikitext
10199 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10200 PMID
10201 1234
10202 !! html/php
10203 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10204 PMID
10205 1234
10206 </p>
10207 !! html/parsoid
10208 <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>
10209 PMID
10210 1234</p>
10211 !! end
10212
10213 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10214 # since these are ExtLinkText, not MagicLinkText
10215 !! test
10216 Magic links: use appropriate serialization for "almost" magic links.
10217 !! wikitext
10218 X[[Special:BookSources/0978739256|foo]]
10219
10220 X[//tools.ietf.org/html/rfc1234 foo]
10221 !! html/php
10222 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10223 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10224 </p>
10225 !! html/parsoid
10226 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10227 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10228 !! end
10229
10230 ###
10231 ### Templates
10232 ####
10233
10234 !! test
10235 Nonexistent template
10236 !! wikitext
10237 {{thistemplatedoesnotexist}}
10238 !! html
10239 <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>
10240 </p>
10241 !! end
10242
10243 !! test
10244 Template with invalid target containing tags
10245 !! wikitext
10246 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10247 !! html
10248 <p>{{a<b>b</b>|foo|a=b|a = b}}
10249 </p>
10250 !! end
10251
10252 !! test
10253 Template with invalid target containing unclosed tag
10254 !! wikitext
10255 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10256 !! html
10257 <p>{{a<b>|foo|a=b|a = b}}</b>
10258 </p>
10259 !! end
10260
10261 !! test
10262 Template with invalid target containing wikilink
10263 !! wikitext
10264 {{[[Main Page]]}}
10265 !! html/php
10266 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10267 </p>
10268 !! html/parsoid
10269 <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>
10270 !! end
10271
10272 !! test
10273 Template with just whitespace in it, bug #68421
10274 !! wikitext
10275 {{echo|{{ }}}}
10276 !! html/parsoid
10277 <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>
10278 !! end
10279
10280 !! article
10281 Template:test
10282 !! text
10283 This is a test template
10284 !! endarticle
10285
10286 !! test
10287 Simple template
10288 !! wikitext
10289 {{test}}
10290 !! html
10291 <p>This is a test template
10292 </p>
10293 !! end
10294
10295 !! test
10296 Template with explicit namespace
10297 !! wikitext
10298 {{Template:test}}
10299 !! html
10300 <p>This is a test template
10301 </p>
10302 !! end
10303
10304
10305 !! article
10306 Template:paramtest
10307 !! text
10308 This is a test template with parameter {{{param}}}
10309 !! endarticle
10310
10311 !! test
10312 Template parameter
10313 !! wikitext
10314 {{paramtest|param=foo}}
10315 !! html
10316 <p>This is a test template with parameter foo
10317 </p>
10318 !! end
10319
10320 !! article
10321 Template:paramtestnum
10322 !! text
10323 [[{{{1}}}|{{{2}}}]]
10324 !! endarticle
10325
10326 !! test
10327 Template unnamed parameter
10328 !! wikitext
10329 {{paramtestnum|Main Page|the main page}}
10330 !! html
10331 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10332 </p>
10333 !! end
10334
10335 !! article
10336 Template:templatesimple
10337 !! text
10338 (test)
10339 !! endarticle
10340
10341 !! article
10342 Template:templateredirect
10343 !! text
10344 #redirect [[Template:templatesimple]]
10345 !! endarticle
10346
10347 !! article
10348 Template:templateasargtestnum
10349 !! text
10350 {{{{{1}}}}}
10351 !! endarticle
10352
10353 !! article
10354 Template:templateasargtest
10355 !! text
10356 {{template{{{templ}}}}}
10357 !! endarticle
10358
10359 !! article
10360 Template:templateasargtest2
10361 !! text
10362 {{{{{templ}}}}}
10363 !! endarticle
10364
10365 !! test
10366 Template with template name as unnamed argument
10367 !! wikitext
10368 {{templateasargtestnum|templatesimple}}
10369 !! html
10370 <p>(test)
10371 </p>
10372 !! end
10373
10374 !! test
10375 Template with template name as argument
10376 !! wikitext
10377 {{templateasargtest|templ=simple}}
10378 !! html
10379 <p>(test)
10380 </p>
10381 !! end
10382
10383 !! test
10384 Template with template name as argument (2)
10385 !! wikitext
10386 {{templateasargtest2|templ=templatesimple}}
10387 !! html
10388 <p>(test)
10389 </p>
10390 !! end
10391
10392 !! article
10393 Template:templateasargtestdefault
10394 !! text
10395 {{{{{templ|templatesimple}}}}}
10396 !! endarticle
10397
10398 !! article
10399 Template:templa
10400 !! text
10401 '''templ'''
10402 !! endarticle
10403
10404 !! test
10405 Template with default value
10406 !! wikitext
10407 {{templateasargtestdefault}}
10408 !! html
10409 <p>(test)
10410 </p>
10411 !! end
10412
10413 !! test
10414 Template with default value (value set)
10415 !! wikitext
10416 {{templateasargtestdefault|templ=templa}}
10417 !! html
10418 <p><b>templ</b>
10419 </p>
10420 !! end
10421
10422 !! test
10423 Template redirect
10424 !! wikitext
10425 {{templateredirect}}
10426 !! html/php
10427 <p>(test)
10428 </p>
10429 !! html/parsoid
10430 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10431 !! end
10432
10433 !! test
10434 Template with argument in separate line
10435 !! wikitext
10436 {{ templateasargtest |
10437 templ = simple }}
10438 !! html
10439 <p>(test)
10440 </p>
10441 !! end
10442
10443 !! test
10444 Template with complex template as argument
10445 !! wikitext
10446 {{paramtest|
10447 param ={{ templateasargtest |
10448 templ = simple }}}}
10449 !! html
10450 <p>This is a test template with parameter (test)
10451 </p>
10452 !! end
10453
10454 !! test
10455 Template with thumb image (with link in description)
10456 !! wikitext
10457 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10458 !! html/php
10459 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>
10460
10461 !! html+tidy
10462 <p>This is a test template with parameter</p>
10463 <div class="thumb tright">
10464 <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>
10465 <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>
10466 </div>
10467 </div>
10468 !! html/parsoid
10469 <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>
10470 !! end
10471
10472 !! article
10473 Template:complextemplate
10474 !! text
10475 {{{1}}} {{paramtest|
10476 param ={{{param}}}}}
10477 !! endarticle
10478
10479 !! test
10480 Template with complex arguments
10481 !! wikitext
10482 {{complextemplate|
10483 param ={{ templateasargtest |
10484 templ = simple }}|[[Template:complextemplate|link]]}}
10485 !! html
10486 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10487 </p>
10488 !! end
10489
10490 !! test
10491 BUG 553: link with two variables in a piped link
10492 !! wikitext
10493 {|
10494 |[[{{{1}}}|{{{2}}}]]
10495 |}
10496 !! html/php
10497 <table>
10498 <tr>
10499 <td>[[{{{1}}}|{{{2}}}]]
10500 </td></tr></table>
10501
10502 !! html/parsoid
10503 <table>
10504 <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>
10505 !! end
10506
10507 # See: T2553
10508 !! test
10509 Abort table cell attribute parsing on wikilink
10510 !! wikitext
10511 {|
10512 | testing [[one|two]] | three || four
10513 | testing one two | three || four
10514 | testing="[[one|two]]" | three || four
10515 |}
10516 !! html/php
10517 <table>
10518 <tr>
10519 <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>
10520 <td> four
10521 </td>
10522 <td> three </td>
10523 <td> four
10524 </td>
10525 <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>
10526 <td> four
10527 </td></tr></table>
10528
10529 !! html/parsoid
10530 <table>
10531 <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>
10532 <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>
10533 <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>
10534 </tbody></table>
10535 !! end
10536
10537 !! test
10538 Don't abort table cell attribute parsing if wikilink is found in template arg
10539 !! wikitext
10540 {|
10541 | Test {{#tag:ref|One two "[[three]]" four}}
10542 |}
10543 !! html/parsoid
10544 <table>
10545 <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>
10546 </tbody></table>
10547 !! end
10548
10549 !! test
10550 Magic variable as template parameter
10551 !! wikitext
10552 {{paramtest|param={{SITENAME}}}}
10553 !! html
10554 <p>This is a test template with parameter MediaWiki
10555 </p>
10556 !! end
10557
10558 !! article
10559 Template:linktest
10560 !! text
10561 [[{{{param}}}|link]]
10562 !! endarticle
10563
10564 !! test
10565 Template parameter as link source
10566 !! wikitext
10567 {{linktest|param=Main Page}}
10568 !! html
10569 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10570 </p>
10571 !! end
10572
10573 !!article
10574 Template:paramtest2
10575 !! text
10576 including another template, {{paramtest|param={{{arg}}}}}
10577 !! endarticle
10578
10579 !! test
10580 Template passing argument to another template
10581 !! wikitext
10582 {{paramtest2|arg='hmm'}}
10583 !! html
10584 <p>including another template, This is a test template with parameter 'hmm'
10585 </p>
10586 !! end
10587
10588 !! article
10589 Template:Linktest2
10590 !! text
10591 Main Page
10592 !! endarticle
10593
10594 !! test
10595 Template as link source
10596 !! wikitext
10597 [[{{linktest2}}]]
10598
10599 [[{{linktest2}}|Main Page]]
10600
10601 [[{{linktest2}}]]Page
10602 !! html
10603 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10604 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10605 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10606 </p>
10607 !! end
10608
10609
10610 !! article
10611 Template:loop1
10612 !! text
10613 {{loop2}}
10614 !! endarticle
10615
10616 !! article
10617 Template:loop2
10618 !! text
10619 {{loop1}}
10620 !! endarticle
10621
10622 !! test
10623 Template infinite loop
10624 !! wikitext
10625 {{loop1}}
10626 !! html
10627 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10628 </p>
10629 !! end
10630
10631 !! test
10632 Template from main namespace
10633 !! wikitext
10634 {{:Main Page}}
10635 !! html
10636 <p>blah blah
10637 </p>
10638 !! end
10639
10640 !! article
10641 Template:table
10642 !! text
10643 {|
10644 | 1 || 2
10645 |-
10646 | 3 || 4
10647 |}
10648 !! endarticle
10649
10650 !! test
10651 BUG 529: Template with table, not included at beginning of line
10652 !! wikitext
10653 foo {{table}}
10654 !! html
10655 <p>foo
10656 </p>
10657 <table>
10658 <tr>
10659 <td> 1 </td>
10660 <td> 2
10661 </td></tr>
10662 <tr>
10663 <td> 3 </td>
10664 <td> 4
10665 </td></tr></table>
10666
10667 !! end
10668
10669 !! test
10670 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10671 !! wikitext
10672 foo
10673 {{table}}
10674 !! html
10675 <p>foo
10676 </p>
10677 <table>
10678 <tr>
10679 <td> 1 </td>
10680 <td> 2
10681 </td></tr>
10682 <tr>
10683 <td> 3 </td>
10684 <td> 4
10685 </td></tr></table>
10686
10687 !! end
10688
10689 !! test
10690 BUG 41: Template parameters shown as broken links
10691 !! wikitext
10692 {{{parameter}}}
10693 !! html
10694 <p>{{{parameter}}}
10695 </p>
10696 !! end
10697
10698 !! test
10699 Template with targets containing wikilinks
10700 !! wikitext
10701 {{[[foo]]}}
10702
10703 {{[[{{echo|foo}}]]}}
10704
10705 {{{{echo|[[foo}}]]}}
10706 !! html
10707 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10708 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10709 </p><p>{{[[foo}}]]
10710 </p>
10711 !! end
10712
10713 !! article
10714 Template:''
10715 !! text
10716 bar
10717 !! endarticle
10718
10719 !! test
10720 Templates: Double quotes as template target
10721 !! wikitext
10722 foo {{''}} baz
10723 !! html/php
10724 <p>foo bar baz
10725 </p>
10726 !! html/parsoid
10727 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10728 </p>
10729 !! end
10730
10731 ## This test is about making sure Parsoid's data-mw is well formed in the
10732 ## face of multiple templates with intersecting and overlapping ranges. The
10733 ## wikitext itself is wretched.
10734 !! test
10735 Templates with intersecting and overlapping ranges
10736 !! wikitext
10737 {|{{echo|
10738 <p>ha</p>}}
10739 {|{{echo|
10740 <p>ho</p>}}
10741 {{echo|{{!}}hi}}
10742 |}
10743 !! html/php+tidy
10744 <p>ha</p>
10745 <p>ho</p>
10746 <table>
10747 <tr>
10748 <td></td>
10749 </tr>
10750 <tr>
10751 <td>hi</td>
10752 </tr>
10753 </table>
10754 <table>
10755 <tr>
10756 <td></td>
10757 </tr>
10758 </table>
10759 !! html/parsoid
10760 <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":""}]]}'>
10761
10762 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10763
10764 <tbody><tr><td>hi</td></tr>
10765 </tbody></table>
10766 !! end
10767
10768 !! article
10769 Template:MSGNW test
10770 !! text
10771 ''None'' of '''this''' should be
10772 * interpreted
10773 but rather passed unmodified
10774 {{test}}
10775 <gallery>
10776 File:Foobar.jpg
10777 </gallery>
10778 <!-- comment -->
10779 !! endarticle
10780
10781 # hmm, fix this or just deprecate msgnw and document its behavior?
10782 !! test
10783 msgnw keyword
10784 !! wikitext
10785 {{msgnw:MSGNW test}}
10786 !! html/php
10787 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10788 &#42; interpreted
10789 &#32;but rather passed unmodified
10790 &#123;&#123;test&#125;&#125;
10791 &#60;gallery&#62;
10792 File:Foobar.jpg
10793 &#60;/gallery&#62;
10794 &#60;!-- comment --&#62;
10795 </p>
10796 !! end
10797
10798 !! test
10799 int keyword
10800 !! wikitext
10801 {{int:youhavenewmessages|lots of money|not!}}
10802 !! html
10803 <p>You have lots of money (not!).
10804 </p>
10805 !! end
10806
10807 !! test
10808 int keyword - non-existing message
10809 !! wikitext
10810 {{int:var}}
10811 !! html
10812 <p>&lt;var&gt;
10813 </p>
10814 !! end
10815
10816 !! article
10817 Template:Includes
10818 !! text
10819 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10820 !! endarticle
10821
10822 !! test
10823 <includeonly> and <noinclude> being included
10824 !! wikitext
10825 {{Includes}}
10826 !! html
10827 <p>Foobar
10828 </p>
10829 !! end
10830
10831 !! article
10832 Template:Includes2
10833 !! text
10834 <onlyinclude>Foo</onlyinclude>bar
10835 !! endarticle
10836
10837 !! test
10838 <onlyinclude> being included
10839 !! wikitext
10840 {{Includes2}}
10841 !! html
10842 <p>Foo
10843 </p>
10844 !! end
10845
10846
10847 !! article
10848 Template:Includes3
10849 !! text
10850 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10851 !! endarticle
10852
10853 !! test
10854 <onlyinclude> and <includeonly> being included
10855 !! wikitext
10856 {{Includes3}}
10857 !! html
10858 <p>Foo
10859 </p>
10860 !! end
10861
10862 !! test
10863 <includeonly> and <noinclude> on a page
10864 !! wikitext
10865 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10866 !! html
10867 <p>Foozar
10868 </p>
10869 !! end
10870
10871 !! test
10872 Un-closed <noinclude>
10873 !! wikitext
10874 <noinclude>
10875 !! html
10876 !! end
10877
10878 !! test
10879 <onlyinclude> on a page
10880 !! wikitext
10881 <onlyinclude>Foo</onlyinclude>bar
10882 !! html
10883 <p>Foobar
10884 </p>
10885 !! end
10886
10887 !! test
10888 Un-closed <onlyinclude>
10889 !! wikitext
10890 <onlyinclude>
10891 !! html
10892 !! end
10893
10894 !!test
10895 Self-closed noinclude, includeonly, onlyinclude tags
10896 !! wikitext
10897 <noinclude />
10898 <includeonly />
10899 <onlyinclude />
10900 !! html
10901 <p><br />
10902 </p>
10903 !!end
10904
10905 !!test
10906 Unbalanced includeonly and noinclude tags
10907 !! wikitext
10908 {|
10909 |a</noinclude>
10910 |b</noinclude></noinclude>
10911 |c</noinclude></includeonly>
10912 |d</includeonly></includeonly>
10913 |}
10914 !! html
10915 <table>
10916 <tr>
10917 <td>a
10918 </td>
10919 <td>b
10920 </td>
10921 <td>c&lt;/includeonly&gt;
10922 </td>
10923 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10924 </td></tr></table>
10925
10926 !!end
10927
10928 !! article
10929 Template:Includeonly section
10930 !! text
10931 <includeonly>
10932 ==Includeonly section==
10933 </includeonly>
10934 ==Section T-1==
10935 !!endarticle
10936
10937 !! test
10938 Bug 6563: Edit link generation for section shown by <includeonly>
10939 !! wikitext
10940 {{includeonly section}}
10941 !! html
10942 <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>
10943 <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>
10944
10945 !! end
10946
10947 # Uses same input as the contents of [[Template:Includeonly section]]
10948 !! test
10949 Bug 6563: Section extraction for section shown by <includeonly>
10950 !! options
10951 section=T-2
10952 !! wikitext
10953 <includeonly>
10954 ==Includeonly section==
10955 </includeonly>
10956 ==Section T-2==
10957 !! html
10958 ==Section T-2==
10959 !! end
10960
10961 !! test
10962 Bug 6563: Edit link generation for section suppressed by <includeonly>
10963 !! wikitext
10964 <includeonly>
10965 ==Includeonly section==
10966 </includeonly>
10967 ==Section 1==
10968 !! html
10969 <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>
10970
10971 !! end
10972
10973 !! test
10974 Bug 6563: Section extraction for section suppressed by <includeonly>
10975 !! options
10976 section=1
10977 !! wikitext
10978 <includeonly>
10979 ==Includeonly section==
10980 </includeonly>
10981 ==Section 1==
10982 !! html
10983 ==Section 1==
10984 !! end
10985
10986 !! test
10987 Un-closed <includeonly>
10988 !! wikitext
10989 <includeonly>
10990 !! html/php
10991 !! html/parsoid
10992 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
10993 !! end
10994
10995 ## We used to, but no longer wt2wt this test since the default serializer
10996 ## will normalize the include directives to serialize on their own line.
10997 ## Selser will take care of preserving formatting in scenarios where they
10998 ## intermingled with other wikitext.
10999 !! test
11000 Includes and comments at SOL
11001 !! options
11002 parsoid=wt2html,html2html
11003 !! wikitext
11004 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11005
11006 <noinclude>
11007 some
11008 </noinclude>* stuff
11009 * here
11010
11011 <includeonly>can have stuff</includeonly>=== here ===
11012
11013 !! html/php
11014 <h2><span class="mw-headline" id="hu">hu</span></h2>
11015 <p>some
11016 </p>
11017 <ul><li> stuff</li>
11018 <li> here</li></ul>
11019 <h3><span class="mw-headline" id="here">here</span></h3>
11020
11021 !! html/parsoid
11022 <!-- 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>
11023
11024 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11025 <p>some</p>
11026 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11027 <li> here</li></ul>
11028
11029 <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>
11030
11031 !! end
11032
11033 # TODO: test with DOM fragment reuse!
11034 !! test
11035 Parsoid: DOM fragment reuse
11036 !! options
11037 parsoid=wt2wt,wt2html
11038 !! wikitext
11039 a{{echo|b<table></table>c}}d
11040
11041 a{{echo|b
11042 <table></table>
11043 c}}d
11044
11045 {{echo|a
11046
11047 <table></table>
11048
11049 b}}
11050 !! html
11051 <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>
11052
11053 <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">
11054 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11055 </span><p about="#mwt2">cd</p>
11056
11057 <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">
11058
11059 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11060
11061 </span><p about="#mwt3">b</p>
11062 !! end
11063
11064 !! test
11065 Parsoid: Merge double tds (T52603)
11066 !! options
11067 parsoid
11068 !! wikitext
11069 {|
11070 |{{echo|{{!}} foo}}
11071 |}
11072 !! html
11073 <table><tbody>
11074 <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>
11075 </tbody></table>
11076 !! end
11077
11078 !! test
11079 Parsoid: Merge double tds in nested transclusion content (T52603)
11080 !! options
11081 parsoid
11082 !! wikitext
11083 {{echo|<div>}}
11084 {|
11085 |{{echo|{{!}} foo}}
11086 |}
11087 {{echo|</div>}}
11088 !! html
11089 <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}}]}'>
11090 <table><tbody>
11091 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11092 </tbody></table>
11093 </div>
11094 !! end
11095
11096 ###
11097 ### <includeonly> and <noinclude> in attributes
11098 ###
11099 !!test
11100 0. includeonly around the entire attribute
11101 !! wikitext
11102 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11103 !! html
11104 <p><span id="v2">bar</span>
11105 </p>
11106 !!end
11107
11108 !!test
11109 1. includeonly in html attr key
11110 !! wikitext
11111 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11112 !! html
11113 <p><span id="foo">bar</span>
11114 </p>
11115 !!end
11116
11117 !!test
11118 2. includeonly in html attr value
11119 !! wikitext
11120 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11121 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11122 !! html
11123 <p><span id="v1">bar</span>
11124 <span id="v1">bar</span>
11125 </p>
11126 !!end
11127
11128 !!test
11129 3. includeonly in part of an attr value
11130 !! wikitext
11131 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11132 !! html
11133 <p><span style="color:red;">bar</span>
11134 </p>
11135 !!end
11136
11137 !!test
11138 4. includeonly in table attributes
11139 !! wikitext
11140 {|
11141 |- <noinclude>
11142 |-
11143 |a
11144 </noinclude>
11145 |- <includeonly>
11146 |-
11147 |b
11148 </includeonly>
11149 |}
11150 !! html
11151 <table>
11152
11153
11154 <tr>
11155 <td>a
11156 </td></tr>
11157 </table>
11158
11159 !!end
11160
11161 ###
11162 ### Token Stream Patcher tests
11163 ###
11164 ### These tests won't always pass wt2wt and other modes because
11165 ### on serialization, the table will be output on a new line.
11166 ### For now, we are blacklisting them, and using this to test selser.
11167 ###
11168
11169 !!test
11170 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11171 !!options
11172 parsoid=wt2html,wt2wt
11173 !!wikitext
11174 {{echo|}}{| width = '100%'
11175 |foo
11176 |}
11177 !!html/parsoid
11178 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11179 <tbody><tr><td>foo</td></tr>
11180 </tbody></table>
11181 !!end
11182
11183 ## We used to, but no longer wt2wt this test since the default serializer
11184 ## will normalize the include directives to serialize on their own line.
11185 ## Selser will take care of preserving formatting in scenarios where they
11186 ## intermingled with other wikitext.
11187 !!test
11188 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11189 !!options
11190 parsoid=wt2html
11191 !!wikitext
11192 <includeonly>a</includeonly>{| {{{b}}}
11193 |c
11194 |}
11195 !!html/parsoid
11196 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
11197 <tbody><tr><td>c</td></tr>
11198 </tbody></table>
11199
11200 !!end
11201
11202 ###
11203 ### Testing parsing of templates where a template arg
11204 ### has the same name as the template itself.
11205 ###
11206
11207 !! article
11208 Template:quote
11209 !! text
11210 {{{quote|{{{1}}}}}}
11211 !! endarticle
11212
11213 !!test
11214 Templates: Template Name/Arg clash: 1. Use of positional param
11215 !! wikitext
11216 {{quote|foo}}
11217 !! html
11218 <p>foo
11219 </p>
11220 !!end
11221
11222 !!test
11223 Templates: Template Name/Arg clash: 2. Use of named param
11224 !! wikitext
11225 {{quote|quote=foo}}
11226 !! html
11227 <p>foo
11228 </p>
11229 !!end
11230
11231 !!test
11232 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11233 !! wikitext
11234 {{quote|quote}}
11235 !! html
11236 <p>quote
11237 </p>
11238 !!end
11239
11240 ###
11241 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11242 ###
11243
11244 !!test
11245 Templates: 1. Simple use
11246 !! wikitext
11247 {{echo|Foo}}
11248 !! html
11249 <p>Foo
11250 </p>
11251 !!end
11252
11253 !!test
11254 Templates: 2. Inside a block tag
11255 !! wikitext
11256 <div>{{echo|Foo}}</div>
11257 <blockquote>{{echo|Foo}}</blockquote>
11258 !! html
11259 <div>Foo</div>
11260 <blockquote>Foo</blockquote>
11261
11262 !! html+tidy
11263 <div>Foo</div>
11264 <blockquote>
11265 <p>Foo</p>
11266 </blockquote>
11267 !!end
11268
11269 !!test
11270 Templates: P-wrapping: 1a. Templates on consecutive lines
11271 !! wikitext
11272 {{echo|Foo}}
11273 {{echo|bar}}
11274 !! html
11275 <p>Foo
11276 bar
11277 </p>
11278 !!end
11279
11280 !!test
11281 Templates: P-wrapping: 1b. Templates on consecutive lines
11282 !! wikitext
11283 Foo
11284
11285 {{echo|bar}}
11286 {{echo|baz}}
11287 !! html
11288 <p>Foo
11289 </p><p>bar
11290 baz
11291 </p>
11292 !!end
11293
11294 !!test
11295 Templates: P-wrapping: 1c. Templates on consecutive lines
11296 !! wikitext
11297 {{echo|Foo}}
11298 {{echo|bar}} <div>baz</div>
11299 !! html
11300 <p>Foo
11301 </p>
11302 bar <div>baz</div>
11303
11304 !! html+tidy
11305 <p>Foo</p>
11306 <p>bar</p>
11307 <div>baz</div>
11308 !! end
11309
11310 !!test
11311 Templates: P-wrapping: 1d. Template preceded by comment-only line
11312 !!options
11313 parsoid
11314 !! wikitext
11315 <!-- foo -->
11316 {{echo|Bar}}
11317 !! html
11318 <!-- foo -->
11319
11320 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11321 !!end
11322
11323 !!test
11324 Templates: Inline Text: 1. Multiple template uses
11325 !! wikitext
11326 {{echo|Foo}}bar{{echo|baz}}
11327 !! html
11328 <p>Foobarbaz
11329 </p>
11330 !!end
11331
11332 !!test
11333 Templates: Inline Text: 2. Back-to-back template uses
11334 !! wikitext
11335 {{echo|Foo}}{{echo|bar}}
11336 !! html
11337 <p>Foobar
11338 </p>
11339 !!end
11340
11341 !!test
11342 Templates: Block Tags: 1. Multiple template uses
11343 !! wikitext
11344 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11345 !! html
11346 <div>Foo</div><div>bar</div><div>baz</div>
11347
11348 !!end
11349
11350 !!test
11351 Templates: Block Tags: 2. Back-to-back template uses
11352 !! wikitext
11353 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11354 !! html
11355 <div>Foo</div><div>bar</div>
11356
11357 !!end
11358
11359 # This is an edge case relating to paragraph wrapping.
11360 !!test
11361 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11362 !! wikitext
11363 {{echo|a
11364 b</p>}}
11365 !! html/parsoid
11366 <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
11367 b</p>
11368 !!end
11369
11370 !!test
11371 Templates: Links: 1. Simple example
11372 !! wikitext
11373 {{echo|[[Foo|bar]]}}
11374 !! html
11375 <p><a href="/wiki/Foo" title="Foo">bar</a>
11376 </p>
11377 !!end
11378
11379 !!test
11380 Templates: Links: 2. Generation of link href
11381 !! wikitext
11382 [[{{echo|Foo}}|bar]]
11383 !! html
11384 <p><a href="/wiki/Foo" title="Foo">bar</a>
11385 </p>
11386 !!end
11387
11388 !!test
11389 Templates: Links: 3. Generation of part of a link href
11390 !! wikitext
11391 [[Fo{{echo|o}}|bar]]
11392
11393 [[Foo{{echo|bar}}]]
11394
11395 [[Foo{{echo|bar}}baz]]
11396
11397 [[Foo{{echo|bar}}|bar]]
11398
11399 [[:Foo{{echo|bar}}]]
11400
11401 [[:Foo{{echo|bar}}|bar]]
11402 !! html
11403 <p><a href="/wiki/Foo" title="Foo">bar</a>
11404 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11405 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11406 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11407 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11408 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11409 </p>
11410 !!end
11411
11412 !!test
11413 Templates: Links: 4. Multiple templates generating link href
11414 !! wikitext
11415 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11416 !! html
11417 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11418 </p>
11419 !!end
11420
11421 !!test
11422 Templates: Links: 5. Generation of link text
11423 !! wikitext
11424 [[Foo|{{echo|bar}}]]
11425 !! html
11426 <p><a href="/wiki/Foo" title="Foo">bar</a>
11427 </p>
11428 !!end
11429
11430 !!test
11431 Templates: Links: 5. Nested templates (only outermost template should be marked)
11432 !! wikitext
11433 {{echo|[[{{echo|Foo}}|bar]]}}
11434 !! html
11435 <p><a href="/wiki/Foo" title="Foo">bar</a>
11436 </p>
11437 !!end
11438
11439 !!test
11440 Templates: HTML Tag: 1. Generation of HTML attr. key
11441 !! wikitext
11442 <div {{echo|style}}="color:red;">foo</div>
11443 !! html
11444 <div style="color:red;">foo</div>
11445
11446 !!end
11447
11448 !!test
11449 Templates: HTML Tag: 2. Generation of HTML attr. value
11450 !! wikitext
11451 <div style={{echo|'color:red;'}}>foo</div>
11452 !! html
11453 <div style="color:red;">foo</div>
11454
11455 !!end
11456
11457 !!test
11458 Templates: HTML Tag: 3. Generation of HTML attr key and value
11459 !! wikitext
11460 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11461 !! html
11462 <div style="color:red;">foo</div>
11463
11464 !!end
11465
11466 !!test
11467 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11468 !! wikitext
11469 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11470 !! html
11471 <div title="This is a long title with just one piece templated">foo</div>
11472
11473 !!end
11474
11475 !!test
11476 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11477 !! wikitext
11478 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11479 !! html
11480 <div title="This is a long title with just one piece templated">foo</div>
11481
11482 !!end
11483
11484 !!test
11485 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11486 !! wikitext
11487 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11488 !! html
11489 <div title="This is a long title with just one piece templated">foo</div>
11490
11491 !!end
11492
11493 # SSS FIXME: While it is great we added support for all this,
11494 # do we want to make this part of the spec? Maybe we want to
11495 # deprecate this kind of usage in the future?
11496 !!test
11497 Templates: HTML Tag: 7. Generation of partial attribute key string
11498 !! wikitext
11499 <div st{{echo|yle}}="color:red;">foo</div>
11500 !! html
11501 <div style="color:red;">foo</div>
11502
11503 !!end
11504
11505 !! test
11506 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11507 !! wikitext
11508 <div {{echo|1=id="v1"}}>bar</div>
11509 !! html
11510 <div id="v1">bar</div>
11511
11512 !!end
11513
11514 !! test
11515 Templates: HTML Tag: 9. Multiple template-generated attributes
11516 !! wikitext
11517 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11518 !! html
11519 <div id="v1" title="foo">bar</div>
11520
11521 !!end
11522
11523 !! test
11524 Templates: Support for templates generating attributes and content
11525 !! wikitext
11526 {| {{mixed_attr_content_template}}
11527 |-
11528 |bar
11529 |}
11530 !! html/php
11531 <table style="color:red;" title="T48811">
11532
11533 <tr>
11534 <td>foo
11535 </td></tr>
11536 <tr>
11537 <td>bar
11538 </td></tr></table>
11539
11540 !! html/parsoid
11541 <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|}"]}'>
11542 <tbody><tr>
11543 <td>foo</td></tr>
11544 <tr>
11545 <td>bar</td></tr>
11546 </tbody></table>
11547 !!end
11548
11549 !! test
11550 1. Entities and nowikis inside templated attributes should be handled correctly
11551 !! wikitext
11552 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11553 !! html/php
11554 <div style="background:#f9f9f9;">foo</div>
11555
11556 !! html/parsoid
11557 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11558 !! end
11559
11560 !! test
11561 2. Entities and nowikis inside templated attributes should be handled correctly
11562 !! wikitext
11563 {|
11564 |{{table_attribs_3}}
11565 |}
11566 !! html/php
11567 <table>
11568 <tr>
11569 <td style="background:#f9f9f9;">Foo
11570 </td></tr></table>
11571
11572 !! html/parsoid
11573 <table>
11574 <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>
11575 </tbody></table>
11576 !! end
11577
11578 !! test
11579 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11580 !! wikitext
11581 {{tbl-start}}
11582 |{{table_attribs_3}}
11583 {{tbl-end}}
11584 !! html/php
11585 <table>
11586 <tr>
11587 <td style="background:#f9f9f9;">Foo
11588 </td></tr></table>
11589
11590 !! html/parsoid
11591 <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}}]}'>
11592 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11593 </tbody></table>
11594 !! end
11595
11596 # T107622
11597 !! test
11598 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11599 !! wikitext
11600 {|
11601 | {{table_attribs_6}} hi
11602 |}
11603 !! html/php
11604 <table>
11605 <tr>
11606 <td style="background: red;"> hi
11607 </td></tr></table>
11608
11609 !! html/parsoid
11610 <table>
11611 <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>
11612 </tbody></table>
11613 !! end
11614
11615 !!test
11616 Templates: HTML Tables: 1. Generating start of a HTML table
11617 !! wikitext
11618 {{echo|<table><tr><td>foo</td>}}</tr></table>
11619 !! html
11620 <table><tr><td>foo</td></tr></table>
11621
11622 !!end
11623
11624 !!test
11625 Templates: HTML Tables: 2a. Generating middle of a HTML table
11626 !! wikitext
11627 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11628 !! html
11629 <table><tr><td>foo</td></tr></table>
11630
11631 !!end
11632
11633 !!test
11634 Templates: HTML Tables: 2b. Generating middle of a HTML table
11635 !! wikitext
11636 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11637 !! html
11638 <table><tr><td>foo</td></tr></table>
11639
11640 !!end
11641
11642 !!test
11643 Templates: HTML Tables: 3. Generating end of a HTML table
11644 !! wikitext
11645 <table><tr>{{echo|<td>foo</td></tr></table>}}
11646 !! html
11647 <table><tr><td>foo</td></tr></table>
11648
11649 !!end
11650
11651 !!test
11652 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11653 !! wikitext
11654 {{echo|<table>}}<tr><td>foo</td></tr></table>
11655 !! html
11656 <table><tr><td>foo</td></tr></table>
11657
11658 !!end
11659
11660 !!test
11661 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11662 !! wikitext
11663 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11664 !! html
11665 <table><tr><td>foo</td></tr></table>
11666
11667 !!end
11668
11669 !!test
11670 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11671 !! wikitext
11672 <table><tr>{{echo|<td>}}foo</td></tr></table>
11673 !! html
11674 <table><tr><td>foo</td></tr></table>
11675
11676 !!end
11677
11678 !!test
11679 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11680 !! wikitext
11681 <table><tr><td>foo{{echo|</td>}}</tr></table>
11682 !! html
11683 <table><tr><td>foo</td></tr></table>
11684
11685 !!end
11686
11687 !!test
11688 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11689 !! wikitext
11690 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11691 !! html
11692 <table><tr><td>foo</td></tr></table>
11693
11694 !!end
11695
11696 !!test
11697 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11698 !! wikitext
11699 <table><tr><td>foo</td></tr>{{echo|</table>}}
11700 !! html
11701 <table><tr><td>foo</td></tr></table>
11702
11703 !!end
11704
11705 !!test
11706 Templates: HTML Tables: 5. Proper fostering of categories from inside
11707 !!options
11708 parsoid=wt2html,wt2wt
11709 !! wikitext
11710 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11711 <!--Two categories (Bug 50330)-->
11712 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11713 !! html
11714 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11715 <!--Two categories (Bug 50330)-->
11716 <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>
11717 !!end
11718
11719 !!test
11720 Templates: Wiki Tables: 1a. Fostering of entire template content
11721 !! wikitext
11722 {|
11723 {{echo|a}}
11724 |}
11725 !! html
11726 <table>
11727 a
11728 <tr><td></td></tr></table>
11729
11730 !! html+tidy
11731 <p>a</p>
11732 <table>
11733 <tr>
11734 <td></td>
11735 </tr>
11736 </table>
11737 !! end
11738
11739 !!test
11740 Templates: Wiki Tables: 1b. Fostering of entire template content
11741 !! wikitext
11742 {|
11743 {{echo|<div>}}
11744 foo
11745 {{echo|</div>}}
11746 |}
11747 !! html
11748 <table>
11749 <div>
11750 <p>foo
11751 </p>
11752 </div>
11753 <tr><td></td></tr></table>
11754
11755 !! html+tidy
11756 <div>
11757 <p>foo</p>
11758 </div>
11759 <table>
11760 <tr>
11761 <td></td>
11762 </tr>
11763 </table>
11764 !! end
11765
11766 !!test
11767 Templates: Wiki Tables: 2. Fostering of partial template content
11768 !! wikitext
11769 {|
11770 {{echo|a
11771 <div>b</div>}}
11772 |}
11773 !! html
11774 <table>
11775 a
11776 <div>b</div>
11777 <tr><td></td></tr></table>
11778
11779 !! html+tidy
11780 <p>a</p>
11781 <div>b</div>
11782 <table>
11783 <tr>
11784 <td></td>
11785 </tr>
11786 </table>
11787 !! end
11788
11789 !!test
11790 Templates: Wiki Tables: 3. td-content via multiple templates
11791 !! wikitext
11792 {|
11793 {{echo|{{pipe}}a}}{{echo|b}}
11794 |}
11795 !! html
11796 <table>
11797 <tr>
11798 <td>ab
11799 </td></tr></table>
11800
11801 !!end
11802
11803 !!test
11804 Templates: Wiki Tables: 4. Templated tags, no content
11805 !! wikitext
11806 {{tbl-start}}
11807 {{tbl-end}}
11808 !! html
11809 <table>
11810 <tr><td></td></tr></table>
11811
11812 !!end
11813
11814 !!test
11815 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11816 !! wikitext
11817 {{tbl-start}}
11818 |foo
11819 {{tbl-end}}
11820 !! html
11821 <table>
11822 <tr>
11823 <td>foo
11824 </td></tr></table>
11825
11826 !!end
11827
11828 !!test
11829 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11830 !! wikitext
11831 {{tbl-start}}
11832 {{!}}foo
11833 {{tbl-end}}
11834 !! html
11835 <table>
11836 <tr>
11837 <td>foo
11838 </td></tr></table>
11839
11840 !!end
11841
11842 ## This test case is very specific to Parsoid's internals
11843 ## and is hence only tested for Parsoid's code. Parsoid uses
11844 ## a <meta> marker tag for <ref> tags and they are expanded
11845 ## much later. We are verifying that this <meta> tag usage
11846 ## doesn't prevent foster parenting.
11847 !!test
11848 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11849 !!wikitext
11850 {{PartialTable}}<ref>foo</ref>
11851 |}
11852
11853 <references />
11854 !!html/parsoid
11855 <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">
11856 <tbody>
11857 </tbody></table>
11858
11859 <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>
11860 !!end
11861
11862 !! test
11863 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11864 !! wikitext
11865 {{echo|
11866 {{{!}}
11867 {{!}}-}}
11868 <onlyinclude>
11869 |foo
11870 </onlyinclude>
11871 {{!}}}
11872 !! html/parsoid
11873 <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{{!}}}"]}'>
11874 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11875 <tbody><tr>
11876
11877 <td>foo
11878 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11879 </tbody></table>
11880 !! end
11881
11882 !!test
11883 Templates: Lists: Multi-line list-items via templates
11884 !! wikitext
11885 *{{echo|a {{nonexistent|
11886 unused}}}}
11887 *{{echo|b {{nonexistent|
11888 unused}}}}
11889 !! html
11890 <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>
11891 <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>
11892
11893 !!end
11894
11895 !!test
11896 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11897 !! wikitext
11898 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11899 !! html
11900 <p><i>ab</i>c<i>d</i>e
11901 </p>
11902 !!end
11903
11904 !!test
11905 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11906 (PHP parser generates misnested html)
11907 !! wikitext
11908 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11909 !! html/parsoid
11910 <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>
11911 !!end
11912
11913 !!test
11914 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11915 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11916 !! options
11917 parsoid=wt2html,wt2wt
11918 !! wikitext
11919 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11920 !! html
11921 <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>
11922 <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>
11923 <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>
11924 !!end
11925
11926 !!test
11927 Templates: Ugly nesting: 4. Divs opened/closed across templates
11928 !! wikitext
11929 a<div>b{{echo|c</div>d}}e
11930 !! html
11931 a<div>bc</div>de
11932
11933 !! html+tidy
11934 <p>a</p>
11935 <div>bc</div>
11936 <p>de</p>
11937 !! end
11938
11939 !!test
11940 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11941 (Parsoid-centric)
11942 !! options
11943 parsoid
11944 !! wikitext
11945 {|
11946 |{{echo|foo</table>}}
11947 |bar
11948 |}
11949 !! html
11950 <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|}"]}'>
11951
11952 <tbody>
11953 <tr>
11954 <td>foo</td></tr></tbody></table><span about="#mwt1">
11955 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11956 |}</span>
11957 !!end
11958
11959 !!test
11960 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11961 (Parsoid-centric)
11962 !! options
11963 parsoid
11964 !! wikitext
11965 <table>
11966 <tr>
11967 <td>
11968 <table>
11969 <tr>
11970 <td>1. {{echo|foo </table>}}</td>
11971 <td> bar </td>
11972 <td>2. {{echo|baz </table>}}</td>
11973 </tr>
11974 <tr>
11975 <td>abc</td>
11976 </tr>
11977 </table>
11978 </td>
11979 </tr>
11980 <tr>
11981 <td>xyz</td>
11982 </tr>
11983 </table>
11984 !! html
11985 <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>"]}'>
11986 <tbody><tr>
11987 <td>
11988 <table>
11989 <tbody><tr>
11990 <td>1. foo </td></tr></tbody></table></td>
11991 <td> bar </td>
11992 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11993 </span><span about="#mwt2">
11994 </span><span about="#mwt2">
11995 </span><span about="#mwt2">abc</span><span about="#mwt2">
11996 </span><span about="#mwt2">
11997 </span><span about="#mwt2">
11998 </span><span about="#mwt2">
11999 </span><span about="#mwt2">
12000 </span><span about="#mwt2">
12001 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12002 </span><span about="#mwt2">
12003 </span>
12004 !!end
12005
12006 !! test
12007 Templates: Ugly templates: 3. newline-only template parameter
12008 !! wikitext
12009 foo {{echo|
12010 }}
12011 !! html
12012 <p>foo
12013 </p>
12014 !! end
12015
12016 # This looks like a bug: a single newline triggers p/br for some reason.
12017 !! test
12018 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12019 !! wikitext
12020 {{echo|
12021 }}
12022 !! html
12023 <p><br />
12024 </p>
12025 !! end
12026
12027 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12028 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12029 !! test
12030 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12031 !! wikitext
12032 {{echo|<table>}}
12033 {{echo|<div>foo}}
12034 {{echo|</table>}}
12035 !! html/parsoid
12036 <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
12037 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12038 </table>
12039 !! end
12040
12041 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12042 # that are "identical" and generate nesting cycles in the algorithm
12043 !! test
12044 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12045 !! wikitext
12046 {{echo|<table><tr><td><table>}}
12047 {{echo|<div>}}
12048 {{echo|</div>}}
12049 !! html/parsoid
12050 <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"}'>
12051 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12052 </table></td></tr></tbody></table>
12053 !! end
12054
12055 !! test
12056 Templates: Parameters substituted at the top-level
12057 !! wikitext
12058 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12059 !! html/php
12060 <p><i>who</i> me? <b>never!</b>
12061 </p>
12062 !! html/parsoid
12063 <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>
12064 !! end
12065
12066 !!test
12067 Parser Functions: 1. Simple example
12068 !! wikitext
12069 {{uc:foo}}
12070 !! html
12071 <p>FOO
12072 </p>
12073 !!end
12074
12075 !!test
12076 Parser Functions: 2. Nested use (only outermost should be marked up)
12077 !! wikitext
12078 {{uc:{{lc:FOO}}}}
12079 !! html
12080 <p>FOO
12081 </p>
12082 !!end
12083
12084 ###
12085 ### Pre-save transform tests
12086 ###
12087 !! test
12088 pre-save transform: subst:
12089 !! options
12090 pst
12091 !! wikitext
12092 {{subst:test}}
12093 !! html/php
12094 This is a test template
12095 !! end
12096
12097 !! test
12098 pre-save transform: normal template
12099 !! options
12100 pst
12101 !! wikitext
12102 {{test}}
12103 !! html/php
12104 {{test}}
12105 !! end
12106
12107 !! test
12108 pre-save transform: nonexistent template
12109 !! options
12110 pst
12111 !! wikitext
12112 {{thistemplatedoesnotexist}}
12113 !! html/php
12114 {{thistemplatedoesnotexist}}
12115 !! end
12116
12117 !! test
12118 pre-save transform: subst magic variables
12119 !! options
12120 pst
12121 !! wikitext
12122 {{subst:SITENAME}}
12123 !! html/php
12124 MediaWiki
12125 !! end
12126
12127 # This is bug 89, which I fixed. -- wtm
12128 !! test
12129 pre-save transform: subst: templates with parameters
12130 !! options
12131 pst
12132 !! wikitext
12133 {{subst:paramtest|param="something else"}}
12134 !! html/php
12135 This is a test template with parameter "something else"
12136 !! end
12137
12138 !! article
12139 Template:nowikitest
12140 !! text
12141 <nowiki>'''not wiki'''</nowiki>
12142 !! endarticle
12143
12144 !! test
12145 pre-save transform: nowiki in subst (bug 1188)
12146 !! options
12147 pst
12148 !! wikitext
12149 {{subst:nowikitest}}
12150 !! html/php
12151 <nowiki>'''not wiki'''</nowiki>
12152 !! end
12153
12154 !! article
12155 Template:commenttest
12156 !! text
12157 This template has <!-- a comment --> in it.
12158 !! endarticle
12159
12160 !! test
12161 pre-save transform: comment in subst (bug 1936)
12162 !! options
12163 pst
12164 !! wikitext
12165 {{subst:commenttest}}
12166 !! html/php
12167 This template has <!-- a comment --> in it.
12168 !! end
12169
12170 !! test
12171 pre-save transform: unclosed tag
12172 !! options
12173 pst
12174 !! wikitext
12175 <nowiki>'''not wiki'''
12176 !! html/php
12177 <nowiki>'''not wiki'''
12178 !! end
12179
12180 !! test
12181 pre-save transform: mixed tag case
12182 !! options
12183 pst
12184 !! wikitext
12185 <NOwiki>'''not wiki'''</noWIKI>
12186 !! html/php
12187 <NOwiki>'''not wiki'''</noWIKI>
12188 !! end
12189
12190 !! test
12191 pre-save transform: unclosed comment in <nowiki>
12192 !! options
12193 pst
12194 !! wikitext
12195 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12196 !! html/php
12197 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12198 !!end
12199
12200 # Leading @ in this template definition works around a limitation
12201 # in parsoid's parserTests which otherwise strips the <span> from the
12202 # result (confusing it for a template wrapper)
12203 !! article
12204 Template:dangerous
12205 !!text
12206 @<span onmouseover="alert('crap')">Oh no</span>
12207 !!endarticle
12208
12209 !!test
12210 (confirming safety of fix for subst bug 1936)
12211 !! wikitext
12212 {{Template:dangerous}}
12213 !! html
12214 <p>@<span>Oh no</span>
12215 </p>
12216 !! end
12217
12218 !! test
12219 pre-save transform: comment containing gallery (bug 5024)
12220 !! options
12221 pst
12222 !! wikitext
12223 <!-- <gallery>data</gallery> -->
12224 !! html/php
12225 <!-- <gallery>data</gallery> -->
12226 !!end
12227
12228 !! test
12229 pre-save transform: comment containing extension
12230 !! options
12231 pst
12232 !! wikitext
12233 <!-- <tag>data</tag> -->
12234 !! html/php
12235 <!-- <tag>data</tag> -->
12236 !!end
12237
12238 !! test
12239 pre-save transform: comment containing nowiki
12240 !! options
12241 pst
12242 !! wikitext
12243 <!-- <nowiki>data</nowiki> -->
12244 !! html/php
12245 <!-- <nowiki>data</nowiki> -->
12246 !!end
12247
12248 !! test
12249 pre-save transform: <noinclude> in subst (bug 3298)
12250 !! options
12251 pst
12252 !! wikitext
12253 {{subst:Includes}}
12254 !! html/php
12255 Foobar
12256 !! end
12257
12258 !! test
12259 pre-save transform: <onlyinclude> in subst (bug 3298)
12260 !! options
12261 pst
12262 !! wikitext
12263 {{subst:Includes2}}
12264 !! html/php
12265 Foo
12266 !! end
12267
12268 !! article
12269 Template:SubstTest
12270 !!text
12271 {{<includeonly>subst:</includeonly>Includes}}
12272 !! endarticle
12273
12274 !! article
12275 Template:SafeSubstTest
12276 !! text
12277 {{<includeonly>safesubst:</includeonly>Includes}}
12278 !! endarticle
12279
12280 !! test
12281 bug 22297: safesubst: works during PST
12282 !! options
12283 pst
12284 !! wikitext
12285 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12286 !! html/php
12287 FoobarFoobar
12288 !! end
12289
12290 !! test
12291 bug 22297: safesubst: works during normal parse
12292 !! wikitext
12293 {{SafeSubstTest}}
12294 !! html
12295 <p>Foobar
12296 </p>
12297 !! end
12298
12299 !! test
12300 subst: does not work during normal parse
12301 !! wikitext
12302 {{SubstTest}}
12303 !! html
12304 <p>{{subst:Includes}}
12305 </p>
12306 !! end
12307
12308 !! test
12309 pre-save transform: context links ("pipe trick")
12310 !! options
12311 pst
12312 !! wikitext
12313 [[Article (context)|]]
12314 [[Bar:Article|]]
12315 [[:Bar:Article|]]
12316 [[Bar:Article (context)|]]
12317 [[:Bar:Article (context)|]]
12318 [[|Article]]
12319 [[|Article (context)]]
12320 [[Bar:X (Y) Z|]]
12321 [[:Bar:X (Y) Z|]]
12322 !! html/php
12323 [[Article (context)|Article]]
12324 [[Bar:Article|Article]]
12325 [[:Bar:Article|Article]]
12326 [[Bar:Article (context)|Article]]
12327 [[:Bar:Article (context)|Article]]
12328 [[Article]]
12329 [[Article (context)]]
12330 [[Bar:X (Y) Z|X (Y) Z]]
12331 [[:Bar:X (Y) Z|X (Y) Z]]
12332 !! end
12333
12334 !! test
12335 pre-save transform: context links ("pipe trick") with interwiki prefix
12336 !! options
12337 pst
12338 !! wikitext
12339 [[interwiki:Article|]]
12340 [[:interwiki:Article|]]
12341 [[interwiki:Bar:Article|]]
12342 [[:interwiki:Bar:Article|]]
12343 !! html/php
12344 [[interwiki:Article|Article]]
12345 [[:interwiki:Article|Article]]
12346 [[interwiki:Bar:Article|Bar:Article]]
12347 [[:interwiki:Bar:Article|Bar:Article]]
12348 !! end
12349
12350 !! test
12351 pre-save transform: context links ("pipe trick") with parens in title
12352 !! options
12353 pst title=[[Somearticle (context)]]
12354 !! wikitext
12355 [[|Article]]
12356 !! html/php
12357 [[Article (context)|Article]]
12358 !! end
12359
12360 !! test
12361 pre-save transform: context links ("pipe trick") with comma in title
12362 !! options
12363 pst title=[[Someplace, Somewhere]]
12364 !! wikitext
12365 [[|Otherplace]]
12366 [[Otherplace, Elsewhere|]]
12367 [[Otherplace, Elsewhere, Anywhere|]]
12368 !! html/php
12369 [[Otherplace, Somewhere|Otherplace]]
12370 [[Otherplace, Elsewhere|Otherplace]]
12371 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12372 !! end
12373
12374 !! test
12375 pre-save transform: context links ("pipe trick") with parens and comma
12376 !! options
12377 pst title=[[Someplace (IGNORED), Somewhere]]
12378 !! wikitext
12379 [[|Otherplace]]
12380 [[Otherplace (place), Elsewhere|]]
12381 !! html/php
12382 [[Otherplace, Somewhere|Otherplace]]
12383 [[Otherplace (place), Elsewhere|Otherplace]]
12384 !! end
12385
12386 !! test
12387 pre-save transform: context links ("pipe trick") with comma and parens
12388 !! options
12389 pst title=[[Who, me? (context)]]
12390 !! wikitext
12391 [[|Yes, you.]]
12392 [[Me, Myself, and I (1937 song)|]]
12393 !! html/php
12394 [[Yes, you. (context)|Yes, you.]]
12395 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12396 !! end
12397
12398 !! test
12399 pre-save transform: context links ("pipe trick") with namespace
12400 !! options
12401 pst title=[[Ns:Somearticle]]
12402 !! wikitext
12403 [[|Article]]
12404 !! html/php
12405 [[Ns:Article|Article]]
12406 !! end
12407
12408 !! test
12409 pre-save transform: context links ("pipe trick") with namespace and parens
12410 !! options
12411 pst title=[[Ns:Somearticle (context)]]
12412 !! wikitext
12413 [[|Article]]
12414 !! html/php
12415 [[Ns:Article (context)|Article]]
12416 !! end
12417
12418 !! test
12419 pre-save transform: context links ("pipe trick") with namespace and comma
12420 !! options
12421 pst title=[[Ns:Somearticle, Context, Whatever]]
12422 !! wikitext
12423 [[|Article]]
12424 !! html/php
12425 [[Ns:Article, Context, Whatever|Article]]
12426 !! end
12427
12428 !! test
12429 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12430 !! options
12431 pst title=[[Ns:Somearticle, Context (context)]]
12432 !! wikitext
12433 [[|Article]]
12434 !! html/php
12435 [[Ns:Article (context)|Article]]
12436 !! end
12437
12438 !! test
12439 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12440 !! options
12441 pst title=[[Ns:Somearticle (IGNORED), Context]]
12442 !! wikitext
12443 [[|Article]]
12444 !! html/php
12445 [[Ns:Article, Context|Article]]
12446 !! end
12447
12448 !! test
12449 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12450 !! options
12451 pst
12452 !! wikitext
12453 [[Article(context)|]]
12454 [[Bar:Article(context)|]]
12455 [[:Bar:Article(context)|]]
12456 [[|Article(context)]]
12457 [[Bar:X(Y)Z|]]
12458 [[:Bar:X(Y)Z|]]
12459 !! html/php
12460 [[Article(context)|Article]]
12461 [[Bar:Article(context)|Article]]
12462 [[:Bar:Article(context)|Article]]
12463 [[Article(context)]]
12464 [[Bar:X(Y)Z|X(Y)Z]]
12465 [[:Bar:X(Y)Z|X(Y)Z]]
12466 !! end
12467
12468 !! test
12469 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12470 !! options
12471 pst
12472 !! wikitext
12473 [[Article (context)|]]
12474 [[Bar:Article (context)|]]
12475 [[:Bar:Article (context)|]]
12476 [[|Article (context)]]
12477 [[Bar:X (Y) Z|]]
12478 [[:Bar:X (Y) Z|]]
12479 !! html/php
12480 [[Article (context)|Article]]
12481 [[Bar:Article (context)|Article]]
12482 [[:Bar:Article (context)|Article]]
12483 [[Article (context)]]
12484 [[Bar:X (Y) Z|X (Y) Z]]
12485 [[:Bar:X (Y) Z|X (Y) Z]]
12486 !! end
12487
12488 !! test
12489 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12490 !! options
12491 pst
12492 !! wikitext
12493 [[Article(context)|]]
12494 [[Bar:Article(context)|]]
12495 [[:Bar:Article(context)|]]
12496 [[|Article(context)]]
12497 [[Bar:X(Y)Z|]]
12498 [[:Bar:X(Y)Z|]]
12499 !! html/php
12500 [[Article(context)|Article]]
12501 [[Bar:Article(context)|Article]]
12502 [[:Bar:Article(context)|Article]]
12503 [[Article(context)]]
12504 [[Bar:X(Y)Z|X(Y)Z]]
12505 [[:Bar:X(Y)Z|X(Y)Z]]
12506 !! end
12507
12508 !! test
12509 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12510 !! options
12511 pst
12512 !! wikitext
12513 [[Article (context), context|]]
12514 [[Article (context),context|]]
12515 [[Bar:Article (context), context|]]
12516 [[Bar:Article (context),context|]]
12517 [[:Bar:Article (context), context|]]
12518 [[:Bar:Article (context),context|]]
12519 !! html/php
12520 [[Article (context), context|Article]]
12521 [[Article (context),context|Article]]
12522 [[Bar:Article (context), context|Article]]
12523 [[Bar:Article (context),context|Article]]
12524 [[:Bar:Article (context), context|Article]]
12525 [[:Bar:Article (context),context|Article]]
12526 !! end
12527
12528 !! test
12529 pre-save transform: trim trailing empty lines
12530 !! options
12531 pst
12532 !! wikitext
12533 Empty lines are trimmed
12534
12535
12536
12537
12538 !! html/php
12539 Empty lines are trimmed
12540 !! end
12541
12542 !! test
12543 pre-save transform: Signature expansion
12544 !! options
12545 pst
12546 !! wikitext
12547 * ~~~
12548 * <noinclude>~~~</noinclude>
12549 * <includeonly>~~~</includeonly>
12550 * <onlyinclude>~~~</onlyinclude>
12551 !! html/php
12552 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12553 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12554 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12555 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12556 !! end
12557
12558
12559 !! test
12560 pre-save transform: Signature expansion in nowiki tags (bug 93)
12561 !! options
12562 pst disabled
12563 !! wikitext
12564 Shall not expand:
12565
12566 <nowiki>~~~~</nowiki>
12567
12568 <includeonly><nowiki>~~~~</nowiki></includeonly>
12569
12570 <noinclude><nowiki>~~~~</nowiki></noinclude>
12571
12572 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12573
12574 {{subst:Foo}} shall be converted to FOO
12575
12576 As well as inside noinclude/onlyinclude
12577 <noinclude>{{subst:Foo}}</noinclude>
12578 <onlyinclude>{{subst:Foo}}</onlyinclude>
12579
12580 But not inside includeonly
12581 <includeonly>{{subst:Foo}}</includeonly>
12582 !! html/php
12583 Shall not expand:
12584
12585 <nowiki>~~~~</nowiki>
12586
12587 <includeonly><nowiki>~~~~</nowiki></includeonly>
12588
12589 <noinclude><nowiki>~~~~</nowiki></noinclude>
12590
12591 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12592
12593 FOO shall be converted to FOO
12594
12595 As well as inside noinclude/onlyinclude
12596 <noinclude>FOO</noinclude>
12597 <onlyinclude>FOO</onlyinclude>
12598
12599 But not inside includeonly
12600 <includeonly>{{subst:Foo}}</includeonly>
12601 !! end
12602
12603 !! test
12604 Parsoid: Recognize nowiki with trailing space in tags
12605 !! options
12606 parsoid=wt2html
12607 !! wikitext
12608 <nowiki ><div>[[foo]]</nowiki >
12609
12610 a<nowiki / >b
12611
12612 c<nowiki />d
12613
12614 e<nowiki/ >f
12615 !! html
12616 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12617 <p>ab</p>
12618 <p>cd</p>
12619 <p>ef</p>
12620 !! end
12621
12622 !! test
12623 Parsoid: Recognize nowiki with odd capitalization
12624 !! options
12625 parsoid=wt2html
12626 !! wikitext
12627 <noWikI ><div>[[foo]]</Nowiki >
12628 !! html
12629 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12630 !! end
12631
12632
12633 !! test
12634 Parsoid: Escape nowiki with trailing space in tags
12635 !! options
12636 parsoid=html2wt
12637 !! html/parsoid
12638 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12639 <p>a&lt;nowiki /&gt;b</p>
12640 <p>c&lt;nowiki/ &gt;d</p>
12641 !! wikitext
12642 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12643
12644 a&lt;nowiki /&gt;b
12645
12646 c&lt;nowiki/ &gt;d
12647 !! end
12648
12649 !! test
12650 Parsoid: Escape weird noWikI capitalizations
12651 !! options
12652 parsoid=html2wt
12653 !! html/parsoid
12654 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12655 !! wikitext
12656 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12657 !! end
12658
12659 ###
12660 ### Message transform tests
12661 ###
12662 !! test
12663 message transform: magic variables
12664 !! options
12665 msg
12666 !! wikitext
12667 {{SITENAME}}
12668 !! html
12669 MediaWiki
12670 !! end
12671
12672 !! test
12673 message transform: should not transform wiki markup
12674 !! options
12675 msg
12676 !! wikitext
12677 ''test''
12678 !! html
12679 ''test''
12680 !! end
12681
12682 !! test
12683 message transform: <noinclude> in transcluded template (bug 4926)
12684 !! options
12685 msg
12686 !! wikitext
12687 {{Includes}}
12688 !! html
12689 Foobar
12690 !! end
12691
12692 !! test
12693 message transform: <onlyinclude> in transcluded template (bug 4926)
12694 !! options
12695 msg
12696 !! wikitext
12697 {{Includes2}}
12698 !! html
12699 Foo
12700 !! end
12701
12702 !! test
12703 {{#special:}} page name, known
12704 !! options
12705 msg
12706 !! wikitext
12707 {{#special:Recentchanges}}
12708 !! html
12709 Special:RecentChanges
12710 !! end
12711
12712 !! test
12713 {{#special:}} page name with subpage, known
12714 !! options
12715 msg
12716 !! wikitext
12717 {{#special:Recentchanges/param}}
12718 !! html
12719 Special:RecentChanges/param
12720 !! end
12721
12722 !! test
12723 {{#special:}} page name, unknown
12724 !! options
12725 msg
12726 !! wikitext
12727 {{#special:foobar nonexistent}}
12728 !! html
12729 Special:Foobar nonexistent
12730 !! end
12731
12732 !! test
12733 {{#speciale:}} page name, known
12734 !! options
12735 msg
12736 !! wikitext
12737 {{#speciale:Recentchanges}}
12738 !! html
12739 Special:RecentChanges
12740 !! end
12741
12742 !! test
12743 {{#speciale:}} page name with subpage, known
12744 !! options
12745 msg
12746 !! wikitext
12747 {{#speciale:Recentchanges/param}}
12748 !! html
12749 Special:RecentChanges/param
12750 !! end
12751
12752 !! test
12753 {{#speciale:}} page name, unknown
12754 !! options
12755 msg
12756 !! wikitext
12757 {{#speciale:foobar nonexistent}}
12758 !! html
12759 Special:Foobar_nonexistent
12760 !! end
12761
12762 ###
12763 ### Images
12764 ###
12765 ### For Parsoid-specific tests, see
12766 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12767
12768 !! test
12769 Simple image
12770 !! options
12771 parsoid=wt2html,wt2wt,html2html
12772 !! wikitext
12773 [[Image:foobar.jpg]]
12774 !! html/php
12775 <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>
12776 </p>
12777 !! html/parsoid
12778 <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>
12779 !! end
12780
12781 !! test
12782 Simple image (using File: namespace, now canonical)
12783 !! wikitext
12784 [[File:Foobar.jpg]]
12785 !! html/php
12786 <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>
12787 </p>
12788 !! html/parsoid
12789 <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>
12790 !! end
12791
12792 !! test
12793 Right-aligned image
12794 !! wikitext
12795 [[File:Foobar.jpg|right]]
12796 !! html/php
12797 <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>
12798
12799 !! html/parsoid
12800 <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>
12801 !! end
12802
12803 !! test
12804 Image with caption
12805 !! wikitext
12806 [[File:Foobar.jpg|right|Caption text]]
12807 !! html/php
12808 <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>
12809
12810 !! html/parsoid
12811 <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>
12812 !! end
12813
12814 !! test
12815 Image with caption, bug 53312 #1
12816 !! wikitext
12817 [[File:Foobar.jpg|right|Caption page stuff]]
12818 !! html/php
12819 <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>
12820
12821 !! html/parsoid
12822 <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>
12823 !! end
12824
12825 !! test
12826 Image with caption, bug 53312 #2
12827 !! wikitext
12828 [[File:Foobar.jpg|right|Caption page=]]
12829 !! html/php
12830 <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>
12831
12832 !! html/parsoid
12833 <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>
12834 !! end
12835
12836 !! test
12837 Image with caption, bug 53312 #3
12838 !! wikitext
12839 [[File:Foobar.jpg|right|Caption page=stuff]]
12840 !! html/php
12841 <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>
12842
12843 !! html/parsoid
12844 <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>
12845 !! end
12846
12847 !! test
12848 Allow empty links in image captions (Bug 60753)
12849 !! options
12850 thumbsize=220
12851 !! wikitext
12852 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12853 [[]]
12854 [[Link2]]
12855 ]]
12856 !! html/php
12857 <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>
12858
12859 !! html/parsoid
12860 <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>
12861 [[]]
12862 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12863 </figcaption></figure>
12864 !! end
12865
12866 !! test
12867 Titles in unlinked images (T23454)
12868 !! wikitext
12869 [[File:Foobar.jpg|link=|stuff]]
12870 !! html/php
12871 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12872 </p>
12873 !! end
12874
12875 !! test
12876 Link with empty target
12877 !! wikitext
12878 [[]]
12879 !! html
12880 <p>[[]]
12881 </p>
12882 !! end
12883
12884 !! test
12885 Image with link trail
12886 !! wikitext
12887 Linktrails should not work for images: [[File:Foobar.jpg]]s
12888 !! html/php
12889 <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
12890 </p>
12891 !! html/parsoid
12892 <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>
12893 !! end
12894
12895 !! test
12896 Image with empty attribute
12897 !! options
12898 parsoid=wt2html,wt2wt,html2html
12899 !! wikitext
12900 [[File:Foobar.jpg|right||Caption text]]
12901 !! html/php
12902 <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>
12903
12904 !! html/parsoid
12905 <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>
12906 !! end
12907
12908 !! test
12909 1. Block image with individual attributes from templates
12910 !! wikitext
12911 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12912 !! html/php
12913 <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>
12914
12915 !! html/parsoid
12916 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><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"/></a><figcaption>This is a caption</figcaption></figure>
12917 !! end
12918
12919 !! test
12920 2. Block Image with individual attributes from templates
12921 !! wikitext
12922 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12923 !! html/php
12924 <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>
12925
12926 !! html/parsoid
12927 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><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"/></a><figcaption>This is a caption</figcaption></figure>
12928 !! end
12929
12930 !! test
12931 3. Inline image with individual attributes from templates
12932 !! wikitext
12933 [[File:Foobar.jpg|{{echo|50px}}]]
12934 !! html/php
12935 <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>
12936 </p>
12937 !! html/parsoid
12938 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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"/></a></span></p>
12939 !! end
12940
12941 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12942 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12943 !! test
12944 Image with multiple attributes from the same template
12945 !! wikitext
12946 [[File:Foobar.jpg|{{image_attribs}}]]
12947 !! html/php
12948 <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>
12949
12950 !! html/parsoid
12951 <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>
12952 !! end
12953
12954 !! test
12955 Image with link tails
12956 !! options
12957 thumbsize=220
12958 !! wikitext
12959 123[[File:Foobar.jpg]]456
12960 123[[File:Foobar.jpg|right]]456
12961 123[[File:Foobar.jpg|thumb]]456
12962 !! html/php
12963 <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
12964 </p>
12965 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
12966 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
12967
12968 !! html/php+tidy
12969 <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>
12970 <p>123</p>
12971 <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>
12972 <p>456 123</p>
12973 <div class="thumb tright">
12974 <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>
12975 <div class="thumbcaption">
12976 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12977 </div>
12978 </div>
12979 </div>
12980 <p>456</p>
12981 !! html/parsoid
12982 <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>
12983 <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>
12984 <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>
12985 !! end
12986
12987 !! test
12988 Image with multiple captions -- only last one is accepted
12989 !! wikitext
12990 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12991 !! html/php
12992 <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>
12993
12994 !! html/parsoid
12995 <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>
12996 !! end
12997
12998 !! test
12999 Image with multiple widths -- use last
13000 !! wikitext
13001 [[File:Foobar.jpg|200px|300px|caption]]
13002 !! html/php
13003 <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>
13004 </p>
13005 !! html/parsoid
13006 <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>
13007 !! end
13008
13009 !! test
13010 Image with multiple alignments -- use first (bug 48664)
13011 !! options
13012 thumbsize=220
13013 !! wikitext
13014 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13015
13016 [[File:Foobar.jpg|middle|text-top|caption]]
13017 !! html/php
13018 <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>
13019 <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>
13020 </p>
13021 !! html/parsoid
13022 <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>
13023 <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>
13024 !! end
13025
13026 !! test
13027 Image with width attribute at different positions
13028 !! wikitext
13029 [[File:Foobar.jpg|200px|right|Caption]]
13030 [[File:Foobar.jpg|right|200px|Caption]]
13031 [[File:Foobar.jpg|right|Caption|200px]]
13032 !! html/php
13033 <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>
13034 <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>
13035 <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>
13036
13037 !! html/parsoid
13038 <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>
13039 <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>
13040 <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>
13041 !! end
13042
13043 # a sad bit of backward-compatibility
13044 !! test
13045 Image with size specified with pxpx (bug 13500, 51628)
13046 !! options
13047 parsoid=wt2html,wt2wt,html2html
13048 !! wikitext
13049 [[File:Foobar.jpg|20pxpx]]
13050 [[File:Foobar.jpg|200x20pxpx]]
13051 !! html/php
13052 <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>
13053 <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>
13054 </p>
13055 !! html/parsoid
13056 <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>
13057 !! end
13058
13059 !! test
13060 Image with link parameter, wiki target
13061 !! wikitext
13062 [[File:Foobar.jpg|link=Main Page]]
13063 !! html/php
13064 <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>
13065 </p>
13066 !! html/parsoid
13067 <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>
13068 !! end
13069
13070 # parsoid bug 49293 (part 1)
13071 !! test
13072 Image with link parameter, URL target
13073 !! wikitext
13074 [[File:Foobar.jpg|link=http://example.com/]]
13075 !! html/php
13076 <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>
13077 </p>
13078 !! html/parsoid
13079 <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>
13080 !! end
13081
13082 # parsoid bug 49293 (part 2)
13083 !! test
13084 Image with link parameter, protocol-less URL target
13085 !! wikitext
13086 [[File:Foobar.jpg|link=//example.com/]]
13087 !! html/php
13088 <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>
13089 </p>
13090 !! html/parsoid
13091 <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>
13092 !! end
13093
13094 !! test
13095 Escaping non-block captions (T107435)
13096 !! options
13097 parsoid={
13098 "modes": ["wt2wt"],
13099 "changes": [
13100 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13101 ]
13102 }
13103 !! wikitext
13104 [[Image:Foobar.jpg|caption]]
13105 !! wikitext/edited
13106 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13107 !! end
13108
13109 # wgExternalLinkTarget not supported by Parsoid
13110 !! test
13111 Image with link parameter, wgExternalLinkTarget
13112 !! wikitext
13113 [[Image:foobar.jpg|link=http://example.com/]]
13114 !! config
13115 wgExternalLinkTarget='foobar'
13116 !! html/php
13117 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13118 </p>
13119 !! end
13120
13121 !! test
13122 Image with link parameter, wgNoFollowLinks set to false
13123 !! wikitext
13124 [[Image:foobar.jpg|link=http://example.com/]]
13125 !! config
13126 wgNoFollowLinks=false
13127 !! html
13128 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13129 </p>
13130 !! end
13131
13132 !! test
13133 Image with link parameter, wgNoFollowDomainExceptions
13134 !! wikitext
13135 [[Image:foobar.jpg|link=http://example.com/]]
13136 !! config
13137 wgNoFollowDomainExceptions='example.com'
13138 !! html
13139 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13140 </p>
13141 !! end
13142
13143 # wgExternalLinkTarget not supported by Parsoid
13144 !! test
13145 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13146 !! wikitext
13147 [[Image:foobar.jpg|link=http://example.com/|Title]]
13148 !! config
13149 wgExternalLinkTarget='foobar'
13150 !! html/php
13151 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13152 </p>
13153 !! end
13154
13155 !! test
13156 Image with empty link parameter
13157 !! wikitext
13158 [[File:Foobar.jpg|link=]]
13159 !! html/php
13160 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13161 </p>
13162 !! html/parsoid
13163 <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>
13164 !! end
13165
13166 !! test
13167 Image with link parameter (wiki target) and unnamed parameter
13168 !! wikitext
13169 [[File:Foobar.jpg|link=Main_Page|Title]]
13170 !! html/php
13171 <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>
13172 </p>
13173 !! html/parsoid
13174 <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>
13175 !! end
13176
13177 !! test
13178 Image with link parameter (URL target) and unnamed parameter
13179 !! wikitext
13180 [[File:Foobar.jpg|link=http://example.com/|Title]]
13181 !! html/php
13182 <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>
13183 </p>
13184 !! html/parsoid
13185 <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>
13186 !! end
13187
13188 !! test
13189 Thumbnail image with link parameter
13190 !! options
13191 thumbsize=220
13192 parsoid=wt2html,wt2wt,html2html
13193 !! wikitext
13194 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13195 !! html/php
13196 <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>
13197
13198 !! html/parsoid
13199 <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>
13200 !! end
13201
13202 !! test
13203 Manually-specified thumbnail image
13204 !! options
13205 thumbsize=220
13206 !! wikitext
13207 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13208 !! html/php
13209 <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>
13210
13211 !! html/parsoid
13212 <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>
13213 !! end
13214
13215 !! test
13216 Manually-specified thumbnail image with explicit link to wiki page
13217 !! options
13218 thumbsize=220
13219 parsoid=wt2html,wt2wt,html2html
13220 !! wikitext
13221 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13222 !! html/php
13223 <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>
13224
13225 !! html/parsoid
13226 <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>
13227 !! end
13228
13229 !! test
13230 Manually-specified thumbnail image with explicit link to url
13231 !! options
13232 thumbsize=220
13233 parsoid=wt2html,wt2wt,html2html
13234 !! wikitext
13235 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13236 !! html/php
13237 <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>
13238
13239 !! html/parsoid
13240 <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>
13241 !! end
13242
13243 !! test
13244 Manually-specified thumbnail image with explicit no link
13245 !! options
13246 thumbsize=220
13247 parsoid=wt2html,wt2wt,html2html
13248 !! wikitext
13249 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13250 !! html/php
13251 <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>
13252
13253 !! html/parsoid
13254 <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>
13255 !! end
13256
13257 !! test
13258 Manually-specified thumbnail image with explicit link and alt text
13259 !! options
13260 thumbsize=220
13261 parsoid=wt2html,wt2wt,html2html
13262 !! wikitext
13263 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13264 !! html/php
13265 <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>
13266
13267 !! html/parsoid
13268 <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>
13269 !! end
13270
13271 !! test
13272 Image with frame and link
13273 !! options
13274 parsoid=wt2html,wt2wt,html2html
13275 !! wikitext
13276 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13277 !! html/php
13278 <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>
13279
13280 !! html/parsoid
13281 <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>
13282 !! end
13283
13284 !! test
13285 Image with frame and link and explicit alt
13286 !! options
13287 parsoid=wt2html,wt2wt,html2html
13288 !! wikitext
13289 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13290 !! html/php
13291 <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>
13292
13293 !! html/parsoid
13294 <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>
13295 !! end
13296
13297 !! test
13298 Image with wiki markup in implicit alt
13299 !! wikitext
13300 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13301
13302 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13303 !! html/php
13304 <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>
13305 </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>
13306 </p>
13307 !! html/parsoid
13308 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13309 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><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>
13310 !! end
13311
13312 !! test
13313 Alt image option should handle most kinds of wikitext without barfing
13314 !! wikitext
13315 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13316 !! html/php
13317 <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>
13318
13319 !! html/parsoid
13320 <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=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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>
13321 !! end
13322
13323 ###################
13324 # Conflicting image format options.
13325 # First option specified should 'win'.
13326 # All three cases in each test should be identical.
13327
13328 !! test
13329 Image with 'frameless' first.
13330 !! options
13331 parsoid=wt2html,wt2wt,html2html
13332 !! wikitext
13333 [[File:Foobar.jpg|frameless|caption]]
13334
13335 [[File:Foobar.jpg|frameless|frame|caption]]
13336
13337 [[File:Foobar.jpg|frameless|thumb|caption]]
13338 !! html/php
13339 <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>
13340 </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>
13341 </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>
13342 </p>
13343 !! html/parsoid
13344 <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>
13345 <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>
13346 <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>
13347 !! end
13348
13349 !! test
13350 Image with 'frame' first.
13351 !! options
13352 parsoid=wt2html,wt2wt,html2html
13353 !! wikitext
13354 [[File:Foobar.jpg|frame|caption]]
13355 [[File:Foobar.jpg|frame|frameless|caption]]
13356 [[File:Foobar.jpg|frame|thumb|caption]]
13357 !! html/php
13358 <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>
13359 <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>
13360 <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>
13361
13362 !! html/parsoid
13363 <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>
13364 <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>
13365 <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>
13366 !! end
13367
13368 !! test
13369 Image with 'thumb' first.
13370 !! options
13371 parsoid=wt2html,wt2wt,html2html
13372 !! wikitext
13373 [[File:Foobar.jpg|thumb|caption]]
13374 [[File:Foobar.jpg|thumb|frameless|caption]]
13375 [[File:Foobar.jpg|thumb|frame|caption]]
13376 !! html/php
13377 <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>
13378 <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>
13379 <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>
13380
13381 !! html/parsoid
13382 <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>
13383 <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>
13384 <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>
13385 !! end
13386
13387 ###################
13388 # Image sizing.
13389 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13390 # and https://phabricator.wikimedia.org/T64258
13391 # Foobar has actual size of 1941x220
13392 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13393 # a scalable format.
13394 # 2. Framed images always ignore size options; always render at default size.
13395 # 3. "Unspecified format" and border are the only types which can be
13396 # enlarged.
13397
13398 !! test
13399 Image: "unspecified format" and border enlarge
13400 !! options
13401 parsoid=wt2html,wt2wt,html2html
13402 !! wikitext
13403 [[File:Foobar.jpg|2000px]]
13404
13405 [[File:Foobar.jpg|border|2000px]]
13406 !! html/php
13407 <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>
13408 </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>
13409 </p>
13410 !! html/parsoid
13411 <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>
13412 <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>
13413 !! end
13414
13415 !! test
13416 Image: "unspecified format" and border reduce
13417 !! options
13418 parsoid=wt2html,wt2wt,html2html
13419 !! wikitext
13420 [[File:Foobar.jpg|1000px]]
13421
13422 [[File:Foobar.jpg|border|1000px]]
13423 !! html/php
13424 <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>
13425 </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>
13426 </p>
13427 !! html/parsoid
13428 <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>
13429 <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>
13430 !! end
13431
13432 !! test
13433 Image: thumbs reduce
13434 !! options
13435 parsoid=wt2html,wt2wt,html2html
13436 !! wikitext
13437 [[File:Foobar.jpg|thumb|50px]]
13438 !! html/php
13439 <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>
13440
13441 !! html/parsoid
13442 <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>
13443 !! end
13444
13445 !! test
13446 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13447 !! options
13448 parsoid=wt2html,wt2wt,html2html
13449 !! wikitext
13450 [[File:Foobar.jpg|thumb|2000px]]
13451
13452 [[File:Foobar.svg|thumb|2000px]]
13453 !! html/php
13454 <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>
13455 <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>
13456
13457 !! html/parsoid
13458 <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>
13459 <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>
13460 !! end
13461
13462 !! test
13463 Image: frameless can reduce in size
13464 !! options
13465 parsoid=wt2html,wt2wt,html2html
13466 !! wikitext
13467 [[File:Foobar.jpg|frameless|50px]]
13468 !! html/php
13469 <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>
13470 </p>
13471 !! html/parsoid
13472 <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>
13473 !! end
13474
13475 !! test
13476 Image: bitmap frameless can't be enlarged past original size, but vector can
13477 !! options
13478 parsoid=wt2html,wt2wt,html2html
13479 !! wikitext
13480 [[File:Foobar.jpg|frameless|2000px]]
13481
13482 [[File:Foobar.svg|frameless|2000px]]
13483 !! html/php
13484 <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>
13485 </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>
13486 </p>
13487 !! html/parsoid
13488 <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>
13489 <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>
13490 !! end
13491
13492 !! test
13493 Image: framed images are always unscaled.
13494 !! options
13495 parsoid=wt2html,wt2wt,html2html
13496 !! wikitext
13497 [[File:Foobar.jpg|frame]]
13498
13499 [[File:Foobar.jpg|frame|50px]]
13500
13501 [[File:Foobar.jpg|frame|50x50px]]
13502
13503 [[File:Foobar.jpg|frame|2000px]]
13504 !! html/php
13505 <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>
13506 <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>
13507 <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>
13508 <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>
13509
13510 !! html/parsoid
13511 <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>
13512 <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>
13513 <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>
13514 <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>
13515 !! end
13516
13517 ###################
13518
13519 !! test
13520 Link to image page- image page normally doesn't exists, hence edit link
13521 Add test with existing image page
13522 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13523 !! wikitext
13524 [[:Image:test]]
13525 !! html
13526 <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>
13527 </p>
13528 !! end
13529
13530 !! test
13531 bug 18784 Link to non-existent image page with caption should use caption as link text
13532 !! wikitext
13533 [[:Image:test|caption]]
13534 !! html
13535 <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>
13536 </p>
13537 !! end
13538
13539 !! test
13540 Frameless image caption with a free URL
13541 !! wikitext
13542 [[File:Foobar.jpg|http://example.com]]
13543 !! html/php
13544 <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>
13545 </p>
13546 !! html/parsoid
13547 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/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>
13548 !! end
13549
13550 !! test
13551 Thumbnail image caption with a free URL
13552 !! options
13553 thumbsize=220
13554 !! wikitext
13555 [[File:Foobar.jpg|thumb|http://example.com]]
13556 !! html/php
13557 <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>
13558
13559 !! html/parsoid
13560 <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>
13561 !! end
13562
13563 !! test
13564 Thumbnail image caption with a free URL and explicit alt
13565 !! options
13566 thumbsize=220
13567 parsoid=wt2html,wt2wt,html2html
13568 !! wikitext
13569 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13570 !! html/php
13571 <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>
13572
13573 !! html/parsoid
13574 <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>
13575 !! end
13576
13577 !! test
13578 SVG thumbnails with no language set
13579 !! options
13580 !! wikitext
13581 [[File:Foobar.svg|thumb|caption]]
13582 !! html/php
13583 <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>
13584
13585 !! html/parsoid
13586 <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>
13587 !! end
13588
13589 !! test
13590 SVG thumbnails with language de
13591 !! options
13592 parsoid=wt2html,wt2wt,html2html
13593 !! wikitext
13594 [[File:Foobar.svg|thumb|caption|lang=de]]
13595 !! html/php
13596 <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>
13597
13598 !! html/parsoid
13599 <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>
13600 !! end
13601
13602 !! test
13603 SVG thumbnails with invalid language code
13604 !! options
13605 parsoid=wt2html,wt2wt,html2html
13606 !! wikitext
13607 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13608 !! html/php
13609 <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>
13610
13611 !! html/parsoid
13612 <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>
13613 !! end
13614
13615 !! test
13616 BUG 1887: A ISBN with a thumbnail
13617 !! wikitext
13618 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13619 !! html/php
13620 <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>
13621
13622 !! html/parsoid
13623 <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>
13624 !! end
13625
13626 !! test
13627 BUG 1887: A RFC with a thumbnail
13628 !! wikitext
13629 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13630 !! html/php
13631 <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>
13632
13633 !! html/parsoid
13634 <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>
13635 !! end
13636
13637 !! test
13638 BUG 1887: A mailto link with a thumbnail
13639 !! wikitext
13640 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13641 !! html/php
13642 <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>
13643
13644 !! html/parsoid
13645 <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>
13646 !! end
13647
13648 # Pending resolution to bug 368
13649 !! test
13650 BUG 648: Frameless image caption with a link
13651 !! wikitext
13652 [[File:Foobar.jpg|text with a [[link]] in it]]
13653 !! html/php
13654 <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>
13655 </p>
13656 !! html/parsoid
13657 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,38,2,2]}\">link&lt;/a> in it"}'><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>
13658 !! end
13659
13660 !! test
13661 BUG 648: Frameless image caption with a link (suffix)
13662 !! wikitext
13663 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13664 !! html/php
13665 <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>
13666 </p>
13667 !! html/parsoid
13668 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> in it"}'><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>
13669 !! end
13670
13671 !! test
13672 BUG 648: Frameless image caption with an interwiki link
13673 !! wikitext
13674 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13675 !! html/php
13676 <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>
13677 </p>
13678 !! html/parsoid
13679 <p><span class="mw-default-size" typeof="mw:Image" 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=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> in it"}'><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>
13680 !! end
13681
13682 !! test
13683 BUG 648: Frameless image caption with a piped interwiki link
13684 !! wikitext
13685 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13686 !! html/php
13687 <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>
13688 </p>
13689 !! html/parsoid
13690 <p><span class="mw-default-size" typeof="mw:Image" 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=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> in it"}'><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>
13691 !! end
13692
13693 !! test
13694 T107474: Frameless image caption with <nowiki>
13695 !! wikitext
13696 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13697 !! html/parsoid
13698 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><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>
13699 !! end
13700
13701 !! test
13702 Escape HTML special chars in image alt text
13703 !! wikitext
13704 [[File:Foobar.jpg|& < > "]]
13705 !! html/php
13706 <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>
13707 </p>
13708 !! html/parsoid
13709 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><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>
13710 !! end
13711
13712 !! test
13713 BUG 499: Alt text should have &#1234;, not &amp;1234;
13714 !! wikitext
13715 [[File:Foobar.jpg|&#9792;]]
13716 !! html/php
13717 <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>
13718 </p>
13719 !! html/parsoid
13720 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&lt;/span>"}'><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>
13721 !! end
13722
13723 !! test
13724 Broken image caption with link
13725 !! options
13726 parsoid=wt2html,wt2wt,html2html
13727 !! wikitext
13728 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13729 !! html/php
13730 <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.
13731 </p>
13732 !! html/parsoid
13733 <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>
13734 !! end
13735
13736 !! test
13737 Image caption containing another image
13738 !! wikitext
13739 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13740 !! html/php
13741 <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>
13742
13743 !! html/parsoid
13744 <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>
13745 !! end
13746
13747 !! test
13748 Image: caption containing a newline
13749 !! wikitext
13750 [[File:Foobar.jpg|This
13751 *is some text]]
13752 !! html/php
13753 <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>
13754 </p>
13755 !! html/parsoid
13756 <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>
13757 !!end
13758
13759 !!test
13760 Image: caption containing leading space
13761 (The leading space should not trigger nowiki escaping in wt2wt mode)
13762 !! wikitext
13763 [[File:Foobar.jpg|thumb| bar]]
13764 !! html/php
13765 <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>
13766
13767 !! html/parsoid
13768 <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>
13769 !!end
13770
13771 !! test
13772 Image: caption containing a table
13773 !! options
13774 parsoid=wt2html,wt2wt,html2html
13775 !! wikitext
13776 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13777 {|
13778 ! Foo !! Bar
13779 |-
13780 | Foo1 || Bar1
13781 |}
13782 and some more text.]]
13783 !! html/php
13784 <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>
13785
13786 !! html/parsoid
13787 <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
13788 <table>
13789 <tbody>
13790 <tr><th>Foo </th><th>Bar</th></tr>
13791 <tr>
13792 <td>Foo1 </td>
13793 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13794 !! end
13795
13796 !! test
13797 Bug 3090: External links other than http: in image captions
13798 !! wikitext
13799 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13800 !! html/php
13801 <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>
13802
13803 !! html/parsoid
13804 <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>
13805 !! end
13806
13807 !! test
13808 Custom class
13809 !! options
13810 parsoid=wt2html,wt2wt,html2html
13811 !! wikitext
13812 [[Image:foobar.jpg|a|class=b]]
13813 !! html/php
13814 <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>
13815 </p>
13816 !! html/parsoid
13817 <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>
13818 !! end
13819
13820 !! test
13821 Localized image handling (1).
13822 !! options
13823 parsoid=wt2html,wt2wt,html2html
13824 language=es
13825 !! wikitext
13826 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13827 !! html/php
13828 <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>
13829
13830 !! html/parsoid
13831 <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>
13832 !! end
13833
13834 !! test
13835 Localized image handling (2).
13836 !! options
13837 thumbsize=220
13838 parsoid=wt2html,wt2wt,html2html
13839 language=es
13840 !! wikitext
13841 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13842 !! html/php
13843 <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>
13844
13845 !! html/parsoid
13846 <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>
13847 !! end
13848
13849 !! test
13850 Localized image handling (3).
13851 !! options
13852 language=fa
13853 parsoid=html2wt
13854 !! html/parsoid
13855 <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>
13856 !! wikitext
13857 [[File:Foobar.jpg|بندانگشتی]]
13858 !! end
13859
13860 !! test
13861 "border", "frameless" and "class" attributes on an image.
13862 !! options
13863 thumbsize=220
13864 parsoid=wt2html,wt2wt,html2html
13865 !! wikitext
13866 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13867 !! html/php
13868 <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>
13869 </p>
13870 !! html/parsoid
13871 <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>
13872 !! end
13873
13874 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13875 !! test
13876 Invalid image attributes (bug 62500)
13877 !! options
13878 thumbsize=220
13879 parsoid=wt2html,wt2wt,html2html
13880 !! wikitext
13881 [[File:Foobar.jpg|thumb|float|left|caption]]
13882
13883 [[File:Foobar.jpg|thumb|righ|caption]]
13884
13885 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13886 !! html/php
13887 <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>
13888 <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>
13889 <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>
13890
13891 !! html/parsoid
13892 <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>
13893 <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>
13894 <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>
13895 !! end
13896
13897 !! article
13898 File:Barfoo.jpg
13899 !! text
13900 #REDIRECT [[File:Barfoo.jpg]]
13901 !! endarticle
13902
13903 # FIXME: Parsoid should run this test -- but we'd need to teach the
13904 # mockAPI about the redirected Barfoo.jpg image.
13905 !! test
13906 Redirected image
13907 !! wikitext
13908 [[Image:Barfoo.jpg]]
13909 !! html/php
13910 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13911 </p>
13912 !! end
13913
13914 !! test
13915 Missing image with uploads disabled
13916 !! options
13917 wgEnableUploads=0
13918 !! wikitext
13919 [[File:Foobaz.jpg]]
13920 !! html/php
13921 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13922 </p>
13923 !! html/parsoid
13924 <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>
13925 !! end
13926
13927 # Parsoid-specific testing for images
13928 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13929 # Currently imperfect due to a flaw in the Parsoid testrunner
13930 # Work in progress
13931 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13932 # image tests.
13933
13934 !! test
13935 Parsoid-specific image handling - simple image with size and middle alignment
13936 !! wikitext
13937 [[File:Foobar.jpg|middle|50px]]
13938 !! html/parsoid
13939 <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>
13940 !! end
13941
13942 !! test
13943 Parsoid-specific image handling - simple image with size, middle alignment,
13944 non-standard namespace alias
13945 !! options
13946 parsoid=wt2wt,wt2html,html2html
13947 !! wikitext
13948 [[Image:Foobar.jpg|middle|50px]]
13949 !! html/parsoid
13950 <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>
13951 !! end
13952
13953 !! test
13954 Parsoid-specific image handling - simple image with size and middle alignment
13955 (existing content)
13956 !! wikitext
13957 [[File:Foobar.jpg|50px|middle]]
13958 !! html/parsoid
13959 <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>
13960 !! end
13961
13962 !! test
13963 Parsoid-specific image handling - simple image with size and middle alignment
13964 and non-standard namespace name
13965 !! options
13966 parsoid=wt2html,wt2wt,html2html
13967 !! wikitext
13968 [[Image:Foobar.jpg|50px|middle]]
13969 !! html/parsoid
13970 <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>
13971 !! end
13972
13973 !! test
13974 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13975 !! wikitext
13976 [[File:Foobar.jpg|500x10px|baseline|caption]]
13977 !! html/parsoid
13978 <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>
13979 !! end
13980
13981 !! test
13982 Parsoid-specific image handling - simple image with border and size spec
13983 !! wikitext
13984 [[File:Foobar.jpg|50px|border|caption]]
13985 !! html/parsoid
13986 <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>
13987 !! end
13988
13989 !! test
13990 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13991 !! wikitext
13992 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13993 !! html/parsoid
13994 <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>
13995 !! end
13996
13997 !! test
13998 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13999 (existing content)
14000 !! wikitext
14001 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14002 !! html/parsoid
14003 <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>
14004 !! end
14005
14006 !! test
14007 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14008 !! wikitext
14009 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14010 !! html/parsoid
14011 <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>
14012 !! end
14013
14014 !! test
14015 Parsoid-specific image handling - thumbnail with specific size, halign,
14016 valign, and caption (existing content)
14017 !! wikitext
14018 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14019 !! html/parsoid
14020 <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>
14021 !! end
14022
14023 !! test
14024 Parsoid-specific image handling - framed image with specific size and caption
14025 (size is ignored)
14026 !! options
14027 parsoid=wt2html,wt2wt,html2html
14028 !! wikitext
14029 [[File:Foobar.jpg|frame|500x50px|caption]]
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14036 (size is ignored)
14037 !! options
14038 parsoid=wt2html,wt2wt,html2html
14039 !! wikitext
14040 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14041 !! html/parsoid
14042 <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>
14043 !! end
14044
14045 !! test
14046 Parsoid-specific image handling - frameless image with specific size, border, and caption
14047 !! wikitext
14048 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14049 !! html/parsoid
14050 <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>
14051 !! end
14052
14053 !! test
14054 Parsoid-specific image handling - simple image with a formatted caption
14055 !! wikitext
14056 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14057 !! html/parsoid
14058 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><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>
14059 !! end
14060
14061 !! test
14062 Parsoid-specific image handling - caption with a template in it
14063 !! wikitext
14064 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14065 !! html/parsoid
14066 <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>
14067 !! end
14068
14069 !! test
14070 Parsoid-specific image handling - caption with unbalanced tags in it
14071 !! options
14072 parsoid=wt2html,wt2wt,html2html
14073 !! wikitext
14074 foo
14075 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14076 bar
14077 !! html/parsoid
14078 <p>foo</p>
14079 <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>
14080 <p>bar</p>
14081 !! end
14082
14083 !! test
14084 Parsoid-specific image handling - empty caption (1)
14085 !! options
14086 parsoid=wt2html,wt2wt
14087 !! wikitext
14088 [[File:Foobar.jpg|thumb|]]
14089 !! html/parsoid
14090 <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>
14091 !! end
14092
14093 # empty captions don't get serialized unless we're in the "round trip" case
14094 !! test
14095 Parsoid-specific image handling - empty caption (2)
14096 !! options
14097 parsoid=html2wt
14098 !! html/parsoid
14099 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14100 <a href="./File:Foobar.jpg">
14101 <img resource="./File:Foobar.jpg"
14102 src="//example.com/images/3/3a/Foobar.jpg"
14103 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14104 height="25" width="220"/>
14105 </a>
14106 <figcaption></figcaption>
14107 </figure>
14108 !! wikitext
14109 [[File:Foobar.jpg|thumb]]
14110 !! end
14111
14112 !! test
14113 Parsoid-specific image handling - whitespace caption
14114 !! wikitext
14115 [[File:Foobar.jpg|thumb| ]]
14116 !! html/parsoid
14117 <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>
14118 !! end
14119
14120 !! test
14121 Parsoid-specific image handling - lang option
14122 !! wikitext
14123 foo
14124 [[File:Foobar.svg|lang=de|caption]]
14125 bar
14126 !! html/parsoid
14127 <p>foo
14128 <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>
14129 bar</p>
14130 !! end
14131
14132 ## Edge case bugs in Parsoid from T93580
14133 !! test
14134 T93580: 1. Templated <ref> inside block images
14135 !! wikitext
14136 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14137
14138 <references />
14139 !! html/parsoid
14140 <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>
14141
14142 <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>
14143 !! end
14144
14145 !! test
14146 T93580: 2. <ref> inside inline images
14147 !! wikitext
14148 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14149
14150 <references />
14151 !! html/parsoid
14152 <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=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><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>
14153
14154 <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>
14155 !! end
14156
14157 !! test
14158 T93580: 3. Templated <ref> inside inline images
14159 !! wikitext
14160 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14161
14162 <references />
14163 !! html/parsoid
14164 <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=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><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>
14165
14166 <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>
14167 !! end
14168
14169 ###
14170 ### Subpages
14171 ###
14172 !! article
14173 Subpage test/subpage
14174 !! text
14175 foo
14176 !! endarticle
14177
14178 !! test
14179 Subpage link
14180 !! options
14181 subpage title=[[Subpage test]]
14182 !! wikitext
14183 [[/subpage]]
14184 !! html
14185 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14186 </p>
14187 !! end
14188
14189 !! test
14190 Subpage noslash link
14191 !! options
14192 subpage title=[[Subpage test]]
14193 !! wikitext
14194 [[/subpage/]]
14195 !! html
14196 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14197 </p>
14198 !! end
14199
14200 !! article
14201 Subpage test/1/2/subpage
14202 !! text
14203 blah
14204 !! endarticle
14205
14206 !! test
14207 Relative subpage noslash link
14208 !! options
14209 parsoid=wt2wt,wt2html,html2html
14210 subpage title=[[Subpage test/1/2/3/4]]
14211 !! wikitext
14212 [[../../subpage/]]
14213
14214 [[../../subpage]]
14215 !! html/php
14216 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14217 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14218 </p>
14219 !! html/parsoid
14220 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14221 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14222 !! end
14223
14224 !! test
14225 Parsoid: dot-slash prefixed wikilinks
14226 !! wikitext
14227 [[./foo]]
14228
14229 [[././bar]]
14230
14231 [[././baz/]]
14232 !! html/php
14233 <p>[[./foo]]
14234 </p><p>[[././bar]]
14235 </p><p>[[././baz/]]
14236 </p>
14237 !! html/parsoid
14238 <p>[[./foo]]
14239 </p><p>[[././bar]]
14240 </p><p>[[././baz/]]
14241 </p>
14242 !! end
14243
14244 !! test
14245 Render invalid page names as plain text (bug 51090)
14246 !! wikitext
14247 [[./../foo|bar]]
14248 [[foo�|bar]]
14249 [[foo/.|bar]]
14250 [[foo/..|bar]]
14251 [[foo~~~bar]]
14252 [[foo>bar]]
14253 [[foo[bar]]
14254 [[.]]
14255 [[..]]
14256 [[foo././bar]]
14257
14258 [[{{echo|./../foo}}|bar]]
14259 [[{{echo|foo/.}}|bar]]
14260 [[{{echo|foo/..}}|bar]]
14261 [[{{echo|foo~~~~bar}}]]
14262 [[{{echo|foo>bar}}]]
14263 [[{{echo|foo././bar}}]]
14264 [[{{echo|foo{bar}}]]
14265 [[{{echo|foo}bar}}]]
14266 [[{{echo|foo[bar}}]]
14267 [[{{echo|foo]bar}}]]
14268 [[{{echo|foo<bar}}]]
14269 !!html/php
14270 <p>[[./../foo|bar]]
14271 [[foo�|bar]]
14272 [[foo/.|bar]]
14273 [[foo/..|bar]]
14274 [[foo~~~bar]]
14275 [[foo&gt;bar]]
14276 [[foo[bar]]
14277 [[.]]
14278 [[..]]
14279 [[foo././bar]]
14280 </p><p>[[./../foo|bar]]
14281 [[foo/.|bar]]
14282 [[foo/..|bar]]
14283 [[foo~~~~bar]]
14284 [[foo&gt;bar]]
14285 [[foo././bar]]
14286 [[foo{bar]]
14287 [[foo}bar]]
14288 [[foo[bar]]
14289 [[foo]bar]]
14290 [[foo&lt;bar]]
14291 </p>
14292 !!html/parsoid
14293 <p>[[./../foo|bar]]
14294 [[foo�|bar]]
14295 [[foo/.|bar]]
14296 [[foo/..|bar]]
14297 [[foo~~~bar]]
14298 [[foo>bar]]
14299 [[foo[bar]]
14300 [[.]]
14301 [[..]]
14302 [[foo././bar]]</p>
14303
14304 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14305 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14306 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14307 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14308 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14309 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14310 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14311 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14312 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14313 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14314 [[<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>
14315 !!end
14316
14317 !! test
14318 Disabled subpages
14319 !! wikitext
14320 [[/subpage]]
14321 !! html
14322 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14323 </p>
14324 !! end
14325
14326 !! test
14327 BUG 561: {{/Subpage}}
14328 !! options
14329 subpage title=[[Page]]
14330 !! wikitext
14331 {{/Subpage}}
14332 !! html
14333 <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>
14334 </p>
14335 !! end
14336
14337 ###
14338 ### Categories
14339 ###
14340 !! article
14341 Category:MediaWiki User's Guide
14342 !! text
14343 blah
14344 !! endarticle
14345
14346 !! test
14347 Link to category
14348 !! wikitext
14349 [[:Category:MediaWiki User's Guide]]
14350 !! html
14351 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14352 </p>
14353 !! end
14354
14355 !! test
14356 Simple category
14357 !! options
14358 cat
14359 !! wikitext
14360 [[Category:MediaWiki User's Guide]]
14361 !! html
14362 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14363 !! end
14364
14365 !! test
14366 PAGESINCATEGORY invalid title fatal (r33546 fix)
14367 !! wikitext
14368 {{PAGESINCATEGORY:<bogus>}}
14369 !! html
14370 <p>0
14371 </p>
14372 !! end
14373
14374 !! test
14375 Category with different sort key
14376 !! options
14377 cat
14378 !! wikitext
14379 [[Category:MediaWiki User's Guide|Foo]]
14380 !! html
14381 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14382 !! end
14383
14384 !! test
14385 Category with identical sort key
14386 !! options
14387 cat
14388 !! wikitext
14389 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14390 !! html
14391 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14392 !! end
14393
14394 !! test
14395 Category with empty sort key
14396 !! options
14397 cat
14398 pst
14399 !! wikitext
14400 [[Category:MediaWiki User's Guide|]]
14401 !! html/php
14402 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14403 !! end
14404
14405 !! test
14406 Category with empty sort key and parentheses
14407 !! options
14408 cat
14409 pst
14410 !! wikitext
14411 [[Category:Foo (bar)|]]
14412 !! html/php
14413 [[Category:Foo (bar)|Foo]]
14414 !! end
14415
14416 ## We used to, but no longer wt2wt this test since the default serializer
14417 ## will normalize all categories to serialize on their own line.
14418 ## This wikitext usage is going to be fairly uncommon in production and
14419 ## selser will take care of preserving formatting in those scenarios.
14420 !! test
14421 Category with link tail
14422 !! options
14423 cat
14424 pst
14425 parsoid=wt2html
14426 !! wikitext
14427 123[[Category:Foo]]456
14428 !! html/php
14429 123[[Category:Foo]]456
14430 !! html/parsoid
14431 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14432 !! end
14433
14434 !! test
14435 Category with template
14436 !! options
14437 cat
14438 pst
14439 !! wikitext
14440 [[Category:{{echo|Foo}}]]
14441 !! html/php
14442 [[Category:{{echo|Foo}}]]
14443 !! end
14444
14445 !! test
14446 Category with template in sort key
14447 !! options
14448 cat
14449 pst
14450 !! wikitext
14451 [[Category:Foo|{{echo|Bar}}]]
14452 !! html/php
14453 [[Category:Foo|{{echo|Bar}}]]
14454 !! end
14455
14456 !! test
14457 Category with template in sort key and title
14458 !! options
14459 cat
14460 pst
14461 !! wikitext
14462 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14463 !! html/php
14464 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14465 !! end
14466
14467 ## We used to, but no longer wt2wt this test since the default serializer
14468 ## will normalize all categories to serialize on their own line.
14469 ## This wikitext usage is going to be fairly uncommon in production and
14470 ## selser will take care of preserving formatting in those scenarios.
14471 !! test
14472 Category / paragraph interactions
14473 !! options
14474 parsoid=wt2html
14475 !! wikitext
14476 Foo [[Category:Baz]] Bar
14477
14478 Foo [[Category:Baz]]
14479 Bar
14480
14481 Foo
14482 [[Category:Baz]]
14483 Bar
14484
14485 Foo
14486 [[Category:Baz]] Bar
14487
14488 Foo
14489 [[Category:Baz]]
14490 [[Category:Baz]]
14491 [[Category:Baz]]
14492 Bar
14493
14494 [[Category:Baz]]
14495 [[Category:Baz]]
14496 [[Category:Baz]]
14497
14498 [[Category:Baz]]
14499 {{echo|[[Category:Baz]]}}
14500 [[Category:Baz]]
14501 !! html/php
14502 <p>Foo Bar
14503 </p><p>Foo
14504 Bar
14505 </p><p>Foo
14506 Bar
14507 </p><p>Foo Bar
14508 </p><p>Foo
14509 Bar
14510 </p>
14511 !! html/parsoid
14512 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14513 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14514 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14515 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14516 <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>
14517 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14518 !! end
14519
14520 ## We used to, but no longer wt2wt this test since the default serializer
14521 ## will normalize all categories to serialize on their own line.
14522 ## This wikitext usage is going to be fairly uncommon in production and
14523 ## selser will take care of preserving formatting in those scenarios.
14524 ##
14525 ## The whitespace on the empty line is part of the test. Please do not delete
14526 !! test
14527 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14528 !! options
14529 parsoid=wt2html
14530 !! wikitext
14531 This
14532
14533 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14534
14535 {{echo|[[Category:Foo]] and so should this!}}
14536 !! html/php
14537 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14538 </p>
14539 !! html/parsoid
14540 <p>This
14541
14542 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14543
14544 <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>
14545 !! end
14546
14547 ## Parsoid will not try to wt2wt this while preserving newlines because
14548 ## it suppresses excess newlines within list items -- and we don't want to
14549 ## introduce a special case just for categories, which is, in reality somewhat
14550 ## odd behavior -- categories are unlikely to be used in list items like this
14551 ## in top-level pages and are only likely to show up in template-generated
14552 ## list items where this RT-ing is a non-issue.
14553 ##
14554 ## The whitespace on the empty line is part of the test. Please do not delete
14555 !! test
14556 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14557 !! options
14558 parsoid=wt2html
14559 !! wikitext
14560 * This
14561
14562 [[Category:Foo]] and this should be part of the same list item
14563 * So should this
14564
14565 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14566 !! html
14567 <ul><li>This and this should be part of the same list item</li>
14568 <li>So should this and this should be part of the same list item</li></ul>
14569 !! html/parsoid
14570 <ul>
14571 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14572 <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>
14573 </ul>
14574 !! end
14575
14576 ## Newlines and categories that follow the last item of a list
14577 ## are treated differently because this (list followed by categories)
14578 ## is an extremely common pattern on wikis.
14579 !! test
14580 3. Categories and newlines: newline suppression for last list item should RT properly
14581 !! wikitext
14582 * a
14583 * b
14584
14585 [[Category:Foo]]
14586
14587 [[Category:Bar]]
14588 [[Category:Baz]]
14589 !! html/parsoid
14590 <ul><li> a</li>
14591 <li> b</li></ul>
14592
14593 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14594
14595 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14596 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14597 !! end
14598
14599 !! test
14600 4. Categories and newlines: newline suppression for last list item should RT properly
14601 !! wikitext
14602 * a
14603 **** b
14604
14605 [[Category:Foo]]
14606 !! html/parsoid
14607 <ul><li> a
14608 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14609
14610 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14611 !! end
14612
14613 ## only wt2html for this to make sure the algo only applies to the rightmost path
14614 !! test
14615 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14616 !! options
14617 parsoid=wt2html
14618 !! wikitext
14619 * a
14620 ** b
14621 [[Category:Foo]]
14622 * c
14623 ** d
14624 [[Category:Foo]]
14625 !! html/parsoid
14626 <ul><li> a
14627 <ul><li> b
14628 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14629 <li> c
14630 <ul><li> d</li></ul></li></ul>
14631 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14632 !! end
14633
14634 ## We used to, but no longer wt2wt this test since the default serializer
14635 ## will normalize all categories to serialize on their own line.
14636 ## This wikitext usage is going to be fairly uncommon in production and
14637 ## selser will take care of preserving formatting in those scenarios.
14638 !! test
14639 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14640 !! options
14641 parsoid=wt2html
14642 !! wikitext
14643 * a [[Category:Foo]]
14644 !! html/parsoid
14645 <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>
14646 !! end
14647
14648 # This test also demonstrates because of newline+category tunneling
14649 # through the list hander, template wrapping doesn't expand to the
14650 # containing list when the list item swallows the category.
14651 !! test
14652 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14653 !! wikitext
14654 * {{echo|a
14655 [[Category:Foo]]}}
14656 !! html/parsoid
14657 <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
14658 </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>
14659 !! end
14660
14661 !! test
14662 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14663 !! wikitext
14664 * a
14665
14666 {{echo|[[Category:Foo]]
14667 [[Category:Bar]]}}
14668 [[Category:Baz]]
14669 !! html/parsoid
14670 <ul><li> a</li></ul>
14671
14672 <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">
14673 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14674 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14675 !! end
14676
14677 !! test
14678 Parsoid: Serialize link to category page with colon escape
14679 !! options
14680 parsoid
14681 !! wikitext
14682
14683 [[:Category:Foo]]
14684 [[:Category:Foo|Bar]]
14685 !! html
14686 <p>
14687 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14688 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14689 </p>
14690 !! end
14691
14692 # We used to, but no longer wt2wt this test since the default serializer
14693 # will normalize all categories to serialize on their own line.
14694 # This wikitext usage is going to be fairly uncommon in production and
14695 # selser will take care of preventing whitespace insertion if this
14696 # occurs in an article.
14697 #
14698 # html2html disabled for the same reason (whitespace insertion between
14699 # x and y).
14700 #
14701 # html2wt disabled because it localizes the "Category" namespace.
14702 !! test
14703 Link prefix/suffixes aren't applied to category links
14704 !! options
14705 parsoid=wt2html
14706 language=is
14707 !! wikitext
14708 x[[Category:Foo]]y
14709 !! html/php
14710 <p>xy
14711 </p>
14712 !! html/parsoid
14713 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14714 !! end
14715
14716 !! test
14717 Parsoid: Serialize link to file page with colon escape
14718 !! options
14719 parsoid
14720 !! wikitext
14721
14722 [[:File:Foo.png]]
14723 [[:File:Foo.png|Bar]]
14724 !! html
14725 <p>
14726 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14727 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14728 </p>
14729 !! end
14730
14731 !! test
14732 Parsoid: Serialize a genuine category link without colon escape
14733 !! options
14734 parsoid
14735 !! wikitext
14736 [[Category:Foo]]
14737 [[Category:Foo|Bar]]
14738 !! html
14739 <link rel="mw:PageProp/Category" href="./Category:Foo">
14740 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14741 !! end
14742
14743 !! test
14744 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14745 !! options
14746 parsoid=html2wt
14747 !! html/parsoid
14748 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14749 !! wikitext
14750 [[Category:Toxine bactérienne]]
14751 !! end
14752
14753 !! test
14754 Parsoid: Defaultsort
14755 !! wikitext
14756 {{DEFAULTSORT:Foo}}
14757 !! html/parsoid
14758 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14759 !! end
14760
14761 !! test
14762 Parsoid: Defaultsort (template-generated)
14763 !! wikitext
14764 {{{{echo|DEFAULTSORT}}:Foo}}
14765 !! html/parsoid
14766 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14767 !! end
14768
14769 ###
14770 ### Inter-language links
14771 ###
14772 !! test
14773 Interlanguage links
14774 !! options
14775 ill
14776 !! wikitext
14777 [[es:Alimento]]
14778 [[fr:Nourriture]]
14779 [[zh:食品]]
14780 !! html/php
14781 es:Alimento fr:Nourriture zh:食品
14782 !! html/parsoid
14783 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14784 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14785 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14786 !! end
14787
14788 !! test
14789 Duplicate interlanguage links (bug 24502)
14790 !! options
14791 ill
14792 !! wikitext
14793 [[es:1]]
14794 [[es:2]]
14795 [[fr:1]]
14796 [[fr:2]]
14797 !! html/php
14798 es:1 fr:1
14799 !! html/parsoid
14800 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14801 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14802 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14803 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14804 !! end
14805
14806 ###
14807 ### Sections
14808 ###
14809 !! test
14810 Basic section headings
14811 !! wikitext
14812 == Headline 1 ==
14813 Some text
14814
14815 ==Headline 2==
14816 More
14817 ===Smaller headline===
14818 Blah blah
14819 !! html
14820 <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>
14821 <p>Some text
14822 </p>
14823 <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>
14824 <p>More
14825 </p>
14826 <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>
14827 <p>Blah blah
14828 </p>
14829 !! end
14830
14831 !! test
14832 Section headings with TOC
14833 !! wikitext
14834 == Headline 1 ==
14835 === Subheadline 1 ===
14836 ===== Skipping a level =====
14837 ====== Skipping a level ======
14838
14839 == Headline 2 ==
14840 Some text
14841 ===Another headline===
14842 !! html
14843 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14844 <ul>
14845 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14846 <ul>
14847 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14848 <ul>
14849 <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>
14850 <ul>
14851 <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>
14852 </ul>
14853 </li>
14854 </ul>
14855 </li>
14856 </ul>
14857 </li>
14858 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14859 <ul>
14860 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14861 </ul>
14862 </li>
14863 </ul>
14864 </div>
14865
14866 <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>
14867 <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>
14868 <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>
14869 <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>
14870 <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>
14871 <p>Some text
14872 </p>
14873 <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>
14874
14875 !! end
14876
14877 !! test
14878 TOC anchors don't collide
14879 !! wikitext
14880 __FORCETOC__
14881 == Headline 2 ==
14882 == Headline ==
14883 == Headline 2 ==
14884 == Headline ==
14885 !! html/php
14886 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14887 <ul>
14888 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14889 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14890 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14891 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14892 </ul>
14893 </div>
14894
14895 <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>
14896 <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>
14897 <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>
14898 <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>
14899
14900 !! end
14901
14902 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14903 !! test
14904 Handling of sections up to level 6 and beyond
14905 !! wikitext
14906 = Level 1 Heading=
14907 == Level 2 Heading==
14908 === Level 3 Heading===
14909 ==== Level 4 Heading====
14910 ===== Level 5 Heading=====
14911 ====== Level 6 Heading======
14912 ======= Level 7 Heading=======
14913 ======== Level 8 Heading========
14914 ========= Level 9 Heading=========
14915 ========== Level 10 Heading==========
14916 !! html
14917 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14918 <ul>
14919 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14920 <ul>
14921 <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>
14922 <ul>
14923 <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>
14924 <ul>
14925 <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>
14926 <ul>
14927 <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>
14928 <ul>
14929 <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>
14930 <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>
14931 <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>
14932 <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>
14933 <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>
14934 </ul>
14935 </li>
14936 </ul>
14937 </li>
14938 </ul>
14939 </li>
14940 </ul>
14941 </li>
14942 </ul>
14943 </li>
14944 </ul>
14945 </div>
14946
14947 <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>
14948 <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>
14949 <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>
14950 <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>
14951 <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>
14952 <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>
14953 <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>
14954 <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>
14955 <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>
14956 <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>
14957
14958 !! end
14959
14960 !! test
14961 TOC regression (T11764)
14962 !! wikitext
14963 == title 1 ==
14964 === title 1.1 ===
14965 ==== title 1.1.1 ====
14966 === title 1.2 ===
14967 == title 2 ==
14968 === title 2.1 ===
14969 !! html
14970 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14971 <ul>
14972 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14973 <ul>
14974 <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>
14975 <ul>
14976 <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>
14977 </ul>
14978 </li>
14979 <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>
14980 </ul>
14981 </li>
14982 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14983 <ul>
14984 <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>
14985 </ul>
14986 </li>
14987 </ul>
14988 </div>
14989
14990 <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>
14991 <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>
14992 <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>
14993 <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>
14994 <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>
14995 <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>
14996
14997 !! end
14998
14999 !! test
15000 TOC for heading containing <span id="..."></span> (T96153)
15001 !! wikitext
15002 __FORCETOC__
15003 ==<span id="old-anchor"></span>New title==
15004 !! html/php
15005 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15006 <ul>
15007 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15008 </ul>
15009 </div>
15010
15011 <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>
15012
15013 !! end
15014
15015 !! test
15016 TOC with wgMaxTocLevel=3 (bug 6204)
15017 !! options
15018 wgMaxTocLevel=3
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></li>
15032 <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>
15033 </ul>
15034 </li>
15035 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15036 <ul>
15037 <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>
15038 </ul>
15039 </li>
15040 </ul>
15041 </div>
15042
15043 <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>
15044 <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>
15045 <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>
15046 <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>
15047 <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>
15048 <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>
15049
15050 !! end
15051
15052 !! test
15053 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15054 !! options
15055 wgMaxTocLevel=3
15056 !! wikitext
15057 ==Section 1==
15058 ===Section 1.1===
15059 ====Section 1.1.1====
15060 ====Section 1.1.1.1====
15061 ==Section 2==
15062 !! html
15063 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15064 <ul>
15065 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15066 <ul>
15067 <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>
15068 </ul>
15069 </li>
15070 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15071 </ul>
15072 </div>
15073
15074 <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>
15075 <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>
15076 <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>
15077 <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>
15078 <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>
15079
15080 !! end
15081
15082
15083 !! test
15084 Resolving duplicate section names
15085 !! wikitext
15086 == Foo bar ==
15087 == Foo bar ==
15088 !! html
15089 <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>
15090 <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>
15091
15092 !! end
15093
15094 !! test
15095 Resolving duplicate section names with differing case (bug 10721)
15096 !! wikitext
15097 == Foo bar ==
15098 == Foo Bar ==
15099 !! html
15100 <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>
15101 <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>
15102
15103 !! end
15104
15105 !! article
15106 Template:sections
15107 !! text
15108 ===Section 1===
15109 ==Section 2==
15110 !! endarticle
15111
15112 !! test
15113 Template with sections, __NOTOC__
15114 !! wikitext
15115 __NOTOC__
15116 ==Section 0==
15117 {{sections}}
15118 ==Section 4==
15119 !! html
15120 <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>
15121 <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>
15122 <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>
15123 <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>
15124
15125 !! end
15126
15127 !! test
15128 __NOEDITSECTION__ keyword
15129 !! wikitext
15130 __NOEDITSECTION__
15131 ==Section 1==
15132 ==Section 2==
15133 !! html
15134 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15135 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15136
15137 !! end
15138
15139 !! test
15140 Link inside a section heading
15141 !! wikitext
15142 ==Section with a [[Main Page|link]] in it==
15143 !! html
15144 <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>
15145
15146 !! end
15147
15148 !! test
15149 TOC regression (T14077)
15150 !! wikitext
15151 __TOC__
15152 == title 1 ==
15153 === title 1.1 ===
15154 == title 2 ==
15155 !! html
15156 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15157 <ul>
15158 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15159 <ul>
15160 <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>
15161 </ul>
15162 </li>
15163 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15164 </ul>
15165 </div>
15166
15167 <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>
15168 <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>
15169 <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>
15170
15171 !! end
15172
15173 !! test
15174 BUG 1219 URL next to image (good)
15175 !! wikitext
15176 http://example.com [[File:Foobar.jpg]]
15177 !! html/php
15178 <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>
15179 </p>
15180 !! html/parsoid
15181 <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>
15182 !!end
15183
15184 !! test
15185 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15186 !! wikitext
15187 ===
15188 The line above must have a trailing space!
15189 === <!--
15190 --> <!-- -->
15191 But just in case it doesn't...
15192 !! html
15193 <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>
15194 <p>The line above must have a trailing space!
15195 </p>
15196 <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>
15197 <p>But just in case it doesn't...
15198 </p>
15199 !! end
15200
15201 !! test
15202 Header with special characters (bug 25462)
15203 !! wikitext
15204 The tooltips shall not show entities to the user (ie. be double escaped)
15205
15206 == text > text ==
15207 section 1
15208
15209 == text < text ==
15210 section 2
15211
15212 == text & text ==
15213 section 3
15214
15215 == text ' text ==
15216 section 4
15217
15218 == text " text ==
15219 section 5
15220 !! html
15221 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15222 </p>
15223 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15224 <ul>
15225 <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>
15226 <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>
15227 <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>
15228 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15229 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15230 </ul>
15231 </div>
15232
15233 <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>
15234 <p>section 1
15235 </p>
15236 <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>
15237 <p>section 2
15238 </p>
15239 <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>
15240 <p>section 3
15241 </p>
15242 <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>
15243 <p>section 4
15244 </p>
15245 <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>
15246 <p>section 5
15247 </p>
15248 !! end
15249
15250 !! test
15251 Header with space, plus and underscore as entity
15252 !! wikitext
15253 Id should not contain + for spaces
15254
15255 == Space between Text ==
15256 section 1
15257
15258 == Space-Entity&#32;between&#32;Text ==
15259 section 2
15260
15261 == Plus+between+Text ==
15262 section 3
15263
15264 == Plus-Entity&#43;between&#43;Text ==
15265 section 4
15266
15267 == Underscore_between_Text ==
15268 section 5
15269
15270 == Underscore-Entity&#95;between&#95;Text ==
15271 section 6
15272
15273 [[#Space between Text]]
15274 [[#Space-Entity&#32;between&#32;Text]]
15275 [[#Plus+between+Text]]
15276 [[#Plus-Entity&#43;between&#43;Text]]
15277 [[#Underscore_between_Text]]
15278 [[#Underscore-Entity&#95;between&#95;Text]]
15279 !! html
15280 <p>Id should not contain + for spaces
15281 </p>
15282 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15283 <ul>
15284 <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>
15285 <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>
15286 <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>
15287 <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>
15288 <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>
15289 <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>
15290 </ul>
15291 </div>
15292
15293 <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>
15294 <p>section 1
15295 </p>
15296 <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>
15297 <p>section 2
15298 </p>
15299 <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>
15300 <p>section 3
15301 </p>
15302 <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>
15303 <p>section 4
15304 </p>
15305 <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>
15306 <p>section 5
15307 </p>
15308 <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>
15309 <p>section 6
15310 </p><p><a href="#Space_between_Text">#Space between Text</a>
15311 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15312 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15313 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15314 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15315 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15316 </p>
15317 !! end
15318
15319 !! test
15320 Headers with excess '=' characters
15321 (Are similar tests necessary beyond the 1st level?)
15322 !! wikitext
15323 =foo==
15324 ==foo=
15325 =''italic'' heading==
15326 ==''italic'' heading=
15327 !! html
15328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15329 <ul>
15330 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15331 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15332 <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>
15333 <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>
15334 </ul>
15335 </div>
15336
15337 <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>
15338 <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>
15339 <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>
15340 <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>
15341
15342 !! end
15343
15344 !! test
15345 HTML headers vs TOC (bug 23393)
15346 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15347 !! wikitext
15348 <h1>Header 1</h1>
15349 == Header 1.1 ==
15350 == Header 1.2 ==
15351
15352 <h1>Header 2
15353 </h1>
15354 == Header 2.1 ==
15355 == Header 2.2 ==
15356 __NOEDITSECTION__
15357 !! html
15358 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15359 <ul>
15360 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15361 <ul>
15362 <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>
15363 <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>
15364 </ul>
15365 </li>
15366 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15367 <ul>
15368 <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>
15369 <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>
15370 </ul>
15371 </li>
15372 </ul>
15373 </div>
15374
15375 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15376 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15377 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15378 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15379 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15380 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15381
15382 !! end
15383
15384 !! test
15385 Single-line or multiline-comments can follow headings
15386 !! options
15387 parsoid=wt2html,wt2wt
15388 !! wikitext
15389 ==foo==<!---->
15390 ==bar==<!--c1-->
15391 ==baz==<!--
15392 c2
15393 c3-->
15394 !! html
15395 <h2><span class="mw-headline" id="foo">foo</span></h2>
15396 <h2><span class="mw-headline" id="bar">bar</span></h2>
15397 <h2><span class="mw-headline" id="baz">baz</span></h2>
15398
15399 !! end
15400
15401 !! test
15402 BUG 1219 URL next to image (broken)
15403 !! wikitext
15404 http://example.com[[File:Foobar.jpg]]
15405 !! html/php
15406 <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>
15407 </p>
15408 !! html/parsoid
15409 <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>
15410 !!end
15411
15412 !! test
15413 Bug 1186 news: in the middle of text
15414 !! wikitext
15415 http://en.wikinews.org/wiki/Wikinews:Workplace
15416 !! html
15417 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15418 </p>
15419 !!end
15420
15421
15422 !! test
15423 Namespaced link must have a title
15424 !! wikitext
15425 [[Project:]]
15426 !! html
15427 <p>[[Project:]]
15428 </p>
15429 !!end
15430
15431 !! test
15432 Namespaced link must have a title (bad fragment version)
15433 !! wikitext
15434 [[Project:#fragment]]
15435 !! html
15436 <p>[[Project:#fragment]]
15437 </p>
15438 !!end
15439
15440
15441 ###
15442 ### HTML tags and HTML attributes
15443 ###
15444
15445 !! test
15446 div with no attributes
15447 !! wikitext
15448 <div>HTML rocks</div>
15449 !! html
15450 <div>HTML rocks</div>
15451
15452 !! end
15453
15454 !! test
15455 div with double-quoted attribute
15456 !! wikitext
15457 <div id="rock">HTML rocks</div>
15458 !! html
15459 <div id="rock">HTML rocks</div>
15460
15461 !! end
15462
15463 !! test
15464 div with single-quoted attribute
15465 !! wikitext
15466 <div id='rock'>HTML rocks</div>
15467 !! html
15468 <div id="rock">HTML rocks</div>
15469
15470 !! end
15471
15472 !! test
15473 div with unquoted attribute
15474 !! wikitext
15475 <div id=rock>HTML rocks</div>
15476 !! html
15477 <div id="rock">HTML rocks</div>
15478
15479 !! end
15480
15481 !! test
15482 div with illegal double attributes
15483 !! wikitext
15484 <div id="a" id="b">HTML rocks</div>
15485 !! html
15486 <div id="b">HTML rocks</div>
15487
15488 !!end
15489
15490 !! test
15491 div with empty attribute value, space before equals
15492 !! options
15493 parsoid=wt2html,html2html
15494 !! wikitext
15495 <div class =>HTML rocks</div>
15496 !! html/php
15497 <div class="">HTML rocks</div>
15498
15499 !! html/parsoid
15500 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15501 !! end
15502
15503 !! test
15504 div with multiple empty attribute values
15505 !! options
15506 parsoid=wt2html,html2html
15507 !! wikitext
15508 <div id= title=>HTML rocks</div>
15509 !! html/php
15510 <div id="title.3D">HTML rocks</div>
15511
15512 !! html/parsoid
15513 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15514 !! end
15515
15516 !! test
15517 table with multiple empty attribute values
15518 !! options
15519 parsoid=wt2html,html2html
15520 !! wikitext
15521 {| title= id=
15522 | hi
15523 |}
15524 !! html/php
15525 <table title="id=">
15526 <tr>
15527 <td> hi
15528 </td></tr></table>
15529
15530 !! html/parsoid
15531 <table title="id=">
15532 <tbody><tr><td> hi</td></tr>
15533 </tbody></table>
15534 !! end
15535
15536 !! test
15537 div with braces in attribute value
15538 !! wikitext
15539 <div title="{}">Foo</div>
15540 !! html/php
15541 <div title="&#123;}">Foo</div>
15542
15543 !! html/parsoid
15544 <div title="{}">Foo</div>
15545 !! end
15546
15547 !! test
15548 div with empty attribute value, no 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="">HTML rocks</div>
15558 !! end
15559
15560 !! test
15561 HTML multiple attributes correction
15562 !! wikitext
15563 <p class="error" class="awesome">Awesome!</p>
15564 !! html
15565 <p class="awesome">Awesome!</p>
15566
15567 !!end
15568
15569 !! test
15570 Table multiple attributes correction
15571 !! wikitext
15572 {|
15573 !+ class="error" class="awesome"| status
15574 |}
15575 !! html
15576 <table>
15577 <tr>
15578 <th class="awesome"> status
15579 </th></tr></table>
15580
15581 !!end
15582
15583 !! test
15584 DIV IN UPPERCASE
15585 !! wikitext
15586 <DIV ID="x">HTML ROCKS</DIV>
15587 !! html
15588 <div id="x">HTML ROCKS</div>
15589
15590 !!end
15591
15592 !! test
15593 Non-ASCII pseudo-tags are rendered as text
15594 !! wikitext
15595 <khyô>
15596 !! html
15597 <p>&lt;khyô&gt;
15598 </p>
15599 !! end
15600
15601 !! test
15602 Pseudo-tag with URL 'name' renders as url link
15603 !! wikitext
15604 <http://example.com/>
15605 !! html
15606 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15607 </p>
15608 !! end
15609
15610 !! test
15611 text with amp in the middle of nowhere
15612 !! wikitext
15613 Remember AT&T?
15614 !! html
15615 <p>Remember AT&amp;T?
15616 </p>
15617 !! end
15618
15619 !! test
15620 text with character entity: eacute
15621 !! wikitext
15622 I always thought &eacute; was a cute letter.
15623 !! html
15624 <p>I always thought &#233; was a cute letter.
15625 </p>
15626 !! html+tidy
15627 <p>I always thought é was a cute letter.</p>
15628 !! end
15629
15630 !! test
15631 text with entity-escaped character entity-like string: eacute
15632 !! wikitext
15633 I always thought &amp;eacute; was a cute letter.
15634 !! html
15635 <p>I always thought &amp;eacute; was a cute letter.
15636 </p>
15637 !! end
15638
15639 !! test
15640 text with undefined character entity: xacute
15641 !! wikitext
15642 I always thought &xacute; was a cute letter.
15643 !! html
15644 <p>I always thought &amp;xacute; was a cute letter.
15645 </p>
15646 !! end
15647
15648 !! test
15649 HTML5 tags
15650 !! wikitext
15651 <data value="5">five</data>
15652 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15653 <mark>This highlighted text</mark>
15654 !! html
15655 <p><data value="5">five</data>
15656 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15657 <mark>This highlighted text</mark>
15658 </p>
15659 !! end
15660
15661 !! test
15662 HTML tag with leading space is parsed as text
15663 !! wikitext
15664 < div>foo< /div>
15665 !! html
15666 <p>&lt; div&gt;foo&lt; /div&gt;
15667 </p>
15668 !! end
15669
15670 ###
15671 ### Nesting tests (see bug 41545, 50604, 51081)
15672 ###
15673
15674 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15675 # Note that html2wt is considerably more difficult if we use <b> in
15676 # the test case, instead of <big>
15677 !! test
15678 Ensure that HTML adoption agency algorithm is properly implemented.
15679 !! wikitext
15680 <big>X<big>Y</big>Z</big>
15681 !! html
15682 <p><big>X<big>Y</big>Z</big>
15683 </p>
15684 !! end
15685
15686 # This was bug 41545 in the PHP parser.
15687 # Note that tidy doesn't handle this correctly.
15688 !! test
15689 Nesting of <kbd>
15690 !! wikitext
15691 <kbd>X<kbd>Y</kbd>Z</kbd>
15692 !! html
15693 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15694 </p>
15695 !! end
15696
15697 # The following cases were bug 51081 in the PHP parser.
15698 # Note that there are some other nestable tags (b, i, etc) which are
15699 # not covered; see bug 51081 for discussion.
15700
15701 # Note that tidy doesn't handle this correctly.
15702 !! test
15703 Nesting of <em>
15704 !! wikitext
15705 <em>X<em>Y</em>Z</em>
15706 !! html
15707 <p><em>X<em>Y</em>Z</em>
15708 </p>
15709 !! end
15710
15711 # Note that tidy doesn't handle this correctly.
15712 !! test
15713 Nesting of <strong>
15714 !! wikitext
15715 <strong>X<strong>Y</strong>Z</strong>
15716 !! html
15717 <p><strong>X<strong>Y</strong>Z</strong>
15718 </p>
15719 !! end
15720
15721 !! test
15722 Nesting of <q>
15723 !! wikitext
15724 <q>X<q>Y</q>Z</q>
15725 !! html+tidy
15726 <p><q>X<q>Y</q>Z</q></p>
15727 !! end
15728
15729 # Note that tidy doesn't handle this correctly.
15730 !! test
15731 Nesting of <ruby>
15732 !! wikitext
15733 <ruby>X<ruby>Y</ruby>Z</ruby>
15734 !! html
15735 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15736 </p>
15737 !! end
15738
15739 # Note that tidy doesn't handle this correctly.
15740 !! test
15741 Nesting of <bdo>
15742 !! wikitext
15743 <bdo>X<bdo>Y</bdo>Z</bdo>
15744 !! html
15745 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15746 </p>
15747 !! end
15748
15749
15750 ###
15751 ### Media links
15752 ###
15753
15754 !! test
15755 Media link
15756 !! wikitext
15757 [[Media:Foobar.jpg]]
15758 !! html
15759 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15760 </p>
15761 !! end
15762
15763 !! test
15764 Media link with text
15765 !! wikitext
15766 [[Media:Foobar.jpg|A neat file to look at]]
15767 !! html
15768 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15769 </p>
15770 !! end
15771
15772 # FIXME: this is still bad HTML tag nesting
15773 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15774 !! test
15775 Media link with nasty text
15776 !! wikitext
15777 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15778 !! html
15779 <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>
15780
15781 !! html+tidy
15782 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15783 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15784 !! end
15785
15786 !! test
15787 Media link to nonexistent file (bug 1702)
15788 !! wikitext
15789 [[Media:No such.jpg]]
15790 !! html
15791 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15792 </p>
15793 !! end
15794
15795 !! test
15796 Image link to nonexistent file (bug 1850 - good)
15797 !! wikitext
15798 [[File:No_such.jpg]]
15799 !! html/php
15800 <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>
15801 </p>
15802 !! html/parsoid
15803 <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>
15804 !! end
15805
15806 !! test
15807 :Image link to nonexistent file (bug 1850 - bad)
15808 !! wikitext
15809 [[:Image:No such.jpg]]
15810 !! html/php
15811 <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>
15812 </p>
15813 !! html/parsoid
15814 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15815 !! end
15816
15817
15818
15819 !! test
15820 Character reference normalization in link text (bug 1938)
15821 !! wikitext
15822 [[Main Page|this&that]]
15823 !! html
15824 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15825 </p>
15826 !!end
15827
15828 !! article
15829 אַ
15830 !! text
15831 Test for unicode normalization
15832
15833 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15834 !! endarticle
15835
15836 !! test
15837 (bug 19451) Links should refer to the normalized form.
15838 !! wikitext
15839 [[&#xFB2E;]]
15840 [[&#x5d0;&#x5b7;]]
15841 [[&#x5d0;ַ]]
15842 [[א&#x5b7;]]
15843 [[אַ]]
15844 !! html
15845 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15846 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15847 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15848 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15849 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15850 </p>
15851 !! end
15852
15853 !! test
15854 Empty attribute crash test (bug 2067)
15855 !! wikitext
15856 <font color="">foo</font>
15857 !! html
15858 <p><font color="">foo</font>
15859 </p>
15860 !! end
15861
15862 !! test
15863 Empty attribute crash test single-quotes (bug 2067)
15864 !! wikitext
15865 <font color=''>foo</font>
15866 !! html
15867 <p><font color="">foo</font>
15868 </p>
15869 !! end
15870
15871 !! test
15872 Attribute test: equals, then nothing
15873 !! options
15874 parsoid=wt2html,html2html
15875 !! wikitext
15876 <font color=>foo</font>
15877 !! html/php
15878 <p><font color="">foo</font>
15879 </p>
15880 !! html/parsoid
15881 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15882 !! end
15883
15884 !! test
15885 Attribute test: unquoted value
15886 !! options
15887 parsoid=wt2html,html2html
15888 !! wikitext
15889 <font color=x>foo</font>
15890 !! html/php
15891 <p><font color="x">foo</font>
15892 </p>
15893 !! html/parsoid
15894 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15895 !! end
15896
15897 !! test
15898 Attribute test: unquoted but illegal value (hash)
15899 !! wikitext
15900 <font color=#x>foo</font>
15901 !! html
15902 <p><font color="#x">foo</font>
15903 </p>
15904 !! end
15905
15906 # Parsoid does not serialize to empty attribute syntax,
15907 # so wt2wt and html2wt cases are skipped
15908 !! test
15909 Attribute test: no value (T54330)
15910 !! options
15911 parsoid=wt2html,html2html
15912 !! wikitext
15913 <font color>foo</font>
15914 !! html/php
15915 <p><font color="">foo</font>
15916 </p>
15917 !! html/parsoid
15918 <p><font color="">foo</font></p>
15919 !! end
15920
15921 !! test
15922 Bug 2095: link with three closing brackets
15923 !! wikitext
15924 [[Main Page]]]
15925 !! html/php
15926 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15927 </p>
15928 !! html/parsoid
15929 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15930 !! end
15931
15932 !! test
15933 Bug 2095: link with pipe and three closing brackets
15934 !! wikitext
15935 [[Main Page|link]]]
15936 !! html/php
15937 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15938 </p>
15939 !! html/parsoid
15940 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15941 !! end
15942
15943 !! test
15944 Bug 2095: link with pipe and three closing brackets, version 2
15945 !! wikitext
15946 [[Main Page|[http://example.com/]]]
15947 !! html/php
15948 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15949 </p>
15950 !! html/parsoid
15951 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15952 !! end
15953
15954
15955 ###
15956 ### Safety
15957 ###
15958
15959 !! article
15960 Template:Dangerous attribute
15961 !! text
15962 " onmouseover="alert(document.cookie)
15963 !! endarticle
15964
15965 !! article
15966 Template:Dangerous style attribute
15967 !! text
15968 border-size: expression(alert(document.cookie))
15969 !! endarticle
15970
15971 !! article
15972 Template:Div style
15973 !! text
15974 <div style="float: right; {{{1}}}">Magic div</div>
15975 !! endarticle
15976
15977 !! test
15978 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15979 !! wikitext
15980 <div title="{{test}}"></div>
15981 !! html
15982 <div title="This is a test template"></div>
15983
15984 !! end
15985
15986 # Parsoid has enough context to handle this case
15987 !! test
15988 Bug 2304: HTML attribute safety (dangerous template; 2309)
15989 !! wikitext
15990 <div title="{{dangerous attribute}}"></div>
15991 !! html/php
15992 <div title=""></div>
15993
15994 !! html/parsoid
15995 <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=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
15996 !! end
15997
15998 !! test
15999 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16000 !! wikitext
16001 <div style="{{dangerous style attribute}}"></div>
16002 !! html
16003 <div style="/* insecure input */"></div>
16004
16005 !! end
16006
16007 !! test
16008 Bug 2304: HTML attribute safety (safe parameter; 2309)
16009 !! wikitext
16010 {{div style|width: 200px}}
16011 !! html
16012 <div style="float: right; width: 200px">Magic div</div>
16013
16014 !! end
16015
16016 !! test
16017 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16018 !! wikitext
16019 {{div style|width: expression(alert(document.cookie))}}
16020 !! html
16021 <div style="/* insecure input */">Magic div</div>
16022
16023 !! end
16024
16025 !! test
16026 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16027 !! wikitext
16028 {{div style|"><script>alert(document.cookie)</script>}}
16029 !! html
16030 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16031
16032 !! end
16033
16034 !! test
16035 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16036 !! wikitext
16037 {{div style|" ><script>alert(document.cookie)</script>}}
16038 !! html
16039 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16040
16041 !! end
16042
16043 !! test
16044 Bug 2304: HTML attribute safety (link)
16045 !! wikitext
16046 <div title="[[Main Page]]"></div>
16047 !! html
16048 <div title="&#91;&#91;Main Page]]"></div>
16049
16050 !! end
16051
16052 !! test
16053 Bug 2304: HTML attribute safety (italics)
16054 !! wikitext
16055 <div title="''foobar''"></div>
16056 !! html
16057 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16058
16059 !! end
16060
16061 !! test
16062 Bug 2304: HTML attribute safety (bold)
16063 !! wikitext
16064 <div title="'''foobar'''"></div>
16065 !! html
16066 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16067
16068 !! end
16069
16070
16071 !! test
16072 Bug 2304: HTML attribute safety (ISBN)
16073 !! wikitext
16074 <div title="ISBN 1234567890"></div>
16075 !! html
16076 <div title="&#73;SBN 1234567890"></div>
16077
16078 !! end
16079
16080 !! test
16081 Bug 2304: HTML attribute safety (RFC)
16082 !! wikitext
16083 <div title="RFC 1234"></div>
16084 !! html
16085 <div title="&#82;FC 1234"></div>
16086
16087 !! end
16088
16089 !! test
16090 Bug 2304: HTML attribute safety (PMID)
16091 !! wikitext
16092 <div title="PMID 1234567890"></div>
16093 !! html
16094 <div title="&#80;MID 1234567890"></div>
16095
16096 !! end
16097
16098 !! test
16099 Bug 2304: HTML attribute safety (web link)
16100 !! wikitext
16101 <div title="http://example.com/"></div>
16102 !! html
16103 <div title="http&#58;//example.com/"></div>
16104
16105 !! end
16106
16107 !! test
16108 Bug 2304: HTML attribute safety (named web link)
16109 !! wikitext
16110 <div title="[http://example.com/ link]"></div>
16111 !! html
16112 <div title="&#91;http&#58;//example.com/ link]"></div>
16113
16114 !! end
16115
16116 !! test
16117 Bug 3244: HTML attribute safety (extension; safe)
16118 !! wikitext
16119 <div style="<nowiki>background:blue</nowiki>"></div>
16120 !! html
16121 <div style="background:blue"></div>
16122
16123 !! end
16124
16125 !! test
16126 Bug 3244: HTML attribute safety (extension; unsafe)
16127 !! wikitext
16128 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16129 !! html
16130 <div style="/* insecure input */"></div>
16131
16132 !! end
16133
16134 # More MSIE fun discovered by Tom Gilder
16135
16136 !! test
16137 MSIE CSS safety test: spurious slash
16138 !! wikitext
16139 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16140 !! html
16141 <div style="/* insecure input */">evil</div>
16142
16143 !! end
16144
16145 !! test
16146 MSIE CSS safety test: hex code
16147 !! wikitext
16148 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16149 !! html
16150 <div style="/* insecure input */">evil</div>
16151
16152 !! end
16153
16154 !! test
16155 MSIE CSS safety test: comment in url
16156 !! wikitext
16157 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16158 !! html
16159 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16160
16161 !! end
16162
16163 !! test
16164 MSIE CSS safety test: comment in expression
16165 !! wikitext
16166 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16167 !! html
16168 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16169
16170 !! end
16171
16172 !! test
16173 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16174 !! wikitext
16175 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16176 !! html
16177 <p style="/* invalid control char */">A</p>
16178
16179 !! end
16180
16181 !! test
16182 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16183 !! wikitext
16184 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16185 <div style="top:EXPRESSION(alert())">B</div>
16186 !! html
16187 <p style="/* insecure input */">A</p>
16188 <div style="/* insecure input */">B</div>
16189
16190 !! end
16191
16192 !! test
16193 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16194 !! wikitext
16195 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16196 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16197 !! html
16198 <div style="/* insecure input */">A</div>
16199 <p style="/* insecure input */">B</p>
16200
16201 !! end
16202
16203 !! test
16204 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16205 !! wikitext
16206 <div style="background-image:url⁽javascript:alert())">A</div>
16207 <div style="background-image:url₍javascript:alert())">B</div>
16208 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16209 !! html
16210 <div style="/* insecure input */">A</div>
16211 <div style="/* insecure input */">B</div>
16212 <p style="/* insecure input */">C</p>
16213
16214 !! end
16215
16216 # FIXME: Parsoid fails to sanitize this! See T58846.
16217 !! test
16218 Opera -o-link CSS
16219 !! wikitext
16220 <div
16221 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;"
16222 style="-o-link:attr(title);-o-link-source:current">X</div>
16223 !! html
16224 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16225
16226 !! end
16227
16228 !! test
16229 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16230 !! wikitext
16231 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16232 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16233 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16234 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16235 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16236 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16237 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16238 !! html
16239 <p style="/* insecure input */">A</p>
16240 <p style="/* insecure input */">B</p>
16241 <p style="/* insecure input */">C</p>
16242 <p style="/* insecure input */">D</p>
16243 <p style="/* insecure input */">E</p>
16244 <p style="/* insecure input */">F</p>
16245 <p style="/* insecure input */">G</p>
16246
16247 !! end
16248
16249 !! test
16250 Table attribute legitimate extension
16251 !! wikitext
16252 {|
16253 !+ style="<nowiki>color:blue</nowiki>"| status
16254 |}
16255 !! html
16256 <table>
16257 <tr>
16258 <th style="color:blue"> status
16259 </th></tr></table>
16260
16261 !!end
16262
16263 !! test
16264 Table attribute safety
16265 !! wikitext
16266 {|
16267 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16268 |}
16269 !! html
16270 <table>
16271 <tr>
16272 <th style="/* insecure input */"> status
16273 </th></tr></table>
16274
16275 !! end
16276
16277 !! test
16278 CSS line continuation 1
16279 !! wikitext
16280 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16281 !! html
16282 <div style="/* insecure input */"></div>
16283
16284 !! end
16285
16286 !! test
16287 CSS line continuation 2
16288 !! wikitext
16289 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16290 !! html
16291 <div style="/* invalid control char */"></div>
16292
16293 !! end
16294
16295 !! article
16296 Template:Identity
16297 !! text
16298 {{{1}}}
16299 !! endarticle
16300
16301 !! test
16302 Expansion of multi-line templates in attribute values (bug 6255)
16303 !! wikitext
16304 <div style="background: {{identity|#00FF00}}">-</div>
16305 !! html
16306 <div style="background: #00FF00">-</div>
16307
16308 !! end
16309
16310
16311 !! test
16312 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16313 !! wikitext
16314 <div style="background:
16315 #00FF00">-</div>
16316 !! html/php
16317 <div style="background: #00FF00">-</div>
16318
16319 !! html/parsoid
16320 <div style="background:
16321 #00FF00">-</div>
16322 !! end
16323
16324 !! test
16325 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16326 !! wikitext
16327 <div style="background: &#10;#00FF00">-</div>
16328 !! html
16329 <div style="background: &#10;#00FF00">-</div>
16330
16331 !! end
16332
16333 !! test
16334 evil <math>-wiki-tags without Extension:Math enabled
16335 !! wikitext
16336 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16337 !! html+tidy
16338 <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>
16339 !! end
16340
16341 ###
16342 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16343 ###
16344 !! test
16345 Parser hook: empty input
16346 !! wikitext
16347 <tag></tag>
16348 !! html/php
16349 <pre>
16350 ''
16351 array (
16352 )
16353 </pre>
16354
16355 !! html/parsoid
16356 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16357 !! end
16358
16359 ## Don't expect parsoid to rt this form.
16360 !! test
16361 Parser hook: empty input using terminated empty elements
16362 !! options
16363 parsoid=wt2html,html2html
16364 !! wikitext
16365 <tag/>
16366 !! html/php
16367 <pre>
16368 NULL
16369 array (
16370 )
16371 </pre>
16372
16373 !! html/parsoid
16374 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16375 !! end
16376
16377 !! test
16378 Parser hook: empty input using terminated empty elements (space before)
16379 !! wikitext
16380 <tag />
16381 !! html/php
16382 <pre>
16383 NULL
16384 array (
16385 )
16386 </pre>
16387
16388 !! html/parsoid
16389 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16390 !! end
16391
16392 !! test
16393 Parser hook: basic input
16394 !! wikitext
16395 <tag>input</tag>
16396 !! html/php
16397 <pre>
16398 'input'
16399 array (
16400 )
16401 </pre>
16402
16403 !! html/parsoid
16404 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16405 !! end
16406
16407 ## Don't expect parsoid to rt this form.
16408 !! test
16409 Parser hook: case insensitive
16410 !! options
16411 parsoid=wt2html,html2html
16412 !! wikitext
16413 <TAG>input</TAG>
16414 !! html/php
16415 <pre>
16416 'input'
16417 array (
16418 )
16419 </pre>
16420
16421 !! html/parsoid
16422 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16423 !! end
16424
16425 ## Don't expect parsoid to rt this form.
16426 !! test
16427 Parser hook: case insensitive, redux
16428 !! options
16429 parsoid=wt2html,html2html
16430 !! wikitext
16431 <TaG>input</TAg>
16432 !! html/php
16433 <pre>
16434 'input'
16435 array (
16436 )
16437 </pre>
16438
16439 !! html/parsoid
16440 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16441 !! end
16442
16443 !! test
16444 Parser hook: nested tags
16445 !! wikitext
16446 <tag><tag></tag></tag>
16447 !! html/php
16448 <pre>
16449 '<tag>'
16450 array (
16451 )
16452 </pre>&lt;/tag&gt;
16453
16454 !! html/parsoid
16455 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16456 !! end
16457
16458 !! test
16459 Parser hook: basic arguments
16460 !! wikitext
16461 <tag width="200" height="100" depth="50" square=""></tag>
16462 !! html/php
16463 <pre>
16464 ''
16465 array (
16466 'width' => '200',
16467 'height' => '100',
16468 'depth' => '50',
16469 'square' => '',
16470 )
16471 </pre>
16472
16473 !! html/parsoid
16474 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16475 !! end
16476
16477 ## Don't expect parsoid to rt this form.
16478 !! test
16479 Parser hook: basic arguments, variations
16480 !! options
16481 parsoid=wt2html,html2html
16482 !! wikitext
16483 <tag width=200 height = "100" depth = '50' square></tag>
16484 !! html/php
16485 <pre>
16486 ''
16487 array (
16488 'width' => '200',
16489 'height' => '100',
16490 'depth' => '50',
16491 'square' => '',
16492 )
16493 </pre>
16494
16495 !! html/parsoid
16496 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16497 !! end
16498
16499 !! test
16500 Parser hook: argument containing a forward slash (bug 5344)
16501 !! wikitext
16502 <tag filename="/tmp/bla"></tag>
16503 !! html/php
16504 <pre>
16505 ''
16506 array (
16507 'filename' => '/tmp/bla',
16508 )
16509 </pre>
16510
16511 !! html/parsoid
16512 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16513 !! end
16514
16515 ## Don't expect parsoid to rt this form.
16516 !! test
16517 Parser hook: empty input using terminated empty elements (bug 2374)
16518 !! options
16519 parsoid=wt2html,html2html
16520 !! wikitext
16521 <tag foo=bar/>text
16522 !! html/php
16523 <pre>
16524 NULL
16525 array (
16526 'foo' => 'bar',
16527 )
16528 </pre>text
16529
16530 !! html/parsoid
16531 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16532 !! end
16533
16534 # </tag> should be output literally since there is no matching tag that begins it
16535 !! test
16536 Parser hook: basic arguments using terminated empty elements (bug 2374)
16537 !! wikitext
16538 <tag width=200 height = "100" depth = '50' square/>
16539 other stuff
16540 </tag>
16541 !! html/php
16542 <pre>
16543 NULL
16544 array (
16545 'width' => '200',
16546 'height' => '100',
16547 'depth' => '50',
16548 'square' => '',
16549 )
16550 </pre>
16551 <p>other stuff
16552 &lt;/tag&gt;
16553 </p>
16554 !! end
16555
16556 ###
16557 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16558 ###
16559
16560 !! test
16561 Parser hook: static parser hook not inside a comment
16562 !! wikitext
16563 <statictag>hello, world</statictag>
16564
16565 <statictag action="flush" />
16566 !! html/php
16567 <p><br />
16568 hello, world
16569 </p>
16570 !! html/parsoid
16571 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16572 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16573 !! end
16574
16575 !! test
16576 Parser hook: static parser hook inside a comment
16577 !! wikitext
16578 <!-- <statictag>hello, world</statictag> -->
16579 <statictag action="flush" />
16580 !! html/php
16581 <p><br />
16582 </p>
16583 !! html/parsoid
16584 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16585 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16586 !! end
16587
16588 # Nested template calls; this case was broken by Parser.php rev 1.506,
16589 # since reverted.
16590
16591 !! article
16592 Template:One-parameter
16593 !! text
16594 (My parameter is: {{{1}}})
16595 !! endarticle
16596
16597 !! article
16598 Template:Map-one-parameter
16599 !! text
16600 {{{{{1}}}|{{{2}}}}}
16601 !! endarticle
16602
16603 !! test
16604 Nested template calls
16605 !! wikitext
16606 {{Map-one-parameter|One-parameter|param}}
16607 !! html
16608 <p>(My parameter is: param)
16609 </p>
16610 !! end
16611
16612
16613 ###
16614 ### Sanitizer
16615 ###
16616
16617 # HTML+Tidy effectively strips out the empty tags completely
16618 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16619 # which Tidy would have done for the PHP parser had there been content inside it.
16620 !! test
16621 Sanitizer: Closing of open tags
16622 !! wikitext
16623 <s></s><table></table>
16624 !! html
16625 <s></s><table></table>
16626
16627 !! html/parsoid
16628 <p><s></s></p><table></table>
16629 !! end
16630
16631 !! test
16632 Sanitizer: Closing of open but not closed tags
16633 !! wikitext
16634 <s>foo
16635 !! html
16636 <p><s>foo</s>
16637 </p>
16638 !! end
16639
16640 !! test
16641 Sanitizer: Closing of closed but not open tags
16642 !! options
16643 parsoid=wt2html
16644 !! wikitext
16645 </s>
16646 !! html/php+tidy
16647 !! html/parsoid
16648 !! end
16649
16650 !! test
16651 Sanitizer: Closing of closed but not open table tags
16652 !! options
16653 parsoid=wt2html
16654 !! wikitext
16655 Table not started</td></tr></table>
16656 !! html/php+tidy
16657 <p>Table not started</p>
16658 !! html/parsoid
16659 <p>Table not started</p>
16660 !! end
16661
16662 !! test
16663 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16664 !! wikitext
16665 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16666 !! html
16667 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16668 </p>
16669 !! end
16670
16671 # In HTML5, the restrictions are that id must contain at least one character,
16672 # and must not contain any space characters.
16673 !! test
16674 Sanitizer: Validating the contents of the id attribute (bug 4515)
16675 !! options
16676 disabled
16677 !! wikitext
16678 <br id="" /><br id="a space" />
16679 !! html
16680 Something ...
16681 !! end
16682
16683 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16684 !! test
16685 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16686 !! options
16687 disabled
16688 !! wikitext
16689 <br id="foo" /><br id="foo" />
16690 !! html
16691 Something need to be done. foo-2 ?
16692 !! end
16693
16694 !! test
16695 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16696 !! wikitext
16697 <div itemscope>
16698 <meta itemprop="hello" content="world">
16699 <meta http-equiv="refresh" content="5">
16700 <meta itemprop="hello" http-equiv="refresh" content="5">
16701 <link itemprop="hello" href="{{SERVER}}">
16702 <link rel="stylesheet" href="{{SERVER}}">
16703 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16704 </div>
16705 !! html
16706 <div itemscope="">
16707 <p> <meta itemprop="hello" content="world" />
16708 &lt;meta http-equiv="refresh" content="5"&gt;
16709 <meta itemprop="hello" content="5" />
16710 </p>
16711 <link itemprop="hello" href="http&#58;//example.org" />
16712 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16713 <link itemprop="hello" href="http&#58;//example.org" />
16714 </div>
16715
16716 !! end
16717
16718 !! test
16719 Language converter: output gets cut off unexpectedly (bug 5757)
16720 !! options
16721 language=zh
16722 !! wikitext
16723 this bit is safe: }-
16724
16725 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16726
16727 then we get cut off here: }-
16728
16729 all additional text is vanished
16730 !! html
16731 <p>this bit is safe: }-
16732 </p><p>but if we add a conversion instance: xxx
16733 </p><p>then we get cut off here: }-
16734 </p><p>all additional text is vanished
16735 </p>
16736 !! end
16737
16738 !! test
16739 Self closed html pairs (bug 5487)
16740 !! options
16741 !! wikitext
16742 <center><font id="bug" />Centered text</center>
16743 <div><font id="bug2" />In div text</div>
16744 !! html
16745 <center>&lt;font id="bug" /&gt;Centered text</center>
16746 <div>&lt;font id="bug2" /&gt;In div text</div>
16747
16748 !! end
16749
16750 #
16751 #
16752 #
16753
16754 !! test
16755 Punctuation: nbsp before exclamation
16756 !! wikitext
16757 C'est grave !
16758 !! html
16759 <p>C'est grave&#160;!
16760 </p>
16761 !! end
16762
16763 !! test
16764 Punctuation: CSS !important (bug 11874)
16765 !! wikitext
16766 <div style="width:50% !important">important</div>
16767 !! html
16768 <div style="width:50% !important">important</div>
16769
16770 !!end
16771
16772 !! test
16773 Punctuation: CSS ! important (bug 11874; with space after)
16774 !! wikitext
16775 <div style="width:50% ! important">important</div>
16776 !! html
16777 <div style="width:50% ! important">important</div>
16778
16779 !!end
16780
16781 !! test
16782 HTML bullet list, closed tags (bug 5497)
16783 !! wikitext
16784 <ul>
16785 <li>One</li>
16786 <li>Two</li>
16787 </ul>
16788 !! html/php
16789 <ul>
16790 <li>One</li>
16791 <li>Two</li>
16792 </ul>
16793
16794 !! html/parsoid
16795 <ul data-parsoid='{"stx":"html"}'>
16796 <li data-parsoid='{"stx":"html"}'>One</li>
16797 <li data-parsoid='{"stx":"html"}'>Two</li>
16798 </ul>
16799
16800 !! end
16801
16802 !! test
16803 HTML bullet list, unclosed tags (bug 5497)
16804 !! wikitext
16805 <ul>
16806 <li>One
16807 <li>Two
16808 </ul>
16809 !! html/php+tidy
16810 <ul>
16811 <li>One</li>
16812 <li>Two</li>
16813 </ul>
16814 !! html/parsoid
16815 <ul data-parsoid='{"stx":"html"}'>
16816 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16817 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16818 </ul>
16819
16820 !! end
16821
16822 !! test
16823 HTML ordered list, closed tags (bug 5497)
16824 !! wikitext
16825 <ol>
16826 <li>One</li>
16827 <li>Two</li>
16828 </ol>
16829 !! html/php
16830 <ol>
16831 <li>One</li>
16832 <li>Two</li>
16833 </ol>
16834
16835 !! html/parsoid
16836 <ol data-parsoid='{"stx":"html"}'>
16837 <li data-parsoid='{"stx":"html"}'>One</li>
16838 <li data-parsoid='{"stx":"html"}'>Two</li>
16839 </ol>
16840
16841 !! end
16842
16843 !! test
16844 HTML ordered list, unclosed tags (bug 5497)
16845 !! options
16846 !! wikitext
16847 <ol>
16848 <li>One
16849 <li>Two
16850 </ol>
16851 !! html/php+tidy
16852 <ol>
16853 <li>One</li>
16854 <li>Two</li>
16855 </ol>
16856 !! html/parsoid
16857 <ol data-parsoid='{"stx":"html"}'>
16858 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16859 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16860 </ol>
16861
16862 !! end
16863
16864 !! test
16865 HTML nested bullet list, closed tags (bug 5497)
16866 !! wikitext
16867 <ul>
16868 <li>One</li>
16869 <li>Two:
16870 <ul>
16871 <li>Sub-one</li>
16872 <li>Sub-two</li>
16873 </ul>
16874 </li>
16875 </ul>
16876 !! html
16877 <ul>
16878 <li>One</li>
16879 <li>Two:
16880 <ul>
16881 <li>Sub-one</li>
16882 <li>Sub-two</li>
16883 </ul>
16884 </li>
16885 </ul>
16886
16887 !! end
16888
16889 !! test
16890 HTML nested bullet list, open tags (bug 5497)
16891 !! wikitext
16892 <ul>
16893 <li>One
16894 <li>Two:
16895 <ul>
16896 <li>Sub-one
16897 <li>Sub-two
16898 </ul>
16899 </ul>
16900 !! html/php+tidy
16901 <ul>
16902 <li>One</li>
16903 <li>Two:
16904 <ul>
16905 <li>Sub-one</li>
16906 <li>Sub-two</li>
16907 </ul>
16908 </li>
16909 </ul>
16910 !! html/parsoid
16911 <ul>
16912 <li>One
16913 </li>
16914 <li>Two:
16915 <ul>
16916 <li>Sub-one
16917 </li>
16918 <li>Sub-two
16919 </li>
16920 </ul>
16921 </li>
16922 </ul>
16923
16924 !! end
16925
16926 !! test
16927 HTML nested ordered list, closed tags (bug 5497)
16928 !! wikitext
16929 <ol>
16930 <li>One</li>
16931 <li>Two:
16932 <ol>
16933 <li>Sub-one</li>
16934 <li>Sub-two</li>
16935 </ol>
16936 </li>
16937 </ol>
16938 !! html
16939 <ol>
16940 <li>One</li>
16941 <li>Two:
16942 <ol>
16943 <li>Sub-one</li>
16944 <li>Sub-two</li>
16945 </ol>
16946 </li>
16947 </ol>
16948
16949 !! end
16950
16951 !! test
16952 HTML nested ordered list, open tags (bug 5497)
16953 !! wikitext
16954 <ol>
16955 <li>One
16956 <li>Two:
16957 <ol>
16958 <li>Sub-one
16959 <li>Sub-two
16960 </ol>
16961 </ol>
16962 !! html/php
16963 <ol>
16964 <li>One
16965 <li>Two:
16966 <ol>
16967 <li>Sub-one
16968 <li>Sub-two
16969 </ol>
16970 </ol>
16971
16972 !! html/parsoid
16973 <ol>
16974 <li>One
16975 </li>
16976 <li>Two:
16977 <ol>
16978 <li>Sub-one
16979 </li>
16980 <li>Sub-two
16981 </li>
16982 </ol>
16983 </li>
16984 </ol>
16985
16986 !! end
16987
16988 !! test
16989 HTML ordered list item with parameters oddity
16990 !! wikitext
16991 <ol><li id="fragment">One</li>
16992 </ol>
16993 !! html
16994 <ol><li id="fragment">One</li>
16995 </ol>
16996
16997 !! end
16998
16999 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17000 !!test
17001 bug 5918: autonumbering
17002 !! wikitext
17003 [http://first/] [http://second] [ftp://ftp]
17004
17005 ftp://inlineftp
17006
17007 [mailto:enclosed@mail.tld With target]
17008
17009 [mailto:enclosed@mail.tld]
17010
17011 mailto:inline@mail.tld
17012 !! html/php
17013 <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>
17014 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17015 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17016 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17017 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17018 </p>
17019 !! html/parsoid
17020 <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>
17021 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17022 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17023 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17024 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17025 !! end
17026
17027
17028 #
17029 # Security and HTML correctness
17030 # From Nick Jenkins' fuzz testing
17031 #
17032
17033 !! test
17034 Fuzz testing: Parser13
17035 !! wikitext
17036 {|
17037 | http://a|
17038 !! html
17039 <table>
17040 <tr>
17041 <td>
17042 </td>
17043 </tr>
17044 </table>
17045
17046 !! end
17047
17048 !! test
17049 Fuzz testing: Parser14
17050 !! wikitext
17051 == onmouseover= ==
17052 http://__TOC__
17053 !! html
17054 <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>
17055 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17056 <ul>
17057 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17058 </ul>
17059 </div>
17060
17061
17062 !! html+tidy
17063 <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>
17064 <p>http://</p>
17065 <div id="toc" class="toc">
17066 <div id="toctitle">
17067 <h2>Contents</h2>
17068 </div>
17069 <ul>
17070 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17071 </ul>
17072 </div>
17073 <p></p>
17074 !! end
17075
17076 !! test
17077 Fuzz testing: Parser14-table
17078 !! options
17079 parsoid=wt2html,html2html
17080 !! wikitext
17081 ==a==
17082 {| STYLE=__TOC__
17083 !! html
17084 <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>
17085 <table style="&#95;_TOC&#95;_">
17086 <tr><td></td></tr>
17087 </table>
17088
17089 !! html+tidy
17090 <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>
17091 <table style="__TOC__">
17092 <tr>
17093 <td></td>
17094 </tr>
17095 </table>
17096 !! html/parsoid
17097 <h2>a</h2>
17098 <table style="__TOC__"></table>
17099 !! end
17100
17101 # Known to produce bogus xml (extra </td>)
17102 !! test
17103 Fuzz testing: Parser16
17104 !! wikitext
17105 {|
17106 !https://||||||
17107 !! html
17108 <table>
17109 <tr>
17110 <th>https://</th>
17111 <th></th>
17112 <th></th>
17113 <th>
17114 </td>
17115 </tr>
17116 </table>
17117
17118 !! html+tidy
17119 <table>
17120 <tr>
17121 <th>https://</th>
17122 <th></th>
17123 <th></th>
17124 <th></th>
17125 </tr>
17126 </table>
17127 !! end
17128
17129 !! test
17130 Fuzz testing: Parser21
17131 !! wikitext
17132 {|
17133 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17134 |
17135 !! html
17136 <table>
17137 <tr>
17138 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17139 </th>
17140 <td>
17141 </td>
17142 </tr>
17143 </table>
17144
17145 !! end
17146
17147 !! test
17148 Fuzz testing: Parser22
17149 !! wikitext
17150 http://===r:::https://b
17151
17152 {|
17153 !! html
17154 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17155 </p>
17156 <table>
17157 <tr><td></td></tr>
17158 </table>
17159
17160 !! end
17161
17162 # Known to produce bad XML for now
17163 !! test
17164 Fuzz testing: Parser24
17165 !! wikitext
17166 {|
17167 {{{|
17168 <u CLASS=
17169 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17170 <br style="onmouseover='alert(document.cookie);' " />
17171
17172 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17173 |
17174 !! html
17175 <table>
17176 {{{|
17177 <u class="&#124;">}}}} &gt;
17178 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17179
17180 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17181 <tr>
17182 <td></u>
17183 </td>
17184 </tr>
17185 </table>
17186
17187 !! end
17188
17189 # Note: the current result listed for this is not what the original one was,
17190 # but the original bug was JavaScript injection, which is fixed in any case.
17191 # It's not clear that the original result listed was any more correct than the
17192 # current one. Original result:
17193 # <p>{{{|
17194 # </p>
17195 # <li class="&#124;&#124;">
17196 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17197 !!test
17198 Fuzz testing: Parser25 (bug 6055)
17199 !! wikitext
17200 {{{
17201 |
17202 <LI CLASS=||
17203 >
17204 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17205 !! html
17206 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17207 </p>
17208 !! end
17209
17210 !!test
17211 Fuzz testing: URL adjacent extension (with space, clean)
17212 !! wikitext
17213 http://example.com <nowiki>junk</nowiki>
17214 !! html/php
17215 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17216 </p>
17217 !! html/parsoid
17218 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17219 !! end
17220
17221 !!test
17222 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17223 !! wikitext
17224 http://example.com<nowiki>junk</nowiki>
17225 !! html/php
17226 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17227 </p>
17228 !! html/parsoid
17229 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17230 !! end
17231
17232 !!test
17233 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17234 !! wikitext
17235 http://example.com<pre>junk</pre>
17236 !! html/php
17237 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17238
17239 !! html/php+tidy
17240 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17241 <pre>
17242 junk
17243 </pre>
17244 !! html/parsoid
17245 <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>
17246 !!end
17247
17248 !!test
17249 Fuzz testing: image with bogus manual thumbnail
17250 !! wikitext
17251 [[Image:foobar.jpg|thumbnail= ]]
17252 !! html/php
17253 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17254
17255 !! html/parsoid
17256 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' 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":{},"dsr":[2,30,null,null]}'><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>
17257 !!end
17258
17259 !! test
17260 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17261 !! wikitext
17262 <pre dir="&#10;"></pre>
17263 !! html
17264 <pre dir="&#10;"></pre>
17265
17266 !! end
17267
17268 !! test
17269 Parsing optional HTML elements (Bug 6171)
17270 !! options
17271 !! wikitext
17272 <table>
17273 <tr>
17274 <td> Some tabular data</td>
17275 <td> More tabular data ...
17276 <td> And yet som tabular data</td>
17277 </tr>
17278 </table>
17279 !! html
17280 <table>
17281 <tr>
17282 <td> Some tabular data</td>
17283 <td> More tabular data ...
17284 </td><td> And yet som tabular data</td>
17285 </tr>
17286 </table>
17287
17288 !! end
17289
17290 !! test
17291 Correct handling of <td>, <tr> (Bug 6171)
17292 !! options
17293 !! wikitext
17294 <table>
17295 <tr>
17296 <td> Some tabular data</td>
17297 <td> More tabular data ...</td>
17298 <td> And yet som tabular data</td>
17299 </tr>
17300 </table>
17301 !! html
17302 <table>
17303 <tr>
17304 <td> Some tabular data</td>
17305 <td> More tabular data ...</td>
17306 <td> And yet som tabular data</td>
17307 </tr>
17308 </table>
17309
17310 !! end
17311
17312
17313 !! test
17314 Parsing crashing regression (fr:JavaScript)
17315 !! wikitext
17316 </body></x>
17317 !! html
17318 <p>&lt;/body&gt;&lt;/x&gt;
17319 </p>
17320 !! end
17321
17322 !! test
17323 Inline wiki vs wiki block nesting
17324 !! wikitext
17325 '''Bold paragraph
17326
17327 New wiki paragraph
17328 !! html
17329 <p><b>Bold paragraph</b>
17330 </p><p>New wiki paragraph
17331 </p>
17332 !! end
17333
17334 # FIXME: The current php output is documented
17335 # and desired output is the parsoid target.
17336 !! test
17337 Inline HTML vs wiki block nesting
17338 !! wikitext
17339 <b>Bold paragraph
17340
17341 New wiki paragraph
17342 !! html/php
17343 <p><b>Bold paragraph
17344 </p><p>New wiki paragraph</b>
17345 </p>
17346 !! html/parsoid
17347 <p><b>Bold paragraph</b>
17348 </p><p>New wiki paragraph
17349 </p>
17350 !! end
17351
17352 # Original result was this:
17353 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17354 # </p>
17355 # While that might be marginally more intuitive, maybe, the six-apostrophe
17356 # construct is clearly pathological and the result stated here (which is what
17357 # the parser actually does) is about as reasonable as anything.
17358 !!test
17359 Mixing markup for italics and bold
17360 !! options
17361 !! wikitext
17362 '''bold''''''bold''bolditalics'''''
17363 !! html
17364 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17365 </p>
17366 !! end
17367
17368
17369 !! article
17370 Xyzzyx
17371 !! text
17372 Article for special page transclusion test
17373 !! endarticle
17374
17375 !! test
17376 Special page transclusion
17377 !! options
17378 !! wikitext
17379 {{Special:Prefixindex/Xyzzyx}}
17380 !! html
17381 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17382 </ul>
17383
17384 !! end
17385
17386 !! test
17387 Special page transclusion twice (bug 5021)
17388 !! options
17389 !! wikitext
17390 {{Special:Prefixindex/Xyzzyx}}
17391 {{Special:Prefixindex/Xyzzyx}}
17392 !! html
17393 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17394 </ul>
17395 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17396 </ul>
17397
17398 !! end
17399
17400 !! test
17401 Transclusion of default MediaWiki message
17402 !! wikitext
17403 {{MediaWiki:Mainpage}}
17404 !! html
17405 <p>Main Page
17406 </p>
17407 !! end
17408
17409 !! test
17410 Transclusion of nonexistent MediaWiki message
17411 !! wikitext
17412 {{MediaWiki:Mainpagexxx}}
17413 !! html
17414 <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>
17415 </p>
17416 !! end
17417
17418 !! test
17419 Transclusion of MediaWiki message with underscore
17420 !! wikitext
17421 {{MediaWiki:history_short}}
17422 !! html
17423 <p>History
17424 </p>
17425 !! end
17426
17427 !! test
17428 Transclusion of MediaWiki message with space
17429 !! wikitext
17430 {{MediaWiki:history short}}
17431 !! html
17432 <p>History
17433 </p>
17434 !! end
17435
17436 !! test
17437 Invalid header with following text
17438 !! wikitext
17439 = x = y
17440 !! html
17441 <p>= x = y
17442 </p>
17443 !! end
17444
17445
17446 !! test
17447 Section extraction test (section 0)
17448 !! options
17449 section=0
17450 !! wikitext
17451 start
17452 ==a==
17453 ===aa===
17454 ====aaa====
17455 ==b==
17456 ===ba===
17457 ===bb===
17458 ====bba====
17459 ===bc===
17460 ==c==
17461 ===ca===
17462 !! html/php
17463 start
17464 !! end
17465
17466 !! test
17467 Section extraction test (section 1)
17468 !! options
17469 section=1
17470 !! wikitext
17471 start
17472 ==a==
17473 ===aa===
17474 ====aaa====
17475 ==b==
17476 ===ba===
17477 ===bb===
17478 ====bba====
17479 ===bc===
17480 ==c==
17481 ===ca===
17482 !! html/php
17483 ==a==
17484 ===aa===
17485 ====aaa====
17486 !! end
17487
17488 !! test
17489 Section extraction test (section 2)
17490 !! options
17491 section=2
17492 !! wikitext
17493 start
17494 ==a==
17495 ===aa===
17496 ====aaa====
17497 ==b==
17498 ===ba===
17499 ===bb===
17500 ====bba====
17501 ===bc===
17502 ==c==
17503 ===ca===
17504 !! html/php
17505 ===aa===
17506 ====aaa====
17507 !! end
17508
17509 !! test
17510 Section extraction test (section 3)
17511 !! options
17512 section=3
17513 !! wikitext
17514 start
17515 ==a==
17516 ===aa===
17517 ====aaa====
17518 ==b==
17519 ===ba===
17520 ===bb===
17521 ====bba====
17522 ===bc===
17523 ==c==
17524 ===ca===
17525 !! html/php
17526 ====aaa====
17527 !! end
17528
17529 !! test
17530 Section extraction test (section 4)
17531 !! options
17532 section=4
17533 !! wikitext
17534 start
17535 ==a==
17536 ===aa===
17537 ====aaa====
17538 ==b==
17539 ===ba===
17540 ===bb===
17541 ====bba====
17542 ===bc===
17543 ==c==
17544 ===ca===
17545 !! html/php
17546 ==b==
17547 ===ba===
17548 ===bb===
17549 ====bba====
17550 ===bc===
17551 !! end
17552
17553 !! test
17554 Section extraction test (section 5)
17555 !! options
17556 section=5
17557 !! wikitext
17558 start
17559 ==a==
17560 ===aa===
17561 ====aaa====
17562 ==b==
17563 ===ba===
17564 ===bb===
17565 ====bba====
17566 ===bc===
17567 ==c==
17568 ===ca===
17569 !! html/php
17570 ===ba===
17571 !! end
17572
17573 !! test
17574 Section extraction test (section 6)
17575 !! options
17576 section=6
17577 !! wikitext
17578 start
17579 ==a==
17580 ===aa===
17581 ====aaa====
17582 ==b==
17583 ===ba===
17584 ===bb===
17585 ====bba====
17586 ===bc===
17587 ==c==
17588 ===ca===
17589 !! html/php
17590 ===bb===
17591 ====bba====
17592 !! end
17593
17594 !! test
17595 Section extraction test (section 7)
17596 !! options
17597 section=7
17598 !! wikitext
17599 start
17600 ==a==
17601 ===aa===
17602 ====aaa====
17603 ==b==
17604 ===ba===
17605 ===bb===
17606 ====bba====
17607 ===bc===
17608 ==c==
17609 ===ca===
17610 !! html/php
17611 ====bba====
17612 !! end
17613
17614 !! test
17615 Section extraction test (section 8)
17616 !! options
17617 section=8
17618 !! wikitext
17619 start
17620 ==a==
17621 ===aa===
17622 ====aaa====
17623 ==b==
17624 ===ba===
17625 ===bb===
17626 ====bba====
17627 ===bc===
17628 ==c==
17629 ===ca===
17630 !! html/php
17631 ===bc===
17632 !! end
17633
17634 !! test
17635 Section extraction test (section 9)
17636 !! options
17637 section=9
17638 !! wikitext
17639 start
17640 ==a==
17641 ===aa===
17642 ====aaa====
17643 ==b==
17644 ===ba===
17645 ===bb===
17646 ====bba====
17647 ===bc===
17648 ==c==
17649 ===ca===
17650 !! html/php
17651 ==c==
17652 ===ca===
17653 !! end
17654
17655 !! test
17656 Section extraction test (section 10)
17657 !! options
17658 section=10
17659 !! wikitext
17660 start
17661 ==a==
17662 ===aa===
17663 ====aaa====
17664 ==b==
17665 ===ba===
17666 ===bb===
17667 ====bba====
17668 ===bc===
17669 ==c==
17670 ===ca===
17671 !! html/php
17672 ===ca===
17673 !! end
17674
17675 !! test
17676 Section extraction test (nonexistent section 11)
17677 !! options
17678 section=11
17679 !! wikitext
17680 start
17681 ==a==
17682 ===aa===
17683 ====aaa====
17684 ==b==
17685 ===ba===
17686 ===bb===
17687 ====bba====
17688 ===bc===
17689 ==c==
17690 ===ca===
17691 !! html/php
17692 !! end
17693
17694 !! test
17695 Section extraction test with bogus heading (section 1)
17696 !! options
17697 section=1
17698 !! wikitext
17699 ==a==
17700 ==bogus== not a legal section
17701 ==b==
17702 !! html/php
17703 ==a==
17704 ==bogus== not a legal section
17705 !! end
17706
17707 !! test
17708 Section extraction test with bogus heading (section 2)
17709 !! options
17710 section=2
17711 !! wikitext
17712 ==a==
17713 ==bogus== not a legal section
17714 ==b==
17715 !! html/php
17716 ==b==
17717 !! end
17718
17719 !! test
17720 Section extraction test with comment after heading (section 1)
17721 !! options
17722 section=1
17723 !! wikitext
17724 ==a==
17725 ==b== <!-- -->
17726 ==c==
17727 !! html/php
17728 ==a==
17729 !! end
17730
17731 !! test
17732 Section extraction test with comment after heading (section 2)
17733 !! options
17734 section=2
17735 !! wikitext
17736 ==a==
17737 ==b== <!-- -->
17738 ==c==
17739 !! html/php
17740 ==b== <!-- -->
17741 !! end
17742
17743 !! test
17744 Section extraction test with bogus <nowiki> heading (section 1)
17745 !! options
17746 section=1
17747 !! wikitext
17748 ==a==
17749 ==bogus== <nowiki>not a legal section</nowiki>
17750 ==b==
17751 !! html/php
17752 ==a==
17753 ==bogus== <nowiki>not a legal section</nowiki>
17754 !! end
17755
17756 !! test
17757 Section extraction test with bogus <nowiki> heading (section 2)
17758 !! options
17759 section=2
17760 !! wikitext
17761 ==a==
17762 ==bogus== <nowiki>not a legal section</nowiki>
17763 ==b==
17764 !! html/php
17765 ==b==
17766 !! end
17767
17768 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17769 # instead of respecting commented sections
17770 !! test
17771 Section extraction prefixed by comment (section 1)
17772 !! options
17773 section=1
17774 !! wikitext
17775 <!-- -->==sec1==
17776 ==sec2==
17777 !! html/php
17778 ==sec2==
17779 !!end
17780
17781 !! test
17782 Section extraction prefixed by comment (section 2)
17783 !! options
17784 section=2
17785 !! wikitext
17786 <!-- -->==sec1==
17787 ==sec2==
17788 !! html/php
17789
17790 !!end
17791
17792 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17793 # instead of respecting HTML-style headings
17794 !! test
17795 Section extraction, mixed wiki and html (section 1)
17796 !! options
17797 section=1
17798 !! wikitext
17799 <h2>unmarked</h2>
17800 unmarked
17801 ==1==
17802 one
17803 ==2==
17804 two
17805 !! html/php
17806 ==1==
17807 one
17808 !! end
17809
17810 !! test
17811 Section extraction, mixed wiki and html (section 2)
17812 !! options
17813 section=2
17814 !! wikitext
17815 <h2>unmarked</h2>
17816 unmarked
17817 ==1==
17818 one
17819 ==2==
17820 two
17821 !! html/php
17822 ==2==
17823 two
17824 !! end
17825
17826
17827 # Formerly testing for bug 3342
17828 !! test
17829 Section extraction, heading surrounded by <noinclude>
17830 !! options
17831 section=1
17832 !! wikitext
17833 <noinclude>==unmarked==</noinclude>
17834 ==marked==
17835 !! html/php
17836 ==marked==
17837 !!end
17838
17839 # Test behavior of bug 19910
17840 !! test
17841 Sectiion with all-equals
17842 !! options
17843 section=2
17844 !! wikitext
17845 ===
17846 The line above must have a trailing space
17847 === <!--
17848 --> <!-- -->
17849 But just in case it doesn't...
17850 !! html/php
17851 === <!--
17852 --> <!-- -->
17853 But just in case it doesn't...
17854 !! end
17855
17856 !! test
17857 Section replacement test (section 0)
17858 !! options
17859 replace=0,"xxx"
17860 !! wikitext
17861 start
17862 ==a==
17863 ===aa===
17864 ====aaa====
17865 ==b==
17866 ===ba===
17867 ===bb===
17868 ====bba====
17869 ===bc===
17870 ==c==
17871 ===ca===
17872 !! html/php
17873 xxx
17874
17875 ==a==
17876 ===aa===
17877 ====aaa====
17878 ==b==
17879 ===ba===
17880 ===bb===
17881 ====bba====
17882 ===bc===
17883 ==c==
17884 ===ca===
17885 !! end
17886
17887 !! test
17888 Section replacement test (section 1)
17889 !! options
17890 replace=1,"xxx"
17891 !! wikitext
17892 start
17893 ==a==
17894 ===aa===
17895 ====aaa====
17896 ==b==
17897 ===ba===
17898 ===bb===
17899 ====bba====
17900 ===bc===
17901 ==c==
17902 ===ca===
17903 !! html/php
17904 start
17905 xxx
17906
17907 ==b==
17908 ===ba===
17909 ===bb===
17910 ====bba====
17911 ===bc===
17912 ==c==
17913 ===ca===
17914 !! end
17915
17916 !! test
17917 Section replacement test (section 2)
17918 !! options
17919 replace=2,"xxx"
17920 !! wikitext
17921 start
17922 ==a==
17923 ===aa===
17924 ====aaa====
17925 ==b==
17926 ===ba===
17927 ===bb===
17928 ====bba====
17929 ===bc===
17930 ==c==
17931 ===ca===
17932 !! html/php
17933 start
17934 ==a==
17935 xxx
17936
17937 ==b==
17938 ===ba===
17939 ===bb===
17940 ====bba====
17941 ===bc===
17942 ==c==
17943 ===ca===
17944 !! end
17945
17946 !! test
17947 Section replacement test (section 3)
17948 !! options
17949 replace=3,"xxx"
17950 !! wikitext
17951 start
17952 ==a==
17953 ===aa===
17954 ====aaa====
17955 ==b==
17956 ===ba===
17957 ===bb===
17958 ====bba====
17959 ===bc===
17960 ==c==
17961 ===ca===
17962 !! html/php
17963 start
17964 ==a==
17965 ===aa===
17966 xxx
17967
17968 ==b==
17969 ===ba===
17970 ===bb===
17971 ====bba====
17972 ===bc===
17973 ==c==
17974 ===ca===
17975 !! end
17976
17977 !! test
17978 Section replacement test (section 4)
17979 !! options
17980 replace=4,"xxx"
17981 !! wikitext
17982 start
17983 ==a==
17984 ===aa===
17985 ====aaa====
17986 ==b==
17987 ===ba===
17988 ===bb===
17989 ====bba====
17990 ===bc===
17991 ==c==
17992 ===ca===
17993 !! html/php
17994 start
17995 ==a==
17996 ===aa===
17997 ====aaa====
17998 xxx
17999
18000 ==c==
18001 ===ca===
18002 !! end
18003
18004 !! test
18005 Section replacement test (section 5)
18006 !! options
18007 replace=5,"xxx"
18008 !! wikitext
18009 start
18010 ==a==
18011 ===aa===
18012 ====aaa====
18013 ==b==
18014 ===ba===
18015 ===bb===
18016 ====bba====
18017 ===bc===
18018 ==c==
18019 ===ca===
18020 !! html/php
18021 start
18022 ==a==
18023 ===aa===
18024 ====aaa====
18025 ==b==
18026 xxx
18027
18028 ===bb===
18029 ====bba====
18030 ===bc===
18031 ==c==
18032 ===ca===
18033 !! end
18034
18035 !! test
18036 Section replacement test (section 6)
18037 !! options
18038 replace=6,"xxx"
18039 !! wikitext
18040 start
18041 ==a==
18042 ===aa===
18043 ====aaa====
18044 ==b==
18045 ===ba===
18046 ===bb===
18047 ====bba====
18048 ===bc===
18049 ==c==
18050 ===ca===
18051 !! html/php
18052 start
18053 ==a==
18054 ===aa===
18055 ====aaa====
18056 ==b==
18057 ===ba===
18058 xxx
18059
18060 ===bc===
18061 ==c==
18062 ===ca===
18063 !! end
18064
18065 !! test
18066 Section replacement test (section 7)
18067 !! options
18068 replace=7,"xxx"
18069 !! wikitext
18070 start
18071 ==a==
18072 ===aa===
18073 ====aaa====
18074 ==b==
18075 ===ba===
18076 ===bb===
18077 ====bba====
18078 ===bc===
18079 ==c==
18080 ===ca===
18081 !! html/php
18082 start
18083 ==a==
18084 ===aa===
18085 ====aaa====
18086 ==b==
18087 ===ba===
18088 ===bb===
18089 xxx
18090
18091 ===bc===
18092 ==c==
18093 ===ca===
18094 !! end
18095
18096 !! test
18097 Section replacement test (section 8)
18098 !! options
18099 replace=8,"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 ===ba===
18119 ===bb===
18120 ====bba====
18121 xxx
18122
18123 ==c==
18124 ===ca===
18125 !!end
18126
18127 !! test
18128 Section replacement test (section 9)
18129 !! options
18130 replace=9,"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 ===bb===
18151 ====bba====
18152 ===bc===
18153 xxx
18154 !! end
18155
18156 !! test
18157 Section replacement test (section 10)
18158 !! options
18159 replace=10,"xxx"
18160 !! wikitext
18161 start
18162 ==a==
18163 ===aa===
18164 ====aaa====
18165 ==b==
18166 ===ba===
18167 ===bb===
18168 ====bba====
18169 ===bc===
18170 ==c==
18171 ===ca===
18172 !! html/php
18173 start
18174 ==a==
18175 ===aa===
18176 ====aaa====
18177 ==b==
18178 ===ba===
18179 ===bb===
18180 ====bba====
18181 ===bc===
18182 ==c==
18183 xxx
18184 !! end
18185
18186 !! test
18187 Section replacement test with initial whitespace (bug 13728)
18188 !! options
18189 replace=2,"xxx"
18190 !! wikitext
18191 Preformatted initial line
18192 ==a==
18193 ===a===
18194 !! html/php
18195 Preformatted initial line
18196 ==a==
18197 xxx
18198 !! end
18199
18200
18201 !! test
18202 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18203 !! options
18204 section=1
18205 !! wikitext
18206 ==a==
18207 a
18208 !! html/php
18209 ==a==
18210 a
18211 !! end
18212
18213 !! test
18214 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18215 !! options
18216 section=1
18217 !! wikitext
18218 ==a==
18219 a
18220 !! html/php
18221 ==a==
18222 a
18223 !! end
18224
18225
18226 !! test
18227 Section extraction, <pre> around bogus header (bug 10309)
18228 !! options
18229 section=2
18230 !! wikitext
18231 == Section One ==
18232 <pre>
18233 =======
18234 </pre>
18235
18236 == Section Two ==
18237 stuff
18238 !! html/php
18239 == Section Two ==
18240 stuff
18241 !! end
18242
18243 !! test
18244 Section replacement, <pre> around bogus header (bug 10309)
18245 !! options
18246 replace=2,"xxx"
18247 !! wikitext
18248 == Section One ==
18249 <pre>
18250 =======
18251 </pre>
18252
18253 == Section Two ==
18254 stuff
18255 !! html/php
18256 == Section One ==
18257 <pre>
18258 =======
18259 </pre>
18260
18261 xxx
18262 !! end
18263
18264
18265 !! test
18266 Handling of &#x0A; in URLs
18267 !! wikitext
18268 ** irc://&#x0A;a
18269 !! html/php
18270 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18271
18272 !! html/parsoid
18273 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18274 a">irc://
18275 a</a></li></ul></li></ul>
18276 !! end
18277
18278 !! test
18279 Handling of %0A in URLs
18280 !! wikitext
18281 ** irc://%0Aa
18282 !! html/php
18283 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18284
18285 !! html/parsoid
18286 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18287 !! end
18288
18289
18290 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18291 !! test
18292 5 quotes, code coverage +1 line
18293 !! options
18294 parsoid=wt2html
18295 !! wikitext
18296 '''''
18297 !! html/php
18298 !! html/parsoid
18299 <p><b><i></i></b></p>
18300 !! end
18301
18302 # same html as previous, but wikitext adjusted to match parsoid html2wt
18303 # note that wt2html and html2html will put the <i> before the <b>
18304 !! test
18305 5 quotes, code coverage +1 line w/ nowiki (1)
18306 !! options
18307 parsoid=wt2wt,html2wt
18308 !! wikitext
18309 '''''<nowiki/>'''''
18310 !! html/php
18311 <p><i></i>
18312 </p>
18313 !! html/parsoid
18314 <p><b><i></i></b></p>
18315 !! end
18316
18317 # same as previous, just swapping the <i> and <b>
18318 !! test
18319 5 quotes, code coverage +1 line w/ nowiki (2)
18320 !! wikitext
18321 '''''<nowiki/>'''''
18322 !! html/php
18323 <p><i></i>
18324 </p>
18325 !! html/parsoid
18326 <p><i><b></b></i></p>
18327 !! end
18328
18329 !! test
18330 Special:Search page linking.
18331 !! wikitext
18332 {{Special:search}}
18333 !! html
18334 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18335 </p>
18336 !! end
18337
18338 !! test
18339 {{!}} is a magic word
18340 !! wikitext
18341 {{!}} is a magic word there and {{!}} is still a magic word here
18342 | is not a magic word here but {{!}} is still a magic word here
18343 !! html/php
18344 <p>| is a magic word there and | is still a magic word here
18345 | is not a magic word here but | is still a magic word here
18346 </p>
18347 !! html/parsoid
18348 <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
18349 | 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>
18350
18351 !! end
18352
18353 !! test
18354 Say the magic word
18355 !! options
18356 title=[[Parser test]]
18357 !! wikitext
18358 * {{PAGENAME}}
18359 * {{PAGENAMEE}}
18360 * {{FULLPAGENAME}}
18361 * {{FULLPAGENAMEE}}
18362 * {{BASEPAGENAME}}
18363 * {{BASEPAGENAMEE}}
18364 * {{SUBPAGENAME}}
18365 * {{SUBPAGENAMEE}}
18366 * {{ROOTPAGENAME}}
18367 * {{ROOTPAGENAMEE}}
18368 * {{TALKPAGENAME}}
18369 * {{TALKPAGENAMEE}}
18370 * {{SUBJECTPAGENAME}}
18371 * {{SUBJECTPAGENAMEE}}
18372 * {{NAMESPACEE}}
18373 * {{NAMESPACE}}
18374 * {{NAMESPACENUMBER}}
18375 * {{TALKSPACE}}
18376 * {{TALKSPACEE}}
18377 * {{SUBJECTSPACE}}
18378 * {{SUBJECTSPACEE}}
18379 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18380 !! html
18381 <ul><li> Parser test</li>
18382 <li> Parser_test</li>
18383 <li> Parser test</li>
18384 <li> Parser_test</li>
18385 <li> Parser test</li>
18386 <li> Parser_test</li>
18387 <li> Parser test</li>
18388 <li> Parser_test</li>
18389 <li> Parser test</li>
18390 <li> Parser_test</li>
18391 <li> Talk:Parser test</li>
18392 <li> Talk:Parser_test</li>
18393 <li> Parser test</li>
18394 <li> Parser_test</li>
18395 <li> </li>
18396 <li> </li>
18397 <li> 0</li>
18398 <li> Talk</li>
18399 <li> Talk</li>
18400 <li> </li>
18401 <li> </li>
18402 <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>
18403
18404 !! end
18405 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18406
18407 !! test
18408 Gallery
18409 !! wikitext
18410 <gallery>
18411 image1.png |
18412 image2.gif|||||
18413
18414 image3|
18415 image4 |300px| centre
18416 image5.svg| http://///////
18417 [[x|xx]]]]
18418 * image6
18419 </gallery>
18420 !! html
18421 <ul class="gallery mw-gallery-traditional">
18422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18423 <div class="thumb" style="height: 150px;">Image1.png</div>
18424 <div class="gallerytext">
18425 </div>
18426 </div></li>
18427 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18428 <div class="thumb" style="height: 150px;">Image2.gif</div>
18429 <div class="gallerytext">
18430 </div>
18431 </div></li>
18432 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18433 <div class="thumb" style="height: 150px;">Image3</div>
18434 <div class="gallerytext">
18435 </div>
18436 </div></li>
18437 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18438 <div class="thumb" style="height: 150px;">Image4</div>
18439 <div class="gallerytext">
18440 <pre>centre
18441 </pre>
18442 </div>
18443 </div></li>
18444 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18445 <div class="thumb" style="height: 150px;">Image5.svg</div>
18446 <div class="gallerytext">
18447 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18448 </p>
18449 </div>
18450 </div></li>
18451 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18452 <div class="thumb" style="height: 150px;">* image6</div>
18453 <div class="gallerytext">
18454 </div>
18455 </div></li>
18456 </ul>
18457
18458 !! end
18459
18460 !! test
18461 Gallery (with options)
18462 !! wikitext
18463 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18464 File:Nonexistent.jpg|caption
18465 File:Nonexistent.jpg
18466 image:foobar.jpg|some '''caption''' [[Main Page]]
18467 image:foobar.jpg
18468 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18469 </gallery>
18470 !! html
18471 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18472 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18473 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18474 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18475 <div class="gallerytext">
18476 <p>caption
18477 </p>
18478 </div>
18479 </div></li>
18480 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18481 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18482 <div class="gallerytext">
18483 </div>
18484 </div></li>
18485 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18486 <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>
18487 <div class="gallerytext">
18488 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18489 </p>
18490 </div>
18491 </div></li>
18492 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18493 <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>
18494 <div class="gallerytext">
18495 </div>
18496 </div></li>
18497 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18498 <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>
18499 <div class="gallerytext">
18500 <p>blabla.
18501 </p>
18502 </div>
18503 </div></li>
18504 </ul>
18505
18506 !! end
18507
18508 !! test
18509 Gallery with link that has fragment
18510 !! wikitext
18511 <gallery>
18512 image:foobar.jpg|link=Main_Page
18513 image:foobar.jpg|link=Main_Page#section
18514 image:foobar.jpg|link=Main Page#section|caption
18515 </gallery>
18516 !! html
18517 <ul class="gallery mw-gallery-traditional">
18518 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18519 <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>
18520 <div class="gallerytext">
18521 </div>
18522 </div></li>
18523 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18524 <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>
18525 <div class="gallerytext">
18526 </div>
18527 </div></li>
18528 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18529 <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>
18530 <div class="gallerytext">
18531 <p>caption
18532 </p>
18533 </div>
18534 </div></li>
18535 </ul>
18536
18537 !! end
18538
18539 !! test
18540 Gallery with wikitext inside caption
18541 !! wikitext
18542 <gallery>
18543 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18544 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18545 </gallery>
18546 !! html
18547 <ul class="gallery mw-gallery-traditional">
18548 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18549 <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>
18550 <div class="gallerytext">
18551 <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>
18552 </p>
18553 </div>
18554 </div></li>
18555 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18556 <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>
18557 <div class="gallerytext">
18558 <p>This is a test template
18559 </p>
18560 </div>
18561 </div></li>
18562 </ul>
18563
18564 !! end
18565
18566 !! test
18567 gallery (with showfilename option)
18568 !! wikitext
18569 <gallery showfilename>
18570 File:Nonexistent.jpg|caption
18571 File:Nonexistent.jpg
18572 image:foobar.jpg|some '''caption''' [[Main Page]]
18573 File:Foobar.jpg
18574 </gallery>
18575 !! html
18576 <ul class="gallery mw-gallery-traditional">
18577 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18578 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18579 <div class="gallerytext">
18580 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18581 caption
18582 </p>
18583 </div>
18584 </div></li>
18585 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18586 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18587 <div class="gallerytext">
18588 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18589 </p>
18590 </div>
18591 </div></li>
18592 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18593 <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>
18594 <div class="gallerytext">
18595 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18596 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18597 </p>
18598 </div>
18599 </div></li>
18600 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18601 <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>
18602 <div class="gallerytext">
18603 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18604 </p>
18605 </div>
18606 </div></li>
18607 </ul>
18608
18609 !! end
18610
18611 !! test
18612 Gallery (with namespace-less filenames)
18613 !! wikitext
18614 <gallery>
18615 File:Nonexistent.jpg
18616 Nonexistent.jpg
18617 image:foobar.jpg
18618 foobar.jpg
18619 </gallery>
18620 !! html
18621 <ul class="gallery mw-gallery-traditional">
18622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18623 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18624 <div class="gallerytext">
18625 </div>
18626 </div></li>
18627 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18628 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18629 <div class="gallerytext">
18630 </div>
18631 </div></li>
18632 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18633 <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>
18634 <div class="gallerytext">
18635 </div>
18636 </div></li>
18637 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18638 <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>
18639 <div class="gallerytext">
18640 </div>
18641 </div></li>
18642 </ul>
18643
18644 !! end
18645
18646 !! test
18647 HTML Hex character encoding (spells the word "JavaScript")
18648 !! options
18649 parsoid=wt2html,wt2wt,html2html
18650 !! wikitext
18651 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18652 !! html/php
18653 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18654 </p>
18655 !! html/php+tidy
18656 <p>JavaScript</p>
18657 !! html/parsoid
18658 <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>
18659 !! end
18660
18661 !! test
18662 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18663 !! wikitext
18664 &#xsee;&#XSEE;
18665 !! html/php
18666 <p>&amp;#xsee;&amp;#XSEE;
18667 </p>
18668 !! html/parsoid
18669 <p>&amp;#xsee;&amp;#XSEE;</p>
18670 !! end
18671
18672 !! test
18673 HTML Hex character encoding mixed case
18674 !! options
18675 parsoid=wt2html,wt2wt,html2html
18676 !! wikitext
18677 &#xEE;&#Xee;
18678 !! html/php
18679 <p>&#xee;&#xee;
18680 </p>
18681 !! html/php+tidy
18682 <p>îî</p>
18683 !! html/parsoid
18684 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18685 !! end
18686
18687 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18688 # Note that U+000C (form feed) is not a valid XML character, so
18689 # it is banned even though allowed in HTML5.
18690 !! test
18691 Illegal character references (T106578)
18692 !! wikitext
18693 ; Null: &#00;
18694 ; FF: &#xC;
18695 ; CR: &#xD;
18696 ; Control (low): &#8;
18697 ; Control (high): &#x7F; &#x9F;
18698 ; Surrogate: &#xD83D;&#xDCA9;
18699 ; This is an okay astral character: &#x1F4A9;
18700 !! html+tidy
18701 <dl>
18702 <dt>Null</dt>
18703 <dd>&amp;#00;</dd>
18704 <dt>FF</dt>
18705 <dd>&amp;#xC;</dd>
18706 <dt>CR</dt>
18707 <dd>&amp;#xD;</dd>
18708 <dt>Control (low)</dt>
18709 <dd>&amp;#8;</dd>
18710 <dt>Control (high)</dt>
18711 <dd>&amp;#x7F; &amp;#x9F;</dd>
18712 <dt>Surrogate</dt>
18713 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18714 <dt>This is an okay astral character</dt>
18715 <dd>💩</dd>
18716 </dl>
18717 !! end
18718
18719 !! test
18720 __FORCETOC__ override
18721 !! wikitext
18722 __NEWSECTIONLINK__
18723 __FORCETOC__
18724 !! html/php
18725 <p><br />
18726 </p>
18727 !! end
18728
18729 !! test
18730 ISBN code coverage
18731 !! wikitext
18732 ISBN 978-0-1234-56&#x20;789
18733 !! html
18734 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18735 </p>
18736 !! html+tidy
18737 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18738 !! html/parsoid
18739 <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>
18740 !! end
18741
18742 !! test
18743 ISBN followed by 5 spaces
18744 !! wikitext
18745 ISBN
18746 !! html
18747 <p>ISBN
18748 </p>
18749 !! end
18750
18751 !! test
18752 Double ISBN
18753 !! wikitext
18754 ISBN ISBN 1234567890
18755 !! html/php
18756 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18757 </p>
18758 !! html/parsoid
18759 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18760 !! end
18761
18762 # Uppercase X and lowercase x as well
18763 !! test
18764 ISBN with an X
18765 !! wikitext
18766 ISBN 3-462-04561-X
18767 ISBN 3-462-04561-x
18768 ISBN 080442957X
18769 ISBN 080442957x
18770 ISBN 978080442957X
18771 ISBN 978080442957x
18772 !! html/php
18773 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18774 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18775 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18776 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18777 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18778 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18779 </p>
18780 !! html/parsoid
18781 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18782 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18783 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18784 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18785 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18786 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18787 !! end
18788
18789 !! test
18790 ISBN with empty prefix (parsoid test)
18791 !! wikitext
18792 ISBN 1234567890
18793 !! html/php
18794 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18795 </p>
18796 !! html/parsoid
18797 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18798 !! end
18799
18800 !! test
18801 Bug 22905: <abbr> followed by ISBN followed by </a>
18802 !! wikitext
18803 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18804 !! html/php
18805 <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>
18806 </p>
18807 !! html/parsoid
18808 <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>
18809 !! end
18810
18811 !! test
18812 Double RFC
18813 !! wikitext
18814 RFC RFC 1234
18815 !! html
18816 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18817 </p>
18818 !! end
18819
18820 !! test
18821 Double RFC with a wiki link
18822 !! wikitext
18823 RFC [[RFC 1234]]
18824 !! html
18825 <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>
18826 </p>
18827 !! end
18828
18829 !! test
18830 RFC code coverage
18831 !! wikitext
18832 RFC 983&#x20;987
18833 !! html
18834 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18835 </p>
18836 !! html+tidy
18837 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18838 !! end
18839
18840 !! test
18841 Centre-aligned image
18842 !! wikitext
18843 [[Image:foobar.jpg|centre]]
18844 !! html
18845 <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>
18846
18847 !!end
18848
18849 !! test
18850 None-aligned image
18851 !! wikitext
18852 [[Image:foobar.jpg|none]]
18853 !! html
18854 <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>
18855
18856 !!end
18857
18858 !! test
18859 Width + Height sized image (using px) (height is ignored)
18860 !! wikitext
18861 [[Image:foobar.jpg|640x480px]]
18862 !! html
18863 <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>
18864 </p>
18865 !!end
18866
18867 !! test
18868 Width-sized image (using px, no following whitespace)
18869 !! wikitext
18870 [[Image:foobar.jpg|640px]]
18871 !! html
18872 <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>
18873 </p>
18874 !!end
18875
18876 !! test
18877 Width-sized image (using px, with following whitespace - test regression from r39467)
18878 !! wikitext
18879 [[Image:foobar.jpg|640px ]]
18880 !! html
18881 <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>
18882 </p>
18883 !!end
18884
18885 !! test
18886 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18887 !! wikitext
18888 [[Image:foobar.jpg| 640px]]
18889 !! html
18890 <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>
18891 </p>
18892 !!end
18893
18894 !! test
18895 Image with page parameter
18896 !! options
18897 djvu
18898 !! wikitext
18899 [[File:LoremIpsum.djvu|page=2]]
18900 !! html/php
18901 <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>
18902 </p>
18903 !! html/parsoid
18904 <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>
18905 !! end
18906
18907 !! test
18908 Another italics / bold test
18909 !! wikitext
18910 ''' ''x'
18911 !! html
18912 <pre>'<i> </i>x'
18913 </pre>
18914 !!end
18915
18916 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18917 !! test
18918 dt/dd/dl test
18919 !! wikitext
18920 :;;;::
18921 !! html/php
18922 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18923
18924 !! html/parsoid
18925 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18926
18927 !!end
18928
18929
18930 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18931 !! test
18932 Images with the "|" character in the comment
18933 !! wikitext
18934 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18935 !! html/php
18936 <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>
18937
18938 !! html/parsoid
18939 <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>
18940 !! end
18941
18942 !! test
18943 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18944 !! wikitext
18945 <html><script>alert(1);</script></html>
18946 !! html
18947 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18948 </p>
18949 !! end
18950
18951 !! test
18952 HTML with raw HTML ($wgRawHtml==true)
18953 !! options
18954 wgRawHtml=1
18955 !! wikitext
18956 <html><script>alert(1);</script></html>
18957 !! html
18958 <p><script>alert(1);</script>
18959 </p>
18960 !! end
18961
18962 !! test
18963 Parents of subpages, one level up
18964 !! options
18965 subpage title=[[Subpage test/L1/L2/L3]]
18966 !! wikitext
18967 [[../|L2]]
18968 !! html
18969 <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>
18970 </p>
18971 !! end
18972
18973
18974 !! test
18975 Parents of subpages, one level up, not named
18976 !! options
18977 subpage title=[[Subpage test/L1/L2/L3]]
18978 !! wikitext
18979 [[../]]
18980 !! html
18981 <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>
18982 </p>
18983 !! end
18984
18985
18986
18987 !! test
18988 Parents of subpages, two levels up
18989 !! options
18990 subpage title=[[Subpage test/L1/L2/L3]]
18991 !! wikitext
18992 [[../../|L1]]2
18993
18994 [[../../|L1]]l
18995 !! html
18996 <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
18997 </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>
18998 </p>
18999 !! end
19000
19001 !! test
19002 Parents of subpages, two levels up, without trailing slash or name.
19003 !! options
19004 subpage title=[[Subpage test/L1/L2/L3]]
19005 !! wikitext
19006 [[../..]]
19007 !! html
19008 <p>[[../..]]
19009 </p>
19010 !! end
19011
19012 !! test
19013 Parents of subpages, two levels up, with lots of extra trailing slashes.
19014 !! options
19015 subpage title=[[Subpage test/L1/L2/L3]]
19016 !! wikitext
19017 [[../../////]]
19018 !! html
19019 <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>
19020 </p>
19021 !! end
19022
19023 !! article
19024 Subpage test/L1/L2/L3Sibling
19025 !! text
19026 Sibling article
19027 !! endarticle
19028
19029 !! test
19030 Transclusion of a sibling page (one level up)
19031 !! options
19032 subpage title=[[Subpage test/L1/L2/L3]]
19033 !! wikitext
19034 {{../L3Sibling}}
19035 !! html
19036 <p>Sibling article
19037 </p>
19038 !! end
19039
19040 !! test
19041 Transclusion of a child page
19042 !! options
19043 subpage title=[[Subpage test/L1/L2]]
19044 !! wikitext
19045 {{/L3Sibling}}
19046 !! html
19047 <p>Sibling article
19048 </p>
19049 !! end
19050
19051 !! test
19052 Non-transclusion because of too many up levels
19053 !! options
19054 subpage title=[[Subpage test/L1/L2/L3]]
19055 !! wikitext
19056 {{../../../../More than parent}}
19057 !! html
19058 <p>{{../../../../More than parent}}
19059 </p>
19060 !! end
19061
19062 !! test
19063 Definition list code coverage
19064 !! wikitext
19065 ; title : def
19066 ; title : def
19067 ;title: def
19068 !! html/php
19069 <dl><dt> title &#160;</dt>
19070 <dd> def</dd>
19071 <dt> title&#160;</dt>
19072 <dd> def</dd>
19073 <dt>title</dt>
19074 <dd> def</dd></dl>
19075
19076 !! html/parsoid
19077 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19078 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19079 <dt>title</dt><dd> def</dd></dl>
19080 !! end
19081
19082 !! test
19083 Don't fall for the self-closing div
19084 !! wikitext
19085 <div>hello world</div/>
19086 !! html
19087 <div>hello world</div>
19088
19089 !! end
19090
19091 !! test
19092 MSGNW magic word
19093 !! wikitext
19094 {{MSGNW:msg}}
19095 !! html/php
19096 <p>&#91;&#91;:Template:Msg&#93;&#93;
19097 </p>
19098 !! end
19099
19100 !! test
19101 RAW magic word
19102 !! wikitext
19103 {{RAW:QUERTY}}
19104 !! html
19105 <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>
19106 </p>
19107 !! end
19108
19109 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19110 !! test
19111 Always escape literal '>' in output, not just after '<'
19112 !! wikitext
19113 ><>
19114 !! html
19115 <p>&gt;&lt;&gt;
19116 </p>
19117 !! end
19118
19119 !! test
19120 Template caching
19121 !! wikitext
19122 {{Test}}
19123 {{Test}}
19124 !! html
19125 <p>This is a test template
19126 This is a test template
19127 </p>
19128 !! end
19129
19130
19131 !! article
19132 MediaWiki:Fake
19133 !! text
19134 ==header==
19135 !! endarticle
19136
19137 !! test
19138 Inclusion of !userCanEdit() content
19139 !! wikitext
19140 {{MediaWiki:Fake}}
19141 !! html
19142 <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>
19143
19144 !! end
19145
19146
19147 !! test
19148 Out-of-order TOC heading levels
19149 !! wikitext
19150 ==2==
19151 ======6======
19152 ===3===
19153 =1=
19154 =====5=====
19155 ==2==
19156 !! html
19157 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19158 <ul>
19159 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19160 <ul>
19161 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19162 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19163 </ul>
19164 </li>
19165 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19166 <ul>
19167 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19168 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19169 </ul>
19170 </li>
19171 </ul>
19172 </div>
19173
19174 <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>
19175 <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>
19176 <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>
19177 <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>
19178 <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>
19179 <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>
19180
19181 !! end
19182
19183
19184 !! test
19185 ISBN with a dummy number
19186 !! wikitext
19187 ISBN ---
19188 !! html
19189 <p>ISBN ---
19190 </p>
19191 !! end
19192
19193
19194 !! test
19195 ISBN with space-delimited number
19196 !! wikitext
19197 ISBN 92 9017 032 8
19198 !! html
19199 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19200 </p>
19201 !! end
19202
19203
19204 !! test
19205 ISBN with multiple spaces, no number
19206 !! wikitext
19207 ISBN foo
19208 !! html
19209 <p>ISBN foo
19210 </p>
19211 !! end
19212
19213
19214 !! test
19215 ISBN length
19216 !! wikitext
19217 ISBN 123456789
19218
19219 ISBN 1234567890
19220
19221 ISBN 12345678901
19222 !! html
19223 <p>ISBN 123456789
19224 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19225 </p><p>ISBN 12345678901
19226 </p>
19227 !! end
19228
19229
19230 !! test
19231 ISBN with trailing year (bug 8110)
19232 !! wikitext
19233 ISBN 1-234-56789-0 - 2006
19234
19235 ISBN 1 234 56789 0 - 2006
19236 !! html
19237 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19238 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19239 </p>
19240 !! end
19241
19242
19243 !! test
19244 anchorencode
19245 !! wikitext
19246 {{anchorencode:foo bar©#%n}}
19247 !! html
19248 <p>foo_bar.C2.A9.23.25n
19249 </p>
19250 !! end
19251
19252 !! test
19253 anchorencode trims spaces
19254 !! wikitext
19255 {{anchorencode: __pretty__please__}}
19256 !! html
19257 <p>pretty_please
19258 </p>
19259 !! end
19260
19261 !! test
19262 anchorencode deals with links
19263 !! wikitext
19264 {{anchorencode: [[hello|world]] [[hi]]}}
19265 !! html
19266 <p>world_hi
19267 </p>
19268 !! end
19269
19270 !! test
19271 anchorencode deals with templates
19272 !! wikitext
19273 {{anchorencode: {{Foo}} }}
19274 !! html
19275 <p>FOO
19276 </p>
19277 !! end
19278
19279 !! test
19280 anchorencode encodes like the TOC generator: (bug 18431)
19281 !! wikitext
19282 === _ +:.3A%3A&&amp;]] ===
19283 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19284 __NOEDITSECTION__
19285 !! html
19286 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19287 <p>.2B:.3A.253A.26.26.5D.5D
19288 </p>
19289 !! end
19290
19291 !! test
19292 Bug 6200: blockquotes and paragraph formatting
19293 !! wikitext
19294 <blockquote>
19295 foo
19296 </blockquote>
19297
19298 bar
19299
19300 baz
19301 !! html
19302 <blockquote>
19303 <p>foo
19304 </p>
19305 </blockquote>
19306 <p>bar
19307 </p>
19308 <pre>baz
19309 </pre>
19310 !! end
19311
19312 !! test
19313 Bug 8293: Use of center tag ruins paragraph formatting
19314 !! wikitext
19315 <center>
19316 foo
19317 </center>
19318
19319 bar
19320
19321 baz
19322 !! html
19323 <center>
19324 <p>foo
19325 </p>
19326 </center>
19327 <p>bar
19328 </p>
19329 <pre>baz
19330 </pre>
19331 !! end
19332
19333 !!test
19334 Parsing of overlapping (improperly nested) inline html tags
19335 !! wikitext
19336 <span><s>x</span></s>
19337 !! html/php
19338 <p><span><s>x&lt;/span&gt;</s></span>
19339 </p>
19340 !! html/parsoid
19341 <p><span><s>x</s></span>
19342 </p>
19343 !!end
19344
19345 ###
19346 ### Language variants related tests
19347 ###
19348 !! test
19349 Self-link in language variants
19350 !! options
19351 title=[[Dunav]] language=sr
19352 !! wikitext
19353 Both [[Dunav]] and [[Дунав]] are names for this river.
19354 !! html
19355 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19356 </p>
19357 !!end
19358
19359 !! article
19360 Дуна
19361 !! text
19362 content
19363 !! endarticle
19364
19365 !! test
19366 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19367 !! options
19368 title=[[Duna]] language=sr
19369 !! wikitext
19370 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19371 !! html
19372 <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.
19373 </p>
19374 !! end
19375
19376 !! test
19377 Link to a section of a variant of this title shouldn't be parsed as self-link
19378 !! options
19379 title=[[Duna]] language=sr
19380 !! wikitext
19381 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19382 !! html
19383 <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.
19384 </p>
19385 !! end
19386
19387 !! test
19388 Link to pages in language variants
19389 !! options
19390 language=sr
19391 !! wikitext
19392 Main Page can be written as [[Маин Паге]]
19393 !! html
19394 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19395 </p>
19396 !!end
19397
19398
19399 !! test
19400 Multiple links to pages in language variants
19401 !! options
19402 language=sr
19403 !! wikitext
19404 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19405 !! html
19406 <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>.
19407 </p>
19408 !!end
19409
19410
19411 !! test
19412 Simple template in language variants
19413 !! options
19414 language=sr
19415 !! wikitext
19416 {{тест}}
19417 !! html
19418 <p>This is a test template
19419 </p>
19420 !! end
19421
19422
19423 !! test
19424 Template with explicit namespace in language variants
19425 !! options
19426 language=sr
19427 !! wikitext
19428 {{Template:тест}}
19429 !! html
19430 <p>This is a test template
19431 </p>
19432 !! end
19433
19434
19435 !! test
19436 Basic test for template parameter in language variants
19437 !! options
19438 language=sr
19439 !! wikitext
19440 {{парамтест|param=foo}}
19441 !! html
19442 <p>This is a test template with parameter foo
19443 </p>
19444 !! end
19445
19446
19447 !! test
19448 Simple category in language variants
19449 !! options
19450 language=sr cat
19451 !! wikitext
19452 [[Category:МедиаWики Усер'с Гуиде]]
19453 !! html
19454 <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>
19455 !! end
19456
19457
19458 !! article
19459 Category:分类
19460 !! text
19461 blah
19462 !! endarticle
19463
19464 !! article
19465 Category:分類
19466 !! text
19467 blah
19468 !! endarticle
19469
19470 ## We used to, but no longer wt2wt this test since the default serializer
19471 ## will normalize all categories to serialize on their own line.
19472 ## This wikitext usage is going to be fairly uncommon in production and
19473 ## selser will take care of preserving formatting in those scenarios.
19474 !! test
19475 Don't convert blue categorylinks to another variant (bug 33210)
19476 !! options
19477 cat
19478 language=zh
19479 parsoid=wt2html
19480 !! wikitext
19481 [[A]][[Category:分类]]
19482 !! html/php
19483 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19484 !! html/parsoid
19485 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19486 <link rel="mw:PageProp/Category" href="Category:分类"/>
19487 !! end
19488
19489 !! test
19490 Stripping -{}- tags (language variants)
19491 !! options
19492 language=sr
19493 !! wikitext
19494 Latin proverb: -{Ne nuntium necare}-
19495 !! html
19496 <p>Latin proverb: Ne nuntium necare
19497 </p>
19498 !! end
19499
19500
19501 !! test
19502 Prevent conversion with -{}- tags (language variants)
19503 !! options
19504 language=sr variant=sr-ec
19505 !! wikitext
19506 Latinski: -{Ne nuntium necare}-
19507 !! html
19508 <p>Латински: Ne nuntium necare
19509 </p>
19510 !! end
19511
19512
19513 !! test
19514 Prevent conversion of text with -{}- tags (language variants)
19515 !! options
19516 language=sr variant=sr-ec
19517 !! wikitext
19518 Latinski: -{Ne nuntium necare}-
19519 !! html
19520 <p>Латински: Ne nuntium necare
19521 </p>
19522 !! end
19523
19524
19525 !! test
19526 Prevent conversion of links with -{}- tags (language variants)
19527 !! options
19528 language=sr variant=sr-ec
19529 !! wikitext
19530 -{[[Main Page]]}-
19531 !! html
19532 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19533 </p>
19534 !! end
19535
19536
19537 !! test
19538 -{}- tags within headlines (within html for parserConvert())
19539 !! options
19540 language=sr variant=sr-ec
19541 !! wikitext
19542 == -{Naslov}- ==
19543 !! html
19544 <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>
19545
19546 !! end
19547
19548
19549 !! test
19550 Explicit definition of language variant alternatives
19551 !! options
19552 language=zh variant=zh-tw
19553 !! wikitext
19554 -{zh:China;zh-tw:Taiwan}-, not China
19555 !! html
19556 <p>Taiwan, not China
19557 </p>
19558 !! end
19559
19560
19561 !! test
19562 Conversion around HTML tags
19563 !! options
19564 language=sr variant=sr-ec
19565 !! wikitext
19566 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19567 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19568 !! html
19569 <p>
19570 <span title="ЛаCтин">ски</span>
19571 </p>
19572 !! end
19573
19574
19575 !! test
19576 Explicit session-wise language variant mapping (A flag and - flag)
19577 !! options
19578 language=zh variant=zh-tw
19579 !! wikitext
19580 Taiwan is not China.
19581 But -{A|zh:China;zh-tw:Taiwan}- is China,
19582 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19583 and -{China}- is China.
19584 !! html
19585 <p>Taiwan is not China.
19586 But Taiwan is Taiwan,
19587 (This should be stripped!)
19588 and China is China.
19589 </p>
19590 !! end
19591
19592 !! test
19593 Explicit session-wise language variant mapping (H flag for hide)
19594 !! options
19595 language=zh variant=zh-tw
19596 !! wikitext
19597 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19598 Taiwan is China.
19599 !! html
19600 <p>(This should be stripped!)
19601 Taiwan is Taiwan.
19602 </p>
19603 !! end
19604
19605 !! test
19606 Adding explicit conversion rule for title (T flag)
19607 !! options
19608 language=zh variant=zh-tw showtitle
19609 !! wikitext
19610 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19611 !! html
19612 Taiwan
19613 <p>Should be stripped!
19614 </p>
19615 !! end
19616
19617 !! test
19618 Testing that changing the language variant here in the tests actually works
19619 !! options
19620 language=zh variant=zh showtitle
19621 !! wikitext
19622 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19623 !! html
19624 China
19625 <p>Should be stripped!
19626 </p>
19627 !! end
19628
19629 !! test
19630 Recursive conversion of alt and title attrs shouldn't clear converter state
19631 !! options
19632 language=zh variant=zh-cn showtitle
19633 !! wikitext
19634 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19635 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19636 !! html
19637 China
19638 <p>
19639 Should be stripped<span title="Exclamation">!</span>
19640 </p>
19641 !! end
19642
19643 !! test
19644 Bug 24072: more test on conversion rule for title
19645 !! options
19646 language=zh variant=zh-tw showtitle
19647 !! wikitext
19648 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19649 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19650 !! html
19651 Taiwan
19652 <p>This should be stripped!
19653 This won't take interferes with the title rule.
19654 </p>
19655 !! end
19656
19657 !! test
19658 Partly disable title conversion if variant == main language code
19659 !! options
19660 language=zh variant=zh title=[[ZH]] showtitle
19661 !! wikitext
19662 -{T|zh-cn:CN;zh-tw:TW}-
19663 !! html
19664 ZH
19665 <p>
19666 </p>
19667 !! end
19668
19669 !! test
19670 Partly disable title conversion if variant == main language code, more
19671 !! options
19672 language=zh variant=zh title=[[ZH]] showtitle
19673 !! wikitext
19674 -{T|TW}-
19675 !! html
19676 ZH
19677 <p>
19678 </p>
19679 !! end
19680
19681 !! test
19682 Raw output of variant escape tags (R flag)
19683 !! options
19684 language=zh variant=zh-tw
19685 !! wikitext
19686 Raw: -{R|zh:China;zh-tw:Taiwan}-
19687 !! html
19688 <p>Raw: zh:China;zh-tw:Taiwan
19689 </p>
19690 !! end
19691
19692 !! test
19693 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19694 !! options
19695 language=zh variant=zh-cn
19696 !! input
19697 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19698 !! result
19699 <p>0
19700 </p>
19701 !! end
19702
19703 !! test
19704 Conversion rules from [numeric-only string] to [something else] (T48634)
19705 !! options
19706 language=zh variant=zh-cn
19707 !! input
19708 -{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
19709 !! result
19710 <p>D12345EE12345
19711 </p>
19712 !! end
19713
19714 !! test
19715 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19716 !! options
19717 language=zh variant=zh-cn
19718 !! input
19719 -{H|zh-cn:foo;zh-tw:;}-foobar
19720 !! result
19721 <p>foobar
19722 </p>
19723 !! end
19724
19725 !! test
19726 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19727 !! options
19728 language=zh variant=zh-cn
19729 !! input
19730 -{H|=>zh-cn:foo;}-foobar
19731 !! result
19732 <p>foobar
19733 </p>
19734 !! end
19735
19736 !! test
19737 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19738 !! options
19739 language=zh variant=zh-cn
19740 !! input
19741 -{H|}-foobar
19742 !! result
19743 <p>foobar
19744 </p>
19745 !! end
19746
19747 !! test
19748 Nested using of manual convert syntax
19749 !! options
19750 language=zh variant=zh-hk
19751 !! wikitext
19752 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19753 !! html
19754 <p>Nested: Hello Hong Kong!
19755 </p>
19756 !! end
19757
19758 !! test
19759 Proper conversion of text in external links
19760 !! options
19761 language=sr variant=sr-ec
19762 !! wikitext
19763 http://www.google.com
19764 gopher://www.google.com
19765 [http://www.google.com http://www.google.com]
19766 [gopher://www.google.com gopher://www.google.com]
19767 [https://www.google.com irc://www.google.com]
19768 [ftp://www.google.com www.google.com/ftp://dir]
19769 [//www.google.com www.google.com]
19770 !! html
19771 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19772 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19773 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19774 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19775 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19776 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19777 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19778 </p>
19779 !! end
19780
19781 !! test
19782 Do not convert roman numbers to language variants
19783 !! options
19784 language=sr variant=sr-ec
19785 !! wikitext
19786 Fridrih IV je car.
19787 !! html
19788 <p>Фридрих IV је цар.
19789 </p>
19790 !! end
19791
19792 !! test
19793 Unclosed language converter markup "-{"
19794 !! options
19795 language=sr
19796 !! wikitext
19797 -{T|hello
19798 !! html
19799 <p>-{T|hello
19800 </p>
19801 !! end
19802
19803 !! test
19804 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19805 !! options
19806 language=sr
19807 !! wikitext
19808 -{R|=&gt;}-
19809 !! html
19810 <p>=&gt;
19811 </p>
19812 !!end
19813
19814 !! test
19815 Don't break link parsing if language converter markup is in the caption.
19816 !! options
19817 language=sr variant=sr-ec
19818 !! wikitext
19819 [[Main Page|-{R|main page}-]]
19820 !! html
19821 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19822 </p>
19823 !! end
19824
19825 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19826 !! test
19827 Don't break image parsing if language converter markup is in the caption.
19828 !! options
19829 language=sr
19830 !! wikitext
19831 [[File:Foobar.jpg|-{R|caption}-]]
19832 !! html/parsoid
19833 <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>
19834 </p>
19835 !! end
19836
19837 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19838 !! test
19839 Don't break list handling if language converter markup is in the item.
19840 !! options
19841 language=zh variant=zh-cn
19842 !! wikitext
19843 ;-{zh-cn:AAA;zh-tw:BBB}-
19844 !! html/php
19845 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19846
19847 !! html/parsoid
19848 <dl><dt>AAA
19849 </dt></dl>
19850 !! end
19851
19852 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19853 !! test
19854 Don't break table handling if language converter markup is in the cell.
19855 !! options
19856 language=sr variant=sr-ec
19857 !! wikitext
19858 {|
19859 |-
19860 | -{R|B}-
19861 |}
19862 !! html/php
19863 <table>
19864
19865 <tr>
19866 <td>Б}-
19867 </td></tr></table>
19868
19869 !! html/parsoid
19870 <table>
19871
19872 <tr>
19873 <td> B
19874 </td></tr></table>
19875
19876 !! end
19877
19878 !! test
19879 Bug 529: Uncovered bullet
19880 !! wikitext
19881 * Foo {{bullet}}
19882 !! html
19883 <ul><li> Foo </li>
19884 <li> Bar</li></ul>
19885
19886 !! end
19887
19888 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19889 # Templates in Wikipedia rely on this behavior, as tidy has always been
19890 # enabled there. These tests are normally run *without* tidy, so specify the
19891 # full output here.
19892 # To test realistic parsing behavior, apply a tidy-like transformation to both
19893 # the expected output and your parser's output.
19894 !! test
19895 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19896 !! wikitext
19897 ******* Foo {{bullet}}
19898 !! html
19899 <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>
19900 <li> Bar</li></ul>
19901
19902 !! end
19903
19904 !! test
19905 Bug 529: Uncovered table already at line-start
19906 !! wikitext
19907 x
19908
19909 {{table}}
19910 y
19911 !! html
19912 <p>x
19913 </p>
19914 <table>
19915 <tr>
19916 <td> 1 </td>
19917 <td> 2
19918 </td></tr>
19919 <tr>
19920 <td> 3 </td>
19921 <td> 4
19922 </td></tr></table>
19923 <p>y
19924 </p>
19925 !! end
19926
19927 !! test
19928 Bug 529: Uncovered bullet in parser function result
19929 !! wikitext
19930 * Foo {{lc:{{bullet}} }}
19931 !! html
19932 <ul><li> Foo </li>
19933 <li> bar</li></ul>
19934
19935 !! end
19936
19937 !! test
19938 Bug 5678: Double-parsed template argument
19939 !! wikitext
19940 {{lc:{{{1}}}|hello}}
19941 !! html
19942 <p>{{{1}}}
19943 </p>
19944 !! end
19945
19946 !! test
19947 Bug 5678: Double-parsed template invocation
19948 !! wikitext
19949 {{lc:{{paramtest {{!}} param = hello }} }}
19950 !! html
19951 <p>{{paramtest | param = hello }}
19952 </p>
19953 !! end
19954
19955 !! test
19956 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19957 !! options
19958 language=cs
19959 title=[[Main Page]]
19960 !! wikitext
19961 {{PRVNÍVELKÉ:ěščř}}
19962 {{prvnívelké:ěščř}}
19963 {{PRVNÍMALÉ:ěščř}}
19964 {{prvnímalé:ěščř}}
19965 {{MALÁ:ěščř}}
19966 {{malá:ěščř}}
19967 {{VELKÁ:ěščř}}
19968 {{velká:ěščř}}
19969 !! html
19970 <p>Ěščř
19971 Ěščř
19972 ěščř
19973 ěščř
19974 ěščř
19975 ěščř
19976 ĚŠČŘ
19977 ĚŠČŘ
19978 </p>
19979 !! end
19980
19981 !! test
19982 Morwen/13: Unclosed link followed by heading
19983 !! wikitext
19984 [[link
19985 ==heading==
19986 !! html
19987 <p>[[link
19988 </p>
19989 <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>
19990
19991 !! end
19992
19993 !! test
19994 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19995 !! wikitext
19996 {{foo|
19997 =heading=
19998 !! html
19999 <p>{{foo|
20000 </p>
20001 <h1><span class="mw-headline" id="heading">heading</span></h1>
20002
20003 !! end
20004
20005 !! test
20006 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20007 !! wikitext
20008 {{foo|
20009 ==heading==
20010 !! html
20011 <p>{{foo|
20012 </p>
20013 <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>
20014
20015 !! end
20016
20017 !! test
20018 Tildes in comments
20019 !! options
20020 pst
20021 !! wikitext
20022 <!-- ~~~~ -->
20023 !! html/php
20024 <!-- ~~~~ -->
20025 !! end
20026
20027 !! test
20028 Paragraphs inside divs (no extra line breaks)
20029 !! wikitext
20030 <div>Line one
20031
20032 Line two</div>
20033 !! html
20034 <div>Line one
20035 Line two</div>
20036
20037 !! end
20038
20039 !! test
20040 Paragraphs inside divs (extra line break on open)
20041 !! wikitext
20042 <div>
20043 Line one
20044
20045 Line two</div>
20046 !! html
20047 <div>
20048 <p>Line one
20049 </p>
20050 Line two</div>
20051
20052 !! end
20053
20054 !! test
20055 Paragraphs inside divs (extra line break on close)
20056 !! wikitext
20057 <div>Line one
20058
20059 Line two
20060 </div>
20061 !! html
20062 <div>Line one
20063 <p>Line two
20064 </p>
20065 </div>
20066
20067 !! end
20068
20069 !! test
20070 Paragraphs inside divs (extra line break on open and close)
20071 !! wikitext
20072 <div>
20073 Line one
20074
20075 Line two
20076 </div>
20077 !! html
20078 <div>
20079 <p>Line one
20080 </p><p>Line two
20081 </p>
20082 </div>
20083
20084 !! end
20085
20086 !! test
20087 Nesting tags, paragraphs on lines which begin with <div>
20088 !! wikitext
20089 <div></div><strong>A
20090 B</strong>
20091 !! html/php+tidy
20092 <p><strong>A</strong></p>
20093 <p><strong>B</strong></p>
20094 !! html/parsoid
20095 <div></div>
20096 <p><strong>A
20097 B</strong>
20098 </p>
20099 !! end
20100
20101 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20102 !! test
20103 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20104 !! wikitext
20105 <blockquote>Line one
20106
20107 Line two</blockquote>
20108 !! html
20109 <blockquote>Line one
20110 Line two</blockquote>
20111
20112 !! html+tidy
20113 <blockquote>
20114 <p>Line one Line two</p>
20115 </blockquote>
20116 !! end
20117
20118 !! test
20119 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20120 !! wikitext
20121 <blockquote>
20122 Line one
20123
20124 Line two</blockquote>
20125 !! html
20126 <blockquote>
20127 <p>Line one
20128 </p>
20129 Line two</blockquote>
20130
20131 !! html+tidy
20132 <blockquote>
20133 <p>Line one</p>
20134 Line two</blockquote>
20135 !! end
20136
20137 !! test
20138 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20139 !! wikitext
20140 <blockquote>Line one
20141
20142 Line two
20143 </blockquote>
20144 !! html
20145 <blockquote>Line one
20146 <p>Line two
20147 </p>
20148 </blockquote>
20149
20150 !! html+tidy
20151 <blockquote>
20152 <p>Line one</p>
20153 <p>Line two</p>
20154 </blockquote>
20155 !! end
20156
20157 !! test
20158 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20159 !! wikitext
20160 <blockquote>
20161 Line one
20162
20163 Line two
20164 </blockquote>
20165 !! html
20166 <blockquote>
20167 <p>Line one
20168 </p><p>Line two
20169 </p>
20170 </blockquote>
20171
20172 !! html+tidy
20173 <blockquote>
20174 <p>Line one</p>
20175 <p>Line two</p>
20176 </blockquote>
20177 !! end
20178
20179 !! test
20180 Paragraphs inside blockquotes/divs (no extra line breaks)
20181 !! wikitext
20182 <blockquote><div>Line one
20183
20184 Line two</div></blockquote>
20185 !! html
20186 <blockquote><div>Line one
20187 Line two</div></blockquote>
20188
20189 !! end
20190
20191 !! test
20192 Paragraphs inside blockquotes/divs (extra line break on open)
20193 !! wikitext
20194 <blockquote><div>
20195 Line one
20196
20197 Line two</div></blockquote>
20198 !! html
20199 <blockquote><div>
20200 <p>Line one
20201 </p>
20202 Line two</div></blockquote>
20203
20204 !! end
20205
20206 !! test
20207 Paragraphs inside blockquotes/divs (extra line break on close)
20208 !! wikitext
20209 <blockquote><div>Line one
20210
20211 Line two
20212 </div></blockquote>
20213 !! html
20214 <blockquote><div>Line one
20215 <p>Line two
20216 </p>
20217 </div></blockquote>
20218
20219 !! end
20220
20221 !! test
20222 Paragraphs inside blockquotes/divs (extra line break on open and close)
20223 !! wikitext
20224 <blockquote><div>
20225 Line one
20226
20227 Line two
20228 </div></blockquote>
20229 !! html
20230 <blockquote><div>
20231 <p>Line one
20232 </p><p>Line two
20233 </p>
20234 </div></blockquote>
20235
20236 !! end
20237
20238 !! test
20239 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20240 !! options
20241 wgLinkHolderBatchSize=0
20242 !! wikitext
20243 [[meatball:1]]
20244 [[meatball:2]]
20245 [[meatball:3]]
20246 !! html
20247 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20248 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20249 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20250 </p>
20251 !! end
20252
20253 !! test
20254 Free external link invading image caption
20255 !! wikitext
20256 [[Image:Foobar.jpg|thumb|http://x|hello]]
20257 !! html
20258 <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>
20259
20260 !! end
20261
20262 !! test
20263 Bug 15196: localised external link numbers
20264 !! options
20265 language=fa
20266 !! wikitext
20267 [http://en.wikipedia.org/]
20268 !! html/php
20269 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20270 </p>
20271 !! html/parsoid
20272 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20273 !! end
20274
20275 !! test
20276 Multibyte character in padleft
20277 !! wikitext
20278 {{padleft:-Hello|7|Æ}}
20279 !! html
20280 <p>Æ-Hello
20281 </p>
20282 !! end
20283
20284 !! test
20285 Multibyte character in padright
20286 !! wikitext
20287 {{padright:Hello-|7|Æ}}
20288 !! html
20289 <p>Hello-Æ
20290 </p>
20291 !! end
20292
20293 !!test
20294 formatdate parser function
20295 !! wikitext
20296 {{#formatdate:2009-03-24}}
20297 !! html
20298 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20299 </p>
20300 !! end
20301
20302 !!test
20303 formatdate parser function, with default format
20304 !! wikitext
20305 {{#formatdate:2009-03-24|mdy}}
20306 !! html
20307 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20308 </p>
20309 !! end
20310
20311 !! test
20312 Spacing of numbers in formatted dates
20313 !! wikitext
20314 {{#formatdate:January 15}}
20315 !! html
20316 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20317 </p>
20318 !! end
20319
20320 !! test
20321 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
20322 !! options
20323 language=nl title=[[MediaWiki:Common.css]]
20324 !! wikitext
20325 {{#formatdate:2009-03-24|dmy}}
20326 !! html
20327 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20328 </p>
20329 !! end
20330
20331 #
20332 #
20333 #
20334
20335 #
20336 # Edit comments
20337 #
20338
20339 !! test
20340 Edit comment with link
20341 !! options
20342 comment
20343 !! wikitext
20344 I like the [[Main Page]] a lot
20345 !! html/php
20346 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20347 !!end
20348
20349 !! test
20350 Edit comment with link and link text
20351 !! options
20352 comment
20353 !! wikitext
20354 I like the [[Main Page|best pages]] a lot
20355 !! html/php
20356 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20357 !!end
20358
20359 !! test
20360 Edit comment with link and link text with suffix
20361 !! options
20362 comment
20363 !! wikitext
20364 I like the [[Main Page|best page]]s a lot
20365 !! html/php
20366 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20367 !!end
20368
20369 !! test
20370 Edit comment with section link (non-local, eg in history list)
20371 !! options
20372 comment title=[[Main Page]]
20373 !! wikitext
20374 /* External links */ removed bogus entries
20375 !! html/php
20376 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20377 !!end
20378
20379 !! test
20380 Edit comment with section link and text before it (non-local, eg in history list)
20381 !! options
20382 comment title=[[Main Page]]
20383 !! wikitext
20384 pre-comment text /* External links */ removed bogus entries
20385 !! html/php
20386 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>
20387 !!end
20388
20389 !! test
20390 Edit comment with section link (local, eg in diff view)
20391 !! options
20392 comment local title=[[Main Page]]
20393 !! wikitext
20394 /* External links */ removed bogus entries
20395 !! html/php
20396 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20397 !!end
20398
20399 !! test
20400 Edit comment with subpage link (bug 14080)
20401 !! options
20402 comment
20403 subpage
20404 title=[[Subpage test]]
20405 !! wikitext
20406 Poked at a [[/subpage]] here...
20407 !! html/php
20408 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20409 !!end
20410
20411 !! test
20412 Edit comment with subpage link and link text (bug 14080)
20413 !! options
20414 comment
20415 subpage
20416 title=[[Subpage test]]
20417 !! wikitext
20418 Poked at a [[/subpage|neat little page]] here...
20419 !! html/php
20420 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20421 !!end
20422
20423 !! test
20424 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20425 !! options
20426 comment
20427 title=[[Subpage test]]
20428 !! wikitext
20429 Poked at a [[/subpage]] here...
20430 !! html/php
20431 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...
20432 !!end
20433
20434 !! test
20435 Edit comment with bare anchor link (local, as on diff)
20436 !! options
20437 comment
20438 local
20439 title=[[Main Page]]
20440 !! wikitext
20441 [[#section]]
20442 !! html/php
20443 <a href="#section">#section</a>
20444 !! end
20445
20446 !! test
20447 Edit comment with bare anchor link (non-local, as on history)
20448 !! options
20449 comment
20450 title=[[Main Page]]
20451 !! wikitext
20452 [[#section]]
20453 !! html/php
20454 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20455 !! end
20456
20457 !! test
20458 Anchor starting with underscore
20459 !! options
20460 title=[[Foo]]
20461 !! wikitext
20462 [[#_ref|One]]
20463 !! html/php
20464 <p><a href="#_ref">One</a>
20465 </p>
20466 !! html/parsoid
20467 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20468 !! end
20469
20470 !! test
20471 Id starting with underscore
20472 !! wikitext
20473 <div id="_ref"></div>
20474 !! html/*
20475 <div id="_ref"></div>
20476
20477 !! end
20478
20479 !! test
20480 Space normalisation on autocomment (bug 22784)
20481 !! options
20482 comment
20483 title=[[Main Page]]
20484 !! wikitext
20485 /* __hello__world__ */
20486 !! html/php
20487 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20488 !! end
20489
20490 !! test
20491 percent-encoding and + signs in comments (Bug 26410)
20492 !! options
20493 comment
20494 !! wikitext
20495 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20496 !! html/php
20497 <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>
20498 !! end
20499
20500 # Parsoid doesn't support this yet: see bug 73581
20501 # but it *should* omit the 'src' attribute if the image is bad.
20502 # PHP side of tests was disabled in
20503 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20504 # because of issues in the PHP parserTests infrastructure
20505 # (but the output below is indeed what the PHP side emits)
20506 !! test
20507 Bad images - basic functionality
20508 !! wikitext
20509 [[File:Bad.jpg]]
20510 !! DISABLED/html/php
20511 !! html/parsoid
20512 <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>
20513 !! end
20514
20515 !! test
20516 Bad images - bug 16039: text after bad image disappears
20517 !! wikitext
20518 Foo bar
20519 [[File:Bad.jpg]]
20520 Bar foo
20521 !! DISABLED/html/php
20522 <p>Foo bar
20523 </p><p>Bar foo
20524 </p>
20525 !! html/parsoid
20526 <p>Foo bar
20527 <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>
20528 Bar foo</p>
20529 !! end
20530
20531 !! test
20532 Verify that displaytitle works (bug #22501) no displaytitle
20533 !! options
20534 showtitle
20535 !! config
20536 wgAllowDisplayTitle=true
20537 wgRestrictDisplayTitle=false
20538 !! wikitext
20539 this is not the the title
20540 !! html/php
20541 Parser test
20542 <p>this is not the the title
20543 </p>
20544 !! end
20545
20546 !! test
20547 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20548 !! options
20549 showtitle
20550 title=[[Screen]]
20551 !! config
20552 wgAllowDisplayTitle=true
20553 wgRestrictDisplayTitle=false
20554 !! wikitext
20555 this is not the the title
20556 {{DISPLAYTITLE:whatever}}
20557 !! html/php
20558 whatever
20559 <p>this is not the the title
20560 </p>
20561 !! end
20562
20563 !! test
20564 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20565 !! options
20566 showtitle
20567 title=[[Screen]]
20568 !! config
20569 wgAllowDisplayTitle=true
20570 wgRestrictDisplayTitle=true
20571 !! wikitext
20572 this is not the the title
20573 {{DISPLAYTITLE:whatever}}
20574 !! html/php
20575 Screen
20576 <p>this is not the the title
20577 </p>
20578 !! end
20579
20580 !! test
20581 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20582 !! options
20583 showtitle
20584 title=[[Screen]]
20585 !! config
20586 wgAllowDisplayTitle=true
20587 wgRestrictDisplayTitle=true
20588 !! wikitext
20589 this is not the the title
20590 {{DISPLAYTITLE:screen}}
20591 !! html/php
20592 screen
20593 <p>this is not the the title
20594 </p>
20595 !! end
20596
20597 !! test
20598 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20599 !! options
20600 showtitle
20601 title=[[Screen]]
20602 !! config
20603 wgAllowDisplayTitle=false
20604 !! wikitext
20605 this is not the the title
20606 {{DISPLAYTITLE:screen}}
20607 !! html/php
20608 Screen
20609 <p>this is not the the title
20610 <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>
20611 </p>
20612 !! end
20613
20614 !! test
20615 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20616 !! options
20617 showtitle
20618 title=[[Screen]]
20619 !! config
20620 wgAllowDisplayTitle=false
20621 !! wikitext
20622 this is not the the title
20623 !! html/php
20624 Screen
20625 <p>this is not the the title
20626 </p>
20627 !! end
20628
20629 !! test
20630 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20631 !! options
20632 showtitle
20633 title=[[Screen]]
20634 !! config
20635 wgAllowDisplayTitle=true
20636 wgRestrictDisplayTitle=true
20637 !! wikitext
20638 this is not the the title
20639 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20640 !! html/php
20641 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20642 <p>this is not the the title
20643 </p>
20644 !! end
20645
20646 !! test
20647 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20648 !! options
20649 showtitle
20650 title=[[Screen]]
20651 !! config
20652 wgAllowDisplayTitle=true
20653 wgRestrictDisplayTitle=true
20654 !! wikitext
20655 this is not the the title
20656 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20657 !! html/php
20658 <span style="color: red;">s</span>creen
20659 <p>this is not the the title
20660 </p>
20661 !! end
20662
20663 !! test
20664 Page status indicators: Empty name is invalid
20665 !! options
20666 showindicators
20667 !! wikitext
20668 <indicator name=" "></indicator>
20669 <indicator></indicator>
20670 !! html
20671 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20672 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20673 </p>
20674 !! end
20675
20676 !! test
20677 Page status indicators: Weird syntaxes that are okay
20678 !! options
20679 showindicators
20680 !! wikitext
20681 <indicator name="empty" />
20682 <indicator name="name"></indicator>
20683 !! html
20684 empty=
20685 name=
20686 <p><br />
20687 </p>
20688 !! end
20689
20690 !! test
20691 Page status indicators: Torture test
20692 !! options
20693 showindicators
20694 !! wikitext
20695 <indicator name="01">hello world</indicator>
20696 <indicator name="02">[[Main Page]]</indicator>
20697 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20698 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20699 <indicator name="05">* foo
20700 * bar</indicator>
20701 <indicator name="06"><nowiki>foo</nowiki></indicator>
20702 <indicator name="07"> Preformatted</indicator>
20703 <indicator name="08"><div>Broken tag</indicator>
20704 <indicator name="09">{| class=wikitable
20705 | cell
20706 |}</indicator>
20707 <indicator name="10">Two
20708
20709 paragraphs</indicator>
20710 !! html
20711 01=hello world
20712 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20713 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" />
20714 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>
20715 05=<ul><li> foo</li>
20716 <li> bar</li></ul>
20717
20718 06=foo
20719 07=<pre>Preformatted
20720 </pre>
20721 08=<div>Broken tag</div>
20722
20723 09=<table class="wikitable">
20724 <tr>
20725 <td> cell
20726 </td></tr></table>
20727
20728 10=<p>Two
20729 </p><p>paragraphs
20730 </p>
20731 <p><br />
20732 </p><p><br />
20733 </p><p><br />
20734 </p><p><br />
20735 </p><p><br />
20736 </p>
20737 !! end
20738
20739 !! test
20740 preload: check <noinclude> and <includeonly>
20741 !! options
20742 preload
20743 !! wikitext
20744 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20745 !! html/php
20746 Hello kind world.
20747 !! end
20748
20749 !! test
20750 preload: check <onlyinclude>
20751 !! options
20752 preload
20753 !! wikitext
20754 Goodbye <onlyinclude>Hello world</onlyinclude>
20755 !! html/php
20756 Hello world
20757 !! end
20758
20759 !! test
20760 preload: can pass tags through if we want to
20761 !! options
20762 preload
20763 !! wikitext
20764 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20765 !! html/php
20766 <includeonly>Hello world</includeonly>
20767 !! end
20768
20769 !! test
20770 preload: check that it doesn't try to do tricks
20771 !! options
20772 preload
20773 !! wikitext
20774 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20775 !! html/php
20776 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20777 !! end
20778
20779 !! test
20780 Play a bit with r67090 and bug 3158
20781 !! wikitext
20782 <div style="width:50% !important">&nbsp;</div>
20783 <div style="width:50%&nbsp;!important">&nbsp;</div>
20784 <div style="width:50%&#160;!important">&nbsp;</div>
20785 <div style="border : solid;">&nbsp;</div>
20786 !! html/php
20787 <div style="width:50% !important">&#160;</div>
20788 <div style="width:50% !important">&#160;</div>
20789 <div style="width:50% !important">&#160;</div>
20790 <div style="border&#160;: solid;">&#160;</div>
20791
20792 !! html/parsoid
20793 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20794 <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>
20795 <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>
20796 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20797
20798 !! end
20799
20800 !! test
20801 HTML5 data attributes
20802 !! wikitext
20803 <span data-foo="bar">Baz</span>
20804 <p data-abc-def_hij="">Quuz</p>
20805 !! html/php
20806 <p><span data-foo="bar">Baz</span>
20807 </p>
20808 <p data-abc-def_hij="">Quuz</p>
20809
20810 !! html/parsoid
20811 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20812 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20813 !! end
20814
20815 !! test
20816 Strip reserved data attributes
20817 !! wikitext
20818 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20819 !! html/php
20820 <div data-ok="fred">d</div>
20821
20822 !! html/parsoid
20823 <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>
20824 !! end
20825
20826 !! test
20827 percent-encoding and + signs in internal links (Bug 26410)
20828 !! wikitext
20829 [[User:+%]] [[Page+title%]]
20830 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20831 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20832 [[%33%45]] [[%33%45+]]
20833 !! html/php
20834 <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>
20835 <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>
20836 <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>
20837 <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>
20838 </p>
20839 !! html/parsoid
20840 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
20841 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
20842 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</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=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bar&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bar&amp;quot;},&amp;quot;dsr&amp;quot;:[94,101,2,2]}\">bar&lt;/a>"}'><a href="./File:%25+abc9"><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>
20843 <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>
20844 !! end
20845
20846 !! test
20847 Special characters in embedded file links (bug 27679)
20848 !! wikitext
20849 [[File:Contains & ampersand.jpg]]
20850 [[File:Does not exist.jpg|Title with & ampersand]]
20851 !! html/php
20852 <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>
20853 <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>
20854 </p>
20855 !! html/parsoid
20856 <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>
20857 <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>
20858 !! end
20859
20860 !! test
20861 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20862 !! wikitext
20863 Text&apos;s been normalized?
20864 !! html
20865 <p>Text&#39;s been normalized?
20866 </p>
20867 !! end
20868
20869 !! test
20870 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20871 !! wikitext
20872 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20873 !! html
20874 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20875 </p>
20876 !! end
20877
20878 !! test
20879 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20880 !! wikitext
20881 [http://www.example.org/ ideograms]
20882 !! html
20883 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20884 </p>
20885 !! end
20886
20887 !! test
20888 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20889 !! wikitext
20890 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20891 !! html
20892 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20893 </p>
20894 !! end
20895
20896 !! article
20897 Mediawiki:loop1
20898 !! text
20899 {{Identical|A}}
20900 !! endarticle
20901
20902 !! article
20903 Mediawiki:loop2
20904 !! text
20905 {{Identical|B}}
20906 !! endarticle
20907
20908 !! article
20909 Template:Identical
20910 !! text
20911 {{int:loop1}}
20912 {{int:loop2}}
20913 !! endarticle
20914
20915 !! test
20916 Bug 31098 Template which includes system messages which includes the template
20917 !! wikitext
20918 {{Identical}}
20919 !! html
20920 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20921 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20922 </p>
20923 !! end
20924
20925 !! test
20926 Bug31490 Turkish: ucfirst 'blah'
20927 !! options
20928 language=tr
20929 !! wikitext
20930 {{ucfirst:blah}}
20931 !! html
20932 <p>Blah
20933 </p>
20934 !! end
20935
20936 !! test
20937 Bug31490 Turkish: ucfirst 'ix'
20938 !! options
20939 language=tr
20940 !! wikitext
20941 {{ucfirst:ix}}
20942 !! html
20943 <p>İx
20944 </p>
20945 !! end
20946
20947 !! test
20948 Bug31490 Turkish: lcfirst 'BLAH'
20949 !! options
20950 language=tr
20951 !! wikitext
20952 {{lcfirst:BLAH}}
20953 !! html
20954 <p>bLAH
20955 </p>
20956 !! end
20957
20958 !! test
20959 Bug31490 Turkish: ucfırst (with a dotless i)
20960 !! options
20961 language=tr
20962 !! wikitext
20963 {{ucfırst:blah}}
20964 !! html
20965 <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>
20966 </p>
20967 !! end
20968
20969 !! test
20970 Bug31490 ucfırst (with a dotless i) with English language
20971 !! options
20972 language=en
20973 !! wikitext
20974 {{ucfırst:blah}}
20975 !! html
20976 <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>
20977 </p>
20978 !! end
20979
20980 !! test
20981 Bug 26375: TOC with italics
20982 !! options
20983 title=[[Main Page]]
20984 !! wikitext
20985 __TOC__
20986 == ''Lost'' episodes ==
20987 !! html
20988 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20989 <ul>
20990 <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>
20991 </ul>
20992 </div>
20993
20994 <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>
20995
20996 !! end
20997
20998 !! test
20999 Bug 26375: TOC with bold
21000 !! options
21001 title=[[Main Page]]
21002 !! wikitext
21003 __TOC__
21004 == '''should be bold''' then normal text ==
21005 !! html
21006 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21007 <ul>
21008 <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>
21009 </ul>
21010 </div>
21011
21012 <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>
21013
21014 !! end
21015
21016 !! test
21017 Bug 33845: Headings become cursive in TOC when they contain an image
21018 !! options
21019 title=[[Main Page]]
21020 !! wikitext
21021 __TOC__
21022 == Image [[Image:foobar.jpg]] ==
21023 !! html
21024 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21025 <ul>
21026 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21027 </ul>
21028 </div>
21029
21030 <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>
21031
21032 !! end
21033
21034 !! test
21035 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21036 !! options
21037 title=[[Main Page]]
21038 !! wikitext
21039 __TOC__
21040 == <blockquote>Quote</blockquote> ==
21041 !! html
21042 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21043 <ul>
21044 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21045 </ul>
21046 </div>
21047
21048 <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>
21049
21050 !! html+tidy
21051 <p></p>
21052 <div id="toc" class="toc">
21053 <div id="toctitle">
21054 <h2>Contents</h2>
21055 </div>
21056 <ul>
21057 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21058 </ul>
21059 </div>
21060 <p></p>
21061 <h2><span class="mw-headline" id="Quote"></span></h2>
21062 <blockquote>
21063 <p><span class="mw-headline" id="Quote">Quote</span></p>
21064 </blockquote>
21065 <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>
21066 !! end
21067
21068 !! test
21069 Unclosed tags in TOC
21070 !! options
21071 title=[[Main Page]]
21072 !! wikitext
21073 __TOC__
21074 == Proof: 2 < 3 ==
21075 <small>Hanc marginis exiguitas non caperet.</small>
21076 QED
21077 !! html
21078 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21079 <ul>
21080 <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>
21081 </ul>
21082 </div>
21083
21084 <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>
21085 <p><small>Hanc marginis exiguitas non caperet.</small>
21086 QED
21087 </p>
21088 !! end
21089
21090 !! test
21091 Multiple tags in TOC
21092 !! wikitext
21093 __TOC__
21094 == <i>Foo</i> <b>Bar</b> ==
21095
21096 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21097 !! html
21098 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21099 <ul>
21100 <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>
21101 <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>
21102 </ul>
21103 </div>
21104
21105 <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>
21106 <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>
21107
21108 !! html+tidy
21109 <p></p>
21110 <div id="toc" class="toc">
21111 <div id="toctitle">
21112 <h2>Contents</h2>
21113 </div>
21114 <ul>
21115 <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>
21116 <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>
21117 </ul>
21118 </div>
21119 <p></p>
21120 <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>
21121 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21122 <blockquote>
21123 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21124 </blockquote>
21125 <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>
21126 !! end
21127
21128 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21129 # html5 tag parsing.
21130 !! test
21131 Tags with parameters in TOC
21132 !! options
21133 parsoid=wt2html
21134 !! wikitext
21135 __TOC__
21136 == <sup class="in-h2">Hello</sup> ==
21137
21138 == <sup class="a > b">Evilbye</sup> ==
21139 !! html/php
21140 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21141 <ul>
21142 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21143 <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>
21144 </ul>
21145 </div>
21146
21147 <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>
21148 <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>
21149
21150 !! html/parsoid
21151 <meta property="mw:PageProp/toc" />
21152 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21153
21154 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21155 !! end
21156
21157 !! test
21158 span tags with directionality in TOC
21159 !! wikitext
21160 __TOC__
21161 == <span dir="ltr">C++</span> ==
21162
21163 == <span dir="rtl">זבנג!</span> ==
21164
21165 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21166
21167 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21168
21169 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
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="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
21174 <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>
21175 <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>
21176 <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>
21177 <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>
21178 </ul>
21179 </div>
21180
21181 <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>
21182 <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>
21183 <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>
21184 <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>
21185 <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>
21186
21187 !! end
21188
21189 !! test
21190 Bug 72884: bdi element in ToC
21191 !! wikitext
21192 __TOC__
21193 == <bdi>test</bdi> ==
21194 !! html
21195 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21196 <ul>
21197 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21198 </ul>
21199 </div>
21200
21201 <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>
21202
21203 !! end
21204
21205 # Note that the html output does not have the <p></p>, but the
21206 # html+tidy output *does*. This is because the empty <p></p> is
21207 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21208 !! test
21209 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21210 !! wikitext
21211 __TOC__
21212 == x ==
21213 !! html
21214 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21215 <ul>
21216 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21217 </ul>
21218 </div>
21219
21220 <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>
21221
21222 !! html+tidy
21223 <p></p>
21224 <div id="toc" class="toc">
21225 <div id="toctitle">
21226 <h2>Contents</h2>
21227 </div>
21228 <ul>
21229 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21230 </ul>
21231 </div>
21232 <p></p>
21233 <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>
21234 !! end
21235
21236 !! article
21237 MediaWiki:Bug32057
21238 !! text
21239 == {{int:headline_sample}} ==
21240 !! endarticle
21241
21242 !! test
21243 Bug 32057: Title needed when expanding <h> nodes.
21244 !! options
21245 title=[[Main Page]]
21246 !! wikitext
21247 {{int:Bug32057}}
21248 !! html
21249 <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>
21250
21251 !! end
21252
21253 !! test
21254 Strip marker in urlencode
21255 !! wikitext
21256 {{urlencode:x<nowiki/>y}}
21257 {{urlencode:x<nowiki/>y|wiki}}
21258 {{urlencode:x<nowiki/>y|path}}
21259 {{urlencode:x<pre id="one">two</pre>y}}
21260 !! html
21261 <p>xy
21262 xy
21263 xy
21264 xy
21265 </p>
21266 !! end
21267
21268 !! test
21269 Strip marker in lc
21270 !! wikitext
21271 {{lc:x<nowiki/>y}}
21272 !! html
21273 <p>xy
21274 </p>
21275 !! end
21276
21277 !! test
21278 Strip marker in uc
21279 !! wikitext
21280 {{uc:x<nowiki/>y}}
21281 !! html
21282 <p>XY
21283 </p>
21284 !! end
21285
21286 !! test
21287 Strip marker in formatNum
21288 !! wikitext
21289 {{formatnum:1<nowiki/>2}}
21290 {{formatnum:1<nowiki/>2|R}}
21291 !! html
21292 <p>12
21293 12
21294 </p>
21295 !! end
21296
21297 !! test
21298 Check noCommafy in formatNum
21299 !! options
21300 language=be-tarask
21301 !! wikitext
21302 {{formatnum:123456.78}}
21303 {{formatnum:123456.78|NOSEP}}
21304 !! html
21305 <p>123 456,78
21306 123456.78
21307 </p>
21308 !! end
21309
21310 !! test
21311 Wrong option for formatNum (bug 56199)
21312 !! wikitext
21313 {{formatnum:1,234.56|Random}}
21314 {{formatnum:1,234.56|EVERYTHING}}
21315 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21316 !! html
21317 <p>1,234.56
21318 1,234.56
21319 1,234.56
21320 </p>
21321 !! end
21322
21323 !! test
21324 Strip marker in grammar
21325 !! options
21326 language=fi
21327 !! wikitext
21328 {{grammar:elative|foo<nowiki/>bar}}
21329 !! html
21330 <p>foobarista
21331 </p>
21332 !! end
21333
21334 !! test
21335 Strip marker in padleft
21336 !! wikitext
21337 {{padleft:|2|x<nowiki/>y}}
21338 !! html
21339 <p>xy
21340 </p>
21341 !! end
21342
21343 !! test
21344 Strip marker in padright
21345 !! wikitext
21346 {{padright:|2|x<nowiki/>y}}
21347 !! html
21348 <p>xy
21349 </p>
21350 !! end
21351
21352 !! test
21353 Strip marker in anchorencode
21354 !! wikitext
21355 {{anchorencode:x<nowiki/>y}}
21356 !! html
21357 <p>xy
21358 </p>
21359 !! end
21360
21361 !! test
21362 nowiki inside link inside heading (bug 18295)
21363 !! wikitext
21364 ==[[foo|x<nowiki>y</nowiki>z]]==
21365 !! html
21366 <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>
21367
21368 !! end
21369
21370 !! test
21371 new support for bdi element (bug 31817)
21372 !! wikitext
21373 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21374 !! html
21375 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21376
21377 !!end
21378
21379 !! test
21380 Ignore pipe between table row attributes
21381 !! wikitext
21382 {|
21383 | quux
21384 |- id=foo | style='color: red'
21385 | bar
21386 |}
21387 !! html
21388 <table>
21389 <tr>
21390 <td> quux
21391 </td></tr>
21392 <tr id="foo" style="color: red">
21393 <td> bar
21394 </td></tr></table>
21395
21396 !! end
21397
21398 !!test
21399 Gallery override link with WikiLink (bug 34852)
21400 !! wikitext
21401 <gallery>
21402 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21403 </gallery>
21404 !! html
21405 <ul class="gallery mw-gallery-traditional">
21406 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21407 <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>
21408 <div class="gallerytext">
21409 <p>caption
21410 </p>
21411 </div>
21412 </div></li>
21413 </ul>
21414
21415 !! end
21416
21417 !!test
21418 Gallery override link with absolute external link (bug 34852)
21419 !! wikitext
21420 <gallery>
21421 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21422 </gallery>
21423 !! html
21424 <ul class="gallery mw-gallery-traditional">
21425 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21426 <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>
21427 <div class="gallerytext">
21428 <p>caption
21429 </p>
21430 </div>
21431 </div></li>
21432 </ul>
21433
21434 !! end
21435
21436 !!test
21437 Gallery override link with malicious javascript (bug 34852)
21438 !! wikitext
21439 <gallery>
21440 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21441 </gallery>
21442 !! html
21443 <ul class="gallery mw-gallery-traditional">
21444 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21445 <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>
21446 <div class="gallerytext">
21447 <p>caption
21448 </p>
21449 </div>
21450 </div></li>
21451 </ul>
21452
21453 !! end
21454
21455 !!test
21456 Gallery with invalid title as link (bug 43964)
21457 !! wikitext
21458 <gallery>
21459 File:foobar.jpg|link=<
21460 </gallery>
21461 !! html
21462 <ul class="gallery mw-gallery-traditional">
21463 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21464 <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>
21465 <div class="gallerytext">
21466 </div>
21467 </div></li>
21468 </ul>
21469
21470 !! end
21471
21472 !!test
21473 Language parser function
21474 !! wikitext
21475 {{#language:ar}}
21476 !! html
21477 <p>العربية
21478 </p>
21479 !! end
21480
21481 !!test
21482 Padleft and padright as substr
21483 !! wikitext
21484 {{padleft:|3|abcde}}
21485 {{padright:|3|abcde}}
21486 !! html
21487 <p>abc
21488 abc
21489 </p>
21490 !! end
21491
21492 !!test
21493 Special parser function
21494 !! wikitext
21495 {{#special:RandomPage}}
21496 {{#special:BaDtItLe}}
21497 {{#special:Foobar}}
21498 !! html
21499 <p>Special:Random
21500 Special:Badtitle
21501 Special:Foobar
21502 </p>
21503 !! end
21504
21505 !!test
21506 Bug 34939 - Case insensitive link parsing ([HttP://])
21507 !! wikitext
21508 [HttP://MediaWiki.Org/]
21509 !! html/php
21510 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21511 </p>
21512 !! html/parsoid
21513 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21514 !! end
21515
21516 !!test
21517 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21518 !! wikitext
21519 [HttP://MediaWiki.Org/ MediaWiki]
21520 !! html
21521 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21522 </p>
21523 !! end
21524
21525 !!test
21526 Bug 34939 - Case insensitive link parsing (HttP://)
21527 !! wikitext
21528 HttP://MediaWiki.Org/
21529 !! html/php
21530 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21531 </p>
21532 !! html/parsoid
21533 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21534 !! end
21535
21536 !!test
21537 Disable TOC
21538 !! options
21539 notoc
21540 !! wikitext
21541 Lead
21542 == Section 1 ==
21543 == Section 2 ==
21544 == Section 3 ==
21545 == Section 4 ==
21546 == Section 5 ==
21547 !! html
21548 <p>Lead
21549 </p>
21550
21551 <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>
21552 <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>
21553 <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>
21554 <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>
21555 <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>
21556
21557 !! end
21558
21559
21560 ###
21561 ### Parsoid-specific tests
21562 ### Parsoid-PHP parser incompatibilities
21563 ###
21564 !!test
21565 1. SOL-sensitive wikitext tokens as template-args
21566 !!options
21567 parsoid=wt2html,wt2wt
21568 !! wikitext
21569 {{echo|*a}}
21570 {{echo|#a}}
21571 {{echo|:a}}
21572 !! html
21573 <span about="#mwt1" typeof="mw:Transclusion">
21574 </span><ul about="#mwt1"><li>a</li>
21575 </ul>
21576 <span about="#mwt2" typeof="mw:Transclusion">
21577 </span><ol about="#mwt2"><li>a</li>
21578 </ol>
21579 <span about="#mwt3" typeof="mw:Transclusion">
21580 </span><dl about="#mwt3"><dd>a</dd>
21581 </dl>
21582 !!end
21583
21584 #### -----------------------------------------------------------------
21585 #### Parsoid-specific functionality tests
21586 #### -----------------------------------------------------------------
21587
21588 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21589 # We know wt2wt will fail, but we expect selser to pass.
21590 # Due to the nature of our testing, wt2wt and selser tests will enter the
21591 # blacklist and we'll catch selser regressions based on changes to the
21592 # blacklist entries for selser tests.
21593 !! test
21594 1. Bad treebuilder fixup of formatting elt is cleaned up
21595 !! options
21596 parsoid=wt2html,wt2wt
21597 !! wikitext
21598 {|
21599 |
21600 <small>
21601 [[Image:Foobar.jpg|right|Test]]
21602 </small>
21603 |}
21604 !! html/parsoid
21605 <table>
21606 <tbody><tr><td>
21607 <small>
21608 <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>
21609 </small>
21610 </td></tr>
21611 </tbody></table>
21612 !! end
21613
21614 !! test
21615 2. Bad treebuilder fixup of formatting elt is cleaned up
21616 !! options
21617 parsoid=wt2html,wt2wt
21618 !! wikitext
21619 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21620
21621 <small>[[Image:Foobar.jpg|right|300px]]</small>
21622 !! html/parsoid
21623
21624 <p><b>foo</b></p>
21625 <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>
21626 <p><b>bar</b></p>
21627 <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>
21628 !! end
21629
21630 !! test
21631 3. Bad treebuilder fixup of formatting elt is cleaned up
21632 !! options
21633 parsoid=wt2html,wt2wt
21634 !! wikitext
21635 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21636 !! html/parsoid
21637 <p><small><b>foo</b></small></p>
21638 <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>
21639 <p><small><b>bar</b></small></p>
21640 !! end
21641
21642 !! test
21643 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21644 !! options
21645 parsoid=wt2html,wt2wt
21646 !! wikitext
21647 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21648 !! html/parsoid
21649 <p><b><small></small></b></p>
21650 <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>
21651 <p></p>
21652 !! end
21653
21654 #### ----------------------------------------------------------------
21655 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21656 #### tags. Parsoid's output for these tags differs from that of the
21657 #### PHP parser.
21658 #### ----------------------------------------------------------------
21659
21660 !!test
21661 Ref: 1. ref-location should be replaced with an index span
21662 !! wikitext
21663 A <ref>foo</ref>
21664 B <ref name="x">foo</ref>
21665 C <ref name="y" />
21666 <references />
21667 !! html/parsoid
21668 <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>
21669 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>
21670 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>
21671 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21672 <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>
21673 <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>
21674 <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>
21675 </ol>
21676 !!end
21677
21678 !!test
21679 Ref: 2. ref-tags with identical names should all get the same index
21680 !! wikitext
21681 A <ref name="x">foo</ref>
21682 B <ref name="x" />
21683 <references />
21684 !! html/parsoid
21685 <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>
21686 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>
21687 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21688 <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>
21689 </ol>
21690 !!end
21691
21692 !!test
21693 Ref: 3. spaces in ref-names should be ignored
21694 !! wikitext
21695 A <ref name="x">foo</ref>
21696 B <ref name=" x " />
21697 C <ref name= x />
21698 <references />
21699 !! html/parsoid
21700 <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>
21701 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>
21702 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>
21703 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21704 <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>
21705 </ol>
21706 !!end
21707
21708 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21709 !!test
21710 Ref: 4. 'constructor' should be accepted as a valid ref-name
21711 !! wikitext
21712 A <ref name="constructor">foo</ref>
21713 <references />
21714 !! html/parsoid
21715 <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>
21716 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21717 <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>
21718 </ol>
21719 !!end
21720
21721 !!test
21722 Ref: 5. body should accept generic wikitext
21723 !! wikitext
21724 A <ref>
21725 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21726 </ref>
21727
21728 <references />
21729 !! html/parsoid
21730 <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>
21731
21732 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21733 <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>
21734 </span></li>
21735 </ol>
21736 !!end
21737
21738 !!test
21739 Ref: 6. indent-pres should not be output in ref-body
21740 !! wikitext
21741 A <ref>
21742 foo
21743 bar
21744 baz
21745 </ref>
21746
21747 <references />
21748 !! html/parsoid
21749 <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>
21750
21751 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21752 <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
21753 bar
21754 baz
21755 </span></li>
21756 </ol>
21757 !!end
21758
21759 !!test
21760 Ref: 7. No p-wrapping in ref-body
21761 !! wikitext
21762 A <ref>
21763 foo
21764
21765 bar
21766
21767
21768 baz
21769
21770
21771
21772 booz
21773 </ref>
21774
21775 <references />
21776 !! html/parsoid
21777 <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>
21778
21779 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21780 <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
21781
21782 bar
21783
21784
21785 baz
21786
21787
21788
21789 booz
21790 </span></li>
21791 </ol>
21792 !!end
21793
21794 !!test
21795 Ref: 8. transclusion wikitext has lower precedence
21796 !! wikitext
21797 A <ref> foo {{echo|</ref> B C}}
21798
21799 <references />
21800 !! html/parsoid
21801 <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>
21802 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21803 <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>
21804 </ol>
21805 !!end
21806
21807 !!test
21808 Ref: 9. unclosed comments should not leak out of ref-body
21809 !! wikitext
21810 A <ref> foo <!--</ref> B C
21811 <references />
21812 !! html/parsoid
21813 <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>
21814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21815 <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>
21816 </ol>
21817 !!end
21818
21819 !!test
21820 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21821 !! wikitext
21822 A <ref> <b> foo </ref> B C
21823
21824 <references />
21825 !! html/parsoid
21826 <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>
21827
21828
21829 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21830 <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>
21831 </ol>
21832 !!end
21833
21834 !!test
21835 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21836 !! wikitext
21837 A <ref>foo</ref> B
21838 C <ref>bar</ref> D
21839 <references />
21840 !! html/parsoid
21841 <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
21842 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>
21843 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21844 <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>
21845 <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>
21846 </ol>
21847 !!end
21848
21849 !!test
21850 Ref: 12. ref-tags act as trailing newline migration barrier
21851 !! wikitext
21852 <!--the newline at the end of this line moves out of the p tag-->a
21853
21854 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21855 <ref />
21856
21857 c
21858 <references />
21859 !! html/parsoid
21860 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21861
21862
21863 <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>
21864 <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>
21865
21866 <p>c</p>
21867 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21868 <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>
21869 <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>
21870 !!end
21871
21872 !!test
21873 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21874 !! wikitext
21875 <ref>foo</ref> A
21876 <ref>bar
21877 </ref> B
21878 <references />
21879 !! html/parsoid
21880 <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
21881 <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>
21882 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21883 <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>
21884 <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
21885 </span></li>
21886 </ol>
21887 !!end
21888
21889 !!test
21890 Ref: 14. A nested ref-tag should be emitted as plain text
21891 !! wikitext
21892 <ref>foo <ref>bar</ref> baz</ref>
21893
21894 <references />
21895 !! html/parsoid
21896 <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>
21897 </p>
21898 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21899 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
21900 </ol>
21901 !!end
21902
21903 !!test
21904 Ref: 15. ref-tags with identical names should get identical indexes
21905 !! wikitext
21906 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21907 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21908
21909 <references />
21910 !! html/parsoid
21911 <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>
21912 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>
21913
21914 <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>
21915 </ol>
21916 !!end
21917
21918 ## We don't bother wt2wt-ing non-standard whitespace
21919 !!test
21920 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21921 !!options
21922 parsoid=wt2html
21923 !! wikitext
21924 A <ref >foo</ref >
21925
21926 <references />
21927 !! html/parsoid
21928 <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>
21929 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21930 <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>
21931 !!end
21932
21933 !!test
21934 Ref: 17. Generate valid HTML5 id/about attributes
21935 !!wikitext
21936 <ref name="a b">foo</ref>
21937
21938 <references />
21939 !!html/parsoid
21940 <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>
21941 </p>
21942
21943 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21944 <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>
21945 </ol>
21946 !!end
21947
21948 !!test
21949 Ref: 18. T58916: Extension attributes should be parsed as plain text
21950 !!wikitext
21951 <ref name="{{echo|a}}">foo</ref>
21952
21953 <references />
21954 !!html/parsoid
21955 <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>
21956 </p>
21957
21958 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21959 <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>
21960 </ol>
21961 !!end
21962
21963 !!test
21964 Ref: 19. ref-tags with identical name encodings should get identical indexes
21965 !! wikitext
21966 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21967
21968 <references />
21969 !! html/parsoid
21970 <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>
21971 </p>
21972 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21973 <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>
21974 </ol>
21975 !!end
21976
21977 !!test
21978 Ref: 20. ref-tags with identical names but different content should keep it
21979 !! wikitext
21980 A <ref name="foo">Foo one</ref>
21981 B <ref name="foo">Foo two</ref>
21982 C <ref name="foo" />
21983
21984 <references />
21985 !! html/parsoid
21986 <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>
21987 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>
21988 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>
21989
21990 <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>
21991 </ol>
21992 !!end
21993
21994 !!test
21995 References: 1. references tag without any refs should be handled properly
21996 !! wikitext
21997 <references />
21998 !! html/parsoid
21999 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22000 !!end
22001
22002 !!test
22003 References: 2. references tag with group only outputs references from that group
22004 !! wikitext
22005 A <ref group="a">foo</ref>
22006 B <ref group="b">bar</ref>
22007 C <ref>baz</ref>
22008
22009 <references group="a" />
22010 <references />
22011 <references group="b" />
22012 !! html/parsoid
22013 <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>
22014 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>
22015 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>
22016
22017 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22018 <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>
22019 </ol>
22020 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22021 <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>
22022 </ol>
22023 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22024 <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>
22025 </ol>
22026 !!end
22027
22028 !!test
22029 References: 3. ref list should be cleared after processing references
22030 !! wikitext
22031 A <ref>foo</ref>
22032
22033 <references />
22034
22035 B <ref>bar</ref>
22036
22037 <references />
22038 !! html/parsoid
22039 <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>
22040
22041 <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>
22042 </ol>
22043
22044 <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>
22045
22046 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22047 <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>
22048 </ol>
22049 !!end
22050
22051 !!test
22052 References: 4. only referenced group should be cleared after processing references
22053 !! wikitext
22054 A <ref group="a">afoo</ref>
22055 B <ref>bfoo</ref>
22056
22057 <references group="a" />
22058
22059 C <ref>cfoo</ref>
22060
22061 <references />
22062 !! html/parsoid
22063 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22064 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>
22065
22066 <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>
22067 </ol>
22068
22069 <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>
22070
22071 <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>
22072 </ol>
22073 !!end
22074
22075 ## Don't expect this to rt since we're dropping content
22076 !! test
22077 References: 5. ref tags in references should be processed while ignoring all other content
22078 !! options
22079 parsoid=wt2html,html2html
22080 !! wikitext
22081 A <ref name="a" />
22082 B <ref name="b">bar</ref>
22083
22084 <references>
22085 <ref name="a">foo</ref>
22086 This should just get lost.
22087 </references>
22088 !! html/parsoid
22089 <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>
22090 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>
22091
22092
22093 <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;\">&lt;span class=\"mw-reflink-text\">[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>
22094 </ol>
22095 !! end
22096
22097 !! test
22098 References: 6. <references /> from a transclusion
22099 !! wikitext
22100 <ref>Foo</ref> {{echo|<references />}}
22101 !! html/parsoid
22102 <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>
22103 </ol>
22104 !! end
22105
22106 !! test
22107 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22108 !! wikitext
22109 A <ref>foo bar for a</ref>
22110 B <ref group="X" name="b" />
22111
22112 <references />
22113
22114 <references group="X">
22115 <ref name="b">foo</ref>
22116 </references>
22117 !! html/parsoid
22118 <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>
22119 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>
22120 </p>
22121
22122 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22123 <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>
22124 </ol>
22125
22126 <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\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22127 <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>
22128 </ol>
22129 !! end
22130
22131 !! test
22132 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22133 !! wikitext
22134 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22135 <references />
22136 !! html/parsoid
22137 <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>
22138 <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>
22139 </ol>
22140 !!end
22141
22142 # This test only works in wt2html now as the <references /> are always generated
22143 # unless selser is active. Once T72722 is fixed, we should add a changes test
22144 # here to ensure that unrelated changes don't add the new <references />
22145 # when selser is active.
22146 !! test
22147 References: 9. Generate missing references list at the end
22148 !! wikitext
22149 A <ref>foo</ref>
22150 B <ref group="inexistent">bar</ref>
22151 !! html/parsoid
22152 <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>
22153 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22154 <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>
22155 </ol>
22156 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22157 <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>
22158 </ol>
22159 !! end
22160
22161 !! test
22162 References: 10. New <references/> shouldn't be added for unrelated edits.
22163 !! options
22164 parsoid={
22165 "modes": ["selser"],
22166 "changes": [["#x", "remove"]],
22167 "selser": "noauto"
22168 }
22169 !! wikitext
22170 Unrelated text<span id="x"> that's going to disappear</span>.
22171 A <ref>foo</ref>
22172 !! wikitext/edited
22173 Unrelated text.
22174 A <ref>foo</ref>
22175 !!end
22176
22177 !! test
22178 Entities in ref name
22179 !! wikitext
22180 <ref name="test &amp; me">hi</ref>
22181 <references />
22182 !! html/parsoid
22183 <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>
22184 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22185 <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>
22186 </ol>
22187 !! end
22188
22189 # This test is wt2html only because we're permitting the serializer to produce
22190 # dirty diffs, normalizing the unclosed references to the self-closed version.
22191 !! test
22192 Generate references for unclosed references tag
22193 !! options
22194 parsoid=wt2html
22195 !! wikitext
22196 a<ref>foo</ref>
22197
22198 <references>
22199 !! html/parsoid
22200 <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>
22201 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22202 <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>
22203 !! end
22204
22205 !! test
22206 New reference serializes on its own line
22207 !! options
22208 parsoid=wt2wt,html2wt
22209 !! wikitext
22210 foo
22211 <references />
22212 !! html/parsoid
22213 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22214 !! end
22215
22216 #### ----------------------------------------------------------------
22217 #### Parsoid-only testing of Parsoid's impl of LST
22218 #### Not implemented yet, see
22219 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22220 #### ----------------------------------------------------------------
22221
22222 !! test
22223 LST Sections: 1. Simple section start and end
22224 !! options
22225 parsoid={ "suppressErrors": true }
22226 !! wikitext
22227 <section begin="2011-05-16" />
22228 <section end="2014-04-10 (MW 1.23wmf22)" />
22229 !! html/parsoid
22230 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22231 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22232 !! end
22233
22234 #--------- Test stripping of empty nodes in template content ----------
22235 !!test
22236 Empty LI and TR nodes should be stripped from template content
22237 !!wikitext
22238 {{EmptyLITest}}
22239 {{EmptyTRTest}}
22240 !!html/parsoid
22241 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22242 <li>a</li>
22243 <li>b</li>
22244 </ul>
22245 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22246 <tbody>
22247 <tr>
22248 <td>foo</td>
22249 </tr>
22250 <tr>
22251 <td>bar</td>
22252 </tr>
22253 </tbody>
22254 </table>
22255 !!end
22256
22257 !!test
22258 Empty LI and TR nodes should not be stripped from top-level content
22259 !!wikitext
22260 * a
22261 *
22262 * b
22263 {|
22264 |-
22265 |-
22266 |foo
22267 |}
22268 !!html/parsoid
22269 <ul>
22270 <li> a</li>
22271 <li></li>
22272 <li> b</li>
22273 </ul>
22274 <table>
22275 <tbody>
22276 <tr></tr>
22277 <tr>
22278 <td>foo</td>
22279 </tr>
22280 </tbody>
22281 </table>
22282 !!end
22283
22284 !!test
22285 Empty TR nodes should not be stripped if they have any attributes set
22286 !!wikitext
22287 {{EmptyTRWithHTMLAttrTest}}
22288 !!html/parsoid
22289 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22290 <tr align="center"></tr>
22291 <tr><td>foo</td></tr>
22292 <tr align="center"></tr>
22293 <tr><td>bar</td></tr>
22294 </table>
22295 !!end
22296
22297 #### ----------------------------------------------------------------
22298 #### The following section of tests are primarily to test
22299 #### wikitext escaping capabilities of Parsoid. Given that
22300 #### escaping can be done any number of ways, the wikitext (input)
22301 #### is always adjusted to reflect how Parsoid adds nowiki
22302 #### escape tags.
22303 ####
22304 #### We are marking several tests as parsoid-only since the
22305 #### HTML in the result section is different from what the
22306 #### PHP parser generates for it.
22307 #### ----------------------------------------------------------------
22308
22309
22310 #### --------------- Headings ---------------
22311 #### 0. Unnested
22312 #### 1. Nested inside html <h1>=foo=</h1>
22313 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22314 #### 3. Nested inside html with wikitext split by html tags
22315 #### 4. No escape needed
22316 #### 5. Empty headings <h1></h1>
22317 #### 6. Heading chars in SOL context
22318 #### ----------------------------------------
22319 !! test
22320 Headings: 0. Unnested
22321 !! options
22322 parsoid=html2wt
22323 !! html/parsoid
22324 <p>=foo=</p>
22325
22326 <p> =foo=
22327 <!--cmt-->
22328 =foo=</p>
22329
22330 <p>=foo<i>a</i>=</p>
22331 !! wikitext
22332 <nowiki>=foo=</nowiki>
22333
22334 <nowiki> </nowiki>=foo=
22335 <!--cmt-->
22336 <nowiki>=foo=</nowiki>
22337
22338 =foo''a''<nowiki>=</nowiki>
22339 !!end
22340
22341 # New headings and existing headings are handled differently
22342 !! test
22343 Headings: 1. Nested inside html
22344 !! options
22345 parsoid=html2wt
22346 !! html/parsoid
22347 <h1>=foo=</h1>
22348 <h2>=foo=</h2>
22349 <h3>=foo=</h3>
22350
22351 <h1 data-parsoid=''>=foo=</h1>
22352 <h2 data-parsoid=''>=foo=</h2>
22353 <h3 data-parsoid=''>=foo=</h3>
22354 <h4 data-parsoid=''>=foo=</h4>
22355 <h5 data-parsoid=''>=foo=</h5>
22356 <h6 data-parsoid=''>=foo=</h6>
22357 !! wikitext
22358 = =foo= =
22359
22360 == =foo= ==
22361
22362 === =foo= ===
22363
22364 =<nowiki>=foo=</nowiki>=
22365 ==<nowiki>=foo=</nowiki>==
22366 ===<nowiki>=foo=</nowiki>===
22367 ====<nowiki>=foo=</nowiki>====
22368 =====<nowiki>=foo=</nowiki>=====
22369 ======<nowiki>=foo=</nowiki>======
22370
22371 !!end
22372
22373 !! test
22374 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22375 !! options
22376 parsoid=html2wt
22377 !! html/parsoid
22378 <h1>foo</h1>*bar
22379 <h1>foo</h1>=bar
22380 <h1>foo</h1>=bar=
22381 !! wikitext
22382 = foo =
22383 <nowiki>*</nowiki>bar
22384
22385 = foo =
22386 =bar
22387
22388 = foo =
22389 <nowiki>=bar=</nowiki>
22390 !!end
22391
22392 !! test
22393 Headings: 3. Nested inside html with wikitext split by html tags
22394 !! options
22395 parsoid=html2wt
22396 !! html/parsoid
22397 <h1>=<b>bold</b>foo=</h1>
22398 !! wikitext
22399 = ='''bold'''foo= =
22400 !!end
22401
22402 !! test
22403 Headings: 4a. No escaping needed (testing just h1 and h2)
22404 !! options
22405 parsoid=html2wt
22406 !! html/parsoid
22407 <h1>=foo</h1>
22408 <h1>foo=</h1>
22409 <h1> =foo= </h1>
22410 <h1>=foo= bar</h1>
22411 <h2>=foo</h2>
22412 <h2>foo=</h2>
22413 <h1>=</h1>
22414 <h1><i>=</i>foo=</h1>
22415 !! wikitext
22416 = =foo =
22417
22418 = foo= =
22419
22420 = =foo= =
22421
22422 = =foo= bar =
22423
22424 == =foo ==
22425
22426 == foo= ==
22427
22428 = = =
22429
22430 = ''=''foo= =
22431 !!end
22432
22433 !! test
22434 Headings: 4b. No escaping needed (inside p-tags)
22435 !! options
22436 parsoid=html2wt
22437 !! html/parsoid
22438 <p>===
22439 =foo= x
22440 =foo= <s></s>
22441 </p>
22442 !! wikitext
22443 ===
22444 =foo= x
22445 =foo= <s></s>
22446 !!end
22447
22448 !! test
22449 Headings: 5. Empty headings
22450 !! options
22451 parsoid=html2wt
22452 !! html/parsoid
22453 <h1 data-parsoid='{}'></h1>
22454
22455 <h2 data-parsoid='{}'></h2>
22456
22457 <h3 data-parsoid='{}'></h3>
22458
22459 <h4 data-parsoid='{}'></h4>
22460
22461 <h5 data-parsoid='{}'></h5>
22462
22463 <h6 data-parsoid='{}'></h6>
22464 !! wikitext
22465 =<nowiki/>=
22466
22467 ==<nowiki/>==
22468
22469 ===<nowiki/>===
22470
22471 ====<nowiki/>====
22472
22473 =====<nowiki/>=====
22474
22475 ======<nowiki/>======
22476 !!end
22477
22478 !! test
22479 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22480 !! options
22481 parsoid=html2wt
22482 !! html/parsoid
22483 <p>=a=</p>
22484
22485 <p>=a=</p>
22486
22487 <p>=a=</p>
22488 !! wikitext
22489 <nowiki>=a=</nowiki>
22490
22491 <nowiki>=a=</nowiki>
22492
22493 <nowiki>=a=</nowiki>
22494 !!end
22495
22496 !! test
22497 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22498 !! options
22499 parsoid=html2wt
22500 !! html/parsoid
22501 <p>=a=
22502 b</p>
22503
22504 <p>=a=
22505 b</p>
22506
22507 <p>=a=
22508 b</p>
22509 !! wikitext
22510 <nowiki>=a=</nowiki>
22511 b
22512
22513 <nowiki>=a=</nowiki>
22514 b
22515
22516 <nowiki>=a=</nowiki>
22517 b
22518 !!end
22519
22520 !! test
22521 Headings: 6c. Heading chars in SOL context (leading newline break)
22522 !! options
22523 parsoid=html2wt
22524 !! html/parsoid
22525 <p>a
22526 =b=</p>
22527 !! wikitext
22528 a
22529 <nowiki>=b=</nowiki>
22530 !!end
22531
22532 !! test
22533 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22534 !! options
22535 parsoid=html2wt
22536 !! html/parsoid
22537 <!--c0--><p>=a=</p>
22538
22539 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22540 !! wikitext
22541 <!--c0--><nowiki>=a=</nowiki>
22542
22543 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22544 !!end
22545
22546 !! test
22547 Headings: 6d. Heading chars in SOL context (No escaping needed)
22548 !! options
22549 parsoid=html2wt
22550 !! html/parsoid
22551 =a=<div>b</div>
22552 !! wikitext
22553 =a=<div>b</div>
22554 !!end
22555
22556 !! test
22557 Headings: 7. Insert a newline between new content and headings
22558 !! options
22559 parsoid=html2wt
22560 !! html/parsoid
22561 <h2>NEW</h2>
22562 <p>new</p>
22563 <h2 data-parsoid='{}'>A</h2>
22564 <p data-parsoid='{}'>a</p>
22565 !! wikitext
22566 == NEW ==
22567 new
22568
22569 ==A==
22570 a
22571
22572 !! end
22573
22574 #### --------------- Lists ---------------
22575 #### 0. Outside nests (*foo, etc.)
22576 #### 1. Nested inside html <ul><li>*foo</li></ul>
22577 #### 2. Inside definition lists
22578 #### 3. Only bullets at start should be escaped
22579 #### 4. No escapes needed
22580 #### 5. No unnecessary escapes
22581 #### 6. Escape bullets in SOL position
22582 #### 7. Escape bullets in a multi-line context
22583 #### ----------------------------------------
22584
22585 !! test
22586 Lists: 0. Outside nests
22587 !! options
22588 parsoid=html2wt
22589 !! html/parsoid
22590 <p>*foo</p>
22591
22592 <p>#foo</p>
22593
22594 <p>;Foo:bar</p>
22595 !! wikitext
22596 <nowiki>*</nowiki>foo
22597
22598 <nowiki>#</nowiki>foo
22599
22600 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22601 !!end
22602
22603 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22604 ## to test wikitext escaping, and insignificant whitespace diffs
22605 ## cause PHP parser tests to barf
22606 !! test
22607 Lists: 1. Nested inside html (No unnecessary escapes)
22608 !! options
22609 parsoid=html2wt
22610 !! html/parsoid
22611 <ul>
22612 <li>*foo</li>
22613 <li>#foo</li>
22614 <li>:foo</li>
22615 <li>;foo</li>
22616 <li data-parsoid='{}'>*foo</li>
22617 <li data-parsoid='{}'>#foo</li>
22618 <li data-parsoid='{}'>:foo</li>
22619 <li data-parsoid='{}'>;foo</li>
22620 </ul>
22621
22622 <ol>
22623 <li>*foo</li>
22624 <li>#foo</li>
22625 <li>:foo</li>
22626 <li>;foo</li>
22627 <li data-parsoid='{}'>*foo</li>
22628 <li data-parsoid='{}'>#foo</li>
22629 <li data-parsoid='{}'>:foo</li>
22630 <li data-parsoid='{}'>;foo</li>
22631 </ol>
22632 !! wikitext
22633 * *foo
22634 * #foo
22635 * :foo
22636 * ;foo
22637 *<nowiki>*foo</nowiki>
22638 *<nowiki>#foo</nowiki>
22639 *<nowiki>:foo</nowiki>
22640 *<nowiki>;foo</nowiki>
22641
22642 # *foo
22643 # #foo
22644 # :foo
22645 # ;foo
22646 #<nowiki>*foo</nowiki>
22647 #<nowiki>#foo</nowiki>
22648 #<nowiki>:foo</nowiki>
22649 #<nowiki>;foo</nowiki>
22650 !!end
22651
22652 !! test
22653 Lists: 2. Inside definition lists
22654 !! options
22655 parsoid=html2wt
22656 !! html/parsoid
22657 <dl><dt>;foo</dt></dl>
22658 <dl><dt>:foo</dt></dl>
22659 <dl><dt>:foo</dt>
22660 <dd>bar</dd></dl>
22661 <dl><dd>:foo</dd></dl>
22662 !! wikitext
22663 ; ;foo
22664
22665 ; <nowiki>:foo</nowiki>
22666
22667 ; <nowiki>:foo</nowiki>
22668 : bar
22669
22670 : :foo
22671 !!end
22672
22673 !! test
22674 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22675 !! options
22676 parsoid=html2wt
22677 !! html/parsoid
22678 <ul>
22679 <li>*foo*bar</li>
22680 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22681 </ul>
22682 !! wikitext
22683 * *foo*bar
22684 *<nowiki>*foo</nowiki>''it''*bar
22685 !!end
22686
22687 !! test
22688 Lists: 4. No escapes needed
22689 !! options
22690 parsoid=html2wt
22691 !! html/parsoid
22692 <ul>
22693 <li>foo*bar
22694 </li>
22695 </ul>
22696 <ul>
22697 <li><i>foo</i>*bar
22698 </li>
22699 </ul>
22700 <ul>
22701 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22702 </li>
22703 </ul>
22704 <ul>
22705 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22706 </li>
22707 </ul>
22708 !! wikitext
22709 *foo*bar
22710
22711 *''foo''*bar
22712
22713 *[[Foo]]: bar
22714
22715 *[[Foo]]*bar
22716 !!end
22717
22718 !! test
22719 Lists: 5. No unnecessary escapes
22720 !! options
22721 parsoid=html2wt
22722 !! html/parsoid
22723 <ul><li> bar <span>[[foo]]</span></li></ul>
22724 <ul><li> =bar <span>[[foo]]</span></li></ul>
22725 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22726 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22727 <ul><li> =bar <span>foo]]</span>=</li></ul>
22728 <ul><li> <s></s>: a</li></ul>
22729 <ul><li> <i>* foo</i></li></ul>
22730
22731 !! wikitext
22732 * bar <span><nowiki>[[foo]]</nowiki></span>
22733
22734 * =bar <span><nowiki>[[foo]]</nowiki></span>
22735
22736 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22737
22738 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22739
22740 * =bar <span>foo]]</span>=
22741
22742 * <s></s>: a
22743
22744 * ''* foo''
22745 !!end
22746
22747 !! test
22748 Lists: 6. Escape bullets in SOL position
22749 !! options
22750 parsoid=html2wt
22751 !! html/parsoid
22752 <p><!--cmt-->*foo</p>
22753 !! wikitext
22754 <!--cmt--><nowiki>*</nowiki>foo
22755 !!end
22756
22757 !! test
22758 Lists: 7. Escape bullets in a multi-line context
22759 !! options
22760 parsoid=html2wt
22761 !! html/parsoid
22762 <p>a
22763 *b
22764 </p>
22765 !! wikitext
22766 a
22767 <nowiki>*</nowiki>b
22768 !!end
22769
22770 !! test
22771 Lists: 8. Escape colons only if not present in tags
22772 !! options
22773 parsoid=html2wt
22774 !! html/parsoid
22775 <dl><dt>a:b<i>c:d</i></dt></dl>
22776 !! wikitext
22777 ; <nowiki>a:b</nowiki>''c:d''
22778 !! end
22779
22780 #### --------------- HRs ---------------
22781 #### 1. Single line
22782 #### -----------------------------------
22783
22784 !! test
22785 HRs: 1. Single line
22786 !! options
22787 parsoid=html2wt
22788 !! html/parsoid
22789 <hr />----
22790 <hr />=foo=
22791 <hr />*foo
22792 !! wikitext
22793 ----<nowiki>----</nowiki>
22794 ----=foo=
22795 ----*foo
22796 !! end
22797
22798 #### --------------- Tables ---------------
22799 #### 1a. Simple example
22800 #### 1b. No escaping needed (!foo)
22801 #### 1c. No escaping needed (|foo)
22802 #### 1d. No escaping needed (|}foo)
22803 ####
22804 #### 2a. Nested in td (<td>foo|bar</td>)
22805 #### 2b. Nested in td (<td>foo||bar</td>)
22806 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22807 ####
22808 #### 3a. Nested in th (<th>foo!bar</th>)
22809 #### 3b. Nested in th (<th>foo!!bar</th>)
22810 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22811 ####
22812 #### 4a. Escape -
22813 #### 4b. Escape +
22814 #### 4c. No escaping needed
22815 #### --------------------------------------
22816
22817 !! test
22818 Tables: 1a. Simple example
22819 !! options
22820 parsoid=html2wt
22821 !! html/parsoid
22822 <p>{|
22823 |}
22824 </p>
22825 !! wikitext
22826 <nowiki>{|</nowiki>
22827 |}
22828 !! end
22829
22830 !! test
22831 Tables: 1b. No escaping needed
22832 !! options
22833 parsoid=html2wt
22834 !! html/parsoid
22835 <p>!foo
22836 </p>
22837 !! wikitext
22838 !foo
22839 !! end
22840
22841 !! test
22842 Tables: 1c. No escaping needed
22843 !! options
22844 parsoid=html2wt
22845 !! html/parsoid
22846 <p>|foo
22847 </p>
22848 !! wikitext
22849 |foo
22850 !! end
22851
22852 !! test
22853 Tables: 1d. No escaping needed
22854 !! options
22855 parsoid=html2wt
22856 !! html/parsoid
22857 <p>|}foo
22858 </p>
22859 !! wikitext
22860 |}foo
22861 !! end
22862
22863 !! test
22864 Tables: 2a. Nested in td
22865 !! options
22866 parsoid=html2wt
22867 !! html/parsoid
22868 <table><tbody><tr>
22869 <td>foo|bar</td></tr>
22870 <tr><td>x<div>a|b</div></td>
22871 </tbody></table>
22872 !! wikitext
22873 {|
22874 |<nowiki>foo|bar</nowiki>
22875 |-
22876 |x<div><nowiki>a|b</nowiki></div>
22877 |}
22878 !! html/php+tidy
22879 <table>
22880 <tr>
22881 <td>foo|bar</td>
22882 </tr>
22883 <tr>
22884 <td>x
22885 <div>a|b</div>
22886 </td>
22887 </tr>
22888 </table>
22889 !! end
22890
22891 !! test
22892 Tables: 2b. Nested in td
22893 !! options
22894 parsoid=html2wt
22895 !! html/parsoid
22896 <table><tbody><tr>
22897 <td>foo||bar</td>
22898 <td>a<i>b||c</i></td>
22899 <td>a<i><div>b||c</div></i></td>
22900 </tr></tbody></table>
22901 !! wikitext
22902 {|
22903 |<nowiki>foo||bar</nowiki>
22904 |a''<nowiki>b||c</nowiki>''
22905 |a''<div><nowiki>b||c</nowiki></div>''
22906 |}
22907 !! html/php
22908 <table>
22909 <tr>
22910 <td>foo||bar
22911 </td>
22912 <td>a<i>b||c</i>
22913 </td>
22914 <td>a<i><div>b||c</div></i>
22915 </td></tr></table>
22916
22917 !! end
22918
22919 !! test
22920 Tables: 2c. Nested in td -- no escaping needed
22921 !! options
22922 parsoid=html2wt
22923 !! html/*
22924 <table>
22925
22926 <tr>
22927 <td>foo!!bar
22928 </td></tr></table>
22929
22930 !! wikitext
22931 {|
22932
22933 |foo!!bar
22934 |}
22935 !! end
22936
22937 !! test
22938 Tables: 3a. Nested in th
22939 !! options
22940 parsoid=html2wt
22941 !! html/*
22942 <table>
22943
22944 <tr>
22945 <th>foo!bar
22946 </th></tr></table>
22947
22948 !! wikitext
22949 {|
22950
22951 !foo!bar
22952 |}
22953 !! end
22954
22955 !! test
22956 Tables: 3b. Nested in th
22957 !! options
22958 parsoid=html2wt
22959 !! html/parsoid
22960 <table><tbody>
22961 <tr><th>foo!!bar</th>
22962 <th><i>foo|bar</i></th>
22963 <th><i>foo!!bar</i></th>
22964 <th><i><span>foo!!bar</span></i></th>
22965 </tr></tbody></table>
22966 !! wikitext
22967 {|
22968 !<nowiki>foo!!bar</nowiki>
22969 !''<nowiki>foo|bar</nowiki>''
22970 !''<nowiki>foo!!bar</nowiki>''
22971 !''<span><nowiki>foo!!bar</nowiki></span>''
22972 |}
22973 !! html/php
22974 <table>
22975 <tr>
22976 <th>foo!!bar
22977 </th>
22978 <th><i>foo|bar</i>
22979 </th>
22980 <th><i>foo!!bar</i>
22981 </th>
22982 <th><i><span>foo!!bar</span></i>
22983 </th></tr></table>
22984
22985 !! end
22986
22987 !! test
22988 Tables: 3c. Nested in th
22989 !! options
22990 parsoid=html2wt
22991 !! html/parsoid
22992 <table><tbody>
22993 <tr><th>foo||bar</th>
22994 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22995 </tr></tbody></table>
22996 !! wikitext
22997 {|
22998 !<nowiki>foo||bar</nowiki>
22999 !<nowiki>foo||bar</nowiki>
23000 |}
23001 !! html/php
23002 <table>
23003 <tr>
23004 <th>foo||bar
23005 </th>
23006 <th>foo||bar
23007 </th></tr></table>
23008
23009 !! end
23010
23011 !! test
23012 Tables: 4a. Escape -
23013 !! options
23014 parsoid=html2wt
23015 !! html/*
23016 <table>
23017
23018 <tr>
23019 <th>-bar
23020 </th></tr>
23021 <tr>
23022 <td>-bar
23023 </td></tr></table>
23024
23025 !! wikitext
23026 {|
23027
23028 !-bar
23029
23030 |-
23031 |<nowiki>-bar</nowiki>
23032 |}
23033 !! end
23034
23035 !! test
23036 Tables: 4b. Escape +
23037 !! options
23038 parsoid=html2wt
23039 !! html/*
23040 <table>
23041
23042 <tr>
23043 <th>+bar
23044 </th></tr>
23045 <tr>
23046 <td>+bar
23047 </td></tr></table>
23048
23049 !! wikitext
23050 {|
23051
23052 !+bar
23053
23054 |-
23055 |<nowiki>+bar</nowiki>
23056 |}
23057 !! end
23058
23059 !! test
23060 Tables: 4c. No escaping needed
23061 !! options
23062 parsoid=html2wt
23063 !! html/parsoid
23064 <table><tbody>
23065 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23066 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23067 <tr><td>foo
23068 <p>bar|baz
23069 +bar
23070 -bar</p></td></tr>
23071 <tr><td>x
23072 <div>a|b</div></td>
23073 </tbody></table>
23074 !! wikitext
23075 {|
23076 |foo-bar
23077 |foo+bar
23078 |-
23079 |''foo''-bar
23080 |''foo''+bar
23081 |-
23082 |foo
23083 bar|baz
23084 +bar
23085 -bar
23086 |-
23087 |x
23088 <div>a|b</div>
23089 |}
23090 !! html/php
23091 <table>
23092 <tr>
23093 <td>foo-bar
23094 </td>
23095 <td>foo+bar
23096 </td></tr>
23097 <tr>
23098 <td><i>foo</i>-bar
23099 </td>
23100 <td><i>foo</i>+bar
23101 </td></tr>
23102 <tr>
23103 <td>foo
23104 <p>bar|baz
23105 +bar
23106 -bar
23107 </p>
23108 </td></tr>
23109 <tr>
23110 <td>x
23111 <div>a|b</div>
23112 </td></tr></table>
23113
23114 !! end
23115
23116 !! test
23117 Tables: 4d. No escaping needed
23118 !! options
23119 parsoid=html2wt
23120 !! html/parsoid
23121 <table>
23122 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23123 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23124 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23125 </tbody></table>
23126 !! wikitext
23127 {|
23128 |[[Foo]]-bar
23129 ||+1
23130 ||-2
23131 |}
23132 !! html/php
23133 <table>
23134 <tr>
23135 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23136 </td>
23137 <td>+1
23138 </td>
23139 <td>-2
23140 </td></tr></table>
23141
23142 !! end
23143
23144 !! test
23145 T97430: Don't emit empty nowiki pairs around marker meta tags
23146 !! options
23147 parsoid=html2wt
23148 !! html/parsoid
23149 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23150 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23151 !! wikitext
23152 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23153 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23154 !! end
23155
23156 !! test
23157 Unclosed xmlish element in table line shouldn't eat end delimiters
23158 !! options
23159 parsoid=html2wt
23160 !! html/parsoid
23161 <table>
23162 <tbody><tr><td> &lt;foo</td>
23163 <td> bar></td></tr>
23164 </tbody></table>
23165 !! wikitext
23166 {|
23167 | <foo
23168 | bar>
23169 |}
23170 !! html/php
23171 <table>
23172 <tr>
23173 <td> &lt;foo
23174 </td>
23175 <td> bar&gt;
23176 </td></tr></table>
23177
23178 !! end
23179
23180 #### --------------- Links ----------------
23181 #### 1. Quote marks in link text
23182 #### 2. Wikilinks: Escapes needed
23183 #### 3. Wikilinks: No escapes needed
23184 #### 4. Extlinks: Escapes needed
23185 #### 5. Extlinks: No escapes needed
23186 #### --------------------------------------
23187 !! test
23188 Links 1. WikiLinks: No escapes needed
23189 !! options
23190 parsoid=html2wt
23191 !! html/parsoid
23192 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23193 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23194 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23195 !! wikitext
23196 [[Foo|Foo''boo'']]
23197 [[Foo|[Foobar]]]
23198 [[Foo|x [Foobar] x]]
23199 !! html/php
23200 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23201 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23202 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23203 </p>
23204 !! end
23205
23206 !! test
23207 Links 2. WikiLinks: Escapes needed
23208 !! options
23209 parsoid=html2wt
23210 !! html/parsoid
23211 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23212 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23213 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23214 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23215 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23216 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23217 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23218 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23219 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23220 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23221 !! wikitext
23222 [[Foo|<nowiki>Foobar]</nowiki>]]
23223 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23224 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23225 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23226 [[Foo|<nowiki>|Bar</nowiki>]]
23227 [[Foo|<nowiki>]]bar</nowiki>]]
23228 [[Foo|<nowiki>[[bar</nowiki>]]
23229 [[Foo|<nowiki>x [[ y</nowiki>]]
23230 [[Foo|<nowiki>x ]] y</nowiki>]]
23231 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23232 !! html/php
23233 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23234 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23235 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23236 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23237 <a href="/wiki/Foo" title="Foo">|Bar</a>
23238 <a href="/wiki/Foo" title="Foo">]]bar</a>
23239 <a href="/wiki/Foo" title="Foo">[[bar</a>
23240 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23241 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23242 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23243 </p>
23244 !! end
23245
23246 !! test
23247 Links 3. WikiLinks: No escapes needed
23248 !! options
23249 parsoid=html2wt
23250 !! html/parsoid
23251 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23252 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23253 !! wikitext
23254 [[Foo|[Foobar]]
23255 [[Foo|foo|bar]]
23256 !! html/php
23257 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23258 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23259 </p>
23260 !! end
23261
23262 !! test
23263 Links 4. ExtLinks: Escapes needed
23264 !! options
23265 parsoid=html2wt
23266 !! html/parsoid
23267 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23268 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23269 <p>[http://google.com]</p>
23270 <p>[http://google.com google]</p>
23271 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23272 <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>
23273 !! wikitext
23274 [http://google.com <nowiki>[google]</nowiki>]
23275 [http://google.com <nowiki>google]</nowiki>]
23276
23277 <nowiki>[http://google.com]</nowiki>
23278
23279 <nowiki>[http://google.com google]</nowiki>
23280
23281 [http://google.com<nowiki>]</nowiki>
23282
23283 [{{echo|http://google.com}}<nowiki>]</nowiki>
23284 !! html/php
23285 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23286 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23287 </p><p>[http://google.com]
23288 </p><p>[http://google.com google]
23289 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23290 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23291 </p>
23292 !! end
23293
23294 !! test
23295 Links 5. ExtLinks: No escapes needed
23296 !! options
23297 parsoid=html2wt
23298 !! html/parsoid
23299 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23300 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23301 !! wikitext
23302 [http://google.com [google]
23303
23304 [[http://google.com]]
23305 !! html/php
23306 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23307 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23308 </p>
23309 !! end
23310
23311 !! test
23312 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23313 !! options
23314 parsoid=html2wt
23315 !! html/parsoid
23316 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23317 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23318 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23319 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23320 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23321 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23322 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23323 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23324 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23325 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23326 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23327 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23328 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23329 </p>
23330 !! wikitext
23331 x<nowiki/>http://example.com<nowiki/>y
23332 http://example.com<nowiki/>?x
23333 http://example.com<nowiki/>&x
23334 http://example.com<nowiki/>'x
23335 http://example.com<nowiki/>,x
23336 http://example.com<nowiki/>.x
23337 http://example.com<nowiki/>;x
23338 http://example.com<nowiki/>:x
23339 http://example.com<nowiki/>;x
23340 http://example.com<nowiki/>!x
23341 http://example.com<nowiki/>=x
23342 http://example.com<nowiki/>(x)
23343 http://example.com(x<nowiki/>)
23344 !! end
23345
23346 !! test
23347 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23348 !! options
23349 parsoid=html2wt
23350 !! html/parsoid
23351 <p>x
23352 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23353 y
23354 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23355 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23356 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23357 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23358 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23359 </p>
23360 !! wikitext
23361 x
23362 http://example.com
23363 y
23364 "http://example.com"
23365 (http://example.com)
23366 (http://example.com) foo
23367 http://example.com,
23368 http://example.com, foo
23369 !! html/php
23370 <p>x
23371 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23372 y
23373 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23374 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23375 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23376 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23377 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23378 </p>
23379 !! end
23380
23381 !! test
23382 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23383 !! options
23384 parsoid=html2wt
23385 !! html/parsoid
23386 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23387 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23388 !! wikitext
23389 http://example.com.,;:!?\
23390 -http://example.com:
23391 !! html/php
23392 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23393 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23394 </p>
23395 !! end
23396
23397 !! test
23398 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23399 !! options
23400 parsoid=html2wt
23401 !! html/parsoid
23402 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23403 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23404 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23405 !! wikitext
23406 RFC 123<nowiki/>4
23407 RFC 123<nowiki/>y
23408 X<nowiki/>RFC 123<nowiki/>y
23409 !! end
23410
23411 !! test
23412 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23413 !! options
23414 parsoid=html2wt
23415 !! html/parsoid
23416 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23417 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23418 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23419 </p>
23420 !! wikitext
23421 RFC 123?foo
23422 RFC 123&foo
23423 -RFC 123-
23424 !! html/php
23425 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23426 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23427 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23428 </p>
23429 !! end
23430
23431 !! test
23432 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23437 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23438 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23439 !! wikitext
23440 PMID 123<nowiki/>4
23441 PMID 123<nowiki/>y
23442 X<nowiki/>PMID 123<nowiki/>y
23443 !! end
23444
23445 !! test
23446 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23447 !! options
23448 parsoid=html2wt
23449 !! html/parsoid
23450 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23451 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23452 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23453 </p>
23454 !! wikitext
23455 PMID 123?foo
23456 PMID 123&foo
23457 -PMID 123-
23458 !! html/php
23459 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23460 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23461 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23462 </p>
23463 !! end
23464
23465 !! test
23466 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23467 !! options
23468 parsoid=html2wt
23469 !! html/parsoid
23470 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23471 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23472 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23473 </p>
23474 !! wikitext
23475 ISBN 1234567890<nowiki/>1
23476 ISBN 1234567890<nowiki/>x
23477 a<nowiki/>ISBN 1234567890<nowiki/>b
23478 !! end
23479
23480 !! test
23481 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23482 !! options
23483 parsoid=html2wt
23484 !! html/parsoid
23485 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23486 !! wikitext
23487 -ISBN 1234567890's
23488 !! html/php
23489 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23490 </p>
23491 !! end
23492
23493 !! test
23494 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23495 !! options
23496 parsoid=html2wt
23497 !! html/*
23498 <p>this is not a link: http://example.com
23499 </p>
23500 !! wikitext
23501 this is not a link: <nowiki>http://example.com</nowiki>
23502 !! end
23503
23504 !! test
23505 Links 15. Link trails can't become link prefixes.
23506 !! options
23507 language=is
23508 parsoid=html2wt
23509 !! html/parsoid
23510 <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>
23511 !! wikitext
23512 [[Söfnuður]]-[[00]]
23513 !! html/php
23514 <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>
23515 </p>
23516 !! end
23517
23518 #### --------------- Quotes ---------------
23519 #### 1. Quotes inside <b> and <i>
23520 #### 2. Link fragments separated by <i> and <b> tags
23521 #### 3. Link fragments inside <i> and <b>
23522 #### 4. No escaping needed
23523 #### --------------------------------------
23524 !! test
23525 1a. Quotes inside <b> and <i>
23526 !! options
23527 parsoid=html2wt
23528 !! html/*
23529 <p><i>'foo'</i>
23530 <i>''foo''</i>
23531 <i>'''foo'''</i>
23532 <i>foo</i>'s
23533 <b>'foo'</b>
23534 <b>''foo''</b>
23535 <b>'''foo'''</b>
23536 <b>foo'<i>bar'</i>baz</b>
23537 <b>foo</b>'s
23538 '<i>foo</i>
23539 <i>foo</i>'
23540 <i>foo'</i>'
23541 '<i>foo</i>'
23542 '<b>foo</b>
23543 <b>foo</b>'
23544 '<b>foo</b>'
23545 <i>fools'<span> errand</span></i>
23546 <i><span>fool</span>'s errand</i>
23547 '<i>foo</i> bar '<i>baz</i>
23548 a|!*#-:;+-~[]{}b'<i>x</i>
23549 </p>
23550 !! wikitext
23551 ''<nowiki/>'foo'''
23552 ''<nowiki>''foo''</nowiki>''
23553 ''<nowiki>'''foo'''</nowiki>''
23554 ''foo''<nowiki/>'s
23555 '''<nowiki/>'foo''''
23556 '''<nowiki>''foo''</nowiki>'''
23557 '''<nowiki>'''foo'''</nowiki>'''
23558 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23559 '''foo'''<nowiki/>'s
23560 '''foo''
23561 ''foo''<nowiki/>'
23562 ''foo'''<nowiki/>'
23563 '''foo''<nowiki/>'
23564 ''''foo'''
23565 '''foo'''<nowiki/>'
23566 ''''foo'''<nowiki/>'
23567 ''fools'<span> errand</span>''
23568 ''<span>fool</span>'s errand''
23569 '<nowiki/>''foo'' bar '''baz''
23570 a|!*#-:;+-~[]{}b'''x''
23571 !! end
23572
23573 !! test
23574 1b. Quotes inside <b> and <i> with other tags on same line
23575 !! options
23576 parsoid=html2wt
23577 !! html/parsoid
23578 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23579 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23580 <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>
23581 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23582 '<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>
23583 '<i>foo</i> <div title="name">test</div>
23584 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23585 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23586 <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>
23587 </ol>
23588 !! wikitext
23589 '''a'' foo ''[[bar]]''
23590 ''a''' foo ''[[bar]]''
23591 ''a''' foo '''{{echo|[[bar]]}}'''
23592 [[foo]] x'''[[bar]]''
23593 '''foo'' <ref>test</ref>
23594 '''foo'' <div title="name">test</div>
23595 '''foo'' and <br> bar
23596 <references />
23597 !! end
23598
23599 !! test
23600 2. Link fragments separated by <i> and <b> tags
23601 !! options
23602 parsoid=html2wt
23603 !! html/parsoid
23604 <p>[[<i>foo</i>hello]]</p>
23605 <p>[[<b>foo</b>hello]]</p>
23606 !! wikitext
23607 [[''foo''<nowiki>hello]]</nowiki>
23608
23609 [['''foo'''<nowiki>hello]]</nowiki>
23610 !! end
23611
23612 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23613 # this is one of the shortcomings of this format
23614 !! test
23615 3. Link fragments inside <i> and <b>
23616 !! options
23617 parsoid=html2wt
23618 !! html/parsoid
23619 <p><i>[[foo</i>]]</p>
23620 <p><b>[[foo</b>]]</p>
23621 !! wikitext
23622 ''[[foo''<nowiki>]]</nowiki>
23623
23624 '''[[foo'''<nowiki>]]</nowiki>
23625 !! end
23626
23627 !! test
23628 4. No escaping needed
23629 !! options
23630 options=html2wt
23631 !! html/parsoid
23632 <p>'<span><i>bar</i></span>'
23633 '<span><b>bar</b></span>'
23634 'a:b'foo
23635 </p>
23636 !! wikitext
23637 '<span>''bar''</span>'
23638 '<span>'''bar'''</span>'
23639 'a:b'foo
23640 !! end
23641
23642 #### ----------- Paragraphs ---------------
23643 #### 1. No unnecessary escapes
23644 #### --------------------------------------
23645
23646 !! test
23647 1. No unnecessary escapes
23648 !! options
23649 parsoid=html2wt
23650 !! html/parsoid
23651 <p>bar <span>[[foo]]</span>
23652 </p><p>=bar <span>[[foo]]</span>
23653 </p><p>[[bar <span>[[foo]]</span>
23654 </p><p>]]bar <span>[[foo]]</span>
23655 </p><p>=bar <span>foo]]</span>=
23656 </p>
23657 !! wikitext
23658 bar <span><nowiki>[[foo]]</nowiki></span>
23659
23660 =bar <span><nowiki>[[foo]]</nowiki></span>
23661
23662 [[bar <span><nowiki>[[foo]]</nowiki></span>
23663
23664 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23665
23666 =bar <span>foo]]</span><nowiki>=</nowiki>
23667 !!end
23668
23669 #### ----------------------- PRE --------------------------
23670 #### 1. Leading whitespace in SOL context should be escaped
23671 #### ------------------------------------------------------
23672 !! test
23673 1. Leading whitespace in SOL context should be escaped
23674 !! options
23675 parsoid=html2wt
23676 !! html/parsoid
23677 <p> a</p>
23678
23679 <p> a</p>
23680
23681 <p> a(tab)</p>
23682
23683 <p> a
23684 <!--cmt-->
23685 a</p>
23686
23687 <p>a
23688 b</p>
23689
23690 <p>a
23691 b</p>
23692
23693 <p>a
23694 b</p>
23695 !! wikitext
23696 <nowiki> </nowiki>a
23697
23698 <nowiki> </nowiki> a
23699
23700 a(tab)
23701
23702 <nowiki> </nowiki> a
23703 <!--cmt-->
23704 <nowiki> </nowiki>a
23705
23706 a
23707 <nowiki> </nowiki>b
23708
23709 a
23710 b
23711
23712 a
23713 b
23714 !! html/php
23715 <p> a
23716 </p><p> a
23717 </p><p> a(tab)
23718 </p><p> a
23719 a
23720 </p><p>a
23721 b
23722 </p><p>a
23723 b
23724 </p><p>a
23725 b
23726 </p>
23727 !! end
23728
23729 !! test
23730 2. Leading whitespace in non-indent-pre contexts should not be escaped
23731 !! options
23732 parsoid=htm2wt
23733 !! html/parsoid
23734 <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>
23735 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23736 <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 data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
23737 b</span></li>
23738 </ol>
23739 !! wikitext
23740 foo <ref>''a''
23741 b</ref>
23742 <references />
23743 !! end
23744
23745 !! test
23746 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23747 !! options
23748 parsoid=html2wt
23749 !! html/parsoid
23750 <blockquote>
23751 <p>
23752 a
23753 <span>b</span>
23754 c</p>
23755 </blockquote>
23756 !! wikitext
23757 <blockquote>
23758 a
23759 <span>b</span>
23760 c
23761 </blockquote>
23762 !! end
23763
23764 !! test
23765 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23766 !! options
23767 options=html2wt
23768 !! html/parsoid
23769 <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>
23770 !! wikitext
23771 [[File:Foobar.jpg|thumb|caption]]
23772 !! end
23773
23774 !! test
23775 5. Nowiki escaping should account for indent-pres
23776 !! options
23777 parsoid=html2wt
23778 !! html/parsoid
23779 <pre>==foo==</pre>
23780 !! wikitext
23781 ==foo==
23782 !! end
23783
23784 !!test
23785 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23786 !! options
23787 parsoid=html2wt
23788 !! html/parsoid
23789 <pre>
23790 * foo
23791 * bar
23792 </pre>
23793 !! wikitext
23794 * foo
23795 * bar
23796 !! end
23797
23798 #### --------------- Behavior Switches --------------------
23799
23800 !! test
23801 1. Valid behavior switches should be escaped
23802 !! options
23803 parsoid=html2wt
23804 !! html/parsoid
23805 __TOC__
23806 <i>__TOC__</i>
23807 !! wikitext
23808 <nowiki>__TOC__</nowiki>
23809 ''<nowiki>__TOC__</nowiki>''
23810 !! end
23811
23812 !! test
23813 2. Invalid behavior switches should not be escaped
23814 !! options
23815 parsoid=html2wt
23816 !! html/parsoid
23817 __TOO__
23818 __|__
23819 !! wikitext
23820 __TOO__
23821 __|__
23822 !! end
23823
23824 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23825 !! test
23826 Behavior switches should be SOL-transparent
23827 !! options
23828 parsoid=html2wt
23829 !! html/parsoid
23830 <meta property="mw:PageProp/toc" />
23831
23832 <!-- this one's bogus -->
23833 <pre>__TOO__</pre>
23834
23835 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23836
23837 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23838 !! wikitext
23839 __TOC__
23840
23841 <!-- this one's bogus -->
23842 __TOO__
23843
23844 __TOC__ foo
23845
23846 __TOC__
23847 bar
23848 !! end
23849
23850 #### --------------- HTML tags ---------------
23851 #### 1. a tags
23852 #### 2. other tags
23853 #### 3. multi-line html tag
23854 #### 4. extension tags
23855 #### -----------------------------------------
23856 !! test
23857 1. a tags
23858 !! options
23859 parsoid=html2wt
23860 !! html/parsoid
23861 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23862 !! wikitext
23863 <a href="http://google.com">google</a>
23864 !! end
23865
23866 !! test
23867 2. other tags
23868 !! options
23869 parsoid=html2wt
23870 !! html/parsoid
23871 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23872 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23873 <li> &lt;td&gt;</li></ul>
23874
23875 !! wikitext
23876 * <nowiki><div>foo</div></nowiki>
23877 * <nowiki><div style="color:red">foo</div></nowiki>
23878 * <nowiki><td></nowiki>
23879 !! end
23880
23881 !! test
23882 3. multi-line html tag
23883 !! options
23884 parsoid=html2wt
23885 !! html/parsoid
23886 <p>&lt;div
23887 &gt;foo&lt;/div
23888 &gt;
23889 </p>
23890 !! wikitext
23891 <nowiki><div
23892 >foo</div
23893 ></nowiki>
23894 !! end
23895
23896 !! test
23897 4. extension tags
23898 !! options
23899 parsoid=html2wt
23900 !! html/parsoid
23901 <p>&lt;ref&gt;foo&lt;/ref&gt;
23902 </p><p>&lt;ref&gt;bar
23903 </p><p>baz&lt;/ref&gt;
23904 </p>
23905 !! wikitext
23906 <nowiki><ref>foo</ref></nowiki>
23907
23908 <nowiki><ref>bar</nowiki>
23909
23910 baz<nowiki></ref></nowiki>
23911 !! end
23912
23913 #### --------------- Others ---------------
23914 !! test
23915 Escaping nowikis
23916 !! options
23917 parsoid=html2wt
23918 !! html/parsoid
23919 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23920 </p>
23921 !! wikitext
23922 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23923 !! end
23924
23925 ## The quote-char in the input is necessary for triggering the bug
23926 !! test
23927 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23928 !! options
23929 parsoid=html2wt
23930 !! html/parsoid
23931 <p>foo's bar :</p>
23932 !! wikitext
23933 foo's bar :
23934 !! end
23935
23936 #----------- End of wikitext escaping tests --------------
23937
23938 !! test
23939
23940 Tag-like HTML structures are passed through as text
23941 !! wikitext
23942 <x y>
23943
23944 <x.y>
23945
23946 <x-y>
23947
23948 1>2
23949
23950 x<y
23951
23952 a>b
23953
23954 1<d e>f
23955 !! html
23956 <p>&lt;x y&gt;
23957 </p><p>&lt;x.y&gt;
23958 </p><p>&lt;x-y&gt;
23959 </p><p>1&gt;2
23960 </p><p>x&lt;y
23961 </p><p>a&gt;b
23962 </p><p>1&lt;d e&gt;f
23963 </p>
23964 !! end
23965
23966 !! test
23967 HTML tag with necessary entities in attributes
23968 !! wikitext
23969 <span title="&amp;amp;">foo</span>
23970 !! html
23971 <p><span title="&amp;amp;">foo</span>
23972 </p>
23973 !! end
23974
23975 !! test
23976 HTML tag with 'unnecessary' entity encoding in attributes
23977 !! wikitext
23978 <span title="&amp;">foo</span>
23979 !! html
23980 <p><span title="&amp;">foo</span>
23981 </p>
23982 !! end
23983
23984 !! test
23985 HTML tag with broken attribute value quoting
23986 !! options
23987 parsoid=wt2html,html2html
23988 !! wikitext
23989 <span title="Hello world>Foo</span>
23990 !! html/php
23991 <p><span title="Hello world">Foo</span>
23992 </p>
23993 !! html/parsoid
23994 <p><span title="Hello world">Foo</span></p>
23995 !! end
23996
23997 !! test
23998 Self-closed tag with broken attribute value quoting
23999 !! options
24000 parsoid=wt2html,html2html
24001 !! wikitext
24002 <div title="Hello world />Foo
24003 !! html/php+tidy
24004 <div title="Hello world"></div>
24005 <p>Foo</p>
24006 !! html/parsoid
24007 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24008 !! end
24009
24010 !! test
24011 Table with broken attribute value quoting
24012 !! options
24013 parsoid=wt2html,html2html
24014 !! wikitext
24015 {|
24016 | title="Hello world|Foo
24017 |}
24018 !! html/php
24019 <table>
24020 <tr>
24021 <td title="Hello world">Foo
24022 </td></tr></table>
24023
24024 !! html/parsoid
24025 <table>
24026 <tr>
24027 <td title="Hello world">Foo
24028 </td></tr></table>
24029
24030 !! end
24031
24032 !! test
24033 Table with broken attribute value quoting on consecutive lines
24034 !! options
24035 parsoid=wt2html,html2html
24036 !! wikitext
24037 {|
24038 | title="Hello world|Foo
24039 | style="color:red|Bar
24040 |}
24041 !! html/php
24042 <table>
24043 <tr>
24044 <td title="Hello world">Foo
24045 </td>
24046 <td style="color:red">Bar
24047 </td></tr></table>
24048
24049 !! html/parsoid
24050 <table><tbody>
24051 <tr>
24052 <td title="Hello world">Foo
24053 </td><td style="color: red">Bar
24054 </td></tr></tbody></table>
24055
24056 !! end
24057
24058 !!test
24059 Accept empty td cell attribute
24060 !! wikitext
24061 {|
24062 | align="center" | foo || |
24063 |}
24064 !! html
24065 <table>
24066 <tr>
24067 <td align="center"> foo </td>
24068 <td>
24069 </td></tr></table>
24070
24071 !!end
24072
24073 !!test
24074 Non-empty attributes in th-cells
24075 !! wikitext
24076 {|
24077 ! Foo !! style="color: red" | Bar
24078 |}
24079 !! html
24080 <table>
24081 <tr>
24082 <th> Foo </th>
24083 <th style="color: red"> Bar
24084 </th></tr></table>
24085
24086 !!end
24087
24088 !!test
24089 Accept empty attributes in th-cells
24090 !! wikitext
24091 {|
24092 !| foo !!| bar
24093 |}
24094 !! html
24095 <table>
24096 <tr>
24097 <th> foo </th>
24098 <th> bar
24099 </th></tr></table>
24100
24101 !!end
24102
24103 !!test
24104 Empty table rows go away
24105 !! wikitext
24106 {|
24107 | Hello
24108 | there
24109 |- class="foo"
24110 |-
24111 |}
24112 !! html
24113 <table>
24114 <tr>
24115 <td> Hello
24116 </td>
24117 <td> there
24118 </td></tr>
24119
24120 </table>
24121
24122 !! end
24123
24124 ###
24125 ### Parsoid-centric tests for testing RTing of inter-element separators
24126 ### Edge cases not tested by existing parser tests and specific to
24127 ### Parsoid-specific serialization strategies.
24128 ###
24129
24130 !!test
24131 RT-ed inter-element separators should be valid separators
24132 !! wikitext
24133 {|
24134 |- [[foo]]
24135 |}
24136 !! html/php
24137 <table>
24138
24139 </table>
24140
24141 !! html/parsoid
24142 <table>
24143 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24144 </tbody></table>
24145 !!end
24146
24147 # Parsoid-only since PHP parser relies on Tidy for correct output
24148 !!test
24149 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24150 !!options
24151 parsoid
24152 !! wikitext
24153 {|
24154 |<small>foo
24155 bar
24156 |}
24157
24158 {|
24159 |<small>foo<small>
24160 |}
24161 !! html
24162 <table>
24163 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24164 <p>bar</p></small></td></tr>
24165 </tbody></table>
24166
24167 <table>
24168 <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>
24169 </tbody></table>
24170 !!end
24171
24172 # Note that the "style" attribute is really a template parameter here.
24173 # The = would have to be {{=}} if you wanted the literal.
24174 !!test
24175 Empty TD followed by TD with tpl-generated attribute
24176 !! wikitext
24177 {|
24178 |-
24179 |
24180 |{{echo|style='color:red'}}|foo
24181 |}
24182 !! html
24183 <table>
24184
24185 <tr>
24186 <td>
24187 </td>
24188 <td>foo
24189 </td></tr></table>
24190
24191 !!end
24192
24193 !!test
24194 Indented table with an empty td
24195 !! wikitext
24196 {|
24197 |-
24198 |
24199 |foo
24200 |}
24201 !! html
24202 <table>
24203
24204 <tr>
24205 <td>
24206 </td>
24207 <td>foo
24208 </td></tr></table>
24209
24210 !!end
24211
24212 ## We have some newline diffs RT-ing this edge case
24213 ## and it is not important enough -- we seem to be emitting
24214 ## at most 2 newlines after a </tr> and this is unrelated to
24215 ## the issue from T85627 that this is testing.
24216 !!test
24217 Indented table with blank lines in between (T85627)
24218 !! options
24219 parsoid=wt2html
24220 !! wikitext
24221 {|
24222 |foo
24223
24224
24225 |}
24226 !! html
24227 <table>
24228
24229 <tr>
24230 <td>foo
24231 </td></tr></table>
24232
24233 !!end
24234
24235 !!test
24236 Indented block & table
24237 !! wikitext
24238 <div>foo</div>
24239 {|
24240 |foo
24241 |}
24242 !! html/php
24243 <div>foo</div>
24244 <table>
24245 <tr>
24246 <td>foo
24247 </td></tr></table>
24248
24249 !! html/parsoid
24250 <div data-parsoid='{"stx":"html"}'>foo</div>
24251 <table><tbody>
24252 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24253 </tbody></table>
24254 !!end
24255
24256 !! test
24257 Indent and comment before table row
24258 !! wikitext
24259 {|
24260 <!--hi-->|-
24261 | there
24262 |}
24263 !! html/php
24264 <table>
24265
24266 <tr>
24267 <td> there
24268 </td></tr></table>
24269
24270 !! html/parsoid
24271 <table>
24272 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24273 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24274 </tbody></table>
24275 !! end
24276
24277 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24278 !!test
24279 Empty TR followed by a template-generated TR
24280 !!options
24281 parsoid
24282 !! wikitext
24283 {|
24284 |-
24285 {{echo|<tr><td>foo</td></tr>}}
24286 |}
24287 !! html
24288 <table>
24289 <tbody>
24290 <tr></tr>
24291 <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}}]}'>
24292 <td>foo</td></tr>
24293 </tbody></table>
24294 !!end
24295
24296 ## PHP and parsoid output differ for this, and since this is primarily
24297 ## for testing Parsoid's serializer, marking this Parsoid only
24298 !!test
24299 Empty TR followed by mixed-ws-comment line should RT correctly
24300 !!options
24301 parsoid
24302 !! wikitext
24303 {|
24304 |-
24305 <!--c-->
24306 |-
24307 <!--c--> <!--d-->
24308 |}
24309 !! html
24310 <table>
24311 <tbody>
24312 <tr></tr>
24313 <!--c-->
24314 <tr>
24315 <!--c--> </tr><!--d-->
24316 </tbody></table>
24317
24318 !!end
24319
24320 !!test
24321 Multi-line image caption generated by templates with/without trailing newlines
24322 !! wikitext
24323 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24324 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24325 !! html/parsoid
24326 <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>
24327 <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>
24328 !!end
24329
24330 !! test
24331 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24332 !! options
24333 parsoid=html2wt
24334 !! html/parsoid
24335 <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>
24336
24337 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24338 !! wikitext
24339 <includeonly>foo</includeonly>
24340 new para
24341
24342 [[Category:Foo]]
24343
24344 = new heading =
24345 !! end
24346
24347 ## PHP emits broken html for this, and since this is primarily
24348 ## a Parsoid serializer test, marking this Parsoid only
24349 !!test
24350 Improperly nested inline or quotes tags with whitespace in between
24351 !! wikitext
24352 <span> <s>x</span> </s>
24353 ''' ''x''' ''
24354 !! html/parsoid
24355 <p><span> <s>x</s></span><s> </s>
24356 <b> <i>x</i></b><i> </i>
24357 </p>
24358 !!end
24359
24360 !!test
24361 Encapsulate protected attributes from wt
24362 !! wikitext
24363 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24364 !! html/parsoid
24365 <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>
24366 </body>
24367 !!end
24368
24369 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24370 ## Having nested or stray pre tags results in the attempt to add duplicates,
24371 ## causing an assertion fail. This test tries to prevent that situation.
24372 !!test
24373 Ensure ParagraphWrapper can deal with stray closing pre tags
24374 !!options
24375 parsoid=wt2html
24376 !! wikitext
24377 plain text</pre>
24378 !! html/parsoid
24379 plain text
24380 !!end
24381
24382 !!test
24383 1. Ensure fostered text content is wrapped in element nodes
24384 !!options
24385 parsoid=wt2html
24386 !! wikitext
24387 <table>hi</table><table>ho</table>
24388 !! html/parsoid
24389 <p>hi</p>
24390 <table></table>
24391 <p>ho</p>
24392 <table></table>
24393 !!end
24394
24395 !!test
24396 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24397 !!options
24398 parsoid=wt2html,wt2wt
24399 !! wikitext
24400 <table>
24401 <tr> || ||
24402 <td> a
24403 </table>
24404 !! html/parsoid
24405 <p> || ||
24406 </p><table>
24407 <tbody><tr><td> a</td></tr>
24408 </tbody></table>
24409 !!end
24410
24411 !!test
24412 Encapsulation properly handles null DSR information from foster box
24413 !!options
24414 parsoid=wt2html,wt2wt
24415 !! wikitext
24416 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24417 !! html/parsoid
24418 <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>
24419 !!end
24420
24421 !!test
24422 1. Encapsulate foster-parented transclusion content
24423 !!options
24424 parsoid=wt2wt,wt2html
24425 !! wikitext
24426 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24427 !! html/parsoid
24428 <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>
24429 <tbody>
24430 <tr>
24431 <td>bar</td>
24432 </tr>
24433 </tbody>
24434 </table>
24435 !!end
24436
24437 !!test
24438 2. Encapsulate foster-parented transclusion content
24439 !!options
24440 parsoid=wt2wt,wt2html
24441 !! wikitext
24442 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24443 !! html/parsoid
24444 <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>
24445 <table>
24446 <tbody>
24447 <tr>
24448 <td>bar</td>
24449 </tr>
24450 </tbody>
24451 </table>
24452 !!end
24453
24454 !!test
24455 3. Encapsulate foster-parented transclusion content
24456 !!options
24457 parsoid=wt2wt,wt2html
24458 !! wikitext
24459 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24460 !! html/parsoid
24461 <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;]}">
24462 <p>foo</p>
24463 </div>
24464 <table>
24465 <tbody>
24466 <tr>
24467 <td>bar</td>
24468 </tr>
24469 </tbody>
24470 </table>
24471 !!end
24472
24473 !!test
24474 4. Encapsulate foster-parented transclusion content
24475 !!options
24476 parsoid=wt2wt,wt2html
24477 !! wikitext
24478 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24479 !! html/parsoid
24480 <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;]}">
24481 <p>foo</p>
24482 </div>
24483 <table>
24484 <tbody>
24485 <tr>
24486 <td>bar</td>
24487 </tr>
24488 </tbody>
24489 </table>
24490 !!end
24491
24492 !!test
24493 5. Encapsulate foster-parented transclusion content
24494 !!options
24495 parsoid=wt2wt,wt2html
24496 !! wikitext
24497 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24498 !! html/parsoid
24499 <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>
24500 <table>
24501 <tbody>
24502 <tr>
24503 <td>
24504 <div>
24505 <p>foo</p>
24506 </div>
24507 </td>
24508 </tr>
24509 </tbody>
24510 </table>
24511 !!end
24512
24513 !!test
24514 6. Encapsulate foster-parented transclusion content
24515 !!options
24516 parsoid=wt2wt,wt2html
24517 !! wikitext
24518 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24519 !! html/parsoid
24520 <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>
24521 <table>
24522 <tbody>
24523 <tr>
24524 <td>
24525 <div>
24526 <p>foo</p>
24527 </div>
24528 </td>
24529 </tr>
24530 </tbody>
24531 </table>
24532 <p>ok</p>
24533 !!end
24534
24535 !!test
24536 7. Encapsulate foster-parented transclusion content
24537 !!options
24538 parsoid=wt2wt,wt2html
24539 !! wikitext
24540 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24541 !! html/parsoid
24542 <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>
24543 <table>
24544 <tbody>
24545 <tr>
24546 <td>bar</td>
24547 </tr>
24548 </tbody>
24549 </table>
24550 !!end
24551
24552 # Note that the wt is broken on purpose: the = should be {{=}} if you
24553 # don't want it to be a template parameter key.
24554 !!test
24555 8. Encapsulate foster-parented transclusion content
24556 !!options
24557 parsoid=wt2wt,wt2html
24558 !! wikitext
24559 {{echo|a
24560 }}{|{{echo|style='color:red'}}
24561 |-
24562 |b
24563 |}
24564 !! html/parsoid
24565 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24566 <span> </span>
24567 <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>
24568 <table>
24569 <tbody>
24570 <tr>
24571 <td>b</td>
24572 </tr>
24573 </tbody>
24574 </table>
24575 !!end
24576
24577 !!test
24578 9. Encapsulate foster-parented transclusion content
24579 !!options
24580 parsoid=wt2wt,wt2html
24581 !! wikitext
24582 <table>{{echo|hi</table>hello}}
24583 !! html/parsoid
24584 <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>
24585 !!end
24586
24587 !!test
24588 Table in fosterable position
24589 !!options
24590 parsoid=wt2html
24591 !! wikitext
24592 {{OpenTable}}
24593 <div>
24594 {|
24595 |}
24596 </div>
24597 |}
24598 !! html/parsoid
24599 <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">
24600 </span>
24601 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24602
24603 <table>
24604 </table>
24605 !!end
24606
24607 # Parsoid only for bug 64747
24608 !! test
24609 Properly encapsulate empty-content transclusions in fosterable positions
24610 !! wikitext
24611 <table>
24612 {{#if:|
24613 <td>foo</td>
24614 }}
24615 </table>
24616 !! html/parsoid
24617 <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"}]]}'>
24618
24619 </table>
24620 !! end
24621
24622 !! test
24623 Always encapsulate foster box when template range is expanded to table
24624 !! options
24625 parsoid=wt2wt
24626 !! wikitext
24627 {|
24628 hello
24629 {{OpenTable}}
24630 |}
24631 !! html/parsoid
24632
24633 !! end
24634
24635 !! test
24636 T115289: Unclosed table
24637 !! wikitext
24638 {{echo|<table>}}<!--c-->[[Category:Two]]
24639 !! html/parsoid
24640 <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>
24641 !! end
24642
24643 !! test
24644 T115289: Don't migrate newlines out of tables with fostered content
24645 !! wikitext
24646 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24647 !! html/parsoid
24648 <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,"dsr":[0,53,7,0]}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
24649 !! end
24650
24651 !! test
24652 T73074: More fostering fun
24653 !! wikitext
24654 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24655 !! html/parsoid
24656 <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>
24657 !! end
24658
24659 !!test
24660 Support <object> element with .data attribute
24661 !!options
24662 parsoid=html2wt
24663 !! html/parsoid
24664 <object data="test.swf"></object>
24665 !! wikitext
24666 <object data="test.swf"></object>
24667 !!end
24668
24669 !! test
24670 Don't block XML namespace declaration
24671 !! wikitext
24672 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24673 !! html/php
24674 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24675 </p>
24676 !! html/parsoid
24677 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24678 !! end
24679
24680 # -----------------------------------------------------------------
24681 # The following section of tests are primarily to spec requirements
24682 # around serialization of new/edited content.
24683 #
24684 # All these tests are marked Parsoid html2wt and html2html only
24685 # ----------------------------------------------------------------
24686
24687 # 'mi' is a localinterwiki prefix as well as a language
24688 !! test
24689 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24690 !! options
24691 parsoid=html2wt
24692 !! html/parsoid
24693 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24694 !! wikitext
24695 [[Foo]]
24696 !! end
24697
24698 # See T93839
24699 !! test
24700 New wikilinks should be serialized properly
24701 !! options
24702 parsoid=html2wt
24703 !! html/parsoid
24704 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24705 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24706 !! wikitext
24707 [[Foo]]
24708 [[Foo]]
24709 !! end
24710
24711 !! test
24712 New wiki links (href variations)
24713 !! options
24714 parsoid=html2wt
24715 !! html/parsoid
24716 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24717 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24718 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24719 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24720 !! wikitext
24721 [[Foo_bar]]
24722 [[Foo_bar]]
24723 [[Foo_bar]]
24724 [[Toxine bactérienne]]
24725 !! end
24726
24727 !! test
24728 New wiki links (content string variations)
24729 !! options
24730 parsoid=html2wt
24731 !! html/parsoid
24732 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24733 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24734 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24735 !! wikitext
24736 [[Foo_bar]]
24737 [[Foo bar]]
24738 [[Foo_bar|./Foo_bar]]
24739 !! end
24740
24741 !! test
24742 New category links (href variations)
24743 !! options
24744 parsoid=html2wt
24745 !! html/parsoid
24746 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24747 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24748 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24749 !! wikitext
24750 [[Category:Toxine bactérienne]]
24751 [[Category:Toxine bactérienne]]
24752 [[Category:Toxine bactérienne]]
24753 !! end
24754
24755 !! test
24756 New sol transparent links don't need indent-pre nowiki protection
24757 !! options
24758 parsoid=html2wt
24759 language=de
24760 !! html/parsoid
24761 <link rel="mw:PageProp/redirect" href="./Main_Page">
24762 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24763 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24764 !! wikitext
24765 #WEITERLEITUNG [[Main Page]]
24766 <!-- this is good --> [[Category:Good]]
24767 <!-- this is great --> [[Kategorie:Great]]
24768 !! end
24769
24770 !! test
24771 New interlanguage links (href variations)
24772 !! options
24773 parsoid=html2wt
24774 !! html/parsoid
24775 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24776 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24777 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24778 !! wikitext
24779 [[es:Toxine bactérienne]]
24780 [[es:Toxine_bactérienne]]
24781 [[es:Toxine_bactérienne]]
24782 !! end
24783
24784 !! test
24785 Image: Modifying size of an image (1)
24786 !! options
24787 parsoid={
24788 "modes": ["wt2wt"],
24789 "changes": [
24790 ["img[height]", "attr", "height", "22"],
24791 ["img[width]", "attr", "width", "200"]
24792 ]
24793 }
24794 !! wikitext
24795 [[Image:Foobar.jpg|230x230px]]
24796 !! wikitext/edited
24797 [[Image:Foobar.jpg|200x200px]]
24798 !!end
24799
24800 !! test
24801 Image: Modifying size of an image (2)
24802 !! options
24803 parsoid={
24804 "modes": ["wt2wt"],
24805 "changes": [
24806 ["img[height]", "attr", "height", "100"],
24807 ["img[width]", "attr", "width", "500"]
24808 ]
24809 }
24810 !! wikitext
24811 [[Image:Foobar.jpg|230x230px]]
24812 !! wikitext/edited
24813 [[Image:Foobar.jpg|500x500px]]
24814 !!end
24815
24816 # Change in size is ignored so long as class='mw-default-size'
24817 !! test
24818 Image: Modifying size of an image (3)
24819 !! options
24820 parsoid={
24821 "modes": ["wt2wt"],
24822 "changes": [
24823 ["figure[class]", "removeClass", "mw-default-size"],
24824 ["figure img", "attr", "height", "19"],
24825 ["figure img", "attr", "width", "170"]
24826 ]
24827 }
24828 !! wikitext
24829 [[Image:Foobar.jpg|thumb]]
24830 !! wikitext/edited
24831 [[Image:Foobar.jpg|thumb|170x170px]]
24832 !!end
24833
24834 !! test
24835 Image: Modifying alignment of an image (bug 48665)
24836 !! options
24837 parsoid={
24838 "modes": ["wt2wt"],
24839 "changes": [
24840 ["figure[class]", "removeClass", "mw-halign-right"],
24841 ["figure[class]", "addClass", "mw-halign-left"]
24842 ]
24843 }
24844 !! wikitext
24845 [[Image:Foobar.jpg|thumb|caption|right]]
24846 !! wikitext/edited
24847 [[Image:Foobar.jpg|thumb|caption|left]]
24848 !! end
24849
24850 !! test
24851 Image: Modifying mw-default-size of an frameless image (bug 62805)
24852 !! options
24853 parsoid={
24854 "modes": ["wt2wt"],
24855 "changes": [
24856 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24857 ]
24858 }
24859 !! wikitext
24860 [[Image:Foobar.jpg|frameless|right]]
24861 !! wikitext/edited
24862 [[Image:Foobar.jpg|frameless|right|220x220px]]
24863 !! end
24864
24865 !! test
24866 Image: Modifying valign of an image (bug 49221)
24867 !! options
24868 parsoid={
24869 "modes": ["wt2wt"],
24870 "changes": [
24871 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24872 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24873 ]
24874 }
24875 !! wikitext
24876 [[File:Foobar.jpg|20px|middle]]
24877 !! wikitext/edited
24878 [[File:Foobar.jpg|20px|text-top]]
24879 !! end
24880
24881 !! test
24882 Image: Modifying alt attribute of an image (bug 56400)
24883 !! options
24884 parsoid={
24885 "modes": ["wt2wt"],
24886 "changes": [
24887 ["img[alt]", "attr", "alt", "some alternate edited text"]
24888 ]
24889 }
24890 !! wikitext
24891 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24892 !! wikitext/edited
24893 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24894 !!end
24895
24896 !! test
24897 Image: Modifying caption of an image
24898 !! options
24899 parsoid={
24900 "modes": ["wt2wt"],
24901 "changes": [
24902 ["figcaption", "text", "new caption"]
24903 ]
24904 }
24905 !! wikitext
24906 [[Image:Foobar.jpg|thumb|original caption]]
24907 !! wikitext/edited
24908 [[Image:Foobar.jpg|thumb|new caption]]
24909 !!end
24910
24911 !! test
24912 Image: empty alt attribute (bug 48924)
24913 !! options
24914 parsoid
24915 !! wikitext
24916 [[File:Foobar.jpg|thumb|alt=|bar]]
24917 !! html
24918 <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>
24919 !! end
24920
24921 !! test
24922 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24923 !! options
24924 parsoid=html2wt
24925 language=ar
24926 disabled
24927 !! html/parsoid
24928 <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>
24929 !! wikitext
24930 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24931 !! end
24932
24933 !! test
24934 Image: Block level image should have \n before and after
24935 !! wikitext
24936 123
24937 [[File:Foobar.jpg|right|thumb|150x150px]]
24938 456
24939 !! html/parsoid
24940 <p>123</p>
24941 <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>
24942 <p>456</p>
24943 !!end
24944
24945 !! test
24946 Image: New block level image should have \n before and after (existing content)
24947 !! wikitext
24948 123
24949 [[File:Foobar.jpg|right|thumb|150x150px]]
24950 456
24951 !! html/parsoid
24952 <p>123</p>
24953 <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>
24954 <p>456</p>
24955 !!end
24956
24957 !! test
24958 Image: upright option (parsoid)
24959 !! wikitext
24960 [[File:Foobar.jpg|thumb|upright|caption]]
24961 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24962 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24963 !! html/parsoid
24964 <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>
24965 <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>
24966 <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>
24967 !!end
24968
24969 !! test
24970 Image: upright option is ignored on inline and frame images (parsoid)
24971 !! wikitext
24972 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24973 !! html/parsoid
24974 <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>
24975 !!end
24976
24977 !! test
24978 Image: from basic HTML (1)
24979 !! options
24980 parsoid=html2wt
24981 !! html/parsoid
24982 <span typeof="mw:Image">
24983 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24984 </span>
24985 !! wikitext
24986 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24987 !! end
24988
24989 !! test
24990 Image: from basic HTML (2)
24991 !! options
24992 parsoid=html2wt
24993 !! html/parsoid
24994 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24995 !! wikitext
24996 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24997 !! end
24998
24999 !! test
25000 Image: from basic HTML (3)
25001 !! options
25002 parsoid=html2wt
25003 !! html/parsoid
25004 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25005 !! wikitext
25006 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25007 !! end
25008
25009 !! test
25010 Image: from basic HTML (4)
25011 !! options
25012 parsoid=html2wt
25013 !! html/parsoid
25014 <img src="./File:Foobar.jpg">
25015 !! wikitext
25016 [[File:Foobar.jpg|link=]]
25017 !! end
25018
25019 !! test
25020 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25021 !! options
25022 parsoid=html2wt
25023 !! html/parsoid
25024 <ul>
25025 <li><p>foo</p></li>
25026 </ul>
25027 !! wikitext
25028 * foo
25029 !! end
25030
25031 !! test
25032 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25033 !! options
25034 parsoid=html2wt
25035 !! html/parsoid
25036 <ul> <li>foo</li></ul>
25037 !! wikitext
25038 * foo
25039 !! end
25040
25041 !! test
25042 Don't strip leading whitespace when handling indent-pre suppressing tags
25043 !! options
25044 parsoid=html2wt
25045 !! html/parsoid
25046 <table>
25047 <tr><td> indented row</td></tr>
25048 </table>
25049 <blockquote><p>
25050 <b>This is very bold of you!</b>
25051 </p>
25052 <table><tr><td>
25053 indented cell (no pre-wrapping!)
25054 </td></tr></table>
25055 </blockquote>
25056 <p>foo</p>
25057 <div>bar</div>
25058 !! wikitext
25059 {|
25060 | indented row
25061 |}
25062 <blockquote>
25063 '''This is very bold of you!'''
25064
25065 {|
25066 |
25067 indented cell (no pre-wrapping!)
25068 |}
25069 </blockquote>
25070 foo
25071 <div>bar</div>
25072 !! end
25073
25074 !! test
25075 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25076 !! options
25077 parsoid=html2wt
25078 !! html/parsoid
25079 <p>foo</p>
25080 <span>bar</span>
25081
25082 <span>foo2
25083 </span>bar2
25084
25085 <div>foo</div>
25086 <span>bar</span>
25087
25088 <div>
25089 <span>foo</span>
25090 </div>
25091 !! wikitext
25092 foo
25093
25094 <span>bar</span>
25095
25096 <span>foo2
25097 <nowiki> </nowiki></span>bar2
25098
25099 <div>foo</div>
25100 <nowiki> </nowiki><span>bar</span>
25101
25102 <div>
25103 <nowiki> </nowiki><span>foo</span>
25104 </div>
25105 !! end
25106
25107 !! test
25108 Lists: Dont insert newlines in a serialized list item.
25109 !! options
25110 parsoid=html2wt
25111 !! html/parsoid
25112 <ul><li>a<br>b</li><li>c</li></ul>
25113 !! wikitext
25114 * a<br>b
25115 * c
25116 !! end
25117
25118 !! test
25119 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25120 !! options
25121 parsoid={
25122 "modes": ["html2wt"],
25123 "scrubWikitext": false
25124 }
25125 !! html/parsoid
25126 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25127 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25128
25129 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25130 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25131
25132 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25133
25134 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25135 !! wikitext
25136 == hello there [[Category:A1]] ==
25137
25138 == [[Category:A2]] hi pal ==
25139
25140 == <!--foo--> [[Category:A3]] how goes it ==
25141
25142 == it goes well [[Category:A4]] <!--bar--> ==
25143
25144 ==howdy [[Category:A5]]==
25145
25146 == __TOC__ ok ==
25147 !! end
25148
25149 !! test
25150 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25151 !! options
25152 parsoid={
25153 "modes": ["html2wt"],
25154 "scrubWikitext": true
25155 }
25156 !! html/parsoid
25157 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25158 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25159
25160 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25161 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25162
25163 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25164 !! wikitext
25165 == hello there ==
25166 [[Category:A1]]
25167 [[Category:A2]]
25168
25169 == hi pal ==
25170
25171 <!--foo--> [[Category:A3]]
25172
25173 == how goes it ==
25174
25175 == it goes well ==
25176 [[Category:A4]] <!--bar-->
25177
25178 __TOC__
25179
25180 == ok ==
25181 !! end
25182
25183 !! test
25184 Headings: Don't hoist metas that come from templates
25185 !! options
25186 parsoid={
25187 "modes": ["html2wt"],
25188 "scrubWikitext": true
25189 }
25190 !! html/parsoid
25191 <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>
25192 !! wikitext
25193 == {{echo|foo [[Category:Foo]]}} ==
25194 !! end
25195
25196 !! test
25197 Headings: Category in ref isn't hoisted
25198 !! options
25199 parsoid={
25200 "modes": ["html2wt"],
25201 "scrubWikitext": true
25202 }
25203 !! html/parsoid
25204 <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>
25205
25206 <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>
25207 !! wikitext
25208 == foo <ref>bar
25209 [[Category:Baz]] </ref> ==
25210
25211 <references />
25212 !! end
25213
25214 !! test
25215 Parsoid: Serialize positional parameters with = in them as named parameter
25216 !! options
25217 parsoid=html2wt
25218 !! html/parsoid
25219 <p about="#mwt1" typeof="mw:Transclusion"
25220 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25221
25222 <p about="#mwt1" typeof="mw:Transclusion"
25223 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25224
25225 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25226 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25227 <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>
25228 !! wikitext
25229 {{echo|1=f=oo}}
25230
25231 {{echo|1=f=oo|2=bar}}
25232
25233 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25234 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25235 {{echo|<nowiki>f=oo</nowiki>|bar}}
25236 !! end
25237
25238 !! test
25239 Parsoid: Serialize positional parameters with = in extlink as named parameter
25240 !! options
25241 parsoid=html2wt
25242 !! html/parsoid
25243 <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>
25244 !! wikitext
25245 {{echo|1=http://stuff?is=ok}}
25246 !! end
25247
25248 !! test
25249 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25250 !! options
25251 parsoid=html2wt
25252 !! html/parsoid
25253 <div>a<p>b</p></div>
25254 <div>a
25255 <p>b</p></div>
25256 <div>
25257 a
25258 <p>b</p></div>
25259 !! wikitext
25260 <div>a
25261 b
25262 </div>
25263 <div>a
25264 b
25265 </div>
25266 <div>
25267 a
25268
25269 b
25270 </div>
25271 !! end
25272
25273 !! test
25274 Substrings resembling wikitext in hrefs should not get nowiki escapes
25275 !! options
25276 parsoid=html2wt
25277 !! html/parsoid
25278 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25279 !! wikitext
25280 [[Foo''bar''baz]]
25281 !! end
25282
25283 !! test
25284 Enforce single-line context in the serializer
25285 !! options
25286 parsoid=html2wt
25287 !! html/parsoid
25288 <h2>testing
25289 123</h2>
25290
25291 <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">
25292 </span><span about="#mwt1">you</span> </h2>
25293
25294 <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>
25295
25296 <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
25297 there</span></li></ol>
25298
25299 <ul><li>asd
25300 sdf</li></ul>
25301
25302 <ul><li>foo
25303 bar
25304 baz</li>
25305 <li>foo <b>bar</b>
25306 baz</li></ul>
25307
25308 <dl><dt>hi
25309 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25310 ho</dd></dl>
25311
25312 <dl><dd> <table>
25313 <tbody><tr><td> ha
25314 ha
25315 ha</td></tr>
25316 </tbody></table></dd></dl>
25317 !! wikitext
25318 == testing 123 ==
25319
25320 == hi {{bogus|there
25321 you}} ==
25322
25323 == foo <ref>hello
25324 there</ref> ==
25325
25326 <references />
25327
25328 * asd sdf
25329
25330 * foo bar baz
25331 * foo '''bar''' baz
25332
25333 ; hi ho : hi ho
25334
25335 : {|
25336 | ha
25337 ha
25338 ha
25339 |}
25340 !! end
25341
25342 !! test
25343 Serialize new placeholder space without spans
25344 !! options
25345 parsoid=html2wt
25346 !! html/parsoid
25347 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25348
25349 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25350
25351 <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>
25352 !! wikitext
25353 foo : bar
25354
25355 foo : bar
25356
25357 <ref>foo : bar</ref>ok
25358 !! end
25359
25360
25361 #-----------------------
25362 # Tag minimization tests
25363 #-----------------------
25364
25365 !! test
25366 1. I/B quote minimization: wikitext-only tags should be combined
25367 !! options
25368 parsoid=html2wt
25369 !! html/parsoid
25370 <p><i>A</i><i>B</i></p>
25371 <p><b>A</b><b>B</b></p>
25372 <p><i>A</i><b><i>B</i></b></p>
25373 <p><b>A</b><i><b>B</b></i></p>
25374 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25375 <p><i><b>A</b></i><i><b>B</b></i></p>
25376 <p><i><b>A</b></i><b><i>B</i></b></p>
25377 <p><b><i>A</i></b><i><b>B</b></i></p>
25378 !! wikitext
25379 ''AB''
25380
25381 '''AB'''
25382
25383 ''A'''B'''''
25384
25385 '''A''B'''''
25386
25387 '''A''BC''D'''
25388
25389 '''''AB'''''
25390
25391 '''''AB'''''
25392
25393 '''''AB'''''
25394 !! end
25395
25396 !! test
25397 2. I/B quote minimization: wikitext and html tags should not be combined
25398 !! options
25399 parsoid=html2wt
25400 !! html/parsoid
25401 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25402 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25403 !! wikitext
25404 ''A''<i>B</i>
25405
25406 ''A''<nowiki/>'''<i>B</i>'''
25407 !! end
25408
25409 !! test
25410 3. I/B quote minimization: templated content stops minimization
25411 !! options
25412 parsoid=html2wt
25413 !! html/parsoid
25414 <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>
25415 <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>
25416 !! wikitext
25417 ''A''{{echo|''B''}}
25418
25419 ''A''{{echo|'''''B'''''}}
25420 !! end
25421
25422 !! test
25423 4. I/B quote minimization: new content should be mimimized with adjacent old content
25424 !! options
25425 parsoid=html2wt
25426 !! html/parsoid
25427 <p><i>A</i><i>B</i></p>
25428 <p><b>A</b><b>B</b></p>
25429 <p><i>A</i><b><i>B</i></b></p>
25430 !! wikitext
25431 ''AB''
25432
25433 '''AB'''
25434
25435 ''A'''B'''''
25436 !! end
25437
25438 !! test
25439 5a. Merge adjacent quote nodes if they've been edited
25440 !! options
25441 parsoid={
25442 "modes": ["wt2wt", "selser"],
25443 "changes": [
25444 ["p", "contents", "remove", ":contains('b')"]
25445 ]
25446 }
25447 !! wikitext
25448 ''a''b''c''
25449 !! wikitext/edited
25450 ''ac''
25451 !! end
25452
25453 !! test
25454 5b. Merge adjacent quote nodes if they've been edited
25455 !! options
25456 parsoid={
25457 "modes": ["wt2wt", "selser"],
25458 "changes": [
25459 ["#x", "remove"]
25460 ]
25461 }
25462 !! wikitext
25463 ''a''<span id="x">b</span>''c''
25464 !! wikitext/edited
25465 ''ac''
25466 !! end
25467
25468 !! test
25469 1. Merge adjacent link nodes as long as at least one element is new
25470 !! options
25471 parsoid={
25472 "modes": ["html2wt"],
25473 "scrubWikitext": true
25474 }
25475 !! html/parsoid
25476 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25477 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25478 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25479 !! wikitext
25480 [[Football]]
25481 [[Football]]
25482 [[Football|Foot]][[Football|ball]]
25483 !! end
25484
25485 !! test
25486 2. Merge adjacent link nodes and enable additional normalizations
25487 !! options
25488 parsoid={
25489 "modes": ["html2wt"],
25490 "scrubWikitext": true
25491 }
25492 !! html/parsoid
25493 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25494 !! wikitext
25495 [[Football|''Football'']]
25496 !! end
25497
25498 !! test
25499 3. Don't merge adjacent link nodes if scrubWikitext is false
25500 !! options
25501 parsoid={
25502 "modes": ["html2wt"],
25503 "scrubWikitext": false
25504 }
25505 !! html/parsoid
25506 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25507 !! wikitext
25508 [[Football|Foot]][[Football|ball]]
25509 !! end
25510
25511 #------------------------------
25512 # End of tag minimization tests
25513 #------------------------------
25514
25515 !!test
25516 Bug 54262: New entities
25517 !! options
25518 parsoid=html2wt
25519 !! html/parsoid
25520 <span typeof="mw:Entity">&nbsp;</span>
25521 !! wikitext
25522 &nbsp;
25523 !! end
25524
25525 ## Note that there is no wikitext output for 'unknownproperty' ##
25526 ## Unknown magic words are silently dropped ##
25527
25528 !! test
25529 Magic words
25530 !! options
25531 parsoid=html2wt
25532 !! html/parsoid
25533 <meta property='mw:PageProp/toc' />
25534 <meta property='mw:PageProp/notoc' />
25535 <meta property='mw:PageProp/forcetoc' />
25536 <meta property='mw:PageProp/index' />
25537 <meta property='mw:PageProp/noindex' />
25538 <meta property='mw:PageProp/nogallery' />
25539 <meta property='mw:PageProp/noeditsection' />
25540 <meta property='mw:PageProp/notitleconvert' />
25541 <meta property='mw:PageProp/nocontentconvert' />
25542 <meta property='mw:PageProp/unknownproperty' />
25543 !! wikitext
25544 __TOC__
25545 __NOTOC__
25546 __FORCETOC__
25547 __INDEX__
25548 __NOINDEX__
25549 __NOGALLERY__
25550 __NOEDITSECTION__
25551 __NOTITLECONVERT__
25552 __NOCONTENTCONVERT__
25553 !! end
25554
25555 !! test
25556 Consecutive <pre>s should not get merged
25557 !! options
25558 parsoid=html2wt,html2html
25559 !! html/parsoid
25560 <pre>a</pre><pre>b</pre>
25561
25562 <pre>c
25563 </pre><pre>
25564 d</pre>
25565
25566 <pre>e
25567
25568 </pre><pre>
25569
25570 f</pre>
25571 !! wikitext
25572 a
25573
25574 b
25575
25576 c
25577
25578 d
25579
25580 e
25581
25582
25583
25584 f
25585 !! end
25586
25587 !! test
25588 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25589 !! options
25590 parsoid=html2wt
25591 !! html/parsoid
25592 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25593 !! wikitext
25594 [[Special:BookSources/1234567890|ISBN 1234567895]]
25595 !! end
25596
25597 !! test
25598 Edited RFC links not serializable as RFC links should serialize as extlinks
25599 !! options
25600 parsoid=html2wt
25601 !! html/parsoid
25602 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25603 !! wikitext
25604 [//tools.ietf.org/html/rfc123 New RFC]
25605 !! end
25606
25607 !! test
25608 Edited PMID links not serializable as PMID links should serialize as extlinks
25609 !! options
25610 parsoid=html2wt
25611 !! html/parsoid
25612 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25613 !! wikitext
25614 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25615 !! end
25616
25617 !! test
25618 WTS of autolinks with trailing/surrounding context
25619 !! options
25620 parsoid=html2wt
25621 !! html/parsoid
25622 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25623 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25624 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25625 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25626 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25627 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25628 !! wikitext
25629 http://cscott.net'''foo'''
25630
25631 http://cscott.net<b>foo</b>
25632
25633 '''http://cscott.net'''
25634
25635 '''http://cscott.net '''
25636
25637 '''http://cscott.net<nowiki/>x'''
25638
25639 http://cscott.net<nowiki/>x
25640 !! end
25641
25642 !! test
25643 WTS of autolinks with nowikis (round-trip)
25644 !! wikitext
25645 x<nowiki/>http://cscott.net<nowiki/>x
25646 !! html/parsoid
25647 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25648 !! end
25649
25650 # this is the "easy" test because it leaves in place all the
25651 # data-parsoid information indicating this is an autolink
25652 !! test
25653 WTS of autolinks with escapes (editing)
25654 !! options
25655 parsoid={
25656 "modes": ["wt2wt"],
25657 "changes": [
25658 [ "meta", "remove" ]
25659 ]
25660 }
25661 !! wikitext
25662 x<nowiki/>http://cscott.net<nowiki/>x
25663 !! wikitext/edited
25664 x<nowiki/>http://cscott.net<nowiki/>x
25665 !! end
25666
25667 !! test
25668 WTS of edited autolink-like text (T103364)
25669 !! options
25670 parsoid={
25671 "modes": ["wt2wt"],
25672 "changes": [
25673 [ "span[typeof]", "removeAttr", "typeof" ]
25674 ]
25675 }
25676 !! wikitext
25677 Not a link: <nowiki>http://example.com</nowiki>.
25678 !! wikitext/edited
25679 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25680 !! end
25681
25682 !! test
25683 WTS of newly-authored autolink-like text (T103364)
25684 !! options
25685 parsoid=html2wt
25686 !! html/parsoid
25687 <p>http://example.com is not a link.</p>
25688 !! wikitext
25689 <nowiki>http://example.com</nowiki> is not a link.
25690 !! end
25691
25692 !! test
25693 WTS of autolink-like text after an autolink (T108563)
25694 !! options
25695 parsoid=html2wt
25696 !! html/parsoid
25697 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25698 !! wikitext
25699 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25700 !! end
25701
25702 !! test
25703 Magic links inside links (not autolinked)
25704 !! wikitext
25705 [[Foo|http://example.com]]
25706 [[Foo|RFC 1234]]
25707 [[Foo|PMID 1234]]
25708 [[Foo|ISBN 123456789x]]
25709
25710 [http://foo.com http://example.com]
25711 [http://foo.com RFC 1234]
25712 [http://foo.com PMID 1234]
25713 [http://foo.com ISBN 123456789x]
25714 !! html+tidy
25715 <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>
25716 <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>
25717 !! html/parsoid
25718 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25719 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25720 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25721 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25722
25723 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25724 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25725 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25726 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25727 !! end
25728
25729 !! test
25730 Magic links inside image captions (autolinked)
25731 !! wikitext
25732 [[File:Foobar.jpg|thumb|http://example.com]]
25733 [[File:Foobar.jpg|thumb|RFC 1234]]
25734 [[File:Foobar.jpg|thumb|PMID 1234]]
25735 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25736 !! html+tidy
25737 <div class="thumb tright">
25738 <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>
25739 <div class="thumbcaption">
25740 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25741 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25742 </div>
25743 </div>
25744 <div class="thumb tright">
25745 <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>
25746 <div class="thumbcaption">
25747 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25748 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25749 </div>
25750 </div>
25751 <div class="thumb tright">
25752 <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>
25753 <div class="thumbcaption">
25754 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25755 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25756 </div>
25757 </div>
25758 <div class="thumb tright">
25759 <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>
25760 <div class="thumbcaption">
25761 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25762 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25763 </div>
25764 </div>
25765 !! html/parsoid
25766 <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>
25767 <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>
25768 <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>
25769 <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>
25770 !! end
25771
25772 !! test
25773 WTS of magic word text (T109371)
25774 !! options
25775 parsoid=html2wt
25776 !! html/parsoid
25777 <p>RFC 1234</p>
25778 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25779 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25780 !! wikitext
25781 <nowiki>RFC 1234</nowiki>
25782
25783 [http://foo.com RFC 1234]
25784
25785 [[Foo|RFC 1234]]
25786 !! end
25787
25788 !! test
25789 Edited Redirect link should emit a non-piped wikitext link
25790 !! options
25791 parsoid=html2wt
25792 !! html/parsoid
25793 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25794 !! wikitext
25795 #REDIRECT [[Bar]]
25796 !! end
25797
25798 !! test
25799 T75121: Infer extension name from typeOf if data-mw is not present
25800 !! options
25801 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25802 !! html/parsoid
25803 <div typeOf="mw:Extension/foo"></div>
25804 !! wikitext
25805 <foo />
25806 !! end
25807
25808 # Note that the <p> wrapping isn't present in PHP parser output
25809 # The important thing for this test is that P-wrapping doesn't
25810 # interfere with the <nowiki> protection for leading - in <td>
25811 # (which isn't necessary for <th>).
25812 !! test
25813 T88318: p-wrapped dash in table.
25814 !! options
25815 parsoid=html2wt,wt2wt
25816 !! html/parsoid
25817 <table><tbody>
25818 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25819 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25820 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25821 </tbody></table>
25822 !! wikitext
25823 {|
25824 !-
25825 !-
25826 |-
25827 |<nowiki>-</nowiki>
25828 |<nowiki>- </nowiki>
25829 |-
25830 |<small>-</small>
25831 |<br>
25832 -
25833 |<br>
25834 -
25835 |}
25836 !! html/php+tidy
25837 <table>
25838 <tr>
25839 <th>-</th>
25840 <th>-</th>
25841 </tr>
25842 <tr>
25843 <td>-</td>
25844 <td>-</td>
25845 </tr>
25846 <tr>
25847 <td><small>-</small></td>
25848 <td><br />
25849 <p>-</p>
25850 </td>
25851 <td><br />
25852 <p>-</p>
25853 </td>
25854 </tr>
25855 </table>
25856 !! end
25857
25858 !! test
25859 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25860 !! options
25861 parsoid=html2wt
25862 !! html/parsoid
25863 <table id='mwAb'>
25864 <td id='mwAc'>foo</td>
25865 <td id='serialize-this'>bar</td>
25866 </table>
25867 !! wikitext
25868 {|
25869 |foo
25870 | id="serialize-this" |bar
25871 |}
25872 !! end
25873
25874 !! test
25875 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25876 !! options
25877 parsoid=html2wt
25878 !! html/parsoid
25879 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25880 !! wikitext
25881 <div id="hello">ok</div>
25882 !! end
25883
25884 !! test
25885 WTS change modes
25886 !! options
25887 parsoid={
25888 "modes": ["wt2wt"],
25889 "changes": [
25890 [ "#xyz", "before", "<b>before</b> stuff " ],
25891 [ "#xyz", "after", " stuff <i>after</i>" ],
25892 [ "#xyz", "html", "x <b>y</b> z" ]
25893 ]
25894 }
25895 !! wikitext
25896 <span id="xyz">hello</span>
25897 !! wikitext/edited
25898 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25899 !! end
25900
25901 !! test
25902 Never serialize a-tag as html, regardless of what data-parsoid has to say
25903 !! options
25904 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25905 !! html/parsoid
25906 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25907 !! wikitext
25908 [[Foo]]
25909 !! end
25910
25911 ## SSS FIXME: This is broken output nevertheless.
25912 ## What might be a reasonable non-broken output for this?
25913 ## This is an edge case unlikely to be seen in production
25914 ## that I am not wasting more time on this right now.
25915 !! test
25916 Never serialize a-tag as html, no matter what attributes it has
25917 !! options
25918 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25919 !! html/parsoid
25920 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25921 !! wikitext
25922 [http://boo.org http://boohoo.org]
25923 !! end
25924
25925 # Misnested is an indication that selser can reuse the source but these have
25926 # shown to sneak through on occasion. See T101768.
25927 # The original wikitext here is: [http://test.com [[one]] two three]
25928 !! test
25929 Strip span tags added to mark misnested links
25930 !! options
25931 parsoid=html2wt
25932 !! html/parsoid
25933 <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>
25934 !! wikitext
25935 [http://test.com][[one]] two three
25936 !! end
25937
25938 !! test
25939 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25940 !! options
25941 parsoid=html2wt
25942 !! html/parsoid
25943 <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|}"]}'>
25944 <tbody><tr><td>d
25945 </td></tr>
25946 </tbody></table>
25947 !! wikitext
25948 {{echo|a}}
25949 {|{{echo|c
25950 {{!}}d
25951 }}
25952 |}
25953 !! end
25954
25955 ## This test verifies the presence and computation of this attribute indirectly
25956 ## by making an edit and ensuring that the serialization is correct (which it would be
25957 ## only if firstWikitextNode is properly set).
25958 !! test
25959 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25960 !! options
25961 parsoid= {
25962 "modes": ["wt2wt"],
25963 "changes": [
25964 [ "div#x", "remove" ],
25965 [ "div", "before", "<div>new</div>" ]
25966 ]
25967 }
25968 !! wikitext
25969 <div id="x">foo</div>
25970 {|
25971 {{echo|<div>boo</div>
25972 {{!}}b}}
25973 |c
25974 |}
25975 !! wikitext/edited
25976
25977 <div>new</div>
25978 {|
25979 {{echo|<div>boo</div>
25980 {{!}}b}}
25981 |c
25982 |}
25983 !! end
25984
25985 # --------------------------------------------
25986 # Tests spec'ing wikitext serialization norms |
25987 # --------------------------------------------
25988
25989 !! test
25990 1. Categories should always be serialized on their own line
25991 !! options
25992 parsoid=html2wt
25993 !! html/parsoid
25994 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25995 !! wikitext
25996 foo
25997 [[Category:Foo]]
25998 bar
25999 !! end
26000
26001 !! test
26002 2. Categories that are part of templates should not introduce a line break
26003 !! wikitext
26004 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26005 !! html/parsoid
26006 <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>
26007 !! end
26008
26009 # Careful while editing these next 2 tests. There are \u200f characters
26010 # before and after the <link> tags in the HTML and following some
26011 # of the categories in wikitext
26012 # Do not remove these characters in edits.
26013 #
26014 # As part of the serialization, these bidi characters will get stripped.
26015 !! test
26016 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26017 !! options
26018 parsoid={
26019 "modes": ["html2wt"],
26020 "scrubWikitext": true
26021 }
26022 !! html/parsoid
26023 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26024 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26025 !! wikitext
26026 [[קטגוריה:טקסים]]
26027 [[קטגוריה: שיטות משפט]]
26028 !! end
26029
26030 !! test
26031 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26032 !! options
26033 parsoid={
26034 "modes": ["html2wt"],
26035 "scrubWikitext": true
26036 }
26037 !! html/parsoid
26038 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26039 !! wikitext
26040 [[קטגוריה:טקסים]]
26041 ‏y
26042 !! end
26043
26044 !! test
26045 Lists: Add space after bullets
26046 !! options
26047 parsoid=html2wt
26048 !! html/parsoid
26049 <ul>
26050 <li>foo</li>
26051 <li> bar</li>
26052 <li><span> baz</span></li>
26053 </ul>
26054 !! wikitext
26055 * foo
26056 * bar
26057 * <span> baz</span>
26058 !! end
26059
26060 !! test
26061 1. Headings: Add space before/after == (T53744)
26062 !! options
26063 parsoid=html2wt
26064 !! html/parsoid
26065 <h2>foo</h2>
26066 <h2> bar</h2>
26067 <h2>baz </h2>
26068 <h2><span> baz</span></h2>
26069 !! wikitext
26070 == foo ==
26071
26072 == bar ==
26073
26074 == baz ==
26075
26076 == <span> baz</span> ==
26077 !! end
26078
26079 !! test
26080 2. Headings: Add space before/after == even after hoisted content
26081 !! options
26082 parsoid={
26083 "modes": ["html2wt"],
26084 "scrubWikitext": true
26085 }
26086 !! html/parsoid
26087 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26088 !! wikitext
26089 [[Category:A2]]
26090
26091 == ok ==
26092 !! end
26093
26094 !! test
26095 1. Headings: suppress newly created empty headings
26096 !! options
26097 parsoid={
26098 "modes": ["html2wt"],
26099 "scrubWikitext": true
26100 }
26101 !! html/parsoid
26102 <h2></h2>
26103 !! wikitext
26104 !! end
26105
26106 !! test
26107 2. Headings: don't suppress empty headings if scrubWikitext is false
26108 !! options
26109 parsoid=html2wt
26110 !! html/parsoid
26111 <h2></h2>
26112 !! wikitext
26113 ==<nowiki/>==
26114 !! end
26115
26116 !! test
26117 3. Headings: suppress empty headings on edits
26118 !! options
26119 parsoid={
26120 "modes": ["selser"],
26121 "scrubWikitext": true,
26122 "changes": [
26123 [ "#x", "remove"]
26124 ]
26125 }
26126 !! wikitext
26127 ==<span id="x">foo</span>==
26128 !! wikitext/edited
26129 !! end
26130
26131 !! test
26132 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26133 !! options
26134 parsoid={
26135 "modes": ["html2wt"],
26136 "scrubWikitext": true
26137 }
26138 !! html/parsoid
26139 <h2>foo<br/>bar</h2>
26140 <h2>foo <span><br/>bar</span> baz</h2>
26141 !! wikitext
26142 == foo bar ==
26143
26144 == foo <span> bar</span> baz ==
26145 !! end
26146
26147 !! test
26148 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26149 !! options
26150 parsoid={
26151 "modes": ["html2wt"],
26152 "scrubWikitext": false
26153 }
26154 !! html/parsoid
26155 <h2>foo<br/>bar</h2>
26156 !! wikitext
26157 == foo<br> bar ==
26158 !! end
26159
26160 !! test
26161 1. WT Quote Tags: suppress newly created empty style tags
26162 !! options
26163 parsoid={
26164 "modes": ["html2wt"],
26165 "scrubWikitext": true
26166 }
26167 !! html/parsoid
26168 <i></i><b></b>
26169 !! wikitext
26170 !! end
26171
26172 !! test
26173 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26174 !! options
26175 parsoid=html2wt
26176 !! html/parsoid
26177 <i></i><b></b>
26178 !! wikitext
26179 ''<nowiki/>'''''<nowiki/>'''
26180 !! end
26181
26182 !! test
26183 3. WT Quote Tags: suppress empty style tags on edits
26184 !! options
26185 parsoid={
26186 "modes": ["selser"],
26187 "scrubWikitext": true,
26188 "changes": [
26189 [ "#x", "remove"]
26190 ]
26191 }
26192 !! wikitext
26193 '''<span id="x">foo</span>'''
26194 !! wikitext/edited
26195 !! end
26196
26197 !! test
26198 1. Anchors: suppress newly created empty anchors
26199 !! options
26200 parsoid={
26201 "modes": ["html2wt"],
26202 "scrubWikitext": true
26203 }
26204 !! html/parsoid
26205 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26206 !! wikitext
26207 !! end
26208
26209 !! test
26210 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26211 !! options
26212 parsoid={
26213 "modes": ["html2wt"],
26214 "scrubWikitext": false
26215 }
26216 !! html/parsoid
26217 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26218 !! wikitext
26219 [[Test|<nowiki/>]]
26220 !! end
26221
26222 !! test
26223 3. Anchors: suppress empty anchors on edits
26224 !! options
26225 parsoid={
26226 "modes": ["selser"],
26227 "scrubWikitext": true,
26228 "changes": [
26229 [ "#x", "remove"]
26230 ]
26231 }
26232 !! wikitext
26233 [[Test|<span id="x">foo</span>]]
26234 !! wikitext/edited
26235 !! end
26236
26237 !! test
26238 3a. Anchors: do not suppress numbered extlinks
26239 !! options
26240 parsoid={
26241 "modes": ["wt2wt"],
26242 "scrubWikitext": true
26243 }
26244 !! wikitext
26245 [http://foo.com]
26246 !! html/parsoid
26247 <a rel="mw:ExtLink" href="http://foo.com"></a>
26248 !! end
26249
26250 !! test
26251 3b. Anchors: do not suppress numbered extlinks
26252 !! options
26253 parsoid={
26254 "modes": ["wt2wt"],
26255 "scrubWikitext": true,
26256 "changes": [
26257 [ "#x", "remove"]
26258 ]
26259 }
26260 !! wikitext
26261 [http://foo.com <span id="x">foo</span>]
26262 !! wikitext/edited
26263 [http://foo.com]
26264 !! end
26265
26266 !!test
26267 Normalizations should be restricted to edited content
26268 !!options
26269 parsoid={
26270 "modes": ["selser"],
26271 "scrubWikitext": true,
26272 "changes": [
26273 [ "h1", "before", "<i></i>"]
26274 ]
26275 }
26276 !!wikitext
26277 a
26278 = =
26279 b
26280 !!wikitext/edited
26281 a
26282 = =
26283 b
26284 !!end
26285
26286 !! test
26287 1. Multiple normalizations (html2wt)
26288 !! options
26289 parsoid={
26290 "modes": ["html2wt"],
26291 "scrubWikitext": true
26292 }
26293 !! html
26294 <h2><i></i></h2>
26295 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26296 </a><b><i></i></b>x</p>
26297 !! wikitext
26298
26299 [[foo]]
26300 x
26301
26302 !! end
26303
26304 !! test
26305 2. Multiple normalizations (selser)
26306 !! options
26307 parsoid={
26308 "modes": ["selser"],
26309 "scrubWikitext": true,
26310 "changes": [
26311 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26312 ]
26313 }
26314 !! wikitext
26315 <span id="x">foo</span>
26316 !! wikitext/edited
26317 <span id="x">foo</span>
26318
26319 x
26320 !! end
26321
26322 !! test
26323 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26324 !! options
26325 parsoid={
26326 "modes": ["html2wt"],
26327 "scrubWikitext": true
26328 }
26329 !! html/parsoid
26330 <p> hi</p>
26331 <p> hello</p>
26332 !! wikitext
26333 hi
26334
26335 hello
26336 !! end
26337
26338 !! test
26339 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26340 !! options
26341 parsoid=html2wt
26342 !! html/parsoid
26343 <p> hi</p>
26344 <p> hello</p>
26345 !! wikitext
26346 <nowiki> </nowiki>hi
26347
26348 <nowiki> </nowiki> hello
26349 !! end
26350
26351 !! test
26352 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26353 !! options
26354 parsoid={
26355 "modes": ["html2wt"],
26356 "scrubWikitext": true
26357 }
26358 !! html/parsoid
26359 <p>Foo
26360 bar
26361 baz</p>
26362
26363 <table><tr><td>Foo
26364 bar
26365 baz bang</td></tr></table>
26366
26367 <p><!--boo--> foo
26368 bar</p>
26369
26370 <p> foo
26371 bar<span>boo</span></p>
26372 !! wikitext
26373 Foo
26374 bar
26375 baz
26376
26377 {|
26378 |Foo
26379 bar
26380 baz bang
26381 |}
26382
26383 <!--boo-->foo
26384 bar
26385
26386 foo
26387 bar<span>boo</span>
26388 !! end
26389
26390 !! test
26391 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26392 !! options
26393 parsoid={
26394 "modes": ["selser"],
26395 "scrubWikitext": true,
26396 "changes": [
26397 [ "p", "html", " a\n b" ]
26398 ]
26399 }
26400 !! wikitext
26401 xyz
26402 !! wikitext/edited
26403 a
26404 b
26405 !! end
26406
26407 !! test
26408 1. New links that end in spaces
26409 !! options
26410 parsoid={
26411 "modes": ["html2wt"],
26412 "scrubWikitext": false
26413 }
26414 !! html/parsoid
26415 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26416 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26417 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26418 !! wikitext
26419 [[Berlin ]]<nowiki/>is the capital of Germany.
26420
26421 [[Foo ]]'''bar'''
26422
26423 [[Boston ]] is a city.
26424 !! end
26425
26426 !! test
26427 2. New links that end in spaces
26428 !! options
26429 parsoid={
26430 "modes": ["html2wt"],
26431 "scrubWikitext": true
26432 }
26433 !! html/parsoid
26434 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26435 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26436 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26437 !! wikitext
26438 [[Berlin]] is the capital of Germany.
26439
26440 [[Foo]] '''bar'''
26441
26442 [[Boston]] is a city.
26443 !! end
26444
26445 !! test
26446 1. Table cells with escapable prefixes
26447 !! options
26448 parsoid={
26449 "modes": ["html2wt"],
26450 "scrubWikitext": false
26451 }
26452 !! html
26453 <table>
26454 <tr><td>a</td></tr>
26455 <tr><td>-</td></tr>
26456 <tr><td>+</td></tr>
26457 </table>
26458 !! wikitext
26459 {|
26460 |a
26461 |-
26462 |<nowiki>-</nowiki>
26463 |-
26464 |<nowiki>+</nowiki>
26465 |}
26466 !! end
26467
26468 !! test
26469 2. Table cells with escapable prefixes
26470 !! options
26471 parsoid={
26472 "modes": ["html2wt"],
26473 "scrubWikitext": true
26474 }
26475 !! html
26476 <table>
26477 <tr><td>a</td></tr>
26478 <tr><td>-</td></tr>
26479 <tr><td>+</td></tr>
26480 </table>
26481 !! wikitext
26482 {|
26483 |a
26484 |-
26485 | -
26486 |-
26487 | +
26488 |}
26489 !! end
26490
26491 !! test
26492 3a. Table cells with escapable prefixes after edits
26493 !! options
26494 parsoid={
26495 "modes": ["selser"],
26496 "scrubWikitext": true,
26497 "changes": [
26498 [ "table tbody tr:first-child td:first-child", "remove"]
26499 ]
26500 }
26501 !! wikitext
26502 {|
26503 |a||-
26504 |}
26505 !! wikitext/edited
26506 {|
26507 | -
26508 |}
26509 !! end
26510
26511 !! test
26512 3b. Table cells with escapable prefixes after edits
26513 !! options
26514 parsoid={
26515 "modes": ["selser"],
26516 "scrubWikitext": true,
26517 "changes": [
26518 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26519 [ "#x", "remove" ]
26520 ]
26521 }
26522 !! wikitext
26523 {|
26524 |pqr
26525 |<span id="x">foo</span>+
26526 |}
26527 !! wikitext/edited
26528 {|
26529 | -
26530 | +
26531 |}
26532 !! end
26533
26534 # FIXME: This test will fail because
26535 # normalization doesn't realize that the id attribute
26536 # will eliminate the escapable scenario
26537 !! test
26538 4a. Table cells without escapable prefixes after edits
26539 !! options
26540 parsoid={
26541 "modes": ["selser"],
26542 "scrubWikitext": true,
26543 "changes": [
26544 [ "#x", "html", "-" ]
26545 ]
26546 }
26547 !! wikitext
26548 {|
26549 | id="x" |abcd
26550 |}
26551 !! wikitext/edited
26552 {|
26553 | id="x" |-
26554 |}
26555 !! end
26556
26557 ## This tests normalizer's ability to discriminate between
26558 ## cells having identical content.
26559 !! test
26560 4b. Table cells without escapable prefixes after edits
26561 !! options
26562 parsoid={
26563 "modes": ["selser"],
26564 "scrubWikitext": true,
26565 "changes": [
26566 [ "td", "html", "-" ]
26567 ]
26568 }
26569 !! wikitext
26570 {|
26571 |a||b
26572 |}
26573 !! wikitext/edited
26574 {|
26575 | -||-
26576 |}
26577 !! end
26578
26579 ## This tests normalizer's ability to not be tripped by
26580 ## comments (and whitespace)
26581 !! test
26582 4c. Table cells without escapable prefixes after edits
26583 !! options
26584 parsoid={
26585 "modes": ["selser"],
26586 "scrubWikitext": true,
26587 "changes": [
26588 [ "table tbody tr td:first-child", "remove" ]
26589 ]
26590 }
26591 !! wikitext
26592 {|
26593 |-
26594 <!--foo--> |a||-
26595 |}
26596 !! wikitext/edited
26597 {|
26598 |-
26599 <!--foo--> | -
26600 |}
26601 !! end
26602
26603 ## This tests normalizer's ability to handle HTML cells
26604 !! test
26605 4d. Table cells without escapable prefixes after edits
26606 !! options
26607 parsoid={
26608 "modes": ["selser"],
26609 "scrubWikitext": true,
26610 "changes": [
26611 [ "td", "html", "-" ]
26612 ]
26613 }
26614 !! wikitext
26615 <table>
26616 <tr><td>a</td></tr>
26617 </table>
26618 !! wikitext/edited
26619 <table>
26620 <tr><td>-</td></tr>
26621 </table>
26622 !! end
26623
26624 ## T111151 Remove font elements without attributes
26625 !! test
26626 5a. font tags without attributes should be dropped in scrubWikitext mode
26627 !! options
26628 parsoid={
26629 "modes": ["html2wt"],
26630 "scrubWikitext": true
26631 }
26632 !! html
26633 <font>foo</font>
26634 <font><font>bar</font></font>
26635 <font class="x">boo</font>
26636 !! wikitext
26637 foo
26638 bar
26639 <font class="x">boo</font>
26640 !! end
26641
26642 !! test
26643 5b. font tags should not be dropped without scrubWikitext being enabled
26644 !! options
26645 parsoid={
26646 "modes": ["html2wt"],
26647 "scrubWikitext": false
26648 }
26649 !! html
26650 <font>foo</font>
26651 !! wikitext
26652 <font>foo</font>
26653 !! end
26654
26655 !! test
26656 Escape nowiki DOM elements
26657 !! options
26658 parsoid=html2wt
26659 !! html/parsoid
26660 <nowiki><i>foo</i></nowiki>
26661 !! wikitext
26662 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26663 !! end
26664
26665 # This is meant to be an interim fix while we go about figuring out
26666 # how to not introduce these trailing <nowiki/>s in the first place.
26667 !! test
26668 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26669 !! options
26670 parsoid=html2wt
26671 !! html/parsoid
26672 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26673 y</p>
26674 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"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>
26675 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,24,null,null],"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>
26676 !! wikitext
26677 x
26678 y
26679
26680 {{echo|
26681 1 = <nowiki/>}}
26682
26683 {{echo|
26684 1 = <nowiki/>
26685 }}
26686 !! end
26687
26688 # ---------------------------------------------------
26689 # End of tests spec'ing wikitext serialization norms |
26690 # ---------------------------------------------------
26691
26692 # T104032
26693 !! test
26694 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26695 !! options
26696 parsoid=html2wt
26697 !! html/parsoid
26698 a<p>b</p>
26699 <b>c</b><p>d</p>
26700 <table><tr>
26701 <td>a<p>b</p></td>
26702 <td><b>c</b><p>d</p></td>
26703 </tr></table>
26704 !! wikitext
26705 a
26706
26707 b
26708
26709 '''c'''
26710
26711 d
26712 {|
26713 |a
26714 b
26715 |'''c'''
26716 d
26717 |}
26718 !! end
26719
26720 # -----------------------------------------------------------------
26721 # End of section for Parsoid-only html2wt tests for serialization
26722 # of new content
26723 # -----------------------------------------------------------------
26724
26725 # -----------------------------------------------------------------
26726 # The following section of tests are primarily to spec behavior of
26727 # the selective serializer. All these tests have manual selser
26728 # changes. The automated selser changes for all tests handle the
26729 # wide variation of changes, but these tests here capture specs
26730 # deterministically.
26731 # ----------------------------------------------------------------
26732
26733 ## T90517
26734 !! test
26735 Selser: New comments should not be lost
26736 !! options
26737 parsoid={
26738 "modes": ["selser"],
26739 "changes": [
26740 [ "#a", "after", "<!--c1-->" ],
26741 [ "#b", "before", "<!--c2-->" ]
26742 ]
26743 }
26744 !! wikitext
26745 <span id="a">a</span>
26746
26747 <span id="b">b</span>
26748 !! wikitext/edited
26749 <span id="a">a</span><!--c1-->
26750
26751 <!--c2--><span id="b">b</span>
26752 !! end
26753
26754 ## T89383
26755 !! test
26756 Selser: Check for validity of DSR before using it
26757 !! options
26758 parsoid={
26759 "modes": ["selser"],
26760 "changes": [
26761 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26762 ]
26763 }
26764 !! wikitext
26765 <span id="a">a</span>
26766 !! wikitext/edited
26767 {{DISPLAYTITLE:foo}}
26768 <span id="a">a</span>
26769 !! end
26770
26771 !! test
26772 1. DOMDiff: Changes to <ref> content should be looked up using id
26773 !! options
26774 parsoid={
26775 "modes": ["selser"],
26776 "changes": [
26777 ["#X", "after", "bar"],
26778 ["#Y", "after", "baz"]
26779 ]
26780 }
26781 !! wikitext
26782 X <ref><span id="X">foo</span></ref>
26783 Y <ref name="a" />
26784 <references>
26785 <ref name="a"><span id="Y">foo</span></ref>
26786 </references>
26787 !! wikitext/edited
26788 X <ref><span id="X">foo</span>bar</ref>
26789 Y <ref name="a" />
26790 <references>
26791 <ref name="a"><span id="Y">foo</span>baz</ref>
26792 </references>
26793 !! end
26794
26795 !! test
26796 2. DOMDiff: Changes to <ref> content should be looked up using id
26797 !! options
26798 parsoid={
26799 "modes": ["selser"],
26800 "changes": [
26801 ["#Z", "after", "bar"]
26802 ]
26803 }
26804 !! wikitext
26805 A <ref>foo bar for a</ref>
26806 B <ref group="X" name="b" />
26807
26808 <references />
26809
26810 <references group="X">
26811 <ref name="b"><span id="Z">foo</span></ref>
26812 </references>
26813 !! wikitext/edited
26814 A <ref>foo bar for a</ref>
26815 B <ref group="X" name="b" />
26816
26817 <references />
26818
26819 <references group="X">
26820 <ref name="b"><span id="Z">foo</span>bar</ref>
26821 </references>
26822 !! end
26823
26824 !! test
26825 Empty LI (T49673)
26826 !! wikitext
26827 * a
26828 *
26829 *
26830 * b
26831 !! html/php+tidy
26832 <ul>
26833 <li>a</li>
26834 <li class="mw-empty-li"></li>
26835 <li class="mw-empty-li"></li>
26836 <li>b</li>
26837 </ul>
26838 !! end