Merge "Fix whitespace trimming in headings"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://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 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 // For Serbian; localize Template namespace
113 !! article
114 Шаблон:Echo
115 !! text
116 {{{1}}}
117 !! endarticle
118
119 !! article
120 Template:echo_with_span
121 !! text
122 <span>{{{1}}}</span>
123 !! endarticle
124
125 !! article
126 Template:echo_with_div
127 !! text
128 <div>{{{1}}}</div>
129 !! endarticle
130
131 !! article
132 Template:blank_param
133 !! text
134 {{{1}}}
135 {{{}}}
136 !! endarticle
137
138 !! article
139 Template:table_attribs
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 !! endarticle
144
145 !! article
146 Template:table_attribs_2
147 !! text
148 <noinclude>
149 |</noinclude>style="color:red;"|Foo
150 |Bar||Baz
151 !! endarticle
152
153 !! article
154 Template:table_attribs_3
155 !! text
156 <noinclude>
157 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
158 !! endarticle
159
160 !! article
161 Template:table_attribs_4
162 !! text
163 | style="background-color:#DC241f;" width="10px" |
164 !! endarticle
165
166 !! article
167 Template:table_attribs_5
168 !! text
169 <noinclude>
170 |</noinclude>style="color:red;"||Bar
171 !! endarticle
172
173 !! article
174 Template:table_attribs_6
175 !! text
176 style="background: <nowiki>
177
178
179 red;</nowiki>" |
180 !! endarticle
181
182 !! article
183 Template:table_attribs_7
184 !! text
185 <noinclude>
186 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
187 !! endarticle
188
189 !! article
190 Template:table_header_cells
191 !! text
192 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
193 !! endarticle
194
195 !! article
196 Template:table_cells
197 !! text
198 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
199 !! endarticle
200
201 !! article
202 Template:PartialTable
203 !! text
204 {|
205 |-
206 !! endarticle
207
208 !! article
209 Template:image_attribs
210 !! text
211 <noinclude>
212 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
213 !! endarticle
214
215 ## See T48811 for details
216 !! article
217 Template:mixed_attr_content_template
218 !! text
219 style="color:red;" title="T48811"
220 |-
221 |foo
222 !! endarticle
223
224 !! article
225 Template:definition_list
226 !! text
227 one
228 ::two
229 !! endarticle
230
231 !! article
232 A?b
233 !! text
234 Weirdo titles!
235 !! endarticle
236
237 !!article
238 Template:Bullet
239 !!text
240 * Bar
241 !!endarticle
242
243 !!article
244 Template:OpenTable
245 !!text
246 {|
247 !!endarticle
248
249 !!article
250 Template:EmptyLITest
251 !!text
252 *a
253 *
254 *
255 *b
256 !!endarticle
257
258 !!article
259 Template:EmptyTRTest
260 !!text
261 {|
262 |-
263 |-
264 |foo
265 |-
266 |-
267 |bar
268 |}
269 !!endarticle
270
271 !!article
272 Template:EmptyTRWithHTMLAttrTest
273 !!text
274 <table>
275 <tr align="center"></tr>
276 <tr><td>foo</td></tr>
277 <tr align="center"></tr>
278 <tr><td>bar</td></tr>
279 </table>
280 !!endarticle
281
282 !! article
283 Template:With: Colon
284 !! text
285 Template with colon
286 !! endarticle
287
288 ###
289 ### Basic tests
290 ###
291
292 !! test
293 Blank input
294 !! wikitext
295 !! html
296 !! end
297
298 !! test
299 Simple paragraph
300 !! wikitext
301 This is a simple paragraph.
302 !! html
303 <p>This is a simple paragraph.
304 </p>
305 !! end
306
307 !! test
308 Paragraphs with extra newline spacing
309 !! wikitext
310 foo
311
312 bar
313
314
315 baz
316
317
318
319 booz
320 !! html
321 <p>foo
322 </p><p>bar
323 </p><p><br />
324 baz
325 </p><p><br />
326 </p><p>booz
327 </p>
328 !! end
329
330 !! test
331 Paragraphs with newline spacing with comment lines in between
332 !! wikitext
333 ----
334 a
335 <!--foo-->
336 b
337 ----
338 a
339 <!--foo--><!--More than 1 comment, still stripped-->
340 b
341 ----
342 a
343 <!--foo--> <!----> <!-- bar -->
344 b
345 ----
346 a
347 <!--foo-->
348
349 b
350 ----
351 a
352
353 <!--foo-->
354 b
355 ----
356 a
357 <!--foo-->
358
359
360 b
361 ----
362 a
363
364
365 <!--foo-->
366 b
367 ----
368 !! html
369 <hr />
370 <p>a
371 b
372 </p>
373 <hr />
374 <p>a
375 b
376 </p>
377 <hr />
378 <p>a
379 b
380 </p>
381 <hr />
382 <p>a
383 </p><p>b
384 </p>
385 <hr />
386 <p>a
387 </p><p>b
388 </p>
389 <hr />
390 <p>a
391 </p><p><br />
392 b
393 </p>
394 <hr />
395 <p>a
396 </p><p><br />
397 b
398 </p>
399 <hr />
400
401 !! end
402
403 !! test
404 Paragraphs with newline spacing with non-empty white-space lines in between
405 !! wikitext
406 ----
407 a
408
409 b
410 ----
411 a
412
413
414 b
415 ----
416 !! html
417 <hr />
418 <p>a
419 </p><p>b
420 </p>
421 <hr />
422 <p>a
423 </p><p><br />
424 b
425 </p>
426 <hr />
427
428 !! end
429
430 !! test
431 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
432 !! wikitext
433 ----
434 a
435 <!--foo-->
436 b
437 ----
438 a
439 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
440 b
441 ----
442 a
443
444 <!--foo-->
445 <!--bar-->
446 b
447 ----
448 a
449
450 <!--foo-->
451 <!--bar-->
452
453 b
454 ----
455 !! html
456 <hr />
457 <p>a
458 b
459 </p>
460 <hr />
461 <p>a
462 b
463 </p>
464 <hr />
465 <p>a
466 </p><p>b
467 </p>
468 <hr />
469 <p>a
470 </p><p><br />
471 b
472 </p>
473 <hr />
474
475 !! end
476
477 !! test
478 Extra newlines: More paragraphs with indented comment
479 !! wikitext
480 a
481
482 <!--boo-->
483
484 b
485 !! html
486 <p>a
487 </p><p><br />
488 b
489 </p>
490 !!end
491
492 !! test
493 Extra newlines followed by heading
494 !! wikitext
495 a
496
497
498
499 =b=
500 [[a]]
501
502
503 =b=
504 !! html
505 <p>a
506 </p><p><br />
507 </p>
508 <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>
509 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
510 </p><p><br />
511 </p>
512 <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>
513
514 !! end
515
516 !! test
517 Extra newlines between heading and content are swallowed
518 !! wikitext
519 =b=
520
521
522
523 [[a]]
524 !! html
525 <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>
526 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
527 </p>
528 !! end
529
530 !! test
531 Heading with line break in nowiki
532 !! options
533 parsoid=wt2html
534 !! config
535 wgFragmentMode=[ 'html5', 'legacy' ]
536 !! wikitext
537 ==A <nowiki>B
538 C</nowiki>==
539 !! html/php
540 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
541 C">A B
542 C</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 B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
543
544 !! html/parsoid
545 <h2 id="A_B
546 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
547 C</span></h2>
548 !! end
549
550 !! test
551 Parsing an URL
552 !! wikitext
553 http://fr.wikipedia.org/wiki/🍺
554 <!-- EasterEgg we love beer, better be able be able to link to it -->
555 !! html
556 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
557 </p>
558 !! end
559
560 !! test
561 Simple list
562 !! wikitext
563 *Item 1
564 *Item 2
565 !! html
566 <ul><li>Item 1</li>
567 <li>Item 2</li></ul>
568
569 !! end
570
571 !! test
572 Italics and bold
573 !! wikitext
574 *plain
575 *plain''italic''plain
576 *plain''italic''plain''italic''plain
577 *plain'''bold'''plain
578 *plain'''bold'''plain'''bold'''plain
579 *plain''italic''plain'''bold'''plain
580 *plain'''bold'''plain''italic''plain
581 *plain''italic'''bold-italic'''italic''plain
582 *plain'''bold''bold-italic''bold'''plain
583 *plain'''''bold-italic'''italic''plain
584 *plain'''''bold-italic''bold'''plain
585 *plain''italic'''bold-italic'''''plain
586 *plain'''bold''bold-italic'''''plain
587 *plain l'''italic''plain
588 *plain l''''bold''' plain
589 !! html
590 <ul><li>plain</li>
591 <li>plain<i>italic</i>plain</li>
592 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
593 <li>plain<b>bold</b>plain</li>
594 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
595 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
596 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
597 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
598 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
599 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
600 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
601 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
602 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
603 <li>plain l'<i>italic</i>plain</li>
604 <li>plain l'<b>bold</b> plain</li></ul>
605
606 !! end
607
608 # this example taken from the [[simple:Moon]] article (T49326)
609 !! test
610 Italics and possessives (1)
611 !! wikitext
612 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
613 !! html
614 <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
615 </p>
616 !! end
617
618 # this example taken from [[en:Flaming Pie]] (T51926)
619 !! test
620 Italics and possessives (2)
621 !! wikitext
622 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
623 !! html
624 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
625 </p>
626 !! end
627
628 # this example taken from [[en:Dictionary]] (T51926)
629 !! test
630 Italics and possessives (3)
631 !! wikitext
632 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''.
633 !! html
634 <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>.
635 </p>
636 !! end
637
638
639 ###
640 ### 2-quote opening sequence tests
641 ###
642 !! test
643 Italics and bold: 2-quote opening sequence: (2,2)
644 !! wikitext
645 ''foo''
646 !! html
647 <p><i>foo</i>
648 </p>
649 !!end
650
651 !! test
652 Italics and bold: 2-quote opening sequence: (2,3)
653 !! wikitext
654 ''foo'''
655 !! html/*
656 <p><i>foo'</i>
657 </p>
658 !!end
659
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,4)
662 !! options
663 parsoid=wt2html
664 !! wikitext
665 ''foo''''
666 !! html/*
667 <p><i>foo''</i>
668 </p>
669 !!end
670
671 # same html as previous, but wikitext adjusted to match parsoid html2wt
672 !! test
673 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
674 !! wikitext
675 ''foo<nowiki>''</nowiki>''
676 !! html
677 <p><i>foo''</i>
678 </p>
679 !! end
680
681 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
682 !! test
683 Italics and bold: 2-quote opening sequence: (2,5)
684 !! options
685 parsoid=wt2html
686 !! wikitext
687 ''foo'''''
688 !! html/php
689 <p><i>foo</i>
690 </p>
691 !! html/parsoid
692 <p><i>foo</i><b></b>
693 </p>
694 !!end
695
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
699 !! wikitext
700 ''foo'''''<nowiki/>'''
701 !! html/php
702 <p><i>foo</i>
703 </p>
704 !! html/parsoid
705 <p><i>foo</i><b></b>
706 </p>
707 !! end
708
709
710 ###
711 ### 3-quote opening sequence tests
712 ###
713
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,2)
716 !! wikitext
717 '''foo''
718 !! html/*
719 <p>'<i>foo</i>
720 </p>
721 !!end
722
723 !! test
724 Italics and bold: 3-quote opening sequence: (3,3)
725 !! wikitext
726 '''foo'''
727 !! html
728 <p><b>foo</b>
729 </p>
730 !!end
731
732 !! test
733 Italics and bold: 3-quote opening sequence: (3,4)
734 !! wikitext
735 '''foo''''
736 !! html/*
737 <p><b>foo'</b>
738 </p>
739 !!end
740
741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
742 !! test
743 Italics and bold: 3-quote opening sequence: (3,5)
744 !! options
745 parsoid=wt2html
746 !! wikitext
747 '''foo'''''
748 !! html/php
749 <p><b>foo</b>
750 </p>
751 !! html/parsoid
752 <p><b>foo</b><i></i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
759 !! wikitext
760 '''foo'''''<nowiki/>''
761 !! html/php
762 <p><b>foo</b>
763 </p>
764 !! html/parsoid
765 <p><b>foo</b><i></i>
766 </p>
767 !! end
768
769
770 ###
771 ### 4-quote opening sequence tests
772 ###
773
774 !! test
775 Italics and bold: 4-quote opening sequence: (4,2)
776 !! options
777 parsoid=wt2html
778 !! wikitext
779 ''''foo''
780 !! html/*
781 <p>''<i>foo</i>
782 </p>
783 !!end
784
785 # same html as previous, but wikitext adjusted to match parsoid html2wt
786 !! test
787 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
788 !! wikitext
789 <nowiki>''</nowiki>''foo''
790 !! html
791 <p>''<i>foo</i>
792 </p>
793 !! end
794
795 !! test
796 Italics and bold: 4-quote opening sequence: (4,3)
797 !! wikitext
798 ''''foo'''
799 !! html/*
800 <p>'<b>foo</b>
801 </p>
802 !!end
803
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,4)
806 !! options
807 parsoid=wt2html
808 !! wikitext
809 ''''foo''''
810 !! html/*
811 <p>'<b>foo'</b>
812 </p>
813 !!end
814
815 # same html as previous, but wikitext adjusted to match parsoid html2wt
816 !! test
817 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
818 !! wikitext
819 '<nowiki/>'''foo''''
820 !! html
821 <p>'<b>foo'</b>
822 </p>
823 !! end
824
825 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
826 !! test
827 Italics and bold: 4-quote opening sequence: (4,5)
828 !! options
829 parsoid=wt2html
830 !! wikitext
831 ''''foo'''''
832 !! html/php
833 <p>'<b>foo</b>
834 </p>
835 !! html/parsoid
836 <p>'<b>foo</b><i></i>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
843 !! wikitext
844 '<nowiki/>'''foo'''''<nowiki/>''
845 !! html/php
846 <p>'<b>foo</b>
847 </p>
848 !! html/parsoid
849 <p>'<b>foo</b><i></i>
850 </p>
851 !! end
852
853
854 ###
855 ### 5-quote opening sequence tests
856 ###
857
858 !! test
859 Italics and bold: 5-quote opening sequence: (5,2)
860 !! options
861 parsoid=wt2html
862 !! wikitext
863 '''''foo''
864 !! html/*
865 <p><b><i>foo</i></b>
866 </p>
867 !!end
868
869 # same html as previous, but wikitext adjusted to match parsoid html2wt
870 !! test
871 Italics and bold: 5-quote opening sequence: (5,2+3)
872 !! wikitext
873 '''''foo'''''
874 !! html/*
875 <p><i><b>foo</b></i>
876 </p>
877 !! end
878
879 !! test
880 Italics and bold: 5-quote opening sequence: (5,3)
881 !! options
882 parsoid=wt2html
883 !! wikitext
884 '''''foo'''
885 !! html/*
886 <p><i><b>foo</b></i>
887 </p>
888 !!end
889
890 # same html as previous, but wikitext adjusted to match parsoid html2wt
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,3+2)
893 !! wikitext
894 '''''foo'''''
895 !! html
896 <p><i><b>foo</b></i>
897 </p>
898 !! end
899
900 !! test
901 Italics and bold: 5-quote opening sequence: (5,4)
902 !! options
903 parsoid=wt2html
904 !! wikitext
905 '''''foo''''
906 !! html/*
907 <p><i><b>foo'</b></i>
908 </p>
909 !!end
910
911 !! test
912 Italics and bold: 5-quote opening sequence: (5,5)
913 !! wikitext
914 '''''foo'''''
915 !! html
916 <p><i><b>foo</b></i>
917 </p>
918 !!end
919
920 !! test
921 Italics and bold: 5-quote opening sequence: (5,6)
922 !! wikitext
923 '''''foo''''''
924 !! html/*
925 <p><i><b>foo'</b></i>
926 </p>
927 !! end
928
929 ###
930 ### multiple quote sequences in a line
931 ###
932
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,2)
935 !! options
936 parsoid=wt2html
937 !! wikitext
938 ''foo''''bar''
939 !! html/*
940 <p><i>foo'<b>bar</b></i>
941 </p>
942 !! end
943
944 # same html as previous, but wikitext adjusted to match parsoid html2wt
945 !! test
946 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
947 !! wikitext
948 ''foo'<nowiki/>'''bar'''''
949 !! html
950 <p><i>foo'<b>bar</b></i>
951 </p>
952 !! end
953
954 !! test
955 Italics and bold: multiple quote sequences: (2,4,3)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 ''foo''''bar'''
960 !! html/*
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !! end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
968 !! wikitext
969 ''foo'<nowiki/>'''bar'''''
970 !! html
971 <p><i>foo'<b>bar</b></i>
972 </p>
973 !! end
974
975 !! test
976 Italics and bold: multiple quote sequences: (2,4,4)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 ''foo''''bar''''
981 !! html/*
982 <p><i>foo'<b>bar'</b></i>
983 </p>
984 !! end
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 !! test
988 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
989 !! wikitext
990 ''foo'<nowiki/>'''bar'<nowiki/>'''''
991 !! html
992 <p><i>foo'<b>bar'</b></i>
993 </p>
994 !! end
995
996 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
997 !! test
998 Italics and bold: multiple quote sequences: (3,4,2)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''foo''''bar''
1003 !! html/php
1004 <p><b>foo'</b>bar
1005 </p>
1006 !! html/parsoid
1007 <p><b>foo'</b>bar<i></i>
1008 </p>
1009 !! end
1010
1011 # same html as previous, but wikitext adjusted to match parsoid html2wt
1012 !! test
1013 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1014 !! wikitext
1015 '''foo''''bar''<nowiki/>''
1016 !! html/php
1017 <p><b>foo'</b>bar
1018 </p>
1019 !! html/parsoid
1020 <p><b>foo'</b>bar<i></i>
1021 </p>
1022 !! end
1023
1024 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1025 !! test
1026 Italics and bold: multiple quote sequences: (3,4,3)
1027 !! options
1028 parsoid=wt2html
1029 !! wikitext
1030 '''foo''''bar'''
1031 !! html/php
1032 <p><b>foo'</b>bar
1033 </p>
1034 !! html/parsoid
1035 <p><b>foo'</b>bar<b></b>
1036 </p>
1037 !! end
1038
1039 # same html as previous, but wikitext adjusted to match parsoid html2wt
1040 !! test
1041 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1042 !! wikitext
1043 '''foo''''bar'''<nowiki/>'''
1044 !! html/php
1045 <p><b>foo'</b>bar
1046 </p>
1047 !! html/parsoid
1048 <p><b>foo'</b>bar<b></b>
1049 </p>
1050 !! end
1051
1052 ###
1053 ### other quote tests
1054 ###
1055 !! test
1056 Italics and bold: other quote tests: (2,3,5)
1057 !! wikitext
1058 ''this is about '''foo's family'''''
1059 !! html
1060 <p><i>this is about <b>foo's family</b></i>
1061 </p>
1062 !!end
1063
1064
1065 !! test
1066 Italics and bold: other quote tests: (2,(3,3),2)
1067 !! wikitext
1068 ''this is about '''foo's''' family''
1069 !! html
1070 <p><i>this is about <b>foo's</b> family</i>
1071 </p>
1072 !!end
1073
1074
1075 !! test
1076 Italics and bold: other quote tests: (3,2,3,2)
1077 !! options
1078 parsoid=wt2html
1079 !! wikitext
1080 '''this is about ''foo'''s family''
1081 !! html/*
1082 <p><b>this is about <i>foo</i></b><i>s family</i>
1083 </p>
1084 !!end
1085
1086
1087 # same html as previous, but wikitext adjusted to match parsoid html2wt
1088 !! test
1089 Italics and bold: other quote tests: (3,2,3+2+2,2)
1090 !! wikitext
1091 '''this is about ''foo'''''<nowiki/>''s family''
1092 !! html
1093 <p><b>this is about <i>foo</i></b><i>s family</i>
1094 </p>
1095 !! end
1096
1097
1098 !! test
1099 Italics and bold: other quote tests: (3,2,3,3)
1100 !! wikitext
1101 '''this is about ''foo'''s family'''
1102 !! html/*
1103 <p>'<i>this is about </i>foo<b>s family</b>
1104 </p>
1105 !!end
1106
1107
1108 !! test
1109 Italics and bold: other quote tests: (3,(2,2),3)
1110 !! wikitext
1111 '''this is about ''foo's'' family'''
1112 !! html
1113 <p><b>this is about <i>foo's</i> family</b>
1114 </p>
1115 !!end
1116
1117
1118 !! test
1119 Italicized possessive
1120 !! wikitext
1121 The ''[[Main Page]]'''s talk page.
1122 !! html/php
1123 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1124 </p>
1125 !! html/parsoid
1126 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1127 !! end
1128
1129 !! test
1130 Quote balancing context should be restricted to td/th cells on the same wikitext line
1131 !! options
1132 parsoid=wt2html,wt2wt
1133 !! wikitext
1134 {|
1135 !''a!!''b
1136 |''a||''b
1137 |}
1138 !! html+tidy
1139 <table>
1140 <tbody><tr>
1141 <th><i>a</i></th>
1142 <th><i>b</i>
1143 </th>
1144 <td><i>a</i></td>
1145 <td><i>b</i>
1146 </td></tr></tbody></table>
1147 !! end
1148
1149 ###
1150 ### Non-html5 tags
1151 ###
1152
1153 !! test
1154 Non-html5 tags should be accepted
1155 !! wikitext
1156 <center>''foo''</center>
1157 <big>''foo''</big>
1158 <font>''foo''</font>
1159 <strike>''foo''</strike>
1160 <tt>''foo''</tt>
1161 !! html
1162 <center><i>foo</i></center>
1163 <p><big><i>foo</i></big>
1164 <font><i>foo</i></font>
1165 <strike><i>foo</i></strike>
1166 <tt><i>foo</i></tt>
1167 </p>
1168 !! end
1169
1170 !! test
1171 <wbr> is valid wikitext (T54468)
1172 !! wikitext
1173 <wbr>
1174 !! html
1175 <p><wbr />
1176 </p>
1177 !! end
1178
1179 # <strike> is HTML4, <s> is HTML4/5.
1180 !! test
1181 <s> or <strike> for strikethrough
1182 !! wikitext
1183 <strike>strike</strike>
1184
1185 <s>s</s>
1186 !! html
1187 <p><strike>strike</strike>
1188 </p><p><s>s</s>
1189 </p>
1190 !! end
1191
1192 ## a not permitted
1193 ## i,b,br omitted
1194 !! test
1195 Text-level semantic html elements in wikitext
1196 !! wikitext
1197 <em>text</em>
1198 <strong>text</strong>
1199 <small>text</small>
1200 <s>text</s>
1201 <cite>text</cite>
1202 <q>text</q>
1203 <dfn>text</dfn>
1204 <abbr>text</abbr>
1205 <data>text</data>
1206 <time>text</time>
1207 <code>text</code>
1208 <var>text</var>
1209 <samp>text</samp>
1210 <kbd>text</kbd>
1211 <sub>text</sub>
1212 <u>text</u>
1213 <mark>text</mark>
1214 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1215 <bdi>text</bdi>
1216 <bdo>text</bdo>
1217 <span>text</span>
1218 <wbr />
1219 !! html
1220 <p><em>text</em>
1221 <strong>text</strong>
1222 <small>text</small>
1223 <s>text</s>
1224 <cite>text</cite>
1225 <q>text</q>
1226 <dfn>text</dfn>
1227 <abbr>text</abbr>
1228 <data>text</data>
1229 <time>text</time>
1230 <code>text</code>
1231 <var>text</var>
1232 <samp>text</samp>
1233 <kbd>text</kbd>
1234 <sub>text</sub>
1235 <u>text</u>
1236 <mark>text</mark>
1237 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1238 <bdi>text</bdi>
1239 <bdo>text</bdo>
1240 <span>text</span>
1241 <wbr />
1242 </p>
1243 !! end
1244
1245 # test cases taken from
1246 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1247 !! test
1248 Ruby markup (W3C-style)
1249 !! wikitext
1250 ;Mono-ruby for individual base characters
1251 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1252 ;Group ruby
1253 :<ruby>今日<rt>きょう</rt></ruby>
1254 ;Jukugo ruby
1255 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1256 ;Inline ruby
1257 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1258 ;Double-sided ruby
1259 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1260 <ruby>
1261 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1262 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1263 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1264 </ruby>
1265 !! html
1266 <dl><dt>Mono-ruby for individual base characters</dt>
1267 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1268 <dt>Group ruby</dt>
1269 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1270 <dt>Jukugo ruby</dt>
1271 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1272 <dt>Inline ruby</dt>
1273 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1274 <dt>Double-sided ruby</dt>
1275 <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>
1276 <p><ruby>
1277 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1278 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1279 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1280 </ruby>
1281 </p>
1282 !! end
1283
1284 # The next two test different paths in the sanitizer.
1285 !! test
1286 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1287 !! wikitext
1288 <blockquote|>a</blockquote>
1289
1290 <b→> doesn't terminate </b→>
1291
1292 <bä> doesn't terminate </bä>
1293
1294 <boo> doesn't terminate </boo>
1295
1296 <s.foo> doesn't terminate </s.foo>
1297
1298 <sub-ID#1>
1299 !! html
1300 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1301 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1302 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1303 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1304 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1305 </p><p>&lt;sub-ID#1&gt;
1306 </p>
1307 !! end
1308
1309 !! test
1310 Non-word characters don't terminate tag names
1311 !! wikitext
1312 <blockquote|>a</blockquote>
1313
1314 <b→> doesn't terminate </b→>
1315
1316 <bä> doesn't terminate </bä>
1317
1318 <boo> doesn't terminate </boo>
1319
1320 <s.foo> doesn't terminate </s.foo>
1321
1322 <sub-ID#1>
1323 !! html+tidy
1324 <p>&lt;blockquote|&gt;a
1325 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1326 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1327 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1328 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1329 </p><p>&lt;sub-ID#1&gt;
1330 </p>
1331 !! end
1332
1333 ###
1334 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1335 ### This checks that HTML5 tags (with non-word characters in the tag
1336 ### name) make it safely through the parser -- the Sanitizer will
1337 ### munge them later, as it should.
1338 ###
1339 !! test
1340 Non-word characters are valid in extension tags (T19663)
1341 !! wikitext
1342 <tåg>tåg</tåg>
1343 !! html/php
1344 <pre>
1345 'tåg'
1346 array (
1347 )
1348 </pre>
1349
1350 !! html/parsoid
1351 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1352 !! end
1353
1354 !! test
1355 Isolated close tags should be treated as literal text (T54760)
1356 !! options
1357 parsoid=wt2html
1358 !! wikitext
1359 </b>
1360
1361 <s.foo>s</s>
1362 !! html/php+tidy
1363 <p class="mw-empty-elt">
1364 </p><p>&lt;s.foo&gt;s
1365 </p>
1366 !! html/parsoid
1367 <p>&lt;s.foo&gt;s</p>
1368 !! end
1369
1370 ###
1371 ### Special characters
1372 ###
1373
1374 !! test
1375 Bare pipe character (T54363)
1376 !! wikitext
1377 |
1378 !! html
1379 <p>|
1380 </p>
1381 !! end
1382
1383 !! test
1384 Bare pipe character from a template (T54363)
1385 !! wikitext
1386 {{pipe}}
1387 !! html
1388 <p>|
1389 </p>
1390 !! end
1391
1392 ###
1393 ### <nowiki> test cases
1394 ###
1395
1396 !! test
1397 <nowiki> unordered list
1398 !! wikitext
1399 <nowiki>* This is not an unordered list item.</nowiki>
1400 !! html/php
1401 <p>* This is not an unordered list item.
1402 </p>
1403 !! html/parsoid
1404 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1405 !! end
1406
1407 !! test
1408 <nowiki> spacing
1409 !! wikitext
1410 <nowiki>Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </nowiki>
1417 !! html/php
1418 <p>Lorem ipsum dolor
1419
1420 sed abit.
1421 sed nullum.
1422
1423 :and a colon
1424
1425 </p>
1426 !! html/parsoid
1427 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1428
1429 sed abit.
1430 sed nullum.
1431
1432 :and a colon
1433 </span></p>
1434 !! end
1435
1436 !! test
1437 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1438 !! wikitext
1439 <nowiki><span class="error"></nowiki>
1440 !! html/php
1441 <p>&lt;span class="error"&gt;
1442 </p>
1443 !! html/parsoid
1444 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1445 !! end
1446
1447 !! test
1448 nowiki 3
1449 !! wikitext
1450 :There is not nowiki.
1451 :There is <nowiki>nowiki</nowiki>.
1452
1453 #There is not nowiki.
1454 #There is <nowiki>nowiki</nowiki>.
1455
1456 *There is not nowiki.
1457 *There is <nowiki>nowiki</nowiki>.
1458 !! html/php
1459 <dl><dd>There is not nowiki.</dd>
1460 <dd>There is nowiki.</dd></dl>
1461 <ol><li>There is not nowiki.</li>
1462 <li>There is nowiki.</li></ol>
1463 <ul><li>There is not nowiki.</li>
1464 <li>There is nowiki.</li></ul>
1465
1466 !! html/parsoid
1467 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1468 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1469
1470 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1471 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1472
1473 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1474 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1475 !! end
1476
1477 !! test
1478 Entities inside <nowiki>
1479 !! wikitext
1480 <nowiki>&lt;</nowiki>
1481 !! html/php
1482 <p>&lt;
1483 </p>
1484 !! html/parsoid
1485 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1486 !! end
1487
1488 !! test
1489 Entities inside template parameters
1490 !! wikitext
1491 {{echo|&ndash;}}
1492 !! html/php+tidy
1493 <p>&#8211;
1494 </p>
1495 !! html/parsoid
1496 <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>
1497 !! end
1498
1499 !! test
1500 Properly escape nowiki when combined with other wiki markup
1501 !! options
1502 parsoid=html2wt
1503 !! html/parsoid
1504 <p>* &lt;/nowiki&gt; tag</p>
1505 !! wikitext
1506 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1507 !! end
1508
1509 !! test
1510 T93824: Put escaped HTML tags inside nowiki
1511 !! options
1512 parsoid=html2wt
1513 !! html/parsoid
1514 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1515 !! wikitext
1516 <nowiki><h2>foo</h2></nowiki>
1517 !! end
1518
1519 !! test
1520 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1525 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1526 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1527 !! wikitext
1528 This text: L'[[Foo]]
1529 This text: L<nowiki>''</nowiki>[[Foo]]
1530 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1531 !! end
1532
1533 # This test fails because wikitext whitespace is not normalized before comparing.
1534 !! test
1535 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 </p>
1541 !! wikitext
1542 This text : L<nowiki>''</nowiki>[[Foo]]
1543 !! end
1544
1545 # This test and the next one are html2wt only as they test that incorrect wikitext
1546 # passed in template arguments gets escaped or wrapped in nowikis where required.
1547 !! test
1548 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1549 !! options
1550 parsoid=html2wt
1551 !! html/parsoid
1552 <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>
1553 <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>
1554 !! wikitext
1555 {{echo|foo{{!}}bar}}
1556 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1557 !! end
1558
1559 !! test
1560 T53961: Output correct nowikis in template arguments
1561 !! options
1562 parsoid=html2wt
1563 !! html/parsoid
1564 <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>
1565 <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>
1566 <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>
1567 <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>
1568 <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>
1569 !! wikitext
1570 {{echo|a [ b}}
1571 {{echo|<nowiki>a }} b</nowiki>}}
1572 {{echo|<nowiki>a [[ b</nowiki>}}
1573 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1574 {{echo|a <nowiki>}</nowiki>}}
1575 !! end
1576
1577 !! test
1578 Cases where "!!" needs nowiki protection
1579 !! options
1580 parsoid=html2wt
1581 !! html/parsoid
1582 <table>
1583 <tr><th>this needs protection !! here</th></tr>
1584 </table>
1585
1586 <table>
1587 <tr><th>this does not need
1588 protection !! here</th></tr>
1589 </table>
1590 !! wikitext
1591 {|
1592 !<nowiki>this needs protection !! here</nowiki>
1593 |}
1594
1595 {|
1596 !this does not need
1597 protection !! here
1598 |}
1599 !! end
1600
1601 ###
1602 ### Comments
1603 ###
1604 !! test
1605 Comments and Indent-Pre
1606 !! wikitext
1607 <!-- comment 1 --> asdf
1608
1609 <!-- comment 1 --> asdf
1610 <!-- comment 2 -->
1611
1612 <!-- comment 1 --> asdf
1613 <!-- comment 2 -->xyz
1614
1615 <!-- comment 1 --> asdf
1616 <!-- comment 2 --> xyz
1617 !! html
1618 <pre>asdf
1619 </pre>
1620 <pre>asdf
1621 </pre>
1622 <pre>asdf
1623 </pre>
1624 <p>xyz
1625 </p>
1626 <pre>asdf
1627 xyz
1628 </pre>
1629 !! end
1630
1631 !! test
1632 Comment test 2a
1633 !! wikitext
1634 asdf
1635 <!-- comment 1 -->
1636 jkl
1637 !! html
1638 <p>asdf
1639 jkl
1640 </p>
1641 !! end
1642
1643 !! test
1644 Comment test 2b
1645 !! wikitext
1646 asdf
1647 <!-- comment 1 -->
1648
1649 jkl
1650 !! html
1651 <p>asdf
1652 </p><p>jkl
1653 </p>
1654 !! end
1655
1656 !! test
1657 Comment test 3
1658 !! wikitext
1659 asdf
1660 <!-- comment 1 -->
1661 <!-- comment 2 -->
1662 jkl
1663 !! html
1664 <p>asdf
1665 jkl
1666 </p>
1667 !! end
1668
1669 !! test
1670 Comment test 4
1671 !! wikitext
1672 asdf<!-- comment 1 -->jkl
1673 !! html
1674 <p>asdfjkl
1675 </p>
1676 !! end
1677
1678 !! test
1679 Comment spacing
1680 !! wikitext
1681 a
1682 <!-- foo --> b <!-- bar -->
1683 c
1684 !! html
1685 <p>a
1686 </p>
1687 <pre> b
1688 </pre>
1689 <p>c
1690 </p>
1691 !! end
1692
1693 !! test
1694 Comment whitespace
1695 !! wikitext
1696 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1697 !! html
1698
1699 !! end
1700
1701 !! test
1702 Comment semantics and delimiters
1703 !! wikitext
1704 <!-- --><!----><!-----><!------>
1705 !! html/php
1706
1707 !! html/parsoid
1708 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1709 !! end
1710
1711 !! test
1712 Comment semantics and delimiters, redux
1713 !! wikitext
1714 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1715 -- foo -- funky huh? ... -->
1716 !! html/php
1717
1718 !! html/parsoid
1719 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1720 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1721 !! end
1722
1723 !! test
1724 Comment semantics and delimiters: directors cut
1725 !! wikitext
1726 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1727 everything starting with < followed by !-- until the first -- and > we see,
1728 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1729 -->-->
1730 !! html/php
1731 <p>--&gt;
1732 </p>
1733 !! html/parsoid
1734 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1735 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1736 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1737 --><p>--></p>
1738 !! end
1739
1740 !! test
1741 Comment semantics: nesting
1742 !! wikitext
1743 <!--<!-- no, we're not going to do anything fancy here -->-->
1744 !! html/php
1745 <p>--&gt;
1746 </p>
1747 !! html/parsoid
1748 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1749 !! end
1750
1751 # Parsoid closes the unclosed comment, even if it means a slight
1752 # round-trip diff.
1753 !! test
1754 Comment semantics: unclosed comment at end
1755 !! options
1756 parsoid=wt2html,html2html
1757 !! wikitext
1758 <!--This comment will run out to the end of the document
1759 !! html/php
1760
1761 !! html/parsoid
1762 <!--This comment will run out to the end of the document-->
1763 !! end
1764
1765 !! test
1766 Comment semantics: normalize comments to play nice with XML and browsers
1767 !! wikitext
1768 <!-- Browsers --!> think this is closed -->
1769 <!--> This would normally be text -->
1770 <!---> As would this -->
1771 <!-- XML doesn't like trailing dashes -------->
1772 <!-- Nor doubled hyphens -- anywhere in the data -->
1773 But this is not a comment.
1774 !! html/php
1775 <p>But this is not a comment.
1776 </p>
1777 !! html/parsoid
1778 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1779 <!--&#x3E; This would normally be text -->
1780 <!--&#x2D;&#x3E; As would this -->
1781 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1782 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1783 <p>But this is not a comment.</p>
1784 !! end
1785
1786 !! test
1787 Comment semantics: round-trip even text which contains encoded -->
1788 !! wikitext
1789 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1790 !! html/parsoid
1791 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1792 !! end
1793
1794 !! test
1795 Comment in template title
1796 !! wikitext
1797 {{f<!---->oo}}
1798 !! html
1799 <p>FOO
1800 </p>
1801 !! end
1802
1803 !! test
1804 Comment on its own line post-expand
1805 !! wikitext
1806 a
1807 {{blank}}<!---->
1808 b
1809 !! html
1810 <p>a
1811 </p><p>b
1812 </p>
1813 !! end
1814
1815 !! test
1816 Comment on its own line post-expand with non-significant whitespace
1817 !! wikitext
1818 a
1819 {{blank}} <!---->
1820 b
1821 !! html
1822 <p>a
1823 </p><p>b
1824 </p>
1825 !! end
1826
1827 !! test
1828 Multiple comments should still parse as SOL-transparent
1829 !! options
1830 parsoid=wt2html,wt2wt
1831 !! wikitext
1832 <!--c1-->*a
1833 <!--c2--><!--c3--><!--c4-->*b
1834 !! html/php
1835 <ul><li>a</li>
1836 <li>b</li></ul>
1837
1838 !! html/parsoid
1839 <!--c1--><ul>
1840 <li>a
1841 </li>
1842 <!--c2--><!--c3--><!--c4-->
1843 <li>b
1844 </li>
1845 </ul>
1846 !! end
1847
1848 ## Make sure ">" gets escaped in comments to avoid XSS
1849 !! test
1850 IE conditional comments
1851 !! wikitext
1852 <!--[if lt IE 9]>
1853 <script>alert('hi');</script>
1854 <![endif]-->
1855 !! html/parsoid
1856 <!--[if lt IE 9]&#x3E;
1857 <script&#x3E;alert('hi');</script&#x3E;
1858 <![endif]-->
1859 !! end
1860
1861 ###
1862 ### paragraph wrapping tests
1863 ###
1864
1865 !! test
1866 No block tags
1867 !! wikitext
1868 a
1869
1870 b
1871 !! html
1872 <p>a
1873 </p><p>b
1874 </p>
1875 !! end
1876
1877 !! test
1878 Block tag on one line (<div>)
1879 !! wikitext
1880 a <div>foo</div>
1881
1882 b
1883 !! html
1884 a <div>foo</div>
1885 <p>b
1886 </p>
1887 !! html+tidy
1888 <p>a </p><div>foo</div>
1889 <p>b
1890 </p>
1891 !! end
1892
1893 # Remex wraps empty tag runs with p-tags.
1894 # Parsoid strips them out during p-wrapping.
1895 !! test
1896 No p-wrappable content
1897 !! wikitext
1898 <span><div>x</div></span>
1899 <span><s><div>x</div></s></span>
1900 <small><em></em></small><span><s><div>x</div></s></span>
1901 !! html/php+tidy
1902 <span><div>x</div></span>
1903 <span><s><div>x</div></s></span>
1904 <p><small><em></em></small></p><span><s><div>x</div></s></span>
1905 !! html/parsoid
1906 <span><div>x</div></span>
1907 <span><s><div>x</div></s></span>
1908 <small><em></em></small><span><s><div>x</div></s></span>
1909 !! end
1910
1911 # T177612: Parsoid-only test
1912 !! test
1913 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
1914 !! wikitext
1915 {{echo|<span><div>x</div></span>}}
1916 x
1917 !! html/parsoid
1918 <span 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;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
1919 <p>x</p>
1920 !! end
1921
1922 !! test
1923 Block tag on one line (<blockquote>)
1924 !! wikitext
1925 a <blockquote>foo</blockquote>
1926
1927 b
1928 !! html
1929 a <blockquote>foo</blockquote>
1930 <p>b
1931 </p>
1932 !! html+tidy
1933 <p>a </p><blockquote><p>foo</p></blockquote>
1934 <p>b
1935 </p>
1936 !! end
1937
1938 !! test
1939 Block tag on both lines (<div>)
1940 !! wikitext
1941 a <div>foo</div>
1942
1943 b <div>foo</div>
1944 !! html
1945 a <div>foo</div>
1946 b <div>foo</div>
1947
1948 !! html+tidy
1949 <p>a </p><div>foo</div><p>
1950 b </p><div>foo</div>
1951 !! end
1952
1953 !! test
1954 Block tag on both lines (<blockquote>)
1955 !! wikitext
1956 a <blockquote>foo</blockquote>
1957
1958 b <blockquote>foo</blockquote>
1959 !! html
1960 a <blockquote>foo</blockquote>
1961 b <blockquote>foo</blockquote>
1962
1963 !! html+tidy
1964 <p>a </p><blockquote><p>foo</p></blockquote><p>
1965 b </p><blockquote><p>foo</p></blockquote>
1966 !! end
1967
1968 !! test
1969 Multiple lines without block tags
1970 !! wikitext
1971 <div>foo</div> a
1972 b
1973 c
1974 d<!--foo--> e
1975 x <div>foo</div> z
1976 !! html
1977 <div>foo</div> a
1978 <p>b
1979 c
1980 d e
1981 </p>
1982 x <div>foo</div> z
1983
1984 !! html+tidy
1985 <div>foo</div><p> a
1986 </p><p>b
1987 c
1988 d e
1989 </p><p>
1990 x </p><div>foo</div><p> z
1991 </p>
1992 !! end
1993
1994 # The difference between Parsoid & Remex here
1995 # is because of Parsoid's Tidy-emulation code
1996 # for p-wrapping. We'll start work to remove this
1997 # emulation code in Parsoid sooner than later.
1998 # Remex wraps empty tag runs with p-tags.
1999 # Parsoid strips them out in a separate pass.
2000 !! test
2001 Empty lines between lines with block tags
2002 !! wikitext
2003 <div></div>
2004
2005
2006 <div></div>a
2007
2008 b
2009 <div>a</div>b
2010
2011 <div>b</div>d
2012
2013
2014 <div>e</div>
2015 !! html
2016 <div></div>
2017 <p><br />
2018 </p>
2019 <div></div>a
2020 <p>b
2021 </p>
2022 <div>a</div>b
2023 <div>b</div>d
2024 <p><br />
2025 </p>
2026 <div>e</div>
2027
2028 !! html+tidy
2029 <div></div>
2030 <p><br />
2031 </p>
2032 <div></div><p>a
2033 </p><p>b
2034 </p>
2035 <div>a</div><p>b
2036 </p><div>b</div><p>d
2037 </p><p><br />
2038 </p>
2039 <div>e</div>
2040 !! html/parsoid
2041 <div data-parsoid='{"stx":"html"}'></div>
2042
2043 <p><br /></p>
2044 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2045
2046 <p>b</p>
2047 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2048
2049 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2050
2051 <p><br /></p>
2052 <div data-parsoid='{"stx":"html"}'>e</div>
2053 !! end
2054
2055 !! test
2056 Unclosed HTML p-tags should be handled properly
2057 !! wikitext
2058 <div><p>foo</div>
2059 a
2060
2061 b
2062 !! html/php+tidy
2063 <div><p>foo</p></div>
2064 <p>a
2065 </p><p>b
2066 </p>
2067 !! html/parsoid
2068 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2069 <p>a</p>
2070 <p>b</p>
2071 !! end
2072
2073 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2074 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2075 ## them for now.
2076 !! test
2077 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2078 !! options
2079 parsoid=wt2html
2080 !! wikitext
2081 a [[Category:A1]] [[Category:A2]]
2082 [[Category:A3]]
2083 [[Category:A4]]
2084 !! html/parsoid
2085 <p>a</p>
2086 <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"/>
2087 !! end
2088
2089 !! test
2090 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2091 !! options
2092 parsoid=wt2html
2093 !! wikitext
2094 [[Category:A1]]a
2095 !! html/parsoid
2096 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2097 !! end
2098
2099 !! test
2100 No paragraph necessary for SOL transparent template
2101 !! wikitext
2102 <span><div>foo</div></span>
2103 [[Category:Foo]]
2104
2105 <span><div>foo</div></span>
2106 {{echo|[[Category:Foo]]}}
2107 !! html/php
2108 <span><div>foo</div></span>
2109 <span><div>foo</div></span>
2110
2111 !! html/parsoid
2112 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2113 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2114
2115 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2116 <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]]"}},"i":0}}]}'/>
2117 !! end
2118
2119 !! test
2120 Avoid expanding multiline sol transparent template ranges unnecessarily
2121 !! wikitext
2122 hi
2123
2124
2125 {{echo|<br/>
2126 }}
2127
2128 [[Category:Ho]]
2129 !! html/php
2130 <p>hi
2131 </p><p><br />
2132 <br />
2133 </p>
2134 !! html/parsoid
2135 <p>hi</p>
2136
2137 <p><br />
2138 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2139 </span></p>
2140
2141 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2142 !! end
2143
2144 ###
2145 ### Preformatted text
2146 ###
2147
2148 !! test
2149 Preformatted text
2150 !! wikitext
2151 This is some
2152 Preformatted text
2153 With ''italic''
2154 And '''bold'''
2155 And a [[Main Page|link]]
2156 !! html
2157 <pre>This is some
2158 Preformatted text
2159 With <i>italic</i>
2160 And <b>bold</b>
2161 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2162 </pre>
2163 !! end
2164
2165 !! test
2166 Tabs don't trigger preformatted text
2167 !! wikitext
2168 This is not
2169 preformatted text.
2170 This is preformatted text.
2171 So is this.
2172 !! html/php
2173 <p> This is not
2174 preformatted text.
2175 </p>
2176 <pre>This is preformatted text.
2177 So is this.
2178 </pre>
2179 !! html/parsoid
2180 <p> This is not
2181 preformatted text.</p>
2182 <pre>This is preformatted text.
2183 So is this.</pre>
2184 !! end
2185
2186 !! test
2187 Space before tab needs nowiki pre protection
2188 !! options
2189 parsoid=html2wt
2190 !! html/parsoid
2191 <p> a</p>
2192 !! wikitext
2193 <nowiki> </nowiki> a
2194 !! end
2195
2196 !! test
2197 Ident preformatting with inline content
2198 !! wikitext
2199 a
2200 ''b''
2201 !! html
2202 <pre>a
2203 <i>b</i>
2204 </pre>
2205 !! end
2206
2207 !! test
2208 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2209 !! wikitext
2210 <pre><nowiki>
2211 <b>
2212 <cite>
2213 <em>
2214 </nowiki></pre>
2215 !! html
2216 <pre>
2217 &lt;b&gt;
2218 &lt;cite&gt;
2219 &lt;em&gt;
2220 </pre>
2221
2222 !! end
2223
2224 !! test
2225 Regression with preformatted in <center>
2226 !! wikitext
2227 <center>
2228 Blah
2229 </center>
2230 !! html
2231 <center>
2232 <pre>Blah
2233 </pre>
2234 </center>
2235
2236 !! end
2237
2238 !! test
2239 T54763: Preformatted in <blockquote>
2240 !! wikitext
2241 <blockquote>
2242 Blah
2243 {|
2244 |
2245 indented cell (no pre-wrapping!)
2246 |}
2247 </blockquote>
2248 !! html
2249 <blockquote>
2250 <p> Blah
2251 </p>
2252 <table>
2253 <tr>
2254 <td>
2255 <p> indented cell (no pre-wrapping!)
2256 </p>
2257 </td></tr></table>
2258 </blockquote>
2259
2260 !! end
2261
2262 !! test
2263 T53086: Double newlines in blockquotes should be turned into paragraphs
2264 !! wikitext
2265 <blockquote>
2266 Foo
2267
2268 Bar
2269 </blockquote>
2270 !! html
2271 <blockquote>
2272 <p>Foo
2273 </p><p>Bar
2274 </p>
2275 </blockquote>
2276
2277 !! end
2278
2279 !! test
2280 T17491: <ins>/<del> in blockquote
2281 !! wikitext
2282 <blockquote>
2283 Foo <del>bar</del> <ins>baz</ins> quux
2284 </blockquote>
2285 !! html
2286 <blockquote>
2287 <p>Foo <del>bar</del> <ins>baz</ins> quux
2288 </p>
2289 </blockquote>
2290
2291 !! end
2292
2293 !! test
2294 T17491: <ins>/<del> in blockquote (2)
2295 !! wikitext
2296 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2297 </blockquote>
2298 !! html
2299 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2300 </blockquote>
2301
2302 !! html+tidy
2303 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2304 </p></blockquote>
2305 !! end
2306
2307 !! test
2308 <pre> with attributes (T5202)
2309 !! wikitext
2310 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2311 !! html
2312 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2313
2314 !! end
2315
2316 !! test
2317 <pre> with width attribute (T5202)
2318 !! wikitext
2319 <pre width="8">Narrow screen goodies</pre>
2320 !! html
2321 <pre width="8">Narrow screen goodies</pre>
2322
2323 !! end
2324
2325 !! test
2326 <pre> with forbidden attribute (T5202)
2327 !! wikitext
2328 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2329 !! html
2330 <pre width="8">Narrow screen goodies</pre>
2331
2332 !! end
2333
2334 !! test
2335 Entities inside <pre>
2336 !! wikitext
2337 <pre>&lt;</pre>
2338 !! html
2339 <pre>&lt;</pre>
2340
2341 !! end
2342
2343 !! test
2344 <pre> with forbidden attribute values (T5202)
2345 !! wikitext
2346 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2347 !! html
2348 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2349
2350 !! end
2351
2352 !! test
2353 <nowiki> inside <pre> (T15238)
2354 !! wikitext
2355 <pre>
2356 <nowiki>
2357 </pre>
2358 <pre>
2359 <nowiki></nowiki>
2360 </pre>
2361 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2362 !! html
2363 <pre>
2364 &lt;nowiki&gt;
2365 </pre>
2366 <pre>
2367
2368 </pre>
2369 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2370
2371 !! end
2372
2373 !! test
2374 <nowiki> inside of #tag:pre
2375 !! wikitext
2376 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2377 !! html/php
2378 <pre>Foo &#8594;bar</pre>
2379
2380 !! html/parsoid
2381 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2382 !! end
2383
2384 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2385 ## aren't enclosed in nowikis.
2386 !! test
2387 <nowiki> and <pre> preference (first one wins)
2388 !! options
2389 parsoid=wt2html
2390 !! wikitext
2391 <pre>
2392 <nowiki>
2393 </pre>
2394 </nowiki>
2395 </pre>
2396
2397 <nowiki>
2398 <pre>
2399 <nowiki>
2400 </pre>
2401 </nowiki>
2402 </pre>
2403
2404 !! html/php
2405 <pre>
2406 &lt;nowiki&gt;
2407 </pre>
2408 <p>&lt;/nowiki&gt;
2409 &lt;/pre&gt;
2410 </p><p>
2411 &lt;pre&gt;
2412 &lt;nowiki&gt;
2413 &lt;/pre&gt;
2414
2415 &lt;/pre&gt;
2416 </p>
2417 !! html/parsoid
2418 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2419 </pre>
2420 <p>&lt;/nowiki></p>
2421
2422
2423 <p><span typeof="mw:Nowiki">
2424 &lt;pre>
2425 &lt;nowiki>
2426 &lt;/pre>
2427 </span></p>
2428 !! end
2429
2430 !! test
2431 </pre> inside nowiki
2432 !! wikitext
2433 <nowiki></pre></nowiki>
2434 !! html
2435 <p>&lt;/pre&gt;
2436 </p>
2437 !! end
2438
2439 !! test
2440 Empty pre; pre inside other HTML tags (T56946)
2441 !! wikitext
2442 a
2443
2444 <div><pre>
2445 foo
2446 </pre></div>
2447 <pre></pre>
2448 !! html/php+tidy
2449 <p>a
2450 </p>
2451 <div><pre>foo
2452 </pre></div>
2453 <pre></pre>
2454 !! html/parsoid
2455 <p>a</p>
2456
2457 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2458 </pre></div>
2459 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2460 !! end
2461
2462 !! test
2463 HTML pre followed by indent-pre
2464 !! wikitext
2465 <pre>foo</pre>
2466 bar
2467 !! html
2468 <pre>foo</pre>
2469 <pre>bar
2470 </pre>
2471 !! end
2472
2473 !! test
2474 Block tag pre
2475 !! wikitext
2476 <p><pre>foo</pre></p>
2477 !! html/php+tidy
2478 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2479 !! html/parsoid
2480 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2481 !! end
2482
2483 !!test
2484 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2485 !! wikitext
2486 {{echo|}}
2487 !! html
2488
2489 !!end
2490
2491 !!test
2492 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2493 !! wikitext
2494 {{echo|
2495 foo}}
2496 !! html
2497 <p>foo
2498 </p>
2499 !!end
2500
2501 !! test
2502 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2503 !! wikitext
2504 {{echo|a
2505 b}}
2506 !! html
2507 <pre>a
2508 </pre>
2509 <p>b
2510 </p>
2511 !!end
2512
2513 !! test
2514 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2515 !! wikitext
2516 {{echo|a
2517 b
2518 c
2519 d
2520 e
2521 }}
2522 !! html
2523 <pre>a
2524 </pre>
2525 <p>b
2526 c
2527 </p>
2528 <pre>d
2529 </pre>
2530 <p>e
2531 </p>
2532 !!end
2533
2534 !!test
2535 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2536 !! wikitext
2537 {{echo| foo}}
2538
2539 {{echo| foo}}{{echo| bar}}
2540
2541 {{echo| foo}}
2542 {{echo| bar}}
2543
2544 {{echo|<!--cmt--> foo}}
2545
2546 <!--cmt-->{{echo| foo}}
2547
2548 {{echo|{{echo| }}bar}}
2549 !! html
2550 <pre>foo
2551 </pre>
2552 <pre>foo bar
2553 </pre>
2554 <pre>foo
2555 bar
2556 </pre>
2557 <pre>foo
2558 </pre>
2559 <pre>foo
2560 </pre>
2561 <pre>bar
2562 </pre>
2563 !!end
2564
2565 !! test
2566 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2567 !! wikitext
2568 {{echo| }}a
2569
2570 {{echo|
2571 }}a
2572
2573 {{echo|
2574 b}}
2575
2576 {{echo|a
2577 }}b
2578
2579 {{echo|a
2580 }} b
2581 !! html
2582 <pre>a
2583 </pre>
2584 <p><br />
2585 </p>
2586 <pre>a
2587 </pre>
2588 <p><br />
2589 </p>
2590 <pre>b
2591 </pre>
2592 <p>a
2593 </p>
2594 <pre>b
2595 </pre>
2596 <p>a
2597 </p>
2598 <pre>b
2599 </pre>
2600 !!end
2601
2602 ## Hmm, should Parsoid rt this?
2603 !! test
2604 Pres with newline attributes
2605 !! options
2606 parsoid=wt2html,html2html
2607 !! wikitext
2608 <pre class="one
2609 two">hi</pre>
2610 !! html/php
2611 <pre class="one two">hi</pre>
2612
2613 !! html/parsoid
2614 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2615 !! end
2616
2617 !! test
2618 Things that look like <pre> tags aren't treated as such
2619 !! wikitext
2620 Barack Obama <President> of the United States
2621 <President></President>
2622 !! html
2623 <p>Barack Obama &lt;President&gt; of the United States
2624 &lt;President&gt;&lt;/President&gt;
2625 </p>
2626 !! end
2627
2628 !! test
2629 Handle broken pre-like tags (T66025)
2630 !! options
2631 parsoid=wt2html
2632 !! wikitext
2633 {{echo|<pre <pre>x</pre>}}
2634
2635 <table><pre </table>
2636 !! html/php
2637 <pre>x</pre>
2638 <table>&lt;pre </table>
2639
2640 !! html/php+tidy
2641 <pre>x</pre>
2642 &lt;pre <table></table>
2643 !! html/parsoid
2644 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" 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>
2645
2646
2647 <p>&lt;pre </p>
2648
2649 <table></table>
2650 !! end
2651
2652 !! test
2653 Parsoid: handle pre with space after attribute
2654 !! options
2655 parsoid=wt2html
2656 !! wikitext
2657 <pre style="width:50%;" >{{echo|foo}}</pre>
2658 !! html/php
2659 <pre style="width:50%;">{{echo|foo}}</pre>
2660
2661 !! html/parsoid
2662 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2663 !! end
2664
2665 # TODO / maybe: fix wt2wt for this
2666 !! test
2667 Parsoid: Don't paragraph-wrap fosterable content
2668 !! options
2669 parsoid=wt2html
2670 !! wikitext
2671 {|
2672 <td></td>
2673 <td></td>
2674
2675
2676
2677 |}
2678 !! html
2679 <table>
2680
2681 <tbody>
2682 <tr>
2683 <td></td>
2684
2685 <td></td></tr>
2686
2687
2688
2689 </tbody></table>
2690 !! end
2691
2692 !! test
2693 Self-closed pre
2694 !! wikitext
2695 <pre />
2696 !! html/php
2697 <pre></pre>
2698
2699 !! html/parsoid
2700 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2701 !! end
2702
2703 !! test
2704 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2705 !! options
2706 parsoid=wt2html
2707 !! wikitext
2708 {|
2709 <td>
2710 <td>
2711 </td>
2712
2713
2714
2715 |}
2716 !! html
2717 <table>
2718
2719 <tbody>
2720 <tr>
2721 <td></td>
2722
2723 <td>
2724 </td></tr>
2725
2726
2727
2728 </tbody></table>
2729 !! end
2730
2731
2732 #--------------------------------------------------------------------
2733 # Transclusion parameter whitespace stripping tests
2734 # Behavior is different for positional and named parameters
2735 #--------------------------------------------------------------------
2736 !! test
2737 Templates: Strip leading and trailing whitespace from named-param values
2738 !! wikitext
2739 {{echo|1= a }}
2740
2741 {{echo|1= {{echo|b}} }}
2742
2743 {{echo| 1 =
2744 c }}
2745
2746 {{echo| 1 =
2747 * d
2748 }}
2749 !! html
2750 <p>a
2751 </p><p>b
2752 </p><p>c
2753 </p>
2754 <ul><li>d</li></ul>
2755
2756 !! end
2757
2758 !! test
2759 Templates: Don't strip whitespace from positional-param values
2760 !! wikitext
2761 {{echo|a }}
2762
2763 {{echo|{{echo|b}} }}
2764
2765 {{echo| c
2766 }}
2767
2768 {{echo| {{echo|d}}
2769 }}
2770
2771 {{echo|
2772 e}}
2773
2774 {{echo|
2775 *f}}
2776
2777 {{echo|
2778 }}g
2779 !! html
2780 <p>a
2781 </p><p>b
2782 </p>
2783 <pre>c
2784 </pre>
2785 <p><br />
2786 </p>
2787 <pre>d
2788 </pre>
2789 <p><br />
2790 </p>
2791 <pre>e
2792 </pre>
2793 <p><br />
2794 </p>
2795 <ul><li>f</li></ul>
2796 <p><br />
2797 </p>
2798 <pre>g
2799 </pre>
2800 !! end
2801
2802 !! test
2803 Templates: Don't recognize targets split by newlines
2804 !! options
2805 parsoid=wt2html
2806 !! wikitext
2807 {{ech
2808 o|foo}}
2809 !! html/php
2810 <p>{{ech
2811 o|foo}}
2812 </p>
2813 !! html/parsoid
2814 <p>{{ech
2815 o|foo}}</p>
2816 !! end
2817
2818 !! test
2819 Templates: Recognize targets when newlines and comments don't split the target
2820 !! options
2821 parsoid=wt2html
2822 !! wikitext
2823 {{
2824 <!--X--> ech<!--X-->o<!--X-->
2825 <!--X--> <!--X-->
2826
2827 |foo}}
2828 !! html/php
2829 <p>foo
2830 </p>
2831 !! html/parsoid
2832 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2833 !! end
2834
2835 !! test
2836 Templates: Handle empty comment-and-ws-only lines correctly
2837 !! wikitext
2838 {{echo|foo
2839 <!--should be ignored-->
2840 <!--should be ignored as well-->
2841 bar}}
2842 !! html/php
2843 <p>foo
2844 bar
2845 </p>
2846 !! html/parsoid
2847 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2848 !! end
2849
2850 !! test
2851 Templates: Handle comments in the target
2852 !! wikitext
2853 {{echo
2854 <!-- should be ignored -->
2855 |foo}}
2856
2857 {{echo
2858 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2859 |foo}}
2860
2861 {{echo<!-- should be ignored -->
2862 |foo}}
2863
2864 {{echo<!-- should be ignored -->|foo}}
2865
2866 {{<!-- should be ignored -->echo|foo}}
2867 !! html/php
2868 <p>foo
2869 </p><p>foo
2870 </p><p>foo
2871 </p><p>foo
2872 </p><p>foo
2873 </p>
2874 !! html/parsoid
2875 <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>
2876
2877 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2878
2879 <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>
2880
2881 <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>
2882
2883 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2884 !! end
2885
2886 !! test
2887 Templates: Handle comments in parameter names (T69657)
2888 !! wikitext
2889 {{echo|1
2890 <!-- should be ignored -->
2891 =foo}}
2892
2893 {{echo|
2894 <!-- should be ignored -->
2895 1 = foo}}
2896
2897 {{echo|1<!-- should be ignored -->=foo}}
2898
2899 {{echo|<!-- should be ignored -->1=foo}}
2900 !! html/php
2901 <p>foo
2902 </p><p>foo
2903 </p><p>foo
2904 </p><p>foo
2905 </p>
2906 !! html/parsoid
2907 <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>
2908
2909 <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>
2910
2911 <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>
2912
2913 <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>
2914 !! end
2915
2916 !! test
2917 Templates: Other wikitext in parameter names (T69657)
2918 !! wikitext
2919 {{echo|''1''=foo}}
2920 !! html/php
2921 <p>{{{1}}}
2922 </p>
2923 !! html/parsoid
2924 <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>
2925 !! end
2926
2927 !! test
2928 Templates: With colons
2929 !! wikitext
2930 {{With: Colon}}
2931 !! html/php
2932 <p>Template with colon
2933 </p>
2934 !! html/parsoid
2935 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
2936 !! end
2937
2938 #--------------------------------------------------------------------
2939 # Transclusion parameter escaping tests
2940 #--------------------------------------------------------------------
2941
2942 !! test
2943 Templates: Parsoid parameter escaping test 1
2944 !! wikitext
2945 {{echo|[foo]|{{echo|[bar]}}}}
2946 !! html/php+tidy
2947 <p>[foo]
2948 </p>
2949 !! html/parsoid
2950 <p about="#mwt1" typeof="mw:Transclusion"
2951 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2952 !! end
2953
2954 !! test
2955 Parsoid: Pipes in external links in template parameter
2956 !! wikitext
2957 {{echo|[{{echo|http://example.com}} link]}}
2958 !! html/php+tidy
2959 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
2960 </p>
2961 !! html/parsoid
2962 <p><a rel="mw:ExtLink" class="external text" 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>
2963 !! end
2964
2965 !! test
2966 Parsoid: pipe in transclusion parameter
2967 !! wikitext
2968 {{echo|http://foo.com/a&#124;b}}
2969 !! html/php+tidy
2970 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
2971 </p>
2972 !! html/parsoid
2973 <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" 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%7Cb</a></p>
2974 !! end
2975
2976 !! test
2977 Parsoid: Pipe in external link target and content in template parameter
2978 !! options
2979 parsoid=html2wt,wt2wt
2980 !! wikitext
2981 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2982 !! html/php+tidy
2983 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
2984 </p>
2985 !! html/parsoid
2986 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2987 typeof="mw:Transclusion"
2988 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2989 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2990 !! end
2991
2992 !! test
2993 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2994 !! options
2995 parsoid
2996 !! wikitext
2997 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2998 !! html
2999 <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>
3000 !! end
3001
3002 !! test
3003 Templates: Don't escape already nowiki-escaped text in template parameters
3004 !! options
3005 parsoid=html2wt,wt2wt
3006 !! wikitext
3007 {{echo|foo<nowiki>|</nowiki>bar}}
3008 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3009 {{echo|<nowiki></nowiki>}}
3010 !! html/php+tidy
3011 <p>foo|bar
3012 &lt;div&gt;
3013
3014 </p>
3015 !! html/parsoid
3016 <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>
3017 <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>
3018 <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>
3019 </p>
3020 !! end
3021
3022 ## T54824
3023 !! test
3024 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3025 !! options
3026 parsoid=html2wt,wt2wt
3027 !! wikitext
3028 {{echo|{{echo|1=bar}}}}
3029 !! html/php+tidy
3030 <p>bar
3031 </p>
3032 !! html/parsoid
3033 <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>
3034 !! end
3035
3036 ## T58733
3037 !! test
3038 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3039 !! wikitext
3040 {{echo|a : b}}
3041 !! html/php+tidy
3042 <p>a&#160;: b
3043 </p>
3044 !! html/parsoid
3045 <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>
3046 !! end
3047
3048 ## T73412
3049 !! test
3050 Templates: Preserve blank parameter names
3051 !! wikitext
3052 {{echo|=foo}}
3053 !! html/php+tidy
3054 <p>{{{1}}}
3055 </p>
3056 !! html/parsoid
3057 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3058 !! end
3059
3060 !! test
3061 Templates: Preserve blank parameter names in other positions
3062 !! wikitext
3063 {{blank_param|bar|=foo}}
3064 !! html/php+tidy
3065 <p>bar
3066 foo
3067 </p>
3068 !! html/parsoid
3069 <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
3070 foo</p>
3071 !! end
3072
3073 ###
3074 ### Parsoid-centric tests for testing RT edge cases for pre
3075 ###
3076
3077 !!test
3078 1a. Indent-Pre and Comments
3079 !! wikitext
3080 a
3081 <!--a-->
3082 c
3083 !! html
3084 <pre>a
3085 </pre>
3086 <p>c
3087 </p>
3088 !!end
3089
3090 !!test
3091 1b. Indent-Pre and Comments
3092 !! wikitext
3093 a
3094 <!--a-->
3095 c
3096 !! html
3097 <pre>a
3098 </pre>
3099 <p>c
3100 </p>
3101 !!end
3102
3103 !!test
3104 1c. Indent-Pre and Comments
3105 !! wikitext
3106 <!--a--> a
3107
3108 <!--a--> a
3109 !! html
3110 <pre> a
3111 </pre>
3112 <pre> a
3113 </pre>
3114 !!end
3115
3116 !!test
3117 1d. Indent-Pre and Comments
3118 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3119 !! wikitext
3120 <!--a--> a
3121
3122 <!--b-->b
3123 !! html
3124 <pre>a
3125 </pre>
3126 <pre>b
3127 </pre>
3128 !!end
3129
3130 !!test
3131 2a. Indent-Pre and tables
3132 !! wikitext
3133 {|
3134 |-
3135 !h1!!h2
3136 |foo||bar
3137 |}
3138 !! html
3139 <table>
3140
3141 <tr>
3142 <th>h1</th>
3143 <th>h2
3144 </th>
3145 <td>foo</td>
3146 <td>bar
3147 </td></tr></table>
3148
3149 !!end
3150
3151 !!test
3152 2b. Indent-Pre and tables
3153 !! wikitext
3154 {|
3155 |-
3156 |foo
3157 |}
3158 !! html
3159 <table>
3160
3161 <tr>
3162 <td>foo
3163 </td></tr></table>
3164
3165 !!end
3166
3167 !!test
3168 2c. Indent-Pre and tables (T44252)
3169 !! wikitext
3170 {|
3171 |+foo
3172 ! |bar
3173 |}
3174 !! html
3175 <table>
3176 <caption>foo
3177 </caption>
3178 <tr>
3179 <th>bar
3180 </th></tr></table>
3181
3182 !!end
3183
3184 !!test
3185 2d. Indent-Pre and tables
3186 !! wikitext
3187 a
3188 {|
3189 |b
3190 |}
3191 !! html/php
3192 <pre>a
3193 </pre>
3194 <table>
3195 <tr>
3196 <td>b
3197 </td></tr></table>
3198
3199 !! html/parsoid
3200 <pre>a</pre>
3201 <table>
3202 <tbody><tr><td> b</td></tr>
3203 </tbody></table>
3204 !!end
3205
3206 !!test
3207 2e. Indent-Pre and table-line syntax
3208 !! wikitext
3209 a
3210 | b
3211 | c
3212 !! html/php
3213 <pre>a
3214 | b
3215 | c
3216 </pre>
3217 !!end
3218
3219 !!test
3220 2f. Indent-pre started by table-line syntax
3221 !! wikitext
3222 a
3223 | b
3224 | c
3225 !! html/php
3226 <p>a
3227 </p>
3228 <pre>| b
3229 | c
3230 </pre>
3231 !! html/parsoid
3232 <p>a</p>
3233 <pre>
3234 | b
3235 | c</pre>
3236 !!end
3237
3238 !! test
3239 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3240 !! wikitext
3241 <table>
3242 <tr>
3243 <td>
3244 Text that should be rendered preformatted
3245 </td>
3246 </tr>
3247 </table>
3248 !! html
3249 <table>
3250 <tr>
3251 <td>
3252 <pre>Text that should be rendered preformatted
3253 </pre>
3254 </td>
3255 </tr>
3256 </table>
3257
3258 !! end
3259
3260 !!test
3261 3a. Indent-Pre and block tags (single-line html)
3262 !! wikitext
3263 a <p> foo </p>
3264 b <div> foo </div>
3265 c <blockquote> foo </blockquote>
3266 <span> foo </span>
3267 !! html
3268 a <p> foo </p>
3269 b <div> foo </div>
3270 c <blockquote> foo </blockquote>
3271 <pre><span> foo </span>
3272 </pre>
3273 !! html/parsoid
3274 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3275 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3276 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3277 <pre><span> foo </span>
3278 </pre>
3279 !! html/php+tidy
3280 <p> a </p><p> foo </p><p>
3281 b </p><div> foo </div><p>
3282 c </p><blockquote><p> foo </p></blockquote>
3283 <pre><span> foo </span>
3284 </pre>
3285 !! end
3286
3287 !!test
3288 3b. Indent-Pre and block tags (multi-line html)
3289 !! wikitext
3290 a <span>foo</span>
3291 b <div> foo </div>
3292 !! html
3293 <pre>a <span>foo</span>
3294 </pre>
3295 b <div> foo </div>
3296
3297 !! html/parsoid
3298 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3299 b <div data-parsoid='{"stx":"html"}'> foo </div>
3300 !! html/php+tidy
3301 <pre>a <span>foo</span>
3302 </pre><p>
3303 b </p><div> foo </div>
3304 !!end
3305
3306 !!test
3307 3c. Indent-Pre and block tags (pre-content on separate line)
3308 !! wikitext
3309 <p>
3310 foo
3311 </p>
3312
3313 <div>
3314 foo
3315 </div>
3316
3317 <center>
3318 foo
3319 </center>
3320
3321 <blockquote>
3322 foo
3323 </blockquote>
3324
3325 <blockquote>
3326 <pre>
3327 foo
3328 </pre>
3329 </blockquote>
3330
3331 <table><tr><td>
3332 foo
3333 </td></tr></table>
3334
3335 <ul><li>
3336 foo
3337 </li></ul>
3338
3339 !! html
3340 <p>
3341 foo
3342 </p>
3343 <div>
3344 <pre>foo
3345 </pre>
3346 </div>
3347 <center>
3348 <pre>foo
3349 </pre>
3350 </center>
3351 <blockquote>
3352 <p> foo
3353 </p>
3354 </blockquote>
3355 <blockquote>
3356 <pre>
3357 foo
3358 </pre>
3359 </blockquote>
3360 <table><tr><td>
3361 <pre>foo
3362 </pre>
3363 </td></tr></table>
3364 <ul><li>
3365 foo
3366 </li></ul>
3367
3368 !!end
3369
3370 !! test
3371 4. Indent-Pre and extension tags
3372 !! wikitext
3373 a <tag />
3374 !! html/php
3375 a <pre>
3376 NULL
3377 array (
3378 )
3379 </pre>
3380
3381 !! html/parsoid
3382 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3383 !! end
3384
3385 !! test
3386 5. Indent-Pre and html pre
3387 !! wikitext
3388 <pre class="123">hi</pre>
3389 !! html/php
3390 <pre class="123">hi</pre>
3391
3392 !! html/parsoid
3393 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3394 !! end
3395
3396 !!test
3397 Render paragraphs when indent-pre is suppressed in blocklevels
3398 !! wikitext
3399 <blockquote>
3400 foo
3401
3402 bar
3403 </blockquote>
3404 !! html
3405 <blockquote>
3406 <p> foo
3407 </p><p> bar
3408 </p>
3409 </blockquote>
3410
3411 !!end
3412
3413 !!test
3414 4. Multiple spaces at start-of-line
3415 !! wikitext
3416 <p> foo </p>
3417 foo
3418 {|
3419 |foo
3420 |}
3421 !! html
3422 <p> foo </p>
3423 <pre> foo
3424 </pre>
3425 <table>
3426 <tr>
3427 <td>foo
3428 </td></tr></table>
3429
3430 !!end
3431
3432 ## NOTE: the leading white-space chars on empty line are significant
3433 !! test
3434 5a. White-space in indent-pre
3435 !! wikitext
3436 a<br />
3437
3438 b
3439 !! html
3440 <pre>a<br />
3441
3442 b
3443 </pre>
3444 !! end
3445
3446 ## NOTE: the leading white-space chars on empty line are significant
3447 !! test
3448 5b. White-space in indent-pre
3449 !! wikitext
3450 a
3451
3452 b
3453
3454
3455 c
3456 !! html
3457 <pre>a
3458
3459 b
3460
3461
3462 c
3463 </pre>
3464 !! end
3465
3466 !! test
3467 5c. White-space in indent-pre
3468 !! wikitext
3469 ''a''
3470 ''b''
3471 ''c''
3472 !! html
3473 <pre><i>a</i>
3474 <i>b</i>
3475 <i>c</i>
3476 </pre>
3477 !! end
3478
3479 !! test
3480 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3481 !! wikitext
3482 a
3483
3484 <!-- continue -->
3485 b
3486
3487 c
3488
3489 d
3490 !! html
3491 <pre>a
3492
3493 b
3494 </pre>
3495 <pre>c
3496
3497 </pre>
3498 <p>d
3499 </p>
3500 !! end
3501
3502 !! test
3503 7a. Indent-pre and category links
3504 !! options
3505 parsoid=wt2html,wt2wt
3506 !! wikitext
3507 [[Category:foo]] <!-- No pre-wrapping -->
3508 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3509 !! html/php+tidy
3510 !! html/parsoid
3511 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3512 <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 -->
3513 !! end
3514
3515 ## We used to, but no longer wt2wt this test since the default serializer
3516 ## will normalize all categories to serialize on their own line.
3517 ## This wikitext usage is going to be fairly uncommon in production and
3518 ## selser will take care of preserving formatting in those scenarios.
3519 !! test
3520 7b. Indent-pre and category links
3521 !! options
3522 parsoid=wt2html
3523 !! wikitext
3524 [[Category:foo]] a
3525 [[Category:foo]] {{echo|b}}
3526 !! html/parsoid
3527 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3528 <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>
3529 !! end
3530
3531 !! test
3532 Indent-Pre: Newlines in comments shouldn't affect sol state
3533 !! wikitext
3534 a <!--
3535 foo
3536 --> b
3537 !! html/php+tidy
3538 <p>a b
3539 </p>
3540 !! html/parsoid
3541 <p>a <!--
3542 foo
3543 --> b</p>
3544 !! end
3545
3546 ###
3547 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3548 ###
3549
3550 !!test
3551 HTML-pre: 1. embedded newlines
3552 !! wikitext
3553 <pre>foo</pre>
3554
3555 <pre>
3556 foo
3557 </pre>
3558
3559 <pre>
3560
3561 foo
3562 </pre>
3563
3564 <pre>
3565
3566
3567 foo
3568 </pre>
3569 !! html/php+tidy
3570 <pre>foo</pre>
3571 <pre>foo
3572 </pre>
3573 <pre>
3574
3575 foo
3576 </pre>
3577 <pre>
3578
3579
3580 foo
3581 </pre>
3582 !! html/parsoid
3583 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3584
3585 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3586 </pre>
3587
3588 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3589
3590 foo
3591 </pre>
3592
3593 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3594
3595
3596 foo
3597 </pre>
3598 !!end
3599
3600 !! test
3601 HTML-pre: big spaces
3602 !! wikitext
3603 <pre>
3604
3605
3606
3607
3608 haha
3609
3610
3611
3612
3613 haha
3614
3615
3616
3617
3618 </pre>
3619 !! html/php+tidy
3620 <pre>
3621
3622
3623
3624
3625 haha
3626
3627
3628
3629
3630 haha
3631
3632
3633
3634
3635 </pre>
3636 !! html/parsoid
3637 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3638
3639
3640
3641
3642 haha
3643
3644
3645
3646
3647 haha
3648
3649
3650
3651
3652 </pre>
3653 !! end
3654
3655 !!test
3656 HTML-pre: 2: indented text
3657 !! wikitext
3658 <pre>
3659 foo
3660 </pre>
3661 !! html
3662 <pre>
3663 foo
3664 </pre>
3665
3666 !!end
3667
3668 !!test
3669 HTML-pre: 3: other wikitext
3670 !! wikitext
3671 <pre>
3672 * foo
3673 # bar
3674 = no-h =
3675 '' no-italic ''
3676 [[ NoLink ]]
3677 </pre>
3678 !! html/php
3679 <pre>
3680 * foo
3681 # bar
3682 = no-h =
3683 '' no-italic ''
3684 [[ NoLink ]]
3685 </pre>
3686
3687 !! html/parsoid
3688 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3689 # bar
3690 = no-h =
3691 '' no-italic ''
3692 [[ NoLink ]]
3693 </pre>
3694 !!end
3695
3696 ###
3697 ### Definition lists
3698 ###
3699 !! test
3700 Simple definition
3701 !! wikitext
3702 ;name :Definition
3703 !! html
3704 <dl><dt>name&#160;</dt>
3705 <dd>Definition</dd></dl>
3706
3707 !! end
3708
3709 !! test
3710 Definition list for indentation only
3711 !! wikitext
3712 :Indented text
3713 !! html
3714 <dl><dd>Indented text</dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition list with no space
3720 !! wikitext
3721 ;name:Definition
3722 !! html
3723 <dl><dt>name</dt>
3724 <dd>Definition</dd></dl>
3725
3726 !!end
3727
3728 !! test
3729 Definition list with URL link
3730 !! wikitext
3731 ;http://example.com/ :definition
3732 !! html
3733 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3734 <dd>definition</dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition list with bracketed URL link
3740 !! wikitext
3741 ;[http://www.example.com/ Example]:Something about it
3742 !! html
3743 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3744 <dd>Something about it</dd></dl>
3745
3746 !! end
3747
3748 !! test
3749 Definition list with wikilink containing colon
3750 !! wikitext
3751 ; [[Help:FAQ]]:The least-read page on Wikipedia
3752 !! html
3753 <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>
3754 <dd>The least-read page on Wikipedia</dd></dl>
3755
3756 !! end
3757
3758 # At Brion's and JeLuF's insistence... :)
3759 !! test
3760 Definition list with news link containing colon
3761 !! wikitext
3762 ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
3763 !! html/php
3764 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3765 <dd>This isn't even a real newsgroup!</dd></dl>
3766
3767 !! html/parsoid
3768 <dl><dt> <a rel="mw:ExtLink" class="external free" 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>
3769 !! end
3770
3771 !! test
3772 Malformed definition list with colon
3773 !! wikitext
3774 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3775 !! html
3776 <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>
3777
3778 !! end
3779
3780 !! test
3781 Definition lists: colon in external link text
3782 !! wikitext
3783 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
3784 !! html
3785 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
3786 <dd>OK, I made that up</dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition lists: colon in HTML attribute
3792 !! wikitext
3793 ;<b style="display: inline">bold</b>
3794 !! html
3795 <dl><dt><b style="display: inline">bold</b></dt></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition lists: self-closed tag
3801 !! wikitext
3802 ;one<br/>two :two-line fun
3803 !! html
3804 <dl><dt>one<br />two&#160;</dt>
3805 <dd>two-line fun</dd></dl>
3806
3807 !! end
3808
3809 !! test
3810 Definition lists: ignore colons inside tags
3811 !! wikitext
3812 ;one <b>two : tag <i>fun:</i>:</b>:def
3813 !! html
3814 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3815 <dd>def</dd></dl>
3816
3817 !! end
3818
3819 !! test
3820 Definition lists: excess closed tags
3821 !! wikitext
3822 ;one</b>two :bad tag fun
3823 !! html/php+tidy
3824 <dl><dt>onetwo&#160;</dt>
3825 <dd>bad tag fun</dd></dl>
3826 !! html/parsoid
3827 <dl>
3828 <dt>onetwo</dt>
3829 <dd>bad tag fun</dd>
3830 </dl>
3831 !! end
3832
3833 !! test
3834 T13748: Literal closing tags
3835 !! wikitext
3836 <dl>
3837 <dt>test 1</dt>
3838 <dd>test test test test test</dd>
3839 <dt>test 2</dt>
3840 <dd>test test test test test</dd>
3841 </dl>
3842 !! html
3843 <dl>
3844 <dt>test 1</dt>
3845 <dd>test test test test test</dd>
3846 <dt>test 2</dt>
3847 <dd>test test test test test</dd>
3848 </dl>
3849
3850 !! end
3851
3852 !! test
3853 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3854 !! wikitext
3855 <ul><li>
3856 ;term :description
3857 *unordered
3858 </li></ul>
3859 !! html
3860 <ul><li>
3861 <dl><dt>term&#160;</dt>
3862 <dd>description</dd></dl>
3863 <ul><li>unordered</li></ul>
3864 </li></ul>
3865
3866 !! end
3867
3868 !! test
3869 Definition list with empty definition and following paragraph
3870 !! wikitext
3871 ;term:
3872 Paragraph text
3873 !! html
3874 <dl><dt>term</dt>
3875 <dd></dd></dl>
3876 <p>Paragraph text
3877 </p>
3878 !! end
3879
3880 !! test
3881 Nested definition lists using html syntax
3882 !! wikitext
3883 <dl><dt>x</dt>
3884 <dd>a</dd>
3885 <dd>b</dd></dl>
3886 !! html
3887 <dl><dt>x</dt>
3888 <dd>a</dd>
3889 <dd>b</dd></dl>
3890
3891 !! end
3892
3893 !! test
3894 Definition Lists: No nesting: Multiple dd's
3895 !! wikitext
3896 ;x
3897 :a
3898 :b
3899 !! html
3900 <dl><dt>x</dt>
3901 <dd>a</dd>
3902 <dd>b</dd></dl>
3903
3904 !! end
3905
3906 !! test
3907 Definition Lists: Indentation: Regular
3908 !! wikitext
3909 :i1
3910 ::i2
3911 :::i3
3912 !! html
3913 <dl><dd>i1
3914 <dl><dd>i2
3915 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3916
3917 !! end
3918
3919 !! test
3920 Definition Lists: Indentation: Missing 1st level
3921 !! wikitext
3922 ::i2
3923 :::i3
3924 !! html
3925 <dl><dd><dl><dd>i2
3926 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3927
3928 !! end
3929
3930 !! test
3931 Definition Lists: Indentation: Multi-level indent
3932 !! wikitext
3933 :::i3
3934 !! html
3935 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3936
3937 !! end
3938
3939 !! test
3940 Definition Lists: Hacky use to indent tables
3941 !! wikitext
3942 ::{|
3943 |foo
3944 |bar
3945 |}
3946 this text
3947 should be left alone
3948 !! html
3949 <dl><dd><dl><dd><table>
3950 <tr>
3951 <td>foo
3952 </td>
3953 <td>bar
3954 </td></tr></table></dd></dl></dd></dl>
3955 <p>this text
3956 should be left alone
3957 </p>
3958 !! end
3959
3960 !! test
3961 Definition Lists: Hacky use to indent tables, with comments (T65979)
3962 !! wikitext
3963 <!-- foo -->
3964 ::{|
3965 |foo
3966 |bar
3967 |}<!-- bar -->
3968 this text
3969 should be left alone
3970 !! html/parsoid
3971 <!-- foo -->
3972 <dl><dd><dl><dd><table><tr>
3973 <td>foo</td>
3974 <td>bar</td>
3975 </tr></table><!-- bar --></dd></dl></dd></dl>
3976 <p>this text
3977 should be left alone</p>
3978 !! end
3979
3980 !! test
3981 Definition Lists: Hacky use to indent tables, with comment before table
3982 !! wikitext
3983 ::<!-- foo -->{|
3984 |foo
3985 |}
3986 !! html/parsoid
3987 <dl><dd><dl><dd><!-- foo --><table><tr>
3988 <td>foo</td>
3989 </tr></table></dd></dl></dd></dl>
3990 !! end
3991
3992 # The trailing whitespace in this test is to catch a regression in
3993 # Parsoid after T54473.
3994 !! test
3995 Definition Lists: Hacky use to indent tables (WS-insensitive)
3996 !! wikitext
3997 : {|
3998 |a
3999 |}
4000 !! html/php
4001 <dl><dd><table>
4002 <tr>
4003 <td>a
4004 </td></tr></table></dd></dl>
4005
4006 !! html/parsoid
4007 <dl><dd> <table>
4008 <tbody><tr><td>a</td></tr>
4009 </tbody></table> </dd></dl>
4010 !! end
4011
4012 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4013 ## as an empty dt item. It also ignores all but the last ";" when followed
4014 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4015 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4016 ## ";"s.
4017 ##
4018 ## Ex: ";;t2 ::d2" is transformed into:
4019 ##
4020 ## <dl>
4021 ## <dt>t2 </dt>
4022 ## <dd>
4023 ## <dl>
4024 ## <dt></dt>
4025 ## <dd>d2</dd>
4026 ## </dl>
4027 ## </dd>
4028 ## </dl>
4029 ##
4030 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4031 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4032 ##
4033 ## <dl>
4034 ## <dt>
4035 ## <dl>
4036 ## <dt>t2 </dt>
4037 ## <dd>:d2</dd>
4038 ## </dl>
4039 ## </dt>
4040 ## </dl>
4041 ##
4042 ## All Parsoid only definition list tests have this difference.
4043 ##
4044 ## See also: https://phabricator.wikimedia.org/T8569
4045 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4046
4047 !! test
4048 Table / list interaction: indented table with lists in table contents
4049 !! wikitext
4050 :{|
4051 |-
4052 |a
4053 *b
4054 |-
4055 |c
4056 *d
4057 |}
4058 !! html
4059 <dl><dd><table>
4060
4061 <tr>
4062 <td>a
4063 <ul><li>b</li></ul>
4064 </td></tr>
4065 <tr>
4066 <td>c
4067 <ul><li>d</li></ul>
4068 </td></tr></table></dd></dl>
4069
4070 !! end
4071
4072 !!test
4073 Table / list interaction: lists nested in tables nested in indented lists
4074 !! wikitext
4075 :{|
4076 |
4077 :a
4078 :b
4079 |
4080 *c
4081 *d
4082 |}
4083
4084 *e
4085 *f
4086 !! html
4087 <dl><dd><table>
4088 <tr>
4089 <td>
4090 <dl><dd>a</dd>
4091 <dd>b</dd></dl>
4092 </td>
4093 <td>
4094 <ul><li>c</li>
4095 <li>d</li></ul>
4096 </td></tr></table></dd></dl>
4097 <ul><li>e</li>
4098 <li>f</li></ul>
4099
4100 !!end
4101
4102 !! test
4103 Definition Lists: Nesting: Multi-level (Parsoid only)
4104 !! wikitext
4105 ;t1 :d1
4106 ;;t2 ::d2
4107 ;;;t3 :::d3
4108 !! html/parsoid
4109 <dl>
4110 <dt>t1 </dt>
4111 <dd>d1</dd>
4112 <dt>
4113 <dl>
4114 <dt>t2 </dt>
4115 <dd>:d2</dd>
4116 <dt>
4117 <dl>
4118 <dt>t3 </dt>
4119 <dd>::d3</dd>
4120 </dl>
4121 </dt>
4122 </dl>
4123 </dt>
4124 </dl>
4125
4126
4127 !! end
4128
4129
4130 !! test
4131 Definition Lists: Nesting: Test 2
4132 !! wikitext
4133 ;t1
4134 ::d2
4135 !! html+tidy
4136 <dl><dt>t1</dt>
4137 <dd>
4138 <dl><dd>d2</dd></dl></dd></dl>
4139 !! end
4140
4141
4142 !! test
4143 Definition Lists: Nesting: Test 3
4144 !! wikitext
4145 :;t1
4146 ::::d2
4147 !! html+tidy
4148 <dl><dd><dl><dt>t1</dt>
4149 <dd>
4150 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Nesting: Test 4
4156 !! wikitext
4157 ::;t3
4158 :::d3
4159 !! html
4160 <dl><dd><dl><dd><dl><dt>t3</dt>
4161 <dd>d3</dd></dl></dd></dl></dd></dl>
4162
4163 !! end
4164
4165
4166 ## The Parsoid team believes the following three test exposes a
4167 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4168 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4169 ## It also exposes a "misfeature" in tidy, which doesn't like
4170 ## <dl> tags with a single <dt> child; it converts the <dt> into
4171 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4172 !! test
4173 Definition Lists: Mixed Lists: Test 1
4174 !! wikitext
4175 :;*foo
4176 ::*bar
4177 :;baz
4178 !! html/php
4179 <dl><dd><dl><dt><ul><li>foo</li>
4180 <li>bar</li></ul></dt></dl>
4181 <dl><dt>baz</dt></dl></dd></dl>
4182
4183 !! html/php+tidy
4184 <dl><dd><dl><dt><ul><li>foo</li>
4185 <li>bar</li></ul></dt></dl>
4186 <dl><dt>baz</dt></dl></dd></dl>
4187 !! html/parsoid
4188 <dl>
4189 <dd><dl>
4190 <dt><ul>
4191 <li>foo
4192 </li>
4193 </ul></dt>
4194 <dd><ul>
4195 <li>bar
4196 </li>
4197 </ul></dd>
4198 <dt>baz</dt>
4199 </dl></dd>
4200 </dl>
4201 !! end
4202
4203 !! test
4204 Definition Lists: Mixed Lists: Test 2
4205 !! wikitext
4206 *:d1
4207 *:d2
4208 !! html
4209 <ul><li><dl><dd>d1</dd>
4210 <dd>d2</dd></dl></li></ul>
4211
4212 !! end
4213
4214
4215 !! test
4216 Definition Lists: Mixed Lists: Test 3
4217 !! wikitext
4218 *:::d1
4219 *:::d2
4220 !! html
4221 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4222 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4223
4224 !! end
4225
4226
4227 !! test
4228 Definition Lists: Mixed Lists: Test 4
4229 !! wikitext
4230 *;d1 :d2
4231 *;d3 :d4
4232 !! html
4233 <ul><li><dl><dt>d1&#160;</dt>
4234 <dd>d2</dd>
4235 <dt>d3&#160;</dt>
4236 <dd>d4</dd></dl></li></ul>
4237
4238 !! end
4239
4240
4241 !! test
4242 Definition Lists: Mixed Lists: Test 5
4243 !! wikitext
4244 *:d1
4245 *::d2
4246 !! html
4247 <ul><li><dl><dd>d1
4248 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4249
4250 !! end
4251
4252
4253 !! test
4254 Definition Lists: Mixed Lists: Test 6
4255 !! wikitext
4256 #*:d1
4257 #*:::d3
4258 !! html
4259 <ol><li><ul><li><dl><dd>d1
4260 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4261
4262 !! end
4263
4264
4265 !! test
4266 Definition Lists: Mixed Lists: Test 7
4267 !! wikitext
4268 :*d1
4269 :*d2
4270 !! html
4271 <dl><dd><ul><li>d1</li>
4272 <li>d2</li></ul></dd></dl>
4273
4274 !! end
4275
4276
4277 !! test
4278 Definition Lists: Mixed Lists: Test 8
4279 !! wikitext
4280 :*d1
4281 ::*d2
4282 !! html
4283 <dl><dd><ul><li>d1</li></ul>
4284 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4285
4286 !! end
4287
4288
4289 !! test
4290 Definition Lists: Mixed Lists: Test 9
4291 !! wikitext
4292 *;foo :bar
4293 !! html
4294 <ul><li><dl><dt>foo&#160;</dt>
4295 <dd>bar</dd></dl></li></ul>
4296
4297 !! end
4298
4299
4300 !! test
4301 Definition Lists: Mixed Lists: Test 10
4302 !! wikitext
4303 *#;foo :bar
4304 !! html
4305 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4306 <dd>bar</dd></dl></li></ol></li></ul>
4307
4308 !! end
4309
4310 # The Parsoid team disagrees with the PHP parser's seemingly-random
4311 # rules regarding dd/dt on the next few tests. Parsoid is more
4312 # consistent, and recognizes the shared nesting and keeps the
4313 # still-open tags around until the nesting is complete.
4314
4315 # This is a regression test for T175099
4316 !! test
4317 Definition Lists: Mixed Lists: Test 11
4318 !! wikitext
4319 ;a
4320 :*b
4321 !! html/php
4322 <dl><dt>a</dt>
4323 <dd>
4324 <ul><li>b</li></ul></dd></dl>
4325
4326 !! html/parsoid
4327 <dl><dt>a
4328 <dd><ul><li>b</li></ul></dd></dl>
4329 !! end
4330
4331 # FIXME: Maybe get rid of this test?
4332 !! test
4333 Definition Lists: Mixed Lists: Test 12
4334 !! wikitext
4335 *#*#;*;;foo :bar
4336 *#*#;boo :baz
4337 !! html/php
4338 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4339 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4340 <dl><dt>boo&#160;</dt>
4341 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4342
4343 !! html/php+tidy
4344 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4345 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4346 <dl><dt>boo&#160;</dt>
4347 <dd>baz</dd></dl></li></ol></li></ul>
4348 !! html/parsoid
4349 <ul>
4350 <li>
4351 <ol>
4352 <li>
4353 <ul>
4354 <li>
4355 <ol>
4356 <li>
4357 <dl>
4358 <dt>
4359 <ul>
4360 <li>
4361 <dl>
4362 <dt>
4363 <dl>
4364 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4365 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4366 </dl></dt>
4367 </dl></li>
4368 </ul></dt>
4369 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4370 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4371 </dl></li>
4372 </ol></li>
4373 </ul></li>
4374 </ol></li>
4375 </ul>
4376 !! end
4377
4378 # FIXME: Maybe get rid of this test?
4379 # From whitelist:
4380 # * The test is wrong, there are two colons where there should be :;
4381 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4382 !! test
4383 Definition Lists: Weird Ones: Test 1
4384 !! wikitext
4385 *#;*::;;foo :bar (who uses this?)
4386 !! html/php+tidy
4387 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4388 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4389 !! html/parsoid
4390 <ul>
4391 <li>
4392 <ol>
4393 <li>
4394 <dl>
4395 <dt>
4396 <ul>
4397 <li>
4398 <dl>
4399 <dd>
4400 <dl>
4401 <dd>
4402 <dl>
4403 <dt>
4404 <dl>
4405 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4406 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4407 </dl></dt>
4408 </dl></dd>
4409 </dl></dd>
4410 </dl></li>
4411 </ul></dt>
4412 </dl></li>
4413 </ol></li>
4414 </ul>
4415 !! end
4416
4417 !! test
4418 Definition Lists: colons occurring in tags
4419 !! wikitext
4420 ;a:b
4421 ;'''a:b'''
4422 ;<i>a:b</i>
4423 ;<span>a:b</span>
4424 ;<div>a:b</div>
4425 ;<div>a
4426 :b</div>
4427 ;{{echo|a:b}}
4428 ;{{echo|''a:b''}}
4429 ;;;''a:b''
4430 !! html+tidy
4431 <dl><dt>a</dt>
4432 <dd>b</dd>
4433 <dt><b>a:b</b></dt>
4434 <dt><i>a:b</i></dt>
4435 <dt><span>a:b</span></dt>
4436 <dt><div>a:b</div></dt>
4437 <dt><div>a</div></dt>
4438 <dd>b</dd>
4439 <dt>a</dt>
4440 <dd>b</dd>
4441 <dt><i>a:b</i></dt></dl>
4442 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4443 !! html/parsoid
4444 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4445 <dt><b>a:b</b></dt>
4446 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4447 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4448 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4449 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4450 <dd>b</dd>
4451 <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>
4452 <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>
4453 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4454 !! end
4455
4456 # Parsoid's output differs here again because it shares
4457 # nesting between the two lists unlike the PHP parser.
4458 # Unsure which is more desirable.
4459 !! test
4460 Definition Lists: colons and tables 1
4461 !! wikitext
4462 :{|
4463 |x
4464 |}
4465 :{|
4466 |y
4467 |}
4468 !! html/php
4469 <dl><dd><table>
4470 <tr>
4471 <td>x
4472 </td></tr></table></dd></dl>
4473 <dl><dd><table>
4474 <tr>
4475 <td>y
4476 </td></tr></table></dd></dl>
4477
4478 !! html/parsoid
4479 <dl><dd><table>
4480 <tr>
4481 <td>x
4482 </td></tr></table></dd>
4483 <dd><table>
4484 <tr>
4485 <td>y
4486 </td></tr></table></dd></dl>
4487 !! end
4488
4489 # FIXME: Does this need a html/php section?
4490 !! test
4491 Definition Lists: template interaction
4492 !! wikitext
4493 ::{{definition_list}}
4494
4495 :one
4496 ::{{definition_list}}
4497 :::two
4498 :::three
4499 ::four
4500 !! html/parsoid
4501 <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">
4502 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4503
4504 <dl><dd data-parsoid='{}'>one
4505 <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">
4506 </span><dd about="#mwt2">two
4507 <dl><dd>two</dd>
4508 <dd>three</dd></dl></dd>
4509 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4510 !! end
4511
4512
4513 ###
4514 ### External links
4515 ###
4516 !! test
4517 External links: non-bracketed
4518 !! wikitext
4519 Non-bracketed: http://example.com
4520 !! html
4521 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4522 </p>
4523 !! end
4524
4525 # parsoid doesn't explicitly mark autonumbered links, see T55505
4526 !! test
4527 External links: numbered
4528 !! wikitext
4529 Numbered: [http://example.com]
4530 Numbered: [http://example.net]
4531 Numbered: [http://example.com]
4532 !! html/php
4533 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4534 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4535 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4536 </p>
4537 !! html/parsoid
4538 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4539 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4540 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4541 !!end
4542
4543 !! test
4544 External links: specified text
4545 !! wikitext
4546 Specified text: [http://example.com link]
4547 !! html
4548 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4549 </p>
4550 !!end
4551
4552 !! test
4553 External links: trail
4554 !! wikitext
4555 Linktrails should not work for external links: [http://example.com link]s
4556 !! html
4557 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4558 </p>
4559 !! end
4560
4561 !! test
4562 External links: dollar sign in URL
4563 !! wikitext
4564 http://example.com/1$2345
4565 !! html
4566 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4567 </p>
4568 !! end
4569
4570 # parsoid doesn't explicitly mark autonumbered links, see T55505
4571 !! test
4572 External links: dollar sign in URL (autonumber)
4573 !! wikitext
4574 [http://example.com/1$2345]
4575 !! html/php
4576 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4577 </p>
4578 !! html/parsoid
4579 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4580 !!end
4581
4582 !! test
4583 External links: open square bracket forbidden in URL (T6377)
4584 !! options
4585 parsoid=wt2html,wt2wt,html2html
4586 !! wikitext
4587 http://example.com/1[2345
4588 !! html/php
4589 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4590 </p>
4591 !! html/parsoid
4592 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4593 !! end
4594
4595 !! test
4596 External links: open square bracket forbidden in URL (named) (T6377)
4597 !! options
4598 parsoid=wt2html,html2html
4599 !! wikitext
4600 [http://example.com/1[2345]
4601 !! html/php
4602 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4603 </p>
4604 !! html/parsoid
4605 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4606 !!end
4607
4608 # parsoid adds a space before the link name
4609 !! test
4610 External links: open square bracket forbidden in URL (named) (T6377)
4611 Parsoid variant.
4612 !! wikitext
4613 [http://example.com/1 [2345]
4614 !! html
4615 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: nowiki in URL link text (T8230)
4621 !! wikitext
4622 [http://example.com/ <nowiki>''example site''</nowiki>]
4623 !! html
4624 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: newline forbidden in text (T8230 regression check)
4630 !! wikitext
4631 [http://example.com/ first
4632 second]
4633 !! html
4634 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4635 second]
4636 </p>
4637 !!end
4638
4639 !! test
4640 External links: Pipe char between url and text
4641 !! wikitext
4642 [http://example.com | link]
4643 !! html
4644 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4645 </p>
4646 !!end
4647
4648 !! test
4649 External links: protocol-relative URL in brackets
4650 !! wikitext
4651 [//example.com/ Test]
4652 !! html
4653 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4654 </p>
4655 !! end
4656
4657 # parsoid doesn't explicitly mark autonumbered links, see T55505
4658 !! test
4659 External links: protocol-relative URL in brackets without text
4660 !! wikitext
4661 [//example.com]
4662 !! html/php
4663 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4664 </p>
4665 !! html/parsoid
4666 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4667 !! end
4668
4669 !! test
4670 External links: protocol-relative URL in free text is left alone
4671 !! wikitext
4672 //example.com/Foo
4673 !! html
4674 <p>//example.com/Foo
4675 </p>
4676 !!end
4677
4678 !! test
4679 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4680 !! wikitext
4681 foo//example.com/Foo
4682 !! html
4683 <p>foo//example.com/Foo
4684 </p>
4685 !! end
4686
4687 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4688 !! test
4689 External links: with no contents
4690 !! options
4691 parsoid=wt2html,wt2wt
4692 !! wikitext
4693 [http://en.wikipedia.org/wiki/Foo]
4694
4695 [[wikipedia:Foo|Bar]]
4696
4697 [[wikipedia:Foo|<span>Bar</span>]]
4698 !! html/php
4699 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4701 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4702 </p>
4703 !! html/parsoid
4704 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4705 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4706 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4707 !! end
4708
4709 !! test
4710 External links: Free with trailing punctuation
4711 !! wikitext
4712 http://example.com,
4713 http://example.com;
4714 http://example.com\
4715 http://example.com.
4716 http://example.com:
4717 http://example.com!
4718 http://example.com?
4719 http://example.com)
4720 http://example.com/url_with_(brackets)
4721 (http://example.com/url_without_brackets)
4722 http://example.com/url_with_entity&amp;
4723 http://example.com/url_with_entity&#x26;
4724 http://example.com/url_with_entity&#038;
4725 http://example.com/url_with_entity&nbsp;
4726 http://example.com/url_with_entity&#xA0;
4727 http://example.com/url_with_entity&#160;
4728 http://example.com/url_with_entity&lt;
4729 http://example.com/url_with_entity&#x3C;
4730 http://example.com/url_with_entity&#60;
4731 !! html/php
4732 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4739 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4741 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4750 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4751 </p>
4752 !! html/parsoid
4753 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
4754 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
4755 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
4756 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
4757 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
4758 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
4759 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
4760 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
4761 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4762 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4763 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4766 <a rel="mw:ExtLink" class="external free" 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>
4767 <a rel="mw:ExtLink" class="external free" 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>
4768 <a rel="mw:ExtLink" class="external free" 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>
4769 <a rel="mw:ExtLink" class="external free" 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>
4770 <a rel="mw:ExtLink" class="external free" 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>
4771 <a rel="mw:ExtLink" class="external free" 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>
4772 !! end
4773
4774 !! test
4775 External links: tricky Parsoid html2html case
4776 !! options
4777 parsoid=wt2html,wt2wt,html2html
4778 !! wikitext
4779 http://example.com/url_with_entity&amp;amp;
4780 !! html/php
4781 <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>;
4782 </p>
4783 !! html/parsoid
4784 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4785 !! end
4786
4787 !! test
4788 External links: Free with trailing quotes (T113666)
4789 !! wikitext
4790 '''News:''' Stuff here
4791
4792 news:'a'b''c''d e
4793 !! html/php
4794 <p><b>News:</b> Stuff here
4795 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
4796 </p>
4797 !! html/parsoid
4798 <p><b>News:</b> Stuff here</p>
4799 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4800 !! end
4801
4802 !! test
4803 External links: with entity
4804 !! wikitext
4805 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4806 !! html/php
4807 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4808 </p>
4809 !! html/parsoid
4810 <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4811 !! end
4812
4813 !! test
4814 External links: Lone protocols are never linked (T105697)
4815 !! wikitext
4816 http://
4817 http://;
4818 (http://)
4819 bitcoin:
4820 bitcoin:;
4821 (bitcoin:)
4822 !! html
4823 <p>http://
4824 http://;
4825 (http://)
4826 bitcoin:
4827 bitcoin:;
4828 (bitcoin:)
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: No preceding word characters allowed (T67278)
4834 !! wikitext
4835 NOPEhttp://example.com
4836 N0http://example.com
4837 ok:http://example.com
4838 ok-http://example.com
4839 !! html
4840 <p>NOPEhttp://example.com
4841 N0http://example.com
4842 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4843 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4844 </p>
4845 !! end
4846
4847 !! test
4848 External links: nofollow domain exception
4849 !! wikitext
4850 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4851 !! html
4852 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4853 </p>
4854 !!end
4855
4856 !! test
4857 External image
4858 !! wikitext
4859 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4860 !! html
4861 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4862 </p>
4863 !! end
4864
4865 !! test
4866 External image from https
4867 !! wikitext
4868 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4869 !! html
4870 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External image (when not allowed)
4876 !! options
4877 wgAllowExternalImages=0
4878 !! wikitext
4879 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4880 !! html
4881 <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>
4882 </p>
4883 !! end
4884
4885 !! test
4886 Link to non-http image, no img tag
4887 !! wikitext
4888 Link to non-http image, no img tag: ftp://example.com/test.jpg
4889 !! html
4890 <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>
4891 </p>
4892 !! end
4893
4894 !! test
4895 External links: terminating separator
4896 !! wikitext
4897 Terminating separator: http://example.com/thing,
4898 !! html
4899 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4900 </p>
4901 !! end
4902
4903 !! test
4904 External links: intervening separator
4905 !! wikitext
4906 Intervening separator: http://example.com/1,2,3
4907 !! html
4908 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4909 </p>
4910 !! end
4911
4912 !! test
4913 External links: old bug with URL in query
4914 !! wikitext
4915 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4916 !! html
4917 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4918 </p>
4919 !! end
4920
4921 !! test
4922 External links: old URL-in-URL bug, mixed protocols
4923 !! wikitext
4924 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4925 !! html
4926 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4927 </p>
4928 !!end
4929
4930 # Since Parsoid is starting to emit canonical wikitext for links,
4931 # [http://example.com http://example.com] will not RT back to that
4932 # form anymore.
4933 !! test
4934 External links: URL in text
4935 !! options
4936 parsoid=wt2html
4937 !! wikitext
4938 URL in text: [http://example.com http://example.com]
4939 !! html/php
4940 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
4941 </p>
4942 !! html/parsoid
4943 <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
4944 !! end
4945
4946 !! test
4947 External links: Clickable images
4948 !! wikitext
4949 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4950 !! html/php
4951 <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>
4952 </p>
4953 !! html/parsoid
4954 <p>ja-style clickable images: <a rel="mw:ExtLink" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4955 !! end
4956
4957 !! test
4958 External links: raw ampersand
4959 !! wikitext
4960 Old &amp; use: http://x&y
4961 !! html
4962 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4963 </p>
4964 !! end
4965
4966 !! test
4967 External links: encoded ampersand
4968 !! wikitext
4969 Old &amp; use: http://x&amp;y
4970 !! html/php
4971 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4972 </p>
4973 !! html/parsoid
4974 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&amp;y">http://x&amp;y</a></p>
4975 !! end
4976
4977 !! test
4978 External links: encoded equals (T8102)
4979 !! wikitext
4980 http://example.com/?foo&#61;bar
4981 !! html/php
4982 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4983 </p>
4984 !! html/parsoid
4985 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4986 !! end
4987
4988 ##
4989 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4990 ## does it number them. As discussed in T55505, we can identify
4991 ## autonumbered links via CSS.
4992 ##
4993
4994 !! test
4995 External links: [raw ampersand]
4996 !! wikitext
4997 Old &amp; use: [http://x&y]
4998 !! html/php
4999 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5000 </p>
5001 !! html/parsoid
5002 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5003 !! end
5004
5005 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5006 # mode will return the [raw ampersand] wikitext
5007 !! test
5008 External links: [encoded ampersand]
5009 !! options
5010 parsoid=wt2html,wt2wt,html2html
5011 !! wikitext
5012 Old &amp; use: [http://x&amp;y]
5013 !! html/php
5014 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5015 </p>
5016 !! html/parsoid
5017 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5018 !! end
5019
5020 !! test
5021 External links: [raw equals]
5022 !! wikitext
5023 [http://example.com/?foo=bar]
5024 !! html/php
5025 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5026 </p>
5027 !! html/parsoid
5028 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5029 !! end
5030
5031 # note that parsoid html is identical to [raw equals] case; so html2wt
5032 # mode will return the [raw equals] wikitext
5033 !! test
5034 External links: [encoded equals] (T8102)
5035 !! options
5036 parsoid=wt2html,wt2wt,html2html
5037 !! wikitext
5038 [http://example.com/?foo&#61;bar]
5039 !! html/php
5040 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5041 </p>
5042 !! html/parsoid
5043 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5044 !! end
5045
5046 # xxx parsoid strips the IDN character, so the round-trip tests will
5047 # obviously fail and are disabled. --cscott
5048 !! test
5049 External links: [IDN ignored character reference in hostname; strip it right off]
5050 !! options
5051 parsoid=wt2html,wt2wt,html2html
5052 !! wikitext
5053 [http://e&zwnj;xample.com/]
5054 !! html/php
5055 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5056 </p>
5057 !! html/parsoid
5058 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5059 !! end
5060
5061 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5062 # Where an external link could easily circumvent the sanitization of the text of
5063 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5064 # test demands a higher standard. That's a bit strange.
5065 #
5066 # Example:
5067 #
5068 # http://e‌xample.com -> [http://example.com|http://example.com]
5069 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5070 #
5071 # The first example is sanitized, but the second is not. Any security benefits
5072 # from this production are trivial to circumvent. Either remove this test and
5073 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5074 # the test accordingly.
5075 #
5076 # All our love,
5077 # The Parsoid team.
5078 # xxx parsoid strips the IDN character, so the round-trip tests will
5079 # obviously fail and are disabled. --cscott
5080 !! test
5081 External links: IDN ignored character reference in hostname; strip it right off
5082 !! options
5083 parsoid=wt2html,html2html
5084 !! wikitext
5085 http://e&zwnj;xample.com/
5086 !! html/php
5087 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5091 !! end
5092
5093 !! test
5094 External links: www.jpeg.org (T2554)
5095 !! wikitext
5096 http://www.jpeg.org
5097 !! html
5098 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5099 </p>
5100 !! end
5101
5102 # parsoid doesn't explicitly mark autonumbered links, see T55505
5103 !! test
5104 External links: URL within URL (T2002)
5105 !! wikitext
5106 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5107 !! html/php
5108 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5109 </p>
5110 !! html/parsoid
5111 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5112 !! end
5113
5114 !! test
5115 T2361: URL inside bracketed URL
5116 !! wikitext
5117 [http://www.example.com/foo http://www.example.com/bar]
5118 !! html
5119 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5120 </p>
5121 !! end
5122
5123 !! test
5124 T2361: URL within URL, not bracketed
5125 !! wikitext
5126 http://www.example.com/foo?=http://www.example.com/bar
5127 !! html
5128 <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>
5129 </p>
5130 !! end
5131
5132 !! test
5133 T2289: ">"-token in URL-tail
5134 !! wikitext
5135 http://www.example.com/<hello>
5136 !! html
5137 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5138 </p>
5139 !!end
5140
5141 !! test
5142 T2289: literal ">"-token in URL-tail
5143 !! wikitext
5144 http://www.example.com/<b>html</b>
5145 !! html/php
5146 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5147 </p>
5148 !! html/parsoid
5149 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5150 !! end
5151
5152 !! test
5153 T2289: ">"-token in bracketed URL
5154 !! wikitext
5155 [http://www.example.com/<hello> stuff]
5156 !! html
5157 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5158 </p>
5159 !!end
5160
5161 !! test
5162 T2289: literal ">"-token in bracketed URL
5163 !! wikitext
5164 [http://www.example.com/<b>html</b> stuff]
5165 !! html
5166 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5167 </p>
5168 !!end
5169
5170 !! test
5171 T2289: literal double quote at end of URL
5172 !! wikitext
5173 http://www.example.com/"hello"
5174 !! html
5175 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5176 </p>
5177 !!end
5178
5179 !! test
5180 T2289: literal double quote in bracketed URL
5181 !! wikitext
5182 [http://www.example.com/"hello" stuff]
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5185 </p>
5186 !!end
5187
5188 !! test
5189 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5190 !! wikitext
5191 [http://www.example.com test]
5192 !! html
5193 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5194 </p>
5195 !! end
5196
5197 !! test
5198 External links: link text with spaces
5199 !! wikitext
5200 [http://www.example.com a b c]
5201 [http://www.example.com ''a'' ''b'']
5202 !! html
5203 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5204 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5205 </p>
5206 !! end
5207
5208 # Note edge case difference between PHP and Parsoid here.
5209 !! test
5210 External links: wiki links within external link (T5695)
5211 !! options
5212 parsoid=wt2html,html2html
5213 !! wikitext
5214 [http://example.com [[wikilink]] embedded in ext link]
5215
5216 [http://example.com test [[wikilink]] embedded in ext link]
5217 !! html/php
5218 <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>
5219 </p><p><a rel="nofollow" class="external text" href="http://example.com">test </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>
5220 </p>
5221 !! html/parsoid
5222 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5223 <p><a rel="mw:ExtLink" class="external text" href="http://example.com">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5224 !! end
5225
5226 !! test
5227 T2787: Links with one slash after the url protocol are invalid
5228 !! wikitext
5229 http:/example.com
5230
5231 [http:/example.com title]
5232 !! html
5233 <p>http:/example.com
5234 </p><p>[http:/example.com title]
5235 </p>
5236 !! end
5237
5238 !! test
5239 Bracketed external links with template-generated invalid target
5240 !! wikitext
5241 [{{echo|http:/example.com}} title]
5242 !! html
5243 <p>[http:/example.com title]
5244 </p>
5245 !! end
5246
5247 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5248 !! test
5249 Broken wikilinks (but not external links) prevent templates from closing
5250 !! options
5251 parsoid=wt2html
5252 !! wikitext
5253 [http://example.com x
5254
5255 {{echo|[http://example.com x}}
5256
5257 [[Foo
5258
5259 {{echo|[[Foo}}
5260 !! html/php
5261 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5262 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5263 </p><p>[[Foo
5264 </p><p>{{echo|[[Foo}}
5265 </p>
5266 !! html/parsoid
5267 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5268 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5269 <p>[[Foo</p>
5270 <p>{{echo|[[Foo}}</p>
5271 !! end
5272
5273 !! test
5274 Wikilinks with embedded newlines are not broken
5275 !! wikitext
5276 {{echo|[[ Foo
5277 B
5278 C]]}}
5279 !! html/php
5280 <p>[[ Foo
5281 B
5282 C]]
5283 </p>
5284 !! html/parsoid
5285 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5286 !! end
5287
5288 !! test
5289 Broken templates
5290 !! options
5291 parsoid=wt2html
5292 !! wikitext
5293 {{echo|[[Foo|}}]]
5294
5295 [[Foo|{{echo|]]}}
5296 !! html/php
5297 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5298 </p><p>[[Foo|]]
5299 </p>
5300 !! html/parsoid
5301 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5302 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5303 !! end
5304
5305 !! test
5306 T4702: Mismatched <i>, <b> and <a> tags are invalid
5307 !! wikitext
5308 ''[http://example.com text'']
5309 [http://example.com '''text]'''
5310 ''Something [http://example.com in italic'']
5311 ''Something [http://example.com mixed''''', even bold]'''
5312 '''''Now [http://example.com both''''']
5313 !! html
5314 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5315 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5316 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5317 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5318 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5319 </p>
5320 !! end
5321
5322
5323 !! test
5324 T6781: %26 in URL
5325 !! wikitext
5326 http://www.example.com/?title=AT%26T
5327 !! html/php
5328 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5329 </p>
5330 !! html/parsoid
5331 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5332 !! end
5333
5334 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5335 # % is actually legal in HTML5. Any change in output would need testing though.
5336 !! test
5337 T6781, T7267: %25 in URL
5338 !! wikitext
5339 http://www.example.com/?title=100%25_Bran
5340 !! html/php
5341 <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>
5342 </p>
5343 !! html/parsoid
5344 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5345 !! end
5346
5347 !! test
5348 T6781, T7267: %28, %29 in URL
5349 !! wikitext
5350 http://www.example.com/?title=Ben-Hur_%281959_film%29
5351 !! html/php
5352 <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>
5353 </p>
5354 !! html/parsoid
5355 <p><a rel="mw:ExtLink" 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></p>
5356 !! end
5357
5358
5359 !! test
5360 T6781: %26 in autonumber URL
5361 !! wikitext
5362 [http://www.example.com/?title=AT%26T]
5363 !! html/php
5364 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5365 </p>
5366 !! html/parsoid
5367 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5368 !! end
5369
5370 !! test
5371 T6781, T7267: %26 in autonumber URL
5372 !! wikitext
5373 [http://www.example.com/?title=100%25_Bran]
5374 !! html/php
5375 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5376 </p>
5377 !! html/parsoid
5378 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5379 !! end
5380
5381 !! test
5382 T6781, T7267: %28, %29 in autonumber URL
5383 !! wikitext
5384 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5385 !! html/php
5386 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5387 </p>
5388 !! html/parsoid
5389 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5390 !! end
5391
5392
5393 !! test
5394 T6781: %26 in bracketed URL
5395 !! wikitext
5396 [http://www.example.com/?title=AT%26T link]
5397 !! html/php
5398 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5399 </p>
5400 !! html/parsoid
5401 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5402 !! end
5403
5404 !! test
5405 T6781, T7267: %25 in bracketed URL
5406 !! wikitext
5407 [http://www.example.com/?title=100%25_Bran link]
5408 !! html
5409 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5410 </p>
5411 !! end
5412
5413 !! test
5414 T6781, T7267: %28, %29 in bracketed URL
5415 !! wikitext
5416 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5417 !! html/php
5418 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5422 !! end
5423
5424 !! test
5425 External link containing a period in the anchor. (T65947)
5426 !! wikitext
5427 [//foo.org/bar#baz. bang]
5428
5429 [//foo.org/bar. bang]
5430 !! html/php
5431 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5432 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5433 </p>
5434 !! html/parsoid
5435 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5436 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5437 !! end
5438
5439 !! test
5440 External link containing a single quote. (T65947)
5441 !! wikitext
5442 [//foo.org/bar'baz]
5443
5444 [//foo.org/bar'baz bang]
5445 !! html/php
5446 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5447 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5448 </p>
5449 !! html/parsoid
5450 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5451 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5452 !! end
5453
5454 !! test
5455 External link containing double-single-quotes in text '' (T6598 sanity check)
5456 !! wikitext
5457 Some [http://example.com/ pretty ''italics'' and stuff]!
5458 !! html
5459 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5460 </p>
5461 !! end
5462
5463 !! test
5464 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5465 !! wikitext
5466 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5467 !! html
5468 <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>
5469 </p>
5470 !! end
5471
5472 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5473 !! test
5474 External link containing double-single-quotes with no space separating the url from text in italics
5475 !! wikitext
5476 [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]].]
5477 !! html/php+tidy
5478 <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>.
5479 </p>
5480 !! html/parsoid
5481 <p><a rel="mw:ExtLink" 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 rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5482 !! end
5483
5484 !! test
5485 External link with comments in link text
5486 !! wikitext
5487 [http://www.google.com Google <!-- comment -->]
5488 !! html/php
5489 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5490 </p>
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5493 !! end
5494
5495 !! test
5496 External link to bare IPv4 address
5497 !! wikitext
5498 [http://192.168.0.1 Link]
5499 !! html/php
5500 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5501 </p>
5502 !! html/parsoid
5503 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5504 !! end
5505
5506 !! test
5507 URL-encoding in URL functions (single parameter)
5508 !! wikitext
5509 {{localurl:Some page|amp=&}}
5510 !! html
5511 <p>/index.php?title=Some_page&amp;amp=&amp;
5512 </p>
5513 !! end
5514
5515 !! test
5516 URL-encoding in URL functions (multiple parameters)
5517 !! wikitext
5518 {{localurl:Some page|q=?&amp=&}}
5519 !! html
5520 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5521 </p>
5522 !! end
5523
5524 !! test
5525 Brackets in urls
5526 !! wikitext
5527 http://example.com/index.php?foozoid%5B%5D=bar
5528
5529 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5530 !! html/php
5531 <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>
5532 </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>
5533 </p>
5534 !! html/parsoid
5535 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5536
5537 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5538 !! end
5539
5540 !! test
5541 IPv6 urls, autolink format (T23261)
5542 !! wikitext
5543 http://[2404:130:0:1000::187:2]/index.php
5544
5545 Examples from RFC 2373, section 2.2:
5546 *http://[1080::8:800:200C:417A]/unicast
5547 *http://[FF01::101]/multicast
5548 *http://[::1]/loopback
5549 *http://[::]/unspecified
5550 *http://[::13.1.68.3]/ipv4compat
5551 *http://[::FFFF:129.144.52.38]/ipv4compat
5552
5553 Examples from RFC 2732, section 2:
5554 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5555 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5556 *http://[3ffe:2a00:100:7031::1]
5557 *http://[1080::8:800:200C:417A]/foo
5558 *http://[::192.9.5.5]/ipng
5559 *http://[::FFFF:129.144.52.38]:80/index.html
5560 *http://[2010:836B:4179::836B:4179]
5561
5562 !! html/php
5563 <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>
5564 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5565 </p>
5566 <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>
5567 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5568 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5569 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5570 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5571 <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>
5572 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5573 </p>
5574 <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>
5575 <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>
5576 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5577 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5578 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5579 <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>
5580 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5581
5582 !! html/parsoid
5583 <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5584
5585 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5586 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5587 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5588 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5589 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5590 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5591 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5592
5593 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5594 <ul><li><a rel="mw:ExtLink" 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>
5595 <li><a rel="mw:ExtLink" 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>
5596 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5597 <li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5598 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5599 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5600 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5601 !! end
5602
5603 !! test
5604 IPv6 urls, bracketed format (T23261)
5605 !! wikitext
5606 [http://[2404:130:0:1000::187:2]/index.php test]
5607
5608 Examples from RFC 2373, section 2.2:
5609 *[http://[1080::8:800:200C:417A] unicast]
5610 *[http://[FF01::101] multicast]
5611 *[http://[::1]/ loopback]
5612 *[http://[::] unspecified]
5613 *[http://[::13.1.68.3] ipv4compat]
5614 *[http://[::FFFF:129.144.52.38] ipv4compat]
5615
5616 Examples from RFC 2732, section 2:
5617 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5618 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5619 *[http://[3ffe:2a00:100:7031::1] 3]
5620 *[http://[1080::8:800:200C:417A]/foo 4]
5621 *[http://[::192.9.5.5]/ipng 5]
5622 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5623 *[http://[2010:836B:4179::836B:4179] 7]
5624
5625 !! html/php
5626 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5627 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5628 </p>
5629 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5630 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5631 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5632 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5633 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5634 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5635 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5636 </p>
5637 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5638 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5639 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5640 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5641 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5642 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5643 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5644
5645 !! html/parsoid
5646 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5647
5648 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5649 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5650 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5651 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5652 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5653 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5654 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5655
5656 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5657 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5658 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5659 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5660 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5661 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5662 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5663 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5664 !! end
5665
5666 !! test
5667 Non-extlinks in brackets
5668 !! wikitext
5669 [foo]
5670 [foo bar]
5671 [foo ''bar'']
5672 [fool's] errand
5673 [fool's errand]
5674 [{{echo|foo}}]
5675 [{{echo|foo}} bar]
5676 [{{echo|foo}} ''bar'']
5677 [{{echo|foo}}l's] errand
5678 [{{echo|foo}}l's errand]
5679 [url={{echo|foo}}]
5680 [url=http://example.com]
5681 [http:// bare protocols don't count]
5682 !! html/php
5683 <p>[foo]
5684 [foo bar]
5685 [foo <i>bar</i>]
5686 [fool's] errand
5687 [fool's errand]
5688 [foo]
5689 [foo bar]
5690 [foo <i>bar</i>]
5691 [fool's] errand
5692 [fool's errand]
5693 [url=foo]
5694 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5695 [http:// bare protocols don't count]
5696 </p>
5697 !! html/parsoid
5698 <p>[foo]
5699 [foo bar]
5700 [foo <i>bar</i>]
5701 [fool's] errand
5702 [fool's errand]
5703 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5704 [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
5705 [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
5706 [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
5707 [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
5708 [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5709 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5710 [http:// bare protocols don't count]</p>
5711 !! end
5712
5713 !! test
5714 Percent encoding in external links
5715 !! wikitext
5716 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5717 !! html/php
5718 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5719 </p>
5720 !! html/parsoid
5721 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5722 !! end
5723
5724 !! test
5725 Use url link syntax for links where the content is equal the link target
5726 !! wikitext
5727 http://example.com
5728 !! html/php
5729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5730 </p>
5731 !! html/parsoid
5732 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
5733 !! end
5734
5735 !! test
5736 Parenthesis in external links, especially URL links
5737 !! wikitext
5738 http://example.com)
5739
5740 http://example.com/test)
5741
5742 http://example.com/(test)
5743
5744 http://example.com/((test)
5745
5746 (http://example.com/(test))
5747
5748 (http://example.com/(test)))))
5749
5750 http://example.com/a)b
5751
5752 [http://example.com) foo]
5753 !! html/php
5754 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5755 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5756 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5757 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5758 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5759 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5760 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5761 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5762 </p>
5763 !! html/parsoid
5764 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
5765 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
5766 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
5767 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
5768 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
5769 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5770 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
5771 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
5772 !! end
5773
5774 !! test
5775 Parenthesis in external links, w/ transclusion or comment
5776 !! wikitext
5777 (http://example.com/{{echo|hi}})
5778
5779 (http://example.com<!-- hi -->)
5780 !! html/php
5781 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5782 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5783 </p>
5784 !! html/parsoid
5785 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5786
5787 <p>(<a rel="mw:ExtLink" class="external free" 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>
5788 !! end
5789
5790 !! test
5791 Serialize <a> tags with invalid link targets as plain text
5792 !! options
5793 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5794 !! html/parsoid
5795 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5796 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5797 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5798 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5799 !! wikitext
5800 text
5801 <nowiki>*</nowiki>text
5802 <nowiki>[[foo]]</nowiki>
5803 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5804 !! end
5805
5806 !! test
5807 mw:ExtLink -vs- mw:WikiLink (T94723)
5808 !! options
5809 parsoid=html2wt
5810 !! html/parsoid
5811 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5812 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5813 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5814 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5815 <p>
5816 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5817 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5818 </p>
5819 !! wikitext
5820 [[Foo|Bar]]
5821 [[Foo|Bar]]
5822 [[:en:Foo|Bar]]
5823 [[:en:Foo|Bar]]
5824
5825 [[:en:European_Robin|European Robin]]
5826 [[:en:European_Robin|European Robin]]
5827 !! end
5828
5829 !! test
5830 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5831 !! options
5832 parsoid=wt2wt
5833 !! wikitext
5834 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5835 !! html/parsoid
5836 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5837 !! end
5838
5839
5840 ###
5841 ### Quotes
5842 ###
5843
5844 !! test
5845 Quotes
5846 !! wikitext
5847 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5848
5849 Normal text. '''''Bold italic text.''''' Normal text.
5850 !! html
5851 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5852 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5853 </p>
5854 !! end
5855
5856
5857 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5858 # parser strips. The wikitext contains just the first half of the bold
5859 # quote pair.
5860 !! test
5861 Unclosed and unmatched quotes
5862 !! wikitext
5863 '''''Bold italic text '''with bold deactivated''' in between.'''''
5864
5865 '''''Bold italic text ''with italic deactivated'' in between.'''''
5866
5867 '''Bold text..
5868
5869 ..spanning two paragraphs (should not work).'''
5870
5871 '''Bold tag left open
5872
5873 ''Italic tag left open
5874
5875 Normal text.
5876
5877 <!-- Unmatching number of opening, closing tags: -->
5878 '''This year''''s election ''should'' beat '''last year''''s.
5879
5880 ''Tom'''s car is bigger than ''Susan'''s.
5881
5882 Plain ''italic'''s plain
5883 !! html/php
5884 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5885 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5886 </p><p><b>Bold text..</b>
5887 </p><p>..spanning two paragraphs (should not work).
5888 </p><p><b>Bold tag left open</b>
5889 </p><p><i>Italic tag left open</i>
5890 </p><p>Normal text.
5891 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5892 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5893 </p><p>Plain <i>italic'</i>s plain
5894 </p>
5895 !! html/parsoid
5896 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5897 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5898 </p><p><b>Bold text..</b>
5899 </p><p>..spanning two paragraphs (should not work).<b></b>
5900 </p><p><b>Bold tag left open</b>
5901 </p><p><i>Italic tag left open</i>
5902 </p><p>Normal text.
5903 </p>
5904 <!-- Unmatching number of opening, closing tags: -->
5905 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5906 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5907 </p><p>Plain <i>italic'</i>s plain
5908 </p>
5909 !! end
5910
5911 ###
5912 ### Tables
5913 ###
5914 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5915 ###
5916
5917 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5918 # is the bare minimum required by the spec, see:
5919 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5920 # Parsoid team replies: empty table tags are legal in HTML5
5921 !! test
5922 A table with no data.
5923 !! options
5924 parsoid=wt2html
5925 !! wikitext
5926 {||}
5927 !! html/php
5928
5929 !! html/parsoid
5930 <table></table>
5931
5932 !! end
5933
5934 !! test
5935 A table with stray table end tags on start tag line (wt2html)
5936 !! options
5937 parsoid=wt2html
5938 !! wikitext
5939 {|style="color: red;"|}
5940
5941 {|style="color: red;" |}
5942 |foo
5943 |}
5944
5945 {|style="color: red;"|} id="foo"
5946 |foo
5947 |}
5948
5949 {|style="color: red;" |} id="foo"
5950 |foo
5951 |}
5952 !! html
5953 <table style="color: red;"></table>
5954
5955 <table style="color: red;">
5956 <tbody><tr>
5957 <td>foo</td>
5958 </tr></tbody>
5959 </table>
5960
5961 <table style="color: red;" id="foo">
5962 <tbody><tr>
5963 <td>foo</td>
5964 </tr></tbody>
5965 </table>
5966
5967 <table style="color: red;" id="foo">
5968 <tbody><tr>
5969 <td>foo</td>
5970 </tr></tbody>
5971 </table>
5972
5973 !! end
5974
5975 !! test
5976 A table with no data (take 2)
5977 !! wikitext
5978 {|
5979 |}
5980 !! html/parsoid
5981 <table></table>
5982 !! end
5983
5984 # A table with nothing but a caption is invalid XHTML, we might want to render
5985 # this as <p>caption</p>
5986 # Parsoid team replies: table with only a caption is legal in HTML5
5987 !! test
5988 A table with nothing but a caption
5989 !! wikitext
5990 {|
5991 |+caption
5992 |}
5993 !! html/php
5994 <table>
5995 <caption>caption
5996 </caption><tr><td></td></tr></table>
5997
5998 !! html/parsoid
5999 <table><caption>caption</caption></table>
6000 !! end
6001
6002 !! test
6003 A table with caption with default-spaced attributes and a table row
6004 !! wikitext
6005 {|
6006 |+ style="color: red;" | caption1
6007 |-
6008 |foo
6009 |}
6010 !! html
6011 <table>
6012 <caption style="color: red;">caption1
6013 </caption>
6014 <tr>
6015 <td>foo
6016 </td></tr></table>
6017
6018 !! end
6019
6020 !! test
6021 A table with captions with non-default spaced attributes and a table row
6022 !! wikitext
6023 {|
6024 |+style="color: red;"|caption2
6025 |+ style="color: red;"|caption3
6026 |-
6027 |foo
6028 |}
6029 !! html
6030 <table>
6031 <caption style="color: red;">caption2
6032 </caption>
6033 <caption style="color: red;">caption3
6034 </caption>
6035 <tr>
6036 <td>foo
6037 </td></tr></table>
6038
6039 !! end
6040
6041 !! test
6042 Table td-cell syntax variations
6043 !! wikitext
6044 {|
6045 |foo bar foo|baz
6046 |foo bar foo||baz
6047 |style='color:red;'|baz
6048 |style='color:red;'||baz
6049 |}
6050 !! html
6051 <table>
6052 <tr>
6053 <td>baz
6054 </td>
6055 <td>foo bar foo</td>
6056 <td>baz
6057 </td>
6058 <td style="color:red;">baz
6059 </td>
6060 <td>style='color:red;'</td>
6061 <td>baz
6062 </td></tr></table>
6063
6064 !! end
6065
6066 !! test
6067 Simple table
6068 !! wikitext
6069 {|
6070 |1||2
6071 |-
6072 |3||4
6073 |}
6074 !! html
6075 <table>
6076 <tr>
6077 <td>1</td>
6078 <td>2
6079 </td></tr>
6080 <tr>
6081 <td>3</td>
6082 <td>4
6083 </td></tr></table>
6084
6085 !! end
6086
6087 !! test
6088 Simple table but with multiple dashes for row wikitext
6089 !! wikitext
6090 {|
6091 |foo
6092 |-----
6093 |bar
6094 |}
6095 !! html
6096 <table>
6097 <tr>
6098 <td>foo
6099 </td></tr>
6100 <tr>
6101 <td>bar
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !! test
6107 Multiplication table
6108 !! wikitext
6109 {| border="1" cellpadding="2"
6110 |+Multiplication table
6111 |-
6112 !&times;!!1!!2!!3
6113 |-
6114 !1
6115 |1||2||3
6116 |-
6117 !2
6118 |2||4||6
6119 |-
6120 !3
6121 |3||6||9
6122 |-
6123 !4
6124 |4||8||12
6125 |-
6126 !5
6127 |5||10||15
6128 |}
6129 !! html
6130 <table border="1" cellpadding="2">
6131 <caption>Multiplication table
6132 </caption>
6133 <tr>
6134 <th>&#215;</th>
6135 <th>1</th>
6136 <th>2</th>
6137 <th>3
6138 </th></tr>
6139 <tr>
6140 <th>1
6141 </th>
6142 <td>1</td>
6143 <td>2</td>
6144 <td>3
6145 </td></tr>
6146 <tr>
6147 <th>2
6148 </th>
6149 <td>2</td>
6150 <td>4</td>
6151 <td>6
6152 </td></tr>
6153 <tr>
6154 <th>3
6155 </th>
6156 <td>3</td>
6157 <td>6</td>
6158 <td>9
6159 </td></tr>
6160 <tr>
6161 <th>4
6162 </th>
6163 <td>4</td>
6164 <td>8</td>
6165 <td>12
6166 </td></tr>
6167 <tr>
6168 <th>5
6169 </th>
6170 <td>5</td>
6171 <td>10</td>
6172 <td>15
6173 </td></tr></table>
6174
6175 !! end
6176
6177 !! test
6178 Accept "||" in table headings
6179 !! wikitext
6180 {|
6181 !h1||h2
6182 |}
6183 !! html
6184 <table>
6185 <tr>
6186 <th>h1</th>
6187 <th>h2
6188 </th></tr></table>
6189
6190 !! end
6191
6192 !! test
6193 Accept "!!" in table data
6194 !! wikitext
6195 {|
6196 |Foo!!||
6197 |}
6198 !! html
6199 <table>
6200 <tr>
6201 <td>Foo!!</td>
6202 <td>
6203 </td></tr></table>
6204
6205 !! html/parsoid
6206 <table>
6207 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6208 </tbody></table>
6209 !! end
6210
6211 !! test
6212 Accept "||" in indented table headings
6213 !! wikitext
6214 :{|
6215 !h1||h2
6216 |}
6217 !! html
6218 <dl><dd><table>
6219 <tr>
6220 <th>h1</th>
6221 <th>h2
6222 </th></tr></table></dd></dl>
6223
6224 !! end
6225
6226 !! test
6227 Accept "!!" in templates
6228 !! wikitext
6229 {|
6230 !a {{echo|b!!c}}
6231 |}
6232 !! html/php
6233 <table>
6234 <tr>
6235 <th>a b</th>
6236 <th>c
6237 </th></tr></table>
6238
6239 !! html/parsoid
6240 <table>
6241 <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>
6242 !! end
6243
6244 !! test
6245 Accept "!!" in table headings after newline
6246 !! wikitext
6247 {|
6248 !a
6249 b!!c
6250 |}
6251 !! html/php
6252 <table>
6253 <tr>
6254 <th>a
6255 <p>b!!c
6256 </p>
6257 </th></tr></table>
6258
6259 !! html/parsoid
6260 <table>
6261 <tbody><tr><th>a
6262 <p>b!!c</p></th></tr>
6263 </tbody></table>
6264 !! end
6265
6266 !! test
6267 Accept "!!" in table data of mixed wikitext / html syntax
6268 !! wikitext
6269 {|
6270 !a
6271 <tr><td>b!!c</td></tr>
6272 |}
6273 !! html/php+tidy
6274 <table>
6275 <tbody><tr>
6276 <th>a
6277 </th></tr><tr><td>b!!c</td></tr>
6278 </tbody></table>
6279 !! html/parsoid
6280 <table>
6281 <tbody><tr><th>a</th></tr>
6282 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6283 </tbody></table>
6284 !! end
6285
6286 !! test
6287 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6288 !! wikitext
6289 {|
6290 !| h1
6291 || a
6292 |}
6293 !! html
6294 <table>
6295 <tr>
6296 <th>h1
6297 </th>
6298 <td>a
6299 </td></tr></table>
6300
6301 !! end
6302
6303 !!test
6304 Accept "| !" at start of line in tables (ignore !-attribute)
6305 !! wikitext
6306 {|
6307 |-
6308 |!style="color:red"|bar
6309 |}
6310 !! html
6311 <table>
6312
6313 <tr>
6314 <td>bar
6315 </td></tr></table>
6316
6317 !!end
6318
6319 !!test
6320 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 +/-
6321 !! wikitext
6322 {|
6323 |-
6324 |style='color:red;'|+1
6325 |style='color:blue;'|-1
6326 |-
6327 |1||2||3
6328 |1||+2||-3
6329 |-
6330 | +1
6331 | -1
6332 |}
6333 !! html
6334 <table>
6335
6336 <tr>
6337 <td style="color:red;">+1
6338 </td>
6339 <td style="color:blue;">-1
6340 </td></tr>
6341 <tr>
6342 <td>1</td>
6343 <td>2</td>
6344 <td>3
6345 </td>
6346 <td>1</td>
6347 <td>+2</td>
6348 <td>-3
6349 </td></tr>
6350 <tr>
6351 <td>+1
6352 </td>
6353 <td>-1
6354 </td></tr></table>
6355
6356 !!end
6357
6358 !! test
6359 Table rowspan
6360 !! wikitext
6361 {| border=1
6362 |Cell 1, row 1
6363 |rowspan=2|Cell 2, row 1 (and 2)
6364 |Cell 3, row 1
6365 |-
6366 |Cell 1, row 2
6367 |Cell 3, row 2
6368 |}
6369 !! html
6370 <table border="1">
6371 <tr>
6372 <td>Cell 1, row 1
6373 </td>
6374 <td rowspan="2">Cell 2, row 1 (and 2)
6375 </td>
6376 <td>Cell 3, row 1
6377 </td></tr>
6378 <tr>
6379 <td>Cell 1, row 2
6380 </td>
6381 <td>Cell 3, row 2
6382 </td></tr></table>
6383
6384 !! end
6385
6386 !! test
6387 Nested table
6388 !! wikitext
6389 {| border=1
6390 | &alpha;
6391 |
6392 {| bgcolor=#ABCDEF border=2
6393 |nested
6394 |-
6395 |table
6396 |}
6397 |the original table again
6398 |}
6399 !! html
6400 <table border="1">
6401 <tr>
6402 <td>&#945;
6403 </td>
6404 <td>
6405 <table bgcolor="#ABCDEF" border="2">
6406 <tr>
6407 <td>nested
6408 </td></tr>
6409 <tr>
6410 <td>table
6411 </td></tr></table>
6412 </td>
6413 <td>the original table again
6414 </td></tr></table>
6415
6416 !! end
6417
6418 !! test
6419 Invalid attributes in table cell (T3830)
6420 !! wikitext
6421 {|
6422 |Cell:|broken
6423 |}
6424 !! html
6425 <table>
6426 <tr>
6427 <td>broken
6428 </td></tr></table>
6429
6430 !! end
6431
6432 !! test
6433 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6434 !! wikitext
6435 {|
6436 | title="foo" |bar
6437 | title="foo<nowiki>|</nowiki>" |bar
6438 | title="foo<nowiki>|</nowiki>" bar
6439 |}
6440 !! html/php
6441 <table>
6442 <tr>
6443 <td title="foo">bar
6444 </td>
6445 <td title="foo&#124;">bar
6446 </td>
6447 <td>title="foo|" bar
6448 </td></tr></table>
6449
6450 !! html/parsoid
6451 <table>
6452 <tbody><tr><td title="foo">bar</td>
6453 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6454 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6455 </tbody></table>
6456 !! end
6457
6458 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6459 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6460 # *2wt modes will fail.
6461 !! test
6462 Table security: embedded pipes
6463 !! options
6464 parsoid=wt2html,html2html
6465 !! wikitext
6466 {|
6467 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6468 !! html/php
6469 <table>
6470 <tr>
6471 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6472 <td>]" onmouseover="alert(document.cookie)"&gt;test
6473 </td>
6474 </tr>
6475 </table>
6476
6477 !! html/parsoid
6478 <table><tbody>
6479 <tr>
6480 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6481 !! end
6482
6483 !! test
6484 Element attributes with double ! should not be broken up by <th>
6485 !! wikitext
6486 {|
6487 !hi <div class="!!">ha</div> ho
6488 |}
6489 !! html/php
6490 <table>
6491 <tr>
6492 <th>hi <div class="!!">ha</div> ho
6493 </th></tr></table>
6494
6495 !! html/parsoid
6496 <table>
6497 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 ! and || in element attributes should not be parsed as <th>/<td>
6503 !! wikitext
6504 {|
6505 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6506 |}
6507 !! html/php
6508 <table>
6509 <tr>
6510 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6511 </td></tr></table>
6512
6513 !! html/parsoid
6514 <table>
6515 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6516 </tbody></table>
6517 !! end
6518
6519 # FIXME: The output seems broken. Filed as T110268.
6520 !! test
6521 ! and || in td attributes should not be parsed as <th>/<td>
6522 !! options
6523 parsoid=wt2html
6524 !! wikitext
6525 {|
6526 |style="color: red !important;" data-contrived="put this here ||"|foo
6527 |}
6528 !! html/php
6529 <table>
6530 <tr>
6531 <td>style="color: red !important;" data-contrived="put this here</td>
6532 <td>foo
6533 </td></tr></table>
6534
6535 !! html/parsoid
6536 <table>
6537 <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
6538 </tbody></table>
6539 !! end
6540
6541 !! test
6542 Break on | in element attribute in template
6543 !! options
6544 parsoid=wt2html,html2html
6545 !! wikitext
6546 {{echo|1=<div class="hi|ho">ha</div>}}
6547 !! html/php
6548 <p>ho"&gt;ha&lt;/div&gt;
6549 </p>
6550 !! html/parsoid
6551 <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>
6552 !! end
6553
6554 !! test
6555 Break on | in element attribute name in template
6556 !! wikitext
6557 {{echo|<div cla|ss="hiho">ha</div>}}
6558 !! html/parsoid
6559 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6560 !! end
6561
6562 !! test
6563 Don't break on | in extension attribute in template
6564 !! wikitext
6565 {{echo|<ref name="hi|ho">ha</ref>}}
6566
6567 <references />
6568 !! html/parsoid
6569 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6570
6571 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Main_Page#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
6572 !! end
6573
6574 ## We don't support roundtripping of these attributes in Parsoid.
6575 ## Selective serialization takes care of preventing dirty diffs.
6576 ## But, on edits, we dirty-diff the invalid attribute text.
6577 !! test
6578 Invalid text in table attributes should be discarded
6579 !! options
6580 parsoid=wt2html
6581 !! wikitext
6582 {| <span>boo</span> style='border:1px solid black'
6583 | <span>boo</span> style='color:blue' |1
6584 |<span>boo</span> style='color:blue'|2
6585 |}
6586 !! html/php
6587 <table style="border:1px solid black">
6588 <tr>
6589 <td style="color:blue">1
6590 </td>
6591 <td style="color:blue">2
6592 </td></tr></table>
6593
6594 !! html/parsoid
6595 <table style="border:1px solid black">
6596 <tr>
6597 <td style="color:blue">1</td>
6598 <td style="color:blue">2</td>
6599 </tr>
6600 </table>
6601 !! end
6602
6603 !! test
6604 Invalid text in table attributes should be preserved by selective serializer
6605 !! options
6606 parsoid={
6607 "modes": ["selser"],
6608 "changes": [
6609 ["td:first-child", "text", "abc"],
6610 ["td + td", "text", "xyz"]
6611 ]
6612 }
6613 !! wikitext
6614 {| <span>boo</span> style='border:1px solid black'
6615 | <span>boo</span> style='color:blue' | 1
6616 |<span>boo</span> style='color:blue'| 2
6617 |}
6618 !! wikitext/edited
6619 {| <span>boo</span> style='border:1px solid black'
6620 | <span>boo</span> style='color:blue' |abc
6621 |<span>boo</span> style='color:blue'|xyz
6622 |}
6623 !! end
6624
6625 !! test
6626 1. Template-generated table cell attributes and cell content
6627 !! wikitext
6628 {|
6629 |{{table_attribs}}
6630 | {{table_attribs}}
6631 || {{table_attribs_5}}
6632 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6633 |align=center {{table_attribs}}
6634 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6635 |}
6636 !! html
6637 <table>
6638 <tr>
6639 <td style="color:red;">Foo
6640 </td>
6641 <td style="color:red;">Foo
6642 </td>
6643 <td>style="color:red;"</td>
6644 <td>Bar
6645 </td>
6646 <td style="color:red;">Foo
6647 </td>
6648 <td align="center" style="color:red;">Foo
6649 </td>
6650 <td align="center" style="color:red;">Foo
6651 </td></tr></table>
6652
6653 !! end
6654
6655 !! test
6656 2. Template-generated table cell attributes and cell content
6657 !! wikitext
6658 {|
6659 |{{table_attribs_2}}
6660 |}
6661 !! html/php
6662 <table>
6663 <tr>
6664 <td style="color:red;">Foo
6665 </td>
6666 <td>Bar</td>
6667 <td>Baz
6668 </td></tr></table>
6669
6670 !! html/parsoid
6671 <table>
6672 <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>
6673 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6674 </tbody></table>
6675 !! end
6676
6677 !! test
6678 3. Template-generated table cell attributes and cell content
6679 !! wikitext
6680 {|
6681 !align=center {{table_header_cells}}
6682 |-
6683 |align=center {{table_cells}}
6684 |}
6685 !! html/php
6686 <table>
6687 <tr>
6688 <th align="center" style="color:red;">Foo</th>
6689 <th style="color:red;"><i>Bar</i></th>
6690 <th style="color:brown;"><i>Foo</i> and Baz
6691 </th></tr>
6692 <tr>
6693 <td align="center" style="color:red;">Foo</td>
6694 <td style="color:red;"><i>Bar</i></td>
6695 <td style="color:brown;"><i>Foo</i> and Baz
6696 </td></tr></table>
6697
6698 !! html/parsoid
6699 <table>
6700 <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>
6701 <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>
6702 </tbody></table>
6703 !! end
6704
6705 !! test
6706 4. Template-generated table cell attributes and cell content inside a templated table
6707 !! wikitext
6708 {{tbl-start}}
6709 !align=center {{table_header_cells}}
6710 |-
6711 |align=center {{table_cells}}
6712 {{tbl-end}}
6713 !! html/php
6714 <table>
6715 <tr>
6716 <th align="center" style="color:red;">Foo</th>
6717 <th style="color:red;"><i>Bar</i></th>
6718 <th style="color:brown;"><i>Foo</i> and Baz
6719 </th></tr>
6720 <tr>
6721 <td align="center" style="color:red;">Foo</td>
6722 <td style="color:red;"><i>Bar</i></td>
6723 <td style="color:brown;"><i>Foo</i> and Baz
6724 </td></tr></table>
6725
6726 !! html/parsoid
6727 <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}}]}'>
6728 <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>
6729 <tr>
6730 <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>
6731 </tbody></table>
6732 !! end
6733
6734 ## Edge case fix to prevent future regressions
6735 !! test
6736 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6737 !! wikitext
6738 {|
6739 |{{table_attribs_7}}
6740 |}
6741 <references />
6742 !! html/parsoid
6743 <table>
6744 <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<sup 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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
6745 </tbody></table>
6746 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
6747 !! end
6748
6749 !! test
6750 Table with row followed by newlines and table heading
6751 !! options
6752 parsoid=wt2html,html2html
6753 !! wikitext
6754 {|
6755 |-
6756
6757 !foo
6758 |}
6759 !! html/*
6760 <table>
6761
6762
6763 <tr>
6764 <th>foo
6765 </th></tr></table>
6766
6767 !! end
6768
6769 !! test
6770 Table with empty line following the start tag
6771 !! options
6772 parsoid=wt2html,html2html
6773 !! wikitext
6774 {|
6775
6776 |-
6777 |foo
6778 |}
6779 !! html/*
6780 <table>
6781
6782
6783 <tr>
6784 <td>foo
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table attributes with empty value
6791 !! options
6792 parsoid=wt2html,html2html
6793 !! wikitext
6794 {|
6795 | style=|hello
6796 |}
6797 !! html/php
6798 <table>
6799 <tr>
6800 <td style="">hello
6801 </td></tr></table>
6802
6803 !! html/parsoid
6804 <table>
6805 <tbody><tr><td style="">hello</td></tr>
6806 </tbody></table>
6807 !! end
6808
6809 !! test
6810 Wikitext table with a lot of comments
6811 !! wikitext
6812 {|
6813 <!-- c0 -->
6814 |foo
6815 <!-- c1 -->
6816 |-<!-- c2 -->
6817 <!-- c3 -->
6818 |<!-- c4 -->
6819 <!-- c5 -->
6820 |}
6821 !! html
6822 <table>
6823 <tr>
6824 <td>foo
6825 </td></tr>
6826 <tr>
6827 <td>
6828 </td></tr></table>
6829
6830 !! end
6831
6832 !! test
6833 Wikitext table comments represented in parsoid dom
6834 !! wikitext
6835 {|<!--c1--><!--c2-->
6836 |-<!--c3-->
6837 |x
6838 |}
6839 !! html/php+tidy
6840 <table>
6841
6842 <tbody><tr>
6843 <td>x
6844 </td></tr></tbody></table>
6845 !! html/parsoid
6846 <table><!--c1--><!--c2-->
6847 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6848 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
6849 </tbody></table>
6850 !! end
6851
6852 !! test
6853 Wikitext table with double-line table cell
6854 !! wikitext
6855 {|
6856 |a
6857 b
6858 |}
6859 !! html
6860 <table>
6861 <tr>
6862 <td>a
6863 <p>b
6864 </p>
6865 </td></tr></table>
6866
6867 !! end
6868
6869 !! test
6870 Table cell with a single comment
6871 !! wikitext
6872 {|
6873 | <!-- c1 -->
6874 |a
6875 |}
6876 !! html
6877 <table>
6878 <tr>
6879 <td>
6880 </td>
6881 <td>a
6882 </td></tr></table>
6883
6884 !! end
6885
6886 !! test
6887 Table-cell after a comment-only-empty-line
6888 !! wikitext
6889 {|
6890 |a
6891 <!--c1-->
6892 <!--c2-->|b
6893 |}
6894 !! html
6895 <table>
6896 <tr>
6897 <td>a
6898 </td>
6899 <td>b
6900 </td></tr></table>
6901
6902 !! html/parsoid
6903 <table>
6904 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6905 <!--c1-->
6906 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
6907 </tbody></table>
6908
6909 !! end
6910
6911 !! test
6912 Build table with {{!}}
6913 !! wikitext
6914 {{{!}} class="wikitable"
6915 !header
6916 !second header
6917 {{!}}- style="color:red;"
6918 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
6919 {{!}}}
6920 !! html
6921 <table class="wikitable">
6922 <tr>
6923 <th>header
6924 </th>
6925 <th>second header
6926 </th></tr>
6927 <tr style="color:red;">
6928 <td>data</td>
6929 <td style="color:red;">second data
6930 </td></tr></table>
6931
6932 !! end
6933
6934 !! test
6935 Build table with pipe as data
6936 !! wikitext
6937 {| class="wikitable"
6938 !header
6939 !second header
6940 |- style="color:red;"
6941 |data|| style="color:red;" |second data
6942 |-
6943 | style="color:red;" |data with | || style="color:red;" | second data with |
6944 |-
6945 ||data with | |||second data with |
6946 |}
6947 !! html
6948 <table class="wikitable">
6949 <tr>
6950 <th>header
6951 </th>
6952 <th>second header
6953 </th></tr>
6954 <tr style="color:red;">
6955 <td>data</td>
6956 <td style="color:red;">second data
6957 </td></tr>
6958 <tr>
6959 <td style="color:red;">data with |</td>
6960 <td style="color:red;">second data with |
6961 </td></tr>
6962 <tr>
6963 <td>data with |</td>
6964 <td>second data with |
6965 </td></tr></table>
6966
6967 !! end
6968
6969 !! test
6970 Build table with wikilink
6971 !! wikitext
6972 {| class="wikitable"
6973 !header||second header
6974 |- style="color:red;"
6975 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
6976 |-
6977 |data||second data [[Main Page|link|text with pipe]]
6978 |}
6979 !! html
6980 <table class="wikitable">
6981 <tr>
6982 <th>header</th>
6983 <th>second header
6984 </th></tr>
6985 <tr style="color:red;">
6986 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
6987 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6988 </td></tr>
6989 <tr>
6990 <td>data</td>
6991 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6992 </td></tr></table>
6993
6994 !! end
6995
6996 # The expected HTML structure in this test is debatable. The PHP parser does
6997 # not parse this kind of table at all. The main focus for Parsoid is on
6998 # round-tripping, so this output is ok for now. TODO: revisit!
6999 !! test
7000 Wikitext table with html-syntax row
7001 !! wikitext
7002 {|
7003 |-
7004 <td>foo</td>
7005 |}
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr>
7010 <td>foo</td></tr></tbody></table>
7011 !! end
7012
7013 !! test
7014 Fostered content in tables: Plain text
7015 !! options
7016 parsoid=wt2html,html2html
7017 !! wikitext
7018 {|
7019 |-
7020 a
7021 |}
7022 !! html/php
7023 <table>
7024
7025 a
7026 </table>
7027
7028 !! html/php+tidy
7029
7030
7031 a
7032 <table></table>
7033 !! html/parsoid
7034 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7035 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7036
7037 </tr></tbody></table>
7038 !! end
7039
7040 !! test
7041 Fostered content in tables: Lists
7042 !! options
7043 parsoid=wt2html,html2html
7044 !! wikitext
7045 {|
7046 |-
7047 *a
7048 |}
7049 !! html/php
7050 <table>
7051
7052 <ul><li>a</li></ul>
7053 </table>
7054
7055 !! html/php+tidy
7056 <ul><li>a</li></ul><table>
7057
7058
7059 </table>
7060 !! html/parsoid
7061 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7062 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7063
7064 </tr></tbody></table>
7065 !! end
7066
7067 !! test
7068 Template generated table cell with attributes
7069 !! wikitext
7070 {|
7071 |-
7072 {{table_attribs_4}} ||a||b
7073 |}
7074 !! html/php+tidy
7075 <table>
7076
7077 <tbody><tr>
7078 <td style="background-color:#DC241f;" width="10px"></td>
7079 <td>a</td>
7080 <td>b
7081 </td></tr></tbody></table>
7082 !! html/parsoid
7083 <table>
7084 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7085 <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}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr>
7086 !! end
7087
7088 !! test
7089 Parsoid: Round-trip tables directly followed by content (T53219)
7090 !! options
7091 parsoid=wt2html,wt2wt
7092 !! wikitext
7093 {|
7094 |foo
7095 |} bar
7096
7097 {|
7098 |baz
7099 |}<b>quux</b>
7100 !! html+tidy
7101 <table>
7102 <tbody><tr>
7103 <td>foo
7104 </td></tr></tbody></table><p> bar
7105 </p><table>
7106 <tbody><tr>
7107 <td>baz
7108 </td></tr></tbody></table><p><b>quux</b>
7109 </p>
7110 !! end
7111
7112 !! test
7113 Parsoid: Default to a newline after tables in new content (T53219)
7114 !! options
7115 parsoid=html2wt
7116 !! html/parsoid
7117 <table><tbody>
7118 <tr><td>foo</td></tr></tbody></table> bar
7119 <table><tbody>
7120 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7121 !! wikitext
7122 {|
7123 |foo
7124 |}
7125 <nowiki> </nowiki>bar
7126 {|
7127 |baz
7128 |}
7129 '''quux'''
7130 !! end
7131
7132 !! test
7133 Parsoid: newline inducing block nodes don't suppress <nowiki>
7134 !! options
7135 parsoid=html2wt
7136 !! html/parsoid
7137 a<h1>foo</h1>
7138 !! wikitext
7139 <nowiki> </nowiki>a
7140
7141 = foo =
7142 !! end
7143
7144 !! test
7145 Parsoid: Row-syntax table headings followed by comment & table cells
7146 !! options
7147 parsoid=wt2html,wt2wt
7148 !! wikitext
7149 {|
7150 !foo||bar
7151 <!-- foo --> ||baz||quux
7152 |}
7153 !! html/php
7154 <table>
7155 <tr>
7156 <th>foo</th>
7157 <th>bar
7158 </th>
7159 <td>baz</td>
7160 <td>quux
7161 </td></tr></table>
7162
7163 !! html/parsoid
7164 <table>
7165 <tbody><tr><th> foo </th><th> bar
7166 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7167 </tbody></table>
7168 !! end
7169
7170 !!test
7171 Parsoid: Recover better from broken table attributes
7172 !!options
7173 parsoid=wt2html
7174 !!wikitext
7175 {| class="foo
7176 | class="bar" |
7177 foo
7178 |}
7179 !!html/php+tidy
7180 <table class="foo">
7181 <tbody><tr>
7182 <td class="bar">
7183 <p>foo
7184 </p>
7185 </td></tr></tbody></table>
7186 !!html/parsoid
7187 <table class="foo">
7188 <tr>
7189 <td class="bar">
7190 <p>foo</p></td></tr>
7191 </tbody></table>
7192 !!end
7193
7194 !! test
7195 Tables: Digest broken attributes on table and tr tag
7196 !! options
7197 parsoid=wt2html
7198 !! wikitext
7199 {| || |} ++
7200 |- || || ++ --
7201 |- > [
7202 |}
7203 !! html
7204 <table>
7205 <tbody>
7206 <tr class='mw-empty-elt'></tr>
7207 <tr class='mw-empty-elt'></tr>
7208 </tbody></table>
7209 !! end
7210
7211 # T137406: Whitespace in the HTML
7212 !! test
7213 1. Generate correct wikitext for tables with thead/tbody/tfoot
7214 !! options
7215 parsoid=html2wt
7216 !! html/parsoid
7217 <table>
7218 <caption>Test</caption>
7219 <thead>
7220 <tr>
7221 <th>Month</th>
7222 <th>Savings</th>
7223 </tr>
7224 </thead>
7225 <tbody>
7226 <tr>
7227 <td>January</td>
7228 <td>$100</td>
7229 </tr>
7230 <tr>
7231 <td>February</td>
7232 <td>$80</td>
7233 </tr>
7234 </tbody>
7235 <tfoot>
7236 <tr>
7237 <td>Sum</td>
7238 <td>$180</td>
7239 </tr>
7240 </tfoot>
7241 </table>
7242 !! wikitext
7243 {|
7244 |+Test
7245 !Month
7246 !Savings
7247 |-
7248 |January
7249 |$100
7250 |-
7251 |February
7252 |$80
7253 |-
7254 |Sum
7255 |$180
7256 |}
7257 !! html/php+tidy
7258 <table>
7259 <caption>Test
7260 </caption>
7261 <tbody><tr>
7262 <th>Month
7263 </th>
7264 <th>Savings
7265 </th></tr>
7266 <tr>
7267 <td>January
7268 </td>
7269 <td>$100
7270 </td></tr>
7271 <tr>
7272 <td>February
7273 </td>
7274 <td>$80
7275 </td></tr>
7276 <tr>
7277 <td>Sum
7278 </td>
7279 <td>$180
7280 </td></tr></tbody></table>
7281 !! end
7282
7283 # T137406: No whitespace in the HTML
7284 !! test
7285 2. Generate correct wikitext for tables with thead/tbody/tfoot
7286 !! options
7287 parsoid=html2wt
7288 !! html/parsoid
7289 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7290 !! wikitext
7291 {|
7292 !heading
7293 |-
7294 |foo
7295 |}
7296 !! end
7297
7298 !! test
7299 Testing serialization after deletion in references
7300 !! options
7301 parsoid={
7302 "modes": ["wt2wt"],
7303 "changes": [
7304 ["#x", "remove"]
7305 ]
7306 }
7307 !! wikitext
7308 hi <ref><div id="x">ho</div></ref>
7309
7310 <references />
7311 !! wikitext/edited
7312 hi <ref></ref>
7313
7314 <references />
7315 !! end
7316
7317 !!test
7318 Testing serialization after deletion of table cells
7319 !!options
7320 parsoid={
7321 "modes": ["wt2wt", "selser"],
7322 "changes": [
7323 ["#x", "remove"]
7324 ]
7325 }
7326 !!wikitext
7327 {|
7328 !h1 !!h2 !!h3
7329 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7330 |}
7331 !! wikitext/edited
7332 {|
7333 !h1 !!h2 !!h3
7334 |c2 |||c3
7335 |}
7336 !!end
7337
7338 !! test
7339 Testing selser after addition of new row before first row (T125419)
7340 !! options
7341 parsoid={
7342 "modes": ["wt2wt", "selser"],
7343 "changes": [
7344 [ "tr", "before", "<tr><td>X</td></tr>" ]
7345 ]
7346 }
7347 !! wikitext
7348 {|
7349 |a
7350 |}
7351 !! wikitext/edited
7352 {|
7353 |X
7354 |-
7355 |a
7356 |}
7357 !! end
7358
7359 !! test
7360 Serialize new table rows in a HTML table using HTML tags
7361 !! options
7362 parsoid={
7363 "modes": ["wt2wt", "selser"],
7364 "changes": [
7365 [ "tr", "before", "<tr><td>X</td></tr>" ]
7366 ]
7367 }
7368 !! wikitext
7369 <table><tr><td>a</td></tr></table>
7370 !! wikitext/edited
7371 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7372 !! end
7373
7374 !! test
7375 Serialize new table cells in a HTML row using HTML tags
7376 !! options
7377 parsoid={
7378 "modes": ["wt2wt", "selser"],
7379 "changes": [
7380 [ "td", "before", "<td>X</td>" ]
7381 ]
7382 }
7383 !! wikitext
7384 <table><tr><td>a</td></tr></table>
7385 !! wikitext/edited
7386 <table><tr><td>X</td><td>a</td></tr></table>
7387 !! end
7388
7389 !! test
7390 Wikitext tables can be nested inside HTML tables
7391 !! options
7392 parsoid=html2wt
7393 !! html
7394 <table data-parsoid='{"stx":"html"}'>
7395 <tr><td>
7396 <table>
7397 <tr><td>foo</td></tr>
7398 </table>
7399 </td></tr>
7400 </table>
7401 !! wikitext
7402 <table>
7403 <tr><td>
7404 {|
7405 |foo
7406 |}
7407 </td></tr>
7408 </table>
7409 !! end
7410
7411 !! test
7412 Serialize wikitext list items as HTML list items when embedded in a HTML list
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{}'>a</li>
7418 <li>b</li>
7419 </ul>
7420 !! wikitext
7421 <ul>
7422 <li>a</li>
7423 <li>b</li>
7424 </ul>
7425 !! end
7426
7427 # SSS FIXME: Is this actually a good thing given the
7428 # odd nested list output that is generated by MW?
7429 # <ul><li>foo<ul>..</ul></li></ul> instead of
7430 # <ul><li>foo</li><ul>..</ul></ul>
7431 !! test
7432 Wikitext lists can be nested inside HTML lists
7433 !! options
7434 parsoid=html2wt
7435 !! html
7436 <ul data-parsoid='{"stx": "html"}'>
7437 <li data-parsoid='{"stx": "html"}'>a
7438 <ul><li>b</li></ul>
7439 </li>
7440 </ul>
7441
7442 <ul data-parsoid='{"stx": "html"}'>
7443 <li>x
7444 <ul><li>y</li></ul>
7445 </li>
7446 </ul>
7447 !! wikitext
7448 <ul>
7449 <li>a
7450 * b
7451 </li>
7452 </ul>
7453
7454 <ul>
7455 <li>x
7456 * y
7457 </li>
7458 </ul>
7459 !! end
7460
7461 ###
7462 ### Internal links
7463 ###
7464 !! test
7465 Plain link, capitalized
7466 !! wikitext
7467 [[Main Page]]
7468 !! html
7469 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7470 </p>
7471 !! end
7472
7473 !! test
7474 Plain link, uncapitalized
7475 !! wikitext
7476 [[main Page]]
7477 !! html
7478 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7479 </p>
7480 !! end
7481
7482 !! test
7483 Piped link
7484 !! wikitext
7485 [[Main Page|The Main Page]]
7486 !! html
7487 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7488 </p>
7489 !! end
7490
7491 !! test
7492 Piped link with comment in link text
7493 !! wikitext
7494 [[Main Page|The Main<!--front--> Page]]
7495 !! html
7496 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7497 </p>
7498 !! end
7499
7500 !! test
7501 Piped link with multiple pipe characters in link text
7502 !! wikitext
7503 [[Main Page||The|Main|Page|]]
7504 !! html/php
7505 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7506 </p>
7507 !! html/parsoid
7508 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7509 !! end
7510
7511 !! test
7512 Piped link with no link text
7513 !! wikitext
7514 [[Thomas Bek (bishop of St David's)|]]
7515 !! html/php
7516 <p>[[Thomas Bek (bishop of St David's)|]]
7517 </p>
7518 !! html/parsoid
7519 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7520 !! end
7521
7522 !! test
7523 Piped link with empty link text
7524 !! wikitext
7525 [[Main Page|<nowiki/>]] - empty nowiki
7526 [[Main Page| ]] - empty space
7527 [[Main Page|&nbsp;]] - empty non breaking space
7528 !! html/php
7529 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7530 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7531 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7532 </p>
7533 !! html/parsoid
7534 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7535 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7536 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7537 !! end
7538
7539 !! test
7540 Broken link
7541 !! wikitext
7542 [[Zigzagzogzagzig]]
7543 !! html
7544 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7545 </p>
7546 !! end
7547
7548 !! test
7549 Broken link with fragment
7550 !! wikitext
7551 [[Zigzagzogzagzig#zug]]
7552 !! html
7553 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7554 </p>
7555 !! end
7556
7557 !! test
7558 Special page link with fragment
7559 !! wikitext
7560 [[Special:Version#anchor]]
7561 !! html
7562 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7563 </p>
7564 !! end
7565
7566 !! test
7567 Nonexistent special page link with fragment
7568 !! wikitext
7569 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7570 !! html
7571 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7572 </p>
7573 !! end
7574
7575 !! test
7576 Link with prefix
7577 !! wikitext
7578 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7579 !! html
7580 <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>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Link with suffix
7586 !! wikitext
7587 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7588 !! html
7589 <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>!!!
7590 </p>
7591 !! end
7592
7593 !! article
7594 prefixed article
7595 !! text
7596 Some text
7597 !! endarticle
7598
7599 !! test
7600 T45661: Piped links with identical prefixes
7601 !! wikitext
7602 [[prefixed article|prefixed articles with spaces]]
7603
7604 [[prefixed article|prefixed articlesaoeu]]
7605
7606 [[Main Page|Main Page test]]
7607 !! html
7608 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7609 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7610 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7611 </p>
7612 !! end
7613
7614
7615 !! test
7616 Link with HTML entity in suffix / tail
7617 !! wikitext
7618 [[Main Page]]&quot;, [[Main Page]]&#97;
7619 !! html/php
7620 <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;
7621 </p>
7622 !! html/parsoid
7623 <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>
7624 !! end
7625
7626 !! test
7627 Link with 3 brackets
7628 !! wikitext
7629 [[[Main Page]]]
7630 Foo [[[Main Page]]]
7631 !! html
7632 <p>[[[Main Page]]]
7633 Foo [[[Main Page]]]
7634 </p>
7635 !! end
7636
7637 !! test
7638 Link with 4 brackets
7639 !! wikitext
7640 [[[[Main Page]]]]
7641 !! html
7642 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7643 </p>
7644 !! end
7645
7646 !! test
7647 Piped link with 3 brackets
7648 !! wikitext
7649 [[[main page|the main page]]]
7650 !! html
7651 <p>[[[main page|the main page]]]
7652 </p>
7653 !! end
7654
7655 !! test
7656 Piped link with extlink-like text
7657 !! wikitext
7658 [[Main Page|[bar]]]
7659 [[Main Page|This is a [bar]]]
7660 [[Main Page|[bar]]
7661 !! html/php
7662 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7663 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7664 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7665 </p>
7666 !! html/parsoid
7667 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7668 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7669 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7670 !! end
7671
7672 !! test
7673 Link with multiple pipes
7674 !! wikitext
7675 [[Main Page|The|Main|Page]]
7676 !! html
7677 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Anchor containing a #. (T65430)
7683 !! config
7684 wgFragmentMode=[ 'html5', 'legacy' ]
7685 !! wikitext
7686 [[Main Page#And#Link]]
7687 !! html/php
7688 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7689 </p>
7690 !! html/parsoid
7691 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7692 !! end
7693
7694 !! test
7695 Link to namespaces
7696 !! wikitext
7697 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7698 !! html
7699 <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>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Link with space in namespace
7705 !! wikitext
7706 [[User talk:Foo bar]]
7707 !! html
7708 <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>
7709 </p>
7710 !! end
7711
7712 !! article
7713 MemoryAlpha:AlphaTest
7714 !! text
7715 This is an article in the MemoryAlpha namespace
7716 (which shadows the memoryalpha interwiki link).
7717 !! endarticle
7718
7719 !! test
7720 Namespace takes precedence over interwiki link (T53680)
7721 !! wikitext
7722 [[MemoryAlpha:AlphaTest]]
7723 !! html
7724 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7725 </p>
7726 !! end
7727
7728 # The previous test doesn't work correctly in html2*, due to not recognizing the
7729 # link as an internal one. This one checks for the correct behavior.
7730 !! test
7731 Link to namespace preferred over interwiki with correct rel attribute
7732 !! options
7733 parsoid=html2wt,html2html
7734 !! html/parsoid
7735 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7736 !! wikitext
7737 [[MemoryAlpha:AlphaTest]]
7738 !! end
7739
7740 !! test
7741 Piped link to namespace
7742 !! wikitext
7743 [[Meta:Disclaimers|The disclaimers]]
7744 !! html
7745 <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>
7746 </p>
7747 !! end
7748
7749 !! test
7750 Link containing }
7751 !! wikitext
7752 [[Usually caused by a typo (oops}]]
7753 !! html
7754 <p>[[Usually caused by a typo (oops}]]
7755 </p>
7756 !! end
7757
7758 !! article
7759 7% Solution
7760 !! text
7761 Just a test of an article title containing a percent.
7762 !! endarticle
7763
7764 !! test
7765 Link containing % (not as a hex sequence)
7766 !! wikitext
7767 [[7% Solution]]
7768 [[7% Solution|7%25 Solution]]
7769 !! html/php
7770 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7771 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7772 </p>
7773 !! html/parsoid
7774 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7775 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7776 !! end
7777
7778 # note that the parsoid HTML is identical to the previous test output,
7779 # so the previous test ensures that the html2wt mode will generate the
7780 # "not as a hex sequence" wikitext.
7781 !! test
7782 Link containing % as a single hex sequence interpreted to char
7783 !! options
7784 parsoid=wt2wt,wt2html,html2html
7785 !! wikitext
7786 [[7%25 Solution]]
7787 [[7%25 Solution|7%25 Solution]]
7788 !! html/php
7789 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7790 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7791 </p>
7792 !! html/parsoid
7793 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7794 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7795 !!end
7796
7797 !! test
7798 Link containing % as a double hex sequence interpreted to hex sequence
7799 !! wikitext
7800 [[7%2525 Solution]]
7801 !! html
7802 <p>[[7%2525 Solution]]
7803 </p>
7804 !!end
7805
7806 ## Example for such a section: == < ==
7807 !! test
7808 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7809 !! config
7810 wgFragmentMode=[ 'html5', 'legacy' ]
7811 !! wikitext
7812 [[%23%3c]][[%23%3e]]
7813 !! html/php
7814 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7815 </p>
7816 !! html/parsoid
7817 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
7818 !! end
7819
7820 ## Example for such a section: == < ==
7821 !! test
7822 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7823 !! config
7824 wgFragmentMode=[ 'legacy' ]
7825 !! wikitext
7826 [[%23%3c]][[%23%3e]]
7827 !! html/php
7828 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7829 </p>
7830 !! end
7831
7832 !! test
7833 Link containing "<#" and ">#" as a hex sequences
7834 !! wikitext
7835 [[%3c%23]][[%3e%23]]
7836 !! html
7837 <p>[[%3c%23]][[%3e%23]]
7838 </p>
7839 !! end
7840
7841 !! test
7842 Link containing an equals sign
7843 !! wikitext
7844 [[Special:BookSources/isbn=4-00-026157-6]]
7845 !! html/php
7846 <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>
7847 </p>
7848 !! html/parsoid
7849 <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>
7850 !! end
7851
7852 !! article
7853 Foo~bar
7854 !! text
7855 Just a test of an article title containing a tilde.
7856 !! endarticle
7857
7858 # note that links containing signatures, like [[Foo~~~~]], are
7859 # massaged by the pre-save transform (PST) and so the tildes are never
7860 # seen by the parser.
7861 !! test
7862 Link containing a tilde
7863 !! wikitext
7864 [[Foo~bar]]
7865 !! html/php
7866 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7867 </p>
7868 !! html/parsoid
7869 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7870 !! end
7871
7872 !! test
7873 Link containing double-single-quotes '' (T6598)
7874 !! wikitext
7875 [[Lista d''e paise d''o munno]]
7876 !! html/php
7877 <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&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
7878 </p>
7879 !! html/parsoid
7880 <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>
7881 !! end
7882
7883 !! test
7884 Link containing double quotes and spaces
7885 !! wikitext
7886 [[Cool "Gator"]]
7887 !! html/php
7888 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7889 </p>
7890 !! html/parsoid
7891 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
7892 !! end
7893
7894 !! test
7895 File containing double quotes and spaces
7896 !! wikitext
7897 [[File:Cool "Gator".png]]
7898 !! html/parsoid
7899 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
7900 !! end
7901
7902 !! test
7903 Redirect containing double quotes and spaces
7904 !! wikitext
7905 #REDIRECT [[Cool "Gator"]]
7906 !! html/parsoid
7907 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7908 !! end
7909
7910 !! test
7911 Link containing double-single-quotes '' in text (T6598 sanity check)
7912 !! wikitext
7913 Some [[Link|pretty ''italics'' and stuff]]!
7914 !! html/php
7915 <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>!
7916 </p>
7917 !! html/parsoid
7918 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7919 !! end
7920
7921 !! test
7922 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7923 !! wikitext
7924 ''Some [[Link|pretty ''italics'' and stuff]]!''
7925 !! html
7926 <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>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Link with double quotes in title part (literal) and alternate part (interpreted)
7932 !! wikitext
7933 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7934
7935 [[''Pentecoste'']]
7936
7937 [[''Pentecoste''|Pentecoste]]
7938
7939 [[''Pentecoste''|''Pentecoste'']]
7940 !! html/php
7941 <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>
7942 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
7943 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
7944 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
7945 </p>
7946 !! html/parsoid
7947 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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></figure-inline></p>
7948 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7949 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7950 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7951 !! end
7952
7953 !! test
7954 Broken image links with HTML captions (T41700)
7955 !! wikitext
7956 [[File:Nonexistent|<script></script>]]
7957 [[File:Nonexistent|100x100px|<script></script>]]
7958 [[File:Nonexistent|&lt;]]
7959 [[File:Nonexistent|a<i>b</i>c]]
7960 !! html/php
7961 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7962 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7963 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7964 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7965 </p>
7966 !! html/parsoid
7967 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7968 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7969 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7970 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
7971 !! end
7972
7973 !! test
7974 Plain link to URL
7975 !! wikitext
7976 [[http://www.example.com]]
7977 !! html/php
7978 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7979 </p>
7980 !! html/parsoid
7981 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
7982 !! end
7983
7984 !! test
7985 Plain link to URL with link text
7986 !! wikitext
7987 [[http://www.example.com Link text]]
7988 !! html
7989 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7990 </p>
7991 !! end
7992
7993 !! test
7994 Plain link to protocol-relative URL
7995 !! wikitext
7996 [[//www.example.com]]
7997 !! html/php
7998 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7999 </p>
8000 !! html/parsoid
8001 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8002 !! end
8003
8004 !! test
8005 Plain link to protocol-relative URL with link text
8006 !! wikitext
8007 [[//www.example.com Link text]]
8008 !! html
8009 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8010 </p>
8011 !! end
8012
8013 !! test
8014 Plain link to page with question mark in title
8015 !! wikitext
8016 [[A?b]]
8017
8018 [[A?b|Baz]]
8019 !! html
8020 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8021 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8022 </p>
8023 !! end
8024
8025 # I'm fairly sure the expected result here is wrong.
8026 # We want these to be URL links, not pseudo-pages with URLs for titles....
8027 # However the current output is also pretty screwy.
8028 #
8029 # ----
8030 # I'm changing it to match the current output--it arguably makes more
8031 # sense in the light of the test above. Old expected result was:
8032 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8033 #</p>
8034 # But I think this test is bordering on "garbage in, garbage out" anyway.
8035 # -- wtm
8036 !! test
8037 Piped link to URL
8038 !! wikitext
8039 Piped link to URL: [[http://www.example.com|an example URL]]
8040 !! html/php
8041 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8042 </p>
8043 !! html/parsoid
8044 <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8045 !! end
8046
8047 !! test
8048 Plain link in template argument
8049 !! options
8050 parsoid=wt2html
8051 !! wikitext
8052 {{echo|[http://www.example.com |123]}}
8053
8054 {{echo|[[http://www.example.com |123]]}}
8055
8056 {{echo|[[http://www.example.com |123]}}
8057
8058 {{echo|[http://www.example.com |123]]}}
8059 !! html/php
8060 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8061 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8062 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8063 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8064 </p>
8065 !! html/parsoid
8066 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8067
8068 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external text" href="http://www.example.com">|123</a>]</p>
8069
8070 <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8071
8072 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8073 !! end
8074
8075 !! test
8076 T2002: [[page|http://url/]] should link to page, not http://url/
8077 !! wikitext
8078 [[Main Page|http://url/]]
8079 !! html/php
8080 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8081 </p>
8082 !! html/parsoid
8083 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8084 !! end
8085
8086 # Parsoid does not mark self-links, by design.
8087 !! test
8088 T2337: Escaped self-links should be bold
8089 !! options
8090 title=[[Bug462]]
8091 !! wikitext
8092 [[Bu&#103;462]] [[Bug462]]
8093 !! html/php+tidy
8094 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8095 </p>
8096 !! html/parsoid
8097 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8098 !! end
8099
8100 !! test
8101 Self-link to section should not be bold
8102 !! options
8103 title=[[Main Page]]
8104 !! wikitext
8105 [[Main Page#section]]
8106 !! html
8107 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8108 </p>
8109 !! end
8110
8111 !! article
8112 00
8113 !! text
8114 This is 00.
8115 !! endarticle
8116
8117 !!test
8118 Self-link to numeric title
8119 !!options
8120 title=[[0]]
8121 !! wikitext
8122 [[0]]
8123 !! html
8124 <p><a class="mw-selflink selflink">0</a>
8125 </p>
8126 !!end
8127
8128 !!test
8129 Link to numeric-equivalent title
8130 !!options
8131 title=[[0]]
8132 !! wikitext
8133 [[00]]
8134 !! html
8135 <p><a href="/wiki/00" title="00">00</a>
8136 </p>
8137 !!end
8138
8139 !! test
8140 <nowiki> inside a link
8141 !! wikitext
8142 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8143 !! html
8144 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8145 </p>
8146 !! end
8147
8148 !! test
8149 Non-breaking spaces in title
8150 !! wikitext
8151 [[&nbsp; Main &nbsp; Page &nbsp;]]
8152 !! html
8153 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8154 </p>
8155 !!end
8156
8157 # Add new article for the test below so that it doesn't red-link
8158 !! article
8159 Foo bar baz
8160 !! text
8161 boo
8162 !! endarticle
8163
8164 !! test
8165 Multiple spaces in titles should normalize to a single underscore
8166 !! options
8167 parsoid=wt2html,wt2wt
8168 !! wikitext
8169 [[Foo bar baz|x]]
8170 [[Foo bar baz|x]]
8171 [[Foo bar baz|x]]
8172 !! html/php
8173 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8174 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8175 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8176 </p>
8177 !! html/parsoid
8178 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8179 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8180 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8181 </p>
8182 !! end
8183
8184 !! test
8185 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8186 !! options
8187 language=ca
8188 !! wikitext
8189 '''[[Main Page]]'''
8190 !! html
8191 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8192 </p>
8193 !! end
8194
8195 !! test
8196 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8197 !! options
8198 language=ca
8199 !! wikitext
8200 ''[[Main Page]]''
8201 !! html
8202 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8203 </p>
8204 !! end
8205
8206 !! test
8207 Internal link with en linktrail: no apostrophes (T29473)
8208 !! options
8209 language=en
8210 !! wikitext
8211 [[Something]]'nice
8212 !! html
8213 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8214 </p>
8215 !! end
8216
8217 !! test
8218 Internal link with ca linktrail with apostrophes (T29473)
8219 !! options
8220 language=ca
8221 !! wikitext
8222 [[Something]]'nice
8223 !! html
8224 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8225 </p>
8226 !! end
8227
8228 !! test
8229 Internal link with kaa linktrail with apostrophes (T29473)
8230 !! options
8231 language=kaa
8232 !! wikitext
8233 [[Something]]'nice
8234 !! html
8235 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8236 </p>
8237 !! end
8238
8239 !! test
8240 Link with multiple ":" in a subpage-supporting namespace (T65636)
8241 !! wikitext
8242 [[User:Foo/Test/63636:Bar|Test]]
8243 !! html/php
8244 <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>
8245 </p>
8246 !! html/parsoid
8247 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8248 !! end
8249
8250 ## Mainly a sanity check for Parsoid
8251 !! test
8252 Handle title parsing for subpages
8253 !! options
8254 title=[[/123123]]
8255 subpage
8256 !! wikitext
8257 123
8258 !! html/php
8259 <p>123
8260 </p>
8261 !! html/parsoid
8262 <p>123</p>
8263 !! end
8264
8265 !! article
8266 User:Test/123
8267 !! text
8268 test 123
8269 !! endarticle
8270
8271 !! test
8272 Link to a subpage from a namespace other than main
8273 !! options
8274 title=[[User:Test]]
8275 subpage
8276 !! wikitext
8277 [[/123]]
8278 !! html/php
8279 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8280 </p>
8281 !! html/parsoid
8282 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8283 !! end
8284
8285 !! test
8286 Ensure that transclusion titles are not url-decoded
8287 !! options
8288 subpage title=[[Test]]
8289 parsoid=wt2html
8290 !! wikitext
8291 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8292 !! html/php
8293 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8294 </p>
8295 !! html/parsoid
8296 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8297 !! end
8298
8299 !! test
8300 Purely hash wikilink
8301 !! options
8302 title=[[User:Test/123]]
8303 subpage
8304 !! wikitext
8305 [[#a|b]]
8306 !! html/php
8307 <p><a href="#a">b</a>
8308 </p>
8309 !! html/parsoid
8310 <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>
8311 !! end
8312
8313 !! test
8314 Serialization of purely hash wikilink
8315 !! options
8316 title=[[User:Test/123]]
8317 subpage
8318 parsoid=html2wt
8319 !! html/parsoid
8320 <p><a href="#a">[[</a></p>
8321 !! wikitext
8322 [[#a|<nowiki>[[</nowiki>]]
8323 !! html/php
8324 <p><a href="#a">[[</a>
8325 </p>
8326 !! end
8327
8328 !! test
8329 1. Interaction of linktrail and template encapsulation
8330 !! wikitext
8331 {{echo|[[Foo]]}}l
8332 !! html/parsoid
8333 <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>
8334 !! end
8335
8336 !! test
8337 2. Interaction of linktrail and template encapsulation
8338 !! options
8339 parsoid
8340 !! wikitext
8341 {{echo|Some [[Fool]]}}s
8342 !! html
8343 <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>
8344 !! end
8345
8346 !! test
8347 3. Interaction of linktrail and template encapsulation
8348 !! options
8349 parsoid
8350 !! wikitext
8351 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8352 !! html
8353 <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>
8354 !! end
8355
8356 !! article
8357 Söfnuður
8358 !! text
8359 Test.
8360 !! endarticle
8361
8362 !! test
8363 Internal link with is link prefix
8364 !! options
8365 language=is
8366 !! wikitext
8367 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8368 !! html
8369 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8370 </p>
8371 !! end
8372
8373 !! article
8374 Mótmælendatrú
8375 !! text
8376 Test.
8377 !! endarticle
8378
8379 !! test
8380 Internal link with is link trail and link prefix
8381 !! options
8382 language=is
8383 !! wikitext
8384 [[mótmælendatrú|xxx]]ar
8385 [[mótmælendatrú]]ar
8386 mótmælenda[[söfnuður]]
8387 mótmælenda[[söfnuður|söfnuðir]]
8388 mótmælenda[[söfnuður|söfnuðir]]xxx
8389 !! html
8390 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8391 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8392 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8393 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8394 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Parsoid link trail escaping
8400 !! options
8401 parsoid=html2wt,html2html
8402 !! html/parsoid
8403 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8404 !! wikitext
8405 [[apple]]<nowiki/>s
8406 !! end
8407
8408 !! test
8409 Parsoid link prefix escaping
8410 !! options
8411 language=is
8412 parsoid=html2wt,html2html
8413 !! html/parsoid
8414 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8415 !! wikitext
8416 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8417 !! end
8418
8419 !! test
8420 Parsoid link bracket escaping
8421 !! options
8422 parsoid=html2wt,html2html
8423 !! html/parsoid
8424 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8425 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8426 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8427 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8428 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8429 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8430 !! wikitext
8431 [[Test]]
8432
8433 [<nowiki/>[[Test]]]
8434
8435 [[[[Test]]]]
8436
8437 [[[<nowiki/>[[Test]]]]]
8438
8439 [[[[[[Test]]]]]]
8440
8441 [[[[[<nowiki/>[[Test]]]]]]]
8442 !! end
8443
8444 !! test
8445 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8446 !! wikitext
8447 [[Foo| bar]]
8448
8449 [[Foo| ''bar'']]
8450
8451 [http://wp.org foo]
8452
8453 [http://wp.org ''foo'']
8454 !! html
8455 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8456 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8457 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8458 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8459 </p>
8460 !! end
8461
8462 !! test
8463 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8464 !! wikitext
8465 [[Foo|{{echo|a}} b {{echo|c}}]]
8466 !! html/parsoid
8467 <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>
8468 !! end
8469
8470 !! test
8471 Link with angle bracket after anchor
8472 !! config
8473 wgFragmentMode=[ 'html5', 'legacy' ]
8474 !! wikitext
8475 [[Foo#<bar>]]
8476 !! html/php
8477 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8478 </p>
8479 !! html/parsoid
8480 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8481 !! end
8482
8483 !! test
8484 Link with angle bracket after anchor (legacy)
8485 !! config
8486 wgFragmentMode=[ 'legacy' ]
8487 !! wikitext
8488 [[Foo#<bar>]]
8489 !! html/php
8490 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8491 </p>
8492 !! end
8493
8494 ###
8495 ### Interwiki links (see maintenance/interwiki.sql)
8496 ###
8497
8498 !! test
8499 Inline interwiki link
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[MeatBall:SoftSecurity]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8509 !! end
8510
8511 !! test
8512 Inline interwiki link with empty title (T4372)
8513 !! options
8514 parsoid=wt2html,wt2wt,html2html
8515 !! wikitext
8516 [[MeatBall:]]
8517 !! html/php
8518 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8522 !! end
8523
8524 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8525 !! test
8526 Interwiki link encoding conversion (T3636)
8527 !! options
8528 parsoid=wt2html,wt2wt
8529 !! wikitext
8530 *[[Wikipedia:ro:Olteni&#0355;a]]
8531 *[[Wikipedia:ro:Olteni&#355;a]]
8532 !! html
8533 <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>
8534 <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>
8535
8536 !! html/php+tidy
8537 <ul>
8538 <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>
8539 <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>
8540 </ul>
8541 !! html/parsoid
8542 <ul>
8543 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8544 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8545 </ul>
8546 !! end
8547
8548 !! test
8549 Interwiki link with fragment (T4130)
8550 !! wikitext
8551 [[MeatBall:SoftSecurity#foo]]
8552 !! html
8553 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8554 </p>
8555 !! end
8556
8557 !! test
8558 Link scenarios with escaped fragments
8559 !! config
8560 wgFragmentMode=[ 'html5', 'legacy' ]
8561 !! wikitext
8562 [[#Is this great?]]
8563 [[Foo#Is this great?]]
8564 [[meatball:Foo#Is this great?]]
8565 !! html/php
8566 <p><a href="#Is_this_great?">#Is this great?</a>
8567 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8568 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8572 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8573 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8574 !! end
8575
8576 !! test
8577 Link scenarios with escaped fragments (legacy)
8578 !! config
8579 wgFragmentMode=[ 'legacy' ]
8580 !! wikitext
8581 [[#Is this great?]]
8582 [[Foo#Is this great?]]
8583 [[meatball:Foo#Is this great?]]
8584 !! html/php
8585 <p><a href="#Is_this_great.3F">#Is this great?</a>
8586 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8587 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8588 </p>
8589 !! end
8590
8591 # Ideally the wikipedia: prefix here should be proto-relative too
8592 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8593 # define the 'en' prefix, and originally the test used 'wikipedia',
8594 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8595 # article.
8596 !! test
8597 Different interwiki prefixes mapping to the same URL
8598 !! wikitext
8599 [[:en:Foo]]
8600
8601 [[:en:Foo|Foo]]
8602
8603 [[wikipedia:Foo]]
8604
8605 [[:wikipedia:Foo|Foo]]
8606
8607 [[wikipedia:en:Foo]]
8608
8609 [[:wikipedia:en:Foo]]
8610
8611 [[ wikiPEdia :Foo]]
8612 !! html/parsoid
8613 <p><a rel="mw:WikiLink/Interwiki" 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>
8614
8615 <p><a rel="mw:WikiLink/Interwiki" 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>
8616
8617 <p><a rel="mw:WikiLink/Interwiki" 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>
8618
8619 <p><a rel="mw:WikiLink/Interwiki" 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>
8620
8621 <p><a rel="mw:WikiLink/Interwiki" 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>
8622
8623 <p><a rel="mw:WikiLink/Interwiki" 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>
8624
8625 <p><a rel="mw:WikiLink/Interwiki" 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>
8626 !! end
8627
8628 !! test
8629 Interwiki links that cannot be represented in wiki syntax
8630 !! wikitext
8631 [[meatball:ok]]
8632 [[meatball:ok#foo|ok with fragment]]
8633 [[meatball:ok_as_well?|ok ending with ? mark]]
8634 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8635 [http://de.wikipedia.org/wiki/#foo is just fragment]
8636
8637 !! html/php
8638 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8639 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8640 <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>
8641 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8642 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8643 </p>
8644 !! html/parsoid
8645 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8646 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8647 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8648 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8649 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8650 !! end
8651
8652 !! test
8653 Interwiki links: trail
8654 !! wikitext
8655 [[wikipedia:Foo|Ba]]r
8656 !! html/php
8657 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8658 </p>
8659 !! html/parsoid
8660 <p><a rel="mw:WikiLink/Interwiki" 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>
8661 !! end
8662
8663 !! test
8664 Local interwiki link
8665 !! options
8666 parsoid=wt2html,wt2wt,html2html
8667 !! wikitext
8668 [[local:Template:Foo]]
8669 !! html/php
8670 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8671 </p>
8672 !! html/parsoid
8673 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8674 !! end
8675
8676 # Parsoid does not mark self-links, by design.
8677 !! test
8678 Local interwiki link: self-link to current page
8679 !! options
8680 title=[[Main Page]]
8681 parsoid=wt2html,wt2wt,html2html
8682 !! wikitext
8683 [[local:Main Page]]
8684 !! html/php
8685 <p><a class="mw-selflink selflink">local:Main Page</a>
8686 </p>
8687 !! html/parsoid
8688 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8689 !! end
8690
8691 !! test
8692 Local interwiki link: prefix only (T66167)
8693 !! options
8694 parsoid=wt2html,wt2wt,html2html
8695 !! wikitext
8696 [[local:]]
8697 !! html/php
8698 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8699 </p>
8700 !! html/parsoid
8701 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8702 !! end
8703
8704 !! test
8705 Local interwiki link: with additional interwiki prefix (T63357)
8706 !! options
8707 parsoid=wt2html,wt2wt,html2html
8708 !! wikitext
8709 [[local:meatball:Hello]]
8710 !! html/php
8711 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8712 </p>
8713 !! html/parsoid
8714 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8715 !! end
8716
8717 !! test
8718 Multiple local interwiki link prefixes
8719 !! wikitext
8720 [[local:local:local:local:mi:local:Foo]]
8721 !! options
8722 parsoid=wt2html,wt2wt,html2html
8723 !! html/php
8724 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8725 </p>
8726 !! html/parsoid
8727 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8728 !! end
8729
8730 ###
8731 ### Interlanguage links
8732 ### Language links (so that searching for '### language' matches..)
8733 ###
8734
8735 !! test
8736 Interlanguage link
8737 !! wikitext
8738 Blah blah blah
8739 [[zh:Chinese]]
8740 !! html/php
8741 <p>Blah blah blah
8742 </p>
8743 !! html/parsoid
8744 <p>Blah blah blah</p>
8745 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8746 !! end
8747
8748 ## parsoid html2wt will lose the space variations
8749 !! test
8750 Interlanguage link with spacing
8751 !! options
8752 parsoid=wt2html,wt2wt,html2html
8753 !! wikitext
8754 Blah blah blah
8755 [[ zh : Chinese ]]
8756 !! html/php
8757 <p>Blah blah blah
8758 </p>
8759 !! html/parsoid
8760 <p>Blah blah blah</p>
8761 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8762 !! end
8763
8764 !! test
8765 Double interlanguage link
8766 !! wikitext
8767 Blah blah blah
8768 [[es:Spanish]]
8769 [[zh:Chinese]]
8770 !! html/php
8771 <p>Blah blah blah
8772 </p>
8773 !! html/parsoid
8774 <p>Blah blah blah</p>
8775 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8776 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8777 !! end
8778
8779 ## parsoid html2wt will lose the space variations
8780 !! test
8781 Interlanguage link variations
8782 !! options
8783 parsoid=wt2html,wt2wt,html2html
8784 !! wikitext
8785 Blah blah blah
8786 [[ es :Spanish]]
8787 [[ ZH :Chinese]]
8788 [[es:Foo_bar]]
8789 !! html/php
8790 <p>Blah blah blah
8791 </p>
8792 !! html/parsoid
8793 <p>Blah blah blah</p>
8794 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8795 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8796 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8797 !! end
8798
8799 !! test
8800 Escaping of interlanguage links (T129218, T156308)
8801 !! wikitext
8802 Blah blah blah
8803 [[:es:Spanish]]
8804 [[ : zh : Chinese ]]
8805 !! html/php
8806 <p>Blah blah blah
8807 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8808 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8809 </p>
8810 !! html/parsoid
8811 <p>Blah blah blah
8812 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8813 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8814 !! end
8815
8816 !! test
8817 Multiple colons escaping interlanguage links
8818 !! options
8819 parsoid=wt2html
8820 !! wikitext
8821 [[:es:Spanish]]
8822 [[::es:Spanish]]
8823 [[:::es:Spanish]]
8824 !! html/php
8825 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8826 [[::es:Spanish]]
8827 [[:::es:Spanish]]
8828 </p>
8829 !! html/parsoid
8830 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8831 [[::es:Spanish]]
8832 [[:::es:Spanish]]</p>
8833 !! end
8834
8835 ## parsoid html2wt will normalize the space to _
8836 !! test
8837 Space and question mark encoding in interlanguage links (T95473)
8838 !! options
8839 parsoid=wt2html,wt2wt,html2html
8840 !! wikitext
8841 Blah blah blah
8842 [[es:Foo bar?]]
8843 !! html/php
8844 <p>Blah blah blah
8845 </p>
8846 !! html/parsoid
8847 <p>Blah blah blah</p>
8848 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8849 !! end
8850
8851 !! test
8852 Interlanguage link, with prefix links
8853 !! options
8854 language=ln
8855 !! wikitext
8856 Blah blah blah
8857 [[zh:Chinese]]
8858 !! html/php
8859 <p>Blah blah blah
8860 </p>
8861 !! html/parsoid
8862 <p>Blah blah blah</p>
8863 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8864 !! end
8865
8866 !! test
8867 Double interlanguage link, with prefix links (T10897)
8868 !! options
8869 language=ln
8870 !! wikitext
8871 Blah blah blah
8872 [[es:Spanish]]
8873 [[zh:Chinese]]
8874 !! html/php
8875 <p>Blah blah blah
8876 </p>
8877 !! html/parsoid
8878 <p>Blah blah blah</p>
8879 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8880 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8881 !! end
8882
8883 !! test
8884 "Extra" interlanguage links (T34189 / gerrit 111390)
8885 !! wikitext
8886 Blah blah blah
8887 [[mul:Article]]
8888 !! html/php
8889 <p>Blah blah blah
8890 </p>
8891 !! html/parsoid
8892 <p>Blah blah blah</p>
8893 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8894 !! end
8895
8896 ## PHP parser tests script needs an update
8897 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8898 !! test
8899 Language links render as inline links if $wgInterwikiMagic=false
8900 !! options
8901 wgInterwikiMagic=false
8902 parsoid=wt2html,wt2wt,html2html
8903 !! wikitext
8904 Blah blah blah
8905 [[zh:Chinese]]
8906 !! html/parsoid
8907 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8908 !! end
8909
8910 ## PHP parser tests script needs an update
8911 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8912 !! test
8913 Language links render as inline links in the Talk namespace
8914 !! options
8915 title=Talk:Foo
8916 parsoid=wt2html,wt2wt,html2html
8917 !! wikitext
8918 Blah blah blah
8919 [[zh:Chinese]]
8920 !! html/parsoid
8921 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8922 !! end
8923
8924 !! test
8925 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8926 !! options
8927 language=ln
8928 !! wikitext
8929 [[WW&nbsp;II]]
8930 !! html
8931 <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>
8932 </p>
8933 !! end
8934
8935 !! test
8936 Parsoid T55221: Wikilinks should be properly entity-escaped
8937 !! options
8938 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8939 !! html/parsoid
8940 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8941 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8942 !! wikitext
8943 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8944
8945 He&amp;nbsp;llo He&amp;nbsp;llo
8946 !! html/php
8947 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8948 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8949 </p>
8950 !! end
8951
8952 # html2wt will fail because of title normalization without data-parsoid
8953 !! test
8954 Parsoid: handle constructor well
8955 !! options
8956 parsoid=wt2html,wt2wt
8957 !! wikitext
8958 [[constructor]]
8959
8960 [[constructor:foo]]
8961 !! html/php
8962 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8963 </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>
8964 </p>
8965 !! html/parsoid
8966 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8967
8968 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8969 !! end
8970
8971 !! article
8972 ko:
8973 !! text
8974 Test.
8975 !! endarticle
8976
8977 # Note that `ko` isn't a known interlanguage prefix
8978 !! test
8979 Parsoid: recognize interlanguage links without a target page
8980 !! options
8981 ill
8982 !! wikitext
8983 [[es:]]
8984
8985 [[ko:]]
8986 !! html/php
8987 es:
8988 !! html/parsoid
8989 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8990
8991 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8992 !! end
8993
8994 # Note that `ko` isn't a known interwiki prefix
8995 !! test
8996 Parsoid: recognize interwiki links without a target page
8997 !! options
8998 parsoid=wt2html,wt2wt,html2html
8999 !! wikitext
9000 [[:es:]]
9001
9002 [[:ko:]]
9003 !! html/php
9004 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9005 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9006 </p>
9007 !! html/parsoid
9008 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9009 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9010 !! end
9011
9012 !! test
9013 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9014 !! wikitext
9015 [[mi:Foo]]
9016 !! html/php
9017 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9018 </p>
9019 !! html/parsoid
9020 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9021 !! end
9022
9023 !! test
9024 Interlanguage link with preceding local interwiki link (T70085)
9025 !! options
9026 parsoid=wt2html,wt2wt,html2html
9027 !! wikitext
9028 Blah blah blah
9029 [[local:es:Spanish]]
9030 !! html/php
9031 <p>Blah blah blah
9032 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9033 </p>
9034 !! html/parsoid
9035 <p>Blah blah blah
9036 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9037 !! end
9038
9039 !! test
9040 Looks like an interlanguage link, but is actually a local interwiki
9041 !! options
9042 parsoid=wt2html,wt2wt,html2html
9043 !! wikitext
9044 Blah blah blah
9045 [[mi:Template:Foo]]
9046 !! html/php
9047 <p>Blah blah blah
9048 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9049 </p>
9050 !! html/parsoid
9051 <p>Blah blah blah
9052 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9053 !! end
9054
9055 ###
9056 ### Redirects, Parsoid-only
9057 ###
9058
9059 !! test
9060 1. Simple redirect to page
9061 !! wikitext
9062 #REDIRECT [[Main Page]]
9063 !! html/parsoid
9064 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9065 !! end
9066
9067 !! test
9068 2. Other redirect variants
9069 !! wikitext
9070 #REDIRECT [[Main_Page]]
9071 !! html/parsoid
9072 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9073 !! end
9074
9075 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9076 # This tests the Parsoid bail-out code.
9077 !! test
9078 3. Other redirect variants
9079 !! options
9080 parsoid=wt2html
9081 !! wikitext
9082 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9083 !! html/parsoid
9084 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9085 !! end
9086
9087 !! test
9088 4. Redirect to a templated destination
9089 !! wikitext
9090 #REDIRECT [[{{echo|Foo}}bar]]
9091 !! html/parsoid
9092 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9093 !! end
9094
9095 !! test
9096 Empty redirect
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 #REDIRECT [[]]
9101 !! html/parsoid
9102 <ol>
9103 <li>REDIRECT [[]]</li></ol>
9104 !! end
9105
9106 !! test
9107 Optional colon in #REDIRECT
9108 !! options
9109 # the colon is archaic syntax. we support it for wt2html, but we
9110 # don't care that it roundtrips back to the modern syntax.
9111 parsoid=wt2html,html2html
9112 !! wikitext
9113 #REDIRECT:[[Main Page]]
9114 !! html/parsoid
9115 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9116 !! end
9117
9118 !! test
9119 Whitespace in #REDIRECT with optional colon
9120 !! options
9121 # the colon and gratuitous whitespace is archaic syntax. we support
9122 # it for wt2html, but we don't care that it roundtrips back to the
9123 # modern syntax (without extra whitespace)
9124 parsoid=wt2html,html2html
9125 !! wikitext
9126
9127 #REDIRECT
9128 :
9129 [[Main Page]]
9130 !! html/parsoid
9131 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9132 !! end
9133
9134 !! test
9135 Piped link in #REDIRECT
9136 !! options
9137 # content after piped link is ignored. we support this syntax,
9138 # but don't care that the piped link is lost when we roundtrip this.
9139 parsoid=wt2html
9140 !! wikitext
9141 #REDIRECT [[Main Page|bar]]
9142 !! html/parsoid
9143 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9144 !! end
9145
9146 !! test
9147 Redirect to category (T104502)
9148 !! options
9149 parsoid=wt2html,wt2wt
9150 !! wikitext
9151 #REDIRECT [[Category:Foo]]
9152 !! html/parsoid
9153 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9154 !! end
9155
9156 !! test
9157 Redirect to category with URL encoding (T104502)
9158 !! options
9159 parsoid=wt2html
9160 !! wikitext
9161 #REDIRECT [[Category%3AFoo]]
9162 !! html/parsoid
9163 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9164 !! end
9165
9166 !! test
9167 Redirect to category page
9168 !! wikitext
9169 #REDIRECT [[:Category:Foo]]
9170 !! html/parsoid
9171 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9172 !! end
9173
9174 !! test
9175 Redirect to image page (1)
9176 !! wikitext
9177 #REDIRECT [[File:Wiki.png]]
9178 !! html/parsoid
9179 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9180 !! end
9181
9182 !! test
9183 Redirect to image page (2)
9184 !! wikitext
9185 #REDIRECT [[Image:Wiki.png]]
9186 !! html/parsoid
9187 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9188 !! end
9189
9190 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9191 # Next test confirms this.
9192 !! test
9193 Redirect to language (1) (T104918)
9194 !! options
9195 parsoid=wt2html,wt2wt,html2html
9196 !! wikitext
9197 #REDIRECT [[en:File:Wiki.png]]
9198 !! html/parsoid
9199 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9200 !! end
9201
9202 !! test
9203 Redirect to language (2) (T104918)
9204 !! wikitext
9205 #REDIRECT [[:en:File:Wiki.png]]
9206 !! html/parsoid
9207 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9208 !! end
9209
9210 !! test
9211 Redirect to interwiki (T104918)
9212 !! wikitext
9213 #REDIRECT [[meatball:File:Wiki.png]]
9214 !! html/parsoid
9215 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9216 !! end
9217
9218 !! test
9219 Non-English #REDIRECT
9220 !! options
9221 language=is
9222 !! wikitext
9223 #TILVÍSUN [[Main Page]]
9224 !! html/parsoid
9225 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9226 !! end
9227
9228 !! test
9229 Redirect syntax under text isn't considered a redirect
9230 !! wikitext
9231 some text
9232 #redirect [[Main Page]]
9233 !! html/parsoid
9234 <p>some text</p>
9235 <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>
9236 !! end
9237
9238 !! test
9239 New redirect
9240 !! options
9241 parsoid=html2wt
9242 !! html/parsoid
9243 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9244 !! wikitext
9245 #REDIRECT [[Foo]]
9246 Foo
9247 !! end
9248
9249 !! test
9250 Redirect followed by block on the same line
9251 !! options
9252 parsoid=wt2html
9253 !! wikitext
9254 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9255 !! html/parsoid
9256 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9257 !! end
9258
9259 !! test
9260 Redirect followed by a newline
9261 !! wikitext
9262 #REDIRECT [[Main Page]]
9263 A newline
9264 !! html/parsoid
9265 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9266 <p>A newline</p>
9267 !! end
9268
9269 !! test
9270 Redirect followed by multiple newlines
9271 !! wikitext
9272 #REDIRECT [[Main Page]]
9273
9274
9275 A newline
9276 !! html/parsoid
9277 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9278
9279 <p><br/>
9280 A newline</p>
9281 !! end
9282
9283 !! test
9284 Drop duplicate redirects
9285 !! options
9286 parsoid=html2wt
9287 !! html/parsoid
9288 <link rel="mw:PageProp/redirect" href="./Foo"/>
9289 <link rel="mw:PageProp/redirect" href="./Bar"/>
9290 <link rel="mw:PageProp/redirect" href="./Baz"/>
9291 !! wikitext
9292 #REDIRECT [[Foo]]
9293 !! end
9294
9295 ##
9296 ## XHTML tidiness
9297 ###
9298
9299 !! test
9300 <br> to <br />
9301 !! wikitext
9302 1<br>2<br />3
9303 !! html
9304 <p>1<br />2<br />3
9305 </p>
9306 !! end
9307
9308 !! test
9309 Broken br tag sanitization
9310 !! wikitext
9311 </br>
9312 !! html/php
9313 <p>&lt;/br&gt;
9314 </p>
9315 !! end
9316
9317 # TODO: Fix html2html mode (T53055)!
9318 !! test
9319 Parsoid: Broken br tag recognition
9320 !! options
9321 parsoid=wt2html
9322 !! wikitext
9323 </br>
9324
9325 <br/ >
9326 !! html+tidy
9327 <p><br />
9328 </p><p><br />
9329 </p>
9330 !! end
9331
9332 !! test
9333 Incorrecly removing closing slashes from correctly formed XHTML
9334 !! wikitext
9335 <br style="clear:both;" />
9336 !! html
9337 <p><br style="clear:both;" />
9338 </p>
9339 !! end
9340
9341 !! test
9342 Failing to transform badly formed HTML into correct XHTML
9343 !! wikitext
9344 <br style="clear: left;">
9345 <br style="clear: right;">
9346 <br style="clear: both;">
9347 !! html
9348 <p><br style="clear: left;" />
9349 <br style="clear: right;" />
9350 <br style="clear: both;" />
9351 </p>
9352 !!end
9353
9354 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9355 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9356 !! test
9357 Handling html with a div self-closing tag
9358 !! wikitext
9359 <div title />
9360 <div title/>
9361 <div title/ >
9362 <div title=bar />
9363 <div title=bar/>
9364 <div title=bar/ >
9365 !! html/php
9366 <p>&lt;div title /&gt;
9367 &lt;div title/&gt;
9368 </p>
9369 <div>
9370 <p>&lt;div title=bar /&gt;
9371 &lt;div title=bar/&gt;
9372 </p>
9373 <div title="bar/"></div>
9374 </div>
9375
9376 !! html/parsoid
9377 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9378 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9379 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9380 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9381 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9382 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9383 !! end
9384
9385 !! test
9386 Handling html with a br self-closing tag
9387 !! wikitext
9388 <br title />
9389 <br title/>
9390 <br title/ >
9391 <br title=bar />
9392 <br title=bar/>
9393 <br title=bar/ >
9394 !! html/php
9395 <p><br title="" />
9396 <br title="" />
9397 <br />
9398 <br title="bar" />
9399 <br title="bar" />
9400 <br title="bar/" />
9401 </p>
9402 !! html/parsoid
9403 <p><br title="" />
9404 <br title="" />
9405 <br title="" />
9406 <br title="bar" />
9407 <br title="bar" />
9408 <br title="bar/" />
9409 </p>
9410 !! end
9411
9412 !! test
9413 Horizontal ruler (should it add that extra space?)
9414 !! wikitext
9415 <hr>
9416 <hr >
9417 foo <hr
9418 > bar
9419 !! html+tidy
9420 <hr />
9421 <hr /><p>
9422 foo </p><hr /><p> bar
9423 </p>
9424 !! end
9425
9426 !! test
9427 Horizontal ruler -- 4+ dashes render hr
9428 !! wikitext
9429 ----
9430 !! html
9431 <hr />
9432
9433 !! end
9434
9435 !! test
9436 Horizontal ruler -- eats additional dashes on the same line
9437 !! wikitext
9438 ---------
9439 !! html
9440 <hr />
9441
9442 !! end
9443
9444 !! test
9445 Horizontal ruler -- does not collapse dashes on consecutive lines
9446 !! wikitext
9447 ----
9448 ----
9449 !! html
9450 <hr />
9451 <hr />
9452
9453 !! end
9454
9455 !! test
9456 Horizontal ruler -- <4 dashes render as plain text
9457 !! wikitext
9458 ---
9459 !! html
9460 <p>---
9461 </p>
9462 !! end
9463
9464 !! test
9465 Horizontal ruler -- Supports content following dashes on same line
9466 !! wikitext
9467 ---- Foo
9468 !! html
9469 <hr /> Foo
9470
9471 !! html+tidy
9472 <hr /><p> Foo
9473 </p>
9474 !! end
9475
9476 ###
9477 ### Block-level elements
9478 ###
9479 !! test
9480 Common list
9481 !! wikitext
9482 *Common list
9483 *item 2
9484 *item 3
9485 !! html
9486 <ul><li>Common list</li>
9487 <li>item 2</li>
9488 <li>item 3</li></ul>
9489
9490 !! end
9491
9492 !! test
9493 Numbered list
9494 !! wikitext
9495 #Numbered list
9496 #item 2
9497 #item 3
9498 !! html
9499 <ol><li>Numbered list</li>
9500 <li>item 2</li>
9501 <li>item 3</li></ol>
9502
9503 !! end
9504
9505 !! test
9506 Mixed list
9507 !! wikitext
9508 *Mixed list
9509 *#with numbers
9510 **and bullets
9511 *#and numbers
9512 *bullets again
9513 **bullet level 2
9514 ***bullet level 3
9515 ***#Number on level 4
9516 **bullet level 2
9517 **#Number on level 3
9518 **#Number on level 3
9519 *#number level 2
9520 *Level 1
9521 ***Level 3
9522 #**Level 3, but ordered
9523 !! html
9524 <ul><li>Mixed list
9525 <ol><li>with numbers</li></ol>
9526 <ul><li>and bullets</li></ul>
9527 <ol><li>and numbers</li></ol></li>
9528 <li>bullets again
9529 <ul><li>bullet level 2
9530 <ul><li>bullet level 3
9531 <ol><li>Number on level 4</li></ol></li></ul></li>
9532 <li>bullet level 2
9533 <ol><li>Number on level 3</li>
9534 <li>Number on level 3</li></ol></li></ul>
9535 <ol><li>number level 2</li></ol></li>
9536 <li>Level 1
9537 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9538 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9539
9540 !! end
9541
9542 !! test
9543 1. Nested mixed wikitext and html list
9544 !! wikitext
9545 *hi
9546 *<ul><li>ho</li></ul>
9547 *hi
9548 **ho
9549 !! html/php
9550 <ul><li>hi</li>
9551 <li><ul><li>ho</li></ul></li>
9552 <li>hi
9553 <ul><li>ho</li></ul></li></ul>
9554
9555 !! html/parsoid
9556 <ul><li>hi</li>
9557 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9558 <li>hi
9559 <ul><li>ho</li></ul></li></ul>
9560 !! end
9561
9562 !! test
9563 2. Nested mixed wikitext and html list (incompatible)
9564 !! wikitext
9565 ;hi
9566 :{{echo|<li>ho</li>}}
9567 !! html/php
9568 <dl><dt>hi</dt>
9569 <dd><li>ho</li></dd></dl>
9570
9571 !! html/parsoid
9572 <dl><dt>hi</dt>
9573 <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>
9574 !! end
9575
9576 !! test
9577 Nested lists 1
9578 !! wikitext
9579 *foo
9580 **bar
9581 !! html
9582 <ul><li>foo
9583 <ul><li>bar</li></ul></li></ul>
9584
9585 !! end
9586
9587 !! test
9588 Nested lists 2
9589 !! wikitext
9590 **foo
9591 *bar
9592 !! html
9593 <ul><li><ul><li>foo</li></ul></li>
9594 <li>bar</li></ul>
9595
9596 !! end
9597
9598 !! test
9599 Nested lists 3 (first element empty)
9600 !! wikitext
9601 *
9602 **bar
9603 !! html
9604 <ul><li>
9605 <ul><li>bar</li></ul></li></ul>
9606
9607 !! end
9608
9609 !! test
9610 Nested lists 4 (first element empty)
9611 !! wikitext
9612 **
9613 *bar
9614 !! html
9615 <ul><li><ul><li></li></ul></li>
9616 <li>bar</li></ul>
9617
9618 !! end
9619
9620 !! test
9621 Nested lists 5 (both elements empty)
9622 !! wikitext
9623 **
9624 *
9625 !! html
9626 <ul><li><ul><li></li></ul></li>
9627 <li></li></ul>
9628
9629 !! end
9630
9631 !! test
9632 Nested lists 6 (both elements empty)
9633 !! wikitext
9634 *
9635 **
9636 !! html
9637 <ul><li>
9638 <ul><li></li></ul></li></ul>
9639
9640 !! end
9641
9642 !! test
9643 Nested lists 7 (skip initial nesting levels)
9644 !! wikitext
9645 ***foo
9646 !! html
9647 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9648
9649 !! end
9650
9651 !! test
9652 Nested lists 8 (multiple nesting transitions)
9653 !! wikitext
9654 *foo
9655 ***bar
9656 **baz
9657 *boo
9658 !! html
9659 <ul><li>foo
9660 <ul><li><ul><li>bar</li></ul></li>
9661 <li>baz</li></ul></li>
9662 <li>boo</li></ul>
9663
9664 !! end
9665
9666 !! test
9667 Nested lists 9 (extension interaction)
9668 !! options
9669 parsoid
9670 !! wikitext
9671 *<references />
9672 !! html/parsoid
9673 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9674 !! end
9675
9676 !! test
9677 1. Lists with start-of-line-transparent tokens before bullets: Comments
9678 !! wikitext
9679 *foo
9680 *<!--cmt-->bar
9681 <!--cmt-->*baz
9682 !! html
9683 <ul><li>foo</li>
9684 <li>bar</li>
9685 <li>baz</li></ul>
9686
9687 !! end
9688
9689 !! test
9690 2. Lists with start-of-line-transparent tokens before bullets: Template close
9691 !! wikitext
9692 *foo {{echo|bar
9693 }}*baz
9694 !! html
9695 <ul><li>foo bar</li>
9696 <li>baz</li></ul>
9697
9698 !! end
9699
9700 !! test
9701 List items are not parsed correctly following a <pre> block (T2785)
9702 !! wikitext
9703 *<pre>foo</pre>
9704 *<pre>bar</pre>
9705 *zar
9706 !! html/php
9707 <ul><li><pre>foo</pre></li>
9708 <li><pre>bar</pre></li>
9709 <li>zar</li></ul>
9710
9711 !! html/parsoid
9712 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9713 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9714 <li>zar</li></ul>
9715 !! end
9716
9717 # FIXME: Might benefit from a html/parsoid since this has a template
9718 !! test
9719 List items from template
9720 !! wikitext
9721
9722 {{inner list}}
9723 *item 2
9724
9725 *item 0
9726 {{inner list}}
9727 *item 2
9728
9729 *item 0
9730 *notSOL{{inner list}}
9731 *item 2
9732 !! html
9733 <ul><li>item 1</li>
9734 <li>item 2</li></ul>
9735 <ul><li>item 0</li>
9736 <li>item 1</li>
9737 <li>item 2</li></ul>
9738 <ul><li>item 0</li>
9739 <li>notSOL</li>
9740 <li>item 1</li>
9741 <li>item 2</li></ul>
9742
9743 !! end
9744
9745 !! test
9746 List interrupted by empty line or heading
9747 !! wikitext
9748 *foo
9749
9750 **bar
9751 ==A heading==
9752 *Another list item
9753 !! html
9754 <ul><li>foo</li></ul>
9755 <ul><li><ul><li>bar</li></ul></li></ul>
9756 <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>
9757 <ul><li>Another list item</li></ul>
9758
9759 !!end
9760
9761 !!test
9762 Multiple list tags generated by templates
9763 !! wikitext
9764 {{echo|<li>}}a
9765 {{echo|<li>}}b
9766 {{echo|<li>}}c
9767 !! html
9768 <li>a
9769 <li>b
9770 <li>c</li>
9771 </li>
9772 </li>
9773
9774 !! html+tidy
9775 <li>a
9776 </li><li>b
9777 </li><li>c
9778 </li>
9779 !! html/parsoid
9780 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
9781 </li><li about="#mwt1">b
9782 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9783 !!end
9784
9785 !!test
9786 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9787 !! wikitext
9788 *a
9789 <!--This line will NOT split the list-->
9790 *b
9791 <!--This line will NOT split the list either-->
9792 *c
9793 <!--foo--> <!----> <!--This line NOT split the list either-->
9794 *d
9795 !! html
9796 <ul><li>a</li>
9797 <li>b</li>
9798 <li>c</li>
9799 <li>d</li></ul>
9800
9801 !!end
9802
9803 !!test
9804 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9805 !! wikitext
9806 *a
9807 <!--This line will NOT split the list-->
9808 *b
9809 <!--This line will NOT split the list either-->
9810 *c
9811 <!--foo--> <!----> <!--This line NOT split the list
9812 either-->
9813 *d
9814 !! html
9815 <ul><li>a</li>
9816 <li>b</li>
9817 <li>c</li>
9818 <li>d</li></ul>
9819
9820 !!end
9821
9822 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9823 # That pass could possibly be removed.
9824 !!test
9825 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9826 !!options
9827 parsoid=wt2html,wt2wt
9828 !! wikitext
9829 *foo
9830 *<li>li-hack
9831 *{{echo|<li>templated li-hack}}
9832 *<!--foo--><li> unsupported li-hack with preceding comments
9833
9834 <ul>
9835 <li><li>not a li-hack
9836 </li>
9837 </ul>
9838 !! html+tidy
9839 <ul><li>foo</li>
9840 <li class="mw-empty-elt"></li><li>li-hack</li>
9841 <li class="mw-empty-elt"></li><li>templated li-hack</li>
9842 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
9843 <ul>
9844 <li class="mw-empty-elt"></li><li>not a li-hack
9845 </li>
9846 </ul>
9847 !! html/parsoid
9848 <ul><li> foo</li>
9849 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
9850 <li 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;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
9851 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
9852
9853 <ul data-parsoid='{"stx":"html"}'>
9854 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9855 </li>
9856 </ul>
9857
9858 !!end
9859
9860 !! test
9861 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9862 !! options
9863 parsoid
9864 !! wikitext
9865 #foo
9866 ##bar
9867 *foo
9868 **bar
9869 :foo
9870 ::bar
9871 !! html
9872 <ol>
9873 <li>foo<ol>
9874 <li>bar</li>
9875 </ol></li>
9876 </ol><ul>
9877 <li>foo<ul>
9878 <li>bar</li>
9879 </ul></li>
9880 </ul><dl>
9881 <dd>foo<dl>
9882 <dd>bar</dd>
9883 </dl></dd>
9884 </dl>
9885 !! end
9886
9887 !! test
9888 Parsoid: Test of whitespace serialization with Templated bullets
9889 !! options
9890 parsoid
9891 !! wikitext
9892 * {{bullet}}
9893 !! html/parsoid
9894 <ul>
9895 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9896 </ul>
9897 !! end
9898
9899 # ------------------------------------------------------------------------
9900 # The next set of tests are about Parsoid's ability to handle badly nested
9901 # tags (parse, minimize scope of fixup, and roundtrip back)
9902 # ------------------------------------------------------------------------
9903
9904 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9905 # Parsoid's list handling is more aware of block structure.
9906 !! test
9907 Unbalanced closing block tags break a list
9908 !! wikitext
9909 <div>
9910 *a</div><div>
9911 *b</div>
9912 !! html+tidy
9913 <div>
9914 <ul><li>a</li></ul></div><div>
9915 <li>b</li></div>
9916 !! html/parsoid
9917 <div><ul>
9918 <li>a</li>
9919 </ul></div>
9920 <div><ul>
9921 <li>b</li>
9922 </ul></div>
9923 !! end
9924
9925 !! test
9926 Unbalanced closing non-block tags don't break a list
9927 !! wikitext
9928 <span>
9929 *a</span><span>
9930 *b</span>
9931 !! html/php+tidy
9932 <p><span>
9933 </span></p>
9934 <ul><li>a<span></span></li>
9935 <li>b</li></ul>
9936 !! html/parsoid
9937 <span>
9938 <ul>
9939 <li>a<span></span></li>
9940 <li>b</li>
9941 </ul>
9942 </span>
9943 !! end
9944
9945 # Parsoid does some post-dom-building cleanup
9946 # which is why its output differs from Remex.
9947 !! test
9948 Unclosed formatting tags that straddle lists are closed and reopened
9949 !! options
9950 parsoid=wt2html,wt2wt,html2html
9951 !! wikitext
9952 #<s> a
9953 #b </s>
9954 !! html/php+tidy
9955 <ol><li><s> a</s></li><s>
9956 </s><li><s>b </s></li></ol>
9957 !! html/parsoid
9958 <ol><li><s> a</s></li>
9959 <li><s>b </s></li></ol>
9960 !! end
9961
9962 # Output is ugly because of all the misnested tag fixups.
9963 # Remex is wrapping p-tags around empty elements.
9964 # Parsoid has special-case handling of this pattern of
9965 # wrapping lists in formatting tags.
9966 # FIXME: Should we remove this code from Parsoid? Or add
9967 # special support in Remex? If the latter, maybe just wait
9968 # for Parsoid to become the default parser.
9969 # See T70395.
9970 !!test
9971 1. List embedded in a formatting tag
9972 !! wikitext
9973 <small>
9974 *foo
9975 </small>
9976 !! html/php+tidy
9977 <p><small>
9978 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
9979 </p>
9980 !! html/parsoid
9981 <small>
9982 <ul>
9983 <li>foo</li>
9984 </ul>
9985 </small>
9986 !!end
9987
9988 # Output is ugly because of all the misnested tag fixups
9989 # Remex is wrapping p-tags around empty elements.
9990 # Parsoid has code that strips useless p-tags.
9991 !!test
9992 2. List embedded in a formatting tag in a misnested way
9993 !! wikitext
9994 <small>
9995 *a
9996 *b</small>
9997 !! html/php+tidy
9998 <p><small>
9999 </small></p><small></small><ul><small><li>a</li>
10000 </small><li><small>b</small></li></ul>
10001 !! html/parsoid
10002 <small></small>
10003 <ul><small>
10004 <li>a</li>
10005 </small>
10006 <li><small>b</small></li>
10007 </ul>
10008 !!end
10009
10010 !! test
10011 Table with missing opening <tr> tag
10012 !! options
10013 parsoid=wt2html,wt2wt
10014 !! wikitext
10015 <table>
10016 <td>foo</td>
10017 </tr>
10018 </table>
10019 !! html+tidy
10020 <table>
10021 <tbody><tr><td>foo</td>
10022 </tr>
10023 </tbody></table>
10024 !! end
10025
10026 ###
10027 ### Magic Words
10028 ###
10029
10030 # Note that the current date is hard-coded as
10031 # 1970-01-01T00:02:03Z (a Thursday)
10032 # when running parser tests. The timezone is also fixed to GMT, so
10033 # local date will be identical to current date.
10034
10035 !! test
10036 Magic Word: {{CURRENTDAY}}
10037 !! wikitext
10038 {{CURRENTDAY}}
10039 !! html
10040 <p>1
10041 </p>
10042 !! end
10043
10044 !! test
10045 Magic Word: {{CURRENTDAY2}}
10046 !! wikitext
10047 {{CURRENTDAY2}}
10048 !! html
10049 <p>01
10050 </p>
10051 !! end
10052
10053 !! test
10054 Magic Word: {{CURRENTDAYNAME}}
10055 !! wikitext
10056 {{CURRENTDAYNAME}}
10057 !! html
10058 <p>Thursday
10059 </p>
10060 !! end
10061
10062 !! test
10063 Magic Word: {{CURRENTDOW}}
10064 !! wikitext
10065 {{CURRENTDOW}}
10066 !! html
10067 <p>4
10068 </p>
10069 !! end
10070
10071 !! test
10072 Magic Word: {{CURRENTMONTH}}
10073 !! wikitext
10074 {{CURRENTMONTH}}
10075 !! html
10076 <p>01
10077 </p>
10078 !! end
10079
10080 !! test
10081 Magic Word: {{CURRENTMONTH1}}
10082 !! wikitext
10083 {{CURRENTMONTH1}}
10084 !! html
10085 <p>1
10086 </p>
10087 !! end
10088
10089 !! test
10090 Magic Word: {{CURRENTMONTHABBREV}}
10091 !! wikitext
10092 {{CURRENTMONTHABBREV}}
10093 !! html
10094 <p>Jan
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{CURRENTMONTHNAME}}
10100 !! wikitext
10101 {{CURRENTMONTHNAME}}
10102 !! html
10103 <p>January
10104 </p>
10105 !! end
10106
10107 !! test
10108 Magic Word: {{CURRENTMONTHNAMEGEN}}
10109 !! wikitext
10110 {{CURRENTMONTHNAMEGEN}}
10111 !! html
10112 <p>January
10113 </p>
10114 !! end
10115
10116 !! test
10117 Magic Word: {{CURRENTTIME}}
10118 !! wikitext
10119 {{CURRENTTIME}}
10120 !! html
10121 <p>00:02
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{CURRENTHOUR}}
10127 !! wikitext
10128 {{CURRENTHOUR}}
10129 !! html
10130 <p>00
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{CURRENTWEEK}} (T6594)
10136 !! wikitext
10137 {{CURRENTWEEK}}
10138 !! html
10139 <p>1
10140 </p>
10141 !! end
10142
10143 !! test
10144 Magic Word: {{CURRENTYEAR}}
10145 !! wikitext
10146 {{CURRENTYEAR}}
10147 !! html
10148 <p>1970
10149 </p>
10150 !! end
10151
10152 !! test
10153 Magic Word: {{CURRENTTIMESTAMP}}
10154 !! wikitext
10155 {{CURRENTTIMESTAMP}}
10156 !! html
10157 <p>19700101000203
10158 </p>
10159 !! end
10160
10161 !! test
10162 Magic Words LOCAL (UTC)
10163 !! wikitext
10164 *{{LOCALMONTH}}
10165 *{{LOCALMONTH1}}
10166 *{{LOCALMONTHNAME}}
10167 *{{LOCALMONTHNAMEGEN}}
10168 *{{LOCALMONTHABBREV}}
10169 *{{LOCALDAY}}
10170 *{{LOCALDAY2}}
10171 *{{LOCALDAYNAME}}
10172 *{{LOCALYEAR}}
10173 *{{LOCALTIME}}
10174 *{{LOCALHOUR}}
10175 *{{LOCALWEEK}}
10176 *{{LOCALDOW}}
10177 *{{LOCALTIMESTAMP}}
10178 !! html
10179 <ul><li>01</li>
10180 <li>1</li>
10181 <li>January</li>
10182 <li>January</li>
10183 <li>Jan</li>
10184 <li>1</li>
10185 <li>01</li>
10186 <li>Thursday</li>
10187 <li>1970</li>
10188 <li>00:02</li>
10189 <li>00</li>
10190 <li>1</li>
10191 <li>4</li>
10192 <li>19700101000203</li></ul>
10193
10194 !! end
10195
10196 !! test
10197 Magic Word: {{FULLPAGENAME}}
10198 !! options
10199 title=[[User:Ævar Arnfjörð Bjarmason]]
10200 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10201 !! wikitext
10202 {{FULLPAGENAME}}
10203 !! html/*
10204 <p>User:Ævar Arnfjörð Bjarmason
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{FULLPAGENAMEE}}
10210 !! options
10211 title=[[User:Ævar Arnfjörð Bjarmason]]
10212 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10213 !! wikitext
10214 {{FULLPAGENAMEE}}
10215 !! html/*
10216 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10217 </p>
10218 !! end
10219
10220 !! test
10221 Magic Word: {{TALKSPACE}}
10222 !! options
10223 title=[[User:Ævar Arnfjörð Bjarmason]]
10224 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10225 !! wikitext
10226 {{TALKSPACE}}
10227 !! html/*
10228 <p>User talk
10229 </p>
10230 !! end
10231
10232 !! test
10233 Magic Word: {{TALKSPACE}}, same namespace
10234 !! options
10235 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10236 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10237 !! wikitext
10238 {{TALKSPACE}}
10239 !! html/*
10240 <p>User talk
10241 </p>
10242 !! end
10243
10244 !! test
10245 Magic Word: {{TALKSPACE}}, main namespace
10246 !! options
10247 title=[[Parser Test]]
10248 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10249 !! wikitext
10250 {{TALKSPACE}}
10251 !! html/*
10252 <p>Talk
10253 </p>
10254 !! end
10255
10256 !! test
10257 Magic Word: {{TALKSPACEE}}
10258 !! options
10259 title=[[User:Ævar Arnfjörð Bjarmason]]
10260 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10261 !! wikitext
10262 {{TALKSPACEE}}
10263 !! html/*
10264 <p>User_talk
10265 </p>
10266 !! end
10267
10268 !! test
10269 Magic Word: {{SUBJECTSPACE}}
10270 !! options
10271 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10272 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10273 !! wikitext
10274 {{SUBJECTSPACE}}
10275 !! html/*
10276 <p>User
10277 </p>
10278 !! end
10279
10280 !! test
10281 Magic Word: {{SUBJECTSPACE}}, same namespace
10282 !! options
10283 title=[[User:Ævar Arnfjörð Bjarmason]]
10284 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10285 !! wikitext
10286 {{SUBJECTSPACE}}
10287 !! html/*
10288 <p>User
10289 </p>
10290 !! end
10291
10292 !! test
10293 Magic Word: {{SUBJECTSPACE}}, main namespace
10294 !! options
10295 title=[[Parser Test]]
10296 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10297 !! wikitext
10298 {{SUBJECTSPACE}}
10299 !! html/*
10300
10301 !! end
10302
10303 !! test
10304 Magic Word: {{SUBJECTSPACEE}}
10305 !! options
10306 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10307 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10308 !! wikitext
10309 {{SUBJECTSPACEE}}
10310 !! html/*
10311 <p>User
10312 </p>
10313 !! end
10314
10315 !! test
10316 Magic Word: {{NAMESPACE}}
10317 !! options
10318 title=[[User:Ævar Arnfjörð Bjarmason]]
10319 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10320 !! wikitext
10321 {{NAMESPACE}}
10322 !! html/*
10323 <p>User
10324 </p>
10325 !! end
10326
10327 !! test
10328 Magic Word: {{NAMESPACEE}}
10329 !! options
10330 title=[[User:Ævar Arnfjörð Bjarmason]]
10331 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10332 !! wikitext
10333 {{NAMESPACEE}}
10334 !! html/*
10335 <p>User
10336 </p>
10337 !! end
10338
10339 !! test
10340 Magic Word: {{NAMESPACENUMBER}}
10341 !! options
10342 title=[[User:Ævar Arnfjörð Bjarmason]]
10343 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10344 !! wikitext
10345 {{NAMESPACENUMBER}}
10346 !! html/*
10347 <p>2
10348 </p>
10349 !! end
10350
10351 !! test
10352 Magic Word: {{SUBPAGENAME}}
10353 !! options
10354 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10355 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10356 !! wikitext
10357 {{SUBPAGENAME}}
10358 !! html/*
10359 <p>sub ö
10360 </p>
10361 !! end
10362
10363 !! test
10364 Magic Word: {{SUBPAGENAMEE}}
10365 !! options
10366 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10367 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10368 !! wikitext
10369 {{SUBPAGENAMEE}}
10370 !! html/*
10371 <p>sub_%C3%B6
10372 </p>
10373 !! end
10374
10375 !! test
10376 Magic Word: {{ROOTPAGENAME}}
10377 !! options
10378 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10379 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10380 !! wikitext
10381 {{ROOTPAGENAME}}
10382 !! html/*
10383 <p>Ævar Arnfjörð Bjarmason
10384 </p>
10385 !! end
10386
10387 !! test
10388 Magic Word: {{ROOTPAGENAMEE}}
10389 !! options
10390 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10391 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10392 !! wikitext
10393 {{ROOTPAGENAMEE}}
10394 !! html/*
10395 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10396 </p>
10397 !! end
10398
10399 !! test
10400 Magic Word: {{BASEPAGENAME}}
10401 !! options
10402 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10403 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10404 !! wikitext
10405 {{BASEPAGENAME}}
10406 !! html/*
10407 <p>Ævar Arnfjörð Bjarmason
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{BASEPAGENAMEE}}
10413 !! options
10414 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10415 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10416 !! wikitext
10417 {{BASEPAGENAMEE}}
10418 !! html/*
10419 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10420 </p>
10421 !! end
10422
10423 !! test
10424 Magic Word: {{TALKPAGENAME}}
10425 !! options
10426 title=[[User:Ævar Arnfjörð Bjarmason]]
10427 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10428 !! wikitext
10429 {{TALKPAGENAME}}
10430 !! html/*
10431 <p>User talk:Ævar Arnfjörð Bjarmason
10432 </p>
10433 !! end
10434
10435 !! test
10436 Magic Word: {{TALKPAGENAMEE}}
10437 !! options
10438 title=[[User:Ævar Arnfjörð Bjarmason]]
10439 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10440 !! wikitext
10441 {{TALKPAGENAMEE}}
10442 !! html/*
10443 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10444 </p>
10445 !! end
10446
10447 !! test
10448 Magic Word: {{SUBJECTPAGENAME}}
10449 !! options
10450 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10451 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10452 !! wikitext
10453 {{SUBJECTPAGENAME}}
10454 !! html/*
10455 <p>User:Ævar Arnfjörð Bjarmason
10456 </p>
10457 !! end
10458
10459 !! test
10460 Magic Word: {{SUBJECTPAGENAMEE}}
10461 !! options
10462 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10463 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10464 !! wikitext
10465 {{SUBJECTPAGENAMEE}}
10466 !! html/*
10467 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10468 </p>
10469 !! end
10470
10471 !! test
10472 Magic Word: {{NUMBEROFFILES}}
10473 !! options
10474 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10475 !! wikitext
10476 {{NUMBEROFFILES}}
10477 !! html/*
10478 <p>7
10479 </p>
10480 !! end
10481
10482 !! test
10483 Magic Word: {{PAGENAME}}
10484 !! options
10485 title=[[User:Ævar Arnfjörð Bjarmason]]
10486 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10487 !! wikitext
10488 {{PAGENAME}}
10489 !! html/*
10490 <p>Ævar Arnfjörð Bjarmason
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{PAGENAME}} with metacharacters
10496 !! options
10497 title=[['foo & bar = baz']]
10498 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10499 !! wikitext
10500 ''{{PAGENAME}}''
10501 !! html+tidy
10502 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10503 </p>
10504 !! end
10505
10506 !! test
10507 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10508 !! options
10509 title=[[*RFC 1234 http://example.com/]]
10510 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10511 !! wikitext
10512 {{PAGENAME}}
10513 !! html+tidy
10514 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10515 </p>
10516 !! end
10517
10518 !! test
10519 Magic Word: {{PAGENAMEE}}
10520 !! options
10521 title=[[User:Ævar Arnfjörð Bjarmason]]
10522 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10523 !! wikitext
10524 {{PAGENAMEE}}
10525 !! html/*
10526 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10527 </p>
10528 !! end
10529
10530 !! test
10531 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10532 !! options
10533 title=[[*RFC 1234 http://example.com/]]
10534 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10535 !! wikitext
10536 {{PAGENAMEE}}
10537 !! html+tidy
10538 <p>&#42;RFC_1234_http&#58;//example.com/
10539 </p>
10540 !! end
10541
10542 !! test
10543 Magic Word: {{REVISIONID}}
10544 !! options
10545 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10546 showflags
10547 !! wikitext
10548 {{REVISIONID}}
10549 !! html/*
10550 <p>1337
10551 </p>
10552 flags=vary-revision-id
10553 !! end
10554
10555 !! test
10556 Magic Word: {{SCRIPTPATH}}
10557 !! options
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{SCRIPTPATH}}
10561 !! html/*
10562
10563 !! end
10564
10565 !! test
10566 Magic Word: {{STYLEPATH}}
10567 !! options
10568 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10569 !! wikitext
10570 {{STYLEPATH}}
10571 !! html/*
10572 <p>/skins
10573 </p>
10574 !! end
10575
10576 !! test
10577 Magic Word: {{SERVER}}
10578 !! options
10579 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10580 !! wikitext
10581 {{SERVER}}
10582 !! html/*
10583 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10584 </p>
10585 !! end
10586
10587 !! test
10588 Magic Word: {{SERVERNAME}}
10589 !! options
10590 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10591 !! wikitext
10592 {{SERVERNAME}}
10593 !! html/*
10594 <p>example.org
10595 </p>
10596 !! end
10597
10598 !! test
10599 Magic Word: {{SITENAME}}
10600 !! options
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{SITENAME}}
10604 !! html/*
10605 <p>MediaWiki
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{PAGELANGUAGE}}
10611 !! options
10612 language=fr
10613 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10614 !! wikitext
10615 {{PAGELANGUAGE}}
10616 !! html/*
10617 <p>fr
10618 </p>
10619 !! end
10620
10621 !! test
10622 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10623 !! options
10624 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10625 !! wikitext
10626 {{PAGELANGUAGE}}
10627 !! html/*
10628 <p>en
10629 </p>
10630 !! end
10631
10632 !! test
10633 Case-sensitive magic words, when cased differently, should just be template transclusions
10634 !! wikitext
10635 {{CurrentMonth}}
10636 {{currentday}}
10637 {{cURreNTweEK}}
10638 {{currentHour}}
10639 !! html
10640 <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>
10641 <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>
10642 <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>
10643 <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>
10644 </p>
10645 !! end
10646
10647 !! test
10648 Case-insensitive magic words should still work with weird casing.
10649 !! wikitext
10650 {{sErVeRNaMe}}
10651 {{LCFirst:AOEU}}
10652 {{ucFIRST:aoeu}}
10653 {{SERver}}
10654 !! html
10655 <p>example.org
10656 aOEU
10657 Aoeu
10658 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10659 </p>
10660 !! end
10661
10662 # From plwiki:PLOS_ONE
10663 !! test
10664 Parsoid: Page property magic word with magic word contents
10665 !! wikitext
10666 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10667 !! html/parsoid
10668 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10669 !! end
10670
10671 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10672 # But, this is a limitation of our representation and is documented in
10673 # TemplateHandler.js in processSpecialMagicWord
10674 !! test
10675 Parsoid: Template-generated DISPLAYTITLE
10676 !! wikitext
10677 {{{{echo|DISPLAYTITLE}}:Foo}}
10678 !! options
10679 showtitle
10680 !! config
10681 wgAllowDisplayTitle=true
10682 wgRestrictDisplayTitle=false
10683 !! html/php
10684 Foo
10685
10686 !! html/parsoid
10687 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10688 !! end
10689
10690 !! test
10691 Namespace 1 {{ns:1}}
10692 !! wikitext
10693 {{ns:1}}
10694 !! html
10695 <p>Talk
10696 </p>
10697 !! end
10698
10699 !! test
10700 Namespace 1 {{ns:01}}
10701 !! wikitext
10702 {{ns:01}}
10703 !! html
10704 <p>Talk
10705 </p>
10706 !! end
10707
10708 !! test
10709 Namespace 0 {{ns:0}} (T6783)
10710 !! wikitext
10711 {{ns:0}}
10712 !! html
10713
10714 !! end
10715
10716 !! test
10717 Namespace 0 {{ns:00}} (T6783)
10718 !! wikitext
10719 {{ns:00}}
10720 !! html
10721
10722 !! end
10723
10724 !! test
10725 Namespace -1 {{ns:-1}}
10726 !! wikitext
10727 {{ns:-1}}
10728 !! html
10729 <p>Special
10730 </p>
10731 !! end
10732
10733 !! test
10734 Namespace User {{ns:User}}
10735 !! wikitext
10736 {{ns:User}}
10737 !! html
10738 <p>User
10739 </p>
10740 !! end
10741
10742 !! test
10743 Namespace User talk {{ns:User_talk}}
10744 !! wikitext
10745 {{ns:User_talk}}
10746 !! html
10747 <p>User talk
10748 </p>
10749 !! end
10750
10751 !! test
10752 Namespace User talk {{ns:uSeR tAlK}}
10753 !! wikitext
10754 {{ns:uSeR tAlK}}
10755 !! html
10756 <p>User talk
10757 </p>
10758 !! end
10759
10760 !! test
10761 Namespace File {{ns:File}}
10762 !! wikitext
10763 {{ns:File}}
10764 !! html
10765 <p>File
10766 </p>
10767 !! end
10768
10769 !! test
10770 Namespace File {{ns:Image}}
10771 !! wikitext
10772 {{ns:Image}}
10773 !! html
10774 <p>File
10775 </p>
10776 !! end
10777
10778 !! test
10779 Namespace (lang=de) Benutzer {{ns:User}}
10780 !! options
10781 language=de
10782 !! wikitext
10783 {{ns:User}}
10784 !! html
10785 <p>Benutzer
10786 </p>
10787 !! end
10788
10789 !! test
10790 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10791 !! options
10792 language=de
10793 !! wikitext
10794 {{ns:3}}
10795 !! html
10796 <p>Benutzer Diskussion
10797 </p>
10798 !! end
10799
10800 !! test
10801 Urlencode
10802 !! wikitext
10803 {{urlencode:hi world?!}}
10804 {{urlencode:hi world?!|WIKI}}
10805 {{urlencode:hi world?!|PATH}}
10806 {{urlencode:hi world?!|QUERY}}
10807 !! html/php
10808 <p>hi+world%3F%21
10809 hi_world%3F!
10810 hi%20world%3F%21
10811 hi+world%3F%21
10812 </p>
10813 !! end
10814
10815 !! test
10816 Magic Word: prioritize type info over data-parsoid
10817 !! options
10818 parsoid=html2wt
10819 !! html/parsoid
10820 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10821 !! wikitext
10822 __FORCETOC__
10823 !! end
10824
10825 !! test
10826 Magic Word: serialize on separate line (parsoid)
10827 !! options
10828 parsoid=wt2wt,html2wt
10829 !! wikitext
10830 foo
10831 __NOTOC__
10832 bar
10833 !! html/parsoid
10834 foo<meta property="mw:PageProp/notoc"/>bar
10835 !! end
10836
10837 !! test
10838 Magic Word: rt non-english wikis
10839 !! options
10840 parsoid=wt2wt
10841 language=de
10842 !! wikitext
10843 __NOEDITSECTION__
10844 !! html/parsoid
10845 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10846 !! end
10847
10848 !!test
10849 __proto__ is treated as normal wikitext (T105997)
10850 !!wikitext
10851 __proto__
10852 !!html
10853 <p>__proto__
10854 </p>
10855 !!end
10856
10857 ###
10858 ### Magic links
10859 ###
10860 !! test
10861 Magic links: internal link to RFC (T2479)
10862 !! wikitext
10863 [[RFC 123]]
10864 !! html/php
10865 <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>
10866 </p>
10867 !! html/parsoid
10868 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10869 !! end
10870
10871 !! test
10872 Magic links: RFC (T2479)
10873 !! wikitext
10874 RFC 822
10875 !! html/php
10876 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10877 </p>
10878 !! html/parsoid
10879 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10880 !! end
10881
10882 !! test
10883 Magic links: RFC (T67278)
10884 !! wikitext
10885 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10886 !! html/php
10887 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10888 </p>
10889 !! html/parsoid
10890 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10891 !! end
10892
10893 !! test
10894 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10895 !! wikitext
10896 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10897 RFC
10898 822
10899 !! html/php
10900 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10901 RFC
10902 822
10903 </p>
10904 !! html/parsoid
10905 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">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>
10906 RFC
10907 822</p>
10908 !! end
10909
10910 !! test
10911 Magic links: ISBN (T3937)
10912 !! wikitext
10913 ISBN 0-306-40615-2
10914 !! html/php
10915 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10916 </p>
10917 !! html/parsoid
10918 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10919 !! end
10920
10921 !! test
10922 Magic links: ISBN (T67278)
10923 !! wikitext
10924 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10925 !! html/php
10926 <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.
10927 </p>
10928 !! html/parsoid
10929 <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>
10930 !! end
10931
10932 !! test
10933 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10934 !! wikitext
10935 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10936 ISBN
10937 9780316098113
10938 ISBN 978
10939 0316098113
10940 !! html/php
10941 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10942 ISBN
10943 9780316098113
10944 ISBN 978
10945 0316098113
10946 </p>
10947 !! html/parsoid
10948 <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>
10949 ISBN
10950 9780316098113
10951 ISBN 978
10952 0316098113</p>
10953 !! end
10954
10955 !! test
10956 Magic links: PMID incorrectly converts space to underscore
10957 !! wikitext
10958 PMID 1234
10959 !! html/php
10960 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10961 </p>
10962 !! html/parsoid
10963 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
10964 !! end
10965
10966 !! test
10967 Magic links: PMID (T67278)
10968 !! wikitext
10969 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10970 !! html/php
10971 <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.
10972 </p>
10973 !! html/parsoid
10974 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10975 !! end
10976
10977 !! test
10978 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10979 !! wikitext
10980 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10981 PMID
10982 1234
10983 !! html/php
10984 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10985 PMID
10986 1234
10987 </p>
10988 !! html/parsoid
10989 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">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>
10990 PMID
10991 1234</p>
10992 !! end
10993
10994 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10995 # since these are ExtLinkText, not MagicLinkText
10996 !! test
10997 Magic links: use appropriate serialization for "almost" magic links.
10998 !! wikitext
10999 X[[Special:BookSources/0978739256|foo]]
11000
11001 X[https://tools.ietf.org/html/rfc1234 foo]
11002 !! html/php
11003 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11004 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11005 </p>
11006 !! html/parsoid
11007 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11008 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11009 !! end
11010
11011 !! test
11012 Magic links: All disabled (T47942)
11013 !! options
11014 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11015 !! wikitext
11016 ISBN 0-306-40615-2
11017 PMID 1234
11018 RFC 4321
11019 !! html/php
11020 <p>ISBN 0-306-40615-2
11021 PMID 1234
11022 RFC 4321
11023 </p>
11024 !! end
11025
11026 ###
11027 ### Templates
11028 ####
11029
11030 !! test
11031 Nonexistent template
11032 !! wikitext
11033 {{thistemplatedoesnotexist}}
11034 !! html
11035 <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>
11036 </p>
11037 !! end
11038
11039 !! test
11040 Template with invalid target containing tags
11041 !! wikitext
11042 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11043 !! html
11044 <p>{{a<b>b</b>|foo|a=b|a = b}}
11045 </p>
11046 !! end
11047
11048 !! test
11049 Template with invalid target containing unclosed tag
11050 !! wikitext
11051 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11052 !! html
11053 <p>{{a<b>|foo|a=b|a = b}}</b>
11054 </p>
11055 !! end
11056
11057 !! test
11058 Template with invalid target containing wikilink
11059 !! wikitext
11060 {{[[Main Page]]}}
11061 !! html/php
11062 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11063 </p>
11064 !! html/parsoid
11065 <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>
11066 !! end
11067
11068 !! test
11069 Template with just whitespace in it, T70421
11070 !! wikitext
11071 {{echo|{{ }}}}
11072 !! html/parsoid
11073 <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>
11074 !! end
11075
11076 !! article
11077 Template:test
11078 !! text
11079 This is a test template
11080 !! endarticle
11081
11082 !! test
11083 Simple template
11084 !! wikitext
11085 {{test}}
11086 !! html
11087 <p>This is a test template
11088 </p>
11089 !! end
11090
11091 !! test
11092 Template with explicit namespace
11093 !! wikitext
11094 {{Template:test}}
11095 !! html
11096 <p>This is a test template
11097 </p>
11098 !! end
11099
11100
11101 !! article
11102 Template:paramtest
11103 !! text
11104 This is a test template with parameter {{{param}}}
11105 !! endarticle
11106
11107 !! test
11108 Template parameter
11109 !! wikitext
11110 {{paramtest|param=foo}}
11111 !! html
11112 <p>This is a test template with parameter foo
11113 </p>
11114 !! end
11115
11116 !! article
11117 Template:paramtestnum
11118 !! text
11119 [[{{{1}}}|{{{2}}}]]
11120 !! endarticle
11121
11122 !! test
11123 Template unnamed parameter
11124 !! wikitext
11125 {{paramtestnum|Main Page|the main page}}
11126 !! html
11127 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11128 </p>
11129 !! end
11130
11131 !! article
11132 Template:templatesimple
11133 !! text
11134 (test)
11135 !! endarticle
11136
11137 !! article
11138 Template:templateredirect
11139 !! text
11140 #redirect [[Template:templatesimple]]
11141 !! endarticle
11142
11143 !! article
11144 Template:templateasargtestnum
11145 !! text
11146 {{{{{1}}}}}
11147 !! endarticle
11148
11149 !! article
11150 Template:templateasargtest
11151 !! text
11152 {{template{{{templ}}}}}
11153 !! endarticle
11154
11155 !! article
11156 Template:templateasargtest2
11157 !! text
11158 {{{{{templ}}}}}
11159 !! endarticle
11160
11161 !! test
11162 Template with template name as unnamed argument
11163 !! wikitext
11164 {{templateasargtestnum|templatesimple}}
11165 !! html
11166 <p>(test)
11167 </p>
11168 !! end
11169
11170 !! test
11171 Template with template name as argument
11172 !! wikitext
11173 {{templateasargtest|templ=simple}}
11174 !! html
11175 <p>(test)
11176 </p>
11177 !! end
11178
11179 !! test
11180 Template with template name as argument (2)
11181 !! wikitext
11182 {{templateasargtest2|templ=templatesimple}}
11183 !! html
11184 <p>(test)
11185 </p>
11186 !! end
11187
11188 !! article
11189 Template:templateasargtestdefault
11190 !! text
11191 {{{{{templ|templatesimple}}}}}
11192 !! endarticle
11193
11194 !! article
11195 Template:templa
11196 !! text
11197 '''templ'''
11198 !! endarticle
11199
11200 !! test
11201 Template with default value
11202 !! wikitext
11203 {{templateasargtestdefault}}
11204 !! html
11205 <p>(test)
11206 </p>
11207 !! end
11208
11209 !! test
11210 Template with default value (value set)
11211 !! wikitext
11212 {{templateasargtestdefault|templ=templa}}
11213 !! html
11214 <p><b>templ</b>
11215 </p>
11216 !! end
11217
11218 !! test
11219 Template redirect
11220 !! wikitext
11221 {{templateredirect}}
11222 !! html/php
11223 <p>(test)
11224 </p>
11225 !! html/parsoid
11226 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11227 !! end
11228
11229 !! test
11230 Template with argument in separate line
11231 !! wikitext
11232 {{ templateasargtest |
11233 templ = simple }}
11234 !! html
11235 <p>(test)
11236 </p>
11237 !! end
11238
11239 !! test
11240 Template with complex template as argument
11241 !! wikitext
11242 {{paramtest|
11243 param ={{ templateasargtest |
11244 templ = simple }}}}
11245 !! html
11246 <p>This is a test template with parameter (test)
11247 </p>
11248 !! end
11249
11250 !! test
11251 Templates with templated name
11252 !! wikitext
11253 {{{{echo|echo}}|foo}}
11254 {{{{echo|inner list}} }}
11255 !! html
11256 <p>foo
11257 </p>
11258 <ul><li>item 1</li></ul>
11259
11260 !! html/parsoid
11261 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11262 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
11263 !! end
11264
11265 ## Regression test; the output here isn't really that interesting.
11266 !! test
11267 Templates with templated name and top level template args
11268 !! wikitext
11269 {{1{{2{{{3}}}|4=5}}}}
11270 !! html/parsoid
11271 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11272 !! end
11273
11274 # Parsoid markup is deliberate "broken". This is an edge case.
11275 # See long comment in TemplateHandler.js:convertAttribsToString.
11276 !! test
11277 Templates with invalid templated targets
11278 !! wikitext
11279 {{echo
11280 {{echo|foo}}
11281 }}
11282 !! html/php
11283 <p>{{echo
11284 foo
11285 }}
11286 </p>
11287 !! html/parsoid
11288 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11289 foo }}</p>
11290 !! end
11291
11292 !! test
11293 Template with thumb image (with link in description)
11294 !! wikitext
11295 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11296 !! html/php
11297 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>
11298
11299 !! html+tidy
11300 <p>This is a test template with parameter </p><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>
11301 !! html/parsoid
11302 <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":"apierror-filedoesnotexist","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>
11303 !! end
11304
11305 !! article
11306 Template:complextemplate
11307 !! text
11308 {{{1}}} {{paramtest|
11309 param ={{{param}}}}}
11310 !! endarticle
11311
11312 !! test
11313 Template with complex arguments
11314 !! wikitext
11315 {{complextemplate|
11316 param ={{ templateasargtest |
11317 templ = simple }}|[[Template:complextemplate|link]]}}
11318 !! html
11319 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11320 </p>
11321 !! end
11322
11323 !! test
11324 T2553: link with two variables in a piped link
11325 !! wikitext
11326 {|
11327 |[[{{{1}}}|{{{2}}}]]
11328 |}
11329 !! html/php
11330 <table>
11331 <tr>
11332 <td>[[{{{1}}}|{{{2}}}]]
11333 </td></tr></table>
11334
11335 !! html/parsoid
11336 <table>
11337 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11338 </tbody></table>
11339 !! end
11340
11341 # See: T2553
11342 !! test
11343 Abort table cell attribute parsing on wikilink
11344 !! wikitext
11345 {|
11346 |testing [[one|two]] |three||four
11347 |testing one two |three||four
11348 |testing="[[one|two]]" |three||four
11349 |}
11350 !! html/php
11351 <table>
11352 <tr>
11353 <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>
11354 <td>four
11355 </td>
11356 <td>three</td>
11357 <td>four
11358 </td>
11359 <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>
11360 <td>four
11361 </td></tr></table>
11362
11363 !! html/parsoid
11364 <table>
11365 <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":"row","autoInsertedEnd":true}'>four</td>
11366 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'>three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11367 <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":"row","autoInsertedEnd":true}'>four</td></tr>
11368 </tbody></table>
11369 !! end
11370
11371 !! test
11372 Don't abort table cell attribute parsing if wikilink is found in template arg
11373 !! wikitext
11374 {|
11375 |Test {{#tag:ref|One two "[[three]]" four}}
11376 |}
11377 !! html/parsoid
11378 <table>
11379 <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>
11380 </tbody></table>
11381 !! end
11382
11383 !! test
11384 Magic variable as template parameter
11385 !! wikitext
11386 {{paramtest|param={{SITENAME}}}}
11387 !! html
11388 <p>This is a test template with parameter MediaWiki
11389 </p>
11390 !! end
11391
11392 !! article
11393 Template:linktest
11394 !! text
11395 [[{{{param}}}|link]]
11396 !! endarticle
11397
11398 !! test
11399 Template parameter as link source
11400 !! wikitext
11401 {{linktest|param=Main Page}}
11402 !! html
11403 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11404 </p>
11405 !! end
11406
11407 !!article
11408 Template:paramtest2
11409 !! text
11410 including another template, {{paramtest|param={{{arg}}}}}
11411 !! endarticle
11412
11413 !! test
11414 Template passing argument to another template
11415 !! wikitext
11416 {{paramtest2|arg='hmm'}}
11417 !! html
11418 <p>including another template, This is a test template with parameter 'hmm'
11419 </p>
11420 !! end
11421
11422 !! article
11423 Template:Linktest2
11424 !! text
11425 Main Page
11426 !! endarticle
11427
11428 !! test
11429 Template as link source
11430 !! wikitext
11431 [[{{linktest2}}]]
11432
11433 [[{{linktest2}}|Main Page]]
11434
11435 [[{{linktest2}}]]Page
11436 !! html
11437 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11438 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11439 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11440 </p>
11441 !! end
11442
11443
11444 !! article
11445 Template:loop1
11446 !! text
11447 {{loop2}}
11448 !! endarticle
11449
11450 !! article
11451 Template:loop2
11452 !! text
11453 {{loop1}}
11454 !! endarticle
11455
11456 !! test
11457 Template infinite loop
11458 !! wikitext
11459 {{loop1}}
11460 !! html
11461 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11462 </p>
11463 !! end
11464
11465 !! test
11466 Template from main namespace
11467 !! wikitext
11468 {{:Main Page}}
11469 !! html
11470 <p>blah blah
11471 </p>
11472 !! end
11473
11474 !! article
11475 Template:table
11476 !! text
11477 {|
11478 | 1 || 2
11479 |-
11480 | 3 || 4
11481 |}
11482 !! endarticle
11483
11484 !! test
11485 T2529: Template with table, not included at beginning of line
11486 !! wikitext
11487 foo {{table}}
11488 !! html
11489 <p>foo
11490 </p>
11491 <table>
11492 <tr>
11493 <td>1</td>
11494 <td>2
11495 </td></tr>
11496 <tr>
11497 <td>3</td>
11498 <td>4
11499 </td></tr></table>
11500
11501 !! end
11502
11503 !! test
11504 T2523: Template shouldn't eat newline (or add an extra one before table)
11505 !! wikitext
11506 foo
11507 {{table}}
11508 !! html
11509 <p>foo
11510 </p>
11511 <table>
11512 <tr>
11513 <td>1</td>
11514 <td>2
11515 </td></tr>
11516 <tr>
11517 <td>3</td>
11518 <td>4
11519 </td></tr></table>
11520
11521 !! end
11522
11523 !! test
11524 T2041: Template parameters shown as broken links
11525 !! wikitext
11526 {{{parameter}}}
11527 !! html
11528 <p>{{{parameter}}}
11529 </p>
11530 !! end
11531
11532 !! test
11533 Template with targets containing wikilinks
11534 !! options
11535 parsoid=wt2html
11536 !! wikitext
11537 {{[[foo]]}}
11538
11539 {{[[{{echo|foo}}]]}}
11540
11541 {{{{echo|[[foo}}]]}}
11542 !! html/php
11543 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11544 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11545 </p><p>{{[[foo}}]]
11546 </p>
11547 !! html/parsoid
11548 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11549 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11550 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11551 !! end
11552
11553 !! article
11554 Template:''
11555 !! text
11556 bar
11557 !! endarticle
11558
11559 !! test
11560 Templates: Double quotes as template target
11561 !! wikitext
11562 foo {{''}} baz
11563 !! html/php
11564 <p>foo bar baz
11565 </p>
11566 !! html/parsoid
11567 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11568 </p>
11569 !! end
11570
11571 ## This test is about making sure Parsoid's data-mw is well formed in the
11572 ## face of multiple templates with intersecting and overlapping ranges. The
11573 ## wikitext itself is wretched.
11574 !! test
11575 Templates with intersecting and overlapping ranges
11576 !! wikitext
11577 {|{{echo|
11578 <p>ha</p>}}
11579 {|{{echo|
11580 <p>ho</p>}}
11581 {{echo|{{!}}hi}}
11582 |}
11583 !! html/php+tidy
11584 <p>ha</p><table>
11585
11586 </table><p>ho</p><table>
11587
11588 <tbody><tr>
11589 <td>hi
11590 </td></tr></tbody></table>
11591 !! html/parsoid
11592 <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":""}]]}'>
11593
11594 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11595
11596 <tbody><tr><td>hi</td></tr>
11597 </tbody></table>
11598 !! end
11599
11600 !! article
11601 Template:MSGNW test
11602 !! text
11603 ''None'' of '''this''' should be
11604 * interpreted
11605 but rather passed unmodified
11606 {{test}}
11607 <gallery>
11608 File:Foobar.jpg
11609 </gallery>
11610 <!-- comment -->
11611 !! endarticle
11612
11613 # hmm, fix this or just deprecate msgnw and document its behavior?
11614 !! test
11615 msgnw keyword
11616 !! wikitext
11617 {{msgnw:MSGNW test}}
11618 !! html/php
11619 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11620 &#42; interpreted
11621 &#32;but rather passed unmodified
11622 &#123;&#123;test&#125;&#125;
11623 &#60;gallery&#62;
11624 File:Foobar.jpg
11625 &#60;/gallery&#62;
11626 &#60;!-- comment --&#62;
11627 </p>
11628 !! end
11629
11630 !! test
11631 int keyword
11632 !! wikitext
11633 {{int:youhavenewmessages|lots of money|not!}}
11634 !! html
11635 <p>You have lots of money (not!).
11636 </p>
11637 !! end
11638
11639 !! test
11640 int keyword - non-existing message
11641 !! wikitext
11642 {{int:var}}
11643 !! html
11644 <p>⧼var⧽
11645 </p>
11646 !! end
11647
11648 !! article
11649 Template:Includes
11650 !! text
11651 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11652 !! endarticle
11653
11654 !! test
11655 <includeonly> and <noinclude> being included
11656 !! wikitext
11657 {{Includes}}
11658 !! html
11659 <p>Foobar
11660 </p>
11661 !! end
11662
11663 !! article
11664 Template:Includes2
11665 !! text
11666 <onlyinclude>Foo</onlyinclude>bar
11667 !! endarticle
11668
11669 !! test
11670 <onlyinclude> being included
11671 !! wikitext
11672 {{Includes2}}
11673 !! html
11674 <p>Foo
11675 </p>
11676 !! end
11677
11678
11679 !! article
11680 Template:Includes3
11681 !! text
11682 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11683 !! endarticle
11684
11685 !! test
11686 <onlyinclude> and <includeonly> being included
11687 !! wikitext
11688 {{Includes3}}
11689 !! html
11690 <p>Foo
11691 </p>
11692 !! end
11693
11694 !! test
11695 <includeonly> and <noinclude> on a page
11696 !! wikitext
11697 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11698 !! html
11699 <p>Foozar
11700 </p>
11701 !! end
11702
11703 !! test
11704 Un-closed <noinclude>
11705 !! wikitext
11706 <noinclude>
11707 !! html
11708 !! end
11709
11710 !! test
11711 <onlyinclude> on a page
11712 !! wikitext
11713 <onlyinclude>Foo</onlyinclude>bar
11714 !! html
11715 <p>Foobar
11716 </p>
11717 !! end
11718
11719 !! test
11720 Un-closed <onlyinclude>
11721 !! wikitext
11722 <onlyinclude>
11723 !! html
11724 !! end
11725
11726 !!test
11727 Self-closed noinclude, includeonly, onlyinclude tags
11728 !! wikitext
11729 <noinclude />
11730 <includeonly />
11731 <onlyinclude />
11732 !! html
11733 <p><br />
11734 </p>
11735 !!end
11736
11737 !!test
11738 Unbalanced includeonly and noinclude tags
11739 !! wikitext
11740 {|
11741 |a</noinclude>
11742 |b</noinclude></noinclude>
11743 |c</noinclude></includeonly>
11744 |d</includeonly></includeonly>
11745 |}
11746 !! html
11747 <table>
11748 <tr>
11749 <td>a
11750 </td>
11751 <td>b
11752 </td>
11753 <td>c&lt;/includeonly&gt;
11754 </td>
11755 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11756 </td></tr></table>
11757
11758 !!end
11759
11760 !! article
11761 Template:Includeonly section
11762 !! text
11763 <includeonly>
11764 ==Includeonly section==
11765 </includeonly>
11766 ==Section T-1==
11767 !!endarticle
11768
11769 !! test
11770 T8563: Edit link generation for section shown by <includeonly>
11771 !! wikitext
11772 {{includeonly section}}
11773 !! html
11774 <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>
11775 <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>
11776
11777 !! end
11778
11779 # Uses same input as the contents of [[Template:Includeonly section]]
11780 !! test
11781 T8563: Section extraction for section shown by <includeonly>
11782 !! options
11783 section=T-2
11784 !! wikitext
11785 <includeonly>
11786 ==Includeonly section==
11787 </includeonly>
11788 ==Section T-2==
11789 !! html
11790 ==Section T-2==
11791 !! end
11792
11793 !! test
11794 T8563: Edit link generation for section suppressed by <includeonly>
11795 !! wikitext
11796 <includeonly>
11797 ==Includeonly section==
11798 </includeonly>
11799 ==Section 1==
11800 !! html
11801 <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>
11802
11803 !! end
11804
11805 !! test
11806 T8563: Section extraction for section suppressed by <includeonly>
11807 !! options
11808 section=1
11809 !! wikitext
11810 <includeonly>
11811 ==Includeonly section==
11812 </includeonly>
11813 ==Section 1==
11814 !! html
11815 ==Section 1==
11816 !! end
11817
11818 !! test
11819 Un-closed <includeonly>
11820 !! wikitext
11821 <includeonly>
11822 !! html/php
11823 !! html/parsoid
11824 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11825 !! end
11826
11827 ## We used to, but no longer wt2wt this test since the default serializer
11828 ## will normalize the include directives to serialize on their own line.
11829 ## Selser will take care of preserving formatting in scenarios where they
11830 ## intermingled with other wikitext.
11831 !! test
11832 Includes and comments at SOL
11833 !! options
11834 parsoid=wt2html,html2html
11835 !! wikitext
11836 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
11837
11838 <noinclude>
11839 some
11840 </noinclude>*stuff
11841 *here
11842
11843 <includeonly>can have stuff</includeonly>===here===
11844
11845 !! html/php
11846 <h2><span class="mw-headline" id="hu">hu</span></h2>
11847 <p>some
11848 </p>
11849 <ul><li>stuff</li>
11850 <li>here</li></ul>
11851 <h3><span class="mw-headline" id="here">here</span></h3>
11852
11853 !! html/parsoid
11854 <!-- 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 id="hu">hu</h2>
11855
11856 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11857 <p>some</p>
11858 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
11859 <li>here</li></ul>
11860
11861 <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 id="here">here</h3>
11862
11863 !! end
11864
11865 # TODO: test with DOM fragment reuse!
11866 !! test
11867 Parsoid: DOM fragment reuse
11868 !! options
11869 parsoid=wt2wt,wt2html
11870 !! wikitext
11871 a{{echo|b<table></table>c}}d
11872
11873 a{{echo|b
11874 <table></table>
11875 c}}d
11876
11877 {{echo|a
11878
11879 <table></table>
11880
11881 b}}
11882 !! html
11883 <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>
11884
11885 <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">
11886 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11887 </span><p about="#mwt2">cd</p>
11888
11889 <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">
11890
11891 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11892
11893 </span><p about="#mwt3">b</p>
11894 !! end
11895
11896 !! test
11897 Parsoid: Merge double tds (T52603)
11898 !! options
11899 parsoid
11900 !! wikitext
11901 {|
11902 |{{echo|{{!}} foo}}
11903 |}
11904 !! html
11905 <table><tbody>
11906 <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>
11907 </tbody></table>
11908 !! end
11909
11910 !! test
11911 Parsoid: Merge double tds in nested transclusion content (T52603)
11912 !! options
11913 parsoid
11914 !! wikitext
11915 {{echo|<div>}}
11916 {|
11917 |{{echo|{{!}} foo}}
11918 |}
11919 {{echo|</div>}}
11920 !! html
11921 <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}}]}'>
11922 <table><tbody>
11923 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11924 </tbody></table>
11925 </div>
11926 !! end
11927
11928 ###
11929 ### <includeonly> and <noinclude> in attributes
11930 ###
11931 !!test
11932 0. includeonly around the entire attribute
11933 !! wikitext
11934 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11935 !! html
11936 <p><span id="v2">bar</span>
11937 </p>
11938 !!end
11939
11940 !!test
11941 1. includeonly in html attr key
11942 !! wikitext
11943 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11944 !! html
11945 <p><span id="foo">bar</span>
11946 </p>
11947 !!end
11948
11949 !!test
11950 2. includeonly in html attr value
11951 !! wikitext
11952 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11953 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11954 !! html
11955 <p><span id="v1">bar</span>
11956 <span id="v1">bar</span>
11957 </p>
11958 !!end
11959
11960 !!test
11961 3. includeonly in part of an attr value
11962 !! wikitext
11963 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11964 !! html
11965 <p><span style="color:red;">bar</span>
11966 </p>
11967 !!end
11968
11969 !!test
11970 4. includeonly in table attributes
11971 !! wikitext
11972 {|
11973 |- <noinclude>
11974 |-
11975 |a
11976 </noinclude>
11977 |- <includeonly>
11978 |-
11979 |b
11980 </includeonly>
11981 |}
11982 !! html
11983 <table>
11984
11985
11986 <tr>
11987 <td>a
11988 </td></tr>
11989 </table>
11990
11991 !!end
11992
11993 ###
11994 ### Preprocessor precedence tests
11995 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11996 ###
11997 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11998 !! test
11999 Preprocessor precedence 1: link is rightmost opening
12000 !! options
12001 parsoid=wt2html
12002 !! wikitext
12003 {{[[Foo|bar}}]]
12004
12005 But close-brace is not a valid character in a link title:
12006 {{[[Foo}}|bar]]
12007
12008 However, we can still tell this was handled as a link in the preprocessor:
12009 {{echo|[[Foo}}|bar]]|bat}}
12010 !! html/php
12011 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12012 </p><p>But close-brace is not a valid character in a link title:
12013 {{[[Foo}}|bar]]
12014 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12015 [[Foo}}|bar]]
12016 </p>
12017 !! html/parsoid
12018 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12019 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12020 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12021 !! end
12022
12023 !! test
12024 Preprocessor precedence 2: template is rightmost opening
12025 !! options
12026 language=zh
12027 !! wikitext
12028 -{{echo|foo}-}}-
12029 !! html/php
12030 <p>-foo}--
12031 </p>
12032 !! html/parsoid
12033 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12034 !! end
12035
12036 !! test
12037 Preprocessor precedence 3: language converter is rightmost opening
12038 !! options
12039 language=zh
12040 parsoid=wt2html
12041 !! wikitext
12042 {{echo|hi}}
12043
12044 {{-{R|echo|hi}}}-
12045
12046 [[-{R|raw]]}-
12047 !! html/php
12048 <p>hi
12049 </p><p>{{echo|hi}}
12050 </p><p>[[raw]]
12051 </p>
12052 !! html/parsoid
12053 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12054 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12055 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12056 !! end
12057
12058 !! test
12059 Preprocessor precedence 4: left-most angle bracket
12060 !! options
12061 language=zh
12062 !! wikitext
12063 <!--{raw}-->
12064 !! html/php
12065 !! html/parsoid
12066 <!--{raw}-->
12067 !! end
12068
12069 !! article
12070 Template:Precedence5
12071 !! text
12072 {{{{{1}}}}}
12073 !! endarticle
12074
12075 !! test
12076 Preprocessor precedence 5: tplarg takes precedence over template
12077 !! wikitext
12078 {{Precedence5|Bullet}}
12079 !! html/php
12080 <ul><li>Bar</li></ul>
12081
12082 !! html/parsoid
12083 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12084 !! end
12085
12086 !! test
12087 Preprocessor precedence 6: broken link is rightmost opening
12088 !! options
12089 parsoid=wt2html
12090 !! wikitext
12091 {{echo|[[Foo}}
12092
12093 {{echo|[[Foo|bar|bat=baz}}
12094 !! html/php
12095 <p>{{echo|[[Foo}}
12096 </p><p>{{echo|[[Foo|bar|bat=baz}}
12097 </p>
12098 !! html/parsoid
12099 <p>{{echo|[[Foo}}</p>
12100 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12101 !! end
12102
12103 # This next test exposes a difference between PHP and Parsoid:
12104 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12105 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12106 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12107 # outer `[[Foo` extends until the `y]]`
12108 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12109 # intermediate result (after template expansion), and link processing
12110 # happens on this intermediate result, which moves the wikilink
12111 # boundary leftward to `[[Foo|Bar]]`
12112 # 2b) Parsoid works in a single step, so it's going to keep the
12113 # wikilink as extending to the `y]]`
12114 # 3a) Then PHP does linktrail processing which slurps up the trailing
12115 # `xy` inside the link.
12116 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12117 # `z` inside the link.
12118 # This is "correct" behavior. Parsoid's basic worldview is that the
12119 # `]]` inside the template shouldn't be allowed to leak out to affect
12120 # the surrounding wikilink. PHP may match Parsoid (in the future)
12121 # if you use {{#balance}} (T114445).
12122
12123 !! test
12124 Preprocessor precedence 7: broken template is rightmost opening
12125 !! options
12126 parsoid=wt2html
12127 !! wikitext
12128 [[Foo|{{echo|Bar]]
12129
12130 [[Foo|{{echo|Bar]]-x}}-y]]-z
12131
12132 Careful: linktrails can move the end of the wikilink:
12133 [[Foo|{{echo|y']]a}}l]]l
12134 !! html/php
12135 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12136 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12137 </p><p>Careful: linktrails can move the end of the wikilink:
12138 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12139 </p>
12140 !! html/parsoid
12141 <p>[[Foo|{{echo|Bar]]</p>
12142 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12143 <p>Careful: linktrails can move the end of the wikilink:
12144 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12145 !! end
12146
12147 !! test
12148 Preprocessor precedence 8: broken language converter is rightmost opening
12149 !! options
12150 language=zh
12151 !! wikitext
12152 [[Foo-{R|raw]]
12153 !! html
12154 <p>[[Foo-{R|raw]]
12155 </p>
12156 !! end
12157
12158 !! article
12159 Template:Preprocessor_precedence_9
12160 !! text
12161 ;4: {{{{1}}}}
12162 ;5: {{{{{2}}}}}
12163 ;6: {{{{{{3}}}}}}
12164 ;7: {{{{{{{4}}}}}}}
12165 !! endarticle
12166
12167 !! test
12168 Preprocessor precedence 9: groups of braces
12169 !! wikitext
12170 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12171 !! html/php
12172 <dl><dt>4</dt>
12173 <dd>{Four}</dd>
12174 <dt>5</dt>
12175 <dd></dd></dl>
12176 <ul><li>Bar</li></ul>
12177 <dl><dt>6</dt>
12178 <dd>Four</dd>
12179 <dt>7</dt>
12180 <dd>{Bullet}</dd></dl>
12181
12182 !! html/parsoid
12183 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12184 <dt>4</dt>
12185 <dd>{Four}</dd>
12186 <dt>5</dt>
12187 <dd></dd>
12188 </dl><ul about="#mwt1">
12189 <li>Bar</li>
12190 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12191 <dt>6</dt>
12192 <dd>Four</dd>
12193 <dt>7</dt>
12194 <dd>{Bullet}</dd>
12195 </dl>
12196 !! end
12197
12198 !! article
12199 Template:Preprocessor_precedence_10
12200 !! text
12201 ;1: -{R|raw}-
12202 ;2: -{{Bullet}}-
12203 ;3: -{{{1}}}-
12204 ;4: -{{{{2}}}}-
12205 ;5: -{{{{{3}}}}}-
12206 ;6: -{{{{{{4}}}}}}-
12207 ;7: -{{{{{{{5}}}}}}}-
12208 !! endarticle
12209
12210 !! test
12211 Preprocessor precedence 10: groups of braces with leading dash
12212 !! options
12213 language=zh
12214 !! wikitext
12215 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12216 !! html/php
12217 <dl><dt>1</dt>
12218 <dd>raw</dd>
12219 <dt>2</dt>
12220 <dd>-</dd></dl>
12221 <ul><li>Bar-</li></ul>
12222 <dl><dt>3</dt>
12223 <dd>-Three-</dd>
12224 <dt>4</dt>
12225 <dd>raw2</dd>
12226 <dt>5</dt>
12227 <dd>-</dd></dl>
12228 <ul><li>Bar-</li></ul>
12229 <dl><dt>6</dt>
12230 <dd>-Three-</dd>
12231 <dt>7</dt>
12232 <dd>raw2</dd></dl>
12233
12234 !! html/parsoid
12235 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12236 <dt>1</dt>
12237 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12238 <dt>2</dt>
12239 <dd>-</dd>
12240 </dl><ul about="#mwt1">
12241 <li>Bar-</li>
12242 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12243 <dt>3</dt>
12244 <dd>-Three-</dd>
12245 <dt>4</dt>
12246 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12247 <dt>5</dt>
12248 <dd>-</dd>
12249 </dl><ul about="#mwt1">
12250 <li>Bar-</li>
12251 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12252 <dt>6</dt>
12253 <dd>-Three-</dd>
12254 <dt>7</dt>
12255 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12256 </dl>
12257 !! end
12258
12259 !! test
12260 Preprocessor precedence 11: found during visual diff testing
12261 !! wikitext
12262 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12263
12264 {{echo|-{{echo|-{{echo|x}}}}}}
12265
12266 {{echo|-{{echo|x}}}}
12267 !! html/php
12268 <p><span>-<span>-x</span></span>
12269 </p><p>--x
12270 </p><p>-x
12271 </p>
12272 !! html/parsoid
12273 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12274
12275 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12276
12277 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12278 !! end
12279
12280 !! test
12281 Preprocessor precedence 12: broken language converter closed by brace.
12282 !! options
12283 parsoid=wt2html
12284 !! wikitext
12285 This form breaks the template, which is unfortunate:
12286 *{{echo|foo-{bar}bat}}
12287
12288 But if the broken language converter markup is inside an extension
12289 tag, nothing bad happens:
12290 *<nowiki>foo-{bar}bat</nowiki>
12291 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12292 *<pre>foo-{bar}bat</pre>
12293 *{{echo|<pre>foo-{bar}bat</pre>}}
12294
12295 <tag>foo-{bar}bat</tag>
12296 {{echo|<tag>foo-{bar}bat</tag>}}
12297
12298 !! html/php+tidy
12299 <p>This form breaks the template, which is unfortunate:
12300 </p>
12301 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12302 <p>But if the broken language converter markup is inside an extension
12303 tag, nothing bad happens:
12304 </p>
12305 <ul><li>foo-&#123;bar}bat</li>
12306 <li>foo-&#123;bar}bat</li>
12307 <li><pre>foo-{bar}bat</pre></li>
12308 <li><pre>foo-{bar}bat</pre></li></ul>
12309 <pre>'foo-{bar}bat'
12310 array (
12311 )
12312 </pre>
12313 <pre>'foo-{bar}bat'
12314 array (
12315 )
12316 </pre>
12317 !! html/parsoid
12318 <p>This form breaks the template, which is unfortunate:</p>
12319 <ul>
12320 <li>{{echo|foo-{bar}bat}}</li>
12321 </ul>
12322 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12323 <ul>
12324 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12325 <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12326 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12327 <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12328 </ul>
12329 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12330 !! end
12331
12332 !! test
12333 Preprocessor precedence 13: broken language converter in external link
12334 !! options
12335 parsoid=wt2html
12336 !! wikitext
12337 *[http://example.com/-{foo Example in URL]
12338 *[http://example.com Example in -{link} description]
12339 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12340 !! html/php+tidy
12341 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12342 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12343 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12344 !! html/parsoid
12345 <ul>
12346 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12347 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12348 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12349 </ul>
12350 !! end
12351
12352 !! test
12353 Preprocessor precedence 14: broken language converter in comment
12354 !! wikitext
12355 *<!--{{foo}}-->...should be ok
12356 *<!---{{foo}}-->...extra dashes
12357 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12358 !! html/php+tidy
12359 <ul><li>...should be ok</li>
12360 <li>...extra dashes</li>
12361 <li>foobat...should be ok</li></ul>
12362 !! html/parsoid
12363 <ul>
12364 <li><!--{{foo}}-->...should be ok</li>
12365 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12366 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
12367 </ul>
12368 !! end
12369
12370 !! test
12371 Preprocessor precedence 15: broken brace markup in headings
12372 !! config
12373 wgFragmentMode=[ 'html5', 'legacy' ]
12374 !! options
12375 parsoid=wt2html
12376 !! wikitext
12377 __NOTOC__ __NOEDITSECTION__
12378 ===1 foo[bar 1===
12379 1
12380 ===2 foo[[bar 2===
12381 2
12382 ===3 foo{bar 3===
12383 3
12384 ===4 foo{{bar 4===
12385 4
12386 ===5 foo{{{bar 5===
12387 5
12388 ===6 foo-{bar 6===
12389 6
12390 !! html/php+tidy
12391 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12392 <p>1
12393 </p>
12394 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12395 <p>2
12396 </p>
12397 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12398 <p>3
12399 </p>
12400 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12401 <p>4
12402 </p>
12403 <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
12404 <p>5
12405 </p>
12406 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12407 <p>6
12408 </p>
12409 !! html/parsoid
12410 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12411 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12412 <p>1</p>
12413 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12414 <p>2</p>
12415 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12416 <p>3</p>
12417 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12418 <p>4</p>
12419 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12420 <p>5</p>
12421 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12422 <p>6</p>
12423 !! end
12424
12425 !! test
12426 Preprocessor precedence 16: matching closing braces to opening braces
12427 !! options
12428 language=zh
12429 parsoid=wt2html
12430 !! wikitext
12431 -{{{echo|foo}}bar}-
12432 !! html/php
12433 <p>foobar
12434 </p>
12435 !! html/parsoid
12436 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
12437 !! end
12438
12439 !! test
12440 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12441 !! options
12442 parsoid=wt2html
12443 !! wikitext
12444 {{echo|hi {{}}}}
12445 !! html/php
12446 <p>hi {{}}
12447 </p>
12448 !! html/parsoid
12449 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12450 !! end
12451
12452 !! test
12453 Preprocessor precedence 18: another rightmost wins scenario
12454 !! options
12455 parsoid=wt2html
12456 !! wikitext
12457 {{ -{{{{1|tplarg}}} }} }-
12458 !! html/php
12459 <p>{{ -{tplarg }} }-
12460 </p>
12461 !! html/parsoid
12462 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12463 !! end
12464
12465 !! test
12466 Preprocessor precedence 19: break syntax
12467 !! options
12468 parsoid=wt2html
12469 !! wikitext
12470 -{{
12471 !! html/php
12472 <p>-{{
12473 </p>
12474 !! html/parsoid
12475 <p>-{{</p>
12476 !! end
12477
12478 ###
12479 ### Token Stream Patcher tests
12480 ###
12481 ### These tests won't always pass wt2wt and other modes because
12482 ### on serialization, the table will be output on a new line.
12483 ### For now, we are blacklisting them, and using this to test selser.
12484 ###
12485
12486 !!test
12487 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12488 !!options
12489 parsoid=wt2html,wt2wt
12490 !!wikitext
12491 {{echo|}}{| width = '100%'
12492 |foo
12493 |}
12494 !!html/parsoid
12495 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12496 <tbody><tr><td>foo</td></tr>
12497 </tbody></table>
12498 !!end
12499
12500 ## We used to, but no longer wt2wt this test since the default serializer
12501 ## will normalize the include directives to serialize on their own line.
12502 ## Selser will take care of preserving formatting in scenarios where they
12503 ## intermingled with other wikitext.
12504 !!test
12505 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12506 !!options
12507 parsoid=wt2html
12508 !!wikitext
12509 <includeonly>a</includeonly>{| {{{b}}}
12510 |c
12511 |}
12512 !!html/parsoid
12513 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
12514 <tbody><tr><td>c</td></tr>
12515 </tbody></table>
12516 !!end
12517
12518 !! test
12519 Table wikitext syntax outside wiki-tables
12520 !! wikitext
12521 a
12522 |+ not a caption
12523 ! not a table heading
12524 |- not a table row
12525 | not a table cell
12526 | class="foo bar" | baz
12527 b
12528 |}
12529 |-
12530 c
12531 !! html
12532 <p>a
12533 |+ not a caption
12534 ! not a table heading
12535 |- not a table row
12536 | not a table cell
12537 | class="foo bar" | baz
12538 b
12539 |}
12540 |-
12541 c
12542 </p>
12543 !! end
12544
12545 ###
12546 ### Testing parsing of templates where a template arg
12547 ### has the same name as the template itself.
12548 ###
12549
12550 !! article
12551 Template:quote
12552 !! text
12553 {{{quote|{{{1}}}}}}
12554 !! endarticle
12555
12556 !!test
12557 Templates: Template Name/Arg clash: 1. Use of positional param
12558 !! wikitext
12559 {{quote|foo}}
12560 !! html
12561 <p>foo
12562 </p>
12563 !!end
12564
12565 !!test
12566 Templates: Template Name/Arg clash: 2. Use of named param
12567 !! wikitext
12568 {{quote|quote=foo}}
12569 !! html
12570 <p>foo
12571 </p>
12572 !!end
12573
12574 !!test
12575 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12576 !! wikitext
12577 {{quote|quote}}
12578 !! html
12579 <p>quote
12580 </p>
12581 !!end
12582
12583 ###
12584 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12585 ###
12586
12587 !!test
12588 Templates: 1. Simple use
12589 !! wikitext
12590 {{echo|Foo}}
12591 !! html
12592 <p>Foo
12593 </p>
12594 !!end
12595
12596 !!test
12597 Templates: 2. Inside a block tag
12598 !! wikitext
12599 <div>{{echo|Foo}}</div>
12600 <blockquote>{{echo|Foo}}</blockquote>
12601 !! html
12602 <div>Foo</div>
12603 <blockquote>Foo</blockquote>
12604
12605 !! html+tidy
12606 <div>Foo</div>
12607 <blockquote><p>Foo</p></blockquote>
12608 !!end
12609
12610 !!test
12611 Templates: P-wrapping: 1a. Templates on consecutive lines
12612 !! wikitext
12613 {{echo|Foo}}
12614 {{echo|bar}}
12615 !! html
12616 <p>Foo
12617 bar
12618 </p>
12619 !!end
12620
12621 !!test
12622 Templates: P-wrapping: 1b. Templates on consecutive lines
12623 !! wikitext
12624 Foo
12625
12626 {{echo|bar}}
12627 {{echo|baz}}
12628 !! html
12629 <p>Foo
12630 </p><p>bar
12631 baz
12632 </p>
12633 !!end
12634
12635 !!test
12636 Templates: P-wrapping: 1c. Templates on consecutive lines
12637 !! wikitext
12638 {{echo|Foo}}
12639 {{echo|bar}} <div>baz</div>
12640 !! html
12641 <p>Foo
12642 </p>
12643 bar <div>baz</div>
12644
12645 !! html+tidy
12646 <p>Foo
12647 </p><p>
12648 bar </p><div>baz</div>
12649 !! end
12650
12651 !!test
12652 Templates: P-wrapping: 1d. Template preceded by comment-only line
12653 !!options
12654 parsoid
12655 !! wikitext
12656 <!-- foo -->
12657 {{echo|Bar}}
12658 !! html
12659 <!-- foo -->
12660
12661 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12662 !!end
12663
12664 !!test
12665 Templates: Inline Text: 1. Multiple template uses
12666 !! wikitext
12667 {{echo|Foo}}bar{{echo|baz}}
12668 !! html
12669 <p>Foobarbaz
12670 </p>
12671 !!end
12672
12673 !!test
12674 Templates: Inline Text: 2. Back-to-back template uses
12675 !! wikitext
12676 {{echo|Foo}}{{echo|bar}}
12677 !! html
12678 <p>Foobar
12679 </p>
12680 !!end
12681
12682 !!test
12683 Templates: Block Tags: 1. Multiple template uses
12684 !! wikitext
12685 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12686 !! html
12687 <div>Foo</div><div>bar</div><div>baz</div>
12688
12689 !!end
12690
12691 !!test
12692 Templates: Block Tags: 2. Back-to-back template uses
12693 !! wikitext
12694 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12695 !! html
12696 <div>Foo</div><div>bar</div>
12697
12698 !!end
12699
12700 # This is an edge case relating to paragraph wrapping.
12701 !!test
12702 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12703 !! wikitext
12704 {{echo|a
12705 b</p>}}
12706 !! html/parsoid
12707 <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
12708 b</p>
12709 !!end
12710
12711 !!test
12712 Templates: Links: 1. Simple example
12713 !! wikitext
12714 {{echo|[[Foo|bar]]}}
12715 !! html
12716 <p><a href="/wiki/Foo" title="Foo">bar</a>
12717 </p>
12718 !!end
12719
12720 !!test
12721 Templates: Links: 2. Generation of link href
12722 !! wikitext
12723 [[{{echo|Foo}}|bar]]
12724 !! html
12725 <p><a href="/wiki/Foo" title="Foo">bar</a>
12726 </p>
12727 !!end
12728
12729 !!test
12730 Templates: Links: 3. Generation of part of a link href
12731 !! wikitext
12732 [[Fo{{echo|o}}|bar]]
12733
12734 [[Foo{{echo|bar}}]]
12735
12736 [[Foo{{echo|bar}}baz]]
12737
12738 [[Foo{{echo|bar}}|bar]]
12739
12740 [[:Foo{{echo|bar}}]]
12741
12742 [[:Foo{{echo|bar}}|bar]]
12743 !! html
12744 <p><a href="/wiki/Foo" title="Foo">bar</a>
12745 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12746 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12747 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12748 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12749 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12750 </p>
12751 !!end
12752
12753 !!test
12754 Templates: Links: 4. Multiple templates generating link href
12755 !! wikitext
12756 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12757 !! html
12758 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12759 </p>
12760 !!end
12761
12762 !!test
12763 Templates: Links: 5. Generation of link text
12764 !! wikitext
12765 [[Foo|{{echo|bar}}]]
12766 !! html
12767 <p><a href="/wiki/Foo" title="Foo">bar</a>
12768 </p>
12769 !!end
12770
12771 !!test
12772 Templates: Links: 5. Nested templates (only outermost template should be marked)
12773 !! wikitext
12774 {{echo|[[{{echo|Foo}}|bar]]}}
12775 !! html
12776 <p><a href="/wiki/Foo" title="Foo">bar</a>
12777 </p>
12778 !!end
12779
12780 !!test
12781 Templates: HTML Tag: 1. Generation of HTML attr. key
12782 !! wikitext
12783 <div {{echo|style}}="color:red;">foo</div>
12784 !! html
12785 <div style="color:red;">foo</div>
12786
12787 !!end
12788
12789 !!test
12790 Templates: HTML Tag: 2. Generation of HTML attr. value
12791 !! wikitext
12792 <div style={{echo|'color:red;'}}>foo</div>
12793 !! html
12794 <div style="color:red;">foo</div>
12795
12796 !!end
12797
12798 !!test
12799 Templates: HTML Tag: 3. Generation of HTML attr key and value
12800 !! wikitext
12801 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12802 !! html
12803 <div style="color:red;">foo</div>
12804
12805 !!end
12806
12807 !!test
12808 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12809 !! wikitext
12810 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12811 !! html
12812 <div title="This is a long title with just one piece templated">foo</div>
12813
12814 !!end
12815
12816 !!test
12817 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12818 !! wikitext
12819 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12820 !! html
12821 <div title="This is a long title with just one piece templated">foo</div>
12822
12823 !!end
12824
12825 !!test
12826 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12827 !! wikitext
12828 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12829 !! html
12830 <div title="This is a long title with just one piece templated">foo</div>
12831
12832 !!end
12833
12834 # SSS FIXME: While it is great we added support for all this,
12835 # do we want to make this part of the spec? Maybe we want to
12836 # deprecate this kind of usage in the future?
12837 !!test
12838 Templates: HTML Tag: 7. Generation of partial attribute key string
12839 !! wikitext
12840 <div st{{echo|yle}}="color:red;">foo</div>
12841 !! html
12842 <div style="color:red;">foo</div>
12843
12844 !!end
12845
12846 !! test
12847 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12848 !! wikitext
12849 <div {{echo|1=id="v1"}}>bar</div>
12850 !! html
12851 <div id="v1">bar</div>
12852
12853 !!end
12854
12855 !! test
12856 Templates: HTML Tag: 9. Multiple template-generated attributes
12857 !! wikitext
12858 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12859 !! html
12860 <div id="v1" title="foo">bar</div>
12861
12862 !!end
12863
12864 !! test
12865 Templates: Support for templates generating attributes and content
12866 !! wikitext
12867 {| {{mixed_attr_content_template}}
12868 |-
12869 |bar
12870 |}
12871 !! html/php
12872 <table style="color:red;" title="T48811">
12873
12874 <tr>
12875 <td>foo
12876 </td></tr>
12877 <tr>
12878 <td>bar
12879 </td></tr></table>
12880
12881 !! html/parsoid
12882 <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|}"]}'>
12883 <tbody><tr>
12884 <td>foo</td></tr>
12885 <tr>
12886 <td>bar</td></tr>
12887 </tbody></table>
12888 !!end
12889
12890 !! test
12891 1. Entities and nowikis inside templated attributes should be handled correctly
12892 !! wikitext
12893 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12894 !! html/php
12895 <div style="background:#f9f9f9;">foo</div>
12896
12897 !! html/parsoid
12898 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
12899 !! end
12900
12901 !! test
12902 2. Entities and nowikis inside templated attributes should be handled correctly
12903 !! wikitext
12904 {|
12905 |{{table_attribs_3}}
12906 |}
12907 !! html/php
12908 <table>
12909 <tr>
12910 <td style="background:#f9f9f9;">Foo
12911 </td></tr></table>
12912
12913 !! html/parsoid
12914 <table>
12915 <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>
12916 </tbody></table>
12917 !! end
12918
12919 !! test
12920 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12921 !! wikitext
12922 {{tbl-start}}
12923 |{{table_attribs_3}}
12924 {{tbl-end}}
12925 !! html/php
12926 <table>
12927 <tr>
12928 <td style="background:#f9f9f9;">Foo
12929 </td></tr></table>
12930
12931 !! html/parsoid
12932 <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}}]}'>
12933 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12934 </tbody></table>
12935 !! end
12936
12937 # T107622
12938 !! test
12939 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12940 !! wikitext
12941 {|
12942 |{{table_attribs_6}} hi
12943 |}
12944 !! html/php
12945 <table>
12946 <tr>
12947 <td style="background: red;">hi
12948 </td></tr></table>
12949
12950 !! html/parsoid
12951 <table>
12952 <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>
12953 </tbody></table>
12954 !! end
12955
12956 !!test
12957 Templates: HTML Tables: 1. Generating start of a HTML table
12958 !! wikitext
12959 {{echo|<table><tr><td>foo</td>}}</tr></table>
12960 !! html
12961 <table><tr><td>foo</td></tr></table>
12962
12963 !!end
12964
12965 !!test
12966 Templates: HTML Tables: 2a. Generating middle of a HTML table
12967 !! wikitext
12968 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12969 !! html
12970 <table><tr><td>foo</td></tr></table>
12971
12972 !!end
12973
12974 !!test
12975 Templates: HTML Tables: 2b. Generating middle of a HTML table
12976 !! wikitext
12977 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12978 !! html
12979 <table><tr><td>foo</td></tr></table>
12980
12981 !!end
12982
12983 !!test
12984 Templates: HTML Tables: 3. Generating end of a HTML table
12985 !! wikitext
12986 <table><tr>{{echo|<td>foo</td></tr></table>}}
12987 !! html
12988 <table><tr><td>foo</td></tr></table>
12989
12990 !!end
12991
12992 !!test
12993 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12994 !! wikitext
12995 {{echo|<table>}}<tr><td>foo</td></tr></table>
12996 !! html
12997 <table><tr><td>foo</td></tr></table>
12998
12999 !!end
13000
13001 !!test
13002 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13003 !! wikitext
13004 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13005 !! html
13006 <table><tr><td>foo</td></tr></table>
13007
13008 !!end
13009
13010 !!test
13011 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13012 !! wikitext
13013 <table><tr>{{echo|<td>}}foo</td></tr></table>
13014 !! html
13015 <table><tr><td>foo</td></tr></table>
13016
13017 !!end
13018
13019 !!test
13020 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13021 !! wikitext
13022 <table><tr><td>foo{{echo|</td>}}</tr></table>
13023 !! html
13024 <table><tr><td>foo</td></tr></table>
13025
13026 !!end
13027
13028 !!test
13029 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13030 !! wikitext
13031 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13032 !! html
13033 <table><tr><td>foo</td></tr></table>
13034
13035 !!end
13036
13037 !!test
13038 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13039 !! wikitext
13040 <table><tr><td>foo</td></tr>{{echo|</table>}}
13041 !! html
13042 <table><tr><td>foo</td></tr></table>
13043
13044 !!end
13045
13046 !!test
13047 Templates: HTML Tables: 5. Proper fostering of categories from inside
13048 !!options
13049 parsoid=wt2html,wt2wt
13050 !! wikitext
13051 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13052 <!--Two categories (T52330)-->
13053 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13054 !! html
13055 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13056 <!--Two categories (T52330)-->
13057 <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>
13058 !!end
13059
13060 !!test
13061 Templates: Wiki Tables: 1a. Fostering of entire template content
13062 !! wikitext
13063 {|
13064 {{echo|a}}
13065 |}
13066 !! html
13067 <table>
13068 a
13069 <tr><td></td></tr></table>
13070
13071 !! html/php+tidy
13072
13073 a
13074 <table><tbody><tr><td></td></tr></tbody></table>
13075 !! html/parsoid
13076 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
13077
13078 </table>
13079 !! end
13080
13081 !!test
13082 Templates: Wiki Tables: 1b. Fostering of entire template content
13083 !! wikitext
13084 {|
13085 {{echo|<div>}}
13086 foo
13087 {{echo|</div>}}
13088 |}
13089 !! html
13090 <table>
13091 <div>
13092 <p>foo
13093 </p>
13094 </div>
13095 <tr><td></td></tr></table>
13096
13097 !! html/php+tidy
13098 <div>
13099 <p>foo
13100 </p>
13101 </div><table>
13102
13103 <tbody><tr><td></td></tr></tbody></table>
13104 !! html/parsoid
13105 <div about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":0}},"\nfoo\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":1}},"\n|}"]}'>
13106 <p>foo</p>
13107 </div><table about="#mwt3">
13108
13109 </table>
13110 !! end
13111
13112 !!test
13113 Templates: Wiki Tables: 2. Fostering of partial template content
13114 !! wikitext
13115 {|
13116 {{echo|a
13117 <div>b</div>}}
13118 |}
13119 !! html
13120 <table>
13121 a
13122 <div>b</div>
13123 <tr><td></td></tr></table>
13124
13125 !! html/php+tidy
13126
13127 a
13128 <div>b</div><table>
13129 <tbody><tr><td></td></tr></tbody></table>
13130 !! html/parsoid
13131 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
13132
13133
13134 </table>
13135 !! end
13136
13137 !!test
13138 Templates: Wiki Tables: 3. td-content via multiple templates
13139 !! wikitext
13140 {|
13141 {{echo|{{pipe}}a}}{{echo|b}}
13142 |}
13143 !! html
13144 <table>
13145 <tr>
13146 <td>ab
13147 </td></tr></table>
13148
13149 !!end
13150
13151 !!test
13152 Templates: Wiki Tables: 4. Templated tags, no content
13153 !! wikitext
13154 {{tbl-start}}
13155 {{tbl-end}}
13156 !! html
13157 <table>
13158 <tr><td></td></tr></table>
13159
13160 !!end
13161
13162 !!test
13163 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13164 !! wikitext
13165 {{tbl-start}}
13166 |foo
13167 {{tbl-end}}
13168 !! html
13169 <table>
13170 <tr>
13171 <td>foo
13172 </td></tr></table>
13173
13174 !!end
13175
13176 !!test
13177 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13178 !! wikitext
13179 {{tbl-start}}
13180 {{!}}foo
13181 {{tbl-end}}
13182 !! html
13183 <table>
13184 <tr>
13185 <td>foo
13186 </td></tr></table>
13187
13188 !!end
13189
13190 ## This test case is very specific to Parsoid's internals
13191 ## and is hence only tested for Parsoid's code. Parsoid uses
13192 ## a <meta> marker tag for <ref> tags and they are expanded
13193 ## much later. We are verifying that this <meta> tag usage
13194 ## doesn't prevent foster parenting.
13195 !!test
13196 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13197 !!wikitext
13198 {{PartialTable}}<ref>foo</ref>
13199 |}
13200
13201 <references />
13202 !!html/parsoid
13203 <sup 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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup><table about="#mwt2">
13204 <tbody>
13205 </tbody></table>
13206
13207 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
13208 !!end
13209
13210 !! test
13211 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13212 !! wikitext
13213 {{echo|
13214 {{{!}}
13215 {{!}}-}}
13216 <onlyinclude>
13217 |foo
13218 </onlyinclude>
13219 {{!}}}
13220 !! html/parsoid
13221 <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{{!}}}"]}'>
13222 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13223 <tbody><tr>
13224
13225 <td>foo
13226 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13227 </tbody></table>
13228 !! end
13229
13230 !!test
13231 Templates: Lists: Multi-line list-items via templates
13232 !! wikitext
13233 *{{echo|a {{nonexistent|
13234 unused}}}}
13235 *{{echo|b {{nonexistent|
13236 unused}}}}
13237 !! html
13238 <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>
13239 <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>
13240
13241 !!end
13242
13243 !!test
13244 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13245 !! wikitext
13246 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13247 !! html
13248 <p><i>ab</i>c<i>d</i>e
13249 </p>
13250 !!end
13251
13252 !!test
13253 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13254 (PHP parser generates misnested html)
13255 !! wikitext
13256 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13257 !! html/parsoid
13258 <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>
13259 !!end
13260
13261 !!test
13262 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13263 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13264 !! options
13265 parsoid=wt2html,wt2wt
13266 !! wikitext
13267 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13268 !! html
13269 <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>
13270 <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>
13271 <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>
13272 !!end
13273
13274 !!test
13275 Templates: Ugly nesting: 4. Divs opened/closed across templates
13276 !! wikitext
13277 a<div>b{{echo|c</div>d}}e
13278 !! html
13279 a<div>bc</div>de
13280
13281 !! html+tidy
13282 <p>a</p><div>bc</div><p>de
13283 </p>
13284 !! end
13285
13286 !! test
13287 Templates: Ugly templates: 3. newline-only template parameter
13288 !! wikitext
13289 foo {{echo|
13290 }}
13291 !! html
13292 <p>foo
13293 </p>
13294 !! end
13295
13296 # This looks like a bug: a single newline triggers p/br for some reason.
13297 !! test
13298 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13299 !! wikitext
13300 {{echo|
13301 }}
13302 !! html
13303 <p><br />
13304 </p>
13305 !! end
13306
13307 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13308 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13309 !! test
13310 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13311 !! wikitext
13312 {{echo|<table>}}
13313 {{echo|<div>foo}}
13314 {{echo|</table>}}
13315 !! html/parsoid
13316 <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
13317 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13318 </table>
13319 !! end
13320
13321 # T66017 -- ugly wikitext with fostered content generates two template ranges
13322 # that are "identical" and generate nesting cycles in the algorithm
13323 !! test
13324 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13325 !! wikitext
13326 {{echo|<table><tr><td><table>}}
13327 {{echo|<div>}}
13328 {{echo|</div>}}
13329 !! html/parsoid
13330 <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"}'>
13331 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13332 </table></td></tr></tbody></table>
13333 !! end
13334
13335 !! test
13336 Templates: Parameters substituted at the top-level
13337 !! wikitext
13338 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13339
13340 {{{foo|bar|baz}}}
13341 !! html/php
13342 <p><i>who</i> me? <b>never!</b>
13343 </p><p>bar
13344 </p>
13345 !! html/parsoid
13346 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
13347
13348 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13349 !! end
13350
13351 !! test
13352 Templates: Param with empty arg in the final position
13353 !! wikitext
13354 {{{hi|}}}
13355 !! html/parsoid
13356 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13357 !! end
13358
13359 !!test
13360 Parser Functions: 1. Simple example
13361 !! wikitext
13362 {{uc:foo}}
13363 !! html
13364 <p>FOO
13365 </p>
13366 !!end
13367
13368 !!test
13369 Parser Functions: 2. Nested use (only outermost should be marked up)
13370 !! wikitext
13371 {{uc:{{lc:FOO}}}}
13372 !! html
13373 <p>FOO
13374 </p>
13375 !!end
13376
13377 ###
13378 ### Pre-save transform tests
13379 ###
13380 !! test
13381 pre-save transform: subst:
13382 !! options
13383 pst
13384 !! wikitext
13385 {{subst:test}}
13386 !! html/php
13387 This is a test template
13388 !! end
13389
13390 !! test
13391 pre-save transform: normal template
13392 !! options
13393 pst
13394 !! wikitext
13395 {{test}}
13396 !! html/php
13397 {{test}}
13398 !! end
13399
13400 !! test
13401 pre-save transform: nonexistent template
13402 !! options
13403 pst
13404 !! wikitext
13405 {{thistemplatedoesnotexist}}
13406 !! html/php
13407 {{thistemplatedoesnotexist}}
13408 !! end
13409
13410 !! test
13411 pre-save transform: subst magic variables
13412 !! options
13413 pst
13414 !! wikitext
13415 {{subst:SITENAME}}
13416 !! html/php
13417 MediaWiki
13418 !! end
13419
13420 # This is T2089, which I fixed. -- wtm
13421 !! test
13422 pre-save transform: subst: templates with parameters
13423 !! options
13424 pst
13425 !! wikitext
13426 {{subst:paramtest|param="something else"}}
13427 !! html/php
13428 This is a test template with parameter "something else"
13429 !! end
13430
13431 !! article
13432 Template:nowikitest
13433 !! text
13434 <nowiki>'''not wiki'''</nowiki>
13435 !! endarticle
13436
13437 !! test
13438 pre-save transform: nowiki in subst (T3188)
13439 !! options
13440 pst
13441 !! wikitext
13442 {{subst:nowikitest}}
13443 !! html/php
13444 <nowiki>'''not wiki'''</nowiki>
13445 !! end
13446
13447 !! article
13448 Template:commenttest
13449 !! text
13450 This template has <!-- a comment --> in it.
13451 !! endarticle
13452
13453 !! test
13454 pre-save transform: comment in subst (T3936)
13455 !! options
13456 pst
13457 !! wikitext
13458 {{subst:commenttest}}
13459 !! html/php
13460 This template has <!-- a comment --> in it.
13461 !! end
13462
13463 !! test
13464 pre-save transform: unclosed tag
13465 !! options
13466 pst
13467 !! wikitext
13468 <nowiki>'''not wiki'''
13469 !! html/php
13470 <nowiki>'''not wiki'''
13471 !! end
13472
13473 !! test
13474 pre-save transform: mixed tag case
13475 !! options
13476 pst
13477 !! wikitext
13478 <NOwiki>'''not wiki'''</noWIKI>
13479 !! html/php
13480 <NOwiki>'''not wiki'''</noWIKI>
13481 !! end
13482
13483 !! test
13484 pre-save transform: unclosed comment in <nowiki>
13485 !! options
13486 pst
13487 !! wikitext
13488 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13489 !! html/php
13490 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13491 !!end
13492
13493 # Leading @ in this template definition works around a limitation
13494 # in parsoid's parserTests which otherwise strips the <span> from the
13495 # result (confusing it for a template wrapper)
13496 !! article
13497 Template:dangerous
13498 !!text
13499 @<span onmouseover="alert('crap')">Oh no</span>
13500 !!endarticle
13501
13502 !!test
13503 (confirming safety of fix for subst T3936)
13504 !! wikitext
13505 {{Template:dangerous}}
13506 !! html
13507 <p>@<span>Oh no</span>
13508 </p>
13509 !! end
13510
13511 !! test
13512 pre-save transform: comment containing gallery (T7024)
13513 !! options
13514 pst
13515 !! wikitext
13516 <!-- <gallery>data</gallery> -->
13517 !! html/php
13518 <!-- <gallery>data</gallery> -->
13519 !!end
13520
13521 !! test
13522 pre-save transform: comment containing extension
13523 !! options
13524 pst
13525 !! wikitext
13526 <!-- <tag>data</tag> -->
13527 !! html/php
13528 <!-- <tag>data</tag> -->
13529 !!end
13530
13531 !! test
13532 pre-save transform: comment containing nowiki
13533 !! options
13534 pst
13535 !! wikitext
13536 <!-- <nowiki>data</nowiki> -->
13537 !! html/php
13538 <!-- <nowiki>data</nowiki> -->
13539 !!end
13540
13541 !! test
13542 pre-save transform: <noinclude> in subst (T5298)
13543 !! options
13544 pst
13545 !! wikitext
13546 {{subst:Includes}}
13547 !! html/php
13548 Foobar
13549 !! end
13550
13551 !! test
13552 pre-save transform: <onlyinclude> in subst (T5298)
13553 !! options
13554 pst
13555 !! wikitext
13556 {{subst:Includes2}}
13557 !! html/php
13558 Foo
13559 !! end
13560
13561 !! article
13562 Template:SubstTest
13563 !!text
13564 {{<includeonly>subst:</includeonly>Includes}}
13565 !! endarticle
13566
13567 !! article
13568 Template:SafeSubstTest
13569 !! text
13570 {{<includeonly>safesubst:</includeonly>Includes}}
13571 !! endarticle
13572
13573 !! test
13574 T24297: safesubst: works during PST
13575 !! options
13576 pst
13577 !! wikitext
13578 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13579 !! html/php
13580 FoobarFoobar
13581 !! end
13582
13583 !! test
13584 T24297: safesubst: works during normal parse
13585 !! wikitext
13586 {{SafeSubstTest}}
13587 !! html
13588 <p>Foobar
13589 </p>
13590 !! end
13591
13592 !! test
13593 subst: does not work during normal parse
13594 !! wikitext
13595 {{SubstTest}}
13596 !! html
13597 <p>{{subst:Includes}}
13598 </p>
13599 !! end
13600
13601 !! test
13602 pre-save transform: context links ("pipe trick")
13603 !! options
13604 pst
13605 !! wikitext
13606 [[Article (context)|]]
13607 [[Bar:Article|]]
13608 [[:Bar:Article|]]
13609 [[Bar:Article (context)|]]
13610 [[:Bar:Article (context)|]]
13611 [[|Article]]
13612 [[|Article (context)]]
13613 [[Bar:X (Y) Z|]]
13614 [[:Bar:X (Y) Z|]]
13615 !! html/php
13616 [[Article (context)|Article]]
13617 [[Bar:Article|Article]]
13618 [[:Bar:Article|Article]]
13619 [[Bar:Article (context)|Article]]
13620 [[:Bar:Article (context)|Article]]
13621 [[Article]]
13622 [[Article (context)]]
13623 [[Bar:X (Y) Z|X (Y) Z]]
13624 [[:Bar:X (Y) Z|X (Y) Z]]
13625 !! end
13626
13627 !! test
13628 pre-save transform: context links ("pipe trick") with interwiki prefix
13629 !! options
13630 pst
13631 !! wikitext
13632 [[interwiki:Article|]]
13633 [[:interwiki:Article|]]
13634 [[interwiki:Bar:Article|]]
13635 [[:interwiki:Bar:Article|]]
13636 !! html/php
13637 [[interwiki:Article|Article]]
13638 [[:interwiki:Article|Article]]
13639 [[interwiki:Bar:Article|Bar:Article]]
13640 [[:interwiki:Bar:Article|Bar:Article]]
13641 !! end
13642
13643 !! test
13644 pre-save transform: context links ("pipe trick") with parens in title
13645 !! options
13646 pst title=[[Somearticle (context)]]
13647 !! wikitext
13648 [[|Article]]
13649 !! html/php
13650 [[Article (context)|Article]]
13651 !! end
13652
13653 !! test
13654 pre-save transform: context links ("pipe trick") with comma in title
13655 !! options
13656 pst title=[[Someplace, Somewhere]]
13657 !! wikitext
13658 [[|Otherplace]]
13659 [[Otherplace, Elsewhere|]]
13660 [[Otherplace, Elsewhere, Anywhere|]]
13661 !! html/php
13662 [[Otherplace, Somewhere|Otherplace]]
13663 [[Otherplace, Elsewhere|Otherplace]]
13664 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13665 !! end
13666
13667 !! test
13668 pre-save transform: context links ("pipe trick") with parens and comma
13669 !! options
13670 pst title=[[Someplace (IGNORED), Somewhere]]
13671 !! wikitext
13672 [[|Otherplace]]
13673 [[Otherplace (place), Elsewhere|]]
13674 !! html/php
13675 [[Otherplace, Somewhere|Otherplace]]
13676 [[Otherplace (place), Elsewhere|Otherplace]]
13677 !! end
13678
13679 !! test
13680 pre-save transform: context links ("pipe trick") with comma and parens
13681 !! options
13682 pst title=[[Who, me? (context)]]
13683 !! wikitext
13684 [[|Yes, you.]]
13685 [[Me, Myself, and I (1937 song)|]]
13686 !! html/php
13687 [[Yes, you. (context)|Yes, you.]]
13688 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13689 !! end
13690
13691 !! test
13692 pre-save transform: context links ("pipe trick") with namespace
13693 !! options
13694 pst title=[[Ns:Somearticle]]
13695 !! wikitext
13696 [[|Article]]
13697 !! html/php
13698 [[Ns:Article|Article]]
13699 !! end
13700
13701 !! test
13702 pre-save transform: context links ("pipe trick") with namespace and parens
13703 !! options
13704 pst title=[[Ns:Somearticle (context)]]
13705 !! wikitext
13706 [[|Article]]
13707 !! html/php
13708 [[Ns:Article (context)|Article]]
13709 !! end
13710
13711 !! test
13712 pre-save transform: context links ("pipe trick") with namespace and comma
13713 !! options
13714 pst title=[[Ns:Somearticle, Context, Whatever]]
13715 !! wikitext
13716 [[|Article]]
13717 !! html/php
13718 [[Ns:Article, Context, Whatever|Article]]
13719 !! end
13720
13721 !! test
13722 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13723 !! options
13724 pst title=[[Ns:Somearticle, Context (context)]]
13725 !! wikitext
13726 [[|Article]]
13727 !! html/php
13728 [[Ns:Article (context)|Article]]
13729 !! end
13730
13731 !! test
13732 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13733 !! options
13734 pst title=[[Ns:Somearticle (IGNORED), Context]]
13735 !! wikitext
13736 [[|Article]]
13737 !! html/php
13738 [[Ns:Article, Context|Article]]
13739 !! end
13740
13741 !! test
13742 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13743 !! options
13744 pst
13745 !! wikitext
13746 [[Article(context)|]]
13747 [[Bar:Article(context)|]]
13748 [[:Bar:Article(context)|]]
13749 [[|Article(context)]]
13750 [[Bar:X(Y)Z|]]
13751 [[:Bar:X(Y)Z|]]
13752 !! html/php
13753 [[Article(context)|Article]]
13754 [[Bar:Article(context)|Article]]
13755 [[:Bar:Article(context)|Article]]
13756 [[Article(context)]]
13757 [[Bar:X(Y)Z|X(Y)Z]]
13758 [[:Bar:X(Y)Z|X(Y)Z]]
13759 !! end
13760
13761 !! test
13762 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13763 !! options
13764 pst
13765 !! wikitext
13766 [[Article (context)|]]
13767 [[Bar:Article (context)|]]
13768 [[:Bar:Article (context)|]]
13769 [[|Article (context)]]
13770 [[Bar:X (Y) Z|]]
13771 [[:Bar:X (Y) Z|]]
13772 !! html/php
13773 [[Article (context)|Article]]
13774 [[Bar:Article (context)|Article]]
13775 [[:Bar:Article (context)|Article]]
13776 [[Article (context)]]
13777 [[Bar:X (Y) Z|X (Y) Z]]
13778 [[:Bar:X (Y) Z|X (Y) Z]]
13779 !! end
13780
13781 !! test
13782 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13783 !! options
13784 pst
13785 !! wikitext
13786 [[Article(context)|]]
13787 [[Bar:Article(context)|]]
13788 [[:Bar:Article(context)|]]
13789 [[|Article(context)]]
13790 [[Bar:X(Y)Z|]]
13791 [[:Bar:X(Y)Z|]]
13792 !! html/php
13793 [[Article(context)|Article]]
13794 [[Bar:Article(context)|Article]]
13795 [[:Bar:Article(context)|Article]]
13796 [[Article(context)]]
13797 [[Bar:X(Y)Z|X(Y)Z]]
13798 [[:Bar:X(Y)Z|X(Y)Z]]
13799 !! end
13800
13801 !! test
13802 pre-save transform: context links ("pipe trick") with commas (T23660)
13803 !! options
13804 pst
13805 !! wikitext
13806 [[Article (context), context|]]
13807 [[Article (context),context|]]
13808 [[Bar:Article (context), context|]]
13809 [[Bar:Article (context),context|]]
13810 [[:Bar:Article (context), context|]]
13811 [[:Bar:Article (context),context|]]
13812 !! html/php
13813 [[Article (context), context|Article]]
13814 [[Article (context),context|Article]]
13815 [[Bar:Article (context), context|Article]]
13816 [[Bar:Article (context),context|Article]]
13817 [[:Bar:Article (context), context|Article]]
13818 [[:Bar:Article (context),context|Article]]
13819 !! end
13820
13821 !! test
13822 Parsoid: backwards pipe trick
13823 !! wikitext
13824 [[|'''bar''']]
13825 !! html/php
13826 <p>[[|<b>bar</b>]]
13827 </p>
13828 !! html/parsoid
13829 <p>[[|<b>bar</b>]]</p>
13830 !! end
13831
13832 !! test
13833 pre-save transform: trim trailing empty lines
13834 !! options
13835 pst
13836 !! wikitext
13837 Empty lines are trimmed
13838
13839
13840
13841
13842 !! html/php
13843 Empty lines are trimmed
13844 !! end
13845
13846 !! test
13847 pre-save transform: Signature expansion
13848 !! options
13849 pst
13850 !! wikitext
13851 * ~~~
13852 * ~~~~
13853 * ~~~~~
13854 * <noinclude>~~~</noinclude>
13855 * <includeonly>~~~</includeonly>
13856 * <onlyinclude>~~~</onlyinclude>
13857 !! html/php
13858 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13859 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13860 * 00:02, 1 January 1970 (UTC)
13861 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13862 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13863 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13864 !! end
13865
13866
13867 !! test
13868 ParserOutput flags from signature expansion (T84843)
13869 !! options
13870 pst
13871 showflags
13872 !! wikitext
13873 ~~~~
13874 !! html/php
13875 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13876 flags=user-signature
13877 !! end
13878
13879
13880 !! test
13881 pre-save transform: Signature expansion in nowiki tags (T2093)
13882 !! options
13883 pst disabled
13884 !! wikitext
13885 Shall not expand:
13886
13887 <nowiki>~~~~</nowiki>
13888
13889 <includeonly><nowiki>~~~~</nowiki></includeonly>
13890
13891 <noinclude><nowiki>~~~~</nowiki></noinclude>
13892
13893 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13894
13895 {{subst:Foo}} shall be converted to FOO
13896
13897 As well as inside noinclude/onlyinclude
13898 <noinclude>{{subst:Foo}}</noinclude>
13899 <onlyinclude>{{subst:Foo}}</onlyinclude>
13900
13901 But not inside includeonly
13902 <includeonly>{{subst:Foo}}</includeonly>
13903 !! html/php
13904 Shall not expand:
13905
13906 <nowiki>~~~~</nowiki>
13907
13908 <includeonly><nowiki>~~~~</nowiki></includeonly>
13909
13910 <noinclude><nowiki>~~~~</nowiki></noinclude>
13911
13912 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13913
13914 FOO shall be converted to FOO
13915
13916 As well as inside noinclude/onlyinclude
13917 <noinclude>FOO</noinclude>
13918 <onlyinclude>FOO</onlyinclude>
13919
13920 But not inside includeonly
13921 <includeonly>{{subst:Foo}}</includeonly>
13922 !! end
13923
13924 !! test
13925 Parsoid: Recognize nowiki with trailing space in tags
13926 !! options
13927 parsoid=wt2html
13928 !! wikitext
13929 <nowiki ><div>[[foo]]</nowiki >
13930
13931 a<nowiki / >b
13932
13933 c<nowiki />d
13934
13935 e<nowiki/ >f
13936 !! html
13937 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13938 <p>ab</p>
13939 <p>cd</p>
13940 <p>ef</p>
13941 !! end
13942
13943 !! test
13944 Parsoid: Recognize nowiki with odd capitalization
13945 !! options
13946 parsoid=wt2html
13947 !! wikitext
13948 <noWikI ><div>[[foo]]</Nowiki >
13949 !! html
13950 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13951 !! end
13952
13953
13954 !! test
13955 Parsoid: Escape nowiki with trailing space in tags
13956 !! options
13957 parsoid=html2wt
13958 !! html/parsoid
13959 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13960 <p>a&lt;nowiki /&gt;b</p>
13961 <p>c&lt;nowiki/ &gt;d</p>
13962 !! wikitext
13963 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13964
13965 a&lt;nowiki /&gt;b
13966
13967 c&lt;nowiki/ &gt;d
13968 !! end
13969
13970 !! test
13971 Parsoid: Escape weird noWikI capitalizations
13972 !! options
13973 parsoid=html2wt
13974 !! html/parsoid
13975 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13976 !! wikitext
13977 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13978 !! end
13979
13980 ###
13981 ### Message transform tests
13982 ###
13983 !! test
13984 message transform: magic variables
13985 !! options
13986 msg
13987 !! wikitext
13988 {{SITENAME}}
13989 !! html
13990 MediaWiki
13991 !! end
13992
13993 !! test
13994 message transform: should not transform wiki markup
13995 !! options
13996 msg
13997 !! wikitext
13998 ''test''
13999 !! html
14000 ''test''
14001 !! end
14002
14003 !! test
14004 message transform: <noinclude> in transcluded template (T6926)
14005 !! options
14006 msg
14007 !! wikitext
14008 {{Includes}}
14009 !! html
14010 Foobar
14011 !! end
14012
14013 !! test
14014 message transform: <onlyinclude> in transcluded template (T6926)
14015 !! options
14016 msg
14017 !! wikitext
14018 {{Includes2}}
14019 !! html
14020 Foo
14021 !! end
14022
14023 !! test
14024 {{#special:}} page name, known
14025 !! options
14026 msg
14027 !! wikitext
14028 {{#special:Recentchanges}}
14029 !! html
14030 Special:RecentChanges
14031 !! end
14032
14033 !! test
14034 {{#special:}} page name with subpage, known
14035 !! options
14036 msg
14037 !! wikitext
14038 {{#special:Recentchanges/param}}
14039 !! html
14040 Special:RecentChanges/param
14041 !! end
14042
14043 !! test
14044 {{#special:}} page name, unknown
14045 !! options
14046 msg
14047 !! wikitext
14048 {{#special:foobar nonexistent}}
14049 !! html
14050 Special:Foobar nonexistent
14051 !! end
14052
14053 !! test
14054 {{#speciale:}} page name, known
14055 !! options
14056 msg
14057 !! wikitext
14058 {{#speciale:Recentchanges}}
14059 !! html
14060 Special:RecentChanges
14061 !! end
14062
14063 !! test
14064 {{#speciale:}} page name with subpage, known
14065 !! options
14066 msg
14067 !! wikitext
14068 {{#speciale:Recentchanges/param}}
14069 !! html
14070 Special:RecentChanges/param
14071 !! end
14072
14073 !! test
14074 {{#speciale:}} page name, unknown
14075 !! options
14076 msg
14077 !! wikitext
14078 {{#speciale:foobar nonexistent}}
14079 !! html
14080 Special:Foobar_nonexistent
14081 !! end
14082
14083 ###
14084 ### Images
14085 ###
14086 ### For Parsoid-specific tests, see
14087 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14088
14089 !! test
14090 Simple image
14091 !! options
14092 parsoid=wt2html,wt2wt,html2html
14093 !! wikitext
14094 [[Image:foobar.jpg]]
14095 !! html/php
14096 <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>
14097 </p>
14098 !! html/parsoid
14099 <p><figure-inline 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></figure-inline></p>
14100 !! end
14101
14102 !! test
14103 Serialize simple image with span wrapper
14104 !! options
14105 parsoid=html2wt
14106 !! html/parsoid
14107 <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>
14108 !! wikitext
14109 [[File:Foobar.jpg]]
14110 !! end
14111
14112 !! test
14113 Simple image (using File: namespace, now canonical)
14114 !! wikitext
14115 [[File:Foobar.jpg]]
14116 !! html/php
14117 <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>
14118 </p>
14119 !! html/parsoid
14120 <p><figure-inline 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></figure-inline></p>
14121 !! end
14122
14123 !! test
14124 Right-aligned image
14125 !! wikitext
14126 [[File:Foobar.jpg|right]]
14127 !! html/php
14128 <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>
14129
14130 !! html/parsoid
14131 <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>
14132 !! end
14133
14134 !! test
14135 Image with caption
14136 !! wikitext
14137 [[File:Foobar.jpg|right|Caption text]]
14138 !! html/php
14139 <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>
14140
14141 !! html/parsoid
14142 <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>
14143 !! end
14144
14145 !! test
14146 Image with caption, T55312 #1
14147 !! wikitext
14148 [[File:Foobar.jpg|right|Caption page stuff]]
14149 !! html/php
14150 <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>
14151
14152 !! html/parsoid
14153 <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>
14154 !! end
14155
14156 !! test
14157 Image with caption, T55312 #2
14158 !! wikitext
14159 [[File:Foobar.jpg|right|Caption page=]]
14160 !! html/php
14161 <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>
14162
14163 !! html/parsoid
14164 <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>
14165 !! end
14166
14167 !! test
14168 Image with caption, T55312 #3
14169 !! wikitext
14170 [[File:Foobar.jpg|right|Caption page=stuff]]
14171 !! html/php
14172 <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>
14173
14174 !! html/parsoid
14175 <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>
14176 !! end
14177
14178 !! test
14179 Image caption with pipe entity
14180 !! wikitext
14181 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14182 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14183 !! html/php
14184 <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>one &#x7c; two</div></div></div>
14185 <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>one <i>two</i> &#x7c; three</div></div></div>
14186
14187 !! html/parsoid
14188 <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>one <span typeof="mw:Entity">|</span> two</figcaption></figure>
14189 <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>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14190 !! end
14191
14192 !! test
14193 Allow empty links in image captions (T62753)
14194 !! options
14195 thumbsize=220
14196 !! wikitext
14197 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14198 [[]]
14199 [[Link2]]
14200 ]]
14201 !! html/php
14202 <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>
14203
14204 !! html/parsoid
14205 <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>
14206 [[]]
14207 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14208 </figcaption></figure>
14209 !! end
14210
14211 !! test
14212 Titles in unlinked images (T23454)
14213 !! wikitext
14214 [[File:Foobar.jpg|link=|stuff]]
14215 !! html/php
14216 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14217 </p>
14218 !! html/parsoid
14219 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"stuff"}'><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></figure-inline></p>
14220 !! end
14221
14222 !! test
14223 Link with empty target
14224 !! wikitext
14225 [[]]
14226 !! html
14227 <p>[[]]
14228 </p>
14229 !! end
14230
14231 !! test
14232 Image with link trail
14233 !! wikitext
14234 Linktrails should not work for images: [[File:Foobar.jpg]]s
14235 !! html/php
14236 <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
14237 </p>
14238 !! html/parsoid
14239 <p>Linktrails should not work for images: <figure-inline 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></figure-inline>s</p>
14240 !! end
14241
14242 !! test
14243 Image with empty attribute
14244 !! options
14245 parsoid=wt2html,wt2wt,html2html
14246 !! wikitext
14247 [[File:Foobar.jpg|right||Caption text]]
14248 !! html/php
14249 <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>
14250
14251 !! html/parsoid
14252 <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>
14253 !! end
14254
14255 !! test
14256 1. Block image with individual attributes from templates
14257 !! wikitext
14258 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14259 !! html/php
14260 <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>
14261
14262 !! html/parsoid
14263 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14264 !! end
14265
14266 !! test
14267 2. Block Image with individual attributes from templates
14268 !! wikitext
14269 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14270 !! html/php
14271 <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>
14272
14273 !! html/parsoid
14274 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14275 !! end
14276
14277 !! test
14278 3. Inline image with individual attributes from templates
14279 !! wikitext
14280 [[File:Foobar.jpg|{{echo|50px}}]]
14281 !! html/php
14282 <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>
14283 </p>
14284 !! html/parsoid
14285 <p><figure-inline typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
14286 !! end
14287
14288 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14289 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14290 !! test
14291 Image with multiple attributes from the same template
14292 !! wikitext
14293 [[File:Foobar.jpg|{{image_attribs}}]]
14294 !! html/php
14295 <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>
14296
14297 !! html/parsoid
14298 <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>
14299 !! end
14300
14301 !! test
14302 Image with link tails
14303 !! options
14304 thumbsize=220
14305 !! wikitext
14306 123[[File:Foobar.jpg]]456
14307 123[[File:Foobar.jpg|right]]456
14308 123[[File:Foobar.jpg|thumb]]456
14309 !! html/php
14310 <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
14311 </p>
14312 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
14313 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
14314
14315 !! html/php+tidy
14316 <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
14317 </p><p>
14318 123</p><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><p>456
14319 123</p><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><p>456
14320 </p>
14321 !! html/parsoid
14322 <p>123<figure-inline 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></figure-inline>456</p>
14323 <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>
14324 <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>
14325 !! end
14326
14327 !! test
14328 Image with multiple captions -- only last one is accepted
14329 !! wikitext
14330 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14331 !! html/php
14332 <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>
14333
14334 !! html/parsoid
14335 <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>
14336 !! end
14337
14338 !! test
14339 Image with multiple widths -- use last
14340 !! wikitext
14341 [[File:Foobar.jpg|200px|300px|caption]]
14342 !! html/php
14343 <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>
14344 </p>
14345 !! html/parsoid
14346 <p><figure-inline 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></figure-inline></p>
14347 !! end
14348
14349 !! test
14350 Image with multiple alignments -- use first (T50664)
14351 !! options
14352 thumbsize=220
14353 !! wikitext
14354 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14355
14356 [[File:Foobar.jpg|middle|text-top|caption]]
14357 !! html/php
14358 <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>
14359 <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>
14360 </p>
14361 !! html/parsoid
14362 <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>
14363 <p><figure-inline 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></figure-inline></p>
14364 !! end
14365
14366 !! test
14367 Image with width attribute at different positions
14368 !! wikitext
14369 [[File:Foobar.jpg|200px|right|Caption]]
14370 [[File:Foobar.jpg|right|200px|Caption]]
14371 [[File:Foobar.jpg|right|Caption|200px]]
14372 !! html/php
14373 <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>
14374 <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>
14375 <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>
14376
14377 !! html/parsoid
14378 <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>
14379 <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>
14380 <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>
14381 !! end
14382
14383 # a sad bit of backward-compatibility
14384 !! test
14385 Image with size specified with pxpx (T15500, T53628)
14386 !! options
14387 parsoid=wt2html,wt2wt,html2html
14388 !! wikitext
14389 [[File:Foobar.jpg|20pxpx]]
14390 [[File:Foobar.jpg|200x20pxpx]]
14391 !! html/php
14392 <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>
14393 <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>
14394 </p>
14395 !! html/parsoid
14396 <p><figure-inline 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></figure-inline> <figure-inline 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></figure-inline></p>
14397 !! end
14398
14399 !! test
14400 Image with link parameter, wiki target
14401 !! wikitext
14402 [[File:Foobar.jpg|link=Main Page]]
14403 !! html/php
14404 <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>
14405 </p>
14406 !! html/parsoid
14407 <p><figure-inline 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></figure-inline></p>
14408 !! end
14409
14410 # parsoid T51293 (part 1)
14411 !! test
14412 Image with link parameter, URL target
14413 !! wikitext
14414 [[File:Foobar.jpg|link=http://example.com/]]
14415 !! html/php
14416 <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>
14417 </p>
14418 !! html/parsoid
14419 <p><figure-inline 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></figure-inline></p>
14420 !! end
14421
14422 # parsoid T51293 (part 2)
14423 !! test
14424 Image with link parameter, protocol-less URL target
14425 !! wikitext
14426 [[File:Foobar.jpg|link=//example.com/]]
14427 !! html/php
14428 <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>
14429 </p>
14430 !! html/parsoid
14431 <p><figure-inline 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></figure-inline></p>
14432 !! end
14433
14434 !! test
14435 Escaping non-block captions (T107435)
14436 !! options
14437 parsoid={
14438 "modes": ["wt2wt"],
14439 "changes": [
14440 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14441 ]
14442 }
14443 !! wikitext
14444 [[Image:Foobar.jpg|caption]]
14445 !! wikitext/edited
14446 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14447 !! end
14448
14449 # wgExternalLinkTarget not supported by Parsoid
14450 !! test
14451 Image with link parameter, wgExternalLinkTarget
14452 !! wikitext
14453 [[Image:foobar.jpg|link=http://example.com/]]
14454 !! config
14455 wgExternalLinkTarget='foobar'
14456 !! html/php
14457 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14458 </p>
14459 !! end
14460
14461 !! test
14462 Image with link parameter, wgNoFollowLinks set to false
14463 !! wikitext
14464 [[Image:foobar.jpg|link=http://example.com/]]
14465 !! config
14466 wgNoFollowLinks=false
14467 !! html/php
14468 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14469 </p>
14470 !! end
14471
14472 !! test
14473 Image with link parameter, wgNoFollowDomainExceptions
14474 !! wikitext
14475 [[Image:foobar.jpg|link=http://example.com/]]
14476 !! config
14477 wgNoFollowDomainExceptions='example.com'
14478 !! html/php
14479 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14480 </p>
14481 !! end
14482
14483 # wgExternalLinkTarget not supported by Parsoid
14484 !! test
14485 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14486 !! wikitext
14487 [[Image:foobar.jpg|link=http://example.com/|Title]]
14488 !! config
14489 wgExternalLinkTarget='foobar'
14490 !! html/php
14491 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14492 </p>
14493 !! end
14494
14495 !! test
14496 Image with empty link parameter
14497 !! wikitext
14498 [[File:Foobar.jpg|link=]]
14499 !! html/php
14500 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14501 </p>
14502 !! html/parsoid
14503 <p><figure-inline 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></figure-inline></p>
14504 !! end
14505
14506 !! test
14507 Image with link parameter (wiki target) and unnamed parameter
14508 !! wikitext
14509 [[File:Foobar.jpg|link=Main_Page|Title]]
14510 !! html/php
14511 <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>
14512 </p>
14513 !! html/parsoid
14514 <p><figure-inline 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></figure-inline></p>
14515 !! end
14516
14517 !! test
14518 Image with link parameter (URL target) and unnamed parameter
14519 !! wikitext
14520 [[File:Foobar.jpg|link=http://example.com/|Title]]
14521 !! html/php
14522 <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>
14523 </p>
14524 !! html/parsoid
14525 <p><figure-inline 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></figure-inline></p>
14526 !! end
14527
14528 !! test
14529 Thumbnail image with link parameter
14530 !! options
14531 thumbsize=220
14532 parsoid=wt2html,wt2wt,html2html
14533 !! wikitext
14534 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14535 !! html/php
14536 <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>
14537
14538 !! html/parsoid
14539 <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>
14540 !! end
14541
14542 !! test
14543 Manually-specified thumbnail image
14544 !! options
14545 thumbsize=220
14546 !! wikitext
14547 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14548 !! html/php
14549 <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>
14550
14551 !! html/parsoid
14552 <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>
14553 !! end
14554
14555 !! test
14556 Manually-specified thumbnail image with explicit link to wiki page
14557 !! options
14558 thumbsize=220
14559 parsoid=wt2html,wt2wt,html2html
14560 !! wikitext
14561 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14562 !! html/php
14563 <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>
14564
14565 !! html/parsoid
14566 <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>
14567 !! end
14568
14569 !! test
14570 Manually-specified thumbnail image with explicit link to url
14571 !! options
14572 thumbsize=220
14573 parsoid=wt2html,wt2wt,html2html
14574 !! wikitext
14575 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14576 !! html/php
14577 <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>
14578
14579 !! html/parsoid
14580 <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>
14581 !! end
14582
14583 !! test
14584 Manually-specified thumbnail image with explicit no link
14585 !! options
14586 thumbsize=220
14587 parsoid=wt2html,wt2wt,html2html
14588 !! wikitext
14589 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14590 !! html/php
14591 <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>
14592
14593 !! html/parsoid
14594 <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>
14595 !! end
14596
14597 !! test
14598 Manually-specified thumbnail image with explicit link and alt text
14599 !! options
14600 thumbsize=220
14601 parsoid=wt2html,wt2wt,html2html
14602 !! wikitext
14603 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14604 !! html/php
14605 <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>
14606
14607 !! html/parsoid
14608 <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>
14609 !! end
14610
14611 !! test
14612 Image with frame and link
14613 !! options
14614 parsoid=wt2html,wt2wt,html2html
14615 !! wikitext
14616 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14617 !! html/php
14618 <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>
14619
14620 !! html/parsoid
14621 <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>
14622 !! end
14623
14624 !! test
14625 Image with frame and link and explicit alt
14626 !! options
14627 parsoid=wt2html,wt2wt,html2html
14628 !! wikitext
14629 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14630 !! html/php
14631 <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>
14632
14633 !! html/parsoid
14634 <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>
14635 !! end
14636
14637 !! test
14638 Image with wiki markup in implicit alt
14639 !! wikitext
14640 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14641
14642 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14643 !! html/php
14644 <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>
14645 </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>
14646 </p>
14647 !! html/parsoid
14648 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14649
14650 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14651 !! end
14652
14653 !! test
14654 Alt image option should handle most kinds of wikitext without barfing
14655 !! wikitext
14656 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14657 !! html/php
14658 <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>
14659
14660 !! html/parsoid
14661 <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|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
14662 !! end
14663
14664 !! test
14665 Image with table with attributes in caption
14666 !! options
14667 parsoid=wt2html,html2html
14668 !! wikitext
14669 [[File:Foobar.jpg|thumb|
14670 {| class="123" |
14671 |- class="456" |
14672 | ha
14673 |}
14674 ]]
14675 !! html/parsoid
14676 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{| class=\"123\" |\n|- class=\"456\" |\n| ha\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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>
14677 <table class="123">
14678 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14679 <td> ha</td></tr>
14680 </tbody></table>
14681 </figcaption></figure>
14682 !! end
14683
14684 !! test
14685 Image with table with rows from templates in caption
14686 !! wikitext
14687 [[File:Foobar.jpg|thumb|
14688 {|
14689 {{echo|{{!}} hi}}
14690 |}
14691 ]]
14692 !! html/parsoid
14693 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{|\n{{echo|{{!}} hi}}\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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>
14694 <table>
14695 <tbody about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} hi"}},"i":0}},"\n"]}'><tr><td> hi</td></tr>
14696 </tbody></table>
14697 </figcaption></figure>
14698 !! end
14699
14700 !! test
14701 Image with nested tables in caption
14702 !! wikitext
14703 [[File:Foobar.jpg|thumb|Foo<br />
14704 {|
14705 |
14706 {|
14707 |z
14708 |}
14709 |}
14710 ]]
14711 !! html/parsoid
14712 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Foo&lt;br/>\n{|\n|\n{|\n|z\n|}\n|}\n"}]}'><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 data-parsoid='{"dsr":[null,50,null,null]}'>Foo<br data-parsoid='{"stx":"html","selfClose":true}'/>
14713 <table>
14714 <tbody><tr><td>
14715 <table>
14716 <tbody><tr><td>z</td></tr>
14717 </tbody></table></td></tr>
14718 </tbody></table>
14719 </figcaption></figure>
14720 !! end
14721
14722 ###################
14723 # Conflicting image format options.
14724 # First option specified should 'win'.
14725 # All three cases in each test should be identical.
14726
14727 !! test
14728 Image with 'frameless' first.
14729 !! options
14730 parsoid=wt2html,wt2wt,html2html
14731 !! wikitext
14732 [[File:Foobar.jpg|frameless|caption]]
14733
14734 [[File:Foobar.jpg|frameless|frame|caption]]
14735
14736 [[File:Foobar.jpg|frameless|thumb|caption]]
14737 !! html/php
14738 <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>
14739 </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>
14740 </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>
14741 </p>
14742 !! html/parsoid
14743 <p><figure-inline 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></figure-inline></p>
14744 <p><figure-inline 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></figure-inline></p>
14745 <p><figure-inline 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></figure-inline></p>
14746 !! end
14747
14748 !! test
14749 Image with 'frame' first.
14750 !! options
14751 parsoid=wt2html,wt2wt,html2html
14752 !! wikitext
14753 [[File:Foobar.jpg|frame|caption]]
14754 [[File:Foobar.jpg|frame|frameless|caption]]
14755 [[File:Foobar.jpg|frame|thumb|caption]]
14756 !! html/php
14757 <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>
14758 <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>
14759 <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>
14760
14761 !! html/parsoid
14762 <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>
14763 <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>
14764 <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>
14765 !! end
14766
14767 !! test
14768 Image with 'thumb' first.
14769 !! options
14770 parsoid=wt2html,wt2wt,html2html
14771 !! wikitext
14772 [[File:Foobar.jpg|thumb|caption]]
14773 [[File:Foobar.jpg|thumb|frameless|caption]]
14774 [[File:Foobar.jpg|thumb|frame|caption]]
14775 !! html/php
14776 <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>
14777 <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>
14778 <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>
14779
14780 !! html/parsoid
14781 <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>
14782 <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>
14783 <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>
14784 !! end
14785
14786 ###################
14787 # Image sizing.
14788 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14789 # and https://phabricator.wikimedia.org/T64258
14790 # Foobar has actual size of 1941x220
14791 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14792 # a scalable format.
14793 # 2. Framed images always ignore size options; always render at default size.
14794 # 3. "Unspecified format" and border are the only types which can be
14795 # enlarged.
14796
14797 !! test
14798 Image: unspecified format and border enlarge
14799 !! options
14800 parsoid=wt2html,wt2wt,html2html
14801 !! wikitext
14802 [[File:Foobar.jpg|2000px]]
14803
14804 [[File:Foobar.jpg|border|2000px]]
14805 !! html/php
14806 <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>
14807 </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>
14808 </p>
14809 !! html/parsoid
14810 <p><figure-inline 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="227" width="2000"/></a></figure-inline></p>
14811 <p><figure-inline class="mw-image-border" 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="227" width="2000"/></a></figure-inline></p>
14812 !! end
14813
14814 !! test
14815 Image: "unspecified format" and border reduce
14816 !! options
14817 parsoid=wt2html,wt2wt,html2html
14818 !! wikitext
14819 [[File:Foobar.jpg|1000px]]
14820
14821 [[File:Foobar.jpg|border|1000px]]
14822 !! html/php
14823 <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>
14824 </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>
14825 </p>
14826 !! html/parsoid
14827 <p><figure-inline 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></figure-inline></p>
14828 <p><figure-inline 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></figure-inline></p>
14829 !! end
14830
14831 !! test
14832 Image: thumbs reduce
14833 !! options
14834 parsoid=wt2html,wt2wt,html2html
14835 !! wikitext
14836 [[File:Foobar.jpg|thumb|50px]]
14837 !! html/php
14838 <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>
14839
14840 !! html/parsoid
14841 <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>
14842 !! end
14843
14844 !! test
14845 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14846 !! options
14847 parsoid=wt2html,wt2wt,html2html
14848 !! wikitext
14849 [[File:Foobar.jpg|thumb|2000px]]
14850
14851 [[File:Foobar.svg|thumb|2000px]]
14852 !! html/php
14853 <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>
14854 <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>
14855
14856 !! html/parsoid
14857 <figure typeof="mw:Image/Thumb"><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>
14858 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
14859 !! end
14860
14861 !! test
14862 Image: frameless can reduce in size
14863 !! options
14864 parsoid=wt2html,wt2wt,html2html
14865 !! wikitext
14866 [[File:Foobar.jpg|frameless|50px]]
14867 !! html/php
14868 <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>
14869 </p>
14870 !! html/parsoid
14871 <p><figure-inline 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></figure-inline></p>
14872 !! end
14873
14874 !! test
14875 Image: bitmap frameless can't be enlarged past original size, but vector can
14876 !! options
14877 parsoid=wt2html,wt2wt,html2html
14878 !! wikitext
14879 [[File:Foobar.jpg|frameless|2000px]]
14880
14881 [[File:Foobar.svg|frameless|2000px]]
14882 !! html/php
14883 <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>
14884 </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>
14885 </p>
14886 !! html/parsoid
14887 <p><figure-inline typeof="mw:Image/Frameless"><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-inline></p>
14888 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure-inline></p>
14889 !! end
14890
14891 !! test
14892 Image: framed images are always unscaled.
14893 !! options
14894 parsoid=wt2html,wt2wt,html2html
14895 !! wikitext
14896 [[File:Foobar.jpg|frame]]
14897
14898 [[File:Foobar.jpg|frame|50px]]
14899
14900 [[File:Foobar.jpg|frame|50x50px]]
14901
14902 [[File:Foobar.jpg|frame|2000px]]
14903 !! html/php
14904 <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>
14905 <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>
14906 <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>
14907 <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>
14908
14909 !! html/parsoid
14910 <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>
14911 <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>
14912 <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>
14913 <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>
14914 !! end
14915
14916 ###################
14917
14918 !! test
14919 Link to image page- image page normally doesn't exists, hence edit link
14920 Add test with existing image page
14921 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14922 !! wikitext
14923 [[:Image:test]]
14924 !! html
14925 <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>
14926 </p>
14927 !! end
14928
14929 !! test
14930 T20784 Link to non-existent image page with caption should use caption as link text
14931 !! wikitext
14932 [[:Image:test|caption]]
14933 !! html
14934 <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>
14935 </p>
14936 !! end
14937
14938 !! test
14939 Frameless image caption with a free URL
14940 !! wikitext
14941 [[File:Foobar.jpg|http://example.com]]
14942 !! html/php
14943 <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>
14944 </p>
14945 !! html/parsoid
14946 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
14947 !! end
14948
14949 !! test
14950 Thumbnail image caption with a free URL
14951 !! options
14952 thumbsize=220
14953 !! wikitext
14954 [[File:Foobar.jpg|thumb|http://example.com]]
14955 !! html/php
14956 <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>
14957
14958 !! html/parsoid
14959 <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" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
14960 !! end
14961
14962 !! test
14963 Thumbnail image caption with a free URL and explicit alt
14964 !! options
14965 thumbsize=220
14966 parsoid=wt2html,wt2wt,html2html
14967 !! wikitext
14968 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14969 !! html/php
14970 <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>
14971
14972 !! html/parsoid
14973 <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" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
14974 !! end
14975
14976 !! test
14977 SVG thumbnails with no language set
14978 !! options
14979 !! wikitext
14980 [[File:Foobar.svg|thumb|caption]]
14981 !! html/php
14982 <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>
14983
14984 !! html/parsoid
14985 <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.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14986 !! end
14987
14988 !! test
14989 SVG thumbnails with language de
14990 !! options
14991 parsoid=wt2html,wt2wt,html2html
14992 !! wikitext
14993 [[File:Foobar.svg|thumb|caption|lang=de]]
14994 !! html/php
14995 <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>
14996
14997 !! html/parsoid
14998 <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.png" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14999 !! end
15000
15001 !! test
15002 SVG thumbnails with invalid language code
15003 !! options
15004 parsoid=wt2html,wt2wt,html2html
15005 !! wikitext
15006 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15007 !! html/php
15008 <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>
15009
15010 !! html/parsoid
15011 <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.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid:language:code</figcaption></figure>
15012 !! end
15013
15014 !! test
15015 T3887: A ISBN with a thumbnail
15016 !! wikitext
15017 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15018 !! html/php
15019 <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>
15020
15021 !! html/parsoid
15022 <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>
15023 !! end
15024
15025 !! test
15026 T3887: A RFC with a thumbnail
15027 !! wikitext
15028 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15029 !! html/php
15030 <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="https://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
15031
15032 !! html/parsoid
15033 <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="https://tools.ietf.org/html/rfc12354" rel="mw:ExtLink" class="external text">RFC 12354</a></figcaption></figure>
15034 !! end
15035
15036 !! test
15037 T3887: A mailto link with a thumbnail
15038 !! wikitext
15039 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15040 !! html/php
15041 <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>
15042
15043 !! html/parsoid
15044 <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" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
15045 !! end
15046
15047 # Pending resolution to T2368
15048 !! test
15049 T2648: Frameless image caption with a link
15050 !! wikitext
15051 [[File:Foobar.jpg|text with a [[link]] in it]]
15052 !! html/php
15053 <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>
15054 </p>
15055 !! html/parsoid
15056 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15057 !! end
15058
15059 !! test
15060 T2648: Frameless image caption with a link (suffix)
15061 !! wikitext
15062 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15063 !! html/php
15064 <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>
15065 </p>
15066 !! html/parsoid
15067 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15068 !! end
15069
15070 !! test
15071 T2648: Frameless image caption with an interwiki link
15072 !! wikitext
15073 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15074 !! html/php
15075 <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>
15076 </p>
15077 !! html/parsoid
15078 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15079 !! end
15080
15081 !! test
15082 T2648: Frameless image caption with a piped interwiki link
15083 !! wikitext
15084 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15085 !! html/php
15086 <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>
15087 </p>
15088 !! html/parsoid
15089 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15090 !! end
15091
15092 !! test
15093 T107474: Frameless image caption with <nowiki>
15094 !! wikitext
15095 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15096 !! html/parsoid
15097 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15098 !! end
15099
15100 !! test
15101 Escape HTML special chars in image alt text
15102 !! wikitext
15103 [[File:Foobar.jpg|& < > "]]
15104 !! html/php
15105 <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>
15106 </p>
15107 !! html/parsoid
15108 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15109 !! end
15110
15111 !! test
15112 Escape HTML special chars in image alt text with LanguageConverter
15113 !! options
15114 language=zh
15115 !! wikitext
15116 [[File:Foobar.jpg|& < > "]]
15117 !! html/php
15118 <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>
15119 </p>
15120 !! html/parsoid
15121 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15122 !! end
15123
15124 !! test
15125 Entities in file name and attributes
15126 !! wikitext
15127 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15128 !! html/php
15129 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15130 </p>
15131 !! html/parsoid
15132 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></figure-inline></p>
15133 !! end
15134
15135 !! test
15136 T2499: Alt text should have &#1234;, not &amp;1234;
15137 !! wikitext
15138 [[File:Foobar.jpg|&#9792;]]
15139 !! html/php
15140 <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>
15141 </p>
15142 !! html/parsoid
15143 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15144 !! end
15145
15146 !! test
15147 Broken image caption with link
15148 !! options
15149 parsoid=wt2html,wt2wt,html2html
15150 !! wikitext
15151 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15152 !! html/php
15153 <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.
15154 </p>
15155 !! html/parsoid
15156 <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>
15157 !! end
15158
15159 !! test
15160 Image caption containing another image
15161 !! wikitext
15162 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15163 !! html/php
15164 <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>
15165
15166 !! html/parsoid
15167 <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 <figure-inline 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></figure-inline> inside it!</figcaption></figure>
15168 !! end
15169
15170 !! test
15171 Image: caption containing a newline
15172 !! wikitext
15173 [[File:Foobar.jpg|This
15174 *is some text]]
15175 !! html/php
15176 <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>
15177 </p>
15178 !! html/parsoid
15179 <p><figure-inline 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></figure-inline></p>
15180 !!end
15181
15182 !!test
15183 Image: caption containing leading space
15184 (The leading space should not trigger nowiki escaping in wt2wt mode)
15185 !! wikitext
15186 [[File:Foobar.jpg|thumb| bar]]
15187 !! html/php
15188 <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>
15189
15190 !! html/parsoid
15191 <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>
15192 !!end
15193
15194 # html/php output not have newlines after table, td, th, etc. because
15195 # Linker::makeThumbLink2() replaces the newlines with spaces since
15196 # the table is inside a caption.
15197 # FIXME: Verify if that circa 2004 fix is still required.
15198 !! test
15199 Image: caption containing a table
15200 !! options
15201 parsoid=wt2html,wt2wt,html2html
15202 !! wikitext
15203 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15204 {|
15205 !Foo!!Bar
15206 |-
15207 |Foo1||Bar1
15208 |}
15209 and some more text.]]
15210 !! html/php
15211 <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>
15212
15213 !! html/parsoid
15214 <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
15215 <table>
15216 <tbody>
15217 <tr><th>Foo</th><th>Bar</th></tr>
15218 <tr>
15219 <td>Foo1</td>
15220 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15221 !! end
15222
15223 !! test
15224 T5090: External links other than http: in image captions
15225 !! wikitext
15226 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15227 !! html/php
15228 <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>
15229
15230 !! html/parsoid
15231 <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" class="external text" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" class="external text" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
15232 !! end
15233
15234 !! test
15235 Custom class
15236 !! options
15237 parsoid=wt2html,wt2wt,html2html
15238 !! wikitext
15239 [[Image:foobar.jpg|a|class=b]]
15240 !! html/php
15241 <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>
15242 </p>
15243 !! html/parsoid
15244 <p><figure-inline 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></figure-inline></p>
15245 !! end
15246
15247 !! test
15248 Localized image handling (1).
15249 !! options
15250 parsoid=wt2html,wt2wt,html2html
15251 language=es
15252 !! wikitext
15253 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15254 !! html/php
15255 <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>
15256
15257 !! html/parsoid
15258 <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>
15259 !! end
15260
15261 !! test
15262 Localized image handling (2).
15263 !! options
15264 thumbsize=220
15265 parsoid=wt2html,wt2wt,html2html
15266 language=es
15267 !! wikitext
15268 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15269 !! html/php
15270 <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>
15271
15272 !! html/parsoid
15273 <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>
15274 !! end
15275
15276 !! test
15277 Localized image handling (3).
15278 !! options
15279 language=fa
15280 parsoid=html2wt
15281 !! html/parsoid
15282 <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>
15283 !! wikitext
15284 [[File:Foobar.jpg|بندانگشتی]]
15285 !! end
15286
15287 !! test
15288 "border", "frameless" and "class" attributes on an image.
15289 !! options
15290 thumbsize=220
15291 parsoid=wt2html,wt2wt,html2html
15292 !! wikitext
15293 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15294 !! html/php
15295 <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>
15296 </p>
15297 !! html/parsoid
15298 <p><figure-inline 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></figure-inline></p>
15299 !! end
15300
15301 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15302 !! test
15303 Invalid image attributes (T64500)
15304 !! options
15305 thumbsize=220
15306 parsoid=wt2html,wt2wt,html2html
15307 !! wikitext
15308 [[File:Foobar.jpg|thumb|float|left|caption]]
15309
15310 [[File:Foobar.jpg|thumb|righ|caption]]
15311
15312 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15313 !! html/php
15314 <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>
15315 <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>
15316 <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>
15317
15318 !! html/parsoid
15319 <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>
15320 <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>
15321 <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>
15322 !! end
15323
15324 !! article
15325 File:Barfoo.jpg
15326 !! text
15327 #REDIRECT [[File:Barfoo.jpg]]
15328 !! endarticle
15329
15330 # FIXME: Parsoid should run this test -- but we'd need to teach the
15331 # mockAPI about the redirected Barfoo.jpg image.
15332 !! test
15333 Redirected image
15334 !! wikitext
15335 [[Image:Barfoo.jpg]]
15336 !! html/php
15337 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15338 </p>
15339 !! end
15340
15341 !! test
15342 Missing image with uploads disabled
15343 !! options
15344 wgEnableUploads=0
15345 !! wikitext
15346 [[File:Foobaz.jpg]]
15347 !! html/php
15348 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15349 </p>
15350 !! html/parsoid
15351 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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></figure-inline></p>
15352 !! end
15353
15354 # Parsoid-specific testing for images
15355 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15356 # Currently imperfect due to a flaw in the Parsoid testrunner
15357 # Work in progress
15358 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15359 # image tests.
15360
15361 !! test
15362 Parsoid-specific image handling - simple image with size and middle alignment
15363 !! wikitext
15364 [[File:Foobar.jpg|middle|50px]]
15365 !! html/parsoid
15366 <p><figure-inline 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></figure-inline></p>
15367 !! end
15368
15369 !! test
15370 Parsoid-specific image handling - simple image with size, middle alignment,
15371 non-standard namespace alias
15372 !! options
15373 parsoid=wt2wt,wt2html,html2html
15374 !! wikitext
15375 [[Image:Foobar.jpg|middle|50px]]
15376 !! html/parsoid
15377 <p><figure-inline 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></figure-inline></p>
15378 !! end
15379
15380 !! test
15381 Parsoid-specific image handling - simple image with size and middle alignment
15382 (existing content)
15383 !! wikitext
15384 [[File:Foobar.jpg|50px|middle]]
15385 !! html/parsoid
15386 <p><figure-inline 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></figure-inline></p>
15387 !! end
15388
15389 !! test
15390 Parsoid-specific image handling - simple image with size and middle alignment
15391 and non-standard namespace name
15392 !! options
15393 parsoid=wt2html,wt2wt,html2html
15394 !! wikitext
15395 [[Image:Foobar.jpg|50px|middle]]
15396 !! html/parsoid
15397 <p><figure-inline 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></figure-inline></p>
15398 !! end
15399
15400 !! test
15401 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15402 !! wikitext
15403 [[File:Foobar.jpg|500x10px|baseline|caption]]
15404 !! html/parsoid
15405 <p><figure-inline 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></figure-inline></p>
15406 !! end
15407
15408 !! test
15409 Parsoid-specific image handling - simple image with border and size spec
15410 !! wikitext
15411 [[File:Foobar.jpg|50px|border|caption]]
15412 !! html/parsoid
15413 <p><figure-inline 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></figure-inline></p>
15414 !! end
15415
15416 !! test
15417 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15418 !! wikitext
15419 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15420 !! html/parsoid
15421 <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>
15422 !! end
15423
15424 !! test
15425 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15426 (existing content)
15427 !! wikitext
15428 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15429 !! html/parsoid
15430 <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>
15431 !! end
15432
15433 !! test
15434 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15435 !! wikitext
15436 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15437 !! html/parsoid
15438 <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>
15439 !! end
15440
15441 !! test
15442 Parsoid-specific image handling - thumbnail with specific size, halign,
15443 valign, and caption (existing content)
15444 !! wikitext
15445 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15446 !! html/parsoid
15447 <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>
15448 !! end
15449
15450 !! test
15451 Parsoid-specific image handling - framed image with specific size and caption
15452 (size is ignored)
15453 !! options
15454 parsoid=wt2html,wt2wt,html2html
15455 !! wikitext
15456 [[File:Foobar.jpg|frame|500x50px|caption]]
15457 !! html/parsoid
15458 <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>
15459 !! end
15460
15461 !! test
15462 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15463 (size is ignored)
15464 !! options
15465 parsoid=wt2html,wt2wt,html2html
15466 !! wikitext
15467 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15468 !! html/parsoid
15469 <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>
15470 !! end
15471
15472 !! test
15473 Parsoid-specific image handling - frameless image with specific size, border, and caption
15474 !! wikitext
15475 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15476 !! html/parsoid
15477 <p><figure-inline 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></figure-inline></p>
15478 !! end
15479
15480 !! test
15481 Parsoid-specific image handling - simple image with a formatted caption
15482 !! wikitext
15483 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15484 !! html/parsoid
15485 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15486 !! end
15487
15488 !! test
15489 Parsoid-specific image handling - caption with a template in it
15490 !! wikitext
15491 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15492 !! html/parsoid
15493 <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>
15494 !! end
15495
15496 !! test
15497 Parsoid-specific image handling - caption with unbalanced tags in it
15498 !! options
15499 parsoid=wt2html,wt2wt,html2html
15500 !! wikitext
15501 foo
15502 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15503 bar
15504 !! html/parsoid
15505 <p>foo</p>
15506 <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>
15507 <p>bar</p>
15508 !! end
15509
15510 !! test
15511 Parsoid-specific image handling - empty caption (1)
15512 !! options
15513 parsoid=wt2html,wt2wt
15514 !! wikitext
15515 [[File:Foobar.jpg|thumb|]]
15516 !! html/parsoid
15517 <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>
15518 !! end
15519
15520 # empty captions don't get serialized unless we're in the "round trip" case
15521 !! test
15522 Parsoid-specific image handling - empty caption (2)
15523 !! options
15524 parsoid=html2wt
15525 !! html/parsoid
15526 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15527 <a href="./File:Foobar.jpg">
15528 <img resource="./File:Foobar.jpg"
15529 src="//example.com/images/3/3a/Foobar.jpg"
15530 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15531 height="25" width="220"/>
15532 </a>
15533 <figcaption></figcaption>
15534 </figure>
15535 !! wikitext
15536 [[File:Foobar.jpg|thumb]]
15537 !! end
15538
15539 !! test
15540 Parsoid-specific image handling - whitespace caption
15541 !! wikitext
15542 [[File:Foobar.jpg|thumb| ]]
15543 !! html/parsoid
15544 <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>
15545 !! end
15546
15547 !! test
15548 Parsoid-specific image handling - lang option
15549 !! wikitext
15550 foo
15551 [[File:Foobar.svg|lang=de|caption]]
15552 bar
15553 !! html/parsoid
15554 <p>foo
15555 <figure-inline 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></figure-inline>
15556 bar</p>
15557 !! end
15558
15559 ## Edge case bugs in Parsoid from T93580
15560 !! test
15561 T93580: 1. Templated <ref> inside block images
15562 !! wikitext
15563 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15564
15565 <references />
15566 !! html/parsoid
15567 <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: <sup 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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
15568
15569 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
15570 !! end
15571
15572 !! test
15573 T93580: 2. <ref> inside inline images
15574 !! wikitext
15575 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15576
15577 <references />
15578 !! html/parsoid
15579 <p><figure-inline 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;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15580
15581 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
15582 !! end
15583
15584 !! test
15585 T93580: 3. Templated <ref> inside inline images
15586 !! wikitext
15587 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15588
15589 <references />
15590 !! html/parsoid
15591 <p><figure-inline 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;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15592
15593 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
15594 !! end
15595
15596 ###
15597 ### Subpages
15598 ###
15599 !! article
15600 Subpage test/subpage
15601 !! text
15602 foo
15603 !! endarticle
15604
15605 !! test
15606 Subpage link
15607 !! options
15608 subpage title=[[Subpage test]]
15609 !! wikitext
15610 [[/subpage]]
15611 !! html
15612 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15613 </p>
15614 !! end
15615
15616 !! test
15617 Subpage noslash link
15618 !! options
15619 subpage title=[[Subpage test]]
15620 !! wikitext
15621 [[/subpage/]]
15622 !! html
15623 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15624 </p>
15625 !! end
15626
15627 !! article
15628 Subpage test/1/2/subpage
15629 !! text
15630 blah
15631 !! endarticle
15632
15633 !! test
15634 Relative subpage noslash link
15635 !! options
15636 parsoid=wt2wt,wt2html,html2html
15637 subpage title=[[Subpage test/1/2/3/4]]
15638 !! wikitext
15639 [[../../subpage/]]
15640
15641 [[../../subpage]]
15642 !! html/php
15643 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15644 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15645 </p>
15646 !! html/parsoid
15647 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15648 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15649 !! end
15650
15651 !! test
15652 Parsoid: dot-slash prefixed wikilinks
15653 !! wikitext
15654 [[./foo]]
15655
15656 [[././bar]]
15657
15658 [[././baz/]]
15659 !! html/php
15660 <p>[[./foo]]
15661 </p><p>[[././bar]]
15662 </p><p>[[././baz/]]
15663 </p>
15664 !! html/parsoid
15665 <p>[[./foo]]
15666 </p><p>[[././bar]]
15667 </p><p>[[././baz/]]
15668 </p>
15669 !! end
15670
15671 !! test
15672 Render invalid page names as plain text (T53090)
15673 !! wikitext
15674 [[./../foo|bar]]
15675 [[foo�|bar]]
15676 [[foo/.|bar]]
15677 [[foo/..|bar]]
15678 [[foo~~~bar]]
15679 [[foo>bar]]
15680 [[foo[bar]]
15681 [[.]]
15682 [[..]]
15683 [[foo././bar]]
15684 [[foo[http://example.com]xyz]]
15685
15686 [[{{echo|./../foo}}|bar]]
15687 [[{{echo|foo/.}}|bar]]
15688 [[{{echo|foo/..}}|bar]]
15689 [[{{echo|foo~~~~bar}}]]
15690 [[{{echo|foo>bar}}]]
15691 [[{{echo|foo././bar}}]]
15692 [[{{echo|foo{bar}}]]
15693 [[{{echo|foo}bar}}]]
15694 [[{{echo|foo[bar}}]]
15695 [[{{echo|foo]bar}}]]
15696 [[{{echo|foo<bar}}]]
15697 !!html/php
15698 <p>[[./../foo|bar]]
15699 [[foo�|bar]]
15700 [[foo/.|bar]]
15701 [[foo/..|bar]]
15702 [[foo~~~bar]]
15703 [[foo&gt;bar]]
15704 [[foo[bar]]
15705 [[.]]
15706 [[..]]
15707 [[foo././bar]]
15708 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15709 </p><p>[[./../foo|bar]]
15710 [[foo/.|bar]]
15711 [[foo/..|bar]]
15712 [[foo~~~~bar]]
15713 [[foo&gt;bar]]
15714 [[foo././bar]]
15715 [[foo{bar]]
15716 [[foo}bar]]
15717 [[foo[bar]]
15718 [[foo]bar]]
15719 [[foo&lt;bar]]
15720 </p>
15721 !!html/parsoid
15722 <p>[[./../foo|bar]]
15723 [[foo�|bar]]
15724 [[foo/.|bar]]
15725 [[foo/..|bar]]
15726 [[foo~~~bar]]
15727 [[foo>bar]]
15728 [[foo[bar]]
15729 [[.]]
15730 [[..]]
15731 [[foo././bar]]
15732 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15733
15734 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15735 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15736 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15737 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15738 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15739 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15740 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15741 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15742 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15743 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15744 [[<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>
15745 !!end
15746
15747 !! test
15748 Disabled subpages
15749 !! wikitext
15750 [[/subpage]]
15751 !! html
15752 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15753 </p>
15754 !! end
15755
15756 !! test
15757 T2561: {{/Subpage}}
15758 !! options
15759 subpage title=[[Page]]
15760 !! wikitext
15761 {{/Subpage}}
15762 !! html
15763 <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>
15764 </p>
15765 !! end
15766
15767 ###
15768 ### Categories
15769 ###
15770 !! article
15771 Category:MediaWiki User's Guide
15772 !! text
15773 blah
15774 !! endarticle
15775
15776 !! test
15777 Link to category
15778 !! wikitext
15779 [[:Category:MediaWiki User's Guide]]
15780 !! html
15781 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15782 </p>
15783 !! end
15784
15785 !! test
15786 Simple category
15787 !! options
15788 cat
15789 !! wikitext
15790 [[Category:MediaWiki User's Guide]]
15791 !! html/php
15792 cat=MediaWiki_User's_Guide sort=
15793 !! html/parsoid
15794 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15795 !! end
15796
15797 !! test
15798 PAGESINCATEGORY invalid title fatal (r33546 fix)
15799 !! wikitext
15800 {{PAGESINCATEGORY:<bogus>}}
15801 !! html
15802 <p>0
15803 </p>
15804 !! end
15805
15806 !! test
15807 Category with different sort key
15808 !! options
15809 cat
15810 !! wikitext
15811 [[Category:MediaWiki User's Guide|Foo]]
15812 !! html/php
15813 cat=MediaWiki_User's_Guide sort=Foo
15814 !! html/parsoid
15815 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15816 !! end
15817
15818 !! test
15819 Category with identical sort key
15820 !! options
15821 cat
15822 !! wikitext
15823 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15824 !! html/php
15825 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15826 !! html/parsoid
15827 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15828 !! end
15829
15830 !! test
15831 Category with empty sort key
15832 !! options
15833 cat
15834 pst
15835 !! wikitext
15836 [[Category:MediaWiki User's Guide|]]
15837 !! html/php
15838 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15839 !! end
15840
15841 !! test
15842 Category with empty sort key and parentheses
15843 !! options
15844 cat
15845 pst
15846 !! wikitext
15847 [[Category:Foo (bar)|]]
15848 !! html/php
15849 [[Category:Foo (bar)|Foo]]
15850 !! end
15851
15852 !! test
15853 Category with link tail
15854 !! options
15855 cat
15856 pst
15857 !! wikitext
15858 123[[Category:Foo]]456
15859 !! html/php
15860 123[[Category:Foo]]456
15861 !! end
15862
15863 !! test
15864 Category with template
15865 !! options
15866 cat
15867 pst
15868 !! wikitext
15869 [[Category:{{echo|Foo}}]]
15870 !! html/php
15871 [[Category:{{echo|Foo}}]]
15872 !! end
15873
15874 !! test
15875 Category with template in sort key
15876 !! options
15877 cat
15878 pst
15879 !! wikitext
15880 [[Category:Foo|{{echo|Bar}}]]
15881 !! html/php
15882 [[Category:Foo|{{echo|Bar}}]]
15883 !! end
15884
15885 !! test
15886 Category with template in sort key and title
15887 !! options
15888 cat
15889 pst
15890 !! wikitext
15891 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15892 !! html/php
15893 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15894 !! end
15895
15896 ## We used to, but no longer wt2wt this test since the default serializer
15897 ## will normalize all categories to serialize on their own line.
15898 ## This wikitext usage is going to be fairly uncommon in production and
15899 ## selser will take care of preserving formatting in those scenarios.
15900 !! test
15901 Category / paragraph interactions
15902 !! options
15903 parsoid=wt2html
15904 !! wikitext
15905 Foo [[Category:Baz]] Bar
15906
15907 Foo [[Category:Baz]]
15908 Bar
15909
15910 Foo
15911 [[Category:Baz]]
15912 Bar
15913
15914 Foo
15915 [[Category:Baz]] Bar
15916
15917 Foo
15918 [[Category:Baz]]
15919 [[Category:Baz]]
15920 [[Category:Baz]]
15921 Bar
15922
15923 [[Category:Baz]]
15924 [[Category:Baz]]
15925 [[Category:Baz]]
15926
15927 [[Category:Baz]]
15928 {{echo|[[Category:Baz]]}}
15929 [[Category:Baz]]
15930 !! html/php
15931 <p>Foo Bar
15932 </p><p>Foo
15933 Bar
15934 </p><p>Foo
15935 Bar
15936 </p><p>Foo Bar
15937 </p><p>Foo
15938 Bar
15939 </p>
15940 !! html/parsoid
15941 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15942 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15943 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15944 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15945 <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</p>
15946 <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}}]}'/>
15947 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15948 !! end
15949
15950 ## We used to, but no longer wt2wt this test since the default serializer
15951 ## will normalize all categories to serialize on their own line.
15952 ## This wikitext usage is going to be fairly uncommon in production and
15953 ## selser will take care of preserving formatting in those scenarios.
15954 ##
15955 ## The whitespace on the empty line is part of the test. Please do not delete
15956 !! test
15957 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15958 !! options
15959 parsoid=wt2html
15960 !! wikitext
15961 This
15962
15963 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15964
15965 {{echo|[[Category:Foo]] and so should this!}}
15966 !! html/php
15967 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15968 </p>
15969 !! html/parsoid
15970 <p>This
15971
15972 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15973
15974 <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>
15975 !! end
15976
15977 ## Parsoid will not try to wt2wt this while preserving newlines because
15978 ## it suppresses excess newlines within list items -- and we don't want to
15979 ## introduce a special case just for categories, which is, in reality somewhat
15980 ## odd behavior -- categories are unlikely to be used in list items like this
15981 ## in top-level pages and are only likely to show up in template-generated
15982 ## list items where this RT-ing is a non-issue.
15983 ##
15984 ## The whitespace on the empty line is part of the test. Please do not delete
15985 !! test
15986 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15987 !! options
15988 parsoid=wt2html
15989 !! wikitext
15990 * This
15991
15992 [[Category:Foo]] and this should be part of the same list item
15993 * So should this
15994
15995 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15996 !! html
15997 <ul><li>This and this should be part of the same list item</li>
15998 <li>So should this and this should be part of the same list item</li></ul>
15999 !! html/parsoid
16000 <ul>
16001 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16002 <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>
16003 </ul>
16004 !! end
16005
16006 ## Newlines and categories that follow the last item of a list
16007 ## are treated differently because this (list followed by categories)
16008 ## is an extremely common pattern on wikis.
16009 !! test
16010 3. Categories and newlines: newline suppression for last list item should RT properly
16011 !! wikitext
16012 * a
16013 * b
16014
16015 [[Category:Foo]]
16016
16017 [[Category:Bar]]
16018 [[Category:Baz]]
16019 !! html/parsoid
16020 <ul><li> a</li>
16021 <li> b</li></ul>
16022
16023 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16024
16025 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16026 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16027 !! end
16028
16029 !! test
16030 4. Categories and newlines: newline suppression for last list item should RT properly
16031 !! wikitext
16032 * a
16033 **** b
16034
16035 [[Category:Foo]]
16036 !! html/parsoid
16037 <ul><li> a
16038 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16039
16040 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16041 !! end
16042
16043 ## only wt2html for this to make sure the algo only applies to the rightmost path
16044 !! test
16045 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16046 !! options
16047 parsoid=wt2html
16048 !! wikitext
16049 * a
16050 ** b
16051 [[Category:Foo]]
16052 * c
16053 ** d
16054 [[Category:Foo]]
16055 !! html/parsoid
16056 <ul><li> a
16057 <ul><li> b
16058 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16059 <li> c
16060 <ul><li> d</li></ul></li></ul>
16061 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16062 !! end
16063
16064 ## We used to, but no longer wt2wt this test since the default serializer
16065 ## will normalize all categories to serialize on their own line.
16066 ## This wikitext usage is going to be fairly uncommon in production and
16067 ## selser will take care of preserving formatting in those scenarios.
16068 !! test
16069 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16070 !! options
16071 parsoid=wt2html
16072 !! wikitext
16073 * a [[Category:Foo]]
16074 !! html/parsoid
16075 <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>
16076 !! end
16077
16078 # This test also demonstrates because of newline+category tunneling
16079 # through the list hander, template wrapping doesn't expand to the
16080 # containing list when the list item swallows the category.
16081 !! test
16082 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16083 !! wikitext
16084 * {{echo|a
16085 [[Category:Foo]]}}
16086 !! html/parsoid
16087 <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
16088 </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>
16089 !! end
16090
16091 !! test
16092 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16093 !! wikitext
16094 * a
16095
16096 {{echo|[[Category:Foo]]
16097 [[Category:Bar]]}}
16098 [[Category:Baz]]
16099 !! html/parsoid
16100 <ul><li> a</li></ul>
16101
16102 <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">
16103 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16104 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16105 !! end
16106
16107 !! test
16108 9. Categories and newlines: should behave properly with linkprefix (T87753)
16109 !! options
16110 language=ar
16111 !! wikitext
16112 foo bar
16113 foo bar
16114 [[تصنيف:Foo]]
16115 [[تصنيف:Bar]]
16116 !! html/php
16117 <p>foo bar
16118 foo bar
16119 </p>
16120 !! html/parsoid
16121 <p>foo bar
16122 foo bar</p>
16123 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16124 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16125 !! end
16126
16127 !! test
16128 10. No regressions on internal links following category (T174639)
16129 !! options
16130 parsoid=wt2html,html2html
16131 !! wikitext
16132 [[Category:Foo]]<div>a
16133
16134 [[Foo]]</div>
16135 !! html/php
16136 <div>a
16137 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16138
16139 !! html/parsoid
16140 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16141
16142 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16143 !! end
16144
16145 # Note that Parsoid differs slightly from PHP due to T175421
16146 !! test
16147 11. Special case where only newlines separate links (T175416)
16148 !! options
16149 parsoid=wt2html,html2html
16150 !! wikitext
16151 [[Category:Foo]]
16152
16153 [[Foo]][[es:Alimento]]
16154
16155 [[Foo]]
16156 !! html/php
16157 <p><br />
16158 <a href="/wiki/Foo" title="Foo">Foo</a>
16159 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16160 </p>
16161 !! html/parsoid
16162 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16163
16164 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16165
16166 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16167 !! end
16168
16169 !! test
16170 Category links with multiple namespaces
16171 !! wikitext
16172 [[Category:Project:Foo]]
16173 !! html/parsoid
16174 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16175 !! end
16176
16177 !! test
16178 Parsoid: Serialize link to category page with colon escape
16179 !! options
16180 parsoid
16181 !! wikitext
16182
16183 [[:Category:Foo]]
16184 [[:Category:Foo|Bar]]
16185 !! html
16186 <p>
16187 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16188 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16189 </p>
16190 !! end
16191
16192 # We used to, but no longer wt2wt this test since the default serializer
16193 # will normalize all categories to serialize on their own line.
16194 # This wikitext usage is going to be fairly uncommon in production and
16195 # selser will take care of preventing whitespace insertion if this
16196 # occurs in an article.
16197 #
16198 # html2html disabled for the same reason (whitespace insertion between
16199 # x and y).
16200 #
16201 # html2wt disabled because it localizes the "Category" namespace.
16202 !! test
16203 Link prefix/suffixes aren't applied to category links
16204 !! options
16205 parsoid=wt2html
16206 language=is
16207 !! wikitext
16208 x[[Category:Foo]]y
16209 !! html/php
16210 <p>xy
16211 </p>
16212 !! html/parsoid
16213 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16214 !! end
16215
16216 !! test
16217 Link prefix/suffixes aren't applied to language links
16218 !! options
16219 parsoid=wt2html
16220 language=is
16221 !! wikitext
16222 x[[es:Foo]]y
16223 !! html/php
16224 <p>xy
16225 </p>
16226 !! html/parsoid
16227 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16228 !! end
16229
16230 !! test
16231 Parsoid: Serialize link to file page with colon escape
16232 !! options
16233 parsoid
16234 !! wikitext
16235
16236 [[:File:Foo.png]]
16237 [[:File:Foo.png|Bar]]
16238 !! html
16239 <p>
16240 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16241 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16242 </p>
16243 !! end
16244
16245 !! test
16246 Parsoid: Serialize a genuine category link without colon escape
16247 !! options
16248 parsoid
16249 !! wikitext
16250 [[Category:Foo]]
16251 [[Category:Foo|Bar]]
16252 !! html
16253 <link rel="mw:PageProp/Category" href="./Category:Foo">
16254 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16255 !! end
16256
16257 !! test
16258 Normalize hrefs properly before testing for invalid link targets (T72894)
16259 !! options
16260 parsoid=html2wt
16261 !! html/parsoid
16262 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16263 !! wikitext
16264 [[Category:Toxine bactérienne]]
16265 !! end
16266
16267 !! test
16268 Parsoid: Defaultsort
16269 !! wikitext
16270 {{DEFAULTSORT:Foo}}
16271 !! html/parsoid
16272 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16273 !! end
16274
16275 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16276 # But, this is a limitation of our representation and is documented in
16277 # TemplateHandler.js in processSpecialMagicWord
16278 !! test
16279 Parsoid: Defaultsort (template-generated)
16280 !! wikitext
16281 {{{{echo|DEFAULTSORT}}:Foo}}
16282 !! html/parsoid
16283 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{{{echo|DEFAULTSORT}}:Foo}}","dsr":[0,26,null,null]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}&#39;>DEFAULTSORT&lt;/span>:Foo"}]]}'/>
16284 !! end
16285
16286 ###
16287 ### Inter-language links
16288 ###
16289 !! test
16290 Interlanguage links
16291 !! options
16292 ill
16293 !! wikitext
16294 [[es:Alimento]]
16295 [[fr:Nourriture]]
16296 [[zh:食品]]
16297 !! html/php
16298 es:Alimento fr:Nourriture zh:食品
16299 !! html/parsoid
16300 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16301 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16302 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16303 !! end
16304
16305 !! test
16306 Duplicate interlanguage links (T26502)
16307 !! options
16308 ill
16309 !! wikitext
16310 [[es:1]]
16311 [[es:2]]
16312 [[fr:1]]
16313 [[fr:2]]
16314 !! html/php
16315 es:1 fr:1
16316 !! html/parsoid
16317 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16318 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16319 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16320 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16321 !! end
16322
16323 ###
16324 ### Sections
16325 ###
16326 !! test
16327 Basic section headings
16328 !! wikitext
16329 ==Headline 1==
16330 Some text
16331
16332 ==Headline 2==
16333 More
16334 ===Smaller headline===
16335 Blah blah
16336 !! html
16337 <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>
16338 <p>Some text
16339 </p>
16340 <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>
16341 <p>More
16342 </p>
16343 <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>
16344 <p>Blah blah
16345 </p>
16346 !! end
16347
16348 !! test
16349 Section headings with TOC
16350 !! wikitext
16351 ==Headline 1==
16352 ===Subheadline 1===
16353 =====Skipping a level=====
16354 ======Skipping a level======
16355
16356 ==Headline 2==
16357 Some text
16358 ===Another headline===
16359 !! html
16360 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16361 <ul>
16362 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16363 <ul>
16364 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16365 <ul>
16366 <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>
16367 <ul>
16368 <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>
16369 </ul>
16370 </li>
16371 </ul>
16372 </li>
16373 </ul>
16374 </li>
16375 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16376 <ul>
16377 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16378 </ul>
16379 </li>
16380 </ul>
16381 </div>
16382
16383 <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>
16384 <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>
16385 <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>
16386 <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>
16387 <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>
16388 <p>Some text
16389 </p>
16390 <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>
16391
16392 !! end
16393
16394 !! test
16395 TOC anchors don't collide
16396 !! wikitext
16397 __FORCETOC__
16398 ==Headline 2==
16399 ==Headline==
16400 ==Headline 2==
16401 ==Headline==
16402 !! html/php
16403 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16404 <ul>
16405 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16406 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16407 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16408 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16409 </ul>
16410 </div>
16411
16412 <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>
16413 <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>
16414 <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>
16415 <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>
16416
16417 !! end
16418
16419 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16420 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16421 !! test
16422 Handling of sections up to level 6 and beyond
16423 !! options
16424 parsoid=wt2html
16425 !! wikitext
16426 =Level 1 Heading=
16427 ==Level 2 Heading==
16428 ===Level 3 Heading===
16429 ====Level 4 Heading====
16430 =====Level 5 Heading=====
16431 ======Level 6 Heading======
16432 =======Level 7 Heading=======
16433 ========Level 8 Heading========
16434 =========Level 9 Heading=========
16435 ==========Level 10 Heading==========
16436 !! html/php
16437 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16438 <ul>
16439 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16440 <ul>
16441 <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>
16442 <ul>
16443 <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>
16444 <ul>
16445 <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>
16446 <ul>
16447 <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>
16448 <ul>
16449 <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>
16450 <li class="toclevel-6 tocsection-7"><a href="#.3DLevel_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">=Level 7 Heading=</span></a></li>
16451 <li class="toclevel-6 tocsection-8"><a href="#.3D.3DLevel_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">==Level 8 Heading==</span></a></li>
16452 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3DLevel_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">===Level 9 Heading===</span></a></li>
16453 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3DLevel_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>
16454 </ul>
16455 </li>
16456 </ul>
16457 </li>
16458 </ul>
16459 </li>
16460 </ul>
16461 </li>
16462 </ul>
16463 </li>
16464 </ul>
16465 </div>
16466
16467 <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>
16468 <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>
16469 <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>
16470 <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>
16471 <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>
16472 <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>
16473 <h6><span class="mw-headline" id=".3DLevel_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>
16474 <h6><span class="mw-headline" id=".3D.3DLevel_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>
16475 <h6><span class="mw-headline" id=".3D.3D.3DLevel_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>
16476 <h6><span class="mw-headline" id=".3D.3D.3D.3DLevel_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>
16477
16478 !! html/parsoid
16479 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16480 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16481 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16482 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16483 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16484 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16485 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3D_Level_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16486 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3D_Level_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16487 <h6 id="===Level_9_Heading===" data-parsoid='{}'><span id=".3D.3D.3D_Level_9_Heading.3D.3D.3D" typeof="mw:FallbackId"></span>===Level 9 Heading===</h6>
16488 <h6 id="====Level_10_Heading====" data-parsoid='{}'><span id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" typeof="mw:FallbackId"></span>====Level 10 Heading====</h6>
16489 !! end
16490
16491 !! test
16492 TOC regression (T11764)
16493 !! wikitext
16494 ==title 1==
16495 ===title 1.1===
16496 ====title 1.1.1====
16497 ===title 1.2===
16498 ==title 2==
16499 ===title 2.1===
16500 !! html
16501 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16502 <ul>
16503 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16504 <ul>
16505 <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>
16506 <ul>
16507 <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>
16508 </ul>
16509 </li>
16510 <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>
16511 </ul>
16512 </li>
16513 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16514 <ul>
16515 <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>
16516 </ul>
16517 </li>
16518 </ul>
16519 </div>
16520
16521 <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>
16522 <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>
16523 <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>
16524 <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>
16525 <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>
16526 <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>
16527
16528 !! end
16529
16530 !! test
16531 TOC for heading containing <span id="..."></span> (T96153)
16532 !! wikitext
16533 __FORCETOC__
16534 ==<span id="old-anchor"></span>New title==
16535 !! html/php
16536 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16537 <ul>
16538 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16539 </ul>
16540 </div>
16541
16542 <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>
16543
16544 !! end
16545
16546 !! test
16547 TOC with wgMaxTocLevel=3 (T8204)
16548 !! options
16549 wgMaxTocLevel=3
16550 !! wikitext
16551 ==title 1==
16552 ===title 1.1===
16553 ====title 1.1.1====
16554 ===title 1.2===
16555 ==title 2==
16556 ===title 2.1===
16557 !! html
16558 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16559 <ul>
16560 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16561 <ul>
16562 <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>
16563 <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>
16564 </ul>
16565 </li>
16566 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16567 <ul>
16568 <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>
16569 </ul>
16570 </li>
16571 </ul>
16572 </div>
16573
16574 <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>
16575 <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>
16576 <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>
16577 <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>
16578 <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>
16579 <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>
16580
16581 !! end
16582
16583 !! test
16584 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16585 !! options
16586 wgMaxTocLevel=3
16587 !! wikitext
16588 ==Section 1==
16589 ===Section 1.1===
16590 ====Section 1.1.1====
16591 ====Section 1.1.1.1====
16592 ==Section 2==
16593 !! html
16594 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16595 <ul>
16596 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16597 <ul>
16598 <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>
16599 </ul>
16600 </li>
16601 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16602 </ul>
16603 </div>
16604
16605 <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>
16606 <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>
16607 <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>
16608 <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>
16609 <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>
16610
16611 !! end
16612
16613
16614 !! test
16615 Resolving duplicate section names
16616 !! wikitext
16617 ==Foo bar==
16618 ==Foo bar==
16619 !! html
16620 <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>
16621 <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>
16622
16623 !! end
16624
16625 !! test
16626 Resolving duplicate section names with differing case (T12721)
16627 !! wikitext
16628 ==Foo bar==
16629 ==Foo Bar==
16630 !! html
16631 <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>
16632 <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>
16633
16634 !! end
16635
16636 !! article
16637 Template:sections
16638 !! text
16639 ===Section 1===
16640 ==Section 2==
16641 !! endarticle
16642
16643 !! test
16644 Template with sections, __NOTOC__
16645 !! wikitext
16646 __NOTOC__
16647 ==Section 0==
16648 {{sections}}
16649 ==Section 4==
16650 !! html
16651 <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>
16652 <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>
16653 <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>
16654 <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>
16655
16656 !! end
16657
16658 !! test
16659 __NOEDITSECTION__ keyword
16660 !! wikitext
16661 __NOEDITSECTION__
16662 ==Section 1==
16663 ==Section 2==
16664 !! html
16665 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16666 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16667
16668 !! end
16669
16670 !! test
16671 Link inside a section heading
16672 !! wikitext
16673 ==Section with a [[Main Page|link]] in it==
16674 !! html
16675 <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>
16676
16677 !! end
16678
16679 !! test
16680 TOC regression (T14077)
16681 !! wikitext
16682 __TOC__
16683 ==title 1==
16684 ===title 1.1===
16685 ==title 2==
16686 !! html
16687 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16688 <ul>
16689 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16690 <ul>
16691 <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>
16692 </ul>
16693 </li>
16694 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16695 </ul>
16696 </div>
16697
16698 <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>
16699 <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>
16700 <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>
16701
16702 !! end
16703
16704 !! test
16705 T3219 URL next to image (good)
16706 !! wikitext
16707 http://example.com [[File:Foobar.jpg]]
16708 !! html/php
16709 <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>
16710 </p>
16711 !! html/parsoid
16712 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> <figure-inline 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></figure-inline></p>
16713 !!end
16714
16715 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16716 !! test
16717 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16718 !! options
16719 parsoid=wt2html,html2html
16720 !! wikitext
16721 ===
16722 The line above must have a trailing space!
16723 === <!--
16724 --> <!-- -->
16725 But just in case it doesn't...
16726 !! html/php
16727 <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>
16728 <p>The line above must have a trailing space!
16729 </p>
16730 <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>
16731 <p>But just in case it doesn't...
16732 </p>
16733 !! html/parsoid
16734 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16735 <p>The line above must have a trailing space!</p>
16736 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16737 --> <!-- -->
16738 <p>But just in case it doesn't...</p>
16739 !! end
16740
16741 !! test
16742 Header with special characters (T27462)
16743 !! wikitext
16744 The tooltips shall not show entities to the user (ie. be double escaped)
16745
16746 ==text > text==
16747 section 1
16748
16749 ==text < text==
16750 section 2
16751
16752 ==text & text==
16753 section 3
16754
16755 ==text ' text==
16756 section 4
16757
16758 ==text " text==
16759 section 5
16760 !! html/php
16761 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16762 </p>
16763 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16764 <ul>
16765 <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>
16766 <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>
16767 <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>
16768 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16769 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16770 </ul>
16771 </div>
16772
16773 <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>
16774 <p>section 1
16775 </p>
16776 <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>
16777 <p>section 2
16778 </p>
16779 <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>
16780 <p>section 3
16781 </p>
16782 <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 &#039; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16783 <p>section 4
16784 </p>
16785 <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>
16786 <p>section 5
16787 </p>
16788 !! html/parsoid
16789 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16790
16791 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
16792 <p>section 1</p>
16793
16794 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
16795 <p>section 2</p>
16796
16797 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
16798 <p>section 3</p>
16799
16800 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
16801 <p>section 4</p>
16802
16803 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
16804 <p>section 5</p>
16805 !! end
16806
16807 !! test
16808 Header with space, plus and underscore as entity
16809 !! wikitext
16810 Id should not contain + for spaces
16811
16812 ==Space between Text==
16813 section 1
16814
16815 ==Space-Entity&#32;between&#32;Text==
16816 section 2
16817
16818 ==Plus+between+Text==
16819 section 3
16820
16821 ==Plus-Entity&#43;between&#43;Text==
16822 section 4
16823
16824 ==Underscore_between_Text==
16825 section 5
16826
16827 ==Underscore-Entity&#95;between&#95;Text==
16828 section 6
16829
16830 [[#Space between Text]]
16831 [[#Space-Entity&#32;between&#32;Text]]
16832 [[#Plus+between+Text]]
16833 [[#Plus-Entity&#43;between&#43;Text]]
16834 [[#Underscore_between_Text]]
16835 [[#Underscore-Entity&#95;between&#95;Text]]
16836 !! html/php
16837 <p>Id should not contain + for spaces
16838 </p>
16839 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16840 <ul>
16841 <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>
16842 <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>
16843 <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>
16844 <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>
16845 <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>
16846 <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>
16847 </ul>
16848 </div>
16849
16850 <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>
16851 <p>section 1
16852 </p>
16853 <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>
16854 <p>section 2
16855 </p>
16856 <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>
16857 <p>section 3
16858 </p>
16859 <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>
16860 <p>section 4
16861 </p>
16862 <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>
16863 <p>section 5
16864 </p>
16865 <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>
16866 <p>section 6
16867 </p><p><a href="#Space_between_Text">#Space between Text</a>
16868 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16869 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16870 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16871 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16872 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16873 </p>
16874 !! html/parsoid
16875 <p>Id should not contain + for spaces</p>
16876
16877 <h2 id="Space_between_Text">Space between Text</h2>
16878 <p>section 1</p>
16879
16880 <h2 id="Space-Entity_between_Text">Space-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>Text</h2>
16881 <p>section 2</p>
16882
16883 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
16884 <p>section 3</p>
16885
16886 <h2 id="Plus-Entity+between+Text"><span id="Plus-Entity.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>Text</h2>
16887 <p>section 4</p>
16888
16889 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
16890 <p>section 5</p>
16891
16892 <h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>Text</h2>
16893 <p>section 6</p>
16894
16895 <p><a rel="mw:WikiLink" href="./Main_Page#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
16896 <a rel="mw:WikiLink" href="./Main_Page#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
16897 <a rel="mw:WikiLink" href="./Main_Page#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
16898 <a rel="mw:WikiLink" href="./Main_Page#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
16899 <a rel="mw:WikiLink" href="./Main_Page#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
16900 <a rel="mw:WikiLink" href="./Main_Page#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
16901 !! end
16902
16903 # Parsoid html2wt disabled because it adds padding spaces around =
16904 !! test
16905 Headers with excess '=' characters
16906 (Are similar tests necessary beyond the 1st level?)
16907 !! options
16908 parsoid=wt2html,wt2wt,html2html
16909 !! wikitext
16910 =foo==
16911 ==foo=
16912 =''italic'' heading==
16913 ==''italic'' heading=
16914 !! html/php
16915 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16916 <ul>
16917 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16918 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16919 <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>
16920 <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>
16921 </ul>
16922 </div>
16923
16924 <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>
16925 <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>
16926 <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>
16927 <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>
16928
16929 !! html/parsoid
16930 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16931 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16932 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16933 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16934 !! end
16935
16936 !! test
16937 HTML headers vs TOC (T25393)
16938 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16939 !! wikitext
16940 <h1>Header 1</h1>
16941 ==Header 1.1==
16942 ==Header 1.2==
16943
16944 <h1>Header 2
16945 </h1>
16946 ==Header 2.1==
16947 ==Header 2.2==
16948 __NOEDITSECTION__
16949 !! html/php
16950 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16951 <ul>
16952 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16953 <ul>
16954 <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>
16955 <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>
16956 </ul>
16957 </li>
16958 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16959 <ul>
16960 <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>
16961 <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>
16962 </ul>
16963 </li>
16964 </ul>
16965 </div>
16966
16967 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16968 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16969 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16970 <h1><span class="mw-headline" id="Header_2">Header 2
16971 </span></h1>
16972 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16973 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16974
16975 !! html/parsoid
16976 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
16977 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
16978 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
16979
16980 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
16981 </h1>
16982 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
16983 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
16984 <meta property="mw:PageProp/noeditsection"/>
16985 !! end
16986
16987 !! test
16988 Single-line or multiline-comments can follow headings
16989 !! options
16990 parsoid=wt2html,wt2wt
16991 !! wikitext
16992 ==foo==<!---->
16993 ==bar==<!--c1-->
16994 ==baz==<!--
16995 c2
16996 c3-->
16997 !! html/php
16998 <h2><span class="mw-headline" id="foo">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></h2>
16999 <h2><span class="mw-headline" id="bar">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: bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17000 <h2><span class="mw-headline" id="baz">baz</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: baz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17001
17002 !! html/parsoid
17003 <h2 id="foo">foo</h2><!---->
17004 <h2 id="bar">bar</h2><!--c1-->
17005 <h2 id="baz">baz</h2><!--
17006 c2
17007 c3-->
17008 !! end
17009
17010 !! test
17011 T3219 URL next to image (broken)
17012 !! wikitext
17013 http://example.com[[File:Foobar.jpg]]
17014 !! html/php
17015 <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>
17016 </p>
17017 !! html/parsoid
17018 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a><figure-inline 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></figure-inline></p>
17019 !!end
17020
17021 !! test
17022 T3186 news: in the middle of text
17023 !! wikitext
17024 http://en.wikinews.org/wiki/Wikinews:Workplace
17025 !! html
17026 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17027 </p>
17028 !!end
17029
17030
17031 !! test
17032 Namespaced link must have a title
17033 !! wikitext
17034 [[Project:]]
17035 !! html
17036 <p>[[Project:]]
17037 </p>
17038 !!end
17039
17040 !! test
17041 Namespaced link must have a title (bad fragment version)
17042 !! wikitext
17043 [[Project:#fragment]]
17044 !! html
17045 <p>[[Project:#fragment]]
17046 </p>
17047 !!end
17048
17049
17050 ###
17051 ### HTML tags and HTML attributes
17052 ###
17053
17054 !! test
17055 div with no attributes
17056 !! wikitext
17057 <div>HTML rocks</div>
17058 !! html
17059 <div>HTML rocks</div>
17060
17061 !! end
17062
17063 !! test
17064 div with double-quoted attribute
17065 !! wikitext
17066 <div id="rock">HTML rocks</div>
17067 !! html
17068 <div id="rock">HTML rocks</div>
17069
17070 !! end
17071
17072 !! test
17073 div with single-quoted attribute
17074 !! wikitext
17075 <div id='rock'>HTML rocks</div>
17076 !! html
17077 <div id="rock">HTML rocks</div>
17078
17079 !! end
17080
17081 !! test
17082 div with unquoted attribute
17083 !! wikitext
17084 <div id=rock>HTML rocks</div>
17085 !! html
17086 <div id="rock">HTML rocks</div>
17087
17088 !! end
17089
17090 !! test
17091 div with illegal double attributes
17092 !! wikitext
17093 <div id="a" id="b">HTML rocks</div>
17094 !! html
17095 <div id="b">HTML rocks</div>
17096
17097 !!end
17098
17099 !! test
17100 div with empty attribute value, space before equals
17101 !! options
17102 parsoid=wt2html,html2html
17103 !! wikitext
17104 <div class =>HTML rocks</div>
17105 !! html/php
17106 <div class="">HTML rocks</div>
17107
17108 !! html/parsoid
17109 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17110 !! end
17111
17112 !! test
17113 div with multiple empty attribute values
17114 !! config
17115 wgFragmentMode=[ 'html5', 'legacy' ]
17116 !! options
17117 parsoid=wt2html,html2html
17118 !! wikitext
17119 <div id= title=>HTML rocks</div>
17120 !! html/php
17121 <div id="title=">HTML rocks</div>
17122
17123 !! html/parsoid
17124 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17125 !! end
17126
17127 # FIXME Parsoid doesn't actually match PHP here.
17128 # Probably we should use the synthetic <foo /> or <indicator>
17129 # extensions for this test, which are enabled when running parser tests.
17130 !! test
17131 Extension tag in attribute value
17132 !! wikitext
17133 <span title="<translate>123</translate>">ok</span>
17134 !! html/php+disabled
17135 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17136 </p>
17137 !! html/parsoid
17138 <p><span title="123" about="#mwt4" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"123"},"sa":{"title":"&lt;translate>123&lt;/translate>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;translate typeof=\"mw:Extension/translate\" about=\"#mwt3\" data-parsoid=&apos;{\"dsr\":[13,39,2,2]}&apos; data-mw=&apos;{\"name\":\"translate\",\"attrs\":{},\"body\":{\"extsrc\":\"123\"}}&apos;>123&lt;/translate>"}]]}'>ok</span></p>
17139 !! end
17140
17141 !! test
17142 table with multiple empty attribute values
17143 !! options
17144 parsoid=wt2html,html2html
17145 !! wikitext
17146 {| title= id=
17147 |hi
17148 |}
17149 !! html/php
17150 <table title="id=">
17151 <tr>
17152 <td>hi
17153 </td></tr></table>
17154
17155 !! html/parsoid
17156 <table title="id=">
17157 <tbody><tr><td>hi</td></tr>
17158 </tbody></table>
17159 !! end
17160
17161 !! test
17162 div with braces in attribute value
17163 !! wikitext
17164 <div title="{}">Foo</div>
17165 !! html/php
17166 <div title="&#123;&#125;">Foo</div>
17167
17168 !! html/parsoid
17169 <div title="{}">Foo</div>
17170 !! end
17171
17172 !! test
17173 div with empty attribute value, no space before equals
17174 !! options
17175 parsoid=wt2html,html2html
17176 !! wikitext
17177 <div class=>HTML rocks</div>
17178 !! html/php
17179 <div class="">HTML rocks</div>
17180
17181 !! html/parsoid
17182 <div class="">HTML rocks</div>
17183 !! end
17184
17185 !! test
17186 HTML multiple attributes correction
17187 !! wikitext
17188 <p class="error" class="awesome">Awesome!</p>
17189 !! html
17190 <p class="awesome">Awesome!</p>
17191
17192 !!end
17193
17194 !! test
17195 Table multiple attributes correction
17196 !! wikitext
17197 {|
17198 !+ class="error" class="awesome"|status
17199 |}
17200 !! html
17201 <table>
17202 <tr>
17203 <th class="awesome">status
17204 </th></tr></table>
17205
17206 !!end
17207
17208 !! test
17209 DIV IN UPPERCASE
17210 !! wikitext
17211 <DIV ID="x">HTML ROCKS</DIV>
17212 !! html
17213 <div id="x">HTML ROCKS</div>
17214
17215 !!end
17216
17217 !! test
17218 Non-ASCII pseudo-tags are rendered as text
17219 !! wikitext
17220 <khyô>
17221 !! html
17222 <p>&lt;khyô&gt;
17223 </p>
17224 !! end
17225
17226 !! test
17227 Pseudo-tag with URL 'name' renders as url link
17228 !! wikitext
17229 <http://example.com/>
17230 !! html
17231 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17232 </p>
17233 !! end
17234
17235 !! test
17236 text with amp in the middle of nowhere
17237 !! wikitext
17238 Remember AT&T?
17239 !! html
17240 <p>Remember AT&amp;T?
17241 </p>
17242 !! end
17243
17244 !! test
17245 text with character entity: eacute
17246 !! wikitext
17247 I always thought &eacute; was a cute letter.
17248 !! html+tidy
17249 <p>I always thought &#233; was a cute letter.
17250 </p>
17251 !! end
17252
17253 !! test
17254 text with entity-escaped character entity-like string: eacute
17255 !! wikitext
17256 I always thought &amp;eacute; was a cute letter.
17257 !! html
17258 <p>I always thought &amp;eacute; was a cute letter.
17259 </p>
17260 !! end
17261
17262 !! test
17263 text with undefined character entity: xacute
17264 !! wikitext
17265 I always thought &xacute; was a cute letter.
17266 !! html
17267 <p>I always thought &amp;xacute; was a cute letter.
17268 </p>
17269 !! end
17270
17271 !! test
17272 HTML5 tags
17273 !! wikitext
17274 <data value="5">five</data>
17275 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17276 <mark>This highlighted text</mark>
17277 !! html
17278 <p><data value="5">five</data>
17279 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17280 <mark>This highlighted text</mark>
17281 </p>
17282 !! end
17283
17284 !! test
17285 HTML tag with leading space is parsed as text
17286 !! wikitext
17287 < div>foo< /div>
17288 !! html
17289 <p>&lt; div&gt;foo&lt; /div&gt;
17290 </p>
17291 !! end
17292
17293 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17294 ## the HTML5 parsing spec.
17295 !! test
17296 Element with broken attribute syntax
17297 !! options
17298 parsoid=wt2html
17299 !! wikitext
17300 <div style=" style="123">hi</div>
17301 <div =>ho</div>
17302 !! html/php
17303 <div style="123">hi</div>
17304 <div>ho</div>
17305
17306 !! html/parsoid
17307 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17308 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17309 !! end
17310
17311 ###
17312 ### Nesting tests (see T43545, T52604, T53081)
17313 ###
17314
17315 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17316 # Note that html2wt is considerably more difficult if we use <b> in
17317 # the test case, instead of <small>
17318 !! test
17319 Ensure that HTML adoption agency algorithm is properly implemented.
17320 !! wikitext
17321 <small>X<small>Y</small>Z</small>
17322 !! html
17323 <p><small>X<small>Y</small>Z</small>
17324 </p>
17325 !! end
17326
17327 # This was T43545 in the PHP parser.
17328 !! test
17329 Nesting of <kbd>
17330 !! wikitext
17331 <kbd>X<kbd>Y</kbd>Z</kbd>
17332 !! html+tidy
17333 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17334 </p>
17335 !! end
17336
17337 # The following cases were T53081 in the PHP parser.
17338 # Note that there are some other nestable tags (b, i, etc) which are
17339 # not covered; see T53081 for discussion.
17340
17341 !! test
17342 Nesting of <em>
17343 !! wikitext
17344 <em>X<em>Y</em>Z</em>
17345 !! html+tidy
17346 <p><em>X<em>Y</em>Z</em>
17347 </p>
17348 !! end
17349
17350 !! test
17351 Nesting of <strong>
17352 !! wikitext
17353 <strong>X<strong>Y</strong>Z</strong>
17354 !! html+tidy
17355 <p><strong>X<strong>Y</strong>Z</strong>
17356 </p>
17357 !! end
17358
17359 !! test
17360 Nesting of <q>
17361 !! wikitext
17362 <q>X<q>Y</q>Z</q>
17363 !! html+tidy
17364 <p><q>X<q>Y</q>Z</q>
17365 </p>
17366 !! end
17367
17368 !! test
17369 Nesting of <ruby>
17370 !! wikitext
17371 <ruby>X<ruby>Y</ruby>Z</ruby>
17372 !! html
17373 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17374 </p>
17375 !! end
17376
17377 !! test
17378 Nesting of <bdo>
17379 !! wikitext
17380 <bdo>X<bdo>Y</bdo>Z</bdo>
17381 !! html
17382 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17383 </p>
17384 !! end
17385
17386
17387 ###
17388 ### Media links
17389 ###
17390
17391 !! test
17392 Media link
17393 !! wikitext
17394 [[Media:Foobar.jpg]]
17395 [[Media:Video.ogv]]
17396 [[:Media:Video.ogv]]
17397 !! html/php
17398 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17399 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17400 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17401 </p>
17402 !! html/parsoid
17403 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17404 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17405 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv" data-parsoid='{"a":{"namespace":"Media"},"sa":{"namespace":":Media"}}'>Media:Video.ogv</a></p>
17406 !! end
17407
17408 !! test
17409 Media link with text
17410 !! wikitext
17411 [[Media:Foobar.jpg|A neat file to look at]]
17412 !! html/php
17413 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17414 </p>
17415 !! html/parsoid
17416 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17417 !! end
17418
17419 # FIXME: this is still bad HTML tag nesting
17420 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17421 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17422 !! test
17423 Media link with nasty text
17424 !! wikitext
17425 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17426 !! html/php
17427 <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>
17428
17429 !! html/php+tidy
17430 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg"><div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
17431 !! html/parsoid
17432 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true}'>Safe Link</a></p><div style="display:none" data-parsoid='{"stx":"html"}'><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'>" onmouseover="alert(document.cookie)" onfoo="</a></div>
17433
17434 !! end
17435
17436 !! test
17437 Media link to nonexistent file (T3702)
17438 !! wikitext
17439 [[Media:No such.jpg]]
17440 [[Media:No_such file.jpg]]
17441 !! html/php
17442 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17443 <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
17444 </p>
17445 !! html/parsoid
17446 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
17447 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
17448 !! end
17449
17450 !! test
17451 Image link to nonexistent file (T3850 - good)
17452 !! wikitext
17453 [[File:No_such.jpg]]
17454 !! html/php
17455 <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>
17456 </p>
17457 !! html/parsoid
17458 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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></figure-inline></p>
17459 !! end
17460
17461 !! test
17462 :Image link to nonexistent file (T3850 - bad)
17463 !! wikitext
17464 [[:Image:No such.jpg]]
17465 !! html/php
17466 <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>
17467 </p>
17468 !! html/parsoid
17469 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17470 !! end
17471
17472 !! test
17473 Character reference normalization in link text (T3938)
17474 !! wikitext
17475 [[Main Page|this&that]]
17476 !! html
17477 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17478 </p>
17479 !!end
17480
17481 !! article
17482 אַ
17483 !! text
17484 Test for unicode normalization
17485
17486 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17487 !! endarticle
17488
17489 !! test
17490 (T21451) Links should refer to the normalized form.
17491 !! wikitext
17492 [[&#xFB2E;]]
17493 [[&#x5d0;&#x5b7;]]
17494 [[&#x5d0;ַ]]
17495 [[א&#x5b7;]]
17496 [[אַ]]
17497 !! html
17498 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17499 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17500 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17501 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17502 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17503 </p>
17504 !! end
17505
17506 !! test
17507 Empty attribute crash test (T4067)
17508 !! wikitext
17509 <font color="">foo</font>
17510 !! html
17511 <p><font color="">foo</font>
17512 </p>
17513 !! end
17514
17515 !! test
17516 Empty attribute crash test single-quotes (T4067)
17517 !! wikitext
17518 <font color=''>foo</font>
17519 !! html
17520 <p><font color="">foo</font>
17521 </p>
17522 !! end
17523
17524 !! test
17525 Attribute test: equals, then nothing
17526 !! options
17527 parsoid=wt2html,html2html
17528 !! wikitext
17529 <font color=>foo</font>
17530 !! html/php
17531 <p><font color="">foo</font>
17532 </p>
17533 !! html/parsoid
17534 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17535 !! end
17536
17537 !! test
17538 Attribute test: unquoted value
17539 !! options
17540 parsoid=wt2html,html2html
17541 !! wikitext
17542 <font color=x>foo</font>
17543 !! html/php
17544 <p><font color="x">foo</font>
17545 </p>
17546 !! html/parsoid
17547 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17548 !! end
17549
17550 !! test
17551 Attribute test: unquoted but illegal value (hash)
17552 !! wikitext
17553 <font color=#x>foo</font>
17554 !! html
17555 <p><font color="#x">foo</font>
17556 </p>
17557 !! end
17558
17559 # Parsoid does not serialize to empty attribute syntax,
17560 # so wt2wt and html2wt cases are skipped
17561 !! test
17562 Attribute test: no value (T54330)
17563 !! options
17564 parsoid=wt2html,html2html
17565 !! wikitext
17566 <font color>foo</font>
17567 !! html/php
17568 <p><font color="">foo</font>
17569 </p>
17570 !! html/parsoid
17571 <p><font color="">foo</font></p>
17572 !! end
17573
17574 !! test
17575 T4095: link with three closing brackets
17576 !! wikitext
17577 [[Main Page]]]
17578 !! html/php
17579 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17580 </p>
17581 !! html/parsoid
17582 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17583 !! end
17584
17585 !! test
17586 T4095: link with pipe and three closing brackets
17587 !! wikitext
17588 [[Main Page|link]]]
17589 !! html/php
17590 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17591 </p>
17592 !! html/parsoid
17593 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17594 !! end
17595
17596 !! test
17597 T4095: link with pipe and three closing brackets, version 2
17598 !! wikitext
17599 [[Main Page|[http://example.com/]]]
17600 !! html/php
17601 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17602 </p>
17603 !! html/parsoid
17604 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17605 !! end
17606
17607
17608 ###
17609 ### Safety
17610 ###
17611
17612 !! article
17613 Template:Dangerous attribute
17614 !! text
17615 " onmouseover="alert(document.cookie)
17616 !! endarticle
17617
17618 !! article
17619 Template:Dangerous style attribute
17620 !! text
17621 border-size: expression(alert(document.cookie))
17622 !! endarticle
17623
17624 !! article
17625 Template:Div style
17626 !! text
17627 <div style="float: right; {{{1}}}">Magic div</div>
17628 !! endarticle
17629
17630 !! test
17631 T4304: HTML attribute safety (safe template; regression T4309)
17632 !! wikitext
17633 <div title="{{test}}"></div>
17634 !! html/php
17635 <div title="This is a test template"></div>
17636
17637 !! html/parsoid
17638 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
17639 !! end
17640
17641 # Parsoid has enough context to handle this case
17642 !! test
17643 T4304: HTML attribute safety (dangerous template; 2309)
17644 !! wikitext
17645 <div title="{{dangerous attribute}}"></div>
17646 !! html/php
17647 <div title=""></div>
17648
17649 !! html/parsoid
17650 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
17651 !! end
17652
17653 !! test
17654 T4304: HTML attribute safety (dangerous style template; 2309)
17655 !! wikitext
17656 <div style="{{dangerous style attribute}}"></div>
17657 !! html/php
17658 <div style="/* insecure input */"></div>
17659
17660 !! html/parsoid
17661 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
17662 !! end
17663
17664 !! test
17665 T4304: HTML attribute safety (safe parameter; 2309)
17666 !! wikitext
17667 {{div style|width: 200px}}
17668 !! html/php
17669 <div style="float: right; width: 200px">Magic div</div>
17670
17671 !! html/parsoid
17672 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
17673 !! end
17674
17675 !! test
17676 T4304: HTML attribute safety (unsafe parameter; 2309)
17677 !! wikitext
17678 {{div style|width: expression(alert(document.cookie))}}
17679 !! html/php
17680 <div style="/* insecure input */">Magic div</div>
17681
17682 !! html/parsoid
17683 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
17684 !! end
17685
17686 ## Parsoid output here differs; needs investigation.
17687 !! test
17688 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17689 !! wikitext
17690 {{div style|"><script>alert(document.cookie)</script>}}
17691 !! html
17692 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17693
17694 !! end
17695
17696 ## Parsoid output here differs; needs investigation.
17697 !! test
17698 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17699 !! wikitext
17700 {{div style|" ><script>alert(document.cookie)</script>}}
17701 !! html
17702 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17703
17704 !! end
17705
17706 !! test
17707 T4304: HTML attribute safety (link)
17708 !! wikitext
17709 <div title="[[Main Page]]"></div>
17710 !! html/php
17711 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17712
17713 !! html/parsoid
17714 <div title="[[Main Page]]"></div>
17715 !! end
17716
17717 !! test
17718 T4304: HTML attribute safety (italics)
17719 !! wikitext
17720 <div title="''foobar''"></div>
17721 !! html
17722 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17723
17724 !! end
17725
17726 !! test
17727 T4304: HTML attribute safety (bold)
17728 !! wikitext
17729 <div title="'''foobar'''"></div>
17730 !! html
17731 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17732
17733 !! end
17734
17735 !! test
17736 T4304: HTML attribute safety (ISBN)
17737 !! wikitext
17738 <div title="ISBN 1234567890"></div>
17739 !! html
17740 <div title="&#73;SBN 1234567890"></div>
17741
17742 !! end
17743
17744 !! test
17745 T4304: HTML attribute safety (RFC)
17746 !! wikitext
17747 <div title="RFC 1234"></div>
17748 !! html
17749 <div title="&#82;FC 1234"></div>
17750
17751 !! end
17752
17753 !! test
17754 T4304: HTML attribute safety (PMID)
17755 !! wikitext
17756 <div title="PMID 1234567890"></div>
17757 !! html
17758 <div title="&#80;MID 1234567890"></div>
17759
17760 !! end
17761
17762 !! test
17763 T4304: HTML attribute safety (web link)
17764 !! wikitext
17765 <div title="http://example.com/"></div>
17766 !! html
17767 <div title="http&#58;//example.com/"></div>
17768
17769 !! end
17770
17771 !! test
17772 T4304: HTML attribute safety (named web link)
17773 !! wikitext
17774 <div title="[http://example.com/ link]"></div>
17775 !! html/php
17776 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17777
17778 !! html/parsoid
17779 <div title="[http://example.com/ link]"></div>
17780 !! end
17781
17782 !! test
17783 T5244: HTML attribute safety (extension; safe)
17784 !! wikitext
17785 <div style="<nowiki>background:blue</nowiki>"></div>
17786 !! html/php
17787 <div style="background:blue"></div>
17788
17789 !! html/parsoid
17790 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17791 !! end
17792
17793 !! test
17794 T5244: HTML attribute safety (extension; unsafe)
17795 !! wikitext
17796 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17797 !! html/php
17798 <div style="/* insecure input */"></div>
17799
17800 !! html/parsoid
17801 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
17802 !! end
17803
17804 # More MSIE fun discovered by Tom Gilder
17805
17806 !! test
17807 MSIE CSS safety test: spurious slash
17808 !! wikitext
17809 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17810 !! html/php
17811 <div style="/* insecure input */">evil</div>
17812
17813 !! html/parsoid
17814 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
17815 !! end
17816
17817 !! test
17818 MSIE CSS safety test: hex code
17819 !! wikitext
17820 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17821 !! html/php
17822 <div style="/* insecure input */">evil</div>
17823
17824 !! html/parsoid
17825 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
17826 !! end
17827
17828 !! test
17829 MSIE CSS safety test: comment in url
17830 !! wikitext
17831 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17832 !! html/php
17833 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17834
17835 !! html/parsoid
17836 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
17837 !! end
17838
17839 !! test
17840 MSIE CSS safety test: comment in expression
17841 !! wikitext
17842 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17843 !! html/php
17844 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17845
17846 !! html/parsoid
17847 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
17848 !! end
17849
17850 !! test
17851 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17852 !! wikitext
17853 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17854 !! html/php
17855 <p style="/* invalid control char */">A</p>
17856
17857 !! html/parsoid
17858 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
17859 !! end
17860
17861 !! test
17862 MSIE 6 CSS safety test: Fullwidth (T57332)
17863 !! wikitext
17864 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17865 <div style="top:EXPRESSION(alert())">B</div>
17866 !! html/php
17867 <p style="/* insecure input */">A</p>
17868 <div style="/* insecure input */">B</div>
17869
17870 !! html/parsoid
17871 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
17872 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17873 !! end
17874
17875 !! test
17876 MSIE 6 CSS safety test: IPA extensions (T57332)
17877 !! wikitext
17878 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17879 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17880 !! html/php
17881 <div style="/* insecure input */">A</div>
17882 <p style="/* insecure input */">B</p>
17883
17884 !! html/parsoid
17885 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17886 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
17887 !! end
17888
17889 !! test
17890 MSIE 6 CSS safety test: sup/sub script (T57332)
17891 !! wikitext
17892 <div style="background-image:url⁽javascript:alert())">A</div>
17893 <div style="background-image:url₍javascript:alert())">B</div>
17894 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17895 !! html/php
17896 <div style="/* insecure input */">A</div>
17897 <div style="/* insecure input */">B</div>
17898 <p style="/* insecure input */">C</p>
17899
17900 !! html/parsoid
17901 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17902 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17903 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
17904 !! end
17905
17906 !! test
17907 Opera -o-link CSS
17908 !! options
17909 parsoid=wt2html,html2html
17910 !! wikitext
17911 <div
17912 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;"
17913 style="-o-link:attr(title);-o-link-source:current">X</div>
17914 !! html/php
17915 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17916
17917 !! html/parsoid
17918 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
17919 !! end
17920
17921 !! test
17922 MSIE 6 CSS safety test: Repetition markers (T57332)
17923 !! wikitext
17924 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17925 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17926 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17927 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17928 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17929 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17930 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17931 !! html/php
17932 <p style="/* insecure input */">A</p>
17933 <p style="/* insecure input */">B</p>
17934 <p style="/* insecure input */">C</p>
17935 <p style="/* insecure input */">D</p>
17936 <p style="/* insecure input */">E</p>
17937 <p style="/* insecure input */">F</p>
17938 <p style="/* insecure input */">G</p>
17939
17940 !! html/parsoid
17941 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
17942 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
17943 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
17944 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
17945 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
17946 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
17947 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
17948 !! end
17949
17950 !! test
17951 Table attribute legitimate extension
17952 !! wikitext
17953 {|
17954 !+ style="<nowiki>color:blue</nowiki>"|status
17955 |}
17956 !! html
17957 <table>
17958 <tr>
17959 <th style="color:blue">status
17960 </th></tr></table>
17961
17962 !!end
17963
17964 !! test
17965 Table attribute safety
17966 !! wikitext
17967 {|
17968 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
17969 |}
17970 !! html
17971 <table>
17972 <tr>
17973 <th style="/* insecure input */">status
17974 </th></tr></table>
17975
17976 !! end
17977
17978 !! test
17979 CSS line continuation 1
17980 !! wikitext
17981 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17982 !! html
17983 <div style="/* insecure input */"></div>
17984
17985 !! end
17986
17987 !! test
17988 CSS line continuation 2
17989 !! wikitext
17990 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17991 !! html
17992 <div style="/* invalid control char */"></div>
17993
17994 !! end
17995
17996 !! article
17997 Template:Identity
17998 !! text
17999 {{{1}}}
18000 !! endarticle
18001
18002 !! test
18003 Expansion of multi-line templates in attribute values (T8255)
18004 !! wikitext
18005 <div style="background: {{identity|#00FF00}}">-</div>
18006 !! html
18007 <div style="background: #00FF00">-</div>
18008
18009 !! end
18010
18011 !! test
18012 Expansion of multi-line templates in attribute values (T8255 sanity check)
18013 !! wikitext
18014 <div style="background:
18015 #00FF00">-</div>
18016 !! html/php
18017 <div style="background: #00FF00">-</div>
18018
18019 !! html/parsoid
18020 <div style="background:
18021 #00FF00">-</div>
18022 !! end
18023
18024 !! test
18025 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18026 !! wikitext
18027 <div style="background: &#10;#00FF00">-</div>
18028 !! html
18029 <div style="background: &#10;#00FF00">-</div>
18030
18031 !! end
18032
18033 !! test
18034 Tags which are hidden from tidiers cannot pass through the Sanitizer
18035 !! wikitext
18036 <mw:toc><script>alert();</script></mw:toc>
18037 !! html+tidy
18038 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18039 </p>
18040 !! end
18041
18042 ###
18043 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18044 ###
18045
18046 !! test
18047 Parser hook: empty input
18048 !! wikitext
18049 <tag></tag>
18050 !! html/php
18051 <pre>
18052 ''
18053 array (
18054 )
18055 </pre>
18056
18057 !! html/parsoid
18058 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18059 !! end
18060
18061 ## Don't expect parsoid to rt this form.
18062 !! test
18063 Parser hook: empty input using terminated empty elements
18064 !! options
18065 parsoid=wt2html,html2html
18066 !! wikitext
18067 <tag/>
18068 !! html/php
18069 <pre>
18070 NULL
18071 array (
18072 )
18073 </pre>
18074
18075 !! html/parsoid
18076 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18077 !! end
18078
18079 !! test
18080 Parser hook: empty input using terminated empty elements (space before)
18081 !! wikitext
18082 <tag />
18083 !! html/php
18084 <pre>
18085 NULL
18086 array (
18087 )
18088 </pre>
18089
18090 !! html/parsoid
18091 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18092 !! end
18093
18094 !! test
18095 Parser hook: basic input
18096 !! wikitext
18097 <tag>input</tag>
18098 !! html/php
18099 <pre>
18100 'input'
18101 array (
18102 )
18103 </pre>
18104
18105 !! html/parsoid
18106 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18107 !! end
18108
18109 ## Don't expect parsoid to rt this form.
18110 !! test
18111 Parser hook: case insensitive
18112 !! options
18113 parsoid=wt2html,html2html
18114 !! wikitext
18115 <TAG>input</TAG>
18116 !! html/php
18117 <pre>
18118 'input'
18119 array (
18120 )
18121 </pre>
18122
18123 !! html/parsoid
18124 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18125 !! end
18126
18127 ## Don't expect parsoid to rt this form.
18128 !! test
18129 Parser hook: case insensitive, redux
18130 !! options
18131 parsoid=wt2html,html2html
18132 !! wikitext
18133 <TaG>input</TAg>
18134 !! html/php
18135 <pre>
18136 'input'
18137 array (
18138 )
18139 </pre>
18140
18141 !! html/parsoid
18142 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18143 !! end
18144
18145 !! test
18146 Parser hook: nested tags
18147 !! wikitext
18148 <tag><tag></tag></tag>
18149 !! html/php
18150 <pre>
18151 '<tag>'
18152 array (
18153 )
18154 </pre>&lt;/tag&gt;
18155
18156 !! html/parsoid
18157 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18158 !! end
18159
18160 !! test
18161 Parser hook: basic arguments
18162 !! wikitext
18163 <tag width="200" height="100" depth="50" square=""></tag>
18164 !! html/php
18165 <pre>
18166 ''
18167 array (
18168 'width' => '200',
18169 'height' => '100',
18170 'depth' => '50',
18171 'square' => '',
18172 )
18173 </pre>
18174
18175 !! html/parsoid
18176 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18177 !! end
18178
18179 ## Don't expect parsoid to rt this form.
18180 !! test
18181 Parser hook: basic arguments, variations
18182 !! options
18183 parsoid=wt2html,html2html
18184 !! wikitext
18185 <tag width=200 height = "100" depth = '50' square></tag>
18186 !! html/php
18187 <pre>
18188 ''
18189 array (
18190 'width' => '200',
18191 'height' => '100',
18192 'depth' => '50',
18193 'square' => '',
18194 )
18195 </pre>
18196
18197 !! html/parsoid
18198 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18199 !! end
18200
18201 !! test
18202 Parser hook: argument containing a forward slash (T7344)
18203 !! wikitext
18204 <tag filename="/tmp/bla"></tag>
18205 !! html/php
18206 <pre>
18207 ''
18208 array (
18209 'filename' => '/tmp/bla',
18210 )
18211 </pre>
18212
18213 !! html/parsoid
18214 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18215 !! end
18216
18217 ## Don't expect parsoid to rt this form.
18218 !! test
18219 Parser hook: empty input using terminated empty elements (T4374)
18220 !! options
18221 parsoid=wt2html,html2html
18222 !! wikitext
18223 <tag foo=bar/>text
18224 !! html/php
18225 <pre>
18226 NULL
18227 array (
18228 'foo' => 'bar',
18229 )
18230 </pre>text
18231
18232 !! html/parsoid
18233 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18234 !! end
18235
18236 ## </tag> should be output literally since there is no matching tag that begins it
18237 ## Don't expect parsoid to rt this form.
18238 !! test
18239 Parser hook: basic arguments using terminated empty elements (T4374)
18240 !! options
18241 parsoid=wt2html
18242 !! wikitext
18243 <tag width=200 height = "100" depth = '50' square/>
18244 other stuff
18245 </tag>
18246 !! html/php
18247 <pre>
18248 NULL
18249 array (
18250 'width' => '200',
18251 'height' => '100',
18252 'depth' => '50',
18253 'square' => '',
18254 )
18255 </pre>
18256 <p>other stuff
18257 &lt;/tag&gt;
18258 </p>
18259 !! html/parsoid
18260 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
18261 &lt;/tag></p>
18262 !! end
18263
18264 ## Don't expect parsoid to rt this form.
18265 !! test
18266 Parser hook: Don't allow unclosed extension tags
18267 !! options
18268 parsoid=wt2html
18269 !! wikitext
18270 test <tag>123
18271
18272 this is a '''test'''
18273 !! html/php
18274 <p>test &lt;tag&gt;123
18275 </p><p>this is a <b>test</b>
18276 </p>
18277 !! html/parsoid
18278 <p>test &lt;tag>123</p>
18279
18280 <p>this is a <b>test</b></p>
18281 !! end
18282
18283 ###
18284 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18285 ###
18286
18287 !! test
18288 Parser hook: static parser hook not inside a comment
18289 !! wikitext
18290 <statictag>hello, world</statictag>
18291
18292 <statictag action="flush" />
18293 !! html/php
18294 <p><br />
18295 hello, world
18296 </p>
18297 !! html/parsoid
18298 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18299 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18300 !! end
18301
18302 !! test
18303 Parser hook: static parser hook inside a comment
18304 !! wikitext
18305 <!-- <statictag>hello, world</statictag> -->
18306 <statictag action="flush" />
18307 !! html/php
18308 <p><br />
18309 </p>
18310 !! html/parsoid
18311 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18312 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18313 !! end
18314
18315 # Nested template calls; this case was broken by Parser.php rev 1.506,
18316 # since reverted.
18317
18318 !! article
18319 Template:One-parameter
18320 !! text
18321 (My parameter is: {{{1}}})
18322 !! endarticle
18323
18324 !! article
18325 Template:Map-one-parameter
18326 !! text
18327 {{{{{1}}}|{{{2}}}}}
18328 !! endarticle
18329
18330 !! test
18331 Nested template calls
18332 !! wikitext
18333 {{Map-one-parameter|One-parameter|param}}
18334 !! html
18335 <p>(My parameter is: param)
18336 </p>
18337 !! end
18338
18339
18340 ###
18341 ### Sanitizer
18342 ###
18343
18344 # Remex wraps empty tag runs with p-tags.
18345 # Parsoid strips them out during p-wrapping.
18346 !! test
18347 Sanitizer: Closing of open tags
18348 !! wikitext
18349 <s></s><table></table>
18350 !! html/php+tidy
18351 <p><s></s></p><table></table>
18352 !! html/parsoid
18353 <s></s><table></table>
18354 !! end
18355
18356 !! test
18357 Sanitizer: Closing of open but not closed tags
18358 !! wikitext
18359 <s>foo
18360 !! html
18361 <p><s>foo</s>
18362 </p>
18363 !! end
18364
18365 !! test
18366 Sanitizer: Closing of closed but not open tags
18367 !! options
18368 parsoid=wt2html
18369 !! wikitext
18370 </s>
18371 !! html/php+tidy
18372 <p class="mw-empty-elt">
18373 </p>
18374 !! html/parsoid
18375 !! end
18376
18377 !! test
18378 Sanitizer: Closing of closed but not open table tags
18379 !! options
18380 parsoid=wt2html
18381 !! wikitext
18382 Table not started</td></tr></table>
18383 !! html+tidy
18384 <p>Table not started
18385 </p>
18386 !! end
18387
18388 !! test
18389 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18390 !! config
18391 wgFragmentMode=[ 'html5', 'legacy' ]
18392 !! wikitext
18393 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18394 !! html/php
18395 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18396 </p>
18397 !! html/parsoid
18398 <p><span id="æ:_v" data-parsoid='{"stx":"html","a":{"id":"æ:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#æ:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#æ:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
18399 !! end
18400
18401 !! test
18402 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18403 !! config
18404 wgFragmentMode=[ 'legacy' ]
18405 !! wikitext
18406 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18407 !! html/php
18408 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18409 </p>
18410 !! end
18411
18412 # In HTML5, the restrictions are that id must contain at least one character,
18413 # and must not contain any space characters.
18414 !! test
18415 Sanitizer: Validating the contents of the id attribute (T6515)
18416 !! options
18417 disabled
18418 !! wikitext
18419 <br id="" /><br id="a space" />
18420 !! html
18421 Something ...
18422 !! end
18423
18424 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18425 !! test
18426 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18427 !! options
18428 disabled
18429 !! wikitext
18430 <br id="foo" /><br id="foo" />
18431 !! html
18432 Something need to be done. foo-2 ?
18433 !! end
18434
18435 !! test
18436 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18437 !! wikitext
18438 <div itemscope>
18439 <meta itemprop="hello" content="world">
18440 <meta http-equiv="refresh" content="5">
18441 <meta itemprop="hello" http-equiv="refresh" content="5">
18442 <link itemprop="hello" href="{{SERVER}}">
18443 <link rel="stylesheet" href="{{SERVER}}">
18444 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18445 </div>
18446 !! html
18447 <div itemscope="">
18448 <p> <meta itemprop="hello" content="world" />
18449 &lt;meta http-equiv="refresh" content="5"&gt;
18450 <meta itemprop="hello" content="5" />
18451 <link itemprop="hello" href="http&#58;//example.org" />
18452 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18453 <link itemprop="hello" href="http&#58;//example.org" />
18454 </p>
18455 </div>
18456
18457 !! end
18458
18459 !! test
18460 Sanitizer: Strip comments from CSS attributes
18461 !! options
18462 parsoid=wt2html,wt2wt
18463 !! wikitext
18464 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18465 !! html/php
18466 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18467 </p>
18468 !! html/parsoid
18469 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18470 !! end
18471
18472 !! test
18473 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18474 !! wikitext
18475 [[meatball:Soft"Security]]
18476 !! html/php
18477 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18478 </p>
18479 !! html/parsoid
18480 <p><a rel="mw:WikiLink/Interwiki" href='http://www.usemod.com/cgi-bin/mb.pl?Soft"Security' title='meatball:Soft"Security'>meatball:Soft"Security</a></p>
18481 !! end
18482
18483 !! test
18484 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18485 !! wikitext
18486 [[meatball:Foo<Bar]]
18487 [[meatball:Foo>Bar]]
18488 [[meatball:Foo&lt;bar]]
18489 [[meatball:Foo&gt;bar]]
18490 !! html/php
18491 <p>[[meatball:Foo&lt;Bar]]
18492 [[meatball:Foo&gt;Bar]]
18493 [[meatball:Foo&lt;bar]]
18494 [[meatball:Foo&gt;bar]]
18495 </p>
18496 !! html/parsoid
18497 <p>[[meatball:Foo&lt;Bar]]
18498 [[meatball:Foo>Bar]]
18499 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18500 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18501 !! end
18502
18503 !! test
18504 Language converter: output gets cut off unexpectedly (T7757)
18505 !! options
18506 language=zh
18507 !! wikitext
18508 this bit is safe: }-
18509
18510 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18511
18512 then we get cut off here: }-
18513
18514 all additional text is vanished
18515 !! html/php
18516 <p>this bit is safe: }-
18517 </p><p>but if we add a conversion instance: xxx
18518 </p><p>then we get cut off here: }-
18519 </p><p>all additional text is vanished
18520 </p>
18521 !! html/parsoid
18522 <p>this bit is safe: }-</p>
18523 <p>but if we add a conversion instance: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"xxx"},{"l":"zh-tw","t":"yyy"}]}'></span></p>
18524 <p>then we get cut off here: }-</p>
18525 <p>all additional text is vanished</p>
18526 !! end
18527
18528 !! test
18529 Language converter glossary rules inside attributes (T119158)
18530 !! options
18531 language=sr variant=sr-el
18532 !! wikitext
18533 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18534
18535 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18536 !! html/php
18537 <p>
18538 </p><p><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="&quot; onload=&quot;alert(1)&quot; data-foo=&quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
18539 </p>
18540 !! html/parsoid
18541 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18542
18543 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Датотека:Foobar.jpg"><img alt="foAjrjvi" resource="./Датотека: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":"foAjrjvi","resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=-{}-foAjrjvi-{}-","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
18544 !! end
18545
18546 !! test
18547 Self closed html pairs (T7487)
18548 !! wikitext
18549 <center><font id="bug" />Centered text</center>
18550 <div><font id="bug2" />In div text</div>
18551 !! html+tidy
18552 <center><font id="bug"></font>Centered text</center>
18553 <div><font id="bug2"></font>In div text</div>
18554 !! end
18555
18556 !! test
18557 Punctuation: nbsp before exclamation
18558 !! wikitext
18559 C'est grave !
18560 !! html
18561 <p>C'est grave&#160;!
18562 </p>
18563 !! end
18564
18565 !! test
18566 Punctuation: CSS !important (T13874)
18567 !! wikitext
18568 <div style="width:50% !important">important</div>
18569 !! html
18570 <div style="width:50% !important">important</div>
18571
18572 !!end
18573
18574 !! test
18575 Punctuation: CSS ! important (T13874; with space after)
18576 !! wikitext
18577 <div style="width:50% ! important">important</div>
18578 !! html
18579 <div style="width:50% ! important">important</div>
18580
18581 !!end
18582
18583 !! test
18584 HTML bullet list, closed tags (T7497)
18585 !! wikitext
18586 <ul>
18587 <li>One</li>
18588 <li>Two</li>
18589 </ul>
18590 !! html/php
18591 <ul>
18592 <li>One</li>
18593 <li>Two</li>
18594 </ul>
18595
18596 !! html/parsoid
18597 <ul data-parsoid='{"stx":"html"}'>
18598 <li data-parsoid='{"stx":"html"}'>One</li>
18599 <li data-parsoid='{"stx":"html"}'>Two</li>
18600 </ul>
18601
18602 !! end
18603
18604 !! test
18605 HTML bullet list, unclosed tags (T7497)
18606 !! wikitext
18607 <ul>
18608 <li>One
18609 <li>Two
18610 </ul>
18611 !! html/php+tidy
18612 <ul>
18613 <li>One
18614 </li><li>Two
18615 </li></ul>
18616 !! html/parsoid
18617 <ul data-parsoid='{"stx":"html"}'>
18618 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18619 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18620 </ul>
18621
18622 !! end
18623
18624 !! test
18625 HTML ordered list, closed tags (T7497)
18626 !! wikitext
18627 <ol>
18628 <li>One</li>
18629 <li>Two</li>
18630 </ol>
18631 !! html/php
18632 <ol>
18633 <li>One</li>
18634 <li>Two</li>
18635 </ol>
18636
18637 !! html/parsoid
18638 <ol data-parsoid='{"stx":"html"}'>
18639 <li data-parsoid='{"stx":"html"}'>One</li>
18640 <li data-parsoid='{"stx":"html"}'>Two</li>
18641 </ol>
18642
18643 !! end
18644
18645 !! test
18646 HTML ordered list, unclosed tags (T7497)
18647 !! options
18648 !! wikitext
18649 <ol>
18650 <li>One
18651 <li>Two
18652 </ol>
18653 !! html/php+tidy
18654 <ol>
18655 <li>One
18656 </li><li>Two
18657 </li></ol>
18658 !! html/parsoid
18659 <ol data-parsoid='{"stx":"html"}'>
18660 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18661 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18662 </ol>
18663
18664 !! end
18665
18666 !! test
18667 HTML nested bullet list, closed tags (T7497)
18668 !! wikitext
18669 <ul>
18670 <li>One</li>
18671 <li>Two:
18672 <ul>
18673 <li>Sub-one</li>
18674 <li>Sub-two</li>
18675 </ul>
18676 </li>
18677 </ul>
18678 !! html/php
18679 <ul>
18680 <li>One</li>
18681 <li>Two:
18682 <ul>
18683 <li>Sub-one</li>
18684 <li>Sub-two</li>
18685 </ul>
18686 </li>
18687 </ul>
18688
18689 !! html/parsoid
18690 <ul data-parsoid='{"stx":"html"}'>
18691 <li data-parsoid='{"stx":"html"}'>One</li>
18692 <li data-parsoid='{"stx":"html"}'>Two:
18693 <ul data-parsoid='{"stx":"html"}'>
18694 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18695 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18696 </ul>
18697 </li>
18698 </ul>
18699 !! end
18700
18701 !! test
18702 HTML nested bullet list, open tags (T7497)
18703 !! wikitext
18704 <ul>
18705 <li>One
18706 <li>Two:
18707 <ul>
18708 <li>Sub-one
18709 <li>Sub-two
18710 </ul>
18711 </ul>
18712 !! html+tidy
18713 <ul>
18714 <li>One
18715 </li><li>Two:
18716 <ul>
18717 <li>Sub-one
18718 </li><li>Sub-two
18719 </li></ul>
18720 </li></ul>
18721 !! end
18722
18723 !! test
18724 HTML nested ordered list, closed tags (T7497)
18725 !! wikitext
18726 <ol>
18727 <li>One</li>
18728 <li>Two:
18729 <ol>
18730 <li>Sub-one</li>
18731 <li>Sub-two</li>
18732 </ol>
18733 </li>
18734 </ol>
18735 !! html
18736 <ol>
18737 <li>One</li>
18738 <li>Two:
18739 <ol>
18740 <li>Sub-one</li>
18741 <li>Sub-two</li>
18742 </ol>
18743 </li>
18744 </ol>
18745
18746 !! end
18747
18748 !! test
18749 HTML nested ordered list, open tags (T7497)
18750 !! wikitext
18751 <ol>
18752 <li>One
18753 <li>Two:
18754 <ol>
18755 <li>Sub-one
18756 <li>Sub-two
18757 </ol>
18758 </ol>
18759 !! html/php
18760 <ol>
18761 <li>One
18762 <li>Two:
18763 <ol>
18764 <li>Sub-one
18765 <li>Sub-two
18766 </ol>
18767 </ol>
18768
18769 !! html/parsoid
18770 <ol>
18771 <li>One
18772 </li>
18773 <li>Two:
18774 <ol>
18775 <li>Sub-one
18776 </li>
18777 <li>Sub-two
18778 </li>
18779 </ol>
18780 </li>
18781 </ol>
18782
18783 !! end
18784
18785 !! test
18786 HTML ordered list item with parameters oddity
18787 !! wikitext
18788 <ol><li id="fragment">One</li>
18789 </ol>
18790 !! html
18791 <ol><li id="fragment">One</li>
18792 </ol>
18793
18794 !! end
18795
18796 # parsoid doesn't explicitly mark autonumbered links, see T55505
18797 !!test
18798 T7918: autonumbering
18799 !! wikitext
18800 [http://first/] [http://second] [ftp://ftp]
18801
18802 ftp://inlineftp
18803
18804 [mailto:enclosed@mail.tld With target]
18805
18806 [mailto:enclosed@mail.tld]
18807
18808 mailto:inline@mail.tld
18809 !! html/php
18810 <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>
18811 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18812 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18813 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18814 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18815 </p>
18816 !! html/parsoid
18817 <p><a rel="mw:ExtLink" class="external autonumber" href="http://first/"></a> <a rel="mw:ExtLink" class="external autonumber" href="http://second"></a> <a rel="mw:ExtLink" class="external autonumber" href="ftp://ftp"></a></p>
18818 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18819 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18820 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18821 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18822 !! end
18823
18824
18825 #
18826 # Security and HTML correctness
18827 # From Nick Jenkins' fuzz testing
18828 #
18829
18830 !! test
18831 Fuzz testing: Parser13
18832 !! wikitext
18833 {|
18834 | http://a|
18835 !! html
18836 <table>
18837 <tr>
18838 <td>
18839 </td>
18840 </tr>
18841 </table>
18842
18843 !! end
18844
18845 # Note that Parsoid output differs from the PHP parser here: the PHP
18846 # parser breaks the URL for the magic word, while in Parsoid the URL
18847 # production takes precedence.
18848 !! test
18849 Fuzz testing: Parser14
18850 !! wikitext
18851 ==onmouseover===
18852 http://__TOC__
18853 !! html/php
18854 <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>
18855 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18856 <ul>
18857 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18858 </ul>
18859 </div>
18860
18861
18862 !! html/php+tidy
18863 <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><p>
18864 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18865 <ul>
18866 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18867 </ul>
18868 </div>
18869 !! html/parsoid
18870 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18871 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18872 !! end
18873
18874 !! test
18875 Fuzz testing: Parser14-table
18876 !! options
18877 parsoid=wt2html,html2html
18878 !! wikitext
18879 ==a==
18880 {| STYLE=__TOC__
18881 !! html
18882 <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>
18883 <table style="&#95;_TOC&#95;_">
18884 <tr><td></td></tr>
18885 </table>
18886
18887 !! html+tidy
18888 <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>
18889 <table style="__TOC__">
18890 <tr>
18891 <td></td>
18892 </tr>
18893 </table>
18894 !! html/parsoid
18895 <h2 id="a">a</h2>
18896 <table style="__TOC__"></table>
18897 !! end
18898
18899 # Known to produce bogus xml (extra </td>)
18900 # Don't add the html/php section since it generates broken HTML
18901 !! test
18902 Fuzz testing: Parser16
18903 !! wikitext
18904 {|
18905 !https://||||||
18906 !! html+tidy
18907 <table>
18908 <tbody><tr>
18909 <th>https://</th>
18910 <th></th>
18911 <th></th>
18912 <th>
18913
18914 </th></tr>
18915 </tbody></table>
18916 !! end
18917
18918 !! test
18919 Fuzz testing: Parser21
18920 !! wikitext
18921 {|
18922 !irc://{{ftp://a" onmouseover="alert('hello world');"
18923 |
18924 !! html
18925 <table>
18926 <tr>
18927 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18928 </th>
18929 <td>
18930 </td>
18931 </tr>
18932 </table>
18933
18934 !! end
18935
18936 !! test
18937 Fuzz testing: Parser22
18938 !! wikitext
18939 http://===r:::https://b
18940
18941 {|
18942 !! html
18943 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18944 </p>
18945 <table>
18946 <tr><td></td></tr>
18947 </table>
18948
18949 !! end
18950
18951 # Known to produce bad XML for now
18952 !! test
18953 Fuzz testing: Parser24
18954 !! options
18955 parsoid=wt2html
18956 !! wikitext
18957 {|
18958 {{{|
18959 <u CLASS=
18960 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18961 <br style="onmouseover='alert(document.cookie);' " />
18962
18963 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18964 |
18965 !! html/php
18966 <table>
18967 {{{|
18968 <u class="&#124;">}}}} &gt;
18969 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18970
18971 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18972 <tr>
18973 <td></u>
18974 </td>
18975 </tr>
18976 </table>
18977
18978 !! html/parsoid
18979 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18980 <u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>}}}} >
18981 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true,"autoInsertedStart":true}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
18982
18983
18984
18985 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18986 !! end
18987
18988 # Note: the current result listed for this is not what the original one was,
18989 # but the original bug was JavaScript injection, which is fixed in any case.
18990 # It's not clear that the original result listed was any more correct than the
18991 # current one. Original result:
18992 # <p>{{{|
18993 # </p>
18994 # <li class="&#124;&#124;">
18995 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18996 !!test
18997 Fuzz testing: Parser25 (T8055)
18998 !! wikitext
18999 {{{
19000 |
19001 <LI CLASS=||
19002 >
19003 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19004 !! html/php
19005 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19006 </p>
19007 !! html/parsoid
19008 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
19009 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19010 !! end
19011
19012 !!test
19013 Fuzz testing: URL adjacent extension (with space, clean)
19014 !! wikitext
19015 http://example.com <nowiki>junk</nowiki>
19016 !! html/php
19017 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19018 </p>
19019 !! html/parsoid
19020 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
19021 !! end
19022
19023 !!test
19024 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19025 !! wikitext
19026 http://example.com<nowiki>junk</nowiki>
19027 !! html/php
19028 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19029 </p>
19030 !! html/parsoid
19031 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
19032 !! end
19033
19034 !! test
19035 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19036 !! wikitext
19037 http://example.com<pre>junk</pre>
19038 !! html/php
19039 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19040
19041 !! html/php+tidy
19042 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19043 !! html/parsoid
19044 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"junk"}}'>junk</pre>
19045 !! end
19046
19047 !! test
19048 Fuzz testing: image with bogus manual thumbnail
19049 !! wikitext
19050 [[Image:foobar.jpg|thumbnail= ]]
19051 !! html/php
19052 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19053
19054 !! html/parsoid
19055 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/Foobar.jpg" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
19056 !! end
19057
19058 # Parsoid will emit the newline literally in wt2wt; see next test case.
19059 !! test
19060 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19061 !! options
19062 parsoid=wt2html
19063 !! wikitext
19064 <pre dir="&#10;"></pre>
19065 !! html/php
19066 <pre dir="&#10;"></pre>
19067
19068 !! html/parsoid
19069 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19070 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19071 !! end
19072
19073 !! test
19074 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19075 !! options
19076 parsoid=html2wt
19077 !! html/parsoid
19078 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19079 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19080 !! wikitext
19081 <pre dir="
19082 "></pre>
19083 !! html/php
19084 <pre dir=""></pre>
19085
19086 !! end
19087
19088 !! test
19089 Templates in extension attributes are not expanded
19090 !! wikitext
19091 <pre dir="{{echo|ltr}}"></pre>
19092 !! html/php
19093 <pre dir="{{echo|ltr}}"></pre>
19094
19095 !! html/parsoid
19096 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19097 !! end
19098
19099 !! test
19100 Parsing optional HTML elements (T8171)
19101 !! options
19102 !! wikitext
19103 <table>
19104 <tr>
19105 <td> Some tabular data</td>
19106 <td> More tabular data ...
19107 <td> And yet som tabular data</td>
19108 </tr>
19109 </table>
19110 !! html
19111 <table>
19112 <tr>
19113 <td> Some tabular data</td>
19114 <td> More tabular data ...
19115 </td><td> And yet som tabular data</td>
19116 </tr>
19117 </table>
19118
19119 !! end
19120
19121 !! test
19122 Correct handling of <td>, <tr> (T8171)
19123 !! options
19124 !! wikitext
19125 <table>
19126 <tr>
19127 <td> Some tabular data</td>
19128 <td> More tabular data ...</td>
19129 <td> And yet som tabular data</td>
19130 </tr>
19131 </table>
19132 !! html
19133 <table>
19134 <tr>
19135 <td> Some tabular data</td>
19136 <td> More tabular data ...</td>
19137 <td> And yet som tabular data</td>
19138 </tr>
19139 </table>
19140
19141 !! end
19142
19143
19144 !! test
19145 Parsing crashing regression (fr:JavaScript)
19146 !! wikitext
19147 </body></x>
19148 !! html
19149 <p>&lt;/body&gt;&lt;/x&gt;
19150 </p>
19151 !! end
19152
19153 !! test
19154 Inline wiki vs wiki block nesting
19155 !! wikitext
19156 '''Bold paragraph
19157
19158 New wiki paragraph
19159 !! html
19160 <p><b>Bold paragraph</b>
19161 </p><p>New wiki paragraph
19162 </p>
19163 !! end
19164
19165 # FIXME: The current php output is documented
19166 # and desired output is the parsoid target.
19167 !! test
19168 Inline HTML vs wiki block nesting
19169 !! wikitext
19170 <b>Bold paragraph
19171
19172 New wiki paragraph
19173 !! html/php
19174 <p><b>Bold paragraph
19175 </p><p>New wiki paragraph</b>
19176 </p>
19177 !! html/parsoid
19178 <p><b>Bold paragraph</b>
19179 </p><p>New wiki paragraph
19180 </p>
19181 !! end
19182
19183 # Original result was this:
19184 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19185 # </p>
19186 # While that might be marginally more intuitive, maybe, the six-apostrophe
19187 # construct is clearly pathological and the result stated here (which is what
19188 # the parser actually does) is about as reasonable as anything.
19189 !!test
19190 Mixing markup for italics and bold
19191 !! options
19192 !! wikitext
19193 '''bold''''''bold''bolditalics'''''
19194 !! html
19195 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19196 </p>
19197 !! end
19198
19199
19200 !! article
19201 Xyzzyx
19202 !! text
19203 Article for special page transclusion test
19204 !! endarticle
19205
19206 !! test
19207 Special page transclusion
19208 !! options
19209 !! wikitext
19210 {{Special:Prefixindex/Xyzzyx}}
19211 !! html
19212 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19213 </ul>
19214
19215 !! end
19216
19217 !! test
19218 Special page transclusion twice (T7021)
19219 !! options
19220 !! wikitext
19221 {{Special:Prefixindex/Xyzzyx}}
19222 {{Special:Prefixindex/Xyzzyx}}
19223 !! html
19224 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19225 </ul>
19226 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19227 </ul>
19228
19229 !! end
19230
19231 !! test
19232 Transclusion of default MediaWiki message
19233 !! wikitext
19234 {{MediaWiki:Mainpage}}
19235 !! html
19236 <p>Main Page
19237 </p>
19238 !! end
19239
19240 !! test
19241 Transclusion of nonexistent MediaWiki message
19242 !! wikitext
19243 {{MediaWiki:Mainpagexxx}}
19244 !! html
19245 <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>
19246 </p>
19247 !! end
19248
19249 !! test
19250 Transclusion of MediaWiki message with underscore
19251 !! wikitext
19252 {{MediaWiki:history_short}}
19253 !! html
19254 <p>History
19255 </p>
19256 !! end
19257
19258 !! test
19259 Transclusion of MediaWiki message with space
19260 !! wikitext
19261 {{MediaWiki:history short}}
19262 !! html
19263 <p>History
19264 </p>
19265 !! end
19266
19267 !! test
19268 Invalid header with following text
19269 !! wikitext
19270 = x = y
19271 !! html
19272 <p>= x = y
19273 </p>
19274 !! end
19275
19276
19277 !! test
19278 Section extraction test (section 0)
19279 !! options
19280 section=0
19281 !! wikitext
19282 start
19283 ==a==
19284 ===aa===
19285 ====aaa====
19286 ==b==
19287 ===ba===
19288 ===bb===
19289 ====bba====
19290 ===bc===
19291 ==c==
19292 ===ca===
19293 !! html/php
19294 start
19295 !! end
19296
19297 !! test
19298 Section extraction test (section 1)
19299 !! options
19300 section=1
19301 !! wikitext
19302 start
19303 ==a==
19304 ===aa===
19305 ====aaa====
19306 ==b==
19307 ===ba===
19308 ===bb===
19309 ====bba====
19310 ===bc===
19311 ==c==
19312 ===ca===
19313 !! html/php
19314 ==a==
19315 ===aa===
19316 ====aaa====
19317 !! end
19318
19319 !! test
19320 Section extraction test (section 2)
19321 !! options
19322 section=2
19323 !! wikitext
19324 start
19325 ==a==
19326 ===aa===
19327 ====aaa====
19328 ==b==
19329 ===ba===
19330 ===bb===
19331 ====bba====
19332 ===bc===
19333 ==c==
19334 ===ca===
19335 !! html/php
19336 ===aa===
19337 ====aaa====
19338 !! end
19339
19340 !! test
19341 Section extraction test (section 3)
19342 !! options
19343 section=3
19344 !! wikitext
19345 start
19346 ==a==
19347 ===aa===
19348 ====aaa====
19349 ==b==
19350 ===ba===
19351 ===bb===
19352 ====bba====
19353 ===bc===
19354 ==c==
19355 ===ca===
19356 !! html/php
19357 ====aaa====
19358 !! end
19359
19360 !! test
19361 Section extraction test (section 4)
19362 !! options
19363 section=4
19364 !! wikitext
19365 start
19366 ==a==
19367 ===aa===
19368 ====aaa====
19369 ==b==
19370 ===ba===
19371 ===bb===
19372 ====bba====
19373 ===bc===
19374 ==c==
19375 ===ca===
19376 !! html/php
19377 ==b==
19378 ===ba===
19379 ===bb===
19380 ====bba====
19381 ===bc===
19382 !! end
19383
19384 !! test
19385 Section extraction test (section 5)
19386 !! options
19387 section=5
19388 !! wikitext
19389 start
19390 ==a==
19391 ===aa===
19392 ====aaa====
19393 ==b==
19394 ===ba===
19395 ===bb===
19396 ====bba====
19397 ===bc===
19398 ==c==
19399 ===ca===
19400 !! html/php
19401 ===ba===
19402 !! end
19403
19404 !! test
19405 Section extraction test (section 6)
19406 !! options
19407 section=6
19408 !! wikitext
19409 start
19410 ==a==
19411 ===aa===
19412 ====aaa====
19413 ==b==
19414 ===ba===
19415 ===bb===
19416 ====bba====
19417 ===bc===
19418 ==c==
19419 ===ca===
19420 !! html/php
19421 ===bb===
19422 ====bba====
19423 !! end
19424
19425 !! test
19426 Section extraction test (section 7)
19427 !! options
19428 section=7
19429 !! wikitext
19430 start
19431 ==a==
19432 ===aa===
19433 ====aaa====
19434 ==b==
19435 ===ba===
19436 ===bb===
19437 ====bba====
19438 ===bc===
19439 ==c==
19440 ===ca===
19441 !! html/php
19442 ====bba====
19443 !! end
19444
19445 !! test
19446 Section extraction test (section 8)
19447 !! options
19448 section=8
19449 !! wikitext
19450 start
19451 ==a==
19452 ===aa===
19453 ====aaa====
19454 ==b==
19455 ===ba===
19456 ===bb===
19457 ====bba====
19458 ===bc===
19459 ==c==
19460 ===ca===
19461 !! html/php
19462 ===bc===
19463 !! end
19464
19465 !! test
19466 Section extraction test (section 9)
19467 !! options
19468 section=9
19469 !! wikitext
19470 start
19471 ==a==
19472 ===aa===
19473 ====aaa====
19474 ==b==
19475 ===ba===
19476 ===bb===
19477 ====bba====
19478 ===bc===
19479 ==c==
19480 ===ca===
19481 !! html/php
19482 ==c==
19483 ===ca===
19484 !! end
19485
19486 !! test
19487 Section extraction test (section 10)
19488 !! options
19489 section=10
19490 !! wikitext
19491 start
19492 ==a==
19493 ===aa===
19494 ====aaa====
19495 ==b==
19496 ===ba===
19497 ===bb===
19498 ====bba====
19499 ===bc===
19500 ==c==
19501 ===ca===
19502 !! html/php
19503 ===ca===
19504 !! end
19505
19506 !! test
19507 Section extraction test (nonexistent section 11)
19508 !! options
19509 section=11
19510 !! wikitext
19511 start
19512 ==a==
19513 ===aa===
19514 ====aaa====
19515 ==b==
19516 ===ba===
19517 ===bb===
19518 ====bba====
19519 ===bc===
19520 ==c==
19521 ===ca===
19522 !! html/php
19523 !! end
19524
19525 !! test
19526 Section extraction test with bogus heading (section 1)
19527 !! options
19528 section=1
19529 !! wikitext
19530 ==a==
19531 ==bogus== not a legal section
19532 ==b==
19533 !! html/php
19534 ==a==
19535 ==bogus== not a legal section
19536 !! end
19537
19538 !! test
19539 Section extraction test with bogus heading (section 2)
19540 !! options
19541 section=2
19542 !! wikitext
19543 ==a==
19544 ==bogus== not a legal section
19545 ==b==
19546 !! html/php
19547 ==b==
19548 !! end
19549
19550 !! test
19551 Section extraction test with comment after heading (section 1)
19552 !! options
19553 section=1
19554 !! wikitext
19555 ==a==
19556 ==b== <!-- -->
19557 ==c==
19558 !! html/php
19559 ==a==
19560 !! end
19561
19562 !! test
19563 Section extraction test with comment after heading (section 2)
19564 !! options
19565 section=2
19566 !! wikitext
19567 ==a==
19568 ==b== <!-- -->
19569 ==c==
19570 !! html/php
19571 ==b== <!-- -->
19572 !! end
19573
19574 !! test
19575 Section extraction test with bogus <nowiki> heading (section 1)
19576 !! options
19577 section=1
19578 !! wikitext
19579 ==a==
19580 ==bogus== <nowiki>not a legal section</nowiki>
19581 ==b==
19582 !! html/php
19583 ==a==
19584 ==bogus== <nowiki>not a legal section</nowiki>
19585 !! end
19586
19587 !! test
19588 Section extraction test with bogus <nowiki> heading (section 2)
19589 !! options
19590 section=2
19591 !! wikitext
19592 ==a==
19593 ==bogus== <nowiki>not a legal section</nowiki>
19594 ==b==
19595 !! html/php
19596 ==b==
19597 !! end
19598
19599 # Formerly testing for T4587, now resolved by the use of unmarked sections
19600 # instead of respecting commented sections
19601 !! test
19602 Section extraction prefixed by comment (section 1)
19603 !! options
19604 section=1
19605 !! wikitext
19606 <!-- -->==sec1==
19607 ==sec2==
19608 !! html/php
19609 ==sec2==
19610 !!end
19611
19612 !! test
19613 Section extraction prefixed by comment (section 2)
19614 !! options
19615 section=2
19616 !! wikitext
19617 <!-- -->==sec1==
19618 ==sec2==
19619 !! html/php
19620
19621 !!end
19622
19623 # Formerly testing for T4607, now resolved by the use of unmarked sections
19624 # instead of respecting HTML-style headings
19625 !! test
19626 Section extraction, mixed wiki and html (section 1)
19627 !! options
19628 section=1
19629 !! wikitext
19630 <h2>unmarked</h2>
19631 unmarked
19632 ==1==
19633 one
19634 ==2==
19635 two
19636 !! html/php
19637 ==1==
19638 one
19639 !! end
19640
19641 !! test
19642 Section extraction, mixed wiki and html (section 2)
19643 !! options
19644 section=2
19645 !! wikitext
19646 <h2>unmarked</h2>
19647 unmarked
19648 ==1==
19649 one
19650 ==2==
19651 two
19652 !! html/php
19653 ==2==
19654 two
19655 !! end
19656
19657
19658 # Formerly testing for T5342
19659 !! test
19660 Section extraction, heading surrounded by <noinclude>
19661 !! options
19662 section=1
19663 !! wikitext
19664 <noinclude>==unmarked==</noinclude>
19665 ==marked==
19666 !! html/php
19667 ==marked==
19668 !!end
19669
19670 # Test behavior of T21910
19671 !! test
19672 Sectiion with all-equals
19673 !! options
19674 section=2
19675 !! wikitext
19676 ===
19677 The line above must have a trailing space
19678 === <!--
19679 --> <!-- -->
19680 But just in case it doesn't...
19681 !! html/php
19682 === <!--
19683 --> <!-- -->
19684 But just in case it doesn't...
19685 !! end
19686
19687 !! test
19688 Section replacement test (section 0)
19689 !! options
19690 replace=0,"xxx"
19691 !! wikitext
19692 start
19693 ==a==
19694 ===aa===
19695 ====aaa====
19696 ==b==
19697 ===ba===
19698 ===bb===
19699 ====bba====
19700 ===bc===
19701 ==c==
19702 ===ca===
19703 !! html/php
19704 xxx
19705
19706 ==a==
19707 ===aa===
19708 ====aaa====
19709 ==b==
19710 ===ba===
19711 ===bb===
19712 ====bba====
19713 ===bc===
19714 ==c==
19715 ===ca===
19716 !! end
19717
19718 !! test
19719 Section replacement test (section 1)
19720 !! options
19721 replace=1,"xxx"
19722 !! wikitext
19723 start
19724 ==a==
19725 ===aa===
19726 ====aaa====
19727 ==b==
19728 ===ba===
19729 ===bb===
19730 ====bba====
19731 ===bc===
19732 ==c==
19733 ===ca===
19734 !! html/php
19735 start
19736 xxx
19737
19738 ==b==
19739 ===ba===
19740 ===bb===
19741 ====bba====
19742 ===bc===
19743 ==c==
19744 ===ca===
19745 !! end
19746
19747 !! test
19748 Section replacement test (section 2)
19749 !! options
19750 replace=2,"xxx"
19751 !! wikitext
19752 start
19753 ==a==
19754 ===aa===
19755 ====aaa====
19756 ==b==
19757 ===ba===
19758 ===bb===
19759 ====bba====
19760 ===bc===
19761 ==c==
19762 ===ca===
19763 !! html/php
19764 start
19765 ==a==
19766 xxx
19767
19768 ==b==
19769 ===ba===
19770 ===bb===
19771 ====bba====
19772 ===bc===
19773 ==c==
19774 ===ca===
19775 !! end
19776
19777 !! test
19778 Section replacement test (section 3)
19779 !! options
19780 replace=3,"xxx"
19781 !! wikitext
19782 start
19783 ==a==
19784 ===aa===
19785 ====aaa====
19786 ==b==
19787 ===ba===
19788 ===bb===
19789 ====bba====
19790 ===bc===
19791 ==c==
19792 ===ca===
19793 !! html/php
19794 start
19795 ==a==
19796 ===aa===
19797 xxx
19798
19799 ==b==
19800 ===ba===
19801 ===bb===
19802 ====bba====
19803 ===bc===
19804 ==c==
19805 ===ca===
19806 !! end
19807
19808 !! test
19809 Section replacement test (section 4)
19810 !! options
19811 replace=4,"xxx"
19812 !! wikitext
19813 start
19814 ==a==
19815 ===aa===
19816 ====aaa====
19817 ==b==
19818 ===ba===
19819 ===bb===
19820 ====bba====
19821 ===bc===
19822 ==c==
19823 ===ca===
19824 !! html/php
19825 start
19826 ==a==
19827 ===aa===
19828 ====aaa====
19829 xxx
19830
19831 ==c==
19832 ===ca===
19833 !! end
19834
19835 !! test
19836 Section replacement test (section 5)
19837 !! options
19838 replace=5,"xxx"
19839 !! wikitext
19840 start
19841 ==a==
19842 ===aa===
19843 ====aaa====
19844 ==b==
19845 ===ba===
19846 ===bb===
19847 ====bba====
19848 ===bc===
19849 ==c==
19850 ===ca===
19851 !! html/php
19852 start
19853 ==a==
19854 ===aa===
19855 ====aaa====
19856 ==b==
19857 xxx
19858
19859 ===bb===
19860 ====bba====
19861 ===bc===
19862 ==c==
19863 ===ca===
19864 !! end
19865
19866 !! test
19867 Section replacement test (section 6)
19868 !! options
19869 replace=6,"xxx"
19870 !! wikitext
19871 start
19872 ==a==
19873 ===aa===
19874 ====aaa====
19875 ==b==
19876 ===ba===
19877 ===bb===
19878 ====bba====
19879 ===bc===
19880 ==c==
19881 ===ca===
19882 !! html/php
19883 start
19884 ==a==
19885 ===aa===
19886 ====aaa====
19887 ==b==
19888 ===ba===
19889 xxx
19890
19891 ===bc===
19892 ==c==
19893 ===ca===
19894 !! end
19895
19896 !! test
19897 Section replacement test (section 7)
19898 !! options
19899 replace=7,"xxx"
19900 !! wikitext
19901 start
19902 ==a==
19903 ===aa===
19904 ====aaa====
19905 ==b==
19906 ===ba===
19907 ===bb===
19908 ====bba====
19909 ===bc===
19910 ==c==
19911 ===ca===
19912 !! html/php
19913 start
19914 ==a==
19915 ===aa===
19916 ====aaa====
19917 ==b==
19918 ===ba===
19919 ===bb===
19920 xxx
19921
19922 ===bc===
19923 ==c==
19924 ===ca===
19925 !! end
19926
19927 !! test
19928 Section replacement test (section 8)
19929 !! options
19930 replace=8,"xxx"
19931 !! wikitext
19932 start
19933 ==a==
19934 ===aa===
19935 ====aaa====
19936 ==b==
19937 ===ba===
19938 ===bb===
19939 ====bba====
19940 ===bc===
19941 ==c==
19942 ===ca===
19943 !! html/php
19944 start
19945 ==a==
19946 ===aa===
19947 ====aaa====
19948 ==b==
19949 ===ba===
19950 ===bb===
19951 ====bba====
19952 xxx
19953
19954 ==c==
19955 ===ca===
19956 !!end
19957
19958 !! test
19959 Section replacement test (section 9)
19960 !! options
19961 replace=9,"xxx"
19962 !! wikitext
19963 start
19964 ==a==
19965 ===aa===
19966 ====aaa====
19967 ==b==
19968 ===ba===
19969 ===bb===
19970 ====bba====
19971 ===bc===
19972 ==c==
19973 ===ca===
19974 !! html/php
19975 start
19976 ==a==
19977 ===aa===
19978 ====aaa====
19979 ==b==
19980 ===ba===
19981 ===bb===
19982 ====bba====
19983 ===bc===
19984 xxx
19985 !! end
19986
19987 !! test
19988 Section replacement test (section 10)
19989 !! options
19990 replace=10,"xxx"
19991 !! wikitext
19992 start
19993 ==a==
19994 ===aa===
19995 ====aaa====
19996 ==b==
19997 ===ba===
19998 ===bb===
19999 ====bba====
20000 ===bc===
20001 ==c==
20002 ===ca===
20003 !! html/php
20004 start
20005 ==a==
20006 ===aa===
20007 ====aaa====
20008 ==b==
20009 ===ba===
20010 ===bb===
20011 ====bba====
20012 ===bc===
20013 ==c==
20014 xxx
20015 !! end
20016
20017 !! test
20018 Section replacement test with initial whitespace (T15728)
20019 !! options
20020 replace=2,"xxx"
20021 !! wikitext
20022 Preformatted initial line
20023 ==a==
20024 ===a===
20025 !! html/php
20026 Preformatted initial line
20027 ==a==
20028 xxx
20029 !! end
20030
20031
20032 !! test
20033 Section extraction, heading followed by pre with 20 spaces (T8398)
20034 !! options
20035 section=1
20036 !! wikitext
20037 ==a==
20038 a
20039 !! html/php
20040 ==a==
20041 a
20042 !! end
20043
20044 !! test
20045 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20046 !! options
20047 section=1
20048 !! wikitext
20049 ==a==
20050 a
20051 !! html/php
20052 ==a==
20053 a
20054 !! end
20055
20056
20057 !! test
20058 Section extraction, <pre> around bogus header (T12309)
20059 !! options
20060 section=2
20061 !! wikitext
20062 == Section One ==
20063 <pre>
20064 =======
20065 </pre>
20066
20067 == Section Two ==
20068 stuff
20069 !! html/php
20070 == Section Two ==
20071 stuff
20072 !! end
20073
20074 !! test
20075 Section replacement, <pre> around bogus header (T12309)
20076 !! options
20077 replace=2,"xxx"
20078 !! wikitext
20079 == Section One ==
20080 <pre>
20081 =======
20082 </pre>
20083
20084 == Section Two ==
20085 stuff
20086 !! html/php
20087 == Section One ==
20088 <pre>
20089 =======
20090 </pre>
20091
20092 xxx
20093 !! end
20094
20095 !! test
20096 Handling of &#x0A; in URLs
20097 !! wikitext
20098 *irc://&#x0A;a
20099 !! html/php
20100 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20101
20102 !! html/parsoid
20103 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul>
20104 !! end
20105
20106 !! test
20107 Handling of %0A in URLs
20108 !! wikitext
20109 *irc://%0Aa
20110 !! html/php
20111 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20112
20113 !! html/parsoid
20114 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20115 !! end
20116
20117 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20118 !! test
20119 5 quotes, code coverage +1 line
20120 !! options
20121 parsoid=wt2html
20122 !! wikitext
20123 '''''
20124 !! html/php
20125 !! html/parsoid
20126 <b><i></i></b>
20127 !! end
20128
20129 # same html as previous, but wikitext adjusted to match parsoid html2wt
20130 # note that wt2html and html2html will put the <i> before the <b>
20131 !! test
20132 5 quotes, code coverage +1 line w/ nowiki (1)
20133 !! options
20134 parsoid=wt2wt,html2wt
20135 !! wikitext
20136 '''''<nowiki/>'''''
20137 !! html/php
20138 <p><i></i>
20139 </p>
20140 !! html/parsoid
20141 <p><b><i></i></b></p>
20142 !! end
20143
20144 # same as previous, just swapping the <i> and <b>
20145 !! test
20146 5 quotes, code coverage +1 line w/ nowiki (2)
20147 !! wikitext
20148 '''''<nowiki/>'''''
20149 !! html/php
20150 <p><i></i>
20151 </p>
20152 !! html/parsoid
20153 <p><i><b></b></i></p>
20154 !! end
20155
20156 !! test
20157 Special:Search page linking.
20158 !! wikitext
20159 {{Special:search}}
20160 !! html
20161 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20162 </p>
20163 !! end
20164
20165 !! test
20166 {{!}} is a magic word
20167 !! wikitext
20168 {{!}} is a magic word there and {{!}} is still a magic word here
20169 | is not a magic word here but {{!}} is still a magic word here
20170 !! html/php
20171 <p>| is a magic word there and | is still a magic word here
20172 | is not a magic word here but | is still a magic word here
20173 </p>
20174 !! html/parsoid
20175 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"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":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
20176 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
20177 !! end
20178
20179 !! test
20180 Say the magic word
20181 !! options
20182 title=[[Parser test]]
20183 !! wikitext
20184 *{{PAGENAME}}
20185 *{{PAGENAMEE}}
20186 *{{FULLPAGENAME}}
20187 *{{FULLPAGENAMEE}}
20188 *{{BASEPAGENAME}}
20189 *{{BASEPAGENAMEE}}
20190 *{{SUBPAGENAME}}
20191 *{{SUBPAGENAMEE}}
20192 *{{ROOTPAGENAME}}
20193 *{{ROOTPAGENAMEE}}
20194 *{{TALKPAGENAME}}
20195 *{{TALKPAGENAMEE}}
20196 *{{SUBJECTPAGENAME}}
20197 *{{SUBJECTPAGENAMEE}}
20198 *{{NAMESPACEE}}
20199 *{{NAMESPACE}}
20200 *{{NAMESPACENUMBER}}
20201 *{{TALKSPACE}}
20202 *{{TALKSPACEE}}
20203 *{{SUBJECTSPACE}}
20204 *{{SUBJECTSPACEE}}
20205 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20206 !! html
20207 <ul><li>Parser test</li>
20208 <li>Parser_test</li>
20209 <li>Parser test</li>
20210 <li>Parser_test</li>
20211 <li>Parser test</li>
20212 <li>Parser_test</li>
20213 <li>Parser test</li>
20214 <li>Parser_test</li>
20215 <li>Parser test</li>
20216 <li>Parser_test</li>
20217 <li>Talk:Parser test</li>
20218 <li>Talk:Parser_test</li>
20219 <li>Parser test</li>
20220 <li>Parser_test</li>
20221 <li></li>
20222 <li></li>
20223 <li>0</li>
20224 <li>Talk</li>
20225 <li>Talk</li>
20226 <li></li>
20227 <li></li>
20228 <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>
20229
20230 !! end
20231 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20232
20233 !! test
20234 Gallery with valid attributes
20235 !! wikitext
20236 <gallery type="123" summary="345">
20237 File:File:Foobar.jpg
20238 </gallery>
20239 !! html/php
20240 <ul class="gallery mw-gallery-traditional" type="123">
20241 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20242 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20243 <div class="gallerytext">
20244 </div>
20245 </div></li>
20246 </ul>
20247
20248 !! html/parsoid
20249 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{"extsrc":"\nFile:File:Foobar.jpg\n"}}'>
20250 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:File:Foobar.jpg"><img resource="./File:File:Foobar.jpg" src="./Special:FilePath/File:Foobar.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20251 </ul>
20252 !! end
20253
20254 ## Parsoid thinks the "centre" here is a property, not a caption.
20255 !! test
20256 Gallery
20257 !! options
20258 parsoid={
20259 "modes": ["wt2html"],
20260 "nativeGallery": true
20261 }
20262 !! wikitext
20263 <gallery>
20264 image1.png |
20265 image2.gif|||||
20266
20267 image3|
20268 image4 |300px| centre
20269 image5.svg| http://///////
20270 [[x|xx]]]]
20271 * image6
20272 </gallery>
20273 !! html/php
20274 <ul class="gallery mw-gallery-traditional">
20275 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20276 <div class="thumb" style="height: 150px;">Image1.png</div>
20277 <div class="gallerytext">
20278 </div>
20279 </div></li>
20280 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20281 <div class="thumb" style="height: 150px;">Image2.gif</div>
20282 <div class="gallerytext">
20283 </div>
20284 </div></li>
20285 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20286 <div class="thumb" style="height: 150px;">Image3</div>
20287 <div class="gallerytext">
20288 </div>
20289 </div></li>
20290 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20291 <div class="thumb" style="height: 150px;">Image4</div>
20292 <div class="gallerytext">
20293 <pre>centre
20294 </pre>
20295 </div>
20296 </div></li>
20297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20298 <div class="thumb" style="height: 150px;">Image5.svg</div>
20299 <div class="gallerytext">
20300 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20301 </p>
20302 </div>
20303 </div></li>
20304 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20305 <div class="thumb" style="height: 150px;">* image6</div>
20306 <div class="gallerytext">
20307 </div>
20308 </div></li>
20309 </ul>
20310
20311 !! html/parsoid
20312 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20313 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image1.png"><img resource="./File:Image1.png" src="./Special:FilePath/Image1.png" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20314 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image2.gif"><img resource="./File:Image2.gif" src="./Special:FilePath/Image2.gif" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20315 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20316 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></a></figure-inline></div><div class="gallerytext"></div></li>
20317 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image5.svg"><img resource="./File:Image5.svg" src="./Special:FilePath/Image5.svg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"> <a rel="mw:ExtLink" class="external free" href="http://///////">http://///////</a></div></li>
20318 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20319 </ul>
20320 !! end
20321
20322 !! test
20323 Gallery (with options, html)
20324 !! options
20325 parsoid={
20326 "modes": ["wt2html", "html2html"],
20327 "nativeGallery": true
20328 }
20329 !! wikitext
20330 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20331 File:Nonexistent.jpg|caption
20332 File:Nonexistent.jpg
20333 image:foobar.jpg|some '''caption''' [[Main Page]]
20334 image:foobar.jpg
20335 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20336 </gallery>
20337 !! html/php
20338 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20339 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20340 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20341 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20342 <div class="gallerytext">
20343 <p>caption
20344 </p>
20345 </div>
20346 </div></li>
20347 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20348 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20349 <div class="gallerytext">
20350 </div>
20351 </div></li>
20352 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20353 <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>
20354 <div class="gallerytext">
20355 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20356 </p>
20357 </div>
20358 </div></li>
20359 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20360 <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>
20361 <div class="gallerytext">
20362 </div>
20363 </div></li>
20364 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20365 <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>
20366 <div class="gallerytext">
20367 <p>blabla.
20368 </p>
20369 </div>
20370 </div></li>
20371 </ul>
20372
20373 !! html/parsoid
20374 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2"},"body":{}}'>
20375 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20376 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20377 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20378 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20379 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20380 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
20381 </ul>
20382 !! end
20383
20384 !! test
20385 Gallery (with options, extsrc)
20386 !! options
20387 parsoid={
20388 "nativeGallery": false
20389 }
20390 !! wikitext
20391 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20392 File:Nonexistent.jpg|caption
20393 File:Nonexistent.jpg
20394 image:foobar.jpg|some '''caption''' [[Main Page]]
20395 image:foobar.jpg
20396 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20397 </gallery>
20398 !! html/php
20399 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20400 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20401 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20402 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20403 <div class="gallerytext">
20404 <p>caption
20405 </p>
20406 </div>
20407 </div></li>
20408 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20409 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20410 <div class="gallerytext">
20411 </div>
20412 </div></li>
20413 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20414 <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>
20415 <div class="gallerytext">
20416 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20417 </p>
20418 </div>
20419 </div></li>
20420 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20421 <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>
20422 <div class="gallerytext">
20423 </div>
20424 </div></li>
20425 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20426 <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>
20427 <div class="gallerytext">
20428 <p>blabla.
20429 </p>
20430 </div>
20431 </div></li>
20432 </ul>
20433
20434 !! html/parsoid
20435 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &#39;&#39;&#39;caption&#39;&#39;&#39; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
20436 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20437 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20438 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20439 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20440 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20441 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
20442 </ul>
20443 !! end
20444
20445 !! test
20446 Gallery (without px units)
20447 !! wikitext
20448 <gallery widths="70" heights="40">
20449 File:Foobar.jpg
20450 </gallery>
20451 !! html/php
20452 <ul class="gallery mw-gallery-traditional">
20453 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20454 <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>
20455 <div class="gallerytext">
20456 </div>
20457 </div></li>
20458 </ul>
20459
20460 !! html/parsoid
20461 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
20462 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20463 </ul>
20464 !! end
20465
20466 !! test
20467 Gallery (with invalid units)
20468 !! wikitext
20469 <gallery widths="70em" heights="40em">
20470 File:Foobar.jpg
20471 </gallery>
20472 !! html/php
20473 <ul class="gallery mw-gallery-traditional">
20474 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20475 <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>
20476 <div class="gallerytext">
20477 </div>
20478 </div></li>
20479 </ul>
20480
20481 !! html/parsoid
20482 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
20483 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20484 </ul>
20485 !! end
20486
20487 !! test
20488 Gallery with link that has fragment
20489 !! options
20490 parsoid={
20491 "modes": ["wt2html", "html2html"],
20492 "nativeGallery": true
20493 }
20494 !! wikitext
20495 <gallery>
20496 image:foobar.jpg|link=Main_Page
20497 image:foobar.jpg|link=Main_Page#section
20498 image:foobar.jpg|link=Main Page#section|caption
20499 </gallery>
20500 !! html/php
20501 <ul class="gallery mw-gallery-traditional">
20502 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20503 <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>
20504 <div class="gallerytext">
20505 </div>
20506 </div></li>
20507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20508 <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>
20509 <div class="gallerytext">
20510 </div>
20511 </div></li>
20512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20513 <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>
20514 <div class="gallerytext">
20515 <p>caption
20516 </p>
20517 </div>
20518 </div></li>
20519 </ul>
20520
20521 !! html/parsoid
20522 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20523 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20524 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20525 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20526 </ul>
20527 !! end
20528
20529 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20530 !! test
20531 Gallery with template inside caption
20532 !! options
20533 parsoid={
20534 "nativeGallery": true
20535 }
20536 !! wikitext
20537 <gallery caption="{{echo|hi}}">
20538 File:Foobar.jpg|{{echo|ho}}
20539 </gallery>
20540 !! html/php
20541 <ul class="gallery mw-gallery-traditional">
20542 <li class='gallerycaption'>{{echo|hi}}</li>
20543 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20544 <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>
20545 <div class="gallerytext">
20546 <p>ho
20547 </p>
20548 </div>
20549 </div></li>
20550 </ul>
20551
20552 !! html/parsoid
20553 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20554 <li class="gallerycaption"><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span></li>
20555 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho"}},"i":0}}]}'>ho</span></div></li>
20556 </ul>
20557 !! end
20558
20559 !! test
20560 Gallery with wikitext inside caption
20561 !! options
20562 parsoid={
20563 "nativeGallery": true
20564 }
20565 !! wikitext
20566 <gallery>
20567 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20568 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20569 </gallery>
20570 !! html/php
20571 <ul class="gallery mw-gallery-traditional">
20572 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20573 <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>
20574 <div class="gallerytext">
20575 <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>
20576 </p>
20577 </div>
20578 </div></li>
20579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20580 <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>
20581 <div class="gallerytext">
20582 <p>This is a test template
20583 </p>
20584 </div>
20585 </div></li>
20586 </ul>
20587
20588 !! html/parsoid
20589 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20590 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image" data-mw='{"caption":"desc"}'><a href="./File:Foobar.jpg"><img alt="inneralt" 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></figure-inline></div></li>
20591 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"param"}},"i":0}}]}'>This is a test template</span></div></li>
20592 </ul>
20593 !! end
20594
20595 !! test
20596 Gallery (with showfilename option)
20597 !! options
20598 parsoid={
20599 "nativeGallery": true
20600 }
20601 !! wikitext
20602 <gallery showfilename="">
20603 File:Nonexistent.jpg|caption
20604 File:Nonexistent.jpg
20605 File:Foobar.jpg|some '''caption''' [[Main Page]]
20606 File:Foobar.jpg
20607 </gallery>
20608 !! html/php
20609 <ul class="gallery mw-gallery-traditional">
20610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20611 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20612 <div class="gallerytext">
20613 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20614 caption
20615 </p>
20616 </div>
20617 </div></li>
20618 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20619 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20620 <div class="gallerytext">
20621 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20622 </p>
20623 </div>
20624 </div></li>
20625 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20626 <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>
20627 <div class="gallerytext">
20628 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20629 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20630 </p>
20631 </div>
20632 </div></li>
20633 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20634 <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>
20635 <div class="gallerytext">
20636 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20637 </p>
20638 </div>
20639 </div></li>
20640 </ul>
20641
20642 !! html/parsoid
20643 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20644 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
20645 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
20646 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20647 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
20648 </ul>
20649 !! end
20650
20651 ## Should Parsoid be preserving these variations? See T151367
20652 !! test
20653 Gallery (with namespace-less filenames)
20654 !! options
20655 parsoid={
20656 "modes": ["wt2html", "html2html"],
20657 "nativeGallery": true
20658 }
20659 !! wikitext
20660 <gallery>
20661 File:Nonexistent.jpg
20662 Nonexistent.jpg
20663 image:foobar.jpg
20664 foobar.jpg
20665 </gallery>
20666 !! html/php
20667 <ul class="gallery mw-gallery-traditional">
20668 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20669 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20670 <div class="gallerytext">
20671 </div>
20672 </div></li>
20673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20674 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20675 <div class="gallerytext">
20676 </div>
20677 </div></li>
20678 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20679 <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>
20680 <div class="gallerytext">
20681 </div>
20682 </div></li>
20683 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20684 <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>
20685 <div class="gallerytext">
20686 </div>
20687 </div></li>
20688 </ul>
20689
20690 !! html/parsoid
20691 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20692 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20693 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20694 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20695 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20696 </ul>
20697 !! end
20698
20699 !! test
20700 Gallery override link with wikilink (T36852)
20701 !! options
20702 parsoid={
20703 "nativeGallery": true
20704 }
20705 !! wikitext
20706 <gallery>
20707 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20708 </gallery>
20709 !! html/php
20710 <ul class="gallery mw-gallery-traditional">
20711 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20712 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Wikilink"><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>
20713 <div class="gallerytext">
20714 </div>
20715 </div></li>
20716 </ul>
20717
20718 !! html/parsoid
20719 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20720 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Wikilink"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20721 </ul>
20722 !! end
20723
20724 !! test
20725 Gallery override link with absolute external link (T36852)
20726 !! options
20727 parsoid={
20728 "nativeGallery": true
20729 }
20730 !! wikitext
20731 <gallery>
20732 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20733 </gallery>
20734 !! html/php
20735 <ul class="gallery mw-gallery-traditional">
20736 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20737 <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>
20738 <div class="gallerytext">
20739 </div>
20740 </div></li>
20741 </ul>
20742
20743 !! html/parsoid
20744 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20745 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20746 </ul>
20747 !! end
20748
20749 !! test
20750 Gallery override link with absolute external link with LanguageConverter
20751 !! options
20752 language=zh
20753 !! wikitext
20754 <gallery>
20755 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20756 </gallery>
20757 !! html/php
20758 <ul class="gallery mw-gallery-traditional">
20759 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20760 <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>
20761 <div class="gallerytext">
20762 <p>caption
20763 </p>
20764 </div>
20765 </div></li>
20766 </ul>
20767
20768 !! html/parsoid
20769 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\n"}}'>
20770 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20771 </ul>
20772 !! end
20773
20774 !! test
20775 Gallery override link with malicious javascript (T36852)
20776 !! options
20777 parsoid={
20778 "modes": ["wt2html", "html2html"],
20779 "nativeGallery": true
20780 }
20781 !! wikitext
20782 <gallery>
20783 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20784 </gallery>
20785 !! html/php
20786 <ul class="gallery mw-gallery-traditional">
20787 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20788 <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>
20789 <div class="gallerytext">
20790 </div>
20791 </div></li>
20792 </ul>
20793
20794 !! html/parsoid
20795 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20796 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20797 </ul>
20798 !! end
20799
20800 # Note that parsoid uses the invalid link as a caption, PHP does not.
20801 !! test
20802 Gallery with invalid title as link (T45964)
20803 !! options
20804 parsoid={
20805 "modes": ["wt2html", "html2html"],
20806 "nativeGallery": true
20807 }
20808 !! wikitext
20809 <gallery>
20810 File:Foobar.jpg|link=<
20811 </gallery>
20812 !! html/php
20813 <ul class="gallery mw-gallery-traditional">
20814 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20815 <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>
20816 <div class="gallerytext">
20817 </div>
20818 </div></li>
20819 </ul>
20820
20821 !! html/parsoid
20822 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20823 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">link=&lt;</div></li>
20824 </ul>
20825 !! end
20826
20827 !! test
20828 Serialize gallery without attrs in data-mw
20829 !! options
20830 parsoid={
20831 "modes": ["html2wt"],
20832 "nativeGallery": true
20833 }
20834 !! html/parsoid
20835 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20836 <li class="gallerycaption">123</li>
20837 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span>File:Test.png</span></div><div class="gallerytext"></div></li>
20838 </ul>
20839 !! wikitext
20840 <gallery caption="123">
20841 File:Test.png
20842 </gallery>
20843 !! end
20844
20845 !! test
20846 Gallery with class and style attributes
20847 !! options
20848 parsoid={
20849 "nativeGallery": true
20850 }
20851 !! wikitext
20852 <gallery class="center" style="text-align: center;">
20853 File:Foobar.jpg
20854 </gallery>
20855 !! html/php
20856 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20857 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20858 <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>
20859 <div class="gallerytext">
20860 </div>
20861 </div></li>
20862 </ul>
20863
20864 !! html/parsoid
20865 <ul class="gallery mw-gallery-traditional center" style="text-align: center;" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center","style":"text-align: center;"},"body":{}}'>
20866 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20867 </ul>
20868 !! end
20869
20870 !! test
20871 Gallery in slideshow mode
20872 !! options
20873 parsoid={
20874 "nativeGallery": true
20875 }
20876 !! wikitext
20877 <gallery mode="slideshow" showthumbnails="">
20878 File:Foobar.jpg
20879 </gallery>
20880 !! html/php
20881 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20882 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20883 <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>
20884 <div class="gallerytext">
20885 </div>
20886 </div></li>
20887 </ul>
20888
20889 !! html/parsoid
20890 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20891 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20892 </ul>
20893 !! end
20894
20895 !! test
20896 HTML Hex character encoding (spells the word "JavaScript")
20897 !! options
20898 parsoid=wt2html,wt2wt,html2html
20899 !! wikitext
20900 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20901 !! html/php
20902 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20903 </p>
20904 !! html/parsoid
20905 <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>
20906 !! end
20907
20908 !! test
20909 HTML Hex character encoding bogus encoding (T28437 regression check)
20910 !! wikitext
20911 &#xsee;&#XSEE;
20912 !! html
20913 <p>&amp;#xsee;&amp;#XSEE;
20914 </p>
20915 !! end
20916
20917 !! test
20918 HTML Hex character encoding mixed case
20919 !! options
20920 parsoid=wt2html,wt2wt,html2html
20921 !! wikitext
20922 &#xEE;&#Xee;
20923 !! html/php
20924 <p>&#xee;&#xee;
20925 </p>
20926 !! html/parsoid
20927 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20928 !! end
20929
20930 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20931 # Note that U+000C (form feed) is not a valid XML character, so
20932 # it is banned even though allowed in HTML5.
20933 !! test
20934 Illegal character references (T106578)
20935 !! wikitext
20936 ; Null: &#00;
20937 ; FF: &#xC;
20938 ; CR: &#xD;
20939 ; Control (low): &#8;
20940 ; Control (high): &#x7F; &#x9F;
20941 ; Surrogate: &#xD83D;&#xDCA9;
20942 ; This is an okay astral character: &#x1F4A9;
20943 !! html+tidy
20944 <dl><dt>Null</dt>
20945 <dd>&amp;#00;</dd>
20946 <dt>FF</dt>
20947 <dd>&amp;#xC;</dd>
20948 <dt>CR</dt>
20949 <dd>&amp;#xD;</dd>
20950 <dt>Control (low)</dt>
20951 <dd>&amp;#8;</dd>
20952 <dt>Control (high)</dt>
20953 <dd>&amp;#x7F; &amp;#x9F;</dd>
20954 <dt>Surrogate</dt>
20955 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20956 <dt>This is an okay astral character</dt>
20957 <dd>&#x1f4a9;</dd></dl>
20958 !! end
20959
20960 !! test
20961 __FORCETOC__ override
20962 !! wikitext
20963 __NEWSECTIONLINK__
20964 __FORCETOC__
20965 !! html/php
20966 <p><br />
20967 </p>
20968 !! end
20969
20970 !! test
20971 ISBN code coverage
20972 !! wikitext
20973 ISBN 978-0-1234-56&#x20;789
20974 !! html/php
20975 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20976 </p>
20977 !! html/parsoid
20978 <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>
20979 !! end
20980
20981 !! test
20982 ISBN followed by 5 spaces
20983 !! wikitext
20984 ISBN
20985 !! html
20986 <p>ISBN
20987 </p>
20988 !! end
20989
20990 !! test
20991 Double ISBN
20992 !! wikitext
20993 ISBN ISBN 1234567890
20994 !! html/php
20995 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20996 </p>
20997 !! html/parsoid
20998 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20999 !! end
21000
21001 # Uppercase X and lowercase x as well
21002 !! test
21003 ISBN with an X
21004 !! wikitext
21005 ISBN 3-462-04561-X
21006 ISBN 3-462-04561-x
21007 ISBN 080442957X
21008 ISBN 080442957x
21009 ISBN 978080442957X
21010 ISBN 978080442957x
21011 !! html/php
21012 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21013 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21014 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21015 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21016 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21017 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21018 </p>
21019 !! html/parsoid
21020 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21021 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21022 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21023 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21024 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21025 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21026 !! end
21027
21028 !! test
21029 ISBN with empty prefix (parsoid test)
21030 !! wikitext
21031 ISBN 1234567890
21032 !! html/php
21033 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21034 </p>
21035 !! html/parsoid
21036 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21037 !! end
21038
21039 !! test
21040 T24905: <abbr> followed by ISBN followed by </a>
21041 !! wikitext
21042 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21043 !! html/php
21044 <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>
21045 </p>
21046 !! html/parsoid
21047 <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" class="external text" href="http://www.example.com">example.com</a></p>
21048 !! end
21049
21050 !! test
21051 Double RFC
21052 !! wikitext
21053 RFC RFC 1234
21054 !! html
21055 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21056 </p>
21057 !! end
21058
21059 !! test
21060 Double RFC with a wiki link
21061 !! wikitext
21062 RFC [[RFC 1234]]
21063 !! html
21064 <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>
21065 </p>
21066 !! end
21067
21068 !! test
21069 RFC code coverage
21070 !! wikitext
21071 RFC 983&#x20;987
21072 !! html/php
21073 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21074 </p>
21075 !! html/parsoid
21076 <p><a href="https://tools.ietf.org/html/rfc983" rel="mw:ExtLink" class="external text" data-parsoid='{"stx":"magiclink"}'>RFC 983</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>987</p>
21077 !! end
21078
21079 !! test
21080 Centre-aligned image
21081 !! wikitext
21082 [[Image:foobar.jpg|centre]]
21083 !! html/php
21084 <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>
21085
21086 !! html/parsoid
21087 <figure class="mw-default-size mw-halign-center" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"center","ak":"centre"}]}'><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></figure>
21088 !! end
21089
21090 !! test
21091 None-aligned image
21092 !! wikitext
21093 [[Image:foobar.jpg|none]]
21094 !! html/php
21095 <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>
21096
21097 !! html/parsoid
21098 <figure class="mw-default-size mw-halign-none" 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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
21099 !! end
21100
21101 !! test
21102 Width + Height sized image (using px) (height is ignored)
21103 !! wikitext
21104 [[Image:foobar.jpg|640x480px]]
21105 !! html/php
21106 <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>
21107 </p>
21108 !! html/parsoid
21109 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640x480px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21110 !! end
21111
21112 !! test
21113 Width-sized image (using px, no following whitespace)
21114 !! wikitext
21115 [[Image:foobar.jpg|640px]]
21116 !! html/php
21117 <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>
21118 </p>
21119 !! html/parsoid
21120 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21121 !! end
21122
21123 !! test
21124 Width-sized image (using px, with following whitespace - test regression from r39467)
21125 !! wikitext
21126 [[Image:foobar.jpg|640px ]]
21127 !! html/php
21128 <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>
21129 </p>
21130 !! html/parsoid
21131 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px "}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21132 !!end
21133
21134 !! test
21135 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21136 !! wikitext
21137 [[Image:foobar.jpg| 640px]]
21138 !! html/php
21139 <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>
21140 </p>
21141 !! html/parsoid
21142 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":" 640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21143 !! end
21144
21145 !! test
21146 Image with page parameter
21147 !! options
21148 djvu
21149 !! wikitext
21150 [[File:LoremIpsum.djvu|page=2]]
21151 !! html/php
21152 <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>
21153 </p>
21154 !! html/parsoid
21155 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}' data-mw='{"page":"2"}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><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></figure-inline></p>
21156 !! end
21157
21158 !! test
21159 Another italics / bold test
21160 !! wikitext
21161 ''' ''x'
21162 !! html
21163 <pre>'<i> </i>x'
21164 </pre>
21165 !!end
21166
21167 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21168 !! test
21169 dt/dd/dl test
21170 !! wikitext
21171 :;;;::
21172 !! html/php
21173 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21174
21175 !! html/parsoid
21176 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21177
21178 !!end
21179
21180 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21181 !! test
21182 Images with the "|" character in the comment
21183 !! wikitext
21184 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21185 !! html/php
21186 <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>
21187
21188 !! html/parsoid
21189 <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" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
21190 !! end
21191
21192 !! test
21193 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21194 !! wikitext
21195 <html><script>alert(1);</script></html>
21196 !! html
21197 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21198 </p>
21199 !! end
21200
21201 !! test
21202 HTML with raw HTML ($wgRawHtml==true)
21203 !! options
21204 wgRawHtml=1
21205 !! wikitext
21206 <html><script>alert(1);</script></html>
21207 !! html/php
21208 <p><script>alert(1);</script>
21209 </p>
21210 !! end
21211
21212 !! test
21213 Parents of subpages, one level up
21214 !! options
21215 subpage title=[[Subpage test/L1/L2/L3]]
21216 !! wikitext
21217 [[../|L2]]
21218 !! html
21219 <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>
21220 </p>
21221 !! end
21222
21223
21224 !! test
21225 Parents of subpages, one level up, not named
21226 !! options
21227 subpage title=[[Subpage test/L1/L2/L3]]
21228 !! wikitext
21229 [[../]]
21230 !! html
21231 <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>
21232 </p>
21233 !! end
21234
21235
21236
21237 !! test
21238 Parents of subpages, two levels up
21239 !! options
21240 subpage title=[[Subpage test/L1/L2/L3]]
21241 !! wikitext
21242 [[../../|L1]]2
21243
21244 [[../../|L1]]l
21245 !! html
21246 <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
21247 </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>
21248 </p>
21249 !! end
21250
21251 !! test
21252 Parents of subpages, two levels up, without trailing slash or name.
21253 !! options
21254 subpage title=[[Subpage test/L1/L2/L3]]
21255 !! wikitext
21256 [[../..]]
21257 !! html
21258 <p>[[../..]]
21259 </p>
21260 !! end
21261
21262 !! test
21263 Parents of subpages, two levels up, with lots of extra trailing slashes.
21264 !! options
21265 subpage title=[[Subpage test/L1/L2/L3]]
21266 !! wikitext
21267 [[../../////]]
21268 !! html
21269 <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>
21270 </p>
21271 !! end
21272
21273 !! article
21274 Subpage test/L1/L2/L3Sibling
21275 !! text
21276 Sibling article
21277 !! endarticle
21278
21279 !! test
21280 Transclusion of a sibling page (one level up)
21281 !! options
21282 subpage title=[[Subpage test/L1/L2/L3]]
21283 !! wikitext
21284 {{../L3Sibling}}
21285 !! html
21286 <p>Sibling article
21287 </p>
21288 !! end
21289
21290 !! test
21291 Transclusion of a child page
21292 !! options
21293 subpage title=[[Subpage test/L1/L2]]
21294 !! wikitext
21295 {{/L3Sibling}}
21296 !! html
21297 <p>Sibling article
21298 </p>
21299 !! end
21300
21301 # This is wt2html only in Parsoid because we add <nowiki>
21302 # because of {{..}} and we don't expect to fix that to
21303 # eliminate the nowikis selective for {{..}} markup.
21304 !! test
21305 Non-transclusion because of too many up levels
21306 !! options
21307 subpage title=[[Subpage test/L1/L2/L3]]
21308 parsoid=wt2html
21309 !! wikitext
21310 {{../../../../More than parent}}
21311 !! html/php
21312 <p>{{../../../../More than parent}}
21313 </p>
21314 !! html/parsoid
21315 <p>{{../../../../More than parent}}</p>
21316 !! end
21317
21318 !! test
21319 Definition list code coverage
21320 !! wikitext
21321 ;title : def
21322 ;title : def
21323 ;title: def
21324 !! html/php
21325 <dl><dt>title &#160;</dt>
21326 <dd>def</dd>
21327 <dt>title&#160;</dt>
21328 <dd>def</dd>
21329 <dt>title</dt>
21330 <dd>def</dd></dl>
21331
21332 !! html/parsoid
21333 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21334 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21335 <dt>title</dt><dd> def</dd></dl>
21336 !! end
21337
21338 !! test
21339 Don't fall for the self-closing div
21340 !! wikitext
21341 <div>hello world</div/>
21342 !! html
21343 <div>hello world</div>
21344
21345 !! end
21346
21347 !! test
21348 MSGNW magic word
21349 !! wikitext
21350 {{MSGNW:msg}}
21351 !! html/php
21352 <p>&#91;&#91;:Template:Msg&#93;&#93;
21353 </p>
21354 !! end
21355
21356 !! test
21357 RAW magic word
21358 !! wikitext
21359 {{RAW:QUERTY}}
21360 !! html
21361 <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>
21362 </p>
21363 !! end
21364
21365 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21366 !! test
21367 Always escape literal '>' in output, not just after '<'
21368 !! wikitext
21369 ><>
21370 !! html
21371 <p>&gt;&lt;&gt;
21372 </p>
21373 !! end
21374
21375 !! test
21376 Template caching
21377 !! wikitext
21378 {{Test}}
21379 {{Test}}
21380 !! html
21381 <p>This is a test template
21382 This is a test template
21383 </p>
21384 !! end
21385
21386
21387 !! article
21388 MediaWiki:Fake
21389 !! text
21390 ==header==
21391 !! endarticle
21392
21393 !! test
21394 Inclusion of !userCanEdit() content
21395 !! wikitext
21396 {{MediaWiki:Fake}}
21397 !! html
21398 <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>
21399
21400 !! end
21401
21402
21403 !! test
21404 Out-of-order TOC heading levels
21405 !! wikitext
21406 ==2==
21407 ======6======
21408 ===3===
21409 =1=
21410 =====5=====
21411 ==2==
21412 !! html
21413 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21414 <ul>
21415 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21416 <ul>
21417 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21418 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21419 </ul>
21420 </li>
21421 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21422 <ul>
21423 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21424 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21425 </ul>
21426 </li>
21427 </ul>
21428 </div>
21429
21430 <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>
21431 <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>
21432 <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>
21433 <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>
21434 <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>
21435 <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>
21436
21437 !! end
21438
21439
21440 !! test
21441 ISBN with a dummy number
21442 !! wikitext
21443 ISBN ---
21444 !! html
21445 <p>ISBN ---
21446 </p>
21447 !! end
21448
21449
21450 !! test
21451 ISBN with space-delimited number
21452 !! wikitext
21453 ISBN 92 9017 032 8
21454 !! html/php
21455 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21456 </p>
21457 !! html/parsoid
21458 <p data-parsoid='{"dsr":[0,18,0,0]}'><a href="./Special:BookSources/9290170328" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink","dsr":[0,18,2,2]}'>ISBN 92 9017 032 8</a></p>
21459 !! end
21460
21461
21462 !! test
21463 ISBN with multiple spaces, no number
21464 !! wikitext
21465 ISBN foo
21466 !! html
21467 <p>ISBN foo
21468 </p>
21469 !! end
21470
21471
21472 !! test
21473 ISBN length
21474 !! wikitext
21475 ISBN 123456789
21476
21477 ISBN 1234567890
21478
21479 ISBN 12345678901
21480 !! html/php
21481 <p>ISBN 123456789
21482 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21483 </p><p>ISBN 12345678901
21484 </p>
21485 !! html/parsoid
21486 <p>ISBN 123456789</p>
21487
21488 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21489
21490 <p>ISBN 12345678901</p>
21491 !! end
21492
21493
21494 !! test
21495 ISBN with trailing year (T9110)
21496 !! wikitext
21497 ISBN 1-234-56789-0 - 2006
21498
21499 ISBN 1 234 56789 0 - 2006
21500 !! html/php
21501 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21502 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21503 </p>
21504 !! html/parsoid
21505 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21506
21507 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21508 !! end
21509
21510
21511 !! test
21512 anchorencode
21513 !! config
21514 wgFragmentMode=[ 'html5', 'legacy' ]
21515 !! wikitext
21516 {{anchorencode:foo bar©#%n}}
21517 !! html/php
21518 <p>foo_bar©#%n
21519 </p>
21520 !! html/parsoid
21521 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:foo bar©#%n","function":"anchorencode"},"params":{},"i":0}}]}'>foo_bar©#%n</p>
21522 !! end
21523
21524 !! test
21525 anchorencode (legacy)
21526 !! config
21527 wgFragmentMode=[ 'legacy' ]
21528 !! wikitext
21529 {{anchorencode:foo bar©#%n}}
21530 !! html/php
21531 <p>foo_bar.C2.A9.23.25n
21532 </p>
21533 !! end
21534
21535 !! test
21536 anchorencode trims spaces
21537 !! config
21538 wgFragmentMode=[ 'html5', 'legacy' ]
21539 !! wikitext
21540 {{anchorencode: __pretty__please__}}
21541 !! html/php
21542 <p>pretty_please
21543 </p>
21544 !! html/parsoid
21545 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21546 !! end
21547
21548 !! test
21549 anchorencode deals with links
21550 !! config
21551 wgFragmentMode=[ 'html5', 'legacy' ]
21552 !! wikitext
21553 {{anchorencode: [[hello|world]] [[hi]]}}
21554 !! html/php
21555 <p>world_hi
21556 </p>
21557 !! html/parsoid
21558 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21559 !! end
21560
21561 !! test
21562 anchorencode deals with templates
21563 !! config
21564 wgFragmentMode=[ 'html5', 'legacy' ]
21565 !! wikitext
21566 {{anchorencode: {{Foo}} x}}
21567 !! html/php
21568 <p>FOO_x
21569 </p>
21570 !! html/parsoid
21571 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21572 !! end
21573
21574 !! test
21575 anchorencode encodes like the TOC generator: (T20431)
21576 !! config
21577 wgFragmentMode=[ 'html5', 'legacy' ]
21578 !! wikitext
21579 ===_ +:.3A%3A _ &&amp;]] x===
21580 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21581 __NOEDITSECTION__
21582 !! html/php
21583 <h3><span id=".2B:.3A.253A_.26.26.5D.5D_x"></span><span class="mw-headline" id="+:.3A%3A_&amp;&amp;]]_x">_ +:.3A%3A _ &amp;&amp;]] x</span></h3>
21584 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21585 </p>
21586 !! html/parsoid
21587 <h3 id="+:.3A%3A_&amp;&amp;]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x" typeof="mw:FallbackId"></span>_ +:.3A%3A _ &amp;<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;","dsr":[18,23,null,null]}'>&amp;</span>]] x</h3>
21588 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: _ +:.3A%3A _ &amp;&amp;amp;]] x","function":"anchorencode"},"params":{},"i":0}}]}'>+:.3A%3A_&amp;&amp;<span typeof="mw:Entity">]</span><span typeof="mw:Entity">]</span>_x</p>
21589 <meta property="mw:PageProp/noeditsection"/>
21590 !! end
21591
21592 !! test
21593 anchorencode encodes like the TOC generator: (T20431) (legacy)
21594 !! config
21595 wgFragmentMode=[ 'legacy' ]
21596 !! wikitext
21597 ===_ +:.3A%3A&&amp;]]===
21598 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21599 __NOEDITSECTION__
21600 !! html/php
21601 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21602 <p>.2B:.3A.253A.26.26.5D.5D
21603 </p>
21604 !! end
21605
21606 !! test
21607 T8200: blockquotes and paragraph formatting
21608 !! wikitext
21609 <blockquote>
21610 foo
21611 </blockquote>
21612
21613 bar
21614
21615 baz
21616 !! html
21617 <blockquote>
21618 <p>foo
21619 </p>
21620 </blockquote>
21621 <p>bar
21622 </p>
21623 <pre>baz
21624 </pre>
21625 !! end
21626
21627 !! test
21628 T10293: Use of center tag ruins paragraph formatting
21629 !! wikitext
21630 <center>
21631 foo
21632 </center>
21633
21634 bar
21635
21636 baz
21637 !! html
21638 <center>
21639 <p>foo
21640 </p>
21641 </center>
21642 <p>bar
21643 </p>
21644 <pre>baz
21645 </pre>
21646 !! end
21647
21648 !!test
21649 Parsing of overlapping (improperly nested) inline html tags
21650 !! wikitext
21651 <span><s>x</span></s>
21652 !! html/php
21653 <p><span><s>x&lt;/span&gt;</s></span>
21654 </p>
21655 !! html/parsoid
21656 <p><span><s>x</s></span>
21657 </p>
21658 !!end
21659
21660 ###
21661 ### Language variants related tests
21662 ###
21663
21664 # Parsoid does not mark self-links.
21665 # Parsoid does not convert links; PHP will do any necessary redirects.
21666
21667 !! test
21668 Self-link in language variants
21669 !! options
21670 title=[[Dunav]] language=sr
21671 !! wikitext
21672 Both [[Dunav]] and [[Дунав]] are names for this river.
21673 !! html/php
21674 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21675 </p>
21676 !! html/parsoid
21677 <p>Both <a rel="mw:WikiLink" href="./Dunav" title="Dunav">Dunav</a> and <a rel="mw:WikiLink" href="./Дунав" title="Дунав">Дунав</a> are names for this river.</p>
21678 !! end
21679
21680 !! article
21681 Дуна
21682 !! text
21683 content
21684 !! endarticle
21685
21686 !! test
21687 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21688 !! options
21689 title=[[Duna]] language=sr
21690 !! wikitext
21691 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21692 !! html/php
21693 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <a class="mw-selflink selflink">Duna</a> and <a class="mw-selflink selflink">Dуна</a> are still self-links.
21694 </p>
21695 !! html/parsoid
21696 <p><a rel="mw:WikiLink" href="./Дуна" title="Дуна">Дуна</a> is not a self-link while <a rel="mw:WikiLink" href="./Duna" title="Duna">Duna</a> and <a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> are still self-links.</p>
21697 !! end
21698
21699 !! test
21700 Link to a section of a variant of this title shouldn't be parsed as self-link
21701 !! options
21702 title=[[Duna]] language=sr
21703 !! wikitext
21704 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21705 !! html/php
21706 <p><a class="mw-selflink selflink">Dуна</a> 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.
21707 </p>
21708 !! html/parsoid
21709 <p><a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> is a self-link while <a rel="mw:WikiLink" href="./Dunа#Foo" title="Dunа">Dunа#Foo</a> and <a rel="mw:WikiLink" href="./Dуна#Foo" title="Dуна">Dуна#Foo</a> are not self-links.</p>
21710 !! end
21711
21712 !! test
21713 Link to pages in language variants
21714 !! options
21715 language=sr
21716 !! wikitext
21717 Main Page can be written as [[Маин Паге]]
21718 !! html/php
21719 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21720 </p>
21721 !! html/parsoid
21722 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21723 !! end
21724
21725
21726 !! test
21727 Multiple links to pages in language variants
21728 !! options
21729 language=sr
21730 !! wikitext
21731 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21732 !! html/php
21733 <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>.
21734 </p>
21735 !! html/parsoid
21736 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a> can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a> same as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a>.</p>
21737 !! end
21738
21739
21740 !! test
21741 Simple template in language variants
21742 !! options
21743 language=sr
21744 !! wikitext
21745 {{тест}}
21746 !! html/php
21747 <p>This is a test template
21748 </p>
21749 !! end
21750
21751
21752 !! test
21753 Template with explicit namespace in language variants
21754 !! options
21755 language=sr
21756 !! wikitext
21757 {{Template:тест}}
21758 !! html/php
21759 <p>This is a test template
21760 </p>
21761 !! end
21762
21763
21764 !! test
21765 Basic test for template parameter in language variants
21766 !! options
21767 language=sr
21768 !! wikitext
21769 {{парамтест|param=foo}}
21770 !! html/php
21771 <p>This is a test template with parameter foo
21772 </p>
21773 !! end
21774
21775 !! test
21776 Simple category in language variants
21777 !! options
21778 language=sr cat
21779 !! wikitext
21780 [[Category:МедиаWики Усер'с Гуиде]]
21781 !! html/php
21782 cat=МедиаWики_Усер'с_Гуиде sort=
21783 !! html/parsoid
21784 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21785 !! end
21786
21787 !! article
21788 Category:分类
21789 !! text
21790 blah
21791 !! endarticle
21792
21793 !! article
21794 Category:分類
21795 !! text
21796 blah
21797 !! endarticle
21798
21799 ## We used to, but no longer wt2wt this test since the default serializer
21800 ## will normalize all categories to serialize on their own line.
21801 ## This wikitext usage is going to be fairly uncommon in production and
21802 ## selser will take care of preserving formatting in those scenarios.
21803 !! test
21804 Don't convert blue categorylinks to another variant (T35210)
21805 !! options
21806 cat
21807 language=zh
21808 parsoid=wt2html
21809 !! wikitext
21810 [[A]][[Category:分类]]
21811 !! html/php
21812 cat=分类 sort=
21813 !! html/parsoid
21814 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21815 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21816 !! end
21817
21818 !! test
21819 Stripping -{}- tags (language variants)
21820 !! options
21821 language=sr
21822 !! wikitext
21823 Latin proverb: -{Ne nuntium necare}-
21824 !! html/php
21825 <p>Latin proverb: Ne nuntium necare
21826 </p>
21827 !! html/parsoid
21828 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21829 !! end
21830
21831
21832 !! test
21833 Prevent conversion with -{}- tags (language variants)
21834 !! options
21835 language=sr variant=sr-ec
21836 !! wikitext
21837 Latinski: -{Ne nuntium necare}-
21838 !! html/php
21839 <p>Латински: Ne nuntium necare
21840 </p>
21841 !! html/parsoid
21842 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21843 !! end
21844
21845
21846 !! test
21847 Prevent conversion of text with -{}- tags (language variants)
21848 !! options
21849 language=sr variant=sr-ec
21850 !! wikitext
21851 Latinski: -{Ne nuntium necare}-
21852 !! html/php
21853 <p>Латински: Ne nuntium necare
21854 </p>
21855 !! html/parsoid
21856 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21857 !! end
21858
21859
21860 !! test
21861 Prevent conversion of links with -{}- tags (language variants)
21862 !! options
21863 language=sr variant=sr-ec
21864 !! wikitext
21865 -{[[Main Page]]}-
21866 !! html/php
21867 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21868 </p>
21869 !! html/parsoid
21870 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[2,15,2,2]}&#39;>Main Page&lt;/a>"}}'></span></p>
21871 !! end
21872
21873
21874 !! test
21875 -{}- tags within headlines (within html for parserConvert())
21876 !! config
21877 wgFragmentMode=[ 'html5', 'legacy' ]
21878 !! options
21879 language=sr variant=sr-ec
21880 !! wikitext
21881 ==-{Naslov}-==
21882
21883 Note that even an unprotected headline ID is not affected by language
21884 conversion:
21885
21886 ==Latinski==
21887 !! html/php
21888 <h2><span id="-.7BNaslov.7D-"></span><span class="mw-headline" id="-{Naslov}-">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>
21889 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21890 цонверсион:
21891 </p>
21892 <h2><span class="mw-headline" id="Latinski">Латински</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="Уреди одељак „Латински“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
21893
21894 !! html/parsoid
21895 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21896
21897 <p>Note that even an unprotected headline ID is not affected by language
21898 conversion:</p>
21899
21900 <h2 id="Latinski">Latinski</h2>
21901 !! end
21902
21903 !! test
21904 Explicit definition of language variant alternatives
21905 !! options
21906 language=zh variant=zh-tw
21907 !! wikitext
21908 -{zh:China;zh-tw:Taiwan}-, not China
21909 !! html/php
21910 <p>Taiwan, not China
21911 </p>
21912 !! html/parsoid
21913 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, not China</p>
21914 !! end
21915
21916 !! test
21917 Filter syntax for language variants
21918 !! options
21919 language=zh variant=zh-tw
21920 !! wikitext
21921 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21922 !! html/php
21923 <p>fooblog, WEBJOURNAL, WEBLOGquux
21924 </p>
21925 !! html/parsoid
21926 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21927 !! end
21928
21929 # Note that Parsoid post-processing for language variants needs to
21930 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21931 !! test
21932 Conversion around HTML tags
21933 !! options
21934 language=sr variant=sr-ec
21935 !! wikitext
21936 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21937 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21938 !! html/php
21939 <p>
21940 <span title="ЛаCтин">ски</span>
21941 </p>
21942 !! html/parsoid
21943 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"span","l":"sr-ec","t":"script"},{"f":"title","l":"sr-ec","t":"src"}]}'/>
21944 <span title="Latin" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"La&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"sr-el\",\"t\":\"L\"},{\"l\":\"sr-ec\",\"t\":\"C\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[57,76,null,2]}&#39;>&lt;/span>tin"}]]}'>ski</span></p>
21945 !! end
21946
21947 !! test
21948 Explicit session-wise two-way language variant mapping (A flag and - flag)
21949 !! options
21950 language=zh variant=zh-tw
21951 !! wikitext
21952 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21953
21954 Taiwan is not China.
21955
21956 But -{A|zh:China; zh-tw:Taiwan}- is China,
21957
21958 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21959
21960 and -{China}- is China.
21961 !! html/php
21962 <p>This is Taiwan, but we'll forget that now.
21963 </p><p>Taiwan is not China.
21964 </p><p>But Taiwan is Taiwan,
21965 </p><p>(This should be stripped!)
21966 </p><p>and China is China.
21967 </p>
21968 !! html/parsoid
21969 <p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p>
21970 <p>Taiwan is not China.</p>
21971 <p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span> is China,</p>
21972 <p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"remove":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
21973 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21974 !! end
21975
21976 !! test
21977 Explicit session-wise one-way language variant mapping (A flag and - flag)
21978 !! options
21979 language=zh variant=zh-tw
21980 !! wikitext
21981 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21982
21983 COUNTRY is China or Taiwan.
21984
21985 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21986
21987 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21988
21989 and -{COUNTRY}- is COUNTRY.
21990 !! html/php
21991 <p>This is Taiwan, but we'll forget that now.
21992 </p><p>COUNTRY is China or Taiwan.
21993 </p><p>But Taiwan is Taiwan,
21994 </p><p>(This should be stripped!)
21995 </p><p>and COUNTRY is COUNTRY.
21996 </p>
21997 !! html/parsoid
21998 <p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p>
21999 <p>COUNTRY is China or Taiwan.</p>
22000 <p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span> is COUNTRY,</p>
22001 <p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}],"remove":true}'/> should be stripped!)</p>
22002 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22003 !! end
22004
22005 !! test
22006 Explicit session-wise two-way language variant mapping (H flag for hide)
22007 !! options
22008 language=zh variant=zh-tw
22009 !! wikitext
22010 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22011
22012 Taiwan is China.
22013 !! html/php
22014 <p>(This should be stripped!)
22015 </p><p>Taiwan is Taiwan.
22016 </p>
22017 !! html/parsoid
22018 <p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
22019 <p>Taiwan is China.</p>
22020 !! end
22021
22022 !! test
22023 Explicit session-wise one-way language variant mapping (H flag for hide)
22024 !! options
22025 language=zh variant=zh-tw
22026 !! wikitext
22027 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22028
22029 COUNTRY is Taiwan or China.
22030 !! html/php
22031 <p>(This should be stripped!)
22032 </p><p>Taiwan is Taiwan or China.
22033 </p>
22034 !! html/parsoid
22035 <p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
22036 <p>COUNTRY is Taiwan or China.</p>
22037 !! end
22038
22039 ## Note that parsoid test runner does not support 'showtitle' option.
22040 !! test
22041 Adding explicit conversion rule for title (T flag)
22042 !! options
22043 language=zh variant=zh-tw showtitle
22044 !! wikitext
22045 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22046
22047 Taiwan is China.
22048 !! html/php
22049 Taiwan
22050 <p>Should be stripped!
22051 </p><p>Taiwan is China.
22052 </p>
22053 !! html/parsoid
22054 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22055 <p>Taiwan is China.</p>
22056 !! end
22057
22058 !! test
22059 Code coverage: T combined with H flag
22060 !! options
22061 language=zh variant=zh-tw showtitle
22062 !! wikitext
22063 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22064
22065 Taiwan is China.
22066 !! html/php
22067 Taiwan
22068 <p>Should be stripped!
22069 </p><p>Taiwan is Taiwan.
22070 </p>
22071 !! html/parsoid
22072 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22073 <p>Taiwan is China.</p>
22074 !! end
22075
22076 !! test
22077 Code coverage: T with no variants
22078 !! options
22079 language=zh variant=zh-tw showtitle
22080 !! wikitext
22081 -{H|zh:China; zh-tw:Taiwan}-
22082 Taiwan is China.-{T|Taiwan is China}-
22083 !! html/php
22084 Taiwan is China
22085 <p>
22086 Taiwan is Taiwan.
22087 </p>
22088 !! html/parsoid
22089 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22090 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22091 !! end
22092
22093 !! test
22094 Code coverage: rules with no variants
22095 !! options
22096 language=zh variant=zh-tw
22097 !! wikitext
22098 -{H|zh:China; zh-tw:Taiwan}-
22099 Taiwan is China.
22100 -{H|China}-
22101 Taiwan is China.
22102 !! html/php
22103 <p>
22104 Taiwan is Taiwan.
22105
22106 Taiwan is China.
22107 </p>
22108 !! html/parsoid
22109 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22110 Taiwan is China.
22111 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22112 Taiwan is China.</p>
22113 !! end
22114
22115
22116 !! test
22117 Code coverage: D flag for conversion rule
22118 !! options
22119 language=zh variant=zh-tw
22120 !! wikitext
22121 -{D|zh-cn:XA; zh-tw:YA}-
22122 -{A;D|zh-cn:XB; zh-tw:YB}-
22123 -{D;H|zh-cn:XC; zh-tw:YC}-
22124
22125 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22126
22127 -{D|0=>zh-tw:1}-
22128 -{A;D|2=>zh-tw:3}-
22129 -{D;H|4=>zh-tw:5}-
22130
22131 XA XB XC YA YB YC FOO BAR BAT 012345
22132 !! html/php
22133 <p>大陆:XA;台灣:YA;
22134
22135 大陆:XC;台灣:YC;
22136 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22137 </p><p>0⇒台灣:1;
22138
22139 4⇒台灣:5;
22140 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22141 </p>
22142 !! html/parsoid
22143 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22144 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22145 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22146 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"FOO","l":"zh-tw","t":"BAR"},{"f":"FOO","l":"zh-cn","t":"BAT"}]}'></span></p>
22147 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22148 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22149 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22150 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22151 !! end
22152
22153 !! test
22154 Code coverage: N flag for conversion rule
22155 !! options
22156 language=zh variant=zh-cn
22157 !! wikitext
22158 -{N|zh-cn}-
22159
22160 -{N|zh-tw}-
22161
22162 -{N|sr-ec}-
22163 !! html/php
22164 <p>大陆
22165 </p><p>台灣
22166 </p><p>српски (ћирилица)‎
22167 </p>
22168 !! html/parsoid
22169 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22170 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22171 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22172 !! end
22173
22174 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22175 !! test
22176 Code coverage: N flag for conversion rule (wt2html only)
22177 !! options
22178 language=zh variant=zh-cn
22179 parsoid=wt2html,html2html
22180 !! wikitext
22181 -{D;N|en}-
22182 !! html/php
22183 <p>English
22184 </p>
22185 !! html/parsoid
22186 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22187 !! end
22188
22189 !! test
22190 Testing that changing the language variant here in the tests actually works
22191 !! options
22192 language=zh variant=zh showtitle
22193 !! wikitext
22194 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22195 !! html/php
22196 China
22197 <p>Should be stripped!
22198 </p>
22199 !! html/parsoid
22200 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22201 !! end
22202
22203 !! test
22204 Recursive conversion of alt and title attrs shouldn't clear converter state
22205 !! options
22206 language=zh variant=zh-cn
22207 showtitle
22208 !! wikitext
22209 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22210 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22211 !! html/php
22212 China
22213 <p>
22214 Should be stripped<span title="Exclamation">!</span>
22215 </p>
22216 !! html/parsoid
22217 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22218 Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/><span title="exclamation">!</span></p>
22219 !! end
22220
22221 !! test
22222 T26072: more test on conversion rule for title
22223 !! options
22224 language=zh variant=zh-tw showtitle
22225 !! wikitext
22226 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22227
22228 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22229 !! html/php
22230 Taiwan
22231 <p>This should be stripped!
22232 </p><p>This won't take interferes with the title rule.
22233 </p>
22234 !! html/parsoid
22235 <p>This should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22236 <p>This won't take interferes with the title rule<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"Beijing"},{"l":"zh-tw","t":"Taipei"}]}'/>.</p>
22237 !! end
22238
22239 !! test
22240 Partly disable title conversion if variant == main language code
22241 !! options
22242 language=zh variant=zh title=[[ZH]] showtitle
22243 !! wikitext
22244 -{T|zh-cn:CN;zh-tw:TW}-
22245 !! html/php
22246 ZH
22247 <p>
22248 </p>
22249 !! html/parsoid
22250 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"CN"},{"l":"zh-tw","t":"TW"}]}'/></p>
22251 !! end
22252
22253 !! test
22254 Partly disable title conversion if variant == main language code, more
22255 !! options
22256 language=zh variant=zh title=[[ZH]] showtitle
22257 !! wikitext
22258 -{T|TW}-
22259 !! html/php
22260 ZH
22261 <p>
22262 </p>
22263 !! html/parsoid
22264 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22265 !! end
22266
22267 !! test
22268 Raw output of variant escape tags (R flag)
22269 !! options
22270 language=zh variant=zh-tw
22271 !! wikitext
22272 Raw: -{R|zh:China;zh-tw:Taiwan}-
22273 !! html/php
22274 <p>Raw: zh:China;zh-tw:Taiwan
22275 </p>
22276 !! html/parsoid
22277 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22278 !! end
22279
22280 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22281 !! test
22282 Raw output of variant escape tags (R flag) (wt2html only)
22283 !! options
22284 language=zh variant=zh-tw
22285 parsoid=wt2html,html2html
22286 !! wikitext
22287 -{Variant}- -{D|syntax}- -{D;R|options}-
22288 !! html/php
22289 <p>Variant syntax options
22290 </p>
22291 !! html/parsoid
22292 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Variant"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"syntax"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"options"}}'></span></p>
22293 !! end
22294
22295 !! test
22296 Nested markup inside raw output of variant escape tags (R flag)
22297 !! options
22298 language=zh variant=zh-tw
22299 !! wikitext
22300 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22301 !! html/php
22302 <p>Nested raw: nested Taiwan nested
22303 </p>
22304 !! html/parsoid
22305 <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh\",\"t\":\"China\"},{\"l\":\"zh-tw\",\"t\":\"Taiwan\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[23,48,null,2]}&#39;>&lt;/span> nested"}}'></span></p>
22306 !! end
22307
22308 !! test
22309 Nested markup and spaces inside raw output of variant escape tags (R flag)
22310 !! options
22311 language=zh variant=zh-tw
22312 !! wikitext
22313 X-{ outer -{ inner }- outer }-X
22314 !! html/php
22315 <p>X outer inner outer X
22316 </p>
22317 !! html/parsoid
22318 <p>X<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":" outer &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\" inner \"}}&#39; data-parsoid=&#39;{\"fl\":[],\"dsr\":[10,21,null,2]}&#39;>&lt;/span> outer "}}'></span>X</p>
22319 !! end
22320
22321 !! test
22322 Templates inside raw output of variant escape tags (R flag)
22323 !! options
22324 language=zh variant=zh-tw
22325 !! wikitext
22326 Nested raw: -{R|nested {{echo|hi}} templates}-
22327 !! html/php
22328 <p>Nested raw: nested hi templates
22329 </p>
22330 !! html/parsoid
22331 <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested &lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[23,34,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span> templates"}}'></span></p>
22332 !! end
22333
22334 !! test
22335 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22336 !! options
22337 language=zh variant=zh-cn
22338 !! wikitext
22339 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22340 !! html/php
22341 <p>0
22342 </p>
22343 !! html/parsoid
22344 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[12]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"0"},{"l":"zh-sg","t":"1"},{"l":"zh-tw","t":"2"},{"l":"zh-hk","t":"3"}]}'></span></p>
22345 !! end
22346
22347 !! test
22348 Conversion rules from [numeric-only string] to [something else] (T48634)
22349 !! options
22350 language=zh variant=zh-cn
22351 !! wikitext
22352 -{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
22353 !! html/php
22354 <p>D12345EE12345
22355 </p>
22356 !! html/parsoid
22357 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"B"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"C"},{"f":"0","l":"zh-cn","t":"D"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-hans","t":"A"}]}'/>012345<span typeof="mw:LanguageVariant" data-parsoid='{"fl":["A"],"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"0"},{"l":"zh-cn","t":"E"}]}'></span>012345</p>
22358 !! end
22359
22360 !! test
22361 Two-way converter rule entries with an empty value should be ignored (T53551)
22362 !! options
22363 language=zh variant=zh-cn
22364 !! wikitext
22365 -{H|zh-cn:foo;zh-tw:;}-foobar
22366 !! html/php
22367 <p>foobar
22368 </p>
22369 !! html/parsoid
22370 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"foo"},{"l":"zh-tw","t":""}]}'/>foobar</p>
22371 !! end
22372
22373 !! test
22374 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22375 !! options
22376 language=zh variant=zh-cn
22377 !! wikitext
22378 -{H|=>zh-cn:foo;}-foobar
22379 !! html/php
22380 <p>foobar
22381 </p>
22382 !! html/parsoid
22383 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22384 !! end
22385
22386 !! test
22387 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22388 !! options
22389 language=zh variant=zh-cn
22390 !! wikitext
22391 -{H|}-foobar
22392 !! html/php
22393 <p>foobar
22394 </p>
22395 !! html/parsoid
22396 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22397 !! end
22398
22399 !! test
22400 Nested using of manual convert syntax
22401 !! options
22402 language=zh variant=zh-hk
22403 !! wikitext
22404 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22405 !! html/php
22406 <p>Nested: Hello Hong Kong!
22407 </p>
22408 !! html/parsoid
22409 <p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}&apos;>&lt;/span>"},{"l":"zh-hant","t":"Hello &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&amp;apos;>&amp;lt;/span> K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&amp;apos;>&amp;lt;/span>ong\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&apos;>&lt;/span>"}]}'></span>!</p>
22410 !! end
22411
22412 !! test
22413 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22414 !! options
22415 language=zh variant=zh-cn
22416 !! wikitext
22417 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22418 !! html/php
22419 <p><span title="X">A</span>
22420 </p>
22421 !! html/parsoid
22422 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[21,49,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[34,39,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22423 !! end
22424
22425 !! test
22426 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22427 !! options
22428 language=zh variant=zh-cn
22429 !! wikitext
22430 -{<span title="-{X}-">A</span>}-
22431 !! html/php+disabled
22432 <p><span title="X">A</span>
22433 </p>
22434 !! html/parsoid
22435 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[2,30,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[15,20,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22436 !! end
22437
22438 # Parsoid and PHP disagree on how to parse this example: Parsoid
22439 # insists that the content of a language converter element be a valid
22440 # DOM fragment or attribute string
22441 !! test
22442 Language converter markup with block content
22443 !! options
22444 language=zh variant=zh-cn
22445 !! wikitext
22446 <span>a-{b<div>c}-d
22447
22448 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22449
22450 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22451 !! html/php+tidy
22452 <span>ab<div>cd
22453 <span>ab<div>cd
22454 <span>ad
22455 </span></div></span></div></span>
22456 !! html/parsoid
22457 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
22458
22459 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
22460
22461 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"x&lt;span data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&#39;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&#39;>c&lt;/div>"}]}'/>d</span></p>
22462 !! end
22463
22464 !! test
22465 LanguageConverter selser (1)
22466 !! options
22467 language=zh variant=zh-cn
22468 parsoid={
22469 "modes": ["wt2wt", "selser"],
22470 "changes": [
22471 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22472 ]
22473 }
22474 !! wikitext
22475 -{raw}-
22476 !! wikitext/edited
22477 -{edited}-
22478 !! end
22479
22480 !! test
22481 LanguageConverter selser (2)
22482 !! options
22483 language=zh variant=zh-cn
22484 parsoid={
22485 "modes": ["wt2wt", "selser"],
22486 "changes": [
22487 ["span[class='x']", "contents", "text", "-{foo}-"],
22488 ["a", "contents", "text", "-{"],
22489 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22490 ]
22491 }
22492 !! wikitext
22493 <span class="x">TEXT1</span>
22494 [http://example.com TEXT2]
22495 [[Foo|TEXT3]]
22496 {{echo|TEXT4}}
22497 !! wikitext/edited
22498 <span class="x"><nowiki>-{foo}-</nowiki></span>
22499 [http://example.com -{]
22500 [[Foo|<nowiki>-{</nowiki>]]
22501 {{1x|<nowiki>-{</nowiki>}}
22502 !! end
22503
22504 # Tests LanguageVariantText in ConstrainedText
22505 !! test
22506 LanguageConverter selser (3)
22507 !! options
22508 language=zh variant=zh-cn
22509 parsoid={
22510 "modes": ["wt2wt", "selser"],
22511 "changes": [
22512 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22513 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22514 ]
22515 }
22516 !! wikitext
22517 {|
22518 |-
22519 |<span>Foo</span>
22520 |}
22521 !! wikitext/edited
22522 {|
22523 |-
22524 |<nowiki/>-{edited}-
22525 |}
22526 !! end
22527
22528 # Tests LanguageVariantText._fromSelSer
22529 !! test
22530 LanguageConverter selser (4)
22531 !! options
22532 language=zh variant=zh-cn
22533 parsoid={
22534 "modes": ["wt2wt", "selser"],
22535 "changes": [
22536 ["td > span.x", "remove"]
22537 ]
22538 }
22539 !! wikitext
22540 {|
22541 |-
22542 |<span class="x">Foo</span>-{Bar}-
22543 ||<span class="x">Foo</span>-{Bar}-
22544 |}
22545 !! wikitext/edited
22546 {|
22547 |-
22548 |<nowiki/>-{Bar}-
22549 ||-{Bar}-
22550 |}
22551 !! end
22552
22553 # Since Parsoid is starting to emit canonical wikitext for links,
22554 # [http://example.com http://example.com] will not RT back to that
22555 # form anymore.
22556 # Parsoid does not language-convert links (it is done in a
22557 # post-processing step)
22558 !! test
22559 Proper conversion of text in external links
22560 !! options
22561 language=sr variant=sr-ec
22562 parsoid=wt2html
22563 !! wikitext
22564 http://www.google.com
22565 gopher://www.google.com
22566 [http://www.google.com http://www.google.com]
22567 [gopher://www.google.com gopher://www.google.com]
22568 [https://www.google.com irc://www.google.com]
22569 [ftp://www.google.com www.google.com/ftp://dir]
22570 [//www.google.com www.google.com]
22571 !! html/php
22572 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22573 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22574 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22575 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22576 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22577 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22578 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22579 </p>
22580 !! html/parsoid
22581 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22582 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22583 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22584 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22585 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22586 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22587 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22588 !! end
22589
22590 !! test
22591 Do not convert roman numbers to language variants
22592 !! options
22593 language=sr variant=sr-ec
22594 !! wikitext
22595 Fridrih IV je car.
22596 !! html/php
22597 <p>Фридрих IV је цар.
22598 </p>
22599 !! html/parsoid
22600 <p>Fridrih IV je car.</p>
22601 !! end
22602
22603 !! test
22604 Unclosed language converter markup "-{"
22605 !! options
22606 language=sr
22607 !! wikitext
22608 -{T|hello
22609 !! html
22610 <p>-{T|hello
22611 </p>
22612 !! end
22613
22614 !! test
22615 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22616 !! options
22617 language=sr
22618 !! wikitext
22619 -{R|=&gt;}-
22620 !! html/php
22621 <p>=&gt;
22622 </p>
22623 !! html/parsoid
22624 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"=&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;gt;\",\"srcContent\":\">\",\"dsr\":[5,9,null,null]}&#39;>>&lt;/span>"}}'></span></p>
22625 !!end
22626
22627 !! test
22628 Don't break link parsing if language converter markup is in the caption.
22629 !! options
22630 language=sr variant=sr-ec
22631 !! wikitext
22632 [[Main Page|-{R|main page}-]]
22633 !! html/php
22634 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22635 </p>
22636 !! html/parsoid
22637 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"main page"}}' data-parsoid='{"fl":["R"]}'></span></a></p>
22638 !! end
22639
22640 !! test
22641 T146304: Don't break template parsing if language converter markup is in the parameter.
22642 !! options
22643 language=sr variant=sr-ec
22644 !! wikitext
22645 {{echo|-{R|foo}-}}
22646 !! html/php
22647 <p>foo
22648 </p>
22649 !! html/parsoid
22650 <p><span typeof="mw:Transclusion mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo"}}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Шаблон:Echo"},"params":{"1":{"wt":"-{R|foo}-"}},"i":0}}]}'></span></p>
22651 !! end
22652
22653 !! test
22654 T146305: Don't break image parsing if language converter markup is in the caption.
22655 !! options
22656 language=sr
22657 !! wikitext
22658 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22659 !! html/php
22660 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0: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/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећај"></a></div>caption:</div></div></div>
22661
22662 !! html/parsoid
22663 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"}]}'><a href="./Датотека:Foobar.jpg"><img resource="./Датотека: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><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"caption:"}}' data-parsoid='{"fl":["R"]}'></span></figcaption></figure>
22664 !! end
22665
22666 !! test
22667 T146305: Don't break image parsing if nested language converter markup is in the caption.
22668 !! options
22669 language=zh variant=zh-cn
22670 !! wikitext
22671 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22672 !! html/php
22673 <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="放大"></a></div>blog (hk: WEBJOURNAL, tw: WEBLOG)</div></div></div>
22674
22675 !! html/parsoid
22676 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"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><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"blog (hk: &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBJOURNAL\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[43,65,null,2]}&#39;>&lt;/span>, tw: &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBLOG\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[71,89,null,2]}&#39;>&lt;/span>)"}]}'></span></figcaption></figure>
22677 !! end
22678
22679 # XXX html2wt disabled because rich markup in alt is not preserved.
22680 !! test
22681 Don't break gallery if language converter markup is inside.
22682 !! options
22683 language=zh
22684 !! wikitext
22685 <gallery>
22686 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22687 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22688 </gallery>
22689 !! html/php
22690 <ul class="gallery mw-gallery-traditional">
22691 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22692 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="bat" 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>
22693 <div class="gallerytext">
22694 <p><a href="/wiki/File:Foobar.jpg" class="image" title="bar"><img alt="foo" 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>
22695 </p>
22696 </div>
22697 </div></li>
22698 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22699 <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>
22700 <div class="gallerytext">
22701 <p>This is a test template
22702 </p>
22703 </div>
22704 </div></li>
22705 </ul>
22706
22707 !! html/parsoid
22708 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-\nFile:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt\n"}}'>
22709 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\"bar\"}}&#39; data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[68,77,null,2]}&#39;>&lt;/span>"}'><a href="./File:Foobar.jpg"><img alt="" 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></figure-inline></div></li>
22710 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"-{R|param}-"}},"i":0}}]}'>This is a test template</span></div></li>
22711 </ul>
22712 !! end
22713
22714 !! test
22715 T153135: Don't break list handling if language converter markup is in the item.
22716 !! options
22717 language=zh variant=zh-cn
22718 !! wikitext
22719 ;-{zh-cn:AAA;zh-tw:BBB}-
22720 ;-{R|foo:bar}-
22721 !! html/php
22722 <dl><dt>AAA</dt>
22723 <dt>foo:bar</dt></dl>
22724
22725 !! html/parsoid
22726 <dl><dt data-parsoid='{"dsr":[0,24,1,0]}'><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}]}'></span></dt>
22727 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22728 </dl>
22729 !! end
22730
22731 // Note that parsoid does not protect colons unless language converter
22732 // markup is properly nested, because it is a backtracking parser.
22733 !! test
22734 T153135: Unclosed markup in definition list (code coverage)
22735 !! options
22736 language=zh variant=zh-cn
22737 !! wikitext
22738 ;<b>foo:bar
22739 ;-{zh-cn:AAA
22740 !! html/php+tidy
22741 <dl><dt><b>foo:bar</b></dt><b>
22742 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22743 </b></p>
22744 !! html/parsoid
22745 <dl><dt data-parsoid='{"dsr":[0,11,1,0]}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
22746 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22747 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22748 </b></dl>
22749 !! end
22750
22751 !! test
22752 T153135: Nested language converter markup in definition list (code coverage)
22753 !! options
22754 language=zh variant=zh-cn
22755 !! wikitext
22756 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22757 !! html/php
22758 <dl><dt>AAA foo:bar bat:baz</dt>
22759 <dd>def</dd></dl>
22760
22761 !! html/parsoid
22762 <dl><dt data-parsoid='{"dsr":[0,49,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"foo:bar\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[14,33,null,2]}&#39;>&lt;/span> &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\"bat:baz\"}}&#39; data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[34,47,null,2]}&#39;>&lt;/span>"}]}'></span></dt>
22763 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22764 </dl>
22765 !! end
22766
22767 # html2wt mode disabled due to <nowiki> insertion.
22768 !! test
22769 T153140: Don't break table handling if language converter markup is in the cell.
22770 !! options
22771 language=sr variant=sr-ec
22772 parsoid=wt2html,wt2wt,html2html
22773 !! wikitext
22774 {|
22775 |-
22776 | -{R|B}-
22777 |}
22778 !! html/php
22779 <table>
22780
22781 <tr>
22782 <td>B
22783 </td></tr></table>
22784
22785 !! html/parsoid
22786 <table>
22787 <tbody>
22788 <tr>
22789 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22790 </tr>
22791 </tbody>
22792 </table>
22793 !! end
22794
22795 !! test
22796 Language converter tricky html2wt cases (1)
22797 !! options
22798 language=sr
22799 parsoid=html2wt,wt2wt
22800 !! html/parsoid
22801 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22802 !! wikitext
22803 -{<nowiki>}-</nowiki>}-
22804 !! html/php
22805 <p>&#125;-
22806 </p>
22807 !! end
22808
22809 !! test
22810 Language converter tricky html2wt cases (2)
22811 !! options
22812 language=sr
22813 parsoid=html2wt,wt2wt
22814 !! html/parsoid
22815 <p>-{foo}-</p>
22816 !! wikitext
22817 <nowiki>-{foo}-</nowiki>
22818 !! html/php
22819 <p>-&#123;foo&#125;-
22820 </p>
22821 !! end
22822
22823 !! test
22824 Language converter tricky html2wt cases (3)
22825 !! options
22826 language=sr
22827 parsoid=html2wt,wt2wt
22828 !! html/parsoid
22829 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22830 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22831 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22832 !! wikitext
22833 -{R||}-
22834
22835 -{R|R|raw}-
22836
22837 -{<nowiki>-{foo}-</nowiki>}-
22838 !! html/php
22839 <p>|
22840 </p><p>R|raw
22841 </p><p>-&#123;foo&#125;-
22842 </p>
22843 !! end
22844
22845 !! test
22846 Language converter tricky html2wt cases (4)
22847 !! options
22848 language=sr
22849 parsoid=html2wt,wt2wt
22850 !! html/parsoid
22851 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hey\"}},\"i\":0}}]}&#39;>hey&lt;/span>"}}'></span></p>
22852 !! wikitext
22853 -{R|{{echo|hey}}}-
22854 !! html/php
22855 <p>hey
22856 </p>
22857 !! end
22858
22859 # Note that the <nowiki> escaping added by parsoid for source text,
22860 # destination text, and language names only works on the PHP side
22861 # for *destination text*. (HTML entity escaping wouldn't work
22862 # any better.) This is probably a bug, at least for source texts.
22863 # (For language names PHP uses a precise regexp based on the languages
22864 # it currently knows have variants, which is fragile since this set
22865 # can grow/shrink over time.)
22866 !! test
22867 Language converter tricky html2wt cases (5)
22868 !! options
22869 language=zh variant=zh-cn
22870 !! html/parsoid
22871 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"a:b=>c","l":"zh-cn","t":"x;foo=>zh-cn:boo"},{"f":"bar","l":"zh-cn","t":"bat;xyz=>zh-cn:abc"}]}'/>foobar</p>
22872 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22873 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"xyz"},{"l":"zh-cn","t":"0;zh-tw:bar"}]}'></span></p>
22874 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22875 <p>a:b=>c xyz</p>
22876 !! wikitext
22877 -{H|<nowiki>a:b=>c</nowiki>=>zh-cn:<nowiki>x;foo=>zh-cn:boo</nowiki>;bar=>zh-cn:<nowiki>bat;xyz=>zh-cn:abc</nowiki>}-foobar
22878
22879 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22880
22881 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22882
22883 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22884
22885 a:b=>c xyz
22886 !! html/php+disabled
22887 <p>foobat;xyz=&gt;zh-cn:abc
22888 </p><p>A
22889 </p><p>0;zh-tw:bar
22890 </p><p>abc
22891 </p><p>a:b=&gt;c 0;zh-tw:bar
22892 </p>
22893 !! end
22894
22895 !! test
22896 T179579: Nowiki and lc interaction
22897 !! options
22898 parsoid=wt2html
22899 language=sr
22900 !! wikitext
22901 -{</nowiki>123}-
22902
22903 -{123<nowiki>|</nowiki>456}-
22904 !! html/parsoid
22905 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22906
22907 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"123&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[23,41,8,9]}&#39;>|&lt;/span>456"}}' data-parsoid='{"fl":[],"src":"-{123&lt;nowiki>|&lt;/nowiki>456}-"}'></span></p>
22908 !! end
22909
22910 !! test
22911 T2529: Uncovered bullet
22912 !! wikitext
22913 *Foo {{bullet}}
22914 !! html
22915 <ul><li>Foo</li>
22916 <li>Bar</li></ul>
22917
22918 !! end
22919
22920 !! test
22921 T2529: Uncovered bullet in a deeply nested list
22922 !! wikitext
22923 *******Foo {{bullet}}
22924 !! html
22925 <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>
22926 <li>Bar</li></ul>
22927
22928 !! end
22929
22930 !! test
22931 T2529: Uncovered table already at line-start
22932 !! wikitext
22933 x
22934
22935 {{table}}
22936 y
22937 !! html
22938 <p>x
22939 </p>
22940 <table>
22941 <tr>
22942 <td>1</td>
22943 <td>2
22944 </td></tr>
22945 <tr>
22946 <td>3</td>
22947 <td>4
22948 </td></tr></table>
22949 <p>y
22950 </p>
22951 !! end
22952
22953 !! test
22954 T2529: Uncovered bullet in parser function result
22955 !! wikitext
22956 *Foo {{lc:{{bullet}} }}
22957 !! html
22958 <ul><li>Foo</li>
22959 <li>bar</li></ul>
22960
22961 !! end
22962
22963 !! test
22964 T7678: Double-parsed template argument
22965 !! wikitext
22966 {{lc:{{{1}}}|hello}}
22967 !! html
22968 <p>{{{1}}}
22969 </p>
22970 !! end
22971
22972 !! test
22973 T7678: Double-parsed template invocation
22974 !! wikitext
22975 {{lc:{{paramtest {{!}} param = hello }} }}
22976 !! html
22977 <p>{{paramtest | param = hello }}
22978 </p>
22979 !! end
22980
22981 !! test
22982 Case insensitivity of parser functions for non-ASCII characters (T10143)
22983 !! options
22984 language=cs
22985 title=[[Main Page]]
22986 !! wikitext
22987 {{PRVNÍVELKÉ:ěščř}}
22988 {{prvnívelké:ěščř}}
22989 {{PRVNÍMALÉ:ěščř}}
22990 {{prvnímalé:ěščř}}
22991 {{MALÁ:ěščř}}
22992 {{malá:ěščř}}
22993 {{VELKÁ:ěščř}}
22994 {{velká:ěščř}}
22995 !! html
22996 <p>Ěščř
22997 Ěščř
22998 ěščř
22999 ěščř
23000 ěščř
23001 ěščř
23002 ĚŠČŘ
23003 ĚŠČŘ
23004 </p>
23005 !! end
23006
23007 !! test
23008 Morwen/13: Unclosed link followed by heading
23009 !! wikitext
23010 [[link
23011 ==heading==
23012 !! html
23013 <p>[[link
23014 </p>
23015 <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>
23016
23017 !! end
23018
23019 !! test
23020 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23021 !! wikitext
23022 {{foo|
23023 =heading=
23024 !! html
23025 <p>{{foo|
23026 </p>
23027 <h1><span class="mw-headline" id="heading">heading</span></h1>
23028
23029 !! end
23030
23031 !! test
23032 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23033 !! wikitext
23034 {{foo|
23035 ==heading==
23036 !! html
23037 <p>{{foo|
23038 </p>
23039 <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>
23040
23041 !! end
23042
23043 !! test
23044 Tildes in comments
23045 !! options
23046 pst
23047 !! wikitext
23048 <!-- ~~~~ -->
23049 !! html/php
23050 <!-- ~~~~ -->
23051 !! end
23052
23053 !! test
23054 Paragraphs inside divs (no extra line breaks)
23055 !! wikitext
23056 <div>Line one
23057
23058 Line two</div>
23059 !! html
23060 <div>Line one
23061 Line two</div>
23062
23063 !! end
23064
23065 !! test
23066 Paragraphs inside divs (extra line break on open)
23067 !! wikitext
23068 <div>
23069 Line one
23070
23071 Line two</div>
23072 !! html
23073 <div>
23074 <p>Line one
23075 </p>
23076 Line two</div>
23077
23078 !! end
23079
23080 !! test
23081 Paragraphs inside divs (extra line break on close)
23082 !! wikitext
23083 <div>Line one
23084
23085 Line two
23086 </div>
23087 !! html
23088 <div>Line one
23089 <p>Line two
23090 </p>
23091 </div>
23092
23093 !! end
23094
23095 !! test
23096 Paragraphs inside divs (extra line break on open and close)
23097 !! wikitext
23098 <div>
23099 Line one
23100
23101 Line two
23102 </div>
23103 !! html
23104 <div>
23105 <p>Line one
23106 </p><p>Line two
23107 </p>
23108 </div>
23109
23110 !! end
23111
23112 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23113 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23114 !! test
23115 Nesting tags, paragraphs on lines which begin with <div>
23116 !! wikitext
23117 <div></div><strong>A
23118 B</strong>
23119 !! html/php+tidy
23120 <div></div><p><strong>A
23121 </strong></p><strong></strong><p><strong>B</strong>
23122 </p>
23123 !! html/parsoid
23124 <div></div>
23125 <p><strong>A
23126 B</strong>
23127 </p>
23128 !! end
23129
23130 # T8200: <blockquote> should behave like <div> with respect to line breaks
23131 !! test
23132 T8200: paragraphs inside blockquotes (no extra line breaks)
23133 !! wikitext
23134 <blockquote>Line one
23135
23136 Line two</blockquote>
23137 !! html
23138 <blockquote>Line one
23139 Line two</blockquote>
23140
23141 !! html+tidy
23142 <blockquote><p>Line one
23143 Line two</p></blockquote>
23144 !! end
23145
23146 !! test
23147 T8200: paragraphs inside blockquotes (extra line break on open)
23148 !! wikitext
23149 <blockquote>
23150 Line one
23151
23152 Line two</blockquote>
23153 !! html
23154 <blockquote>
23155 <p>Line one
23156 </p>
23157 Line two</blockquote>
23158
23159 !! html+tidy
23160 <blockquote>
23161 <p>Line one
23162 </p><p>
23163 Line two</p></blockquote>
23164 !! end
23165
23166 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23167 !! test
23168 T8200: paragraphs inside blockquotes (extra line break on close)
23169 !! wikitext
23170 <blockquote>Line one
23171
23172 Line two
23173 </blockquote>
23174 !! html
23175 <blockquote>Line one
23176 <p>Line two
23177 </p>
23178 </blockquote>
23179
23180 !! html+tidy
23181 <blockquote><p>Line one
23182 </p><p>Line two
23183 </p>
23184 </blockquote>
23185 !! end
23186
23187 !! test
23188 T8200: paragraphs inside blockquotes (extra line break on open and close)
23189 !! wikitext
23190 <blockquote>
23191 Line one
23192
23193 Line two
23194 </blockquote>
23195 !! html
23196 <blockquote>
23197 <p>Line one
23198 </p><p>Line two
23199 </p>
23200 </blockquote>
23201
23202 !! end
23203
23204 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23205 !! test
23206 Paragraphs inside blockquotes/divs (no extra line breaks)
23207 !! wikitext
23208 <blockquote><div>Line one
23209
23210 Line two</div></blockquote>
23211 !! html
23212 <blockquote><div>Line one
23213 Line two</div></blockquote>
23214
23215 !! end
23216
23217 !! test
23218 Paragraphs inside blockquotes/divs (extra line break on open)
23219 !! wikitext
23220 <blockquote><div>
23221 Line one
23222
23223 Line two</div></blockquote>
23224 !! html
23225 <blockquote><div>
23226 <p>Line one
23227 </p>
23228 Line two</div></blockquote>
23229
23230 !! end
23231
23232 !! test
23233 Paragraphs inside blockquotes/divs (extra line break on close)
23234 !! wikitext
23235 <blockquote><div>Line one
23236
23237 Line two
23238 </div></blockquote>
23239 !! html
23240 <blockquote><div>Line one
23241 <p>Line two
23242 </p>
23243 </div></blockquote>
23244
23245 !! end
23246
23247 !! test
23248 Paragraphs inside blockquotes/divs (extra line break on open and close)
23249 !! wikitext
23250 <blockquote><div>
23251 Line one
23252
23253 Line two
23254 </div></blockquote>
23255 !! html
23256 <blockquote><div>
23257 <p>Line one
23258 </p><p>Line two
23259 </p>
23260 </div></blockquote>
23261
23262 !! end
23263
23264 !! test
23265 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23266 !! options
23267 wgLinkHolderBatchSize=0
23268 !! wikitext
23269 [[meatball:1]]
23270 [[meatball:2]]
23271 [[meatball:3]]
23272 !! html
23273 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23274 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23275 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23276 </p>
23277 !! end
23278
23279 !! test
23280 Free external link invading image caption
23281 !! wikitext
23282 [[Image:Foobar.jpg|thumb|http://x|hello]]
23283 !! html/php
23284 <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>
23285
23286 !! html/parsoid
23287 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"bogus","ak":"http://x"},{"ck":"caption","ak":"hello"}]}'><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":"Image:Foobar.jpg"}}'/></a><figcaption>hello</figcaption></figure>
23288 !! end
23289
23290 !! test
23291 T17196: localised external link numbers
23292 !! options
23293 language=fa
23294 !! wikitext
23295 [http://en.wikipedia.org/]
23296 !! html/php
23297 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23298 </p>
23299 !! html/parsoid
23300 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23301 !! end
23302
23303 !! test
23304 Multibyte character in padleft
23305 !! wikitext
23306 {{padleft:-Hello|7|Æ}}
23307 !! html/php
23308 <p>Æ-Hello
23309 </p>
23310 !! html/parsoid
23311 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23312 !! end
23313
23314 !! test
23315 Multibyte character in padright
23316 !! wikitext
23317 {{padright:Hello-|7|Æ}}
23318 !! html/php
23319 <p>Hello-Æ
23320 </p>
23321 !! html/parsoid
23322 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23323 !! end
23324
23325 !!test
23326 formatdate parser function
23327 !! wikitext
23328 {{#formatdate:2009-03-24}}
23329 !! html
23330 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23331 </p>
23332 !! end
23333
23334 !!test
23335 formatdate parser function, with default format
23336 !! wikitext
23337 {{#formatdate:2009-03-24|mdy}}
23338 !! html
23339 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23340 </p>
23341 !! end
23342
23343 !! test
23344 Spacing of numbers in formatted dates
23345 !! wikitext
23346 {{#formatdate:January 15}}
23347 !! html
23348 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23349 </p>
23350 !! end
23351
23352 !! test
23353 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
23354 !! options
23355 language=nl title=[[MediaWiki:Common.css]]
23356 !! wikitext
23357 {{#formatdate:2009-03-24|dmy}}
23358 !! html
23359 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23360 </p>
23361 !! end
23362
23363 #
23364 #
23365 #
23366
23367 #
23368 # Edit comments
23369 #
23370
23371 !! test
23372 Edit comment with link
23373 !! options
23374 comment
23375 !! wikitext
23376 I like the [[Main Page]] a lot
23377 !! html/php
23378 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23379 !!end
23380
23381 !! test
23382 Edit comment with link and link text
23383 !! options
23384 comment
23385 !! wikitext
23386 I like the [[Main Page|best pages]] a lot
23387 !! html/php
23388 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23389 !!end
23390
23391 !! test
23392 Edit comment with link and link text with suffix
23393 !! options
23394 comment
23395 !! wikitext
23396 I like the [[Main Page|best page]]s a lot
23397 !! html/php
23398 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23399 !!end
23400
23401 !! test
23402 Edit comment with section link (non-local, eg in history list)
23403 !! options
23404 comment title=[[Main Page]]
23405 !! wikitext
23406 /* External links */ removed bogus entries
23407 !! html/php
23408 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23409 !!end
23410
23411 !! test
23412 Edit comment with section link and text before it (non-local, eg in history list)
23413 !! options
23414 comment title=[[Main Page]]
23415 !! wikitext
23416 pre-comment text /* External links */ removed bogus entries
23417 !! html/php
23418 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>
23419 !!end
23420
23421 !! test
23422 Edit comment with section link (local, eg in diff view)
23423 !! options
23424 comment local title=[[Main Page]]
23425 !! wikitext
23426 /* External links */ removed bogus entries
23427 !! html/php
23428 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23429 !!end
23430
23431 !! test
23432 Edit comment with subpage link (T16080)
23433 !! options
23434 comment
23435 subpage
23436 title=[[Subpage test]]
23437 !! wikitext
23438 Poked at a [[/subpage]] here...
23439 !! html/php
23440 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23441 !!end
23442
23443 !! test
23444 Edit comment with subpage link and link text (T16080)
23445 !! options
23446 comment
23447 subpage
23448 title=[[Subpage test]]
23449 !! wikitext
23450 Poked at a [[/subpage|neat little page]] here...
23451 !! html/php
23452 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23453 !!end
23454
23455 !! test
23456 Edit comment with bogus subpage link in non-subpage NS (T16080)
23457 !! options
23458 comment
23459 title=[[Subpage test]]
23460 !! wikitext
23461 Poked at a [[/subpage]] here...
23462 !! html/php
23463 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...
23464 !!end
23465
23466 !! test
23467 Edit comment with bare anchor link (local, as on diff)
23468 !! options
23469 comment
23470 local
23471 title=[[Main Page]]
23472 !! wikitext
23473 [[#section]]
23474 !! html/php
23475 <a href="#section">#section</a>
23476 !! end
23477
23478 !! test
23479 Edit comment with bare anchor link (non-local, as on history)
23480 !! options
23481 comment
23482 title=[[Main Page]]
23483 !! wikitext
23484 [[#section]]
23485 !! html/php
23486 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23487 !! end
23488
23489 !! test
23490 Anchor starting with underscore
23491 !! options
23492 title=[[Foo]]
23493 !! wikitext
23494 [[#_ref|One]]
23495 !! html/php
23496 <p><a href="#_ref">One</a>
23497 </p>
23498 !! html/parsoid
23499 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23500 !! end
23501
23502 !! test
23503 Id starting with underscore
23504 !! wikitext
23505 <div id="_ref"></div>
23506 !! html/*
23507 <div id="_ref"></div>
23508
23509 !! end
23510
23511 !! test
23512 Edit comment with link with more than one pipe (T99346)
23513 !! options
23514 comment
23515 !! wikitext
23516 [[Main Page|Many|pipes]]
23517 !! html/php
23518 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23519 !! end
23520
23521 !! test
23522 Complex edit comment with link with more than one pipe (T99346)
23523 !! options
23524 comment
23525 !! wikitext
23526 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23527 !! html/php
23528 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
23529 !! end
23530
23531 !! test
23532 Space normalisation on autocomment (T24784)
23533 !! options
23534 comment
23535 title=[[Main Page]]
23536 !! wikitext
23537 /* __hello__world__ */
23538 !! html/php
23539 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23540 !! end
23541
23542 !! test
23543 percent-encoding and + signs in comments (T28410)
23544 !! options
23545 comment
23546 !! wikitext
23547 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23548 !! html/php
23549 <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>
23550 !! end
23551
23552 # Parsoid doesn't support this yet: see T75581
23553 # but it *should* omit the 'src' attribute if the image is bad.
23554 # PHP side of tests was disabled in
23555 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23556 # because of issues in the PHP parserTests infrastructure
23557 # (but the output below is indeed what the PHP side emits)
23558 !! test
23559 Bad images - basic functionality
23560 !! wikitext
23561 [[File:Bad.jpg]]
23562 !! html/php+disabled
23563 !! html/parsoid
23564 <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>
23565 !! end
23566
23567 !! test
23568 Bad images - T18039: text after bad image disappears
23569 !! wikitext
23570 Foo bar
23571 [[File:Bad.jpg]]
23572 Bar foo
23573 !! html/php+disabled
23574 <p>Foo bar
23575 </p><p>Bar foo
23576 </p>
23577 !! html/parsoid
23578 <p>Foo bar
23579 <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>
23580 Bar foo</p>
23581 !! end
23582
23583 !! test
23584 Verify that displaytitle works (T24501) no displaytitle
23585 !! options
23586 showtitle
23587 !! config
23588 wgAllowDisplayTitle=true
23589 wgRestrictDisplayTitle=false
23590 !! wikitext
23591 this is not the the title
23592 !! html/php
23593 Parser test
23594 <p>this is not the the title
23595 </p>
23596 !! end
23597
23598 !! test
23599 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23600 !! options
23601 showtitle
23602 title=[[Screen]]
23603 !! config
23604 wgAllowDisplayTitle=true
23605 wgRestrictDisplayTitle=false
23606 !! wikitext
23607 this is not the the title
23608 {{DISPLAYTITLE:whatever}}
23609 !! html/php
23610 whatever
23611 <p>this is not the the title
23612 </p>
23613 !! end
23614
23615 !! test
23616 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23617 !! options
23618 showtitle
23619 title=[[Screen]]
23620 !! config
23621 wgAllowDisplayTitle=true
23622 wgRestrictDisplayTitle=true
23623 !! wikitext
23624 this is not the the title
23625 {{DISPLAYTITLE:whatever}}
23626 !! html/php
23627 Screen
23628 <p>this is not the the title
23629 </p>
23630 !! end
23631
23632 !! test
23633 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23634 !! options
23635 showtitle
23636 title=[[Screen]]
23637 !! config
23638 wgAllowDisplayTitle=true
23639 wgRestrictDisplayTitle=true
23640 !! wikitext
23641 this is not the the title
23642 {{DISPLAYTITLE:screen}}
23643 !! html/php
23644 screen
23645 <p>this is not the the title
23646 </p>
23647 !! end
23648
23649 !! test
23650 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23651 !! options
23652 showtitle
23653 title=[[Screen]]
23654 !! config
23655 wgAllowDisplayTitle=false
23656 !! wikitext
23657 this is not the the title
23658 {{DISPLAYTITLE:screen}}
23659 !! html/php
23660 Screen
23661 <p>this is not the the title
23662 <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>
23663 </p>
23664 !! end
23665
23666 !! test
23667 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23668 !! options
23669 showtitle
23670 title=[[Screen]]
23671 !! config
23672 wgAllowDisplayTitle=false
23673 !! wikitext
23674 this is not the the title
23675 !! html/php
23676 Screen
23677 <p>this is not the the title
23678 </p>
23679 !! end
23680
23681 !! test
23682 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23683 !! options
23684 showtitle
23685 title=[[Screen]]
23686 !! config
23687 wgAllowDisplayTitle=true
23688 wgRestrictDisplayTitle=true
23689 !! wikitext
23690 this is not the the title
23691 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23692 !! html/php
23693 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23694 <p>this is not the the title
23695 </p>
23696 !! end
23697
23698 !! test
23699 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23700 !! options
23701 showtitle
23702 title=[[Screen]]
23703 !! config
23704 wgAllowDisplayTitle=true
23705 wgRestrictDisplayTitle=true
23706 !! wikitext
23707 this is not the the title
23708 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23709 !! html/php
23710 <span style="color: red;">s</span>creen
23711 <p>this is not the the title
23712 </p>
23713 !! end
23714
23715 !! test
23716 Page status indicators: Empty name is invalid
23717 !! options
23718 showindicators
23719 !! wikitext
23720 <indicator name=" "></indicator>
23721 <indicator></indicator>
23722 !! html/php
23723 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23724 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23725 </p>
23726 !! end
23727
23728 !! test
23729 Page status indicators: Weird syntaxes that are okay
23730 !! options
23731 showindicators
23732 !! wikitext
23733 <indicator name="empty" />
23734 <indicator name="name"></indicator>
23735 !! html/php
23736 empty=
23737 name=
23738 <p><br />
23739 </p>
23740 !! end
23741
23742 !! test
23743 Page status indicators: Torture test
23744 !! options
23745 showindicators
23746 !! wikitext
23747 <indicator name="01">hello world</indicator>
23748 <indicator name="02">[[Main Page]]</indicator>
23749 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23750 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23751 <indicator name="05">*foo
23752 *bar</indicator>
23753 <indicator name="06"><nowiki>foo</nowiki></indicator>
23754 <indicator name="07"> Preformatted</indicator>
23755 <indicator name="08"><div>Broken tag</indicator>
23756 <indicator name="09">{| class=wikitable
23757 |cell
23758 |}</indicator>
23759 <indicator name="10">Two
23760
23761 paragraphs</indicator>
23762 !! html/php
23763 01=hello world
23764 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23765 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" />
23766 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>
23767 05=<ul><li>foo</li>
23768 <li>bar</li></ul>
23769
23770 06=foo
23771 07=<pre>Preformatted
23772 </pre>
23773 08=<div>Broken tag</div>
23774
23775 09=<table class="wikitable">
23776 <tr>
23777 <td>cell
23778 </td></tr></table>
23779
23780 10=<p>Two
23781 </p><p>paragraphs
23782 </p>
23783 <p><br />
23784 </p><p><br />
23785 </p><p><br />
23786 </p><p><br />
23787 </p><p><br />
23788 </p>
23789 !! end
23790
23791 !! test
23792 preload: check <noinclude> and <includeonly>
23793 !! options
23794 preload
23795 !! wikitext
23796 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23797 !! html/php
23798 Hello kind world.
23799 !! end
23800
23801 !! test
23802 preload: check <onlyinclude>
23803 !! options
23804 preload
23805 !! wikitext
23806 Goodbye <onlyinclude>Hello world</onlyinclude>
23807 !! html/php
23808 Hello world
23809 !! end
23810
23811 !! test
23812 preload: can pass tags through if we want to
23813 !! options
23814 preload
23815 !! wikitext
23816 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23817 !! html/php
23818 <includeonly>Hello world</includeonly>
23819 !! end
23820
23821 !! test
23822 preload: check that it doesn't try to do tricks
23823 !! options
23824 preload
23825 !! wikitext
23826 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23827 !! html/php
23828 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23829 !! end
23830
23831 !! test
23832 Play a bit with r67090 and T5158
23833 !! wikitext
23834 <div style="width:50% !important">&nbsp;</div>
23835 <div style="width:50%&nbsp;!important">&nbsp;</div>
23836 <div style="width:50%&#160;!important">&nbsp;</div>
23837 <div style="border : solid;">&nbsp;</div>
23838 !! html/php
23839 <div style="width:50% !important">&#160;</div>
23840 <div style="width:50% !important">&#160;</div>
23841 <div style="width:50% !important">&#160;</div>
23842 <div style="border&#160;: solid;">&#160;</div>
23843
23844 !! html/parsoid
23845 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23846 <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>
23847 <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>
23848 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23849
23850 !! end
23851
23852 !! test
23853 HTML5 data attributes
23854 !! wikitext
23855 <span data-foo="bar">Baz</span>
23856 <p data-abc-def_hij="">Quuz</p>
23857 !! html/php
23858 <p><span data-foo="bar">Baz</span>
23859 </p>
23860 <p data-abc-def_hij="">Quuz</p>
23861
23862 !! html/parsoid
23863 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23864 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23865 !! end
23866
23867 !! test
23868 Strip reserved data attributes
23869 !! wikitext
23870 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23871 !! html/php
23872 <div data-ok="fred">d</div>
23873
23874 !! html/parsoid
23875 <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>
23876 !! end
23877
23878 !! test
23879 percent-encoding and + signs in internal links (T28410)
23880 !! wikitext
23881 [[User:+%]] [[Page+title%]]
23882 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23883 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23884 [[%33%45]] [[%33%45+]]
23885 !! html/php
23886 <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>
23887 <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>
23888 <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>
23889 <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>
23890 </p>
23891 !! html/parsoid
23892 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
23893 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
23894 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></figure-inline>
23895 <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>
23896 !! end
23897
23898 !! test
23899 Special characters in embedded file links (T29679)
23900 !! wikitext
23901 [[File:Contains & ampersand.jpg]]
23902 [[File:Does not exist.jpg|Title with & ampersand]]
23903 !! html/php
23904 <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>
23905 <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>
23906 </p>
23907 !! html/parsoid
23908 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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></figure-inline>
23909 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","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></figure-inline></p>
23910 !! end
23911
23912 !! test
23913 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23914 !! wikitext
23915 Text&apos;s been normalized?
23916 !! html
23917 <p>Text&#39;s been normalized?
23918 </p>
23919 !! end
23920
23921 !! test
23922 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23923 !! wikitext
23924 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23925 !! html
23926 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23927 </p>
23928 !! end
23929
23930 !! test
23931 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23932 !! wikitext
23933 [http://www.example.org/ ideograms]
23934 !! html
23935 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23936 </p>
23937 !! end
23938
23939 !! test
23940 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23941 !! wikitext
23942 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23943 !! html
23944 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23945 </p>
23946 !! end
23947
23948 !! article
23949 Mediawiki:loop1
23950 !! text
23951 {{Identical|A}}
23952 !! endarticle
23953
23954 !! article
23955 Mediawiki:loop2
23956 !! text
23957 {{Identical|B}}
23958 !! endarticle
23959
23960 !! article
23961 Template:Identical
23962 !! text
23963 {{int:loop1}}
23964 {{int:loop2}}
23965 !! endarticle
23966
23967 !! test
23968 T33098 Template which includes system messages which includes the template
23969 !! wikitext
23970 {{Identical}}
23971 !! html
23972 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23973 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23974 </p>
23975 !! end
23976
23977 !! test
23978 T33490 Turkish: ucfirst 'blah'
23979 !! options
23980 language=tr
23981 !! wikitext
23982 {{ucfirst:blah}}
23983 !! html
23984 <p>Blah
23985 </p>
23986 !! end
23987
23988 !! test
23989 T33490 Turkish: ucfirst 'ix'
23990 !! options
23991 language=tr
23992 !! wikitext
23993 {{ucfirst:ix}}
23994 !! html
23995 <p>İx
23996 </p>
23997 !! end
23998
23999 !! test
24000 T33490 Turkish: lcfirst 'BLAH'
24001 !! options
24002 language=tr
24003 !! wikitext
24004 {{lcfirst:BLAH}}
24005 !! html
24006 <p>bLAH
24007 </p>
24008 !! end
24009
24010 !! test
24011 T33490 Turkish: ucfırst (with a dotless i)
24012 !! options
24013 language=tr
24014 !! wikitext
24015 {{ucfırst:blah}}
24016 !! html
24017 <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>
24018 </p>
24019 !! end
24020
24021 !! test
24022 T33490 ucfırst (with a dotless i) with English language
24023 !! options
24024 language=en
24025 !! wikitext
24026 {{ucfırst:blah}}
24027 !! html
24028 <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>
24029 </p>
24030 !! end
24031
24032 # Note that Parsoid doesn't emit an explicit TOC.
24033 # Note also that the html2wt direction tends to emit an extra newline
24034 # between the __TOC__ magicword and the first heading unless *both*
24035 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24036 # it's "{}").
24037
24038 !! test
24039 T28375: TOC with italics
24040 !! options
24041 title=[[Main Page]]
24042 !! wikitext
24043 __TOC__
24044 ==''Lost'' episodes==
24045 !! html/php
24046 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24047 <ul>
24048 <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>
24049 </ul>
24050 </div>
24051
24052 <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>
24053
24054 !! html/parsoid
24055 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24056 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24057 !! end
24058
24059 !! test
24060 T28375: TOC with bold
24061 !! options
24062 title=[[Main Page]]
24063 !! wikitext
24064 __TOC__
24065 =='''should be bold''' then normal text==
24066 !! html/php
24067 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24068 <ul>
24069 <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>
24070 </ul>
24071 </div>
24072
24073 <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>
24074
24075 !! html/parsoid
24076 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24077 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24078 !! end
24079
24080 !! test
24081 T35845: Headings become cursive in TOC when they contain an image
24082 !! options
24083 title=[[Main Page]]
24084 !! wikitext
24085 __TOC__
24086 ==Image [[Image:foobar.jpg]]==
24087 !! html/php
24088 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24089 <ul>
24090 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24091 </ul>
24092 </div>
24093
24094 <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>
24095
24096 !! html/parsoid
24097 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24098 <h2 id="Image" data-parsoid='{}'>Image <figure-inline 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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></h2>
24099 !! end
24100
24101 !! test
24102 T35845 (2): Headings become bold in TOC when they contain a blockquote
24103 !! options
24104 title=[[Main Page]]
24105 !! wikitext
24106 __TOC__
24107 ==<blockquote>Quote</blockquote>==
24108 !! html/php
24109 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24110 <ul>
24111 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24112 </ul>
24113 </div>
24114
24115 <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>
24116
24117 !! html/php+tidy
24118 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24119 <ul>
24120 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24121 </ul>
24122 </div>
24123
24124 <h2><span class="mw-headline" id="Quote"><blockquote><p>Quote</p></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>
24125 !! html/parsoid
24126 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24127 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24128 !! end
24129
24130 !! test
24131 Unclosed tags in TOC
24132 !! config
24133 wgFragmentMode=[ 'html5', 'legacy' ]
24134 !! options
24135 title=[[Main Page]]
24136 !! wikitext
24137 __TOC__
24138 ==Proof: 2 < 3==
24139 <small>Hanc marginis exiguitas non caperet.</small>
24140 QED
24141 !! html/php
24142 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24143 <ul>
24144 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_&lt;_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
24145 </ul>
24146 </div>
24147
24148 <h2><span id="Proof:_2_.3C_3"></span><span class="mw-headline" id="Proof:_2_&lt;_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>
24149 <p><small>Hanc marginis exiguitas non caperet.</small>
24150 QED
24151 </p>
24152 !! html/parsoid
24153 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24154 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24155 <p><small>Hanc marginis exiguitas non caperet.</small>
24156 QED</p>
24157 !! end
24158
24159 !! test
24160 Multiple tags in TOC
24161 !! wikitext
24162 __TOC__
24163 ==<i>Foo</i> <b>Bar</b>==
24164
24165 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24166 !! html/php
24167 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24168 <ul>
24169 <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>
24170 <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>
24171 </ul>
24172 </div>
24173
24174 <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>
24175 <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>
24176
24177 !! html/php+tidy
24178 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24179 <ul>
24180 <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>
24181 <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>
24182 </ul>
24183 </div>
24184
24185 <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>
24186 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote><p>Bar</p></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>
24187 !! html/parsoid
24188 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24189 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24190
24191 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24192 !! end
24193
24194 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24195 # html5 tag parsing.
24196 !! test
24197 Tags with parameters in TOC
24198 !! options
24199 parsoid=wt2html
24200 !! wikitext
24201 __TOC__
24202 ==<sup class="in-h2">Hello</sup>==
24203
24204 ==<sup class="a > b">Evilbye</sup>==
24205 !! html/php
24206 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24207 <ul>
24208 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24209 <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>
24210 </ul>
24211 </div>
24212
24213 <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>
24214 <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>
24215
24216 !! html/parsoid
24217 <meta property="mw:PageProp/toc" />
24218 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24219
24220 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24221 !! end
24222
24223 !! test
24224 span tags with directionality in TOC
24225 !! wikitext
24226 __TOC__
24227 ==<span dir="ltr">C++</span>==
24228
24229 ==<span dir="rtl">זבנג!</span>==
24230
24231 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24232
24233 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24234
24235 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24236 !! html/php
24237 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24238 <ul>
24239 <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>
24240 <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>
24241 <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>
24242 <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>
24243 <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>
24244 </ul>
24245 </div>
24246
24247 <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>
24248 <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>
24249 <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>
24250 <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>
24251 <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>
24252
24253 !! html/parsoid
24254 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24255 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24256 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24257 <h2 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></h2>
24258 <h2 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></h2>
24259 <h2 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></h2>
24260 !! end
24261
24262 !! test
24263 T74884: bdi element in ToC
24264 !! wikitext
24265 __TOC__
24266 ==<bdi>test</bdi>==
24267 !! html/php
24268 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24269 <ul>
24270 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24271 </ul>
24272 </div>
24273
24274 <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>
24275
24276 !! html/parsoid
24277 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24278 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24279 !! end
24280
24281 !! test
24282 T35715: s/strike element in ToC
24283 !! wikitext
24284 __TOC__
24285 ==<s>test</s> test <strike>test</strike>==
24286 !! html/php
24287 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24288 <ul>
24289 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
24290 </ul>
24291 </div>
24292
24293 <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></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 test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
24294
24295 !! html/parsoid
24296 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24297 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24298 !! end
24299
24300 !! test
24301 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24302 !! wikitext
24303 __TOC__
24304 ==x==
24305 !! html/php
24306 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24307 <ul>
24308 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24309 </ul>
24310 </div>
24311
24312 <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>
24313
24314 !! html/parsoid
24315 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24316 <h2 id="x" data-parsoid='{}'>x</h2>
24317 !! end
24318
24319 !! article
24320 MediaWiki:T34057
24321 !! text
24322 == {{int:headline_sample}} ==
24323 !! endarticle
24324
24325 !! test
24326 T34057: Title needed when expanding <h> nodes.
24327 !! options
24328 title=[[Main Page]]
24329 !! wikitext
24330 {{int:T34057}}
24331 !! html
24332 <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>
24333
24334 !! end
24335
24336 !! test
24337 Strip marker in urlencode
24338 !! wikitext
24339 {{urlencode:x<nowiki/>y}}
24340 {{urlencode:x<nowiki/>y|wiki}}
24341 {{urlencode:x<nowiki/>y|path}}
24342 {{urlencode:x<pre id="one">two</pre>y}}
24343 !! html/php
24344 <p>xy
24345 xy
24346 xy
24347 xy
24348 </p>
24349 !! end
24350
24351 !! test
24352 Strip marker in lc
24353 !! wikitext
24354 {{lc:x<nowiki/>y}}
24355 !! html
24356 <p>xy
24357 </p>
24358 !! end
24359
24360 !! test
24361 Strip marker in uc
24362 !! wikitext
24363 {{uc:x<nowiki/>y}}
24364 !! html
24365 <p>XY
24366 </p>
24367 !! end
24368
24369 !! test
24370 Strip marker in formatNum
24371 !! wikitext
24372 {{formatnum:1<nowiki/>2}}
24373 {{formatnum:1<nowiki/>2|R}}
24374 !! html
24375 <p>12
24376 12
24377 </p>
24378 !! end
24379
24380 !! test
24381 Check noCommafy in formatNum
24382 !! options
24383 language=be-tarask
24384 !! wikitext
24385 {{formatnum:123456.78}}
24386 {{formatnum:123456.78|NOSEP}}
24387 !! html
24388 <p>123 456,78
24389 123456.78
24390 </p>
24391 !! end
24392
24393 !! test
24394 Wrong option for formatNum (T58199)
24395 !! wikitext
24396 {{formatnum:1,234.56|Random}}
24397 {{formatnum:1,234.56|EVERYTHING}}
24398 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24399 !! html
24400 <p>1,234.56
24401 1,234.56
24402 1,234.56
24403 </p>
24404 !! end
24405
24406 !! test
24407 Strip marker in grammar
24408 !! options
24409 language=fi
24410 !! wikitext
24411 {{grammar:elative|foo<nowiki/>bar}}
24412 !! html
24413 <p>foobarista
24414 </p>
24415 !! end
24416
24417 !! test
24418 Strip marker in padleft
24419 !! wikitext
24420 {{padleft:|2|x<nowiki/>y}}
24421 !! html
24422 <p>xy
24423 </p>
24424 !! end
24425
24426 !! test
24427 Strip marker in padright
24428 !! wikitext
24429 {{padright:|2|x<nowiki/>y}}
24430 !! html
24431 <p>xy
24432 </p>
24433 !! end
24434
24435 !! test
24436 Strip marker in anchorencode
24437 !! wikitext
24438 {{anchorencode:x<nowiki/>y}}
24439 !! html/php
24440 <p>xy
24441 </p>
24442 !! html/parsoid
24443 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:x&lt;nowiki/>y","function":"anchorencode"},"params":{},"i":0}}]}'>xy</p>
24444 !! end
24445
24446 !! test
24447 nowiki inside link inside heading (T20295)
24448 !! wikitext
24449 ==[[foo|x<nowiki>y</nowiki>z]]==
24450 !! html
24451 <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>
24452
24453 !! end
24454
24455 !! test
24456 new support for bdi element (T33817)
24457 !! wikitext
24458 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24459 !! html
24460 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24461
24462 !!end
24463
24464 !! test
24465 Ignore pipe between table row attributes
24466 !! wikitext
24467 {|
24468 |quux
24469 |- id=foo | style='color: red'
24470 |bar
24471 |}
24472 !! html
24473 <table>
24474 <tr>
24475 <td>quux
24476 </td></tr>
24477 <tr id="foo" style="color: red">
24478 <td>bar
24479 </td></tr></table>
24480
24481 !! end
24482
24483 !!test
24484 Language parser function
24485 !! wikitext
24486 {{#language:ar}}
24487 !! html
24488 <p>العربية
24489 </p>
24490 !! end
24491
24492 !!test
24493 Padleft and padright (default 0-padding)
24494 !! wikitext
24495 {{padleft:xyz|5}}
24496 {{padright:xyz|5}}
24497 !! html/php
24498 <p>00xyz
24499 xyz00
24500 </p>
24501 !! html/parsoid
24502 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24503 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24504 !! end
24505
24506 !!test
24507 Padleft and padright (partial fill)
24508 !! wikitext
24509 {{padleft:xyz|6|ab}}
24510 {{padright:xyz|6|ab}}
24511 !! html/php
24512 <p>abaxyz
24513 xyzaba
24514 </p>
24515 !! html/parsoid
24516 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>abaxyz</span>
24517 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>xyzaba</span></p>
24518 !! end
24519
24520 !!test
24521 Padleft and padright as substr
24522 !! wikitext
24523 {{padleft:|3|abcde}}
24524 {{padright:|3|abcde}}
24525 !! html/php
24526 <p>abc
24527 abc
24528 </p>
24529 !! html/parsoid
24530 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:","function":"padleft"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span>
24531 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:","function":"padright"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span></p>
24532 !! end
24533
24534 !!test
24535 Special parser function
24536 !! wikitext
24537 {{#special:RandomPage}}
24538 {{#special:BaDtItLe}}
24539 {{#special:Foobar}}
24540 !! html
24541 <p>Special:Random
24542 Special:Badtitle
24543 Special:Foobar
24544 </p>
24545 !! end
24546
24547 !!test
24548 T36939 - Case insensitive link parsing ([HttP://])
24549 !! wikitext
24550 [HttP://MediaWiki.Org/]
24551 !! html/php
24552 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24553 </p>
24554 !! html/parsoid
24555 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24556 !! end
24557
24558 !!test
24559 T36939 - Case insensitive link parsing ([HttP:// title])
24560 !! wikitext
24561 [HttP://MediaWiki.Org/ MediaWiki]
24562 !! html
24563 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24564 </p>
24565 !! end
24566
24567 !!test
24568 T36939 - Case insensitive link parsing (HttP://)
24569 !! wikitext
24570 HttP://MediaWiki.Org/
24571 !! html/php
24572 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24573 </p>
24574 !! html/parsoid
24575 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24576 !! end
24577
24578 !!test
24579 Disable TOC
24580 !! options
24581 notoc
24582 !! wikitext
24583 Lead
24584 ==Section 1==
24585 ==Section 2==
24586 ==Section 3==
24587 ==Section 4==
24588 ==Section 5==
24589 !! html
24590 <p>Lead
24591 </p>
24592
24593 <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>
24594 <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>
24595 <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>
24596 <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>
24597 <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>
24598
24599 !! end
24600
24601
24602 ###
24603 ### Parsoid-specific tests
24604 ### Parsoid-PHP parser incompatibilities
24605 ###
24606 !!test
24607 1. SOL-sensitive wikitext tokens as template-args
24608 !!options
24609 parsoid=wt2html,wt2wt
24610 !! wikitext
24611 {{echo|*a}}
24612 {{echo|#a}}
24613 {{echo|:a}}
24614 !! html
24615 <span about="#mwt1" typeof="mw:Transclusion">
24616 </span><ul about="#mwt1"><li>a</li>
24617 </ul>
24618 <span about="#mwt2" typeof="mw:Transclusion">
24619 </span><ol about="#mwt2"><li>a</li>
24620 </ol>
24621 <span about="#mwt3" typeof="mw:Transclusion">
24622 </span><dl about="#mwt3"><dd>a</dd>
24623 </dl>
24624 !!end
24625
24626 #### -----------------------------------------------------------------
24627 #### Parsoid-specific functionality tests
24628 #### -----------------------------------------------------------------
24629
24630 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24631 # We know wt2wt will fail, but we expect selser to pass.
24632 # Due to the nature of our testing, wt2wt and selser tests will enter the
24633 # blacklist and we'll catch selser regressions based on changes to the
24634 # blacklist entries for selser tests.
24635 !! test
24636 1. Bad treebuilder fixup of formatting elt is cleaned up
24637 !! options
24638 parsoid=wt2html,wt2wt
24639 !! wikitext
24640 {|
24641 |
24642 <small>
24643 [[Image:Foobar.jpg|right|Test]]
24644 </small>
24645 |}
24646 !! html/parsoid
24647 <table>
24648 <tbody><tr><td>
24649 <small>
24650 <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>
24651 </small>
24652 </td></tr>
24653 </tbody></table>
24654 !! end
24655
24656 !! test
24657 2. Bad treebuilder fixup of formatting elt is cleaned up
24658 !! options
24659 parsoid=wt2html,wt2wt
24660 !! wikitext
24661 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24662
24663 <small>[[Image:Foobar.jpg|right|300px]]</small>
24664 !! html/parsoid
24665
24666 <p><b>foo</b></p>
24667 <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>
24668 <p><b>bar</b></p>
24669 <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>
24670 !! end
24671
24672 !! test
24673 3. Bad treebuilder fixup of formatting elt is cleaned up
24674 !! options
24675 parsoid=wt2html,wt2wt
24676 !! wikitext
24677 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24678 !! html/parsoid
24679 <p><small><b>foo</b></small></p>
24680 <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>
24681 <p><small><b>bar</b></small></p>
24682 !! end
24683
24684 !! test
24685 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24686 !! options
24687 parsoid=wt2html,wt2wt
24688 !! wikitext
24689 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24690 !! html/parsoid
24691 <b><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></b>
24692 !! end
24693
24694 #### ----------------------------------------------------------------
24695 #### Parsoid-only testing of Parsoid's impl of LST
24696 #### Not implemented yet, see
24697 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24698 #### ----------------------------------------------------------------
24699
24700 ## We still need to support serializing the older format while content is stored.
24701 !! test
24702 LST Sections: Backwards compatibility
24703 !! options
24704 parsoid={
24705 "suppressErrors": true,
24706 "modes": ["html2wt"]
24707 }
24708 !! wikitext
24709 <section begin="2011-05-16" />
24710 <section end="2014-04-10 (MW 1.23wmf22)" />
24711 !! html/parsoid
24712 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24713 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24714 !! end
24715
24716 !! test
24717 LST Sections: Newfangled approach
24718 !! wikitext
24719 <section begin="2011-05-16" />
24720 <section end="2014-04-10 (MW 1.23wmf22)" />
24721 !! html/parsoid
24722 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24723 </span>
24724 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24725 </span></p>
24726 !! end
24727
24728 #--------- Test stripping of empty nodes in template content ----------
24729
24730 !! test
24731 Empty LI and TR nodes should be stripped from template content
24732 !! wikitext
24733 {{EmptyLITest}}
24734 {{EmptyTRTest}}
24735 !! html/parsoid
24736 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24737 <li>a</li>
24738 <li>b</li>
24739 </ul>
24740 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24741 <tbody>
24742 <tr>
24743 <td>foo</td>
24744 </tr>
24745 <tr>
24746 <td>bar</td>
24747 </tr>
24748 </tbody>
24749 </table>
24750 !! end
24751
24752 !! test
24753 Empty LI and TR nodes should not be stripped from top-level content
24754 !! wikitext
24755 * a
24756 *
24757 * b
24758 {|
24759 |-
24760 |-
24761 |foo
24762 |}
24763 !! html/parsoid
24764 <ul>
24765 <li> a</li>
24766 <li class='mw-empty-elt'></li>
24767 <li> b</li>
24768 </ul>
24769 <table>
24770 <tbody>
24771 <tr class='mw-empty-elt'></tr>
24772 <tr>
24773 <td>foo</td>
24774 </tr>
24775 </tbody>
24776 </table>
24777 !! end
24778
24779 !! test
24780 Empty TR nodes should not be stripped if they have any attributes set
24781 !! wikitext
24782 {{EmptyTRWithHTMLAttrTest}}
24783 !! html/parsoid
24784 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24785 <tr align='center'></tr>
24786 <tr><td>foo</td></tr>
24787 <tr align='center'></tr>
24788 <tr><td>bar</td></tr>
24789 </table>
24790 !! end
24791
24792 #### ----------------------------------------------------------------
24793 #### The following section of tests are primarily to test
24794 #### wikitext escaping capabilities of Parsoid. Given that
24795 #### escaping can be done any number of ways, the wikitext (input)
24796 #### is always adjusted to reflect how Parsoid adds nowiki
24797 #### escape tags.
24798 ####
24799 #### We are marking several tests as parsoid-only since the
24800 #### HTML in the result section is different from what the
24801 #### PHP parser generates for it.
24802 #### ----------------------------------------------------------------
24803
24804
24805 #### --------------- Headings ---------------
24806 #### 0. Unnested
24807 #### 1. Nested inside html <h1>=foo=</h1>
24808 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24809 #### 3. Nested inside html with wikitext split by html tags
24810 #### 4. No escape needed
24811 #### 5. Empty headings <h1></h1>
24812 #### 6. Heading chars in SOL context
24813 #### ----------------------------------------
24814 !! test
24815 Headings: 0. Unnested
24816 !! options
24817 parsoid=html2wt
24818 !! html/parsoid
24819 <p>=foo=</p>
24820
24821 <p> =foo=
24822 <!--cmt-->
24823 =foo=</p>
24824
24825 <p>=foo<i>a</i>=</p>
24826 !! wikitext
24827 <nowiki>=foo=</nowiki>
24828
24829 <nowiki> </nowiki>=foo=
24830 <!--cmt-->
24831 <nowiki>=foo=</nowiki>
24832
24833 =foo''a''<nowiki>=</nowiki>
24834 !!end
24835
24836 # New headings and existing headings are handled differently
24837 !! test
24838 Headings: 1. Nested inside html
24839 !! options
24840 parsoid=html2wt
24841 !! html/parsoid
24842 <h1>=foo=</h1>
24843 <h2>=foo=</h2>
24844 <h3>=foo=</h3>
24845
24846 <h1 data-parsoid=''>=foo=</h1>
24847 <h2 data-parsoid=''>=foo=</h2>
24848 <h3 data-parsoid=''>=foo=</h3>
24849 <h4 data-parsoid=''>=foo=</h4>
24850 <h5 data-parsoid=''>=foo=</h5>
24851 <h6 data-parsoid=''>=foo=</h6>
24852 !! wikitext
24853 = =foo= =
24854
24855 == =foo= ==
24856
24857 === =foo= ===
24858
24859 =<nowiki>=foo=</nowiki>=
24860 ==<nowiki>=foo=</nowiki>==
24861 ===<nowiki>=foo=</nowiki>===
24862 ====<nowiki>=foo=</nowiki>====
24863 =====<nowiki>=foo=</nowiki>=====
24864 ======<nowiki>=foo=</nowiki>======
24865
24866 !!end
24867
24868 !! test
24869 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24870 !! options
24871 parsoid=html2wt
24872 !! html/parsoid
24873 <h1>foo</h1>*bar
24874 <h1>foo</h1>=bar
24875 <h1>foo</h1>=bar=
24876 !! wikitext
24877 = foo =
24878 <nowiki>*</nowiki>bar
24879
24880 = foo =
24881 =bar
24882
24883 = foo =
24884 <nowiki>=bar=</nowiki>
24885 !!end
24886
24887 !! test
24888 Headings: 3. Nested inside html with wikitext split by html tags
24889 !! options
24890 parsoid=html2wt
24891 !! html/parsoid
24892 <h1>=<b>bold</b>foo=</h1>
24893 !! wikitext
24894 = ='''bold'''foo= =
24895 !!end
24896
24897 !! test
24898 Headings: 4a. No escaping needed (testing just h1 and h2)
24899 !! options
24900 parsoid=html2wt
24901 !! html/parsoid
24902 <h1>=foo</h1>
24903 <h1>foo=</h1>
24904 <h1> =foo= </h1>
24905 <h1>=foo= bar</h1>
24906 <h2>=foo</h2>
24907 <h2>foo=</h2>
24908 <h1>=</h1>
24909 <h1><i>=</i>foo=</h1>
24910 !! wikitext
24911 = =foo =
24912
24913 = foo= =
24914
24915 = =foo= =
24916
24917 = =foo= bar =
24918
24919 == =foo ==
24920
24921 == foo= ==
24922
24923 = = =
24924
24925 = ''=''foo= =
24926 !!end
24927
24928 !! test
24929 Headings: 4b. No escaping needed (inside p-tags)
24930 !! options
24931 parsoid=html2wt
24932 !! html/parsoid
24933 <p>=foo= x
24934 =foo= <s></s>
24935 </p>
24936 !! wikitext
24937 =foo= x
24938 =foo= <s></s>
24939 !! html/php
24940 <p>=foo= x
24941 =foo= <s></s>
24942 </p>
24943 !!end
24944
24945 !! test
24946 Headings: 4c. Short headings (1)
24947 !! options
24948 parsoid=html2wt
24949 !! html/parsoid
24950 <p>===
24951 </p>
24952 !! wikitext
24953 <nowiki>===</nowiki>
24954 !! html/php
24955 <p>===
24956 </p>
24957 !! end
24958
24959 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24960 !! test
24961 Headings: 4d. Short headings (2)
24962 !! options
24963 parsoid=wt2html,html2html
24964 !! wikitext
24965 =
24966 ==
24967 ===
24968 ====
24969 =====
24970 !! html/php
24971 <p>=
24972 ==
24973 </p>
24974 <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>
24975 <h1><span class="mw-headline" id=".3D.3D">==</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>
24976 <h2><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=3" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
24977
24978 !! html/parsoid
24979 <p>=
24980 ==</p>
24981 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
24982 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
24983 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
24984 !! end
24985
24986 !! test
24987 Headings: 5. Empty headings
24988 !! options
24989 parsoid=html2wt
24990 !! html/parsoid
24991 <h1 data-parsoid='{}'></h1>
24992
24993 <h2 data-parsoid='{}'></h2>
24994
24995 <h3 data-parsoid='{}'></h3>
24996
24997 <h4 data-parsoid='{}'></h4>
24998
24999 <h5 data-parsoid='{}'></h5>
25000
25001 <h6 data-parsoid='{}'></h6>
25002 !! wikitext
25003 =<nowiki/>=
25004
25005 ==<nowiki/>==
25006
25007 ===<nowiki/>===
25008
25009 ====<nowiki/>====
25010
25011 =====<nowiki/>=====
25012
25013 ======<nowiki/>======
25014 !!end
25015
25016 !! test
25017 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25018 !! options
25019 parsoid=html2wt
25020 !! html/parsoid
25021 <p>=a=</p>
25022
25023 <p>=a=</p>
25024
25025 <p>=a=</p>
25026 !! wikitext
25027 <nowiki>=a=</nowiki>
25028
25029 <nowiki>=a=</nowiki>
25030
25031 <nowiki>=a=</nowiki>
25032 !!end
25033
25034 !! test
25035 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25036 !! options
25037 parsoid=html2wt
25038 !! html/parsoid
25039 <p>=a=
25040 b</p>
25041
25042 <p>=a=
25043 b</p>
25044
25045 <p>=a=
25046 b</p>
25047 !! wikitext
25048 <nowiki>=a=</nowiki>
25049 b
25050
25051 <nowiki>=a=</nowiki>
25052 b
25053
25054 <nowiki>=a=</nowiki>
25055 b
25056 !!end
25057
25058 !! test
25059 Headings: 6c. Heading chars in SOL context (leading newline break)
25060 !! options
25061 parsoid=html2wt
25062 !! html/parsoid
25063 <p>a
25064 =b=</p>
25065 !! wikitext
25066 a
25067 <nowiki>=b=</nowiki>
25068 !!end
25069
25070 !! test
25071 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25072 !! options
25073 parsoid=html2wt
25074 !! html/parsoid
25075 <!--c0--><p>=a=</p>
25076
25077 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25078 !! wikitext
25079 <!--c0--><nowiki>=a=</nowiki>
25080
25081 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25082 !!end
25083
25084 !! test
25085 Headings: 6d. Heading chars in SOL context (No escaping needed)
25086 !! options
25087 parsoid=html2wt
25088 !! html/parsoid
25089 =a=<div>b</div>
25090 !! wikitext
25091 =a=<div>b</div>
25092 !!end
25093
25094 !! test
25095 Headings: 7. Insert a newline between new content and headings
25096 !! options
25097 parsoid=html2wt
25098 !! html/parsoid
25099 <h2>NEW</h2>
25100 <p>new</p>
25101 <h2 data-parsoid='{}'>A</h2>
25102 <p data-parsoid='{}'>a</p>
25103 !! wikitext
25104 == NEW ==
25105 new
25106
25107 ==A==
25108 a
25109
25110 !! end
25111
25112 !! test
25113 Headings: Used as horizontal rule
25114 !! config
25115 wgFragmentMode=[ 'html5', 'legacy' ]
25116 !! options
25117 parsoid=wt2html
25118 !! wikitext
25119 ===============
25120 !! html/php
25121 <h6><span id=".3D.3D.3D"></span><span class="mw-headline" id="===">===</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></h6>
25122
25123 !! html/parsoid
25124 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25125 !! end
25126
25127 #### --------------- Lists ---------------
25128 #### 0. Outside nests (*foo, etc.)
25129 #### 1. Nested inside html <ul><li>*foo</li></ul>
25130 #### 2. Inside definition lists
25131 #### 3. Only bullets at start should be escaped
25132 #### 4. No escapes needed
25133 #### 5. No unnecessary escapes
25134 #### 6. Escape bullets in SOL position
25135 #### 7. Escape bullets in a multi-line context
25136 #### ----------------------------------------
25137
25138 !! test
25139 Lists: 0. Outside nests
25140 !! options
25141 parsoid=html2wt
25142 !! html/parsoid
25143 <p>*foo</p>
25144
25145 <p>#foo</p>
25146
25147 <p>;Foo:bar</p>
25148 !! wikitext
25149 <nowiki>*</nowiki>foo
25150
25151 <nowiki>#</nowiki>foo
25152
25153 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25154 !!end
25155
25156 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25157 ## to test wikitext escaping, and insignificant whitespace diffs
25158 ## cause PHP parser tests to barf
25159 !! test
25160 Lists: 1. Nested inside html (No unnecessary escapes)
25161 !! options
25162 parsoid=html2wt
25163 !! html/parsoid
25164 <ul>
25165 <li>*foo</li>
25166 <li>#foo</li>
25167 <li>:foo</li>
25168 <li>;foo</li>
25169 <li data-parsoid='{}'>*foo</li>
25170 <li data-parsoid='{}'>#foo</li>
25171 <li data-parsoid='{}'>:foo</li>
25172 <li data-parsoid='{}'>;foo</li>
25173 </ul>
25174
25175 <ol>
25176 <li>*foo</li>
25177 <li>#foo</li>
25178 <li>:foo</li>
25179 <li>;foo</li>
25180 <li data-parsoid='{}'>*foo</li>
25181 <li data-parsoid='{}'>#foo</li>
25182 <li data-parsoid='{}'>:foo</li>
25183 <li data-parsoid='{}'>;foo</li>
25184 </ol>
25185 !! wikitext
25186 * *foo
25187 * #foo
25188 * :foo
25189 * ;foo
25190 *<nowiki>*foo</nowiki>
25191 *<nowiki>#foo</nowiki>
25192 *<nowiki>:foo</nowiki>
25193 *<nowiki>;foo</nowiki>
25194
25195 # *foo
25196 # #foo
25197 # :foo
25198 # ;foo
25199 #<nowiki>*foo</nowiki>
25200 #<nowiki>#foo</nowiki>
25201 #<nowiki>:foo</nowiki>
25202 #<nowiki>;foo</nowiki>
25203 !!end
25204
25205 !! test
25206 Lists: 2. Inside definition lists
25207 !! options
25208 parsoid=html2wt
25209 !! html/parsoid
25210 <dl><dt>;foo</dt></dl>
25211 <dl><dt>:foo</dt></dl>
25212 <dl><dt>:foo</dt>
25213 <dd>bar</dd></dl>
25214 <dl><dd>:foo</dd></dl>
25215 !! wikitext
25216 ; ;foo
25217
25218 ; <nowiki>:foo</nowiki>
25219
25220 ; <nowiki>:foo</nowiki>
25221 : bar
25222
25223 : :foo
25224 !!end
25225
25226 !! test
25227 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25228 !! options
25229 parsoid=html2wt
25230 !! html/parsoid
25231 <ul>
25232 <li>*foo*bar</li>
25233 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25234 </ul>
25235 !! wikitext
25236 * *foo*bar
25237 *<nowiki>*foo</nowiki>''it''*bar
25238 !!end
25239
25240 !! test
25241 Lists: 4. No escapes needed
25242 !! options
25243 parsoid=html2wt
25244 !! html/parsoid
25245 <ul>
25246 <li>foo*bar
25247 </li>
25248 </ul>
25249 <ul>
25250 <li><i>foo</i>*bar
25251 </li>
25252 </ul>
25253 <ul>
25254 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25255 </li>
25256 </ul>
25257 <ul>
25258 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25259 </li>
25260 </ul>
25261 !! wikitext
25262 *foo*bar
25263
25264 *''foo''*bar
25265
25266 *[[Foo]]: bar
25267
25268 *[[Foo]]*bar
25269 !!end
25270
25271 !! test
25272 Lists: 5. No unnecessary escapes
25273 !! options
25274 parsoid=html2wt
25275 !! html/parsoid
25276 <ul><li> bar <span>[[foo]]</span></li></ul>
25277 <ul><li> =bar <span>[[foo]]</span></li></ul>
25278 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25279 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25280 <ul><li> =bar <span>foo]]</span>=</li></ul>
25281 <ul><li> <s></s>: a</li></ul>
25282 <ul><li> <i>* foo</i></li></ul>
25283
25284 !! wikitext
25285 * bar <span><nowiki>[[foo]]</nowiki></span>
25286
25287 * =bar <span><nowiki>[[foo]]</nowiki></span>
25288
25289 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25290
25291 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25292
25293 * =bar <span>foo]]</span>=
25294
25295 * <s></s>: a
25296
25297 * ''* foo''
25298 !!end
25299
25300 !! test
25301 Lists: 6. Escape bullets in SOL position
25302 !! options
25303 parsoid=html2wt
25304 !! html/parsoid
25305 <p><!--cmt-->*foo</p>
25306 !! wikitext
25307 <!--cmt--><nowiki>*</nowiki>foo
25308 !!end
25309
25310 !! test
25311 Lists: 7. Escape bullets in a multi-line context
25312 !! options
25313 parsoid=html2wt
25314 !! html/parsoid
25315 <p>a
25316 *b
25317 </p>
25318 !! wikitext
25319 a
25320 <nowiki>*</nowiki>b
25321 !!end
25322
25323 !! test
25324 Lists: 8. Escape colons only if not present in tags
25325 !! options
25326 parsoid=html2wt
25327 !! html/parsoid
25328 <dl><dt>a:b<i>c:d</i></dt></dl>
25329 !! wikitext
25330 ; <nowiki>a:b</nowiki>''c:d''
25331 !! end
25332
25333 #### --------------- HRs ---------------
25334 #### 1. Single line
25335 #### -----------------------------------
25336
25337 !! test
25338 HRs: 1. Single line
25339 !! options
25340 parsoid=html2wt
25341 !! html/parsoid
25342 <hr />----
25343 <hr />=foo=
25344 <hr />*foo
25345 !! wikitext
25346 ----<nowiki>----</nowiki>
25347 ----=foo=
25348 ----*foo
25349 !! end
25350
25351 #### --------------- Tables ---------------
25352 #### 1a. Simple example
25353 #### 1b. No escaping needed (!foo)
25354 #### 1c. No escaping needed (|foo)
25355 #### 1d. No escaping needed (|}foo)
25356 ####
25357 #### 2a. Nested in td (<td>foo|bar</td>)
25358 #### 2b. Nested in td (<td>foo||bar</td>)
25359 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25360 ####
25361 #### 3a. Nested in th (<th>foo!bar</th>)
25362 #### 3b. Nested in th (<th>foo!!bar</th>)
25363 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25364 ####
25365 #### 4a. Escape -
25366 #### 4b. Escape +
25367 #### 4c. No escaping needed
25368 #### --------------------------------------
25369
25370 !! test
25371 Tables: 1a. Simple example
25372 !! options
25373 parsoid=html2wt
25374 !! html/parsoid
25375 <p>{|
25376 |}
25377 </p>
25378 !! wikitext
25379 <nowiki>{|</nowiki>
25380 |}
25381 !! end
25382
25383 !! test
25384 Tables: 1b. No escaping needed
25385 !! options
25386 parsoid=html2wt
25387 !! html/parsoid
25388 <p>!foo
25389 </p>
25390 !! wikitext
25391 !foo
25392 !! end
25393
25394 !! test
25395 Tables: 1c. No escaping needed
25396 !! options
25397 parsoid=html2wt
25398 !! html/parsoid
25399 <p>|foo
25400 </p>
25401 !! wikitext
25402 |foo
25403 !! end
25404
25405 !! test
25406 Tables: 1d. No escaping needed
25407 !! options
25408 parsoid=html2wt
25409 !! html/parsoid
25410 <p>|}foo
25411 </p>
25412 !! wikitext
25413 |}foo
25414 !! end
25415
25416 !! test
25417 Tables: 2a. Nested in td
25418 !! options
25419 parsoid=html2wt
25420 !! html/parsoid
25421 <table><tbody><tr>
25422 <td>foo|bar</td></tr>
25423 <tr><td>x<div>a|b</div></td>
25424 </tbody></table>
25425 !! wikitext
25426 {|
25427 |<nowiki>foo|bar</nowiki>
25428 |-
25429 |x<div><nowiki>a|b</nowiki></div>
25430 |}
25431 !! html/php+tidy
25432 <table>
25433 <tbody><tr>
25434 <td>foo|bar
25435 </td></tr>
25436 <tr>
25437 <td>x<div>a|b</div>
25438 </td></tr></tbody></table>
25439 !! end
25440
25441 !! test
25442 Tables: 2b. Nested in td
25443 !! options
25444 parsoid=html2wt
25445 !! html/parsoid
25446 <table><tbody><tr>
25447 <td>foo||bar</td>
25448 <td>a<i>b||c</i></td>
25449 <td>a<i><div>b||c</div></i></td>
25450 </tr></tbody></table>
25451 !! wikitext
25452 {|
25453 |<nowiki>foo||bar</nowiki>
25454 |a''<nowiki>b||c</nowiki>''
25455 |a''<div><nowiki>b||c</nowiki></div>''
25456 |}
25457 !! html/php
25458 <table>
25459 <tr>
25460 <td>foo||bar
25461 </td>
25462 <td>a<i>b||c</i>
25463 </td>
25464 <td>a<i><div>b||c</div></i>
25465 </td></tr></table>
25466
25467 !! end
25468
25469 !! test
25470 Tables: 2c. Nested in td -- no escaping needed
25471 !! options
25472 parsoid=html2wt
25473 !! html/*
25474 <table>
25475 <tr>
25476 <td>foo!!bar
25477 </td></tr></table>
25478
25479 !! wikitext
25480 {|
25481 |foo!!bar
25482 |}
25483 !! end
25484
25485 !! test
25486 Tables: 3a. Nested in th
25487 !! options
25488 parsoid=html2wt
25489 !! html/*
25490 <table>
25491 <tr>
25492 <th>foo!bar
25493 </th></tr></table>
25494
25495 !! wikitext
25496 {|
25497 !foo!bar
25498 |}
25499 !! end
25500
25501 !! test
25502 Tables: 3b. Nested in th
25503 !! options
25504 parsoid=html2wt
25505 !! html/parsoid
25506 <table><tbody>
25507 <tr><th>foo!!bar</th>
25508 <th><i>foo|bar</i></th>
25509 <th><i>foo!!bar</i></th>
25510 <th><i><span>foo!!bar</span></i></th>
25511 </tr></tbody></table>
25512 !! wikitext
25513 {|
25514 !<nowiki>foo!!bar</nowiki>
25515 !''<nowiki>foo|bar</nowiki>''
25516 !''<nowiki>foo!!bar</nowiki>''
25517 !''<span><nowiki>foo!!bar</nowiki></span>''
25518 |}
25519 !! html/php
25520 <table>
25521 <tr>
25522 <th>foo!!bar
25523 </th>
25524 <th><i>foo|bar</i>
25525 </th>
25526 <th><i>foo!!bar</i>
25527 </th>
25528 <th><i><span>foo!!bar</span></i>
25529 </th></tr></table>
25530
25531 !! end
25532
25533 !! test
25534 Tables: 3c. Nested in th
25535 !! options
25536 parsoid=html2wt
25537 !! html/parsoid
25538 <table><tbody>
25539 <tr><th>foo||bar</th>
25540 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25541 </tr></tbody></table>
25542 !! wikitext
25543 {|
25544 !<nowiki>foo||bar</nowiki>
25545 !<nowiki>foo||bar</nowiki>
25546 |}
25547 !! html/php
25548 <table>
25549 <tr>
25550 <th>foo||bar
25551 </th>
25552 <th>foo||bar
25553 </th></tr></table>
25554
25555 !! end
25556
25557 !! test
25558 Tables: 4a. Escape -
25559 !! options
25560 parsoid=html2wt
25561 !! html/*
25562 <table>
25563 <tr>
25564 <th>-bar
25565 </th></tr>
25566 <tr>
25567 <td>-bar
25568 </td></tr></table>
25569
25570 !! wikitext
25571 {|
25572 !-bar
25573 |-
25574 |<nowiki>-bar</nowiki>
25575 |}
25576 !! end
25577
25578 !! test
25579 Tables: 4b. Escape +
25580 !! options
25581 parsoid=html2wt
25582 !! html/*
25583 <table>
25584 <tr>
25585 <th>+bar
25586 </th></tr>
25587 <tr>
25588 <td>+bar
25589 </td></tr></table>
25590
25591 !! wikitext
25592 {|
25593 !+bar
25594 |-
25595 |<nowiki>+bar</nowiki>
25596 |}
25597 !! end
25598
25599 !! test
25600 Tables: 4c. No escaping needed
25601 !! options
25602 parsoid=html2wt
25603 !! html/parsoid
25604 <table><tbody>
25605 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25606 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25607 <tr><td>foo
25608 <p>bar|baz
25609 +bar
25610 -bar</p></td></tr>
25611 <tr><td>x
25612 <div>a|b</div></td>
25613 </tbody></table>
25614 !! wikitext
25615 {|
25616 |foo-bar
25617 |foo+bar
25618 |-
25619 |''foo''-bar
25620 |''foo''+bar
25621 |-
25622 |foo
25623 bar|baz
25624 +bar
25625 -bar
25626 |-
25627 |x
25628 <div>a|b</div>
25629 |}
25630 !! html/php
25631 <table>
25632 <tr>
25633 <td>foo-bar
25634 </td>
25635 <td>foo+bar
25636 </td></tr>
25637 <tr>
25638 <td><i>foo</i>-bar
25639 </td>
25640 <td><i>foo</i>+bar
25641 </td></tr>
25642 <tr>
25643 <td>foo
25644 <p>bar|baz
25645 +bar
25646 -bar
25647 </p>
25648 </td></tr>
25649 <tr>
25650 <td>x
25651 <div>a|b</div>
25652 </td></tr></table>
25653
25654 !! end
25655
25656 !! test
25657 Tables: 4d. No escaping needed
25658 !! options
25659 parsoid=html2wt
25660 !! html/parsoid
25661 <table>
25662 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25663 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25664 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25665 </tbody></table>
25666 !! wikitext
25667 {|
25668 |[[Foo]]-bar
25669 ||+1
25670 ||-2
25671 |}
25672 !! html/php
25673 <table>
25674 <tr>
25675 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25676 </td>
25677 <td>+1
25678 </td>
25679 <td>-2
25680 </td></tr></table>
25681
25682 !! end
25683
25684 !! test
25685 T97430: Don't emit empty nowiki pairs around marker meta tags
25686 !! options
25687 parsoid=html2wt
25688 !! html/parsoid
25689 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25690 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25691 !! wikitext
25692 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25693 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25694 !! end
25695
25696 !! test
25697 Unclosed xmlish element in table line shouldn't eat end delimiters
25698 !! options
25699 parsoid=html2wt
25700 !! html/parsoid
25701 <table>
25702 <tbody><tr><td> &lt;foo</td>
25703 <td> bar></td></tr>
25704 </tbody></table>
25705 !! wikitext
25706 {|
25707 | <foo
25708 | bar>
25709 |}
25710 !! html/php
25711 <table>
25712 <tr>
25713 <td>&lt;foo
25714 </td>
25715 <td>bar&gt;
25716 </td></tr></table>
25717
25718 !! end
25719
25720 #### --------------- Links ----------------
25721 #### 1. Quote marks in link text
25722 #### 2. Wikilinks: Escapes needed
25723 #### 3. Wikilinks: No escapes needed
25724 #### 4. Extlinks: Escapes needed
25725 #### 5. Extlinks: No escapes needed
25726 #### --------------------------------------
25727 !! test
25728 Links 1. WikiLinks: No escapes needed
25729 !! options
25730 parsoid=html2wt
25731 !! html/parsoid
25732 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25733 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25734 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25735 !! wikitext
25736 [[Foo|Foo''boo'']]
25737 [[Foo|[Foobar]]]
25738 [[Foo|x [Foobar] x]]
25739 !! html/php
25740 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25741 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25742 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25743 </p>
25744 !! end
25745
25746 !! test
25747 Links 2. WikiLinks: Escapes needed
25748 !! options
25749 parsoid=html2wt
25750 !! html/parsoid
25751 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25752 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25753 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25754 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25755 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25756 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25757 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25758 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25759 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25760 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25761 !! wikitext
25762 [[Foo|<nowiki>Foobar]</nowiki>]]
25763 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25764 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25765 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25766 [[Foo|<nowiki>|Bar</nowiki>]]
25767 [[Foo|<nowiki>]]bar</nowiki>]]
25768 [[Foo|<nowiki>[[bar</nowiki>]]
25769 [[Foo|<nowiki>x [[ y</nowiki>]]
25770 [[Foo|<nowiki>x ]] y</nowiki>]]
25771 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25772 !! html/php
25773 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25774 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25775 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25776 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25777 <a href="/wiki/Foo" title="Foo">|Bar</a>
25778 <a href="/wiki/Foo" title="Foo">]]bar</a>
25779 <a href="/wiki/Foo" title="Foo">[[bar</a>
25780 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25781 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25782 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25783 </p>
25784 !! end
25785
25786 !! test
25787 Links 3. WikiLinks: No escapes needed
25788 !! options
25789 parsoid=html2wt
25790 !! html/parsoid
25791 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25792 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25793 !! wikitext
25794 [[Foo|[Foobar]]
25795 [[Foo|foo|bar]]
25796 !! html/php
25797 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25798 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25799 </p>
25800 !! end
25801
25802 !! test
25803 Links 4. ExtLinks: Escapes needed
25804 !! options
25805 parsoid=html2wt
25806 !! html/parsoid
25807 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25808 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25809 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25810 <p>[http://google.com]</p>
25811 <p>[http://google.com google]</p>
25812 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25813 <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>
25814 !! wikitext
25815 [http://google.com <nowiki>[google]</nowiki>]
25816 [http://google.com <nowiki>google]</nowiki>]
25817 [http://google.com <nowiki>goog] le</nowiki>]
25818
25819 <nowiki>[http://google.com]</nowiki>
25820
25821 <nowiki>[http://google.com google]</nowiki>
25822
25823 [http://google.com<nowiki>]</nowiki>
25824
25825 [{{echo|http://google.com}}<nowiki>]</nowiki>
25826 !! html/php
25827 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25828 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25829 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25830 </p><p>[http://google.com]
25831 </p><p>[http://google.com google]
25832 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25833 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25834 </p>
25835 !! end
25836
25837 !! test
25838 Links 5. ExtLinks: No escapes needed
25839 !! options
25840 parsoid=html2wt
25841 !! html/parsoid
25842 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25843 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25844 !! wikitext
25845 [http://google.com [google]
25846
25847 [[http://google.com]]
25848 !! html/php
25849 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25850 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25851 </p>
25852 !! end
25853
25854 !! test
25855 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25856 !! options
25857 parsoid=html2wt
25858 !! html/parsoid
25859 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25860 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25861 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25862 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25863 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25864 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25865 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25866 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25867 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25868 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25869 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25870 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25871 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25872 </p>
25873 !! wikitext
25874 x<nowiki/>http://example.com<nowiki/>y
25875 http://example.com<nowiki/>?x
25876 http://example.com<nowiki/>&x
25877 http://example.com<nowiki/>'x
25878 http://example.com<nowiki/>,x
25879 http://example.com<nowiki/>.x
25880 http://example.com<nowiki/>;x
25881 http://example.com<nowiki/>:x
25882 http://example.com<nowiki/>;x
25883 http://example.com<nowiki/>!x
25884 http://example.com<nowiki/>=x
25885 http://example.com<nowiki/>(x)
25886 http://example.com(x<nowiki/>)
25887 !! end
25888
25889 !! test
25890 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25891 !! options
25892 parsoid=html2wt
25893 !! html/parsoid
25894 <p>x
25895 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25896 y
25897 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25898 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25899 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25900 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25901 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25902 </p>
25903 !! wikitext
25904 x
25905 http://example.com
25906 y
25907 "http://example.com"
25908 (http://example.com)
25909 (http://example.com) foo
25910 http://example.com,
25911 http://example.com, foo
25912 !! html/php
25913 <p>x
25914 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25915 y
25916 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25917 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25918 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25919 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25920 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25921 </p>
25922 !! end
25923
25924 !! test
25925 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25926 !! options
25927 parsoid=html2wt
25928 !! html/parsoid
25929 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25930 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25931 !! wikitext
25932 http://example.com.,;:!?\
25933 -http://example.com:
25934 !! html/php
25935 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25936 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25937 </p>
25938 !! end
25939
25940 !! test
25941 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25942 !! options
25943 parsoid=html2wt
25944 !! html/parsoid
25945 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25946 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25947 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25948 !! wikitext
25949 RFC 123<nowiki/>4
25950 RFC 123<nowiki/>y
25951 X<nowiki/>RFC 123<nowiki/>y
25952 !! end
25953
25954 !! test
25955 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25956 !! options
25957 parsoid=html2wt
25958 !! html/parsoid
25959 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25960 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25961 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25962 </p>
25963 !! wikitext
25964 RFC 123?foo
25965 RFC 123&foo
25966 -RFC 123-
25967 !! html/php
25968 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25969 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25970 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25971 </p>
25972 !! end
25973
25974 !! test
25975 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25980 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25981 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25982 !! wikitext
25983 PMID 123<nowiki/>4
25984 PMID 123<nowiki/>y
25985 X<nowiki/>PMID 123<nowiki/>y
25986 !! end
25987
25988 !! test
25989 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25990 !! options
25991 parsoid=html2wt
25992 !! html/parsoid
25993 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25994 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25995 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25996 </p>
25997 !! wikitext
25998 PMID 123?foo
25999 PMID 123&foo
26000 -PMID 123-
26001 !! html/php
26002 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26003 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26004 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26005 </p>
26006 !! end
26007
26008 !! test
26009 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26010 !! options
26011 parsoid=html2wt
26012 !! html/parsoid
26013 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26014 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26015 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26016 </p>
26017 !! wikitext
26018 ISBN 1234567890<nowiki/>1
26019 ISBN 1234567890<nowiki/>x
26020 a<nowiki/>ISBN 1234567890<nowiki/>b
26021 !! end
26022
26023 !! test
26024 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26025 !! options
26026 parsoid=html2wt
26027 !! html/parsoid
26028 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26029 !! wikitext
26030 -ISBN 1234567890's
26031 !! html/php
26032 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26033 </p>
26034 !! end
26035
26036 !! test
26037 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26038 !! options
26039 parsoid=html2wt
26040 !! html/*
26041 <p>this is not a link: http://example.com
26042 </p>
26043 !! wikitext
26044 this is not a link: <nowiki>http://example.com</nowiki>
26045 !! end
26046
26047 !! test
26048 Links 15. Link trails can't become link prefixes.
26049 !! options
26050 language=is
26051 parsoid=html2wt
26052 !! html/parsoid
26053 <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>
26054 !! wikitext
26055 [[Söfnuður]]-[[00]]
26056 !! html/php
26057 <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>
26058 </p>
26059 !! end
26060
26061 #### --------------- Quotes ---------------
26062 #### 1. Quotes inside <b> and <i>
26063 #### 2. Link fragments separated by <i> and <b> tags
26064 #### 3. Link fragments inside <i> and <b>
26065 #### 4. No escaping needed
26066 #### --------------------------------------
26067 !! test
26068 1a. Quotes inside <b> and <i>
26069 !! options
26070 parsoid=html2wt
26071 !! html/*
26072 <p><i>'foo'</i>
26073 <i>''foo''</i>
26074 <i>'''foo'''</i>
26075 <i>foo</i>'s
26076 <b>'foo'</b>
26077 <b>''foo''</b>
26078 <b>'''foo'''</b>
26079 <b>foo'<i>bar'</i>baz</b>
26080 <b>foo</b>'s
26081 '<i>foo</i>
26082 <i>foo</i>'
26083 <i>foo'</i>'
26084 '<i>foo</i>'
26085 '<b>foo</b>
26086 <b>foo</b>'
26087 '<b>foo</b>'
26088 <i>fools'<span> errand</span></i>
26089 <i><span>fool</span>'s errand</i>
26090 '<i>foo</i> bar '<i>baz</i>
26091 a|!*#-:;+-~[]{}b'<i>x</i>
26092 </p>
26093 !! wikitext
26094 ''<nowiki/>'foo'''
26095 ''<nowiki>''foo''</nowiki>''
26096 ''<nowiki>'''foo'''</nowiki>''
26097 ''foo''<nowiki/>'s
26098 '''<nowiki/>'foo''''
26099 '''<nowiki>''foo''</nowiki>'''
26100 '''<nowiki>'''foo'''</nowiki>'''
26101 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26102 '''foo'''<nowiki/>'s
26103 '''foo''
26104 ''foo''<nowiki/>'
26105 ''foo'''<nowiki/>'
26106 '''foo''<nowiki/>'
26107 ''''foo'''
26108 '''foo'''<nowiki/>'
26109 ''''foo'''<nowiki/>'
26110 ''fools'<span> errand</span>''
26111 ''<span>fool</span>'s errand''
26112 '<nowiki/>''foo'' bar '''baz''
26113 a|!*#-:;+-~[]{}b'''x''
26114 !! end
26115
26116 !! test
26117 1b. Quotes inside <b> and <i> with other tags on same line
26118 !! options
26119 parsoid=html2wt
26120 !! html/parsoid
26121 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26122 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26123 <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>
26124 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26125 '<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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
26126 '<i>foo</i> <div title="name">test</div>
26127 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26128 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26129 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
26130 </ol>
26131 !! wikitext
26132 '''a'' foo ''[[bar]]''
26133 ''a''' foo ''[[bar]]''
26134 ''a''' foo '''{{echo|[[bar]]}}'''
26135 [[foo]] x'''[[bar]]''
26136 '''foo'' <ref>test</ref>
26137 '''foo'' <div title="name">test</div>
26138 '''foo'' and <br> bar
26139 <references />
26140 !! end
26141
26142 !! test
26143 2. Link fragments separated by <i> and <b> tags
26144 !! options
26145 parsoid=html2wt
26146 !! html/parsoid
26147 <p>[[<i>foo</i>hello]]</p>
26148 <p>[[<b>foo</b>hello]]</p>
26149 !! wikitext
26150 [[''foo''<nowiki>hello]]</nowiki>
26151
26152 [['''foo'''<nowiki>hello]]</nowiki>
26153 !! end
26154
26155 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26156 # this is one of the shortcomings of this format
26157 !! test
26158 3. Link fragments inside <i> and <b>
26159 !! options
26160 parsoid=html2wt
26161 !! html/parsoid
26162 <p><i>[[foo</i>]]</p>
26163 <p><b>[[foo</b>]]</p>
26164 !! wikitext
26165 ''[[foo''<nowiki>]]</nowiki>
26166
26167 '''[[foo'''<nowiki>]]</nowiki>
26168 !! end
26169
26170 !! test
26171 4. No escaping needed
26172 !! options
26173 parsoid=html2wt
26174 !! html/parsoid
26175 <p>'<span><i>bar</i></span>'
26176 '<span><b>bar</b></span>'
26177 'a:b'foo
26178 </p>
26179 !! wikitext
26180 '<span>''bar''</span>'
26181 '<span>'''bar'''</span>'
26182 'a:b'foo
26183 !! end
26184
26185 #### ----------- Paragraphs ---------------
26186 #### 1. No unnecessary escapes
26187 #### --------------------------------------
26188
26189 !! test
26190 1. No unnecessary escapes
26191 !! options
26192 parsoid=html2wt
26193 !! html/parsoid
26194 <p>bar <span>[[foo]]</span>
26195 </p><p>=bar <span>[[foo]]</span>
26196 </p><p>[[bar <span>[[foo]]</span>
26197 </p><p>]]bar <span>[[foo]]</span>
26198 </p><p>=bar <span>foo]]</span>=
26199 </p>
26200 !! wikitext
26201 bar <span><nowiki>[[foo]]</nowiki></span>
26202
26203 =bar <span><nowiki>[[foo]]</nowiki></span>
26204
26205 [[bar <span><nowiki>[[foo]]</nowiki></span>
26206
26207 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26208
26209 =bar <span>foo]]</span><nowiki>=</nowiki>
26210 !!end
26211
26212 #### ----------------------- PRE --------------------------
26213 #### 1. Leading whitespace in SOL context should be escaped
26214 #### ------------------------------------------------------
26215 !! test
26216 1. Leading whitespace in SOL context should be escaped
26217 !! options
26218 parsoid=html2wt
26219 !! html/parsoid
26220 <p> a</p>
26221
26222 <p> a</p>
26223
26224 <p> a(tab)</p>
26225
26226 <p> a
26227 <!--cmt-->
26228 a</p>
26229
26230 <p>a
26231 b</p>
26232
26233 <p>a
26234 b</p>
26235
26236 <p>a
26237 b</p>
26238 !! wikitext
26239 <nowiki> </nowiki>a
26240
26241 <nowiki> </nowiki> a
26242
26243 a(tab)
26244
26245 <nowiki> </nowiki> a
26246 <!--cmt-->
26247 <nowiki> </nowiki>a
26248
26249 a
26250 <nowiki> </nowiki>b
26251
26252 a
26253 b
26254
26255 a
26256 b
26257 !! html/php
26258 <p> a
26259 </p><p> a
26260 </p><p> a(tab)
26261 </p><p> a
26262 a
26263 </p><p>a
26264 b
26265 </p><p>a
26266 b
26267 </p><p>a
26268 b
26269 </p>
26270 !! end
26271
26272 !! test
26273 2. Leading whitespace in non-indent-pre contexts should not be escaped
26274 !! options
26275 parsoid=html2wt
26276 !! html/parsoid
26277 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
26278 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26279 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
26280 b</span></li>
26281 </ol>
26282 !! wikitext
26283 foo <ref>''a''
26284 b</ref>
26285 <references />
26286 !! end
26287
26288 !! test
26289 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26290 !! options
26291 parsoid=html2wt
26292 !! html/parsoid
26293 <blockquote>
26294 <p>
26295 a
26296 <span>b</span>
26297 c</p>
26298 </blockquote>
26299 !! wikitext
26300 <blockquote>
26301 a
26302 <span>b</span>
26303 c
26304 </blockquote>
26305 !! end
26306
26307 !! test
26308 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26309 !! options
26310 parsoid=html2wt
26311 !! html/parsoid
26312 <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>
26313 !! wikitext
26314 [[File:Foobar.jpg|thumb|caption]]
26315 !! end
26316
26317 !! test
26318 5. Nowiki escaping should account for indent-pres
26319 !! options
26320 parsoid=html2wt
26321 !! html/parsoid
26322 <pre>==foo==</pre>
26323 !! wikitext
26324 ==foo==
26325 !! end
26326
26327 !!test
26328 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26329 !! options
26330 parsoid=html2wt
26331 !! html/parsoid
26332 <pre>
26333 * foo
26334 * bar
26335 </pre>
26336 !! wikitext
26337 * foo
26338 * bar
26339 !! end
26340
26341 #### --------------- Behavior Switches --------------------
26342
26343 !! test
26344 1. Valid behavior switches should be escaped
26345 !! options
26346 parsoid=html2wt
26347 !! html/parsoid
26348 __TOC__
26349 <i>__TOC__</i>
26350 !! wikitext
26351 <nowiki>__TOC__</nowiki>
26352 ''<nowiki>__TOC__</nowiki>''
26353 !! end
26354
26355 !! test
26356 2. Invalid behavior switches should not be escaped
26357 !! options
26358 parsoid=html2wt
26359 !! html/parsoid
26360 __TOO__
26361 __|__
26362 !! wikitext
26363 __TOO__
26364 __|__
26365 !! end
26366
26367 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26368 !! test
26369 Behavior switches should be SOL-transparent
26370 !! options
26371 parsoid=html2wt
26372 !! html/parsoid
26373 <meta property="mw:PageProp/toc" />
26374
26375 <!-- this one's bogus -->
26376 <pre>__TOO__</pre>
26377
26378 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26379
26380 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26381 !! wikitext
26382 __TOC__
26383
26384 <!-- this one's bogus -->
26385 __TOO__
26386
26387 __TOC__ foo
26388
26389 __TOC__
26390 bar
26391 !! end
26392
26393 #### --------------- HTML tags ---------------
26394 #### 1. a tags
26395 #### 2. other tags
26396 #### 3. multi-line html tag
26397 #### 4. extension tags
26398 #### -----------------------------------------
26399 !! test
26400 1. a tags
26401 !! options
26402 parsoid=html2wt
26403 !! html/parsoid
26404 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26405 !! wikitext
26406 <a href="http://google.com">google</a>
26407 !! end
26408
26409 !! test
26410 2. other tags
26411 !! options
26412 parsoid=html2wt
26413 !! html/parsoid
26414 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26415 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26416 <li> &lt;td&gt;</li></ul>
26417
26418 !! wikitext
26419 * <nowiki><div>foo</div></nowiki>
26420 * <nowiki><div style="color:red">foo</div></nowiki>
26421 * <nowiki><td></nowiki>
26422 !! end
26423
26424 !! test
26425 3. multi-line html tag
26426 !! options
26427 parsoid=html2wt
26428 !! html/parsoid
26429 <p>&lt;div
26430 &gt;foo&lt;/div
26431 &gt;
26432 </p>
26433 !! wikitext
26434 <nowiki><div
26435 >foo</div
26436 ></nowiki>
26437 !! end
26438
26439 !! test
26440 4. extension tags
26441 !! options
26442 parsoid=html2wt
26443 !! html/parsoid
26444 <p>&lt;ref&gt;foo&lt;/ref&gt;
26445 </p><p>&lt;ref&gt;bar
26446 </p><p>baz&lt;/ref&gt;
26447 </p>
26448 !! wikitext
26449 <nowiki><ref>foo</ref></nowiki>
26450
26451 <nowiki><ref>bar</nowiki>
26452
26453 baz<nowiki></ref></nowiki>
26454 !! end
26455
26456 #### --------------- Others ---------------
26457 !! test
26458 Escaping nowikis
26459 !! options
26460 parsoid=html2wt
26461 !! html/parsoid
26462 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26463 </p>
26464 !! wikitext
26465 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26466 !! end
26467
26468 ## The quote-char in the input is necessary for triggering the bug
26469 !! test
26470 (T54035) Nowiki-escaping should not get tripped by " :" in text
26471 !! options
26472 parsoid=html2wt
26473 !! html/parsoid
26474 <p>foo's bar :</p>
26475 !! wikitext
26476 foo's bar :
26477 !! end
26478
26479 #----------- End of wikitext escaping tests --------------
26480
26481 !! test
26482
26483 Tag-like HTML structures are passed through as text
26484 !! wikitext
26485 <x y>
26486
26487 <x.y>
26488
26489 <x-y>
26490
26491 1>2
26492
26493 x<y
26494
26495 a>b
26496
26497 1<d e>f
26498 !! html
26499 <p>&lt;x y&gt;
26500 </p><p>&lt;x.y&gt;
26501 </p><p>&lt;x-y&gt;
26502 </p><p>1&gt;2
26503 </p><p>x&lt;y
26504 </p><p>a&gt;b
26505 </p><p>1&lt;d e&gt;f
26506 </p>
26507 !! end
26508
26509 !! test
26510 HTML tag with necessary entities in attributes
26511 !! wikitext
26512 <span title="&amp;amp;">foo</span>
26513 !! html
26514 <p><span title="&amp;amp;">foo</span>
26515 </p>
26516 !! end
26517
26518 !! test
26519 HTML tag with 'unnecessary' entity encoding in attributes
26520 !! wikitext
26521 <span title="&amp;">foo</span>
26522 !! html
26523 <p><span title="&amp;">foo</span>
26524 </p>
26525 !! end
26526
26527 !! test
26528 HTML tag with broken attribute value quoting
26529 !! options
26530 parsoid=wt2html,html2html
26531 !! wikitext
26532 <span title="Hello world>Foo</span>
26533 !! html/php
26534 <p><span title="Hello world">Foo</span>
26535 </p>
26536 !! html/parsoid
26537 <p><span title="Hello world">Foo</span></p>
26538 !! end
26539
26540 !! test
26541 Self-closed tag with broken attribute value quoting
26542 !! options
26543 parsoid=wt2html,html2html
26544 !! wikitext
26545 <div title="Hello world />Foo
26546 !! html/php+tidy
26547 <div title="Hello world"></div><p>Foo
26548 </p>
26549 !! html/parsoid
26550 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26551 !! end
26552
26553 !! test
26554 Table with broken attribute value quoting
26555 !! options
26556 parsoid=wt2html,html2html
26557 !! wikitext
26558 {|
26559 | title="Hello world|Foo
26560 |}
26561 !! html/php
26562 <table>
26563 <tr>
26564 <td title="Hello world">Foo
26565 </td></tr></table>
26566
26567 !! html/parsoid
26568 <table>
26569 <tr>
26570 <td title="Hello world">Foo
26571 </td></tr></table>
26572
26573 !! end
26574
26575 !! test
26576 Table with broken attribute value quoting on consecutive lines
26577 !! options
26578 parsoid=wt2html,html2html
26579 !! wikitext
26580 {|
26581 | title="Hello world|Foo
26582 | style="color:red|Bar
26583 |}
26584 !! html/php
26585 <table>
26586 <tr>
26587 <td title="Hello world">Foo
26588 </td>
26589 <td style="color:red">Bar
26590 </td></tr></table>
26591
26592 !! html/parsoid
26593 <table><tbody>
26594 <tr>
26595 <td title="Hello world">Foo
26596 </td><td style="color: red">Bar
26597 </td></tr></tbody></table>
26598
26599 !! end
26600
26601 !!test
26602 Accept empty td cell attribute
26603 !! wikitext
26604 {|
26605 | align="center" |foo|| |
26606 |}
26607 !! html
26608 <table>
26609 <tr>
26610 <td align="center">foo</td>
26611 <td>
26612 </td></tr></table>
26613
26614 !!end
26615
26616 !!test
26617 Non-empty attributes in th-cells
26618 !! wikitext
26619 {|
26620 !Foo!! style="color: red" |Bar
26621 |}
26622 !! html
26623 <table>
26624 <tr>
26625 <th>Foo</th>
26626 <th style="color: red">Bar
26627 </th></tr></table>
26628
26629 !!end
26630
26631 !!test
26632 Accept empty attributes in th-cells
26633 !! wikitext
26634 {|
26635 !|foo!!|bar
26636 |}
26637 !! html
26638 <table>
26639 <tr>
26640 <th>foo</th>
26641 <th>bar
26642 </th></tr></table>
26643
26644 !!end
26645
26646 !!test
26647 Empty table rows go away
26648 !! wikitext
26649 {|
26650 |Hello
26651 |there
26652 |- class="foo"
26653 |-
26654 |}
26655 !! html
26656 <table>
26657 <tr>
26658 <td>Hello
26659 </td>
26660 <td>there
26661 </td></tr>
26662
26663 </table>
26664
26665 !! end
26666
26667 ###
26668 ### Parsoid-centric tests for testing RTing of inter-element separators
26669 ### Edge cases not tested by existing parser tests and specific to
26670 ### Parsoid-specific serialization strategies.
26671 ###
26672
26673 !!test
26674 RT-ed inter-element separators should be valid separators
26675 !! wikitext
26676 {|
26677 |- [[foo]]
26678 |}
26679 !! html/php
26680 <table>
26681
26682 </table>
26683
26684 !! html/parsoid
26685 <table>
26686 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26687 </tbody></table>
26688 !!end
26689
26690 # Parsoid-only test of a DOM pass
26691 !!test
26692 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26693 !! wikitext
26694 {|
26695 |<small>foo
26696 bar
26697 |}
26698
26699 {|
26700 |<small>foo<small>
26701 |}
26702 !! html/parsoid
26703 <table>
26704 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26705 <p>bar</p></small></td></tr>
26706 </tbody></table>
26707
26708 <table>
26709 <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>
26710 </tbody></table>
26711 !!end
26712
26713 # Note that the "style" attribute is really a template parameter here.
26714 # The = would have to be {{=}} if you wanted the literal.
26715 !!test
26716 Empty TD followed by TD with tpl-generated attribute
26717 !! wikitext
26718 {|
26719 |-
26720 |
26721 |{{echo|style='color:red'}}|foo
26722 |}
26723 !! html
26724 <table>
26725
26726 <tr>
26727 <td>
26728 </td>
26729 <td>foo
26730 </td></tr></table>
26731
26732 !!end
26733
26734 !!test
26735 Indented table with an empty td
26736 !! wikitext
26737 {|
26738 |-
26739 |
26740 |foo
26741 |}
26742 !! html
26743 <table>
26744
26745 <tr>
26746 <td>
26747 </td>
26748 <td>foo
26749 </td></tr></table>
26750
26751 !!end
26752
26753 ## We have some newline diffs RT-ing this edge case
26754 ## and it is not important enough -- we seem to be emitting
26755 ## at most 2 newlines after a </tr> and this is unrelated to
26756 ## the issue from T85627 that this is testing.
26757 !!test
26758 Indented table with blank lines in between (T85627)
26759 !! options
26760 parsoid=wt2html
26761 !! wikitext
26762 {|
26763 |foo
26764
26765
26766 |}
26767 !! html
26768 <table>
26769
26770 <tr>
26771 <td>foo
26772 </td></tr></table>
26773
26774 !!end
26775
26776 !!test
26777 Indented block & table
26778 !! wikitext
26779 <div>foo</div>
26780 {|
26781 |foo
26782 |}
26783 !! html/php
26784 <div>foo</div>
26785 <table>
26786 <tr>
26787 <td>foo
26788 </td></tr></table>
26789
26790 !! html/parsoid
26791 <div data-parsoid='{"stx":"html"}'>foo</div>
26792 <table><tbody>
26793 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26794 </tbody></table>
26795 !!end
26796
26797 !! test
26798 Indent and comment before table row
26799 !! wikitext
26800 {|
26801 <!--hi-->|-
26802 |there
26803 |}
26804 !! html/php
26805 <table>
26806
26807 <tr>
26808 <td>there
26809 </td></tr></table>
26810
26811 !! html/parsoid
26812 <table>
26813 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26814 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26815 </tbody></table>
26816 !! end
26817
26818 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26819 !!test
26820 Empty TR followed by a template-generated TR
26821 !!options
26822 parsoid
26823 !! wikitext
26824 {|
26825 |-
26826 {{echo|<tr><td>foo</td></tr>}}
26827 |}
26828 !! html
26829 <table>
26830 <tbody>
26831 <tr class='mw-empty-elt'></tr>
26832 <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}}]}'>
26833 <td>foo</td></tr>
26834 </tbody></table>
26835 !!end
26836
26837 ## PHP and parsoid output differ for this, and since this is primarily
26838 ## for testing Parsoid's serializer, marking this Parsoid only
26839 !!test
26840 Empty TR followed by mixed-ws-comment line should RT correctly
26841 !!options
26842 parsoid
26843 !! wikitext
26844 {|
26845 |-
26846 <!--c-->
26847 |-
26848 <!--c--> <!--d-->
26849 |}
26850 !! html
26851 <table>
26852 <tbody>
26853 <tr class='mw-empty-elt'></tr>
26854 <!--c-->
26855 <tr>
26856 <!--c--> </tr><!--d-->
26857 </tbody></table>
26858
26859 !!end
26860
26861 !!test
26862 Multi-line image caption generated by templates with/without trailing newlines
26863 !! wikitext
26864 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26865 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26866 !! html/parsoid
26867 <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>
26868 <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>
26869 !!end
26870
26871 !! test
26872 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26873 !! options
26874 parsoid=html2wt
26875 !! html/parsoid
26876 <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>
26877
26878 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26879 !! wikitext
26880 <includeonly>foo</includeonly>
26881 new para
26882
26883 [[Category:Foo]]
26884
26885 = new heading =
26886 !! end
26887
26888 ## PHP emits broken html for this, and since this is primarily
26889 ## a Parsoid serializer test, marking this Parsoid only
26890 !!test
26891 Improperly nested inline or quotes tags with whitespace in between
26892 !! wikitext
26893 <span> <s>x</span> </s>
26894 ''' ''x''' ''
26895 !! html/parsoid
26896 <p><span> <s>x</s></span><s> </s>
26897 <b> <i>x</i></b><i> </i>
26898 </p>
26899 !!end
26900
26901 !!test
26902 Encapsulate protected attributes from wt
26903 !! wikitext
26904 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26905
26906 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26907 | ok
26908 |}
26909 !! html/parsoid
26910 <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>
26911
26912 <table 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">
26913 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26914 </tbody></table>
26915 !!end
26916
26917 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26918 ## Having nested or stray pre tags results in the attempt to add duplicates,
26919 ## causing an assertion fail. This test tries to prevent that situation.
26920 !!test
26921 Ensure ParagraphWrapper can deal with stray closing pre tags
26922 !!options
26923 parsoid=wt2html
26924 !! wikitext
26925 plain text</pre>
26926 !! html/parsoid
26927 plain text
26928 !!end
26929
26930 !!test
26931 1. Ensure fostered text content is wrapped in element nodes
26932 !!options
26933 parsoid=wt2html
26934 !! wikitext
26935 <table>hi</table><table>ho</table>
26936 !! html/parsoid
26937 <p>hi</p>
26938 <table></table>
26939 <p>ho</p>
26940 <table></table>
26941 !!end
26942
26943 !!test
26944 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26945 !!options
26946 parsoid=wt2html,wt2wt
26947 !! wikitext
26948 <table>
26949 <tr> || ||
26950 <td> a
26951 </table>
26952 !! html/parsoid
26953 <p> || ||
26954 </p><table>
26955 <tbody><tr><td> a</td></tr>
26956 </tbody></table>
26957 !!end
26958
26959 !!test
26960 Encapsulation properly handles null DSR information from foster box
26961 !!options
26962 parsoid=wt2html,wt2wt
26963 !! wikitext
26964 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26965 !! html/parsoid
26966 <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>
26967 !!end
26968
26969 !!test
26970 1. Encapsulate foster-parented transclusion content
26971 !!options
26972 parsoid=wt2wt,wt2html
26973 !! wikitext
26974 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26975 !! html/parsoid
26976 <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>
26977 <tbody>
26978 <tr>
26979 <td>bar</td>
26980 </tr>
26981 </tbody>
26982 </table>
26983 !!end
26984
26985 !!test
26986 2. Encapsulate foster-parented transclusion content
26987 !!options
26988 parsoid=wt2wt,wt2html
26989 !! wikitext
26990 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26991 !! html/parsoid
26992 <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>
26993 <table>
26994 <tbody>
26995 <tr>
26996 <td>bar</td>
26997 </tr>
26998 </tbody>
26999 </table>
27000 !!end
27001
27002 !!test
27003 3. Encapsulate foster-parented transclusion content
27004 !!options
27005 parsoid=wt2wt,wt2html
27006 !! wikitext
27007 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27008 !! html/parsoid
27009 <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;]}">
27010 <p>foo</p>
27011 </div>
27012 <table>
27013 <tbody>
27014 <tr>
27015 <td>bar</td>
27016 </tr>
27017 </tbody>
27018 </table>
27019 !!end
27020
27021 !!test
27022 4. Encapsulate foster-parented transclusion content
27023 !!options
27024 parsoid=wt2wt,wt2html
27025 !! wikitext
27026 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27027 !! html/parsoid
27028 <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;]}">
27029 <p>foo</p>
27030 </div>
27031 <table>
27032 <tbody>
27033 <tr>
27034 <td>bar</td>
27035 </tr>
27036 </tbody>
27037 </table>
27038 !!end
27039
27040 !!test
27041 5. Encapsulate foster-parented transclusion content
27042 !!options
27043 parsoid=wt2wt,wt2html
27044 !! wikitext
27045 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27046 !! html/parsoid
27047 <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>
27048 <table>
27049 <tbody>
27050 <tr>
27051 <td>
27052 <div>
27053 <p>foo</p>
27054 </div>
27055 </td>
27056 </tr>
27057 </tbody>
27058 </table>
27059 !!end
27060
27061 !!test
27062 6. Encapsulate foster-parented transclusion content
27063 !!options
27064 parsoid=wt2wt,wt2html
27065 !! wikitext
27066 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27067 !! html/parsoid
27068 <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>
27069 <table>
27070 <tbody>
27071 <tr>
27072 <td>
27073 <div>
27074 <p>foo</p>
27075 </div>
27076 </td>
27077 </tr>
27078 </tbody>
27079 </table>
27080 <p>ok</p>
27081 !!end
27082
27083 !!test
27084 7. Encapsulate foster-parented transclusion content
27085 !!options
27086 parsoid=wt2wt,wt2html
27087 !! wikitext
27088 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27089 !! html/parsoid
27090 <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>
27091 <table>
27092 <tbody>
27093 <tr>
27094 <td>bar</td>
27095 </tr>
27096 </tbody>
27097 </table>
27098 !!end
27099
27100 # Note that the wt is broken on purpose: the = should be {{=}} if you
27101 # don't want it to be a template parameter key.
27102 !!test
27103 8. Encapsulate foster-parented transclusion content
27104 !!options
27105 parsoid=wt2wt,wt2html
27106 !! wikitext
27107 {{echo|a
27108 }}{|{{echo|style='color:red'}}
27109 |-
27110 |b
27111 |}
27112 !! html/parsoid
27113 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27114 <span> </span>
27115 <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>
27116 <table>
27117 <tbody>
27118 <tr>
27119 <td>b</td>
27120 </tr>
27121 </tbody>
27122 </table>
27123 !!end
27124
27125 !!test
27126 9. Encapsulate foster-parented transclusion content
27127 !!options
27128 parsoid=wt2wt,wt2html
27129 !! wikitext
27130 <table>{{echo|hi</table>hello}}
27131 !! html/parsoid
27132 <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>
27133 !!end
27134
27135 !!test
27136 Table in fosterable position
27137 !!options
27138 parsoid=wt2html
27139 !! wikitext
27140 {{OpenTable}}
27141 <div>
27142 {|
27143 |}
27144 </div>
27145 |}
27146 !! html/parsoid
27147 <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">
27148 </span>
27149 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27150
27151 <table>
27152 </table>
27153 !!end
27154
27155 # Parsoid only for T66747
27156 !! test
27157 Properly encapsulate empty-content transclusions in fosterable positions
27158 !! wikitext
27159 <table>
27160 {{#if:|
27161 <td>foo</td>
27162 }}
27163 </table>
27164 !! html/parsoid
27165 <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"}]]}'>
27166
27167 </table>
27168 !! end
27169
27170 !! test
27171 Always encapsulate foster box when template range is expanded to table
27172 !! options
27173 parsoid=wt2wt
27174 !! wikitext
27175 {|
27176 hello
27177 {{OpenTable}}
27178 |}
27179 !! html/parsoid
27180
27181 !! end
27182
27183 !! test
27184 T115289: Unclosed table
27185 !! wikitext
27186 {{echo|<table>}}<!--c-->[[Category:Two]]
27187 !! html/parsoid
27188 <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>
27189 !! end
27190
27191 !! test
27192 T115289: Don't migrate newlines out of tables with fostered content
27193 !! wikitext
27194 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27195 !! html/parsoid
27196 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
27197 !! end
27198
27199 !! test
27200 T73074: More fostering fun
27201 !! wikitext
27202 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27203 !! html/parsoid
27204 <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>
27205 !! end
27206
27207 !!test
27208 Support <object> element with .data attribute
27209 !!options
27210 parsoid=html2wt
27211 !! html/parsoid
27212 <object data="test.swf"></object>
27213 !! wikitext
27214 <object data="test.swf"></object>
27215 !!end
27216
27217 !! test
27218 Don't block XML namespace declaration
27219 !! wikitext
27220 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27221 !! html/php
27222 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27223 </p>
27224 !! html/parsoid
27225 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27226 !! end
27227
27228 # -----------------------------------------------------------------
27229 # The following section of tests are primarily to spec requirements
27230 # around Parsoid's serialization (old, new, edited content)
27231 #
27232 # All these tests are marked Parsoid html2wt and html2html only
27233 # ----------------------------------------------------------------
27234
27235 !! test
27236 Ignore rel attribute in a-tags during serialization to url-links
27237 !! options
27238 parsoid=html2wt
27239 !! html/parsoid
27240 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27241 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27242 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27243 !! wikitext
27244 http://en.wikipedia.org/wiki/Foobar
27245 http://en.wikipedia.org/wiki/Foobar
27246 http://en.wikipedia.org/wiki/Foobar
27247 !! end
27248
27249 # 'mi' is a localinterwiki prefix as well as a language
27250 !! test
27251 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27252 !! options
27253 parsoid=html2wt
27254 !! html/parsoid
27255 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27256 !! wikitext
27257 [[Foo]]
27258 !! end
27259
27260 !! test
27261 Parsoid should accept interwiki shortcuts
27262 !! options
27263 parsoid=html2wt
27264 !! html/parsoid
27265 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27266 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27267 <a href='./fr:Foo'>Foo</a></p>
27268 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27269 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27270 <a href='fr%3AFoo'>Foo</a></p>
27271 <p><a href='FR%3AFoo'>Foo</a>
27272 <a href='./FR:Foo'>Foo</a></p>
27273 !! wikitext
27274 [[:fr:Foo|Foo]]
27275 [[:fr:Foo|Foo]]
27276 [[:fr:Foo|Foo]]
27277
27278 [[:fr:Foo|Foo]]
27279 [[:fr:Foo|Foo]]
27280 [[:fr:Foo|Foo]]
27281
27282 [[:fr:Foo|Foo]]
27283 [[:fr:Foo|Foo]]
27284 !! end
27285
27286 !! test
27287 Parsoid should not accept invalid interwiki shortcuts
27288 !! options
27289 parsoid=html2wt
27290 !! html/parsoid
27291 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27292 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27293 <a href='news:Foo'>Foo</a></p>
27294 !! wikitext
27295 [news:Foo Foo]
27296 [news:Foo Foo]
27297 [news:Foo Foo]
27298 !! end
27299
27300 # See T93839
27301 !! test
27302 New wikilinks should be serialized properly
27303 !! options
27304 parsoid=html2wt
27305 !! html/parsoid
27306 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27307 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27308 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27309 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27310 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27311 !! wikitext
27312 [[Foo]]
27313 [[Foo]]
27314 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27315 http://en.wikipedia.org/wiki/Foo
27316 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27317 !! end
27318
27319 !! test
27320 New wiki links (href variations)
27321 !! options
27322 parsoid=html2wt
27323 !! html/parsoid
27324 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27325 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27326 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27327 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27328 !! wikitext
27329 [[Foo_bar]]
27330 [[Foo_bar]]
27331 [[Foo_bar]]
27332 [[Toxine bactérienne]]
27333 !! end
27334
27335 !! test
27336 New wiki links (content string variations)
27337 !! options
27338 parsoid=html2wt
27339 !! html/parsoid
27340 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27341 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27342 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27343 !! wikitext
27344 [[Foo_bar]]
27345 [[Foo bar]]
27346 [[Foo_bar|./Foo_bar]]
27347 !! end
27348
27349 !! test
27350 New category links (href variations)
27351 !! options
27352 parsoid=html2wt
27353 !! html/parsoid
27354 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27355 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27356 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27357 !! wikitext
27358 [[Category:Toxine bactérienne]]
27359 [[Category:Toxine bactérienne]]
27360 [[Category:Toxine bactérienne]]
27361 !! end
27362
27363 !! test
27364 New sol transparent links don't need indent-pre nowiki protection
27365 !! options
27366 parsoid=html2wt
27367 language=de
27368 !! html/parsoid
27369 <link rel="mw:PageProp/redirect" href="./Main_Page">
27370 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27371 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27372 !! wikitext
27373 #WEITERLEITUNG [[Main Page]]
27374 <!-- this is good --> [[Category:Good]]
27375 <!-- this is great --> [[Kategorie:Great]]
27376 !! end
27377
27378 !! test
27379 New interlanguage links (href variations)
27380 !! options
27381 parsoid=html2wt
27382 !! html/parsoid
27383 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27384 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27385 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27386 !! wikitext
27387 [[es:Toxine bactérienne]]
27388 [[es:Toxine_bactérienne]]
27389 [[es:Toxine_bactérienne]]
27390 !! end
27391
27392 !! test
27393 Image: Modifying size of an image (1)
27394 !! options
27395 parsoid={
27396 "modes": ["wt2wt"],
27397 "changes": [
27398 ["img[height]", "attr", "height", "22"],
27399 ["img[width]", "attr", "width", "200"]
27400 ]
27401 }
27402 !! wikitext
27403 [[Image:Foobar.jpg|230x230px]]
27404 !! wikitext/edited
27405 [[Image:Foobar.jpg|200x200px]]
27406 !!end
27407
27408 !! test
27409 Image: Modifying size of an image (2)
27410 !! options
27411 parsoid={
27412 "modes": ["wt2wt"],
27413 "changes": [
27414 ["img[height]", "attr", "height", "100"],
27415 ["img[width]", "attr", "width", "500"]
27416 ]
27417 }
27418 !! wikitext
27419 [[Image:Foobar.jpg|230x230px]]
27420 !! wikitext/edited
27421 [[Image:Foobar.jpg|500x500px]]
27422 !!end
27423
27424 # Change in size is ignored so long as class='mw-default-size'
27425 !! test
27426 Image: Modifying size of an image (3)
27427 !! options
27428 parsoid={
27429 "modes": ["wt2wt"],
27430 "changes": [
27431 ["figure[class]", "removeClass", "mw-default-size"],
27432 ["figure img", "attr", "height", "19"],
27433 ["figure img", "attr", "width", "170"]
27434 ]
27435 }
27436 !! wikitext
27437 [[Image:Foobar.jpg|thumb]]
27438 !! wikitext/edited
27439 [[Image:Foobar.jpg|thumb|170x170px]]
27440 !!end
27441
27442 !! test
27443 Image: Modifying alignment of an image (T50665)
27444 !! options
27445 parsoid={
27446 "modes": ["wt2wt"],
27447 "changes": [
27448 ["figure[class]", "removeClass", "mw-halign-right"],
27449 ["figure[class]", "addClass", "mw-halign-left"]
27450 ]
27451 }
27452 !! wikitext
27453 [[Image:Foobar.jpg|thumb|caption|right]]
27454 !! wikitext/edited
27455 [[Image:Foobar.jpg|thumb|caption|left]]
27456 !! end
27457
27458 !! test
27459 Image: Modifying mw-default-size of an frameless image (T64805)
27460 !! options
27461 parsoid={
27462 "modes": ["wt2wt"],
27463 "changes": [
27464 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27465 ]
27466 }
27467 !! wikitext
27468 [[Image:Foobar.jpg|frameless|right]]
27469 !! wikitext/edited
27470 [[Image:Foobar.jpg|frameless|right|220x220px]]
27471 !! end
27472
27473 !! test
27474 Image: Modifying valign of an image (T51221)
27475 !! options
27476 parsoid={
27477 "modes": ["wt2wt"],
27478 "changes": [
27479 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27480 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27481 ]
27482 }
27483 !! wikitext
27484 [[File:Foobar.jpg|20px|middle]]
27485 !! wikitext/edited
27486 [[File:Foobar.jpg|20px|text-top]]
27487 !! end
27488
27489 !! test
27490 Image: Modifying alt attribute of an image (T58400)
27491 !! options
27492 parsoid={
27493 "modes": ["wt2wt"],
27494 "changes": [
27495 ["img[alt]", "attr", "alt", "some alternate edited text"]
27496 ]
27497 }
27498 !! wikitext
27499 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27500 !! wikitext/edited
27501 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27502 !!end
27503
27504 !! test
27505 Image: Modifying caption of an image
27506 !! options
27507 parsoid={
27508 "modes": ["wt2wt"],
27509 "changes": [
27510 ["figcaption", "text", "new caption"]
27511 ]
27512 }
27513 !! wikitext
27514 [[Image:Foobar.jpg|thumb|original caption]]
27515 !! wikitext/edited
27516 [[Image:Foobar.jpg|thumb|new caption]]
27517 !!end
27518
27519 !! test
27520 Image: empty alt attribute (T50924)
27521 !! options
27522 parsoid
27523 !! wikitext
27524 [[File:Foobar.jpg|thumb|alt=|bar]]
27525 !! html
27526 <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>
27527 !! end
27528
27529 !! test
27530 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27531 !! options
27532 parsoid=html2wt
27533 language=ar
27534 disabled
27535 !! html/parsoid
27536 <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>
27537 !! wikitext
27538 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27539 !! end
27540
27541 !! test
27542 Image: Block level image should have \n before and after
27543 !! wikitext
27544 123
27545 [[File:Foobar.jpg|right|thumb|150x150px]]
27546 456
27547 !! html/parsoid
27548 <p>123</p>
27549 <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>
27550 <p>456</p>
27551 !! end
27552
27553 !! test
27554 Image: New block level image should have \n before and after (existing content)
27555 !! wikitext
27556 123
27557 [[File:Foobar.jpg|right|thumb|150x150px]]
27558 456
27559 !! html/parsoid
27560 <p>123</p>
27561 <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>
27562 <p>456</p>
27563 !! end
27564
27565 !! test
27566 Image: upright option (parsoid)
27567 !! wikitext
27568 [[File:Foobar.jpg|thumb|upright|caption]]
27569 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27570 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27571 !! html/parsoid
27572 <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>
27573 <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>
27574 <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>
27575 !! end
27576
27577 !! test
27578 Image: upright option is ignored on inline and frame images (parsoid)
27579 !! wikitext
27580 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27581 !! html/parsoid
27582 <p><figure-inline 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></figure-inline></p>
27583 !! end
27584
27585 !! test
27586 Image: in template parameter with empty parameter
27587 !! wikitext
27588 {{echo|[[File:Foobar.jpg|link=]]}}
27589 !! html/parsoid
27590 <p><figure-inline class="mw-default-size" typeof="mw:Transclusion mw:Image" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[File:Foobar.jpg|link=]]"}},"i":0}}]}'><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></figure-inline></p>
27591 !! end
27592
27593 !! test
27594 Image: from basic HTML (1)
27595 !! options
27596 parsoid=html2wt
27597 !! html/parsoid
27598 <span typeof="mw:Image">
27599 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27600 </span>
27601 !! wikitext
27602 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27603 !! end
27604
27605 !! test
27606 Image: from basic HTML (2)
27607 !! options
27608 parsoid=html2wt
27609 !! html/parsoid
27610 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27611 !! wikitext
27612 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27613 !! end
27614
27615 !! test
27616 Image: from basic HTML (3)
27617 !! options
27618 parsoid=html2wt
27619 !! html/parsoid
27620 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27621 !! wikitext
27622 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27623 !! end
27624
27625 !! test
27626 Image: from basic HTML (4)
27627 !! options
27628 parsoid=html2wt
27629 !! html/parsoid
27630 <img src="./File:Foobar.jpg">
27631 !! wikitext
27632 [[File:Foobar.jpg|link=]]
27633 !! end
27634
27635 !! test
27636 Image: Invalid title as link
27637 !! wikitext
27638 [[File:Foobar.jpg|link=<]]
27639 !! html/php
27640 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
27641 </p>
27642 !! html/parsoid
27643 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&amp;lt;"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
27644 !! end
27645
27646 !! test
27647 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27648 !! options
27649 parsoid=html2wt
27650 !! html/parsoid
27651 <ul>
27652 <li><p>foo</p></li>
27653 </ul>
27654 !! wikitext
27655 * foo
27656 !! end
27657
27658 !! test
27659 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27660 !! options
27661 parsoid=html2wt
27662 !! html/parsoid
27663 <ul> <li>foo</li></ul>
27664 !! wikitext
27665 * foo
27666 !! end
27667
27668 !! test
27669 Don't strip leading whitespace when handling indent-pre suppressing tags
27670 !! options
27671 parsoid=html2wt
27672 !! html/parsoid
27673 <table>
27674 <tr><td> indented row</td></tr>
27675 </table>
27676 <blockquote><p>
27677 <b>This is very bold of you!</b>
27678 </p>
27679 <table><tr><td>
27680 indented cell (no pre-wrapping!)
27681 </td></tr></table>
27682 </blockquote>
27683 <p>foo</p>
27684 <div>bar</div>
27685 !! wikitext
27686 {|
27687 | indented row
27688 |}
27689 <blockquote>
27690 '''This is very bold of you!'''
27691
27692 {|
27693 |
27694 indented cell (no pre-wrapping!)
27695 |}
27696 </blockquote>
27697 foo
27698 <div>bar</div>
27699 !! end
27700
27701 !! test
27702 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27703 !! options
27704 parsoid=html2wt
27705 !! html/parsoid
27706 <p>foo</p>
27707 <span>bar</span>
27708
27709 <span>foo2
27710 </span>bar2
27711
27712 <div>foo</div>
27713 <span>bar</span>
27714
27715 <div>
27716 <span>foo</span>
27717 </div>
27718 !! wikitext
27719 foo
27720
27721 <span>bar</span>
27722
27723 <span>foo2
27724 <nowiki> </nowiki></span>bar2
27725
27726 <div>foo</div>
27727 <nowiki> </nowiki><span>bar</span>
27728
27729 <div>
27730 <nowiki> </nowiki><span>foo</span>
27731 </div>
27732 !! end
27733
27734 !! test
27735 Lists: Dont insert newlines in a serialized list item.
27736 !! options
27737 parsoid=html2wt
27738 !! html/parsoid
27739 <ul><li>a<br>b</li><li>c</li></ul>
27740 !! wikitext
27741 * a<br />b
27742 * c
27743 !! end
27744
27745 !! test
27746 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27747 !! options
27748 parsoid={
27749 "modes": ["html2wt"],
27750 "scrubWikitext": false
27751 }
27752 !! html/parsoid
27753 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27754 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27755
27756 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27757 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27758
27759 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27760
27761 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27762 !! wikitext
27763 == hello there [[Category:A1]] ==
27764
27765 == [[Category:A2]] hi pal ==
27766
27767 == <!--foo--> [[Category:A3]] how goes it ==
27768
27769 == it goes well [[Category:A4]] <!--bar--> ==
27770
27771 ==howdy [[Category:A5]]==
27772
27773 == __TOC__ ok ==
27774 !! end
27775
27776 !! test
27777 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27778 !! options
27779 parsoid={
27780 "modes": ["html2wt"],
27781 "scrubWikitext": true
27782 }
27783 !! html/parsoid
27784 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27785 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27786
27787 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27788 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27789
27790 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27791 !! wikitext
27792 == hello there ==
27793 [[Category:A1]]
27794 [[Category:A2]]
27795
27796 == hi pal ==
27797
27798 <!--foo--> [[Category:A3]]
27799
27800 == how goes it ==
27801
27802 == it goes well ==
27803 [[Category:A4]] <!--bar-->
27804
27805 __TOC__
27806
27807 == ok ==
27808 !! end
27809
27810 !! test
27811 Headings: Don't hoist metas that come from templates
27812 !! options
27813 parsoid={
27814 "modes": ["html2wt"],
27815 "scrubWikitext": true
27816 }
27817 !! html/parsoid
27818 <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>
27819 !! wikitext
27820 == {{echo|foo [[Category:Foo]]}} ==
27821 !! end
27822
27823 !! test
27824 Headings: Category in ref isn't hoisted
27825 !! options
27826 parsoid={
27827 "modes": ["html2wt"],
27828 "scrubWikitext": true
27829 }
27830 !! html/parsoid
27831 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
27832
27833 <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="./Main_Page#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>
27834 !! wikitext
27835 == foo <ref>bar
27836 [[Category:Baz]] </ref> ==
27837
27838 <references />
27839 !! end
27840
27841 !! test
27842 Parsoid: Serialize positional parameters with = in them as named parameter
27843 !! options
27844 parsoid=html2wt
27845 !! html/parsoid
27846 <p about="#mwt1" typeof="mw:Transclusion"
27847 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27848
27849 <p about="#mwt1" typeof="mw:Transclusion"
27850 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27851
27852 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27853 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27854 <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>
27855 !! wikitext
27856 {{echo|1=f=oo}}
27857
27858 {{echo|1=f=oo|2=bar}}
27859
27860 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27861 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27862 {{echo|<nowiki>f=oo</nowiki>|bar}}
27863 !! end
27864
27865 !! test
27866 Parsoid: Serialize positional parameters with = in extlink as named parameter
27867 !! options
27868 parsoid=html2wt
27869 !! html/parsoid
27870 <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>
27871 !! wikitext
27872 {{echo|1=http://stuff?is=ok}}
27873 !! end
27874
27875 !! test
27876 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27877 !! options
27878 parsoid=html2wt
27879 !! html/parsoid
27880 <div>a<p>b</p></div>
27881 <div>a
27882 <p>b</p></div>
27883 <div>
27884 a
27885 <p>b</p></div>
27886 !! wikitext
27887 <div>a
27888 b
27889 </div>
27890 <div>a
27891 b
27892 </div>
27893 <div>
27894 a
27895
27896 b
27897 </div>
27898 !! end
27899
27900 !! test
27901 Substrings resembling wikitext in hrefs should not get nowiki escapes
27902 !! options
27903 parsoid=html2wt
27904 !! html/parsoid
27905 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27906 !! wikitext
27907 [[Foo''bar''baz]]
27908 !! end
27909
27910 !! test
27911 Enforce single-line context in the serializer
27912 !! options
27913 parsoid=html2wt
27914 !! html/parsoid
27915 <h2>testing
27916 123</h2>
27917
27918 <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">
27919 </span><span about="#mwt1">you</span> </h2>
27920
27921 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
27922
27923 <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="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
27924 there</span></li></ol>
27925
27926 <ul><li>asd
27927 sdf</li></ul>
27928
27929 <ul><li>foo
27930 bar
27931 baz</li>
27932 <li>foo <b>bar</b>
27933 baz</li></ul>
27934
27935 <dl><dt>hi
27936 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27937 ho</dd></dl>
27938
27939 <dl><dd> <table>
27940 <tbody><tr><td> ha
27941 ha
27942 ha</td></tr>
27943 </tbody></table></dd></dl>
27944 !! wikitext
27945 == testing 123 ==
27946
27947 == hi {{bogus|there
27948 you}} ==
27949
27950 == foo <ref>hello
27951 there</ref> ==
27952
27953 <references />
27954
27955 * asd sdf
27956
27957 * foo bar baz
27958 * foo '''bar''' baz
27959
27960 ; hi ho : hi ho
27961
27962 : {|
27963 | ha
27964 ha
27965 ha
27966 |}
27967 !! end
27968
27969 !! test
27970 Serialize new placeholder space without spans
27971 !! options
27972 parsoid=html2wt
27973 !! html/parsoid
27974 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27975
27976 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27977
27978 <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>
27979 !! wikitext
27980 foo : bar
27981
27982 foo : bar
27983
27984 <ref>foo : bar</ref>ok
27985 !! end
27986
27987
27988 #-----------------------
27989 # Tag minimization tests
27990 #-----------------------
27991
27992 !! test
27993 1. I/B quote minimization: wikitext-only tags should be combined
27994 !! options
27995 parsoid=html2wt
27996 !! html/parsoid
27997 <p><i>A</i><i>B</i></p>
27998 <p><b>A</b><b>B</b></p>
27999 <p><i>A</i><b><i>B</i></b></p>
28000 <p><b>A</b><i><b>B</b></i></p>
28001 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28002 <p><i><b>A</b></i><i><b>B</b></i></p>
28003 <p><i><b>A</b></i><b><i>B</i></b></p>
28004 <p><b><i>A</i></b><i><b>B</b></i></p>
28005 !! wikitext
28006 ''AB''
28007
28008 '''AB'''
28009
28010 ''A'''B'''''
28011
28012 '''A''B'''''
28013
28014 '''A''BC''D'''
28015
28016 '''''AB'''''
28017
28018 '''''AB'''''
28019
28020 '''''AB'''''
28021 !! end
28022
28023 !! test
28024 2. I/B quote minimization: wikitext and html tags should not be combined
28025 !! options
28026 parsoid=html2wt
28027 !! html/parsoid
28028 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28029 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28030 !! wikitext
28031 ''A''<i>B</i>
28032
28033 ''A''<nowiki/>'''<i>B</i>'''
28034 !! end
28035
28036 !! test
28037 3. I/B quote minimization: templated content stops minimization
28038 !! options
28039 parsoid=html2wt
28040 !! html/parsoid
28041 <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>
28042 <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>
28043 !! wikitext
28044 ''A''{{echo|''B''}}
28045
28046 ''A''{{echo|'''''B'''''}}
28047 !! end
28048
28049 !! test
28050 4. I/B quote minimization: new content should be mimimized with adjacent old content
28051 !! options
28052 parsoid=html2wt
28053 !! html/parsoid
28054 <p><i>A</i><i>B</i></p>
28055 <p><b>A</b><b>B</b></p>
28056 <p><i>A</i><b><i>B</i></b></p>
28057 !! wikitext
28058 ''AB''
28059
28060 '''AB'''
28061
28062 ''A'''B'''''
28063 !! end
28064
28065 !! test
28066 5a. Merge adjacent quote nodes if they've been edited
28067 !! options
28068 parsoid={
28069 "modes": ["wt2wt", "selser"],
28070 "changes": [
28071 ["p", "contents", "remove", ":contains('b')"]
28072 ]
28073 }
28074 !! wikitext
28075 ''a''b''c''
28076 !! wikitext/edited
28077 ''ac''
28078 !! end
28079
28080 !! test
28081 5b. Merge adjacent quote nodes if they've been edited
28082 !! options
28083 parsoid={
28084 "modes": ["wt2wt", "selser"],
28085 "changes": [
28086 ["#x", "remove"]
28087 ]
28088 }
28089 !! wikitext
28090 ''a''<span id="x">b</span>''c''
28091 !! wikitext/edited
28092 ''ac''
28093 !! end
28094
28095 !! test
28096 1. Merge adjacent link nodes as long as at least one element is new
28097 !! options
28098 parsoid={
28099 "modes": ["html2wt"],
28100 "scrubWikitext": true
28101 }
28102 !! html/parsoid
28103 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28104 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28105 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28106 !! wikitext
28107 [[Football]]
28108 [[Football]]
28109 [[Football|Foot]][[Football|ball]]
28110 !! end
28111
28112 !! test
28113 2. Merge adjacent link nodes and enable additional normalizations
28114 !! options
28115 parsoid={
28116 "modes": ["html2wt"],
28117 "scrubWikitext": true
28118 }
28119 !! html/parsoid
28120 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28121 !! wikitext
28122 [[Football|''Football'']]
28123 !! end
28124
28125 !! test
28126 3. Don't merge adjacent link nodes if scrubWikitext is false
28127 !! options
28128 parsoid={
28129 "modes": ["html2wt"],
28130 "scrubWikitext": false
28131 }
28132 !! html/parsoid
28133 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28134 !! wikitext
28135 [[Football|Foot]][[Football|ball]]
28136 !! end
28137
28138 #------------------------------
28139 # End of tag minimization tests
28140 #------------------------------
28141
28142 !!test
28143 T56262: New entities
28144 !! options
28145 parsoid=html2wt
28146 !! html/parsoid
28147 <span typeof="mw:Entity">&nbsp;</span>
28148 !! wikitext
28149 &nbsp;
28150 !! end
28151
28152 ## Note that there is no wikitext output for 'unknownproperty' ##
28153 ## Unknown magic words are silently dropped ##
28154
28155 !! test
28156 Magic words
28157 !! options
28158 parsoid=html2wt
28159 !! html/parsoid
28160 <meta property='mw:PageProp/toc' />
28161 <meta property='mw:PageProp/notoc' />
28162 <meta property='mw:PageProp/forcetoc' />
28163 <meta property='mw:PageProp/index' />
28164 <meta property='mw:PageProp/noindex' />
28165 <meta property='mw:PageProp/nogallery' />
28166 <meta property='mw:PageProp/noeditsection' />
28167 <meta property='mw:PageProp/notitleconvert' />
28168 <meta property='mw:PageProp/nocontentconvert' />
28169 <meta property='mw:PageProp/unknownproperty' />
28170 !! wikitext
28171 __TOC__
28172 __NOTOC__
28173 __FORCETOC__
28174 __INDEX__
28175 __NOINDEX__
28176 __NOGALLERY__
28177 __NOEDITSECTION__
28178 __NOTITLECONVERT__
28179 __NOCONTENTCONVERT__
28180 !! end
28181
28182 !! test
28183 Consecutive <pre>s should not get merged
28184 !! options
28185 parsoid=html2wt,html2html
28186 !! html/parsoid
28187 <pre>a</pre><pre>b</pre>
28188
28189 <pre>c
28190 </pre><pre>
28191 d</pre>
28192
28193 <pre>e
28194
28195 </pre><pre>
28196
28197 f</pre>
28198 !! wikitext
28199 a
28200
28201 b
28202
28203 c
28204
28205 d
28206
28207 e
28208
28209
28210
28211 f
28212 !! end
28213
28214 !! test
28215 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28216 !! options
28217 parsoid=html2wt
28218 !! html/parsoid
28219 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28220 !! wikitext
28221 [[Special:BookSources/1234567890|ISBN 1234567895]]
28222 !! end
28223
28224 !! test
28225 Edited RFC links not serializable as RFC links should serialize as extlinks
28226 !! options
28227 parsoid=html2wt
28228 !! html/parsoid
28229 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28230 !! wikitext
28231 [https://tools.ietf.org/html/rfc123 New RFC]
28232 !! end
28233
28234 !! test
28235 Edited PMID links not serializable as PMID links should serialize as extlinks
28236 !! options
28237 parsoid=html2wt
28238 !! html/parsoid
28239 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28240 !! wikitext
28241 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28242 !! end
28243
28244 !! test
28245 WTS of autolinks with trailing/surrounding context
28246 !! options
28247 parsoid=html2wt
28248 !! html/parsoid
28249 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28250 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28251 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28252 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28253 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28254 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28255 !! wikitext
28256 http://cscott.net'''foo'''
28257
28258 http://cscott.net<b>foo</b>
28259
28260 '''http://cscott.net'''
28261
28262 '''http://cscott.net '''
28263
28264 '''http://cscott.net<nowiki/>x'''
28265
28266 http://cscott.net<nowiki/>x
28267 !! end
28268
28269 !! test
28270 WTS of autolinks with nowikis (round-trip)
28271 !! wikitext
28272 x<nowiki/>http://cscott.net<nowiki/>x
28273 !! html/parsoid
28274 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28275 !! end
28276
28277 # this is the "easy" test because it leaves in place all the
28278 # data-parsoid information indicating this is an autolink
28279 !! test
28280 WTS of autolinks with escapes (editing)
28281 !! options
28282 parsoid={
28283 "modes": ["wt2wt"],
28284 "changes": [
28285 [ "span", "remove" ]
28286 ]
28287 }
28288 !! wikitext
28289 x<nowiki/>http://cscott.net<nowiki/>x
28290 !! wikitext/edited
28291 x<nowiki/>http://cscott.net<nowiki/>x
28292 !! end
28293
28294 !! test
28295 WTS of edited autolink-like text (T103364)
28296 !! options
28297 parsoid={
28298 "modes": ["wt2wt"],
28299 "changes": [
28300 [ "span[typeof]", "removeAttr", "typeof" ]
28301 ]
28302 }
28303 !! wikitext
28304 Not a link: <nowiki>http://example.com</nowiki>.
28305 !! wikitext/edited
28306 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28307 !! end
28308
28309 !! test
28310 WTS of newly-authored autolink-like text (T103364)
28311 !! options
28312 parsoid=html2wt
28313 !! html/parsoid
28314 <p>http://example.com is not a link.</p>
28315 !! wikitext
28316 <nowiki>http://example.com</nowiki> is not a link.
28317 !! end
28318
28319 !! test
28320 WTS of autolink-like text after an autolink (T108563)
28321 !! options
28322 parsoid=html2wt
28323 !! html/parsoid
28324 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28325 !! wikitext
28326 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28327 !! end
28328
28329 !! test
28330 Magic links inside links (not autolinked)
28331 !! wikitext
28332 [[Foo|http://example.com]]
28333 [[Foo|RFC 1234]]
28334 [[Foo|PMID 1234]]
28335 [[Foo|ISBN 123456789x]]
28336
28337 [http://foo.com http://example.com]
28338 [http://foo.com RFC 1234]
28339 [http://foo.com PMID 1234]
28340 [http://foo.com ISBN 123456789x]
28341 !! html+tidy
28342 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28343 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28344 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28345 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28346 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28347 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28348 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28349 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28350 </p>
28351 !! html/parsoid
28352 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28353 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28354 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28355 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28356
28357 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28358 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28359 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28360 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28361 !! end
28362
28363 !! test
28364 Magic links inside image captions (autolinked)
28365 !! wikitext
28366 [[File:Foobar.jpg|thumb|http://example.com]]
28367 [[File:Foobar.jpg|thumb|RFC 1234]]
28368 [[File:Foobar.jpg|thumb|PMID 1234]]
28369 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28370 !! html+tidy
28371 <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 rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
28372 <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 class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a></div></div></div>
28373 <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 class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div></div></div>
28374 <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/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div></div></div>
28375 !! html/parsoid
28376 <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" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
28377 <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="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external text">RFC 1234</a></figcaption></figure>
28378 <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" class="external text">PMID 1234</a></figcaption></figure>
28379 <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>
28380 !! end
28381
28382 !! test
28383 WTS of magic word text (T109371)
28384 !! options
28385 parsoid=html2wt
28386 !! html/parsoid
28387 <p>RFC 1234</p>
28388 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28389 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28390 !! wikitext
28391 <nowiki>RFC 1234</nowiki>
28392
28393 [http://foo.com RFC 1234]
28394
28395 [[Foo|RFC 1234]]
28396 !! end
28397
28398 !! test
28399 Edited Redirect link should emit a non-piped wikitext link
28400 !! options
28401 parsoid=html2wt
28402 !! html/parsoid
28403 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28404 !! wikitext
28405 #REDIRECT [[Bar]]
28406 !! end
28407
28408 !! test
28409 T75121: Infer extension name from typeOf if data-mw is not present
28410 !! options
28411 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28412 !! html/parsoid
28413 <div typeOf="mw:Extension/foo"></div>
28414 !! wikitext
28415 <foo />
28416 !! end
28417
28418 # Note that the <p> wrapping isn't present in PHP parser output
28419 # The important thing for this test is that P-wrapping doesn't
28420 # interfere with the <nowiki> protection for leading - in <td>
28421 # (which isn't necessary for <th>).
28422 !! test
28423 T88318: p-wrapped dash in table.
28424 !! options
28425 parsoid=html2wt,wt2wt
28426 !! html/parsoid
28427 <table><tbody>
28428 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28429 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28430 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28431 </tbody></table>
28432 !! wikitext
28433 {|
28434 !-
28435 !-
28436 |-
28437 |<nowiki>-</nowiki>
28438 |<nowiki>- </nowiki>
28439 |-
28440 |<small>-</small>
28441 |<br />
28442 -
28443 |<br />
28444 -
28445 |}
28446 !! html/php+tidy
28447 <table>
28448 <tbody><tr>
28449 <th>-
28450 </th>
28451 <th>-
28452 </th></tr>
28453 <tr>
28454 <td>-
28455 </td>
28456 <td>-
28457 </td></tr>
28458 <tr>
28459 <td><small>-</small>
28460 </td>
28461 <td><br />
28462 <p>-
28463 </p>
28464 </td>
28465 <td><br />
28466 <p>-
28467 </p>
28468 </td></tr></tbody></table>
28469 !! end
28470
28471 !! test
28472 T149209: WTS: Handle newlines in table cells properly
28473 !! options
28474 parsoid=html2wt
28475 !! html/parsoid
28476 <table>
28477 <tbody>
28478 <tr><td>a
28479 b
28480 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28481 <tr><td><p>x</p>
28482 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28483 </tbody></table>
28484 <table>
28485 <tbody>
28486 <tr><th>a
28487 b
28488 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28489 <tr><th><p>x</h>
28490 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28491 </tbody></table>
28492 !! wikitext
28493 {|
28494 |a
28495 b
28496 |c
28497 |-
28498 |x
28499 {{!}}y
28500 |}
28501 {|
28502 !a
28503 b
28504 !c
28505 |-
28506 !x
28507 !y
28508 |}
28509 !! end
28510
28511 !! test
28512 T149209: Selser: Handle newlines in table cells properly
28513 !! options
28514 parsoid={
28515 "modes": ["selser"],
28516 "changes": [
28517 [ "#h1", "html", "a\nb\n" ],
28518 [ "#h2", "html", "a\nb\n" ],
28519 [ "#c1", "html", "a\nb\n" ],
28520 [ "#c2", "html", "<p>a</p>" ],
28521 [ "#c3", "html", "<p>a</p>" ],
28522 [ "#c4", "html", "edit-me<p>a</p>" ]
28523 ]
28524 }
28525 !! wikitext
28526 {|
28527 ! id="h1" |edit-me!!1
28528 |-
28529 ! id="h2" |edit-me||2
28530 |-
28531 | id="c1" |edit-me||3
28532 |-
28533 | id="c2" |edit-me||4
28534 |-
28535 | id="c3" |edit-me||p||q||r
28536 |-
28537 | id="c4" |edit-me||p||q||r
28538 |}
28539 !! wikitext/edited
28540 {|
28541 ! id="h1" |a
28542 b
28543 !1
28544 |-
28545 ! id="h2" |a
28546 b
28547 !2
28548 |-
28549 | id="c1" |a
28550 b
28551 |3
28552 |-
28553 | id="c2" |a
28554 |4
28555 |-
28556 | id="c3" |a
28557 |p||q||r
28558 |-
28559 | id="c4" |edit-me
28560 a
28561 |p||q||r
28562 |}
28563 !! end
28564
28565 !! test
28566 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28567 !! options
28568 parsoid=html2wt
28569 !! html/parsoid
28570 <table id='mwAb'>
28571 <td id='mwAc'>foo</td>
28572 <td id='serialize-this'>bar</td>
28573 </table>
28574 !! wikitext
28575 {|
28576 |foo
28577 | id="serialize-this" |bar
28578 |}
28579 !! end
28580
28581 !! test
28582 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28583 !! options
28584 parsoid=html2wt
28585 !! html/parsoid
28586 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28587 !! wikitext
28588 <div id="hello">ok</div>
28589 !! end
28590
28591 !! test
28592 WTS change modes
28593 !! options
28594 parsoid={
28595 "modes": ["wt2wt"],
28596 "changes": [
28597 [ "#xyz", "before", "<b>before</b> stuff " ],
28598 [ "#xyz", "after", " stuff <i>after</i>" ],
28599 [ "#xyz", "html", "x <b>y</b> z" ]
28600 ]
28601 }
28602 !! wikitext
28603 <span id="xyz">hello</span>
28604 !! wikitext/edited
28605 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28606 !! end
28607
28608 !! test
28609 Never serialize a-tag as html, regardless of what data-parsoid has to say
28610 !! options
28611 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28612 !! html/parsoid
28613 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28614 !! wikitext
28615 [[Foo]]
28616 !! end
28617
28618 ## SSS FIXME: This is broken output nevertheless.
28619 ## What might be a reasonable non-broken output for this?
28620 ## This is an edge case unlikely to be seen in production
28621 ## that I am not wasting more time on this right now.
28622 !! test
28623 Never serialize a-tag as html, no matter what attributes it has
28624 !! options
28625 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28626 !! html/parsoid
28627 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28628 !! wikitext
28629 [http://boo.org http://boohoo.org]
28630 !! end
28631
28632 # Misnested is an indication that selser can reuse the source but these have
28633 # shown to sneak through on occasion. See T101768.
28634 # The original wikitext here is: [http://test.com [[one]] two three]
28635 !! test
28636 Strip span tags added to mark misnested links
28637 !! options
28638 parsoid=html2wt
28639 !! html/parsoid
28640 <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>
28641 !! wikitext
28642 [http://test.com][[one]] two three
28643 !! end
28644
28645 !! test
28646 Catch regression when unpacking misnested links
28647 !! options
28648 parsoid=wt2html
28649 !! wikitext
28650 {{echo|hi}}[http://example.com [[ho]]]
28651 !! html/parsoid
28652 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"misnested":true}'>ho</a></p>
28653 !! end
28654
28655 !! test
28656 Catch regression when unpacking with trailing content
28657 !! wikitext
28658 {{echo|Foo <references/> bar}}
28659 !! html/parsoid
28660 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Foo &lt;references/> bar"}},"i":0}}]}'>Foo </p><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol><p about="#mwt2"> bar</p>
28661 !! end
28662
28663 !! test
28664 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28665 !! options
28666 parsoid=html2wt
28667 !! html/parsoid
28668 <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|}"]}'>
28669 <tbody><tr><td>d
28670 </td></tr>
28671 </tbody></table>
28672 !! wikitext
28673 {{echo|a}}
28674 {|{{echo|c
28675 {{!}}d
28676 }}
28677 |}
28678 !! end
28679
28680 ## This test verifies the presence and computation of this attribute indirectly
28681 ## by making an edit and ensuring that the serialization is correct (which it would be
28682 ## only if firstWikitextNode is properly set).
28683 !! test
28684 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28685 !! options
28686 parsoid= {
28687 "modes": ["wt2wt"],
28688 "changes": [
28689 [ "div#x", "remove" ],
28690 [ "div", "before", "<div>new</div>" ]
28691 ]
28692 }
28693 !! wikitext
28694 <div id="x">foo</div>
28695 {|
28696 {{echo|<div>boo</div>
28697 {{!}}b}}
28698 |c
28699 |}
28700 !! wikitext/edited
28701
28702 <div>new</div>
28703 {|
28704 {{echo|<div>boo</div>
28705 {{!}}b}}
28706 |c
28707 |}
28708 !! end
28709
28710 # --------------------------------------------
28711 # Tests spec'ing wikitext serialization norms |
28712 # --------------------------------------------
28713
28714 !! test
28715 Serialize multi-line indent-pre starting with wikitext syntax
28716 !! options
28717 parsoid=html2wt
28718 !! html/parsoid
28719 <pre>* 1
28720 ** 2
28721 * 3</pre>
28722 !! wikitext
28723 * 1
28724 ** 2
28725 * 3
28726 !! end
28727
28728 !! test
28729 1. Categories should always be serialized on their own line
28730 !! options
28731 parsoid=html2wt
28732 !! html/parsoid
28733 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28734 !! wikitext
28735 foo
28736 [[Category:Foo]]
28737 bar
28738 !! end
28739
28740 !! test
28741 2. Categories that are part of templates should not introduce a line break
28742 !! wikitext
28743 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28744 !! html/parsoid
28745 <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>
28746 !! end
28747
28748 # Careful while editing these next 2 tests. There are \u200f characters
28749 # before and after the <link> tags in the HTML and following some
28750 # of the categories in wikitext
28751 # Do not remove these characters in edits.
28752 #
28753 # As part of the serialization, these bidi characters will get stripped.
28754 !! test
28755 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28756 !! options
28757 parsoid={
28758 "modes": ["html2wt"],
28759 "scrubWikitext": true
28760 }
28761 !! html/parsoid
28762 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28763 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28764 !! wikitext
28765 [[קטגוריה:טקסים]]
28766 [[קטגוריה: שיטות משפט]]
28767 !! end
28768
28769 !! test
28770 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28771 !! options
28772 parsoid={
28773 "modes": ["html2wt"],
28774 "scrubWikitext": true
28775 }
28776 !! html/parsoid
28777 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28778 !! wikitext
28779 [[קטגוריה:טקסים]]
28780 ‏y
28781 !! end
28782
28783 !! test
28784 Lists: Add space after bullets
28785 !! options
28786 parsoid=html2wt
28787 !! html/parsoid
28788 <ul>
28789 <li>foo</li>
28790 <li> bar</li>
28791 <li><span> baz</span></li>
28792 </ul>
28793 !! wikitext
28794 * foo
28795 * bar
28796 * <span> baz</span>
28797 !! end
28798
28799 !! test
28800 1. Headings: Add space before/after == (T53744)
28801 !! options
28802 parsoid=html2wt
28803 !! html/parsoid
28804 <h2>foo</h2>
28805 <h2> bar</h2>
28806 <h2>baz </h2>
28807 <h2><span> baz</span></h2>
28808 !! wikitext
28809 == foo ==
28810
28811 == bar ==
28812
28813 == baz ==
28814
28815 == <span> baz</span> ==
28816 !! end
28817
28818 !! test
28819 2. Headings: Add space before/after == even after hoisted content
28820 !! options
28821 parsoid={
28822 "modes": ["html2wt"],
28823 "scrubWikitext": true
28824 }
28825 !! html/parsoid
28826 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28827 !! wikitext
28828 [[Category:A2]]
28829
28830 == ok ==
28831 !! end
28832
28833 !! test
28834 1. Headings: suppress newly created empty headings
28835 !! options
28836 parsoid={
28837 "modes": ["html2wt"],
28838 "scrubWikitext": true
28839 }
28840 !! html/parsoid
28841 <h2></h2>
28842 !! wikitext
28843 !! end
28844
28845 !! test
28846 2. Headings: don't suppress empty headings if scrubWikitext is false
28847 !! options
28848 parsoid=html2wt
28849 !! html/parsoid
28850 <h2></h2>
28851 !! wikitext
28852 ==<nowiki/>==
28853 !! end
28854
28855 !! test
28856 3. Headings: suppress empty headings on edits
28857 !! options
28858 parsoid={
28859 "modes": ["selser"],
28860 "scrubWikitext": true,
28861 "changes": [
28862 [ "#x", "remove"]
28863 ]
28864 }
28865 !! wikitext
28866 ==<span id="x">foo</span>==
28867 !! wikitext/edited
28868 !! end
28869
28870 !! test
28871 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28872 !! options
28873 parsoid={
28874 "modes": ["html2wt"],
28875 "scrubWikitext": true
28876 }
28877 !! html/parsoid
28878 <h2>foo<br/>bar</h2>
28879 <h2>foo <span><br/>bar</span> baz</h2>
28880 !! wikitext
28881 == foo bar ==
28882
28883 == foo <span> bar</span> baz ==
28884 !! end
28885
28886 !! test
28887 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28888 !! options
28889 parsoid={
28890 "modes": ["html2wt"],
28891 "scrubWikitext": false
28892 }
28893 !! html/parsoid
28894 <h2>foo<br/>bar</h2>
28895 !! wikitext
28896 == foo<br /> bar ==
28897 !! end
28898
28899 !! test
28900 1. WT Quote Tags: suppress newly created empty style tags
28901 !! options
28902 parsoid={
28903 "modes": ["html2wt"],
28904 "scrubWikitext": true
28905 }
28906 !! html/parsoid
28907 <i></i><b></b>
28908 !! wikitext
28909 !! end
28910
28911 !! test
28912 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28913 !! options
28914 parsoid=html2wt
28915 !! html/parsoid
28916 <i></i><b></b>
28917 !! wikitext
28918 ''<nowiki/>'''''<nowiki/>'''
28919 !! end
28920
28921 !! test
28922 3. WT Quote Tags: suppress empty style tags on edits
28923 !! options
28924 parsoid={
28925 "modes": ["selser"],
28926 "scrubWikitext": true,
28927 "changes": [
28928 [ "#x", "remove"]
28929 ]
28930 }
28931 !! wikitext
28932 '''<span id="x">foo</span>'''
28933 !! wikitext/edited
28934 !! end
28935
28936 !! test
28937 1. Anchors: suppress newly created empty anchors
28938 !! options
28939 parsoid={
28940 "modes": ["html2wt"],
28941 "scrubWikitext": true
28942 }
28943 !! html/parsoid
28944 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28945 !! wikitext
28946 !! end
28947
28948 !! test
28949 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28950 !! options
28951 parsoid={
28952 "modes": ["html2wt"],
28953 "scrubWikitext": false
28954 }
28955 !! html/parsoid
28956 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28957 !! wikitext
28958 [[Test|<nowiki/>]]
28959 !! end
28960
28961 !! test
28962 3. Anchors: suppress empty anchors on edits
28963 !! options
28964 parsoid={
28965 "modes": ["selser"],
28966 "scrubWikitext": true,
28967 "changes": [
28968 [ "#x", "remove"]
28969 ]
28970 }
28971 !! wikitext
28972 [[Test|<span id="x">foo</span>]]
28973 !! wikitext/edited
28974 !! end
28975
28976 !! test
28977 3a. Anchors: do not suppress numbered extlinks
28978 !! options
28979 parsoid={
28980 "modes": ["wt2wt"],
28981 "scrubWikitext": true
28982 }
28983 !! wikitext
28984 [http://foo.com]
28985 !! html/parsoid
28986 <a rel="mw:ExtLink" href="http://foo.com"></a>
28987 !! end
28988
28989 !! test
28990 3b. Anchors: do not suppress numbered extlinks
28991 !! options
28992 parsoid={
28993 "modes": ["wt2wt"],
28994 "scrubWikitext": true,
28995 "changes": [
28996 [ "#x", "remove"]
28997 ]
28998 }
28999 !! wikitext
29000 [http://foo.com <span id="x">foo</span>]
29001 !! wikitext/edited
29002 [http://foo.com]
29003 !! end
29004
29005 !!test
29006 Normalizations should be restricted to edited content
29007 !!options
29008 parsoid={
29009 "modes": ["selser"],
29010 "scrubWikitext": true,
29011 "changes": [
29012 [ "h1", "before", "<i></i>"]
29013 ]
29014 }
29015 !!wikitext
29016 a
29017 = =
29018 b
29019 !!wikitext/edited
29020 a
29021 = =
29022 b
29023 !!end
29024
29025 !! test
29026 1. Multiple normalizations (html2wt)
29027 !! options
29028 parsoid={
29029 "modes": ["html2wt"],
29030 "scrubWikitext": true
29031 }
29032 !! html
29033 <h2><i></i></h2>
29034 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29035 </a><b><i></i></b>x</p>
29036 !! wikitext
29037
29038 [[foo]]
29039 x
29040
29041 !! end
29042
29043 !! test
29044 2. Multiple normalizations (selser)
29045 !! options
29046 parsoid={
29047 "modes": ["selser"],
29048 "scrubWikitext": true,
29049 "changes": [
29050 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29051 ]
29052 }
29053 !! wikitext
29054 <span id="x">foo</span>
29055 !! wikitext/edited
29056 <span id="x">foo</span>
29057
29058 x
29059 !! end
29060
29061 !! test
29062 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29063 !! options
29064 parsoid={
29065 "modes": ["html2wt"],
29066 "scrubWikitext": true
29067 }
29068 !! html/parsoid
29069 <p> hi</p>
29070 <p> hello</p>
29071 !! wikitext
29072 hi
29073
29074 hello
29075 !! end
29076
29077 !! test
29078 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29079 !! options
29080 parsoid=html2wt
29081 !! html/parsoid
29082 <p> hi</p>
29083 <p> hello</p>
29084 !! wikitext
29085 <nowiki> </nowiki>hi
29086
29087 <nowiki> </nowiki> hello
29088 !! end
29089
29090 !! test
29091 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29092 !! options
29093 parsoid={
29094 "modes": ["html2wt"],
29095 "scrubWikitext": true
29096 }
29097 !! html/parsoid
29098 <p>Foo
29099 bar
29100 baz</p>
29101
29102 <table><tr><td>Foo
29103 bar
29104 baz bang</td></tr></table>
29105
29106 <p><!--boo--> foo
29107 bar</p>
29108
29109 <p> foo
29110 bar<span>boo</span></p>
29111 !! wikitext
29112 Foo
29113 bar
29114 baz
29115
29116 {|
29117 |Foo
29118 bar
29119 baz bang
29120 |}
29121
29122 <!--boo-->foo
29123 bar
29124
29125 foo
29126 bar<span>boo</span>
29127 !! end
29128
29129 !! test
29130 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29131 !! options
29132 parsoid={
29133 "modes": ["selser"],
29134 "scrubWikitext": true,
29135 "changes": [
29136 [ "p", "html", " a\n b" ]
29137 ]
29138 }
29139 !! wikitext
29140 xyz
29141 !! wikitext/edited
29142 a
29143 b
29144 !! end
29145
29146 !! test
29147 1. New links that end in spaces
29148 !! options
29149 parsoid={
29150 "modes": ["html2wt"],
29151 "scrubWikitext": false
29152 }
29153 !! html/parsoid
29154 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29155 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29156 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29157 !! wikitext
29158 [[Berlin ]]<nowiki/>is the capital of Germany.
29159
29160 [[Foo ]]'''bar'''
29161
29162 [[Boston ]] is a city.
29163 !! end
29164
29165 !! test
29166 2. New links that end in spaces
29167 !! options
29168 parsoid={
29169 "modes": ["html2wt"],
29170 "scrubWikitext": true
29171 }
29172 !! html/parsoid
29173 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29174 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29175 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29176 !! wikitext
29177 [[Berlin]] is the capital of Germany.
29178
29179 [[Foo]] '''bar'''
29180
29181 [[Boston]] is a city.
29182 !! end
29183
29184 !! test
29185 1. Table cells with escapable prefixes
29186 !! options
29187 parsoid={
29188 "modes": ["html2wt"],
29189 "scrubWikitext": false
29190 }
29191 !! html
29192 <table>
29193 <tr><td>a</td></tr>
29194 <tr><td>-</td></tr>
29195 <tr><td>+</td></tr>
29196 </table>
29197 !! wikitext
29198 {|
29199 |a
29200 |-
29201 |<nowiki>-</nowiki>
29202 |-
29203 |<nowiki>+</nowiki>
29204 |}
29205 !! end
29206
29207 !! test
29208 2. Table cells with escapable prefixes
29209 !! options
29210 parsoid={
29211 "modes": ["html2wt"],
29212 "scrubWikitext": true
29213 }
29214 !! html
29215 <table>
29216 <tr><td>a</td></tr>
29217 <tr><td>-</td></tr>
29218 <tr><td>+</td></tr>
29219 </table>
29220 !! wikitext
29221 {|
29222 |a
29223 |-
29224 | -
29225 |-
29226 | +
29227 |}
29228 !! end
29229
29230 !! test
29231 3a. Table cells with escapable prefixes after edits
29232 !! options
29233 parsoid={
29234 "modes": ["selser"],
29235 "scrubWikitext": true,
29236 "changes": [
29237 [ "table tbody tr:first-child td:first-child", "remove"]
29238 ]
29239 }
29240 !! wikitext
29241 {|
29242 |a||-
29243 |}
29244 !! wikitext/edited
29245 {|
29246 | -
29247 |}
29248 !! end
29249
29250 !! test
29251 3b. Table cells with escapable prefixes after edits
29252 !! options
29253 parsoid={
29254 "modes": ["selser"],
29255 "scrubWikitext": true,
29256 "changes": [
29257 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29258 [ "#x", "remove" ]
29259 ]
29260 }
29261 !! wikitext
29262 {|
29263 |pqr
29264 |<span id="x">foo</span>+
29265 |}
29266 !! wikitext/edited
29267 {|
29268 | -
29269 | +
29270 |}
29271 !! end
29272
29273 # FIXME: This test will fail because
29274 # normalization doesn't realize that the id attribute
29275 # will eliminate the escapable scenario
29276 !! test
29277 4a. Table cells without escapable prefixes after edits
29278 !! options
29279 parsoid={
29280 "modes": ["selser"],
29281 "scrubWikitext": true,
29282 "changes": [
29283 [ "#x", "html", "-" ]
29284 ]
29285 }
29286 !! wikitext
29287 {|
29288 | id="x" |abcd
29289 |}
29290 !! wikitext/edited
29291 {|
29292 | id="x" |-
29293 |}
29294 !! end
29295
29296 ## This tests normalizer's ability to discriminate between
29297 ## cells having identical content.
29298 !! test
29299 4b. Table cells without escapable prefixes after edits
29300 !! options
29301 parsoid={
29302 "modes": ["selser"],
29303 "scrubWikitext": true,
29304 "changes": [
29305 [ "td", "html", "-" ]
29306 ]
29307 }
29308 !! wikitext
29309 {|
29310 |a||b
29311 |}
29312 !! wikitext/edited
29313 {|
29314 | -||-
29315 |}
29316 !! end
29317
29318 ## This tests normalizer's ability to not be tripped by
29319 ## comments (and whitespace)
29320 !! test
29321 4c. Table cells without escapable prefixes after edits
29322 !! options
29323 parsoid={
29324 "modes": ["selser"],
29325 "scrubWikitext": true,
29326 "changes": [
29327 [ "table tbody tr td:first-child", "remove" ]
29328 ]
29329 }
29330 !! wikitext
29331 {|
29332 |-
29333 <!--foo--> |a||-
29334 |}
29335 !! wikitext/edited
29336 {|
29337 |-
29338 <!--foo--> | -
29339 |}
29340 !! end
29341
29342 ## This tests normalizer's ability to handle HTML cells
29343 !! test
29344 4d. Table cells without escapable prefixes after edits
29345 !! options
29346 parsoid={
29347 "modes": ["selser"],
29348 "scrubWikitext": true,
29349 "changes": [
29350 [ "td", "html", "-" ]
29351 ]
29352 }
29353 !! wikitext
29354 <table>
29355 <tr><td>a</td></tr>
29356 </table>
29357 !! wikitext/edited
29358 <table>
29359 <tr><td>-</td></tr>
29360 </table>
29361 !! end
29362
29363 ## T111151 Remove font elements without attributes
29364 !! test
29365 5a. font tags without attributes should be dropped in scrubWikitext mode
29366 !! options
29367 parsoid={
29368 "modes": ["html2wt"],
29369 "scrubWikitext": true
29370 }
29371 !! html
29372 <font>foo</font>
29373 <font><font>bar</font></font>
29374 <font class="x">boo</font>
29375 !! wikitext
29376 foo
29377 bar
29378 <font class="x">boo</font>
29379 !! end
29380
29381 !! test
29382 5b. font tags should not be dropped without scrubWikitext being enabled
29383 !! options
29384 parsoid={
29385 "modes": ["html2wt"],
29386 "scrubWikitext": false
29387 }
29388 !! html
29389 <font>foo</font>
29390 !! wikitext
29391 <font>foo</font>
29392 !! end
29393
29394 !! test
29395 Escape nowiki DOM elements
29396 !! options
29397 parsoid=html2wt
29398 !! html/parsoid
29399 <nowiki><i>foo</i></nowiki>
29400 !! wikitext
29401 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29402 !! end
29403
29404 # This is meant to be an interim fix while we go about figuring out
29405 # how to not introduce these trailing <nowiki/>s in the first place.
29406 !! test
29407 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29408 !! options
29409 parsoid=html2wt
29410 !! html/parsoid
29411 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29412 y</p>
29413 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
29414 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
29415 !! wikitext
29416 x
29417 y
29418
29419 {{echo|
29420 1 = <nowiki/>}}
29421
29422 {{echo|
29423 1 = <nowiki/>
29424 }}
29425 !! end
29426
29427 # ---------------------------------------------------
29428 # End of tests spec'ing wikitext serialization norms |
29429 # ---------------------------------------------------
29430
29431 # T104032
29432 !! test
29433 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29434 !! options
29435 parsoid=html2wt
29436 !! html/parsoid
29437 a<p>b</p>
29438 <b>c</b><p>d</p>
29439 <table><tr>
29440 <td>a<p>b</p></td>
29441 <td><b>c</b><p>d</p></td>
29442 </tr></table>
29443 !! wikitext
29444 a
29445
29446 b
29447
29448 '''c'''
29449
29450 d
29451 {|
29452 |a
29453 b
29454 |'''c'''
29455 d
29456 |}
29457 !! end
29458
29459 !! test
29460 Anchor without href scenarios
29461 !! options
29462 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29463 !! html/parsoid
29464 <a class="bc"></a>
29465 <a class="no">dice</a>
29466 <a name="foo"></a>
29467 !! wikitext
29468
29469 dice
29470 <span name="foo"></span>
29471 !! end
29472
29473 !! test
29474 New transclusion added after a list should be serialized after the list
29475 !! options
29476 parsoid=html2wt
29477 !! html/parsoid
29478 <ul><li>a</li></ul><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>
29479 !! wikitext
29480 * a
29481 {{echo|foo}}
29482 !! end
29483
29484 # -----------------------------------------------------------------
29485 # End of section for Parsoid-only html2wt tests for serialization
29486 # of new content
29487 # -----------------------------------------------------------------
29488
29489 # -----------------------------------------------------------------
29490 # The following section of tests are primarily to spec behavior of
29491 # the selective serializer. All these tests have manual selser
29492 # changes. The automated selser changes for all tests handle the
29493 # wide variation of changes, but these tests here capture specs
29494 # deterministically.
29495 # ----------------------------------------------------------------
29496
29497 ## T90517
29498 !! test
29499 Selser: New comments should not be lost
29500 !! options
29501 parsoid={
29502 "modes": ["selser"],
29503 "changes": [
29504 [ "#a", "after", "<!--c1-->" ],
29505 [ "#b", "before", "<!--c2-->" ]
29506 ]
29507 }
29508 !! wikitext
29509 <span id="a">a</span>
29510
29511 <span id="b">b</span>
29512 !! wikitext/edited
29513 <span id="a">a</span><!--c1-->
29514
29515 <!--c2--><span id="b">b</span>
29516 !! end
29517
29518 ## T89383
29519 !! test
29520 Selser: Check for validity of DSR before using it
29521 !! options
29522 parsoid={
29523 "modes": ["selser"],
29524 "changes": [
29525 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29526 ]
29527 }
29528 !! wikitext
29529 <span id="a">a</span>
29530 !! wikitext/edited
29531 {{DISPLAYTITLE:foo}}
29532 <span id="a">a</span>
29533 !! end
29534
29535 !! test
29536 1. DOMDiff: Changes to <ref> content should be looked up using id
29537 !! options
29538 parsoid={
29539 "modes": ["selser"],
29540 "changes": [
29541 ["#X", "after", "bar"],
29542 ["#Y", "after", "baz"]
29543 ]
29544 }
29545 !! wikitext
29546 X <ref><span id="X">foo</span></ref>
29547 Y <ref name="a" />
29548 <references>
29549 <ref name="a"><span id="Y">foo</span></ref>
29550 </references>
29551 !! wikitext/edited
29552 X <ref><span id="X">foo</span>bar</ref>
29553 Y <ref name="a" />
29554 <references>
29555 <ref name="a"><span id="Y">foo</span>baz</ref>
29556 </references>
29557 !! end
29558
29559 !! test
29560 2. DOMDiff: Changes to <ref> content should be looked up using id
29561 !! options
29562 parsoid={
29563 "modes": ["selser"],
29564 "changes": [
29565 ["#Z", "after", "bar"]
29566 ]
29567 }
29568 !! wikitext
29569 A <ref>foo bar for a</ref>
29570 B <ref group="X" name="b" />
29571
29572 <references />
29573
29574 <references group="X">
29575 <ref name="b"><span id="Z">foo</span></ref>
29576 </references>
29577 !! wikitext/edited
29578 A <ref>foo bar for a</ref>
29579 B <ref group="X" name="b" />
29580
29581 <references />
29582
29583 <references group="X">
29584 <ref name="b"><span id="Z">foo</span>bar</ref>
29585 </references>
29586 !! end
29587
29588 !! test
29589 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29590 !! options
29591 parsoid={
29592 "modes": ["selser"],
29593 "changes": [
29594 [ "div:first-child", "text", "bar" ]
29595 ]
29596 }
29597 !! wikitext
29598 <div style="{{1x|color:red;}}%">foo</div>
29599 !! wikitext/edited
29600 <div style="{{1x|color:red;}}%">bar</div>
29601 !! end
29602
29603 !! test
29604 Empty LI (T49673)
29605 !! wikitext
29606 *a
29607 *
29608 *
29609 *b
29610 !! html+tidy
29611 <ul><li>a</li>
29612 <li class="mw-empty-elt"></li>
29613 <li class="mw-empty-elt"></li>
29614 <li>b</li></ul>
29615 !! end
29616
29617 !! test
29618 Thumbnail output
29619 !! wikitext
29620 [[File:Thumb.png|thumb]]
29621 !! html/php+tidy
29622 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div></div></div></div>
29623 !! html/parsoid
29624 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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></figure>
29625 !! end
29626
29627 !! test
29628 unclosed internal link XSS (T137264)
29629 !! wikitext
29630 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29631 !! html/php
29632 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29633 </p>
29634 !! html/parsoid
29635 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29636 !! end
29637
29638 !! test
29639 Validating that <style> isn't eaten by tidy (T167349)
29640 !! options
29641 styletag=1
29642 !! wikitext
29643 <div class="foo">
29644 <style>.foo::before { content: "<foo>"; }</style>
29645 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29646 </div>
29647 !! html/php+tidy
29648 <div class="foo">
29649 <style>.foo::before { content: "<foo>"; }</style>
29650 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29651 </div>
29652 !! end
29653
29654 !! test
29655 Validating that <style> isn't wrapped in a paragraph (T186965)
29656 !! options
29657 styletag=1
29658 !! wikitext
29659 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29660
29661 <style>.foo::before { content: "<foo>"; }</style>
29662
29663 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29664
29665 But if it's on a line with other content, let it be wrapped.
29666
29667 <style>.foo::before { content: "<foo>"; }</style> bar
29668
29669 foo <style>.foo::before { content: "<foo>"; }</style>
29670
29671 foo <style>.foo::before { content: "<foo>"; }</style> bar
29672
29673 And the same if we have non-paragraph-breaking whitespace
29674
29675 foo
29676 <style>.foo::before { content: "<foo>"; }</style>
29677 bar
29678 !! html/php
29679 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29680 </p>
29681 <style>.foo::before { content: "<foo>"; }</style>
29682 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29683 <p>But if it's on a line with other content, let it be wrapped.
29684 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29685 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29686 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29687 </p><p>And the same if we have non-paragraph-breaking whitespace
29688 </p><p>foo
29689 <style>.foo::before { content: "<foo>"; }</style>
29690 bar
29691 </p>
29692 !! end
29693
29694 !! test
29695 Validating that <link> isn't wrapped in a paragraph (T186965)
29696 !! options
29697 styletag=1
29698 !! wikitext
29699 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29700
29701 <link rel="foo" href="bar"/>
29702
29703 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29704
29705 But if it's on a line with other content, let it be wrapped.
29706
29707 <link rel="foo" href="bar"/> bar
29708
29709 foo <link rel="foo" href="bar"/>
29710
29711 foo <link rel="foo" href="bar"/> bar
29712
29713 And the same if we have non-paragraph-breaking whitespace
29714
29715 foo
29716 <link rel="foo" href="bar"/>
29717 bar
29718 !! html/php
29719 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29720 </p>
29721 <link rel="foo" href="bar"/>
29722 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29723 <p>But if it's on a line with other content, let it be wrapped.
29724 </p><p><link rel="foo" href="bar"/> bar
29725 </p><p>foo <link rel="foo" href="bar"/>
29726 </p><p>foo <link rel="foo" href="bar"/> bar
29727 </p><p>And the same if we have non-paragraph-breaking whitespace
29728 </p><p>foo
29729 <link rel="foo" href="bar"/>
29730 bar
29731 </p>
29732 !! end
29733
29734 !! test
29735 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29736 !! config
29737 wgFragmentMode=[ 'html5', 'legacy' ]
29738 !! wikitext
29739 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29740 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29741 !! html/php
29742 <h2><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE"></span><span class="mw-headline" id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</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&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29743 <p><a href="#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29744 </p>
29745 !! html/parsoid
29746 <h2 id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE" typeof="mw:FallbackId" data-parsoid="{}"></span>A&amp;B<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>C<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;D<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;amp;E</h2>
29747 <p><a rel="mw:WikiLink" href="./Main_Page#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"},"sa":{"href":"#A&amp;B&amp;amp;C&amp;amp;amp;D&amp;amp;amp;amp;E"}}'>#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a></p>
29748 !! end
29749
29750 !! test
29751 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29752 !! config
29753 wgFragmentMode=[ 'legacy' ]
29754 !! wikitext
29755 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29756 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29757 !! html/php
29758 <h2><span class="mw-headline" id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</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&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29759 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29760 </p>
29761 !! end
29762
29763 !! test
29764 Decoding of HTML entities in embedded HTML tags
29765 !! wikitext
29766 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29767 !! html/php
29768 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29769
29770 !! html/parsoid
29771 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5" data-parsoid='{"stx":"html","a":{"class":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"sa":{"class":"1&amp;2&amp;amp;3&amp;amp;amp;4&amp;amp;amp;amp;5"}}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>x</td></tr></tbody></table>
29772 !! end
29773
29774 !! test
29775 Decoding of HTML entities in indicator names for IDs (T104196)
29776 !! options
29777 parsoid=wt2html,html2html
29778 showindicators
29779 !! wikitext
29780 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29781 !! html/php
29782 1&2&3&amp;4&amp;amp;5=Indicator
29783
29784 !! html/parsoid
29785 <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
29786 !! end
29787
29788 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29789 !! test
29790 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29791 !! options
29792 showindicators
29793 !! wikitext
29794 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29795 !! html/php
29796 1&2&3&amp;4&amp;amp;5=Indicator
29797
29798 !! html/parsoid
29799 <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
29800 !! end
29801
29802 # This fragment mode is what Parsoid supports.
29803 !! test
29804 HTML5 ids: fallback to legacy
29805 !! config
29806 wgFragmentMode=[ 'html5', 'legacy' ]
29807 !! wikitext
29808 ==Foo bar==
29809
29810 ==foo Bar==
29811
29812 ==Тест==
29813
29814 ==Тест==
29815
29816 ==тест==
29817
29818 ==Hey < # " > % : '==
29819 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29820
29821 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29822
29823 <!-- These two links should produce identical HTML -->
29824 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29825
29826 !! html/php
29827 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29828 <ul>
29829 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29830 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29831 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29832 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29833 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29834 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29835 </ul>
29836 </div>
29837
29838 <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>
29839 <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>
29840 <h2><span id=".D0.A2.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29841 <h2><span id=".D0.A2.D0.B5.D1.81.D1.82_2"></span><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29842 <h2><span id=".D1.82.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29843 <h2><span id="Hey_.3C_.23_.22_.3E_.25_:_.27"></span><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29844 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29845 </p><p>💩 <span id="💩"></span>
29846 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29847 </p>
29848 !! html/parsoid
29849 <h2 id="Foo_bar">Foo bar</h2>
29850
29851 <h2 id="foo_Bar_2">foo Bar</h2>
29852
29853 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29854
29855 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29856
29857 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29858
29859 <h2 id="Hey_&lt;_#_&quot;_>_%_:_'"><span id="Hey_.3C_.23_.22_.3E_.25_:_.27" typeof="mw:FallbackId"></span>Hey &lt; # " > %<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: '</h2>
29860 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar">#Foo bar</a> <a rel="mw:WikiLink" href="./Main_Page#foo_Bar">#foo Bar</a> <a rel="mw:WikiLink" href="./Main_Page#Тест">#Тест</a> <a rel="mw:WikiLink" href="./Main_Page#тест">#тест</a> <a rel="mw:WikiLink" href="./Main_Page#Hey_&lt;_#_&quot;_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Hey_&lt;_#_\"_>_%_:_&#39;"},"sa":{"href":"#Hey &lt; # \" > % : &#39;"}}'>#Hey &lt; # " > % : '</a></p>
29861
29862 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:💩","function":"anchorencode"},"params":{},"i":0}}]}'>💩</span> <span id="💩" about="#mwt3" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[178,197,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&#39;>💩&lt;/span>"}]]}'></span></p>
29863
29864 <!-- These two links should produce identical HTML -->
29865 <p><a rel="mw:WikiLink" href="./Main_Page#啤酒">#啤酒</a> <a rel="mw:WikiLink" href="./Main_Page#啤酒" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
29866 !! end
29867
29868 # Parsoid doesn't support this mode
29869 !! test
29870 HTML5 ids: legacy with a fallback to modern
29871 !! config
29872 wgFragmentMode=[ 'legacy', 'html5' ]
29873 !! wikitext
29874 ==Foo bar==
29875
29876 ==foo Bar==
29877
29878 ==Тест==
29879
29880 ==Тест==
29881
29882 ==тест==
29883
29884 ==Hey < # " > % : '==
29885 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29886
29887 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29888
29889 <!-- These two links should produce identical HTML -->
29890 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29891
29892 !! html/php
29893 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29894 <ul>
29895 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29896 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29897 <li class="toclevel-1 tocsection-3"><a href="#.D0.A2.D0.B5.D1.81.D1.82"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29898 <li class="toclevel-1 tocsection-4"><a href="#.D0.A2.D0.B5.D1.81.D1.82_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29899 <li class="toclevel-1 tocsection-5"><a href="#.D1.82.D0.B5.D1.81.D1.82"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29900 <li class="toclevel-1 tocsection-6"><a href="#Hey_.3C_.23_.22_.3E_.25_:_.27"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29901 </ul>
29902 </div>
29903
29904 <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>
29905 <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>
29906 <h2><span id="Тест"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29907 <h2><span id="Тест_2"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29908 <h2><span id="тест"></span><span class="mw-headline" id=".D1.82.D0.B5.D1.81.D1.82">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29909 <h2><span id="Hey_&lt;_#_&quot;_&gt;_%_:_'"></span><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29910 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#.D0.A2.D0.B5.D1.81.D1.82">#Тест</a> <a href="#.D1.82.D0.B5.D1.81.D1.82">#тест</a> <a href="#Hey_.3C_.23_.22_.3E_.25_:_.27">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29911 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29912 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29913 </p>
29914 !! end
29915
29916 # Parsoid doesn't support this mode.
29917 !! test
29918 HTML5 ids: no legacy
29919 !! config
29920 wgFragmentMode=[ 'html5' ]
29921 !! wikitext
29922 ==Foo bar==
29923
29924 ==foo Bar==
29925
29926 ==Тест==
29927
29928 ==Тест==
29929
29930 ==тест==
29931
29932 ==Hey < # " > % : '==
29933 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29934
29935 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29936
29937 <!-- These two links should produce identical HTML -->
29938 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29939
29940 !! html/php
29941 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29942 <ul>
29943 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29944 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29945 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29946 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29947 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29948 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29949 </ul>
29950 </div>
29951
29952 <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>
29953 <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>
29954 <h2><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29955 <h2><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29956 <h2><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29957 <h2><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29958 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29959 </p><p>💩 <span id="💩"></span>
29960 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29961 </p>
29962 !! end
29963
29964 !! test
29965 T90902: Normalize weird characters in section IDs
29966 !! config
29967 wgFragmentMode=[ 'html5', 'legacy' ]
29968 !! wikitext
29969 ==Foo&nbsp;bar==
29970 [[#Foo&nbsp;bar]]
29971
29972 !! html/php
29973 <h2><span class="mw-headline" id="Foo_bar">Foo&#160;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>
29974 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29975 </p>
29976 !! html/parsoid
29977 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
29978 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
29979 !! end
29980
29981 !! test
29982 T51672: Test for brackets in attributes of elements in external link texts
29983 !! wikitext
29984 [http://example.com/ link <span title="title with [brackets]">span</span>]
29985 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29986
29987 !! html/php
29988 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29989 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29990 </p>
29991 !! html/parsoid
29992 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
29993 <a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]" data-parsoid='{"stx":"html","a":{"title":"title with [brackets]"},"sa":{"title":"title with &amp;#91;brackets&amp;#93;"}}'>span</span></a></p>
29994 !! end
29995
29996 !! test
29997 T72875: Test for brackets in attributes of elements in internal link texts
29998 !! wikitext
29999 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30000 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30001
30002 !! html/php
30003 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30004 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30005 </p>
30006 !! html/parsoid
30007 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30008 <a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]" data-parsoid='{"stx":"html","a":{"title":"title with [[double brackets]]"},"sa":{"title":"title with &amp;#91;&amp;#91;double brackets&amp;#93;&amp;#93;"}}'>span</span></a></p>
30009 !! end
30010
30011 !! test
30012 T179544: {{anchorencode:}} output should be always usable in links
30013 !! config
30014 wgFragmentMode=[ 'html5' ]
30015 !! wikitext
30016 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30017 !! html/php
30018 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30019 </p>
30020 !! html/parsoid
30021 <p><span id="[foo]" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"id":"[foo]"},"sa":{"id":"{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[10,32,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'></span><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Main_Page#[foo]" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#[foo]"},"sa":{"href":"#{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"#&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[44,66,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt2\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'>#[foo]</a></p>
30022 !! end
30023
30024 ## ------------------------------
30025 ## Parsoid section-wrapping tests
30026 ## ------------------------------
30027 !! test
30028 Section wrapping for well-nested sections (no leading content)
30029 !! options
30030 parsoid={
30031 "wrapSections": true
30032 }
30033 !! wikitext
30034 =1=
30035 a
30036
30037 =2=
30038 b
30039
30040 ==2.1==
30041 c
30042
30043 ==2.2==
30044 d
30045
30046 ===2.2.1===
30047 e
30048
30049 =3=
30050 f
30051 !! html/parsoid
30052 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30053 <p>a</p>
30054
30055 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30056 <p>b</p>
30057
30058 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30059 <p>c</p>
30060
30061 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30062 <p>d</p>
30063
30064 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30065 <p>e</p>
30066
30067 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30068 <p>f</p>
30069
30070 </section>
30071 !! end
30072
30073 !! test
30074 Section wrapping for well-nested sections (with leading content)
30075 !! options
30076 parsoid={
30077 "wrapSections": true
30078 }
30079 !! wikitext
30080 Para 1.
30081
30082 Para 2 with a <div>nested in it</div>
30083
30084 Para 3.
30085
30086 =1=
30087 a
30088
30089 =2=
30090 b
30091
30092 ==2.1==
30093 c
30094 !! html/parsoid
30095 <section data-mw-section-id="0"><p>Para 1.</p>
30096
30097 <p>Para 2 with a </p><div>nested in it</div>
30098
30099 <p>Para 3.</p>
30100
30101 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30102 <p>a</p>
30103
30104 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30105 <p>b</p>
30106
30107 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30108 <p>c</p>
30109
30110 </section></section>
30111 !! end
30112
30113 !! test
30114 Section wrapping with template-generated sections (good nesting 1)
30115 !! options
30116 parsoid={
30117 "wrapSections": true
30118 }
30119 !! wikitext
30120 =1=
30121 a
30122
30123 {{echo|1=
30124 ==1.1==
30125 b
30126 }}
30127
30128 ==1.2==
30129 c
30130
30131 =2=
30132 d
30133 !! html/parsoid
30134 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30135 <p>a</p>
30136
30137 <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.1" data-parsoid='{"dsr":[9,33,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.1==\nb"}},"i":0}}]}'>1.1</h2><span about="#mwt1">
30138 </span><p about="#mwt1">b</p>
30139 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30140 <p>c</p>
30141
30142 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30143 <p>d</p></section>
30144 !! end
30145
30146 # In this example, the template scope is mildly expanded to incorporate the
30147 # trailing newline after the transclusion since that is part of section 1.1.1
30148 !! test
30149 Section wrapping with template-generated sections (good nesting 2)
30150 !! options
30151 parsoid={
30152 "wrapSections": true,
30153 "modes": ["wt2html", "wt2wt"]
30154 }
30155 !! wikitext
30156 =1=
30157 a
30158
30159 {{echo|1=
30160 ==1.1==
30161 b
30162 ===1.1.1===
30163 d
30164 }}
30165 =2=
30166 e
30167 !! html/parsoid
30168 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30169 <p>a</p>
30170
30171 <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.1" data-parsoid='{"dsr":[9,50,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.1==\nb\n===1.1.1===\nd"}},"i":0}},"\n"]}'>1.1</h2><span about="#mwt1">
30172 </span><p about="#mwt1">b</p><span about="#mwt1">
30173 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30174 </span><p about="#mwt1">d</p><span about="#mwt1">
30175 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30176 <p>e</p></section>
30177 !! end
30178
30179 # In this example, the template scope is mildly expanded to incorporate the
30180 # trailing newline after the transclusion since that is part of section 1.2.1
30181 !! test
30182 Section wrapping with template-generated sections (good nesting 3)
30183 !! options
30184 parsoid={
30185 "wrapSections": true,
30186 "modes": ["wt2html", "wt2wt"]
30187 }
30188 !! wikitext
30189 =1=
30190 a
30191
30192 {{echo|1=
30193 x
30194 ==1.1==
30195 b
30196 ==1.2==
30197 c
30198 ===1.2.1===
30199 d
30200 }}
30201 =2=
30202 e
30203 !! html/parsoid
30204 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30205 <p>a</p>
30206
30207 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[9,60,0,0],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"x\n==1.1==\nb\n==1.2==\nc\n===1.2.1===\nd"}},"i":0}},"\n"]}'>x</p><span about="#mwt1">
30208 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30209 </span><p about="#mwt1">b</p><span about="#mwt1">
30210 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30211 </span><p about="#mwt1">c</p><span about="#mwt1">
30212 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30213 </span><p about="#mwt1">d</p><span about="#mwt1">
30214 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30215 <p>e</p></section>
30216 !! end
30217
30218 # Because of section-wrapping and template-wrapping interactions,
30219 # the scope of the template is expanded so that the template markup
30220 # is valid in the presence of <section> tags.
30221 # This exercises the s1 is null scenario in the wrapSections code
30222 !! test
30223 Section wrapping with template-generated sections (bad nesting 1)
30224 !! options
30225 parsoid={
30226 "wrapSections": true
30227 }
30228 !! wikitext
30229 <div>
30230 a
30231
30232 {{echo|
30233 =1=
30234 b
30235 }}
30236
30237 c
30238 </div>
30239 !! html/parsoid
30240 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30241 <p>a</p>
30242
30243 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n=1=\nb\n"}},"i":0}},"\n\nc\n"]}'>
30244 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30245 </span><p about="#mwt1">b
30246 </p><span about="#mwt1">
30247
30248 </span><p about="#mwt1">c</p><span about="#mwt1">
30249 </span></section></div></section>
30250 !! end
30251
30252 # Because of section-wrapping and template-wrapping interactions,
30253 # the scope of the template is expanded so that the template markup
30254 # is valid in the presence of <section> tags.
30255 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30256 !! test
30257 Section wrapping with template-generated sections (bad nesting 2)
30258 !! options
30259 parsoid={
30260 "wrapSections": true
30261 }
30262 !! wikitext
30263 =1=
30264 a
30265
30266 {{echo|1=
30267 =2=
30268 b
30269 ==2.1==
30270 c
30271 }}
30272
30273 d
30274
30275 =3=
30276 e
30277 !! html/parsoid
30278 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30279 <p>a</p>
30280
30281 </section><section data-mw-section-id="-1"><h1 about="#mwt1" typeof="mw:Transclusion" id="2" data-parsoid='{"dsr":[9,45,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"=2=\nb\n==2.1==\nc"}},"i":0}},"\n\nd\n\n"]}'>2</h1><span about="#mwt1">
30282 </span><p about="#mwt1">b</p><span about="#mwt1">
30283 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30284 </span><p about="#mwt1">c</p><span about="#mwt1">
30285
30286 </span><p about="#mwt1">d</p><span about="#mwt1">
30287
30288 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30289 <p>e</p></section>
30290 !! end
30291
30292 # Because of section-wrapping and template-wrapping interactions,
30293 # additional template wrappers are added to <section> tags
30294 # so that template wrapping semantics are valid whether section
30295 # tags are retained or stripped. But, the template scope can expand
30296 # greatly when accounting for section tags.
30297 # This exercises the s1 and s2 are in different subtrees scenario
30298 !! test
30299 Section wrapping with template-generated sections (bad nesting 3)
30300 !! options
30301 parsoid={
30302 "wrapSections": true,
30303 "modes": ["wt2html", "wt2wt"]
30304 }
30305 !! wikitext
30306 =1=
30307 a
30308
30309 {{echo|1=
30310 ==1.2==
30311 b
30312 =2=
30313 c
30314 }}
30315
30316 d
30317
30318 =3=
30319 e
30320 !! html/parsoid
30321 <section data-mw-section-id="0"></section><section data-mw-section-id="1" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["=1=\na\n\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.2==\nb\n=2=\nc"}},"i":0}},"\n\nd\n\n"]}'><h1 id="1">1</h1>
30322 <p>a</p>
30323
30324 <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.2==\nb\n=2=\nc"}},"i":0}}]}'>1.2</h2><span about="#mwt1">
30325 </span><p about="#mwt1">b</p><span about="#mwt1">
30326 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30327 </span><p about="#mwt1">c</p>
30328
30329 <p>d</p>
30330 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30331 <p>e</p></section>
30332 !! end
30333
30334 !! test
30335 Section wrapping with uneditable lead section + div wrapping multiple sections
30336 !! options
30337 parsoid={
30338 "wrapSections": true
30339 }
30340 !! wikitext
30341 foo
30342
30343 <div style="border:1px solid red;">
30344 =1=
30345 a
30346
30347 ==1.1==
30348 b
30349
30350 =2=
30351 c
30352 </div>
30353
30354 =3=
30355 d
30356
30357 ==3.1==
30358 e
30359 !! html/parsoid
30360 <section data-mw-section-id="-1"><p>foo</p>
30361
30362 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30363 <section data-mw-section-id="1"><h1 id="1">1</h1>
30364 <p>a</p>
30365
30366 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30367 <p>b</p>
30368
30369 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30370 <p>c</p>
30371 </section></div>
30372
30373 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30374 <p>d</p>
30375
30376 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30377 <p>e</p>
30378 </section></section>
30379 !! end
30380
30381 !! test
30382 Section wrapping with editable lead section + div overlapping multiple sections
30383 !! options
30384 parsoid={
30385 "wrapSections": true
30386 }
30387 !! wikitext
30388 foo
30389
30390 =1=
30391 a
30392 <div style="border:1px solid red;">
30393 b
30394
30395 ==1.1==
30396 c
30397
30398 =2=
30399 d
30400 </div>
30401 e
30402
30403 =3=
30404 f
30405
30406 ==3.1==
30407 g
30408 !! html/parsoid
30409 <section data-mw-section-id="0"><p>foo</p>
30410
30411 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30412 <p>a</p>
30413 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30414 <p>b</p>
30415
30416 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30417 <p>c</p>
30418
30419 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30420 <p>d</p>
30421 </section></div>
30422 <p>e</p>
30423
30424 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30425 <p>f</p>
30426
30427 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30428 <p>g</p>
30429 </section></section>
30430 !! end
30431
30432 !! test
30433 HTML header tags should not be wrapped in section tags
30434 !! options
30435 parsoid={
30436 "wrapSections": true
30437 }
30438 !! wikitext
30439 foo
30440
30441 <h1>a</h1>
30442
30443 =b=
30444
30445 <h1>c</h1>
30446
30447 =d=
30448 !! html/parsoid
30449 <section data-mw-section-id="0"><p>foo</p>
30450
30451 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30452
30453 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30454
30455 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30456
30457 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30458 !! end
30459
30460 !! test
30461 Lead section containing only whitespace and comments.
30462 !! options
30463 parsoid={
30464 "wrapSections": true
30465 }
30466 !! wikitext
30467
30468 <!-- this is a comment, presumably significant to editors -->
30469 =1=
30470 a
30471
30472 =2=
30473 b
30474 !! html/parsoid
30475 <section data-mw-section-id="0" data-parsoid="{}">
30476 <!-- this is a comment, presumably significant to editors -->
30477 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30478 <p>a</p>
30479
30480 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30481 <p>b</p></section>
30482 !! end
30483
30484 !! test
30485 Pseudo-sections emitted by templates should have id -2
30486 !! options
30487 parsoid={
30488 "wrapSections": true
30489 }
30490 !! wikitext
30491 foo
30492 {{echo|<div>
30493 ==a==
30494 ==b==
30495 </div>
30496 }}
30497 !! html/parsoid
30498 <section data-mw-section-id="-1"><p>foo</p>
30499 </section><section data-mw-section-id="-2"><div 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;div>\n==a==\n==b==\n&lt;/div>\n"}},"i":0}}]}'>
30500 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30501 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30502 </section></div><span about="#mwt1">
30503 </span></section>
30504 !! end
30505
30506 ##########################################################################
30507 Tests demonstrating white-space insensitivity in input wikitext
30508 for wikitext headings, wikitext list items, and wikitext table captions,
30509 headings, and cells. HTML versions of the same should preserve whitespace.
30510 ##########################################################################
30511 !! test
30512 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30513 !! wikitext
30514 __NOTOC__
30515 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
30516 == <!--c2--> <!--c2--> Tabs <!--c3--><!--c4--> ==
30517 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30518 ; <!--term to define--> term : <!--term's definition--> definition
30519 {|
30520 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30521 |-
30522 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30523 |-
30524 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30525 |-
30526 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30527 |-
30528 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30529 |}
30530 : {|
30531 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30532 |} foo <!--c1-->
30533 !! html/php+tidy
30534 <h2><span class="mw-headline" id="Spaces">Spaces</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: Spaces">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
30535 <h2><span class="mw-headline" id="Tabs">Tabs</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: Tabs">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
30536 <ul><li>List item</li></ul>
30537 <dl><dt>term&#160;</dt>
30538 <dd>definition</dd></dl>
30539 <table>
30540 <caption>Table Caption
30541 </caption>
30542 <tbody><tr>
30543 <th>Table Heading 1</th>
30544 <th>Table Heading 2
30545 </th></tr>
30546 <tr>
30547 <td>Table Cell 1</td>
30548 <td>Table Cell 2
30549 </td></tr>
30550 <tr>
30551 <td>class="foo"</td>
30552 <td>Table Cell 3
30553 </td></tr>
30554 <tr>
30555 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | some content
30556 </td></tr></tbody></table>
30557 <dl><dd><table>
30558 <tbody><tr>
30559 <td>Table Cell 1</td>
30560 <td>Table Cell 2
30561 </td></tr></tbody></table> foo</dd></dl>
30562 !! end
30563
30564 # Looks like <caption> is not accepted in HTML
30565 !! test
30566 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30567 !! wikitext
30568 __NOTOC__
30569 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
30570 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30571 <table>
30572 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30573 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30574 </table>
30575 !! html/php+tidy
30576 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
30577 <ul><li> List item </li></ul>
30578 <table>
30579 <tbody><tr><th> Table Heading </th><th></th></tr>
30580 <tr><td> Table Cell </td><th></th></tr>
30581 </tbody></table>
30582 !! end
30583
30584 !! test
30585 Do not trim whitespace in links and quotes
30586 !! wikitext
30587 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30588 [[Foo| some text ]]
30589 !! html/php+tidy
30590 <p>foo <i> italic </i> and <b> bold </b>
30591 <a href="/wiki/Foo" title="Foo"> some text </a>
30592 </p>
30593 !! end