Merge "rdbms: clean up DBO_TRX behavior for onTransactionPreCommitOrIdle()"
[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</span></h1>
16971 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16972 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16973
16974 !! html/parsoid
16975 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
16976 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
16977 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
16978
16979 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
16980 </h1>
16981 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
16982 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
16983 <meta property="mw:PageProp/noeditsection"/>
16984 !! end
16985
16986 !! test
16987 Single-line or multiline-comments can follow headings
16988 !! options
16989 parsoid=wt2html,wt2wt
16990 !! wikitext
16991 ==foo==<!---->
16992 ==bar==<!--c1-->
16993 ==baz==<!--
16994 c2
16995 c3-->
16996 !! html/php
16997 <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>
16998 <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>
16999 <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>
17000
17001 !! html/parsoid
17002 <h2 id="foo">foo</h2><!---->
17003 <h2 id="bar">bar</h2><!--c1-->
17004 <h2 id="baz">baz</h2><!--
17005 c2
17006 c3-->
17007 !! end
17008
17009 !! test
17010 T3219 URL next to image (broken)
17011 !! wikitext
17012 http://example.com[[File:Foobar.jpg]]
17013 !! html/php
17014 <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>
17015 </p>
17016 !! html/parsoid
17017 <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>
17018 !!end
17019
17020 !! test
17021 T3186 news: in the middle of text
17022 !! wikitext
17023 http://en.wikinews.org/wiki/Wikinews:Workplace
17024 !! html
17025 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17026 </p>
17027 !!end
17028
17029
17030 !! test
17031 Namespaced link must have a title
17032 !! wikitext
17033 [[Project:]]
17034 !! html
17035 <p>[[Project:]]
17036 </p>
17037 !!end
17038
17039 !! test
17040 Namespaced link must have a title (bad fragment version)
17041 !! wikitext
17042 [[Project:#fragment]]
17043 !! html
17044 <p>[[Project:#fragment]]
17045 </p>
17046 !!end
17047
17048
17049 ###
17050 ### HTML tags and HTML attributes
17051 ###
17052
17053 !! test
17054 div with no attributes
17055 !! wikitext
17056 <div>HTML rocks</div>
17057 !! html
17058 <div>HTML rocks</div>
17059
17060 !! end
17061
17062 !! test
17063 div with double-quoted attribute
17064 !! wikitext
17065 <div id="rock">HTML rocks</div>
17066 !! html
17067 <div id="rock">HTML rocks</div>
17068
17069 !! end
17070
17071 !! test
17072 div with single-quoted attribute
17073 !! wikitext
17074 <div id='rock'>HTML rocks</div>
17075 !! html
17076 <div id="rock">HTML rocks</div>
17077
17078 !! end
17079
17080 !! test
17081 div with unquoted attribute
17082 !! wikitext
17083 <div id=rock>HTML rocks</div>
17084 !! html
17085 <div id="rock">HTML rocks</div>
17086
17087 !! end
17088
17089 !! test
17090 div with illegal double attributes
17091 !! wikitext
17092 <div id="a" id="b">HTML rocks</div>
17093 !! html
17094 <div id="b">HTML rocks</div>
17095
17096 !!end
17097
17098 !! test
17099 div with empty attribute value, space before equals
17100 !! options
17101 parsoid=wt2html,html2html
17102 !! wikitext
17103 <div class =>HTML rocks</div>
17104 !! html/php
17105 <div class="">HTML rocks</div>
17106
17107 !! html/parsoid
17108 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17109 !! end
17110
17111 !! test
17112 div with multiple empty attribute values
17113 !! config
17114 wgFragmentMode=[ 'html5', 'legacy' ]
17115 !! options
17116 parsoid=wt2html,html2html
17117 !! wikitext
17118 <div id= title=>HTML rocks</div>
17119 !! html/php
17120 <div id="title=">HTML rocks</div>
17121
17122 !! html/parsoid
17123 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17124 !! end
17125
17126 # FIXME Parsoid doesn't actually match PHP here.
17127 # Probably we should use the synthetic <foo /> or <indicator>
17128 # extensions for this test, which are enabled when running parser tests.
17129 !! test
17130 Extension tag in attribute value
17131 !! wikitext
17132 <span title="<translate>123</translate>">ok</span>
17133 !! html/php+disabled
17134 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17135 </p>
17136 !! html/parsoid
17137 <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>
17138 !! end
17139
17140 !! test
17141 table with multiple empty attribute values
17142 !! options
17143 parsoid=wt2html,html2html
17144 !! wikitext
17145 {| title= id=
17146 |hi
17147 |}
17148 !! html/php
17149 <table title="id=">
17150 <tr>
17151 <td>hi
17152 </td></tr></table>
17153
17154 !! html/parsoid
17155 <table title="id=">
17156 <tbody><tr><td>hi</td></tr>
17157 </tbody></table>
17158 !! end
17159
17160 !! test
17161 div with braces in attribute value
17162 !! wikitext
17163 <div title="{}">Foo</div>
17164 !! html/php
17165 <div title="&#123;&#125;">Foo</div>
17166
17167 !! html/parsoid
17168 <div title="{}">Foo</div>
17169 !! end
17170
17171 !! test
17172 div with empty attribute value, no space before equals
17173 !! options
17174 parsoid=wt2html,html2html
17175 !! wikitext
17176 <div class=>HTML rocks</div>
17177 !! html/php
17178 <div class="">HTML rocks</div>
17179
17180 !! html/parsoid
17181 <div class="">HTML rocks</div>
17182 !! end
17183
17184 !! test
17185 HTML multiple attributes correction
17186 !! wikitext
17187 <p class="error" class="awesome">Awesome!</p>
17188 !! html
17189 <p class="awesome">Awesome!</p>
17190
17191 !!end
17192
17193 !! test
17194 Table multiple attributes correction
17195 !! wikitext
17196 {|
17197 !+ class="error" class="awesome"|status
17198 |}
17199 !! html
17200 <table>
17201 <tr>
17202 <th class="awesome">status
17203 </th></tr></table>
17204
17205 !!end
17206
17207 !! test
17208 DIV IN UPPERCASE
17209 !! wikitext
17210 <DIV ID="x">HTML ROCKS</DIV>
17211 !! html
17212 <div id="x">HTML ROCKS</div>
17213
17214 !!end
17215
17216 !! test
17217 Non-ASCII pseudo-tags are rendered as text
17218 !! wikitext
17219 <khyô>
17220 !! html
17221 <p>&lt;khyô&gt;
17222 </p>
17223 !! end
17224
17225 !! test
17226 Pseudo-tag with URL 'name' renders as url link
17227 !! wikitext
17228 <http://example.com/>
17229 !! html
17230 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17231 </p>
17232 !! end
17233
17234 !! test
17235 text with amp in the middle of nowhere
17236 !! wikitext
17237 Remember AT&T?
17238 !! html
17239 <p>Remember AT&amp;T?
17240 </p>
17241 !! end
17242
17243 !! test
17244 text with character entity: eacute
17245 !! wikitext
17246 I always thought &eacute; was a cute letter.
17247 !! html+tidy
17248 <p>I always thought &#233; was a cute letter.
17249 </p>
17250 !! end
17251
17252 !! test
17253 text with entity-escaped character entity-like string: eacute
17254 !! wikitext
17255 I always thought &amp;eacute; was a cute letter.
17256 !! html
17257 <p>I always thought &amp;eacute; was a cute letter.
17258 </p>
17259 !! end
17260
17261 !! test
17262 text with undefined character entity: xacute
17263 !! wikitext
17264 I always thought &xacute; was a cute letter.
17265 !! html
17266 <p>I always thought &amp;xacute; was a cute letter.
17267 </p>
17268 !! end
17269
17270 !! test
17271 HTML5 tags
17272 !! wikitext
17273 <data value="5">five</data>
17274 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17275 <mark>This highlighted text</mark>
17276 !! html
17277 <p><data value="5">five</data>
17278 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17279 <mark>This highlighted text</mark>
17280 </p>
17281 !! end
17282
17283 !! test
17284 HTML tag with leading space is parsed as text
17285 !! wikitext
17286 < div>foo< /div>
17287 !! html
17288 <p>&lt; div&gt;foo&lt; /div&gt;
17289 </p>
17290 !! end
17291
17292 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17293 ## the HTML5 parsing spec.
17294 !! test
17295 Element with broken attribute syntax
17296 !! options
17297 parsoid=wt2html
17298 !! wikitext
17299 <div style=" style="123">hi</div>
17300 <div =>ho</div>
17301 !! html/php
17302 <div style="123">hi</div>
17303 <div>ho</div>
17304
17305 !! html/parsoid
17306 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17307 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17308 !! end
17309
17310 ###
17311 ### Nesting tests (see T43545, T52604, T53081)
17312 ###
17313
17314 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17315 # Note that html2wt is considerably more difficult if we use <b> in
17316 # the test case, instead of <small>
17317 !! test
17318 Ensure that HTML adoption agency algorithm is properly implemented.
17319 !! wikitext
17320 <small>X<small>Y</small>Z</small>
17321 !! html
17322 <p><small>X<small>Y</small>Z</small>
17323 </p>
17324 !! end
17325
17326 # This was T43545 in the PHP parser.
17327 !! test
17328 Nesting of <kbd>
17329 !! wikitext
17330 <kbd>X<kbd>Y</kbd>Z</kbd>
17331 !! html+tidy
17332 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17333 </p>
17334 !! end
17335
17336 # The following cases were T53081 in the PHP parser.
17337 # Note that there are some other nestable tags (b, i, etc) which are
17338 # not covered; see T53081 for discussion.
17339
17340 !! test
17341 Nesting of <em>
17342 !! wikitext
17343 <em>X<em>Y</em>Z</em>
17344 !! html+tidy
17345 <p><em>X<em>Y</em>Z</em>
17346 </p>
17347 !! end
17348
17349 !! test
17350 Nesting of <strong>
17351 !! wikitext
17352 <strong>X<strong>Y</strong>Z</strong>
17353 !! html+tidy
17354 <p><strong>X<strong>Y</strong>Z</strong>
17355 </p>
17356 !! end
17357
17358 !! test
17359 Nesting of <q>
17360 !! wikitext
17361 <q>X<q>Y</q>Z</q>
17362 !! html+tidy
17363 <p><q>X<q>Y</q>Z</q>
17364 </p>
17365 !! end
17366
17367 !! test
17368 Nesting of <ruby>
17369 !! wikitext
17370 <ruby>X<ruby>Y</ruby>Z</ruby>
17371 !! html
17372 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17373 </p>
17374 !! end
17375
17376 !! test
17377 Nesting of <bdo>
17378 !! wikitext
17379 <bdo>X<bdo>Y</bdo>Z</bdo>
17380 !! html
17381 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17382 </p>
17383 !! end
17384
17385
17386 ###
17387 ### Media links
17388 ###
17389
17390 !! test
17391 Media link
17392 !! wikitext
17393 [[Media:Foobar.jpg]]
17394 [[Media:Video.ogv]]
17395 [[:Media:Video.ogv]]
17396 !! html/php
17397 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17398 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17399 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17400 </p>
17401 !! html/parsoid
17402 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17403 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17404 <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>
17405 !! end
17406
17407 !! test
17408 Media link with text
17409 !! wikitext
17410 [[Media:Foobar.jpg|A neat file to look at]]
17411 !! html/php
17412 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17413 </p>
17414 !! html/parsoid
17415 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17416 !! end
17417
17418 # FIXME: this is still bad HTML tag nesting
17419 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17420 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17421 !! test
17422 Media link with nasty text
17423 !! wikitext
17424 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17425 !! html/php
17426 <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>
17427
17428 !! html/php+tidy
17429 <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>
17430 !! html/parsoid
17431 <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>
17432
17433 !! end
17434
17435 !! test
17436 Media link to nonexistent file (T3702)
17437 !! wikitext
17438 [[Media:No such.jpg]]
17439 [[Media:No_such file.jpg]]
17440 !! html/php
17441 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17442 <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>
17443 </p>
17444 !! html/parsoid
17445 <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>
17446 <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>
17447 !! end
17448
17449 !! test
17450 Image link to nonexistent file (T3850 - good)
17451 !! wikitext
17452 [[File:No_such.jpg]]
17453 !! html/php
17454 <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>
17455 </p>
17456 !! html/parsoid
17457 <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>
17458 !! end
17459
17460 !! test
17461 :Image link to nonexistent file (T3850 - bad)
17462 !! wikitext
17463 [[:Image:No such.jpg]]
17464 !! html/php
17465 <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>
17466 </p>
17467 !! html/parsoid
17468 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17469 !! end
17470
17471 !! test
17472 Character reference normalization in link text (T3938)
17473 !! wikitext
17474 [[Main Page|this&that]]
17475 !! html
17476 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17477 </p>
17478 !!end
17479
17480 !! article
17481 אַ
17482 !! text
17483 Test for unicode normalization
17484
17485 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17486 !! endarticle
17487
17488 !! test
17489 (T21451) Links should refer to the normalized form.
17490 !! wikitext
17491 [[&#xFB2E;]]
17492 [[&#x5d0;&#x5b7;]]
17493 [[&#x5d0;ַ]]
17494 [[א&#x5b7;]]
17495 [[אַ]]
17496 !! html
17497 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17498 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17499 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17500 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17501 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17502 </p>
17503 !! end
17504
17505 !! test
17506 Empty attribute crash test (T4067)
17507 !! wikitext
17508 <font color="">foo</font>
17509 !! html
17510 <p><font color="">foo</font>
17511 </p>
17512 !! end
17513
17514 !! test
17515 Empty attribute crash test single-quotes (T4067)
17516 !! wikitext
17517 <font color=''>foo</font>
17518 !! html
17519 <p><font color="">foo</font>
17520 </p>
17521 !! end
17522
17523 !! test
17524 Attribute test: equals, then nothing
17525 !! options
17526 parsoid=wt2html,html2html
17527 !! wikitext
17528 <font color=>foo</font>
17529 !! html/php
17530 <p><font color="">foo</font>
17531 </p>
17532 !! html/parsoid
17533 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17534 !! end
17535
17536 !! test
17537 Attribute test: unquoted value
17538 !! options
17539 parsoid=wt2html,html2html
17540 !! wikitext
17541 <font color=x>foo</font>
17542 !! html/php
17543 <p><font color="x">foo</font>
17544 </p>
17545 !! html/parsoid
17546 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17547 !! end
17548
17549 !! test
17550 Attribute test: unquoted but illegal value (hash)
17551 !! wikitext
17552 <font color=#x>foo</font>
17553 !! html
17554 <p><font color="#x">foo</font>
17555 </p>
17556 !! end
17557
17558 # Parsoid does not serialize to empty attribute syntax,
17559 # so wt2wt and html2wt cases are skipped
17560 !! test
17561 Attribute test: no value (T54330)
17562 !! options
17563 parsoid=wt2html,html2html
17564 !! wikitext
17565 <font color>foo</font>
17566 !! html/php
17567 <p><font color="">foo</font>
17568 </p>
17569 !! html/parsoid
17570 <p><font color="">foo</font></p>
17571 !! end
17572
17573 !! test
17574 T4095: link with three closing brackets
17575 !! wikitext
17576 [[Main Page]]]
17577 !! html/php
17578 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17579 </p>
17580 !! html/parsoid
17581 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17582 !! end
17583
17584 !! test
17585 T4095: link with pipe and three closing brackets
17586 !! wikitext
17587 [[Main Page|link]]]
17588 !! html/php
17589 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17590 </p>
17591 !! html/parsoid
17592 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17593 !! end
17594
17595 !! test
17596 T4095: link with pipe and three closing brackets, version 2
17597 !! wikitext
17598 [[Main Page|[http://example.com/]]]
17599 !! html/php
17600 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17601 </p>
17602 !! html/parsoid
17603 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17604 !! end
17605
17606
17607 ###
17608 ### Safety
17609 ###
17610
17611 !! article
17612 Template:Dangerous attribute
17613 !! text
17614 " onmouseover="alert(document.cookie)
17615 !! endarticle
17616
17617 !! article
17618 Template:Dangerous style attribute
17619 !! text
17620 border-size: expression(alert(document.cookie))
17621 !! endarticle
17622
17623 !! article
17624 Template:Div style
17625 !! text
17626 <div style="float: right; {{{1}}}">Magic div</div>
17627 !! endarticle
17628
17629 !! test
17630 T4304: HTML attribute safety (safe template; regression T4309)
17631 !! wikitext
17632 <div title="{{test}}"></div>
17633 !! html/php
17634 <div title="This is a test template"></div>
17635
17636 !! html/parsoid
17637 <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>
17638 !! end
17639
17640 # Parsoid has enough context to handle this case
17641 !! test
17642 T4304: HTML attribute safety (dangerous template; 2309)
17643 !! wikitext
17644 <div title="{{dangerous attribute}}"></div>
17645 !! html/php
17646 <div title=""></div>
17647
17648 !! html/parsoid
17649 <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>
17650 !! end
17651
17652 !! test
17653 T4304: HTML attribute safety (dangerous style template; 2309)
17654 !! wikitext
17655 <div style="{{dangerous style attribute}}"></div>
17656 !! html/php
17657 <div style="/* insecure input */"></div>
17658
17659 !! html/parsoid
17660 <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>
17661 !! end
17662
17663 !! test
17664 T4304: HTML attribute safety (safe parameter; 2309)
17665 !! wikitext
17666 {{div style|width: 200px}}
17667 !! html/php
17668 <div style="float: right; width: 200px">Magic div</div>
17669
17670 !! html/parsoid
17671 <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>
17672 !! end
17673
17674 !! test
17675 T4304: HTML attribute safety (unsafe parameter; 2309)
17676 !! wikitext
17677 {{div style|width: expression(alert(document.cookie))}}
17678 !! html/php
17679 <div style="/* insecure input */">Magic div</div>
17680
17681 !! html/parsoid
17682 <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>
17683 !! end
17684
17685 ## Parsoid output here differs; needs investigation.
17686 !! test
17687 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17688 !! wikitext
17689 {{div style|"><script>alert(document.cookie)</script>}}
17690 !! html
17691 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17692
17693 !! end
17694
17695 ## Parsoid output here differs; needs investigation.
17696 !! test
17697 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17698 !! wikitext
17699 {{div style|" ><script>alert(document.cookie)</script>}}
17700 !! html
17701 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17702
17703 !! end
17704
17705 !! test
17706 T4304: HTML attribute safety (link)
17707 !! wikitext
17708 <div title="[[Main Page]]"></div>
17709 !! html/php
17710 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17711
17712 !! html/parsoid
17713 <div title="[[Main Page]]"></div>
17714 !! end
17715
17716 !! test
17717 T4304: HTML attribute safety (italics)
17718 !! wikitext
17719 <div title="''foobar''"></div>
17720 !! html
17721 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17722
17723 !! end
17724
17725 !! test
17726 T4304: HTML attribute safety (bold)
17727 !! wikitext
17728 <div title="'''foobar'''"></div>
17729 !! html
17730 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17731
17732 !! end
17733
17734 !! test
17735 T4304: HTML attribute safety (ISBN)
17736 !! wikitext
17737 <div title="ISBN 1234567890"></div>
17738 !! html
17739 <div title="&#73;SBN 1234567890"></div>
17740
17741 !! end
17742
17743 !! test
17744 T4304: HTML attribute safety (RFC)
17745 !! wikitext
17746 <div title="RFC 1234"></div>
17747 !! html
17748 <div title="&#82;FC 1234"></div>
17749
17750 !! end
17751
17752 !! test
17753 T4304: HTML attribute safety (PMID)
17754 !! wikitext
17755 <div title="PMID 1234567890"></div>
17756 !! html
17757 <div title="&#80;MID 1234567890"></div>
17758
17759 !! end
17760
17761 !! test
17762 T4304: HTML attribute safety (web link)
17763 !! wikitext
17764 <div title="http://example.com/"></div>
17765 !! html
17766 <div title="http&#58;//example.com/"></div>
17767
17768 !! end
17769
17770 !! test
17771 T4304: HTML attribute safety (named web link)
17772 !! wikitext
17773 <div title="[http://example.com/ link]"></div>
17774 !! html/php
17775 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17776
17777 !! html/parsoid
17778 <div title="[http://example.com/ link]"></div>
17779 !! end
17780
17781 !! test
17782 T5244: HTML attribute safety (extension; safe)
17783 !! wikitext
17784 <div style="<nowiki>background:blue</nowiki>"></div>
17785 !! html/php
17786 <div style="background:blue"></div>
17787
17788 !! html/parsoid
17789 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17790 !! end
17791
17792 !! test
17793 T5244: HTML attribute safety (extension; unsafe)
17794 !! wikitext
17795 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17796 !! html/php
17797 <div style="/* insecure input */"></div>
17798
17799 !! html/parsoid
17800 <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>
17801 !! end
17802
17803 # More MSIE fun discovered by Tom Gilder
17804
17805 !! test
17806 MSIE CSS safety test: spurious slash
17807 !! wikitext
17808 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17809 !! html/php
17810 <div style="/* insecure input */">evil</div>
17811
17812 !! html/parsoid
17813 <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>
17814 !! end
17815
17816 !! test
17817 MSIE CSS safety test: hex code
17818 !! wikitext
17819 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17820 !! html/php
17821 <div style="/* insecure input */">evil</div>
17822
17823 !! html/parsoid
17824 <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>
17825 !! end
17826
17827 !! test
17828 MSIE CSS safety test: comment in url
17829 !! wikitext
17830 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17831 !! html/php
17832 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17833
17834 !! html/parsoid
17835 <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>
17836 !! end
17837
17838 !! test
17839 MSIE CSS safety test: comment in expression
17840 !! wikitext
17841 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17842 !! html/php
17843 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17844
17845 !! html/parsoid
17846 <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>
17847 !! end
17848
17849 !! test
17850 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17851 !! wikitext
17852 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17853 !! html/php
17854 <p style="/* invalid control char */">A</p>
17855
17856 !! html/parsoid
17857 <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>
17858 !! end
17859
17860 !! test
17861 MSIE 6 CSS safety test: Fullwidth (T57332)
17862 !! wikitext
17863 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17864 <div style="top:EXPRESSION(alert())">B</div>
17865 !! html/php
17866 <p style="/* insecure input */">A</p>
17867 <div style="/* insecure input */">B</div>
17868
17869 !! html/parsoid
17870 <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>
17871 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17872 !! end
17873
17874 !! test
17875 MSIE 6 CSS safety test: IPA extensions (T57332)
17876 !! wikitext
17877 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17878 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17879 !! html/php
17880 <div style="/* insecure input */">A</div>
17881 <p style="/* insecure input */">B</p>
17882
17883 !! html/parsoid
17884 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17885 <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>
17886 !! end
17887
17888 !! test
17889 MSIE 6 CSS safety test: sup/sub script (T57332)
17890 !! wikitext
17891 <div style="background-image:url⁽javascript:alert())">A</div>
17892 <div style="background-image:url₍javascript:alert())">B</div>
17893 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17894 !! html/php
17895 <div style="/* insecure input */">A</div>
17896 <div style="/* insecure input */">B</div>
17897 <p style="/* insecure input */">C</p>
17898
17899 !! html/parsoid
17900 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17901 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17902 <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>
17903 !! end
17904
17905 !! test
17906 Opera -o-link CSS
17907 !! options
17908 parsoid=wt2html,html2html
17909 !! wikitext
17910 <div
17911 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;"
17912 style="-o-link:attr(title);-o-link-source:current">X</div>
17913 !! html/php
17914 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17915
17916 !! html/parsoid
17917 <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>
17918 !! end
17919
17920 !! test
17921 MSIE 6 CSS safety test: Repetition markers (T57332)
17922 !! wikitext
17923 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17924 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17925 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17926 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17927 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17928 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17929 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17930 !! html/php
17931 <p style="/* insecure input */">A</p>
17932 <p style="/* insecure input */">B</p>
17933 <p style="/* insecure input */">C</p>
17934 <p style="/* insecure input */">D</p>
17935 <p style="/* insecure input */">E</p>
17936 <p style="/* insecure input */">F</p>
17937 <p style="/* insecure input */">G</p>
17938
17939 !! html/parsoid
17940 <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>
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;)"}}'>B</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;)"}}'>C</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;)"}}'>D</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;)"}}'>E</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;)"}}'>F</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;)"}}'>G</p>
17947 !! end
17948
17949 !! test
17950 Table attribute legitimate extension
17951 !! wikitext
17952 {|
17953 !+ style="<nowiki>color:blue</nowiki>"|status
17954 |}
17955 !! html
17956 <table>
17957 <tr>
17958 <th style="color:blue">status
17959 </th></tr></table>
17960
17961 !!end
17962
17963 !! test
17964 Table attribute safety
17965 !! wikitext
17966 {|
17967 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
17968 |}
17969 !! html
17970 <table>
17971 <tr>
17972 <th style="/* insecure input */">status
17973 </th></tr></table>
17974
17975 !! end
17976
17977 !! test
17978 CSS line continuation 1
17979 !! wikitext
17980 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17981 !! html
17982 <div style="/* insecure input */"></div>
17983
17984 !! end
17985
17986 !! test
17987 CSS line continuation 2
17988 !! wikitext
17989 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17990 !! html
17991 <div style="/* invalid control char */"></div>
17992
17993 !! end
17994
17995 !! article
17996 Template:Identity
17997 !! text
17998 {{{1}}}
17999 !! endarticle
18000
18001 !! test
18002 Expansion of multi-line templates in attribute values (T8255)
18003 !! wikitext
18004 <div style="background: {{identity|#00FF00}}">-</div>
18005 !! html
18006 <div style="background: #00FF00">-</div>
18007
18008 !! end
18009
18010 !! test
18011 Expansion of multi-line templates in attribute values (T8255 sanity check)
18012 !! wikitext
18013 <div style="background:
18014 #00FF00">-</div>
18015 !! html/php
18016 <div style="background: #00FF00">-</div>
18017
18018 !! html/parsoid
18019 <div style="background:
18020 #00FF00">-</div>
18021 !! end
18022
18023 !! test
18024 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18025 !! wikitext
18026 <div style="background: &#10;#00FF00">-</div>
18027 !! html
18028 <div style="background: &#10;#00FF00">-</div>
18029
18030 !! end
18031
18032 !! test
18033 Tags which are hidden from tidiers cannot pass through the Sanitizer
18034 !! wikitext
18035 <mw:toc><script>alert();</script></mw:toc>
18036 !! html+tidy
18037 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18038 </p>
18039 !! end
18040
18041 ###
18042 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18043 ###
18044
18045 !! test
18046 Parser hook: empty input
18047 !! wikitext
18048 <tag></tag>
18049 !! html/php
18050 <pre>
18051 ''
18052 array (
18053 )
18054 </pre>
18055
18056 !! html/parsoid
18057 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18058 !! end
18059
18060 ## Don't expect parsoid to rt this form.
18061 !! test
18062 Parser hook: empty input using terminated empty elements
18063 !! options
18064 parsoid=wt2html,html2html
18065 !! wikitext
18066 <tag/>
18067 !! html/php
18068 <pre>
18069 NULL
18070 array (
18071 )
18072 </pre>
18073
18074 !! html/parsoid
18075 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18076 !! end
18077
18078 !! test
18079 Parser hook: empty input using terminated empty elements (space before)
18080 !! wikitext
18081 <tag />
18082 !! html/php
18083 <pre>
18084 NULL
18085 array (
18086 )
18087 </pre>
18088
18089 !! html/parsoid
18090 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18091 !! end
18092
18093 !! test
18094 Parser hook: basic input
18095 !! wikitext
18096 <tag>input</tag>
18097 !! html/php
18098 <pre>
18099 'input'
18100 array (
18101 )
18102 </pre>
18103
18104 !! html/parsoid
18105 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18106 !! end
18107
18108 ## Don't expect parsoid to rt this form.
18109 !! test
18110 Parser hook: case insensitive
18111 !! options
18112 parsoid=wt2html,html2html
18113 !! wikitext
18114 <TAG>input</TAG>
18115 !! html/php
18116 <pre>
18117 'input'
18118 array (
18119 )
18120 </pre>
18121
18122 !! html/parsoid
18123 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18124 !! end
18125
18126 ## Don't expect parsoid to rt this form.
18127 !! test
18128 Parser hook: case insensitive, redux
18129 !! options
18130 parsoid=wt2html,html2html
18131 !! wikitext
18132 <TaG>input</TAg>
18133 !! html/php
18134 <pre>
18135 'input'
18136 array (
18137 )
18138 </pre>
18139
18140 !! html/parsoid
18141 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18142 !! end
18143
18144 !! test
18145 Parser hook: nested tags
18146 !! wikitext
18147 <tag><tag></tag></tag>
18148 !! html/php
18149 <pre>
18150 '<tag>'
18151 array (
18152 )
18153 </pre>&lt;/tag&gt;
18154
18155 !! html/parsoid
18156 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18157 !! end
18158
18159 !! test
18160 Parser hook: basic arguments
18161 !! wikitext
18162 <tag width="200" height="100" depth="50" square=""></tag>
18163 !! html/php
18164 <pre>
18165 ''
18166 array (
18167 'width' => '200',
18168 'height' => '100',
18169 'depth' => '50',
18170 'square' => '',
18171 )
18172 </pre>
18173
18174 !! html/parsoid
18175 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18176 !! end
18177
18178 ## Don't expect parsoid to rt this form.
18179 !! test
18180 Parser hook: basic arguments, variations
18181 !! options
18182 parsoid=wt2html,html2html
18183 !! wikitext
18184 <tag width=200 height = "100" depth = '50' square></tag>
18185 !! html/php
18186 <pre>
18187 ''
18188 array (
18189 'width' => '200',
18190 'height' => '100',
18191 'depth' => '50',
18192 'square' => '',
18193 )
18194 </pre>
18195
18196 !! html/parsoid
18197 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18198 !! end
18199
18200 !! test
18201 Parser hook: argument containing a forward slash (T7344)
18202 !! wikitext
18203 <tag filename="/tmp/bla"></tag>
18204 !! html/php
18205 <pre>
18206 ''
18207 array (
18208 'filename' => '/tmp/bla',
18209 )
18210 </pre>
18211
18212 !! html/parsoid
18213 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18214 !! end
18215
18216 ## Don't expect parsoid to rt this form.
18217 !! test
18218 Parser hook: empty input using terminated empty elements (T4374)
18219 !! options
18220 parsoid=wt2html,html2html
18221 !! wikitext
18222 <tag foo=bar/>text
18223 !! html/php
18224 <pre>
18225 NULL
18226 array (
18227 'foo' => 'bar',
18228 )
18229 </pre>text
18230
18231 !! html/parsoid
18232 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18233 !! end
18234
18235 ## </tag> should be output literally since there is no matching tag that begins it
18236 ## Don't expect parsoid to rt this form.
18237 !! test
18238 Parser hook: basic arguments using terminated empty elements (T4374)
18239 !! options
18240 parsoid=wt2html
18241 !! wikitext
18242 <tag width=200 height = "100" depth = '50' square/>
18243 other stuff
18244 </tag>
18245 !! html/php
18246 <pre>
18247 NULL
18248 array (
18249 'width' => '200',
18250 'height' => '100',
18251 'depth' => '50',
18252 'square' => '',
18253 )
18254 </pre>
18255 <p>other stuff
18256 &lt;/tag&gt;
18257 </p>
18258 !! html/parsoid
18259 <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
18260 &lt;/tag></p>
18261 !! end
18262
18263 ## Don't expect parsoid to rt this form.
18264 !! test
18265 Parser hook: Don't allow unclosed extension tags
18266 !! options
18267 parsoid=wt2html
18268 !! wikitext
18269 test <tag>123
18270
18271 this is a '''test'''
18272 !! html/php
18273 <p>test &lt;tag&gt;123
18274 </p><p>this is a <b>test</b>
18275 </p>
18276 !! html/parsoid
18277 <p>test &lt;tag>123</p>
18278
18279 <p>this is a <b>test</b></p>
18280 !! end
18281
18282 ###
18283 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18284 ###
18285
18286 !! test
18287 Parser hook: static parser hook not inside a comment
18288 !! wikitext
18289 <statictag>hello, world</statictag>
18290
18291 <statictag action="flush" />
18292 !! html/php
18293 <p><br />
18294 hello, world
18295 </p>
18296 !! html/parsoid
18297 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18298 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18299 !! end
18300
18301 !! test
18302 Parser hook: static parser hook inside a comment
18303 !! wikitext
18304 <!-- <statictag>hello, world</statictag> -->
18305 <statictag action="flush" />
18306 !! html/php
18307 <p><br />
18308 </p>
18309 !! html/parsoid
18310 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18311 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18312 !! end
18313
18314 # Nested template calls; this case was broken by Parser.php rev 1.506,
18315 # since reverted.
18316
18317 !! article
18318 Template:One-parameter
18319 !! text
18320 (My parameter is: {{{1}}})
18321 !! endarticle
18322
18323 !! article
18324 Template:Map-one-parameter
18325 !! text
18326 {{{{{1}}}|{{{2}}}}}
18327 !! endarticle
18328
18329 !! test
18330 Nested template calls
18331 !! wikitext
18332 {{Map-one-parameter|One-parameter|param}}
18333 !! html
18334 <p>(My parameter is: param)
18335 </p>
18336 !! end
18337
18338
18339 ###
18340 ### Sanitizer
18341 ###
18342
18343 # Remex wraps empty tag runs with p-tags.
18344 # Parsoid strips them out during p-wrapping.
18345 !! test
18346 Sanitizer: Closing of open tags
18347 !! wikitext
18348 <s></s><table></table>
18349 !! html/php+tidy
18350 <p><s></s></p><table></table>
18351 !! html/parsoid
18352 <s></s><table></table>
18353 !! end
18354
18355 !! test
18356 Sanitizer: Closing of open but not closed tags
18357 !! wikitext
18358 <s>foo
18359 !! html
18360 <p><s>foo</s>
18361 </p>
18362 !! end
18363
18364 !! test
18365 Sanitizer: Closing of closed but not open tags
18366 !! options
18367 parsoid=wt2html
18368 !! wikitext
18369 </s>
18370 !! html/php+tidy
18371 <p class="mw-empty-elt">
18372 </p>
18373 !! html/parsoid
18374 !! end
18375
18376 !! test
18377 Sanitizer: Closing of closed but not open table tags
18378 !! options
18379 parsoid=wt2html
18380 !! wikitext
18381 Table not started</td></tr></table>
18382 !! html+tidy
18383 <p>Table not started
18384 </p>
18385 !! end
18386
18387 !! test
18388 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18389 !! config
18390 wgFragmentMode=[ 'html5', 'legacy' ]
18391 !! wikitext
18392 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18393 !! html/php
18394 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18395 </p>
18396 !! html/parsoid
18397 <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>
18398 !! end
18399
18400 !! test
18401 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18402 !! config
18403 wgFragmentMode=[ 'legacy' ]
18404 !! wikitext
18405 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18406 !! html/php
18407 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18408 </p>
18409 !! end
18410
18411 # In HTML5, the restrictions are that id must contain at least one character,
18412 # and must not contain any space characters.
18413 !! test
18414 Sanitizer: Validating the contents of the id attribute (T6515)
18415 !! options
18416 disabled
18417 !! wikitext
18418 <br id="" /><br id="a space" />
18419 !! html
18420 Something ...
18421 !! end
18422
18423 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18424 !! test
18425 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18426 !! options
18427 disabled
18428 !! wikitext
18429 <br id="foo" /><br id="foo" />
18430 !! html
18431 Something need to be done. foo-2 ?
18432 !! end
18433
18434 !! test
18435 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18436 !! wikitext
18437 <div itemscope>
18438 <meta itemprop="hello" content="world">
18439 <meta http-equiv="refresh" content="5">
18440 <meta itemprop="hello" http-equiv="refresh" content="5">
18441 <link itemprop="hello" href="{{SERVER}}">
18442 <link rel="stylesheet" href="{{SERVER}}">
18443 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18444 </div>
18445 !! html
18446 <div itemscope="">
18447 <p> <meta itemprop="hello" content="world" />
18448 &lt;meta http-equiv="refresh" content="5"&gt;
18449 <meta itemprop="hello" content="5" />
18450 <link itemprop="hello" href="http&#58;//example.org" />
18451 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18452 <link itemprop="hello" href="http&#58;//example.org" />
18453 </p>
18454 </div>
18455
18456 !! end
18457
18458 !! test
18459 Sanitizer: Strip comments from CSS attributes
18460 !! options
18461 parsoid=wt2html,wt2wt
18462 !! wikitext
18463 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18464 !! html/php
18465 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18466 </p>
18467 !! html/parsoid
18468 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18469 !! end
18470
18471 !! test
18472 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18473 !! wikitext
18474 [[meatball:Soft"Security]]
18475 !! html/php
18476 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18477 </p>
18478 !! html/parsoid
18479 <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>
18480 !! end
18481
18482 !! test
18483 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18484 !! wikitext
18485 [[meatball:Foo<Bar]]
18486 [[meatball:Foo>Bar]]
18487 [[meatball:Foo&lt;bar]]
18488 [[meatball:Foo&gt;bar]]
18489 !! html/php
18490 <p>[[meatball:Foo&lt;Bar]]
18491 [[meatball:Foo&gt;Bar]]
18492 [[meatball:Foo&lt;bar]]
18493 [[meatball:Foo&gt;bar]]
18494 </p>
18495 !! html/parsoid
18496 <p>[[meatball:Foo&lt;Bar]]
18497 [[meatball:Foo>Bar]]
18498 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18499 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18500 !! end
18501
18502 !! test
18503 Language converter: output gets cut off unexpectedly (T7757)
18504 !! options
18505 language=zh
18506 !! wikitext
18507 this bit is safe: }-
18508
18509 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18510
18511 then we get cut off here: }-
18512
18513 all additional text is vanished
18514 !! html/php
18515 <p>this bit is safe: }-
18516 </p><p>but if we add a conversion instance: xxx
18517 </p><p>then we get cut off here: }-
18518 </p><p>all additional text is vanished
18519 </p>
18520 !! html/parsoid
18521 <p>this bit is safe: }-</p>
18522 <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>
18523 <p>then we get cut off here: }-</p>
18524 <p>all additional text is vanished</p>
18525 !! end
18526
18527 !! test
18528 Language converter glossary rules inside attributes (T119158)
18529 !! options
18530 language=sr variant=sr-el
18531 !! wikitext
18532 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18533
18534 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18535 !! html/php
18536 <p>
18537 </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>
18538 </p>
18539 !! html/parsoid
18540 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18541
18542 <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>
18543 !! end
18544
18545 !! test
18546 Self closed html pairs (T7487)
18547 !! wikitext
18548 <center><font id="bug" />Centered text</center>
18549 <div><font id="bug2" />In div text</div>
18550 !! html+tidy
18551 <center><font id="bug"></font>Centered text</center>
18552 <div><font id="bug2"></font>In div text</div>
18553 !! end
18554
18555 !! test
18556 Punctuation: nbsp before exclamation
18557 !! wikitext
18558 C'est grave !
18559 !! html
18560 <p>C'est grave&#160;!
18561 </p>
18562 !! end
18563
18564 !! test
18565 Punctuation: CSS !important (T13874)
18566 !! wikitext
18567 <div style="width:50% !important">important</div>
18568 !! html
18569 <div style="width:50% !important">important</div>
18570
18571 !!end
18572
18573 !! test
18574 Punctuation: CSS ! important (T13874; with space after)
18575 !! wikitext
18576 <div style="width:50% ! important">important</div>
18577 !! html
18578 <div style="width:50% ! important">important</div>
18579
18580 !!end
18581
18582 !! test
18583 HTML bullet list, closed tags (T7497)
18584 !! wikitext
18585 <ul>
18586 <li>One</li>
18587 <li>Two</li>
18588 </ul>
18589 !! html/php
18590 <ul>
18591 <li>One</li>
18592 <li>Two</li>
18593 </ul>
18594
18595 !! html/parsoid
18596 <ul data-parsoid='{"stx":"html"}'>
18597 <li data-parsoid='{"stx":"html"}'>One</li>
18598 <li data-parsoid='{"stx":"html"}'>Two</li>
18599 </ul>
18600
18601 !! end
18602
18603 !! test
18604 HTML bullet list, unclosed tags (T7497)
18605 !! wikitext
18606 <ul>
18607 <li>One
18608 <li>Two
18609 </ul>
18610 !! html/php+tidy
18611 <ul>
18612 <li>One
18613 </li><li>Two
18614 </li></ul>
18615 !! html/parsoid
18616 <ul data-parsoid='{"stx":"html"}'>
18617 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18618 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18619 </ul>
18620
18621 !! end
18622
18623 !! test
18624 HTML ordered list, closed tags (T7497)
18625 !! wikitext
18626 <ol>
18627 <li>One</li>
18628 <li>Two</li>
18629 </ol>
18630 !! html/php
18631 <ol>
18632 <li>One</li>
18633 <li>Two</li>
18634 </ol>
18635
18636 !! html/parsoid
18637 <ol data-parsoid='{"stx":"html"}'>
18638 <li data-parsoid='{"stx":"html"}'>One</li>
18639 <li data-parsoid='{"stx":"html"}'>Two</li>
18640 </ol>
18641
18642 !! end
18643
18644 !! test
18645 HTML ordered list, unclosed tags (T7497)
18646 !! options
18647 !! wikitext
18648 <ol>
18649 <li>One
18650 <li>Two
18651 </ol>
18652 !! html/php+tidy
18653 <ol>
18654 <li>One
18655 </li><li>Two
18656 </li></ol>
18657 !! html/parsoid
18658 <ol data-parsoid='{"stx":"html"}'>
18659 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18660 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18661 </ol>
18662
18663 !! end
18664
18665 !! test
18666 HTML nested bullet list, closed tags (T7497)
18667 !! wikitext
18668 <ul>
18669 <li>One</li>
18670 <li>Two:
18671 <ul>
18672 <li>Sub-one</li>
18673 <li>Sub-two</li>
18674 </ul>
18675 </li>
18676 </ul>
18677 !! html/php
18678 <ul>
18679 <li>One</li>
18680 <li>Two:
18681 <ul>
18682 <li>Sub-one</li>
18683 <li>Sub-two</li>
18684 </ul>
18685 </li>
18686 </ul>
18687
18688 !! html/parsoid
18689 <ul data-parsoid='{"stx":"html"}'>
18690 <li data-parsoid='{"stx":"html"}'>One</li>
18691 <li data-parsoid='{"stx":"html"}'>Two:
18692 <ul data-parsoid='{"stx":"html"}'>
18693 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18694 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18695 </ul>
18696 </li>
18697 </ul>
18698 !! end
18699
18700 !! test
18701 HTML nested bullet list, open tags (T7497)
18702 !! wikitext
18703 <ul>
18704 <li>One
18705 <li>Two:
18706 <ul>
18707 <li>Sub-one
18708 <li>Sub-two
18709 </ul>
18710 </ul>
18711 !! html+tidy
18712 <ul>
18713 <li>One
18714 </li><li>Two:
18715 <ul>
18716 <li>Sub-one
18717 </li><li>Sub-two
18718 </li></ul>
18719 </li></ul>
18720 !! end
18721
18722 !! test
18723 HTML nested ordered list, closed tags (T7497)
18724 !! wikitext
18725 <ol>
18726 <li>One</li>
18727 <li>Two:
18728 <ol>
18729 <li>Sub-one</li>
18730 <li>Sub-two</li>
18731 </ol>
18732 </li>
18733 </ol>
18734 !! html
18735 <ol>
18736 <li>One</li>
18737 <li>Two:
18738 <ol>
18739 <li>Sub-one</li>
18740 <li>Sub-two</li>
18741 </ol>
18742 </li>
18743 </ol>
18744
18745 !! end
18746
18747 !! test
18748 HTML nested ordered list, open tags (T7497)
18749 !! wikitext
18750 <ol>
18751 <li>One
18752 <li>Two:
18753 <ol>
18754 <li>Sub-one
18755 <li>Sub-two
18756 </ol>
18757 </ol>
18758 !! html/php
18759 <ol>
18760 <li>One
18761 <li>Two:
18762 <ol>
18763 <li>Sub-one
18764 <li>Sub-two
18765 </ol>
18766 </ol>
18767
18768 !! html/parsoid
18769 <ol>
18770 <li>One
18771 </li>
18772 <li>Two:
18773 <ol>
18774 <li>Sub-one
18775 </li>
18776 <li>Sub-two
18777 </li>
18778 </ol>
18779 </li>
18780 </ol>
18781
18782 !! end
18783
18784 !! test
18785 HTML ordered list item with parameters oddity
18786 !! wikitext
18787 <ol><li id="fragment">One</li>
18788 </ol>
18789 !! html
18790 <ol><li id="fragment">One</li>
18791 </ol>
18792
18793 !! end
18794
18795 # parsoid doesn't explicitly mark autonumbered links, see T55505
18796 !!test
18797 T7918: autonumbering
18798 !! wikitext
18799 [http://first/] [http://second] [ftp://ftp]
18800
18801 ftp://inlineftp
18802
18803 [mailto:enclosed@mail.tld With target]
18804
18805 [mailto:enclosed@mail.tld]
18806
18807 mailto:inline@mail.tld
18808 !! html/php
18809 <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>
18810 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18811 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18812 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18813 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18814 </p>
18815 !! html/parsoid
18816 <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>
18817 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18818 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18819 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18820 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18821 !! end
18822
18823
18824 #
18825 # Security and HTML correctness
18826 # From Nick Jenkins' fuzz testing
18827 #
18828
18829 !! test
18830 Fuzz testing: Parser13
18831 !! wikitext
18832 {|
18833 | http://a|
18834 !! html
18835 <table>
18836 <tr>
18837 <td>
18838 </td>
18839 </tr>
18840 </table>
18841
18842 !! end
18843
18844 # Note that Parsoid output differs from the PHP parser here: the PHP
18845 # parser breaks the URL for the magic word, while in Parsoid the URL
18846 # production takes precedence.
18847 !! test
18848 Fuzz testing: Parser14
18849 !! wikitext
18850 ==onmouseover===
18851 http://__TOC__
18852 !! html/php
18853 <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>
18854 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18855 <ul>
18856 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18857 </ul>
18858 </div>
18859
18860
18861 !! html/php+tidy
18862 <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>
18863 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18864 <ul>
18865 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18866 </ul>
18867 </div>
18868 !! html/parsoid
18869 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18870 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18871 !! end
18872
18873 !! test
18874 Fuzz testing: Parser14-table
18875 !! options
18876 parsoid=wt2html,html2html
18877 !! wikitext
18878 ==a==
18879 {| STYLE=__TOC__
18880 !! html
18881 <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>
18882 <table style="&#95;_TOC&#95;_">
18883 <tr><td></td></tr>
18884 </table>
18885
18886 !! html+tidy
18887 <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>
18888 <table style="__TOC__">
18889 <tr>
18890 <td></td>
18891 </tr>
18892 </table>
18893 !! html/parsoid
18894 <h2 id="a">a</h2>
18895 <table style="__TOC__"></table>
18896 !! end
18897
18898 # Known to produce bogus xml (extra </td>)
18899 # Don't add the html/php section since it generates broken HTML
18900 !! test
18901 Fuzz testing: Parser16
18902 !! wikitext
18903 {|
18904 !https://||||||
18905 !! html+tidy
18906 <table>
18907 <tbody><tr>
18908 <th>https://</th>
18909 <th></th>
18910 <th></th>
18911 <th>
18912
18913 </th></tr>
18914 </tbody></table>
18915 !! end
18916
18917 !! test
18918 Fuzz testing: Parser21
18919 !! wikitext
18920 {|
18921 !irc://{{ftp://a" onmouseover="alert('hello world');"
18922 |
18923 !! html
18924 <table>
18925 <tr>
18926 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18927 </th>
18928 <td>
18929 </td>
18930 </tr>
18931 </table>
18932
18933 !! end
18934
18935 !! test
18936 Fuzz testing: Parser22
18937 !! wikitext
18938 http://===r:::https://b
18939
18940 {|
18941 !! html
18942 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18943 </p>
18944 <table>
18945 <tr><td></td></tr>
18946 </table>
18947
18948 !! end
18949
18950 # Known to produce bad XML for now
18951 !! test
18952 Fuzz testing: Parser24
18953 !! options
18954 parsoid=wt2html
18955 !! wikitext
18956 {|
18957 {{{|
18958 <u CLASS=
18959 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18960 <br style="onmouseover='alert(document.cookie);' " />
18961
18962 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18963 |
18964 !! html/php
18965 <table>
18966 {{{|
18967 <u class="&#124;">}}}} &gt;
18968 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18969
18970 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18971 <tr>
18972 <td></u>
18973 </td>
18974 </tr>
18975 </table>
18976
18977 !! html/parsoid
18978 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18979 <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>"}'/>}}}} >
18980 <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}'>
18981
18982
18983
18984 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18985 !! end
18986
18987 # Note: the current result listed for this is not what the original one was,
18988 # but the original bug was JavaScript injection, which is fixed in any case.
18989 # It's not clear that the original result listed was any more correct than the
18990 # current one. Original result:
18991 # <p>{{{|
18992 # </p>
18993 # <li class="&#124;&#124;">
18994 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18995 !!test
18996 Fuzz testing: Parser25 (T8055)
18997 !! wikitext
18998 {{{
18999 |
19000 <LI CLASS=||
19001 >
19002 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19003 !! html/php
19004 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19005 </p>
19006 !! html/parsoid
19007 <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"]}'>
19008 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19009 !! end
19010
19011 !!test
19012 Fuzz testing: URL adjacent extension (with space, clean)
19013 !! wikitext
19014 http://example.com <nowiki>junk</nowiki>
19015 !! html/php
19016 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19017 </p>
19018 !! html/parsoid
19019 <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>
19020 !! end
19021
19022 !!test
19023 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19024 !! wikitext
19025 http://example.com<nowiki>junk</nowiki>
19026 !! html/php
19027 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19028 </p>
19029 !! html/parsoid
19030 <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>
19031 !! end
19032
19033 !! test
19034 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19035 !! wikitext
19036 http://example.com<pre>junk</pre>
19037 !! html/php
19038 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19039
19040 !! html/php+tidy
19041 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19042 !! html/parsoid
19043 <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>
19044 !! end
19045
19046 !! test
19047 Fuzz testing: image with bogus manual thumbnail
19048 !! wikitext
19049 [[Image:foobar.jpg|thumbnail= ]]
19050 !! html/php
19051 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19052
19053 !! html/parsoid
19054 <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>
19055 !! end
19056
19057 # Parsoid will emit the newline literally in wt2wt; see next test case.
19058 !! test
19059 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19060 !! options
19061 parsoid=wt2html
19062 !! wikitext
19063 <pre dir="&#10;"></pre>
19064 !! html/php
19065 <pre dir="&#10;"></pre>
19066
19067 !! html/parsoid
19068 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19069 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19070 !! end
19071
19072 !! test
19073 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19074 !! options
19075 parsoid=html2wt
19076 !! html/parsoid
19077 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19078 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19079 !! wikitext
19080 <pre dir="
19081 "></pre>
19082 !! html/php
19083 <pre dir=""></pre>
19084
19085 !! end
19086
19087 !! test
19088 Templates in extension attributes are not expanded
19089 !! wikitext
19090 <pre dir="{{echo|ltr}}"></pre>
19091 !! html/php
19092 <pre dir="{{echo|ltr}}"></pre>
19093
19094 !! html/parsoid
19095 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19096 !! end
19097
19098 !! test
19099 Parsing optional HTML elements (T8171)
19100 !! options
19101 !! wikitext
19102 <table>
19103 <tr>
19104 <td> Some tabular data</td>
19105 <td> More tabular data ...
19106 <td> And yet som tabular data</td>
19107 </tr>
19108 </table>
19109 !! html
19110 <table>
19111 <tr>
19112 <td> Some tabular data</td>
19113 <td> More tabular data ...
19114 </td><td> And yet som tabular data</td>
19115 </tr>
19116 </table>
19117
19118 !! end
19119
19120 !! test
19121 Correct handling of <td>, <tr> (T8171)
19122 !! options
19123 !! wikitext
19124 <table>
19125 <tr>
19126 <td> Some tabular data</td>
19127 <td> More tabular data ...</td>
19128 <td> And yet som tabular data</td>
19129 </tr>
19130 </table>
19131 !! html
19132 <table>
19133 <tr>
19134 <td> Some tabular data</td>
19135 <td> More tabular data ...</td>
19136 <td> And yet som tabular data</td>
19137 </tr>
19138 </table>
19139
19140 !! end
19141
19142
19143 !! test
19144 Parsing crashing regression (fr:JavaScript)
19145 !! wikitext
19146 </body></x>
19147 !! html
19148 <p>&lt;/body&gt;&lt;/x&gt;
19149 </p>
19150 !! end
19151
19152 !! test
19153 Inline wiki vs wiki block nesting
19154 !! wikitext
19155 '''Bold paragraph
19156
19157 New wiki paragraph
19158 !! html
19159 <p><b>Bold paragraph</b>
19160 </p><p>New wiki paragraph
19161 </p>
19162 !! end
19163
19164 # FIXME: The current php output is documented
19165 # and desired output is the parsoid target.
19166 !! test
19167 Inline HTML vs wiki block nesting
19168 !! wikitext
19169 <b>Bold paragraph
19170
19171 New wiki paragraph
19172 !! html/php
19173 <p><b>Bold paragraph
19174 </p><p>New wiki paragraph</b>
19175 </p>
19176 !! html/parsoid
19177 <p><b>Bold paragraph</b>
19178 </p><p>New wiki paragraph
19179 </p>
19180 !! end
19181
19182 # Original result was this:
19183 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19184 # </p>
19185 # While that might be marginally more intuitive, maybe, the six-apostrophe
19186 # construct is clearly pathological and the result stated here (which is what
19187 # the parser actually does) is about as reasonable as anything.
19188 !!test
19189 Mixing markup for italics and bold
19190 !! options
19191 !! wikitext
19192 '''bold''''''bold''bolditalics'''''
19193 !! html
19194 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19195 </p>
19196 !! end
19197
19198
19199 !! article
19200 Xyzzyx
19201 !! text
19202 Article for special page transclusion test
19203 !! endarticle
19204
19205 !! test
19206 Special page transclusion
19207 !! options
19208 !! wikitext
19209 {{Special:Prefixindex/Xyzzyx}}
19210 !! html
19211 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19212 </ul>
19213
19214 !! end
19215
19216 !! test
19217 Special page transclusion twice (T7021)
19218 !! options
19219 !! wikitext
19220 {{Special:Prefixindex/Xyzzyx}}
19221 {{Special:Prefixindex/Xyzzyx}}
19222 !! html
19223 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19224 </ul>
19225 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19226 </ul>
19227
19228 !! end
19229
19230 !! test
19231 Transclusion of default MediaWiki message
19232 !! wikitext
19233 {{MediaWiki:Mainpage}}
19234 !! html
19235 <p>Main Page
19236 </p>
19237 !! end
19238
19239 !! test
19240 Transclusion of nonexistent MediaWiki message
19241 !! wikitext
19242 {{MediaWiki:Mainpagexxx}}
19243 !! html
19244 <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>
19245 </p>
19246 !! end
19247
19248 !! test
19249 Transclusion of MediaWiki message with underscore
19250 !! wikitext
19251 {{MediaWiki:history_short}}
19252 !! html
19253 <p>History
19254 </p>
19255 !! end
19256
19257 !! test
19258 Transclusion of MediaWiki message with space
19259 !! wikitext
19260 {{MediaWiki:history short}}
19261 !! html
19262 <p>History
19263 </p>
19264 !! end
19265
19266 !! test
19267 Invalid header with following text
19268 !! wikitext
19269 = x = y
19270 !! html
19271 <p>= x = y
19272 </p>
19273 !! end
19274
19275
19276 !! test
19277 Section extraction test (section 0)
19278 !! options
19279 section=0
19280 !! wikitext
19281 start
19282 ==a==
19283 ===aa===
19284 ====aaa====
19285 ==b==
19286 ===ba===
19287 ===bb===
19288 ====bba====
19289 ===bc===
19290 ==c==
19291 ===ca===
19292 !! html/php
19293 start
19294 !! end
19295
19296 !! test
19297 Section extraction test (section 1)
19298 !! options
19299 section=1
19300 !! wikitext
19301 start
19302 ==a==
19303 ===aa===
19304 ====aaa====
19305 ==b==
19306 ===ba===
19307 ===bb===
19308 ====bba====
19309 ===bc===
19310 ==c==
19311 ===ca===
19312 !! html/php
19313 ==a==
19314 ===aa===
19315 ====aaa====
19316 !! end
19317
19318 !! test
19319 Section extraction test (section 2)
19320 !! options
19321 section=2
19322 !! wikitext
19323 start
19324 ==a==
19325 ===aa===
19326 ====aaa====
19327 ==b==
19328 ===ba===
19329 ===bb===
19330 ====bba====
19331 ===bc===
19332 ==c==
19333 ===ca===
19334 !! html/php
19335 ===aa===
19336 ====aaa====
19337 !! end
19338
19339 !! test
19340 Section extraction test (section 3)
19341 !! options
19342 section=3
19343 !! wikitext
19344 start
19345 ==a==
19346 ===aa===
19347 ====aaa====
19348 ==b==
19349 ===ba===
19350 ===bb===
19351 ====bba====
19352 ===bc===
19353 ==c==
19354 ===ca===
19355 !! html/php
19356 ====aaa====
19357 !! end
19358
19359 !! test
19360 Section extraction test (section 4)
19361 !! options
19362 section=4
19363 !! wikitext
19364 start
19365 ==a==
19366 ===aa===
19367 ====aaa====
19368 ==b==
19369 ===ba===
19370 ===bb===
19371 ====bba====
19372 ===bc===
19373 ==c==
19374 ===ca===
19375 !! html/php
19376 ==b==
19377 ===ba===
19378 ===bb===
19379 ====bba====
19380 ===bc===
19381 !! end
19382
19383 !! test
19384 Section extraction test (section 5)
19385 !! options
19386 section=5
19387 !! wikitext
19388 start
19389 ==a==
19390 ===aa===
19391 ====aaa====
19392 ==b==
19393 ===ba===
19394 ===bb===
19395 ====bba====
19396 ===bc===
19397 ==c==
19398 ===ca===
19399 !! html/php
19400 ===ba===
19401 !! end
19402
19403 !! test
19404 Section extraction test (section 6)
19405 !! options
19406 section=6
19407 !! wikitext
19408 start
19409 ==a==
19410 ===aa===
19411 ====aaa====
19412 ==b==
19413 ===ba===
19414 ===bb===
19415 ====bba====
19416 ===bc===
19417 ==c==
19418 ===ca===
19419 !! html/php
19420 ===bb===
19421 ====bba====
19422 !! end
19423
19424 !! test
19425 Section extraction test (section 7)
19426 !! options
19427 section=7
19428 !! wikitext
19429 start
19430 ==a==
19431 ===aa===
19432 ====aaa====
19433 ==b==
19434 ===ba===
19435 ===bb===
19436 ====bba====
19437 ===bc===
19438 ==c==
19439 ===ca===
19440 !! html/php
19441 ====bba====
19442 !! end
19443
19444 !! test
19445 Section extraction test (section 8)
19446 !! options
19447 section=8
19448 !! wikitext
19449 start
19450 ==a==
19451 ===aa===
19452 ====aaa====
19453 ==b==
19454 ===ba===
19455 ===bb===
19456 ====bba====
19457 ===bc===
19458 ==c==
19459 ===ca===
19460 !! html/php
19461 ===bc===
19462 !! end
19463
19464 !! test
19465 Section extraction test (section 9)
19466 !! options
19467 section=9
19468 !! wikitext
19469 start
19470 ==a==
19471 ===aa===
19472 ====aaa====
19473 ==b==
19474 ===ba===
19475 ===bb===
19476 ====bba====
19477 ===bc===
19478 ==c==
19479 ===ca===
19480 !! html/php
19481 ==c==
19482 ===ca===
19483 !! end
19484
19485 !! test
19486 Section extraction test (section 10)
19487 !! options
19488 section=10
19489 !! wikitext
19490 start
19491 ==a==
19492 ===aa===
19493 ====aaa====
19494 ==b==
19495 ===ba===
19496 ===bb===
19497 ====bba====
19498 ===bc===
19499 ==c==
19500 ===ca===
19501 !! html/php
19502 ===ca===
19503 !! end
19504
19505 !! test
19506 Section extraction test (nonexistent section 11)
19507 !! options
19508 section=11
19509 !! wikitext
19510 start
19511 ==a==
19512 ===aa===
19513 ====aaa====
19514 ==b==
19515 ===ba===
19516 ===bb===
19517 ====bba====
19518 ===bc===
19519 ==c==
19520 ===ca===
19521 !! html/php
19522 !! end
19523
19524 !! test
19525 Section extraction test with bogus heading (section 1)
19526 !! options
19527 section=1
19528 !! wikitext
19529 ==a==
19530 ==bogus== not a legal section
19531 ==b==
19532 !! html/php
19533 ==a==
19534 ==bogus== not a legal section
19535 !! end
19536
19537 !! test
19538 Section extraction test with bogus heading (section 2)
19539 !! options
19540 section=2
19541 !! wikitext
19542 ==a==
19543 ==bogus== not a legal section
19544 ==b==
19545 !! html/php
19546 ==b==
19547 !! end
19548
19549 !! test
19550 Section extraction test with comment after heading (section 1)
19551 !! options
19552 section=1
19553 !! wikitext
19554 ==a==
19555 ==b== <!-- -->
19556 ==c==
19557 !! html/php
19558 ==a==
19559 !! end
19560
19561 !! test
19562 Section extraction test with comment after heading (section 2)
19563 !! options
19564 section=2
19565 !! wikitext
19566 ==a==
19567 ==b== <!-- -->
19568 ==c==
19569 !! html/php
19570 ==b== <!-- -->
19571 !! end
19572
19573 !! test
19574 Section extraction test with bogus <nowiki> heading (section 1)
19575 !! options
19576 section=1
19577 !! wikitext
19578 ==a==
19579 ==bogus== <nowiki>not a legal section</nowiki>
19580 ==b==
19581 !! html/php
19582 ==a==
19583 ==bogus== <nowiki>not a legal section</nowiki>
19584 !! end
19585
19586 !! test
19587 Section extraction test with bogus <nowiki> heading (section 2)
19588 !! options
19589 section=2
19590 !! wikitext
19591 ==a==
19592 ==bogus== <nowiki>not a legal section</nowiki>
19593 ==b==
19594 !! html/php
19595 ==b==
19596 !! end
19597
19598 # Formerly testing for T4587, now resolved by the use of unmarked sections
19599 # instead of respecting commented sections
19600 !! test
19601 Section extraction prefixed by comment (section 1)
19602 !! options
19603 section=1
19604 !! wikitext
19605 <!-- -->==sec1==
19606 ==sec2==
19607 !! html/php
19608 ==sec2==
19609 !!end
19610
19611 !! test
19612 Section extraction prefixed by comment (section 2)
19613 !! options
19614 section=2
19615 !! wikitext
19616 <!-- -->==sec1==
19617 ==sec2==
19618 !! html/php
19619
19620 !!end
19621
19622 # Formerly testing for T4607, now resolved by the use of unmarked sections
19623 # instead of respecting HTML-style headings
19624 !! test
19625 Section extraction, mixed wiki and html (section 1)
19626 !! options
19627 section=1
19628 !! wikitext
19629 <h2>unmarked</h2>
19630 unmarked
19631 ==1==
19632 one
19633 ==2==
19634 two
19635 !! html/php
19636 ==1==
19637 one
19638 !! end
19639
19640 !! test
19641 Section extraction, mixed wiki and html (section 2)
19642 !! options
19643 section=2
19644 !! wikitext
19645 <h2>unmarked</h2>
19646 unmarked
19647 ==1==
19648 one
19649 ==2==
19650 two
19651 !! html/php
19652 ==2==
19653 two
19654 !! end
19655
19656
19657 # Formerly testing for T5342
19658 !! test
19659 Section extraction, heading surrounded by <noinclude>
19660 !! options
19661 section=1
19662 !! wikitext
19663 <noinclude>==unmarked==</noinclude>
19664 ==marked==
19665 !! html/php
19666 ==marked==
19667 !!end
19668
19669 # Test behavior of T21910
19670 !! test
19671 Sectiion with all-equals
19672 !! options
19673 section=2
19674 !! wikitext
19675 ===
19676 The line above must have a trailing space
19677 === <!--
19678 --> <!-- -->
19679 But just in case it doesn't...
19680 !! html/php
19681 === <!--
19682 --> <!-- -->
19683 But just in case it doesn't...
19684 !! end
19685
19686 !! test
19687 Section replacement test (section 0)
19688 !! options
19689 replace=0,"xxx"
19690 !! wikitext
19691 start
19692 ==a==
19693 ===aa===
19694 ====aaa====
19695 ==b==
19696 ===ba===
19697 ===bb===
19698 ====bba====
19699 ===bc===
19700 ==c==
19701 ===ca===
19702 !! html/php
19703 xxx
19704
19705 ==a==
19706 ===aa===
19707 ====aaa====
19708 ==b==
19709 ===ba===
19710 ===bb===
19711 ====bba====
19712 ===bc===
19713 ==c==
19714 ===ca===
19715 !! end
19716
19717 !! test
19718 Section replacement test (section 1)
19719 !! options
19720 replace=1,"xxx"
19721 !! wikitext
19722 start
19723 ==a==
19724 ===aa===
19725 ====aaa====
19726 ==b==
19727 ===ba===
19728 ===bb===
19729 ====bba====
19730 ===bc===
19731 ==c==
19732 ===ca===
19733 !! html/php
19734 start
19735 xxx
19736
19737 ==b==
19738 ===ba===
19739 ===bb===
19740 ====bba====
19741 ===bc===
19742 ==c==
19743 ===ca===
19744 !! end
19745
19746 !! test
19747 Section replacement test (section 2)
19748 !! options
19749 replace=2,"xxx"
19750 !! wikitext
19751 start
19752 ==a==
19753 ===aa===
19754 ====aaa====
19755 ==b==
19756 ===ba===
19757 ===bb===
19758 ====bba====
19759 ===bc===
19760 ==c==
19761 ===ca===
19762 !! html/php
19763 start
19764 ==a==
19765 xxx
19766
19767 ==b==
19768 ===ba===
19769 ===bb===
19770 ====bba====
19771 ===bc===
19772 ==c==
19773 ===ca===
19774 !! end
19775
19776 !! test
19777 Section replacement test (section 3)
19778 !! options
19779 replace=3,"xxx"
19780 !! wikitext
19781 start
19782 ==a==
19783 ===aa===
19784 ====aaa====
19785 ==b==
19786 ===ba===
19787 ===bb===
19788 ====bba====
19789 ===bc===
19790 ==c==
19791 ===ca===
19792 !! html/php
19793 start
19794 ==a==
19795 ===aa===
19796 xxx
19797
19798 ==b==
19799 ===ba===
19800 ===bb===
19801 ====bba====
19802 ===bc===
19803 ==c==
19804 ===ca===
19805 !! end
19806
19807 !! test
19808 Section replacement test (section 4)
19809 !! options
19810 replace=4,"xxx"
19811 !! wikitext
19812 start
19813 ==a==
19814 ===aa===
19815 ====aaa====
19816 ==b==
19817 ===ba===
19818 ===bb===
19819 ====bba====
19820 ===bc===
19821 ==c==
19822 ===ca===
19823 !! html/php
19824 start
19825 ==a==
19826 ===aa===
19827 ====aaa====
19828 xxx
19829
19830 ==c==
19831 ===ca===
19832 !! end
19833
19834 !! test
19835 Section replacement test (section 5)
19836 !! options
19837 replace=5,"xxx"
19838 !! wikitext
19839 start
19840 ==a==
19841 ===aa===
19842 ====aaa====
19843 ==b==
19844 ===ba===
19845 ===bb===
19846 ====bba====
19847 ===bc===
19848 ==c==
19849 ===ca===
19850 !! html/php
19851 start
19852 ==a==
19853 ===aa===
19854 ====aaa====
19855 ==b==
19856 xxx
19857
19858 ===bb===
19859 ====bba====
19860 ===bc===
19861 ==c==
19862 ===ca===
19863 !! end
19864
19865 !! test
19866 Section replacement test (section 6)
19867 !! options
19868 replace=6,"xxx"
19869 !! wikitext
19870 start
19871 ==a==
19872 ===aa===
19873 ====aaa====
19874 ==b==
19875 ===ba===
19876 ===bb===
19877 ====bba====
19878 ===bc===
19879 ==c==
19880 ===ca===
19881 !! html/php
19882 start
19883 ==a==
19884 ===aa===
19885 ====aaa====
19886 ==b==
19887 ===ba===
19888 xxx
19889
19890 ===bc===
19891 ==c==
19892 ===ca===
19893 !! end
19894
19895 !! test
19896 Section replacement test (section 7)
19897 !! options
19898 replace=7,"xxx"
19899 !! wikitext
19900 start
19901 ==a==
19902 ===aa===
19903 ====aaa====
19904 ==b==
19905 ===ba===
19906 ===bb===
19907 ====bba====
19908 ===bc===
19909 ==c==
19910 ===ca===
19911 !! html/php
19912 start
19913 ==a==
19914 ===aa===
19915 ====aaa====
19916 ==b==
19917 ===ba===
19918 ===bb===
19919 xxx
19920
19921 ===bc===
19922 ==c==
19923 ===ca===
19924 !! end
19925
19926 !! test
19927 Section replacement test (section 8)
19928 !! options
19929 replace=8,"xxx"
19930 !! wikitext
19931 start
19932 ==a==
19933 ===aa===
19934 ====aaa====
19935 ==b==
19936 ===ba===
19937 ===bb===
19938 ====bba====
19939 ===bc===
19940 ==c==
19941 ===ca===
19942 !! html/php
19943 start
19944 ==a==
19945 ===aa===
19946 ====aaa====
19947 ==b==
19948 ===ba===
19949 ===bb===
19950 ====bba====
19951 xxx
19952
19953 ==c==
19954 ===ca===
19955 !!end
19956
19957 !! test
19958 Section replacement test (section 9)
19959 !! options
19960 replace=9,"xxx"
19961 !! wikitext
19962 start
19963 ==a==
19964 ===aa===
19965 ====aaa====
19966 ==b==
19967 ===ba===
19968 ===bb===
19969 ====bba====
19970 ===bc===
19971 ==c==
19972 ===ca===
19973 !! html/php
19974 start
19975 ==a==
19976 ===aa===
19977 ====aaa====
19978 ==b==
19979 ===ba===
19980 ===bb===
19981 ====bba====
19982 ===bc===
19983 xxx
19984 !! end
19985
19986 !! test
19987 Section replacement test (section 10)
19988 !! options
19989 replace=10,"xxx"
19990 !! wikitext
19991 start
19992 ==a==
19993 ===aa===
19994 ====aaa====
19995 ==b==
19996 ===ba===
19997 ===bb===
19998 ====bba====
19999 ===bc===
20000 ==c==
20001 ===ca===
20002 !! html/php
20003 start
20004 ==a==
20005 ===aa===
20006 ====aaa====
20007 ==b==
20008 ===ba===
20009 ===bb===
20010 ====bba====
20011 ===bc===
20012 ==c==
20013 xxx
20014 !! end
20015
20016 !! test
20017 Section replacement test with initial whitespace (T15728)
20018 !! options
20019 replace=2,"xxx"
20020 !! wikitext
20021 Preformatted initial line
20022 ==a==
20023 ===a===
20024 !! html/php
20025 Preformatted initial line
20026 ==a==
20027 xxx
20028 !! end
20029
20030
20031 !! test
20032 Section extraction, heading followed by pre with 20 spaces (T8398)
20033 !! options
20034 section=1
20035 !! wikitext
20036 ==a==
20037 a
20038 !! html/php
20039 ==a==
20040 a
20041 !! end
20042
20043 !! test
20044 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20045 !! options
20046 section=1
20047 !! wikitext
20048 ==a==
20049 a
20050 !! html/php
20051 ==a==
20052 a
20053 !! end
20054
20055
20056 !! test
20057 Section extraction, <pre> around bogus header (T12309)
20058 !! options
20059 section=2
20060 !! wikitext
20061 == Section One ==
20062 <pre>
20063 =======
20064 </pre>
20065
20066 == Section Two ==
20067 stuff
20068 !! html/php
20069 == Section Two ==
20070 stuff
20071 !! end
20072
20073 !! test
20074 Section replacement, <pre> around bogus header (T12309)
20075 !! options
20076 replace=2,"xxx"
20077 !! wikitext
20078 == Section One ==
20079 <pre>
20080 =======
20081 </pre>
20082
20083 == Section Two ==
20084 stuff
20085 !! html/php
20086 == Section One ==
20087 <pre>
20088 =======
20089 </pre>
20090
20091 xxx
20092 !! end
20093
20094 !! test
20095 Handling of &#x0A; in URLs
20096 !! wikitext
20097 *irc://&#x0A;a
20098 !! html/php
20099 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20100
20101 !! html/parsoid
20102 <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>
20103 !! end
20104
20105 !! test
20106 Handling of %0A in URLs
20107 !! wikitext
20108 *irc://%0Aa
20109 !! html/php
20110 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20111
20112 !! html/parsoid
20113 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20114 !! end
20115
20116 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20117 !! test
20118 5 quotes, code coverage +1 line
20119 !! options
20120 parsoid=wt2html
20121 !! wikitext
20122 '''''
20123 !! html/php
20124 !! html/parsoid
20125 <b><i></i></b>
20126 !! end
20127
20128 # same html as previous, but wikitext adjusted to match parsoid html2wt
20129 # note that wt2html and html2html will put the <i> before the <b>
20130 !! test
20131 5 quotes, code coverage +1 line w/ nowiki (1)
20132 !! options
20133 parsoid=wt2wt,html2wt
20134 !! wikitext
20135 '''''<nowiki/>'''''
20136 !! html/php
20137 <p><i></i>
20138 </p>
20139 !! html/parsoid
20140 <p><b><i></i></b></p>
20141 !! end
20142
20143 # same as previous, just swapping the <i> and <b>
20144 !! test
20145 5 quotes, code coverage +1 line w/ nowiki (2)
20146 !! wikitext
20147 '''''<nowiki/>'''''
20148 !! html/php
20149 <p><i></i>
20150 </p>
20151 !! html/parsoid
20152 <p><i><b></b></i></p>
20153 !! end
20154
20155 !! test
20156 Special:Search page linking.
20157 !! wikitext
20158 {{Special:search}}
20159 !! html
20160 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20161 </p>
20162 !! end
20163
20164 !! test
20165 {{!}} is a magic word
20166 !! wikitext
20167 {{!}} is a magic word there and {{!}} is still a magic word here
20168 | is not a magic word here but {{!}} is still a magic word here
20169 !! html/php
20170 <p>| is a magic word there and | is still a magic word here
20171 | is not a magic word here but | is still a magic word here
20172 </p>
20173 !! html/parsoid
20174 <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
20175 | 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>
20176 !! end
20177
20178 !! test
20179 Say the magic word
20180 !! options
20181 title=[[Parser test]]
20182 !! wikitext
20183 *{{PAGENAME}}
20184 *{{PAGENAMEE}}
20185 *{{FULLPAGENAME}}
20186 *{{FULLPAGENAMEE}}
20187 *{{BASEPAGENAME}}
20188 *{{BASEPAGENAMEE}}
20189 *{{SUBPAGENAME}}
20190 *{{SUBPAGENAMEE}}
20191 *{{ROOTPAGENAME}}
20192 *{{ROOTPAGENAMEE}}
20193 *{{TALKPAGENAME}}
20194 *{{TALKPAGENAMEE}}
20195 *{{SUBJECTPAGENAME}}
20196 *{{SUBJECTPAGENAMEE}}
20197 *{{NAMESPACEE}}
20198 *{{NAMESPACE}}
20199 *{{NAMESPACENUMBER}}
20200 *{{TALKSPACE}}
20201 *{{TALKSPACEE}}
20202 *{{SUBJECTSPACE}}
20203 *{{SUBJECTSPACEE}}
20204 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20205 !! html
20206 <ul><li>Parser test</li>
20207 <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>Talk:Parser test</li>
20217 <li>Talk:Parser_test</li>
20218 <li>Parser test</li>
20219 <li>Parser_test</li>
20220 <li></li>
20221 <li></li>
20222 <li>0</li>
20223 <li>Talk</li>
20224 <li>Talk</li>
20225 <li></li>
20226 <li></li>
20227 <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>
20228
20229 !! end
20230 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20231
20232 !! test
20233 Gallery with valid attributes
20234 !! wikitext
20235 <gallery type="123" summary="345">
20236 File:File:Foobar.jpg
20237 </gallery>
20238 !! html/php
20239 <ul class="gallery mw-gallery-traditional" type="123">
20240 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20241 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20242 <div class="gallerytext">
20243 </div>
20244 </div></li>
20245 </ul>
20246
20247 !! html/parsoid
20248 <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"}}'>
20249 <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>
20250 </ul>
20251 !! end
20252
20253 ## Parsoid thinks the "centre" here is a property, not a caption.
20254 !! test
20255 Gallery
20256 !! options
20257 parsoid={
20258 "modes": ["wt2html"],
20259 "nativeGallery": true
20260 }
20261 !! wikitext
20262 <gallery>
20263 image1.png |
20264 image2.gif|||||
20265
20266 image3|
20267 image4 |300px| centre
20268 image5.svg| http://///////
20269 [[x|xx]]]]
20270 * image6
20271 </gallery>
20272 !! html/php
20273 <ul class="gallery mw-gallery-traditional">
20274 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20275 <div class="thumb" style="height: 150px;">Image1.png</div>
20276 <div class="gallerytext">
20277 </div>
20278 </div></li>
20279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20280 <div class="thumb" style="height: 150px;">Image2.gif</div>
20281 <div class="gallerytext">
20282 </div>
20283 </div></li>
20284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20285 <div class="thumb" style="height: 150px;">Image3</div>
20286 <div class="gallerytext">
20287 </div>
20288 </div></li>
20289 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20290 <div class="thumb" style="height: 150px;">Image4</div>
20291 <div class="gallerytext">
20292 <pre>centre
20293 </pre>
20294 </div>
20295 </div></li>
20296 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20297 <div class="thumb" style="height: 150px;">Image5.svg</div>
20298 <div class="gallerytext">
20299 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20300 </p>
20301 </div>
20302 </div></li>
20303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20304 <div class="thumb" style="height: 150px;">* image6</div>
20305 <div class="gallerytext">
20306 </div>
20307 </div></li>
20308 </ul>
20309
20310 !! html/parsoid
20311 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20312 <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>
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: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>
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:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" 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:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></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: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>
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:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20318 </ul>
20319 !! end
20320
20321 !! test
20322 Gallery (with options, html)
20323 !! options
20324 parsoid={
20325 "modes": ["wt2html", "html2html"],
20326 "nativeGallery": true
20327 }
20328 !! wikitext
20329 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20330 File:Nonexistent.jpg|caption
20331 File:Nonexistent.jpg
20332 image:foobar.jpg|some '''caption''' [[Main Page]]
20333 image:foobar.jpg
20334 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20335 </gallery>
20336 !! html/php
20337 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20338 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20339 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20340 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20341 <div class="gallerytext">
20342 <p>caption
20343 </p>
20344 </div>
20345 </div></li>
20346 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20347 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20348 <div class="gallerytext">
20349 </div>
20350 </div></li>
20351 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20352 <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>
20353 <div class="gallerytext">
20354 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20355 </p>
20356 </div>
20357 </div></li>
20358 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20359 <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>
20360 <div class="gallerytext">
20361 </div>
20362 </div></li>
20363 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20364 <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>
20365 <div class="gallerytext">
20366 <p>blabla.
20367 </p>
20368 </div>
20369 </div></li>
20370 </ul>
20371
20372 !! html/parsoid
20373 <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":{}}'>
20374 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20375 <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>
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"></div></li>
20377 <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>
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"></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 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>
20380 </ul>
20381 !! end
20382
20383 !! test
20384 Gallery (with options, extsrc)
20385 !! options
20386 parsoid={
20387 "nativeGallery": false
20388 }
20389 !! wikitext
20390 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20391 File:Nonexistent.jpg|caption
20392 File:Nonexistent.jpg
20393 image:foobar.jpg|some '''caption''' [[Main Page]]
20394 image:foobar.jpg
20395 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20396 </gallery>
20397 !! html/php
20398 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20399 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20400 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20401 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20402 <div class="gallerytext">
20403 <p>caption
20404 </p>
20405 </div>
20406 </div></li>
20407 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20408 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20409 <div class="gallerytext">
20410 </div>
20411 </div></li>
20412 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20413 <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>
20414 <div class="gallerytext">
20415 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20416 </p>
20417 </div>
20418 </div></li>
20419 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20420 <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>
20421 <div class="gallerytext">
20422 </div>
20423 </div></li>
20424 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20425 <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>
20426 <div class="gallerytext">
20427 <p>blabla.
20428 </p>
20429 </div>
20430 </div></li>
20431 </ul>
20432
20433 !! html/parsoid
20434 <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"}}'>
20435 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20436 <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>
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"></div></li>
20438 <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>
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"></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 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>
20441 </ul>
20442 !! end
20443
20444 !! test
20445 Gallery (without px units)
20446 !! wikitext
20447 <gallery widths="70" heights="40">
20448 File:Foobar.jpg
20449 </gallery>
20450 !! html/php
20451 <ul class="gallery mw-gallery-traditional">
20452 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20453 <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>
20454 <div class="gallerytext">
20455 </div>
20456 </div></li>
20457 </ul>
20458
20459 !! html/parsoid
20460 <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"}}'>
20461 <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>
20462 </ul>
20463 !! end
20464
20465 !! test
20466 Gallery (with invalid units)
20467 !! wikitext
20468 <gallery widths="70em" heights="40em">
20469 File:Foobar.jpg
20470 </gallery>
20471 !! html/php
20472 <ul class="gallery mw-gallery-traditional">
20473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20474 <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>
20475 <div class="gallerytext">
20476 </div>
20477 </div></li>
20478 </ul>
20479
20480 !! html/parsoid
20481 <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"}}'>
20482 <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>
20483 </ul>
20484 !! end
20485
20486 !! test
20487 Gallery with link that has fragment
20488 !! options
20489 parsoid={
20490 "modes": ["wt2html", "html2html"],
20491 "nativeGallery": true
20492 }
20493 !! wikitext
20494 <gallery>
20495 image:foobar.jpg|link=Main_Page
20496 image:foobar.jpg|link=Main_Page#section
20497 image:foobar.jpg|link=Main Page#section|caption
20498 </gallery>
20499 !! html/php
20500 <ul class="gallery mw-gallery-traditional">
20501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20502 <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>
20503 <div class="gallerytext">
20504 </div>
20505 </div></li>
20506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20507 <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>
20508 <div class="gallerytext">
20509 </div>
20510 </div></li>
20511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20512 <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>
20513 <div class="gallerytext">
20514 <p>caption
20515 </p>
20516 </div>
20517 </div></li>
20518 </ul>
20519
20520 !! html/parsoid
20521 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20522 <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>
20523 <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>
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">caption</div></li>
20525 </ul>
20526 !! end
20527
20528 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20529 !! test
20530 Gallery with template inside caption
20531 !! options
20532 parsoid={
20533 "nativeGallery": true
20534 }
20535 !! wikitext
20536 <gallery caption="{{echo|hi}}">
20537 File:Foobar.jpg|{{echo|ho}}
20538 </gallery>
20539 !! html/php
20540 <ul class="gallery mw-gallery-traditional">
20541 <li class='gallerycaption'>{{echo|hi}}</li>
20542 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20543 <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>
20544 <div class="gallerytext">
20545 <p>ho
20546 </p>
20547 </div>
20548 </div></li>
20549 </ul>
20550
20551 !! html/parsoid
20552 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20553 <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>
20554 <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>
20555 </ul>
20556 !! end
20557
20558 !! test
20559 Gallery with wikitext inside caption
20560 !! options
20561 parsoid={
20562 "nativeGallery": true
20563 }
20564 !! wikitext
20565 <gallery>
20566 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20567 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20568 </gallery>
20569 !! html/php
20570 <ul class="gallery mw-gallery-traditional">
20571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20572 <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>
20573 <div class="gallerytext">
20574 <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>
20575 </p>
20576 </div>
20577 </div></li>
20578 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20579 <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>
20580 <div class="gallerytext">
20581 <p>This is a test template
20582 </p>
20583 </div>
20584 </div></li>
20585 </ul>
20586
20587 !! html/parsoid
20588 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20589 <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>
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"><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>
20591 </ul>
20592 !! end
20593
20594 !! test
20595 Gallery (with showfilename option)
20596 !! options
20597 parsoid={
20598 "nativeGallery": true
20599 }
20600 !! wikitext
20601 <gallery showfilename="">
20602 File:Nonexistent.jpg|caption
20603 File:Nonexistent.jpg
20604 File:Foobar.jpg|some '''caption''' [[Main Page]]
20605 File:Foobar.jpg
20606 </gallery>
20607 !! html/php
20608 <ul class="gallery mw-gallery-traditional">
20609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20610 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20611 <div class="gallerytext">
20612 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20613 caption
20614 </p>
20615 </div>
20616 </div></li>
20617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20618 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20619 <div class="gallerytext">
20620 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20621 </p>
20622 </div>
20623 </div></li>
20624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20625 <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>
20626 <div class="gallerytext">
20627 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20628 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20629 </p>
20630 </div>
20631 </div></li>
20632 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20633 <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>
20634 <div class="gallerytext">
20635 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20636 </p>
20637 </div>
20638 </div></li>
20639 </ul>
20640
20641 !! html/parsoid
20642 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20643 <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>
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></div></li>
20645 <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>
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></div></li>
20647 </ul>
20648 !! end
20649
20650 ## Should Parsoid be preserving these variations? See T151367
20651 !! test
20652 Gallery (with namespace-less filenames)
20653 !! options
20654 parsoid={
20655 "modes": ["wt2html", "html2html"],
20656 "nativeGallery": true
20657 }
20658 !! wikitext
20659 <gallery>
20660 File:Nonexistent.jpg
20661 Nonexistent.jpg
20662 image:foobar.jpg
20663 foobar.jpg
20664 </gallery>
20665 !! html/php
20666 <ul class="gallery mw-gallery-traditional">
20667 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20668 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20669 <div class="gallerytext">
20670 </div>
20671 </div></li>
20672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20673 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20674 <div class="gallerytext">
20675 </div>
20676 </div></li>
20677 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20678 <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>
20679 <div class="gallerytext">
20680 </div>
20681 </div></li>
20682 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20683 <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>
20684 <div class="gallerytext">
20685 </div>
20686 </div></li>
20687 </ul>
20688
20689 !! html/parsoid
20690 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20691 <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>
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: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>
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 </ul>
20696 !! end
20697
20698 !! test
20699 Gallery override link with wikilink (T36852)
20700 !! options
20701 parsoid={
20702 "nativeGallery": true
20703 }
20704 !! wikitext
20705 <gallery>
20706 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20707 </gallery>
20708 !! html/php
20709 <ul class="gallery mw-gallery-traditional">
20710 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20711 <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>
20712 <div class="gallerytext">
20713 </div>
20714 </div></li>
20715 </ul>
20716
20717 !! html/parsoid
20718 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20719 <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>
20720 </ul>
20721 !! end
20722
20723 !! test
20724 Gallery override link with absolute external link (T36852)
20725 !! options
20726 parsoid={
20727 "nativeGallery": true
20728 }
20729 !! wikitext
20730 <gallery>
20731 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20732 </gallery>
20733 !! html/php
20734 <ul class="gallery mw-gallery-traditional">
20735 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20736 <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>
20737 <div class="gallerytext">
20738 </div>
20739 </div></li>
20740 </ul>
20741
20742 !! html/parsoid
20743 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20744 <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>
20745 </ul>
20746 !! end
20747
20748 !! test
20749 Gallery override link with absolute external link with LanguageConverter
20750 !! options
20751 language=zh
20752 !! wikitext
20753 <gallery>
20754 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20755 </gallery>
20756 !! html/php
20757 <ul class="gallery mw-gallery-traditional">
20758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20759 <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>
20760 <div class="gallerytext">
20761 <p>caption
20762 </p>
20763 </div>
20764 </div></li>
20765 </ul>
20766
20767 !! html/parsoid
20768 <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"}}'>
20769 <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>
20770 </ul>
20771 !! end
20772
20773 !! test
20774 Gallery override link with malicious javascript (T36852)
20775 !! options
20776 parsoid={
20777 "modes": ["wt2html", "html2html"],
20778 "nativeGallery": true
20779 }
20780 !! wikitext
20781 <gallery>
20782 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20783 </gallery>
20784 !! html/php
20785 <ul class="gallery mw-gallery-traditional">
20786 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20787 <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>
20788 <div class="gallerytext">
20789 </div>
20790 </div></li>
20791 </ul>
20792
20793 !! html/parsoid
20794 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20795 <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>
20796 </ul>
20797 !! end
20798
20799 # Note that parsoid uses the invalid link as a caption, PHP does not.
20800 !! test
20801 Gallery with invalid title as link (T45964)
20802 !! options
20803 parsoid={
20804 "modes": ["wt2html", "html2html"],
20805 "nativeGallery": true
20806 }
20807 !! wikitext
20808 <gallery>
20809 File:Foobar.jpg|link=<
20810 </gallery>
20811 !! html/php
20812 <ul class="gallery mw-gallery-traditional">
20813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20814 <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>
20815 <div class="gallerytext">
20816 </div>
20817 </div></li>
20818 </ul>
20819
20820 !! html/parsoid
20821 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20822 <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>
20823 </ul>
20824 !! end
20825
20826 !! test
20827 Serialize gallery without attrs in data-mw
20828 !! options
20829 parsoid={
20830 "modes": ["html2wt"],
20831 "nativeGallery": true
20832 }
20833 !! html/parsoid
20834 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20835 <li class="gallerycaption">123</li>
20836 <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>
20837 </ul>
20838 !! wikitext
20839 <gallery caption="123">
20840 File:Test.png
20841 </gallery>
20842 !! end
20843
20844 !! test
20845 Gallery with class and style attributes
20846 !! options
20847 parsoid={
20848 "nativeGallery": true
20849 }
20850 !! wikitext
20851 <gallery class="center" style="text-align: center;">
20852 File:Foobar.jpg
20853 </gallery>
20854 !! html/php
20855 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20856 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20857 <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>
20858 <div class="gallerytext">
20859 </div>
20860 </div></li>
20861 </ul>
20862
20863 !! html/parsoid
20864 <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":{}}'>
20865 <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>
20866 </ul>
20867 !! end
20868
20869 !! test
20870 Gallery in slideshow mode
20871 !! options
20872 parsoid={
20873 "nativeGallery": true
20874 }
20875 !! wikitext
20876 <gallery mode="slideshow" showthumbnails="">
20877 File:Foobar.jpg
20878 </gallery>
20879 !! html/php
20880 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20882 <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>
20883 <div class="gallerytext">
20884 </div>
20885 </div></li>
20886 </ul>
20887
20888 !! html/parsoid
20889 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20890 <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>
20891 </ul>
20892 !! end
20893
20894 !! test
20895 HTML Hex character encoding (spells the word "JavaScript")
20896 !! options
20897 parsoid=wt2html,wt2wt,html2html
20898 !! wikitext
20899 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20900 !! html/php
20901 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20902 </p>
20903 !! html/parsoid
20904 <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>
20905 !! end
20906
20907 !! test
20908 HTML Hex character encoding bogus encoding (T28437 regression check)
20909 !! wikitext
20910 &#xsee;&#XSEE;
20911 !! html
20912 <p>&amp;#xsee;&amp;#XSEE;
20913 </p>
20914 !! end
20915
20916 !! test
20917 HTML Hex character encoding mixed case
20918 !! options
20919 parsoid=wt2html,wt2wt,html2html
20920 !! wikitext
20921 &#xEE;&#Xee;
20922 !! html/php
20923 <p>&#xee;&#xee;
20924 </p>
20925 !! html/parsoid
20926 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20927 !! end
20928
20929 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20930 # Note that U+000C (form feed) is not a valid XML character, so
20931 # it is banned even though allowed in HTML5.
20932 !! test
20933 Illegal character references (T106578)
20934 !! wikitext
20935 ; Null: &#00;
20936 ; FF: &#xC;
20937 ; CR: &#xD;
20938 ; Control (low): &#8;
20939 ; Control (high): &#x7F; &#x9F;
20940 ; Surrogate: &#xD83D;&#xDCA9;
20941 ; This is an okay astral character: &#x1F4A9;
20942 !! html+tidy
20943 <dl><dt>Null</dt>
20944 <dd>&amp;#00;</dd>
20945 <dt>FF</dt>
20946 <dd>&amp;#xC;</dd>
20947 <dt>CR</dt>
20948 <dd>&amp;#xD;</dd>
20949 <dt>Control (low)</dt>
20950 <dd>&amp;#8;</dd>
20951 <dt>Control (high)</dt>
20952 <dd>&amp;#x7F; &amp;#x9F;</dd>
20953 <dt>Surrogate</dt>
20954 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20955 <dt>This is an okay astral character</dt>
20956 <dd>&#x1f4a9;</dd></dl>
20957 !! end
20958
20959 !! test
20960 __FORCETOC__ override
20961 !! wikitext
20962 __NEWSECTIONLINK__
20963 __FORCETOC__
20964 !! html/php
20965 <p><br />
20966 </p>
20967 !! end
20968
20969 !! test
20970 ISBN code coverage
20971 !! wikitext
20972 ISBN 978-0-1234-56&#x20;789
20973 !! html/php
20974 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20975 </p>
20976 !! html/parsoid
20977 <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>
20978 !! end
20979
20980 !! test
20981 ISBN followed by 5 spaces
20982 !! wikitext
20983 ISBN
20984 !! html
20985 <p>ISBN
20986 </p>
20987 !! end
20988
20989 !! test
20990 Double ISBN
20991 !! wikitext
20992 ISBN ISBN 1234567890
20993 !! html/php
20994 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20995 </p>
20996 !! html/parsoid
20997 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20998 !! end
20999
21000 # Uppercase X and lowercase x as well
21001 !! test
21002 ISBN with an X
21003 !! wikitext
21004 ISBN 3-462-04561-X
21005 ISBN 3-462-04561-x
21006 ISBN 080442957X
21007 ISBN 080442957x
21008 ISBN 978080442957X
21009 ISBN 978080442957x
21010 !! html/php
21011 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21012 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21013 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21014 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21015 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21016 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21017 </p>
21018 !! html/parsoid
21019 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21020 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21021 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21022 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21023 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21024 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21025 !! end
21026
21027 !! test
21028 ISBN with empty prefix (parsoid test)
21029 !! wikitext
21030 ISBN 1234567890
21031 !! html/php
21032 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21033 </p>
21034 !! html/parsoid
21035 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21036 !! end
21037
21038 !! test
21039 T24905: <abbr> followed by ISBN followed by </a>
21040 !! wikitext
21041 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21042 !! html/php
21043 <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>
21044 </p>
21045 !! html/parsoid
21046 <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>
21047 !! end
21048
21049 !! test
21050 Double RFC
21051 !! wikitext
21052 RFC RFC 1234
21053 !! html
21054 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21055 </p>
21056 !! end
21057
21058 !! test
21059 Double RFC with a wiki link
21060 !! wikitext
21061 RFC [[RFC 1234]]
21062 !! html
21063 <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>
21064 </p>
21065 !! end
21066
21067 !! test
21068 RFC code coverage
21069 !! wikitext
21070 RFC 983&#x20;987
21071 !! html/php
21072 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21073 </p>
21074 !! html/parsoid
21075 <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>
21076 !! end
21077
21078 !! test
21079 Centre-aligned image
21080 !! wikitext
21081 [[Image:foobar.jpg|centre]]
21082 !! html/php
21083 <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>
21084
21085 !! html/parsoid
21086 <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>
21087 !! end
21088
21089 !! test
21090 None-aligned image
21091 !! wikitext
21092 [[Image:foobar.jpg|none]]
21093 !! html/php
21094 <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>
21095
21096 !! html/parsoid
21097 <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>
21098 !! end
21099
21100 !! test
21101 Width + Height sized image (using px) (height is ignored)
21102 !! wikitext
21103 [[Image:foobar.jpg|640x480px]]
21104 !! html/php
21105 <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>
21106 </p>
21107 !! html/parsoid
21108 <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>
21109 !! end
21110
21111 !! test
21112 Width-sized image (using px, no following whitespace)
21113 !! wikitext
21114 [[Image:foobar.jpg|640px]]
21115 !! html/php
21116 <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>
21117 </p>
21118 !! html/parsoid
21119 <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>
21120 !! end
21121
21122 !! test
21123 Width-sized image (using px, with following whitespace - test regression from r39467)
21124 !! wikitext
21125 [[Image:foobar.jpg|640px ]]
21126 !! html/php
21127 <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>
21128 </p>
21129 !! html/parsoid
21130 <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>
21131 !!end
21132
21133 !! test
21134 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21135 !! wikitext
21136 [[Image:foobar.jpg| 640px]]
21137 !! html/php
21138 <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>
21139 </p>
21140 !! html/parsoid
21141 <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>
21142 !! end
21143
21144 !! test
21145 Image with page parameter
21146 !! options
21147 djvu
21148 !! wikitext
21149 [[File:LoremIpsum.djvu|page=2]]
21150 !! html/php
21151 <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>
21152 </p>
21153 !! html/parsoid
21154 <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>
21155 !! end
21156
21157 !! test
21158 Another italics / bold test
21159 !! wikitext
21160 ''' ''x'
21161 !! html
21162 <pre>'<i> </i>x'
21163 </pre>
21164 !!end
21165
21166 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21167 !! test
21168 dt/dd/dl test
21169 !! wikitext
21170 :;;;::
21171 !! html/php
21172 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21173
21174 !! html/parsoid
21175 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21176
21177 !!end
21178
21179 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21180 !! test
21181 Images with the "|" character in the comment
21182 !! wikitext
21183 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21184 !! html/php
21185 <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>
21186
21187 !! html/parsoid
21188 <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>
21189 !! end
21190
21191 !! test
21192 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21193 !! wikitext
21194 <html><script>alert(1);</script></html>
21195 !! html
21196 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21197 </p>
21198 !! end
21199
21200 !! test
21201 HTML with raw HTML ($wgRawHtml==true)
21202 !! options
21203 wgRawHtml=1
21204 !! wikitext
21205 <html><script>alert(1);</script></html>
21206 !! html/php
21207 <p><script>alert(1);</script>
21208 </p>
21209 !! end
21210
21211 !! test
21212 Parents of subpages, one level up
21213 !! options
21214 subpage title=[[Subpage test/L1/L2/L3]]
21215 !! wikitext
21216 [[../|L2]]
21217 !! html
21218 <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>
21219 </p>
21220 !! end
21221
21222
21223 !! test
21224 Parents of subpages, one level up, not named
21225 !! options
21226 subpage title=[[Subpage test/L1/L2/L3]]
21227 !! wikitext
21228 [[../]]
21229 !! html
21230 <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>
21231 </p>
21232 !! end
21233
21234
21235
21236 !! test
21237 Parents of subpages, two levels up
21238 !! options
21239 subpage title=[[Subpage test/L1/L2/L3]]
21240 !! wikitext
21241 [[../../|L1]]2
21242
21243 [[../../|L1]]l
21244 !! html
21245 <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
21246 </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>
21247 </p>
21248 !! end
21249
21250 !! test
21251 Parents of subpages, two levels up, without trailing slash or name.
21252 !! options
21253 subpage title=[[Subpage test/L1/L2/L3]]
21254 !! wikitext
21255 [[../..]]
21256 !! html
21257 <p>[[../..]]
21258 </p>
21259 !! end
21260
21261 !! test
21262 Parents of subpages, two levels up, with lots of extra trailing slashes.
21263 !! options
21264 subpage title=[[Subpage test/L1/L2/L3]]
21265 !! wikitext
21266 [[../../////]]
21267 !! html
21268 <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>
21269 </p>
21270 !! end
21271
21272 !! article
21273 Subpage test/L1/L2/L3Sibling
21274 !! text
21275 Sibling article
21276 !! endarticle
21277
21278 !! test
21279 Transclusion of a sibling page (one level up)
21280 !! options
21281 subpage title=[[Subpage test/L1/L2/L3]]
21282 !! wikitext
21283 {{../L3Sibling}}
21284 !! html
21285 <p>Sibling article
21286 </p>
21287 !! end
21288
21289 !! test
21290 Transclusion of a child page
21291 !! options
21292 subpage title=[[Subpage test/L1/L2]]
21293 !! wikitext
21294 {{/L3Sibling}}
21295 !! html
21296 <p>Sibling article
21297 </p>
21298 !! end
21299
21300 # This is wt2html only in Parsoid because we add <nowiki>
21301 # because of {{..}} and we don't expect to fix that to
21302 # eliminate the nowikis selective for {{..}} markup.
21303 !! test
21304 Non-transclusion because of too many up levels
21305 !! options
21306 subpage title=[[Subpage test/L1/L2/L3]]
21307 parsoid=wt2html
21308 !! wikitext
21309 {{../../../../More than parent}}
21310 !! html/php
21311 <p>{{../../../../More than parent}}
21312 </p>
21313 !! html/parsoid
21314 <p>{{../../../../More than parent}}</p>
21315 !! end
21316
21317 !! test
21318 Definition list code coverage
21319 !! wikitext
21320 ;title : def
21321 ;title : def
21322 ;title: def
21323 !! html/php
21324 <dl><dt>title &#160;</dt>
21325 <dd>def</dd>
21326 <dt>title&#160;</dt>
21327 <dd>def</dd>
21328 <dt>title</dt>
21329 <dd>def</dd></dl>
21330
21331 !! html/parsoid
21332 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21333 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21334 <dt>title</dt><dd> def</dd></dl>
21335 !! end
21336
21337 !! test
21338 Don't fall for the self-closing div
21339 !! wikitext
21340 <div>hello world</div/>
21341 !! html
21342 <div>hello world</div>
21343
21344 !! end
21345
21346 !! test
21347 MSGNW magic word
21348 !! wikitext
21349 {{MSGNW:msg}}
21350 !! html/php
21351 <p>&#91;&#91;:Template:Msg&#93;&#93;
21352 </p>
21353 !! end
21354
21355 !! test
21356 RAW magic word
21357 !! wikitext
21358 {{RAW:QUERTY}}
21359 !! html
21360 <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>
21361 </p>
21362 !! end
21363
21364 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21365 !! test
21366 Always escape literal '>' in output, not just after '<'
21367 !! wikitext
21368 ><>
21369 !! html
21370 <p>&gt;&lt;&gt;
21371 </p>
21372 !! end
21373
21374 !! test
21375 Template caching
21376 !! wikitext
21377 {{Test}}
21378 {{Test}}
21379 !! html
21380 <p>This is a test template
21381 This is a test template
21382 </p>
21383 !! end
21384
21385
21386 !! article
21387 MediaWiki:Fake
21388 !! text
21389 ==header==
21390 !! endarticle
21391
21392 !! test
21393 Inclusion of !userCanEdit() content
21394 !! wikitext
21395 {{MediaWiki:Fake}}
21396 !! html
21397 <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>
21398
21399 !! end
21400
21401
21402 !! test
21403 Out-of-order TOC heading levels
21404 !! wikitext
21405 ==2==
21406 ======6======
21407 ===3===
21408 =1=
21409 =====5=====
21410 ==2==
21411 !! html
21412 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21413 <ul>
21414 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21415 <ul>
21416 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21417 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21418 </ul>
21419 </li>
21420 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21421 <ul>
21422 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21423 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21424 </ul>
21425 </li>
21426 </ul>
21427 </div>
21428
21429 <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>
21430 <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>
21431 <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>
21432 <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>
21433 <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>
21434 <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>
21435
21436 !! end
21437
21438
21439 !! test
21440 ISBN with a dummy number
21441 !! wikitext
21442 ISBN ---
21443 !! html
21444 <p>ISBN ---
21445 </p>
21446 !! end
21447
21448
21449 !! test
21450 ISBN with space-delimited number
21451 !! wikitext
21452 ISBN 92 9017 032 8
21453 !! html/php
21454 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21455 </p>
21456 !! html/parsoid
21457 <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>
21458 !! end
21459
21460
21461 !! test
21462 ISBN with multiple spaces, no number
21463 !! wikitext
21464 ISBN foo
21465 !! html
21466 <p>ISBN foo
21467 </p>
21468 !! end
21469
21470
21471 !! test
21472 ISBN length
21473 !! wikitext
21474 ISBN 123456789
21475
21476 ISBN 1234567890
21477
21478 ISBN 12345678901
21479 !! html/php
21480 <p>ISBN 123456789
21481 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21482 </p><p>ISBN 12345678901
21483 </p>
21484 !! html/parsoid
21485 <p>ISBN 123456789</p>
21486
21487 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21488
21489 <p>ISBN 12345678901</p>
21490 !! end
21491
21492
21493 !! test
21494 ISBN with trailing year (T9110)
21495 !! wikitext
21496 ISBN 1-234-56789-0 - 2006
21497
21498 ISBN 1 234 56789 0 - 2006
21499 !! html/php
21500 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21501 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21502 </p>
21503 !! html/parsoid
21504 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21505
21506 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21507 !! end
21508
21509
21510 !! test
21511 anchorencode
21512 !! config
21513 wgFragmentMode=[ 'html5', 'legacy' ]
21514 !! wikitext
21515 {{anchorencode:foo bar©#%n}}
21516 !! html/php
21517 <p>foo_bar©#%n
21518 </p>
21519 !! html/parsoid
21520 <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>
21521 !! end
21522
21523 !! test
21524 anchorencode (legacy)
21525 !! config
21526 wgFragmentMode=[ 'legacy' ]
21527 !! wikitext
21528 {{anchorencode:foo bar©#%n}}
21529 !! html/php
21530 <p>foo_bar.C2.A9.23.25n
21531 </p>
21532 !! end
21533
21534 !! test
21535 anchorencode trims spaces
21536 !! config
21537 wgFragmentMode=[ 'html5', 'legacy' ]
21538 !! wikitext
21539 {{anchorencode: __pretty__please__}}
21540 !! html/php
21541 <p>pretty_please
21542 </p>
21543 !! html/parsoid
21544 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21545 !! end
21546
21547 !! test
21548 anchorencode deals with links
21549 !! config
21550 wgFragmentMode=[ 'html5', 'legacy' ]
21551 !! wikitext
21552 {{anchorencode: [[hello|world]] [[hi]]}}
21553 !! html/php
21554 <p>world_hi
21555 </p>
21556 !! html/parsoid
21557 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21558 !! end
21559
21560 !! test
21561 anchorencode deals with templates
21562 !! config
21563 wgFragmentMode=[ 'html5', 'legacy' ]
21564 !! wikitext
21565 {{anchorencode: {{Foo}} x}}
21566 !! html/php
21567 <p>FOO_x
21568 </p>
21569 !! html/parsoid
21570 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21571 !! end
21572
21573 !! test
21574 anchorencode encodes like the TOC generator: (T20431)
21575 !! config
21576 wgFragmentMode=[ 'html5', 'legacy' ]
21577 !! wikitext
21578 ===_ +:.3A%3A _ &&amp;]] x===
21579 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21580 __NOEDITSECTION__
21581 !! html/php
21582 <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>
21583 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21584 </p>
21585 !! html/parsoid
21586 <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>
21587 <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>
21588 <meta property="mw:PageProp/noeditsection"/>
21589 !! end
21590
21591 !! test
21592 anchorencode encodes like the TOC generator: (T20431) (legacy)
21593 !! config
21594 wgFragmentMode=[ 'legacy' ]
21595 !! wikitext
21596 ===_ +:.3A%3A&&amp;]]===
21597 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21598 __NOEDITSECTION__
21599 !! html/php
21600 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21601 <p>.2B:.3A.253A.26.26.5D.5D
21602 </p>
21603 !! end
21604
21605 !! test
21606 T8200: blockquotes and paragraph formatting
21607 !! wikitext
21608 <blockquote>
21609 foo
21610 </blockquote>
21611
21612 bar
21613
21614 baz
21615 !! html
21616 <blockquote>
21617 <p>foo
21618 </p>
21619 </blockquote>
21620 <p>bar
21621 </p>
21622 <pre>baz
21623 </pre>
21624 !! end
21625
21626 !! test
21627 T10293: Use of center tag ruins paragraph formatting
21628 !! wikitext
21629 <center>
21630 foo
21631 </center>
21632
21633 bar
21634
21635 baz
21636 !! html
21637 <center>
21638 <p>foo
21639 </p>
21640 </center>
21641 <p>bar
21642 </p>
21643 <pre>baz
21644 </pre>
21645 !! end
21646
21647 !!test
21648 Parsing of overlapping (improperly nested) inline html tags
21649 !! wikitext
21650 <span><s>x</span></s>
21651 !! html/php
21652 <p><span><s>x&lt;/span&gt;</s></span>
21653 </p>
21654 !! html/parsoid
21655 <p><span><s>x</s></span>
21656 </p>
21657 !!end
21658
21659 ###
21660 ### Language variants related tests
21661 ###
21662
21663 # Parsoid does not mark self-links.
21664 # Parsoid does not convert links; PHP will do any necessary redirects.
21665
21666 !! test
21667 Self-link in language variants
21668 !! options
21669 title=[[Dunav]] language=sr
21670 !! wikitext
21671 Both [[Dunav]] and [[Дунав]] are names for this river.
21672 !! html/php
21673 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21674 </p>
21675 !! html/parsoid
21676 <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>
21677 !! end
21678
21679 !! article
21680 Дуна
21681 !! text
21682 content
21683 !! endarticle
21684
21685 !! test
21686 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21687 !! options
21688 title=[[Duna]] language=sr
21689 !! wikitext
21690 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21691 !! html/php
21692 <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.
21693 </p>
21694 !! html/parsoid
21695 <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>
21696 !! end
21697
21698 !! test
21699 Link to a section of a variant of this title shouldn't be parsed as self-link
21700 !! options
21701 title=[[Duna]] language=sr
21702 !! wikitext
21703 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21704 !! html/php
21705 <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.
21706 </p>
21707 !! html/parsoid
21708 <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>
21709 !! end
21710
21711 !! test
21712 Link to pages in language variants
21713 !! options
21714 language=sr
21715 !! wikitext
21716 Main Page can be written as [[Маин Паге]]
21717 !! html/php
21718 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21719 </p>
21720 !! html/parsoid
21721 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21722 !! end
21723
21724
21725 !! test
21726 Multiple links to pages in language variants
21727 !! options
21728 language=sr
21729 !! wikitext
21730 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21731 !! html/php
21732 <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>.
21733 </p>
21734 !! html/parsoid
21735 <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>
21736 !! end
21737
21738
21739 !! test
21740 Simple template in language variants
21741 !! options
21742 language=sr
21743 !! wikitext
21744 {{тест}}
21745 !! html/php
21746 <p>This is a test template
21747 </p>
21748 !! end
21749
21750
21751 !! test
21752 Template with explicit namespace in language variants
21753 !! options
21754 language=sr
21755 !! wikitext
21756 {{Template:тест}}
21757 !! html/php
21758 <p>This is a test template
21759 </p>
21760 !! end
21761
21762
21763 !! test
21764 Basic test for template parameter in language variants
21765 !! options
21766 language=sr
21767 !! wikitext
21768 {{парамтест|param=foo}}
21769 !! html/php
21770 <p>This is a test template with parameter foo
21771 </p>
21772 !! end
21773
21774 !! test
21775 Simple category in language variants
21776 !! options
21777 language=sr cat
21778 !! wikitext
21779 [[Category:МедиаWики Усер'с Гуиде]]
21780 !! html/php
21781 cat=МедиаWики_Усер'с_Гуиде sort=
21782 !! html/parsoid
21783 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21784 !! end
21785
21786 !! article
21787 Category:分类
21788 !! text
21789 blah
21790 !! endarticle
21791
21792 !! article
21793 Category:分類
21794 !! text
21795 blah
21796 !! endarticle
21797
21798 ## We used to, but no longer wt2wt this test since the default serializer
21799 ## will normalize all categories to serialize on their own line.
21800 ## This wikitext usage is going to be fairly uncommon in production and
21801 ## selser will take care of preserving formatting in those scenarios.
21802 !! test
21803 Don't convert blue categorylinks to another variant (T35210)
21804 !! options
21805 cat
21806 language=zh
21807 parsoid=wt2html
21808 !! wikitext
21809 [[A]][[Category:分类]]
21810 !! html/php
21811 cat=分类 sort=
21812 !! html/parsoid
21813 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21814 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21815 !! end
21816
21817 !! test
21818 Stripping -{}- tags (language variants)
21819 !! options
21820 language=sr
21821 !! wikitext
21822 Latin proverb: -{Ne nuntium necare}-
21823 !! html/php
21824 <p>Latin proverb: Ne nuntium necare
21825 </p>
21826 !! html/parsoid
21827 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21828 !! end
21829
21830
21831 !! test
21832 Prevent conversion with -{}- tags (language variants)
21833 !! options
21834 language=sr variant=sr-ec
21835 !! wikitext
21836 Latinski: -{Ne nuntium necare}-
21837 !! html/php
21838 <p>Латински: Ne nuntium necare
21839 </p>
21840 !! html/parsoid
21841 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21842 !! end
21843
21844
21845 !! test
21846 Prevent conversion of text with -{}- tags (language variants)
21847 !! options
21848 language=sr variant=sr-ec
21849 !! wikitext
21850 Latinski: -{Ne nuntium necare}-
21851 !! html/php
21852 <p>Латински: Ne nuntium necare
21853 </p>
21854 !! html/parsoid
21855 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21856 !! end
21857
21858
21859 !! test
21860 Prevent conversion of links with -{}- tags (language variants)
21861 !! options
21862 language=sr variant=sr-ec
21863 !! wikitext
21864 -{[[Main Page]]}-
21865 !! html/php
21866 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21867 </p>
21868 !! html/parsoid
21869 <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>
21870 !! end
21871
21872
21873 !! test
21874 -{}- tags within headlines (within html for parserConvert())
21875 !! config
21876 wgFragmentMode=[ 'html5', 'legacy' ]
21877 !! options
21878 language=sr variant=sr-ec
21879 !! wikitext
21880 ==-{Naslov}-==
21881
21882 Note that even an unprotected headline ID is not affected by language
21883 conversion:
21884
21885 ==Latinski==
21886 !! html/php
21887 <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>
21888 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21889 цонверсион:
21890 </p>
21891 <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>
21892
21893 !! html/parsoid
21894 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21895
21896 <p>Note that even an unprotected headline ID is not affected by language
21897 conversion:</p>
21898
21899 <h2 id="Latinski">Latinski</h2>
21900 !! end
21901
21902 !! test
21903 Explicit definition of language variant alternatives
21904 !! options
21905 language=zh variant=zh-tw
21906 !! wikitext
21907 -{zh:China;zh-tw:Taiwan}-, not China
21908 !! html/php
21909 <p>Taiwan, not China
21910 </p>
21911 !! html/parsoid
21912 <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>
21913 !! end
21914
21915 !! test
21916 Filter syntax for language variants
21917 !! options
21918 language=zh variant=zh-tw
21919 !! wikitext
21920 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21921 !! html/php
21922 <p>fooblog, WEBJOURNAL, WEBLOGquux
21923 </p>
21924 !! html/parsoid
21925 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21926 !! end
21927
21928 # Note that Parsoid post-processing for language variants needs to
21929 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21930 !! test
21931 Conversion around HTML tags
21932 !! options
21933 language=sr variant=sr-ec
21934 !! wikitext
21935 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21936 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21937 !! html/php
21938 <p>
21939 <span title="ЛаCтин">ски</span>
21940 </p>
21941 !! html/parsoid
21942 <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"}]}'/>
21943 <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>
21944 !! end
21945
21946 !! test
21947 Explicit session-wise two-way language variant mapping (A flag and - flag)
21948 !! options
21949 language=zh variant=zh-tw
21950 !! wikitext
21951 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21952
21953 Taiwan is not China.
21954
21955 But -{A|zh:China; zh-tw:Taiwan}- is China,
21956
21957 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21958
21959 and -{China}- is China.
21960 !! html/php
21961 <p>This is Taiwan, but we'll forget that now.
21962 </p><p>Taiwan is not China.
21963 </p><p>But Taiwan is Taiwan,
21964 </p><p>(This should be stripped!)
21965 </p><p>and China is China.
21966 </p>
21967 !! html/parsoid
21968 <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>
21969 <p>Taiwan is not China.</p>
21970 <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>
21971 <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>
21972 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21973 !! end
21974
21975 !! test
21976 Explicit session-wise one-way language variant mapping (A flag and - flag)
21977 !! options
21978 language=zh variant=zh-tw
21979 !! wikitext
21980 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21981
21982 COUNTRY is China or Taiwan.
21983
21984 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21985
21986 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21987
21988 and -{COUNTRY}- is COUNTRY.
21989 !! html/php
21990 <p>This is Taiwan, but we'll forget that now.
21991 </p><p>COUNTRY is China or Taiwan.
21992 </p><p>But Taiwan is Taiwan,
21993 </p><p>(This should be stripped!)
21994 </p><p>and COUNTRY is COUNTRY.
21995 </p>
21996 !! html/parsoid
21997 <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>
21998 <p>COUNTRY is China or Taiwan.</p>
21999 <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>
22000 <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>
22001 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22002 !! end
22003
22004 !! test
22005 Explicit session-wise two-way language variant mapping (H flag for hide)
22006 !! options
22007 language=zh variant=zh-tw
22008 !! wikitext
22009 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22010
22011 Taiwan is China.
22012 !! html/php
22013 <p>(This should be stripped!)
22014 </p><p>Taiwan is Taiwan.
22015 </p>
22016 !! html/parsoid
22017 <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>
22018 <p>Taiwan is China.</p>
22019 !! end
22020
22021 !! test
22022 Explicit session-wise one-way language variant mapping (H flag for hide)
22023 !! options
22024 language=zh variant=zh-tw
22025 !! wikitext
22026 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22027
22028 COUNTRY is Taiwan or China.
22029 !! html/php
22030 <p>(This should be stripped!)
22031 </p><p>Taiwan is Taiwan or China.
22032 </p>
22033 !! html/parsoid
22034 <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>
22035 <p>COUNTRY is Taiwan or China.</p>
22036 !! end
22037
22038 ## Note that parsoid test runner does not support 'showtitle' option.
22039 !! test
22040 Adding explicit conversion rule for title (T flag)
22041 !! options
22042 language=zh variant=zh-tw showtitle
22043 !! wikitext
22044 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22045
22046 Taiwan is China.
22047 !! html/php
22048 Taiwan
22049 <p>Should be stripped!
22050 </p><p>Taiwan is China.
22051 </p>
22052 !! html/parsoid
22053 <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>
22054 <p>Taiwan is China.</p>
22055 !! end
22056
22057 !! test
22058 Code coverage: T combined with H flag
22059 !! options
22060 language=zh variant=zh-tw showtitle
22061 !! wikitext
22062 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22063
22064 Taiwan is China.
22065 !! html/php
22066 Taiwan
22067 <p>Should be stripped!
22068 </p><p>Taiwan is Taiwan.
22069 </p>
22070 !! html/parsoid
22071 <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>
22072 <p>Taiwan is China.</p>
22073 !! end
22074
22075 !! test
22076 Code coverage: T with no variants
22077 !! options
22078 language=zh variant=zh-tw showtitle
22079 !! wikitext
22080 -{H|zh:China; zh-tw:Taiwan}-
22081 Taiwan is China.-{T|Taiwan is China}-
22082 !! html/php
22083 Taiwan is China
22084 <p>
22085 Taiwan is Taiwan.
22086 </p>
22087 !! html/parsoid
22088 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22089 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22090 !! end
22091
22092 !! test
22093 Code coverage: rules with no variants
22094 !! options
22095 language=zh variant=zh-tw
22096 !! wikitext
22097 -{H|zh:China; zh-tw:Taiwan}-
22098 Taiwan is China.
22099 -{H|China}-
22100 Taiwan is China.
22101 !! html/php
22102 <p>
22103 Taiwan is Taiwan.
22104
22105 Taiwan is China.
22106 </p>
22107 !! html/parsoid
22108 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22109 Taiwan is China.
22110 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22111 Taiwan is China.</p>
22112 !! end
22113
22114
22115 !! test
22116 Code coverage: D flag for conversion rule
22117 !! options
22118 language=zh variant=zh-tw
22119 !! wikitext
22120 -{D|zh-cn:XA; zh-tw:YA}-
22121 -{A;D|zh-cn:XB; zh-tw:YB}-
22122 -{D;H|zh-cn:XC; zh-tw:YC}-
22123
22124 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22125
22126 -{D|0=>zh-tw:1}-
22127 -{A;D|2=>zh-tw:3}-
22128 -{D;H|4=>zh-tw:5}-
22129
22130 XA XB XC YA YB YC FOO BAR BAT 012345
22131 !! html/php
22132 <p>大陆:XA;台灣:YA;
22133
22134 大陆:XC;台灣:YC;
22135 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22136 </p><p>0⇒台灣:1;
22137
22138 4⇒台灣:5;
22139 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22140 </p>
22141 !! html/parsoid
22142 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22143 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22144 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22145 <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>
22146 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22147 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22148 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22149 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22150 !! end
22151
22152 !! test
22153 Code coverage: N flag for conversion rule
22154 !! options
22155 language=zh variant=zh-cn
22156 !! wikitext
22157 -{N|zh-cn}-
22158
22159 -{N|zh-tw}-
22160
22161 -{N|sr-ec}-
22162 !! html/php
22163 <p>大陆
22164 </p><p>台灣
22165 </p><p>српски (ћирилица)‎
22166 </p>
22167 !! html/parsoid
22168 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22169 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22170 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22171 !! end
22172
22173 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22174 !! test
22175 Code coverage: N flag for conversion rule (wt2html only)
22176 !! options
22177 language=zh variant=zh-cn
22178 parsoid=wt2html,html2html
22179 !! wikitext
22180 -{D;N|en}-
22181 !! html/php
22182 <p>English
22183 </p>
22184 !! html/parsoid
22185 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22186 !! end
22187
22188 !! test
22189 Testing that changing the language variant here in the tests actually works
22190 !! options
22191 language=zh variant=zh showtitle
22192 !! wikitext
22193 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22194 !! html/php
22195 China
22196 <p>Should be stripped!
22197 </p>
22198 !! html/parsoid
22199 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22200 !! end
22201
22202 !! test
22203 Recursive conversion of alt and title attrs shouldn't clear converter state
22204 !! options
22205 language=zh variant=zh-cn
22206 showtitle
22207 !! wikitext
22208 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22209 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22210 !! html/php
22211 China
22212 <p>
22213 Should be stripped<span title="Exclamation">!</span>
22214 </p>
22215 !! html/parsoid
22216 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22217 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>
22218 !! end
22219
22220 !! test
22221 T26072: more test on conversion rule for title
22222 !! options
22223 language=zh variant=zh-tw showtitle
22224 !! wikitext
22225 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22226
22227 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22228 !! html/php
22229 Taiwan
22230 <p>This should be stripped!
22231 </p><p>This won't take interferes with the title rule.
22232 </p>
22233 !! html/parsoid
22234 <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>
22235 <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>
22236 !! end
22237
22238 !! test
22239 Partly disable title conversion if variant == main language code
22240 !! options
22241 language=zh variant=zh title=[[ZH]] showtitle
22242 !! wikitext
22243 -{T|zh-cn:CN;zh-tw:TW}-
22244 !! html/php
22245 ZH
22246 <p>
22247 </p>
22248 !! html/parsoid
22249 <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>
22250 !! end
22251
22252 !! test
22253 Partly disable title conversion if variant == main language code, more
22254 !! options
22255 language=zh variant=zh title=[[ZH]] showtitle
22256 !! wikitext
22257 -{T|TW}-
22258 !! html/php
22259 ZH
22260 <p>
22261 </p>
22262 !! html/parsoid
22263 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22264 !! end
22265
22266 !! test
22267 Raw output of variant escape tags (R flag)
22268 !! options
22269 language=zh variant=zh-tw
22270 !! wikitext
22271 Raw: -{R|zh:China;zh-tw:Taiwan}-
22272 !! html/php
22273 <p>Raw: zh:China;zh-tw:Taiwan
22274 </p>
22275 !! html/parsoid
22276 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22277 !! end
22278
22279 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22280 !! test
22281 Raw output of variant escape tags (R flag) (wt2html only)
22282 !! options
22283 language=zh variant=zh-tw
22284 parsoid=wt2html,html2html
22285 !! wikitext
22286 -{Variant}- -{D|syntax}- -{D;R|options}-
22287 !! html/php
22288 <p>Variant syntax options
22289 </p>
22290 !! html/parsoid
22291 <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>
22292 !! end
22293
22294 !! test
22295 Nested markup inside raw output of variant escape tags (R flag)
22296 !! options
22297 language=zh variant=zh-tw
22298 !! wikitext
22299 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22300 !! html/php
22301 <p>Nested raw: nested Taiwan nested
22302 </p>
22303 !! html/parsoid
22304 <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>
22305 !! end
22306
22307 !! test
22308 Nested markup and spaces inside raw output of variant escape tags (R flag)
22309 !! options
22310 language=zh variant=zh-tw
22311 !! wikitext
22312 X-{ outer -{ inner }- outer }-X
22313 !! html/php
22314 <p>X outer inner outer X
22315 </p>
22316 !! html/parsoid
22317 <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>
22318 !! end
22319
22320 !! test
22321 Templates inside raw output of variant escape tags (R flag)
22322 !! options
22323 language=zh variant=zh-tw
22324 !! wikitext
22325 Nested raw: -{R|nested {{echo|hi}} templates}-
22326 !! html/php
22327 <p>Nested raw: nested hi templates
22328 </p>
22329 !! html/parsoid
22330 <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>
22331 !! end
22332
22333 !! test
22334 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22335 !! options
22336 language=zh variant=zh-cn
22337 !! wikitext
22338 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22339 !! html/php
22340 <p>0
22341 </p>
22342 !! html/parsoid
22343 <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>
22344 !! end
22345
22346 !! test
22347 Conversion rules from [numeric-only string] to [something else] (T48634)
22348 !! options
22349 language=zh variant=zh-cn
22350 !! wikitext
22351 -{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
22352 !! html/php
22353 <p>D12345EE12345
22354 </p>
22355 !! html/parsoid
22356 <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>
22357 !! end
22358
22359 !! test
22360 Two-way converter rule entries with an empty value should be ignored (T53551)
22361 !! options
22362 language=zh variant=zh-cn
22363 !! wikitext
22364 -{H|zh-cn:foo;zh-tw:;}-foobar
22365 !! html/php
22366 <p>foobar
22367 </p>
22368 !! html/parsoid
22369 <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>
22370 !! end
22371
22372 !! test
22373 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22374 !! options
22375 language=zh variant=zh-cn
22376 !! wikitext
22377 -{H|=>zh-cn:foo;}-foobar
22378 !! html/php
22379 <p>foobar
22380 </p>
22381 !! html/parsoid
22382 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22383 !! end
22384
22385 !! test
22386 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22387 !! options
22388 language=zh variant=zh-cn
22389 !! wikitext
22390 -{H|}-foobar
22391 !! html/php
22392 <p>foobar
22393 </p>
22394 !! html/parsoid
22395 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22396 !! end
22397
22398 !! test
22399 Nested using of manual convert syntax
22400 !! options
22401 language=zh variant=zh-hk
22402 !! wikitext
22403 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22404 !! html/php
22405 <p>Nested: Hello Hong Kong!
22406 </p>
22407 !! html/parsoid
22408 <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>
22409 !! end
22410
22411 !! test
22412 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22413 !! options
22414 language=zh variant=zh-cn
22415 !! wikitext
22416 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22417 !! html/php
22418 <p><span title="X">A</span>
22419 </p>
22420 !! html/parsoid
22421 <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>
22422 !! end
22423
22424 !! test
22425 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22426 !! options
22427 language=zh variant=zh-cn
22428 !! wikitext
22429 -{<span title="-{X}-">A</span>}-
22430 !! html/php+disabled
22431 <p><span title="X">A</span>
22432 </p>
22433 !! html/parsoid
22434 <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>
22435 !! end
22436
22437 # Parsoid and PHP disagree on how to parse this example: Parsoid
22438 # insists that the content of a language converter element be a valid
22439 # DOM fragment or attribute string
22440 !! test
22441 Language converter markup with block content
22442 !! options
22443 language=zh variant=zh-cn
22444 !! wikitext
22445 <span>a-{b<div>c}-d
22446
22447 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22448
22449 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22450 !! html/php+tidy
22451 <span>ab<div>cd
22452 <span>ab<div>cd
22453 <span>ad
22454 </span></div></span></div></span>
22455 !! html/parsoid
22456 <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>
22457
22458 <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>
22459
22460 <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>
22461 !! end
22462
22463 !! test
22464 LanguageConverter selser (1)
22465 !! options
22466 language=zh variant=zh-cn
22467 parsoid={
22468 "modes": ["wt2wt", "selser"],
22469 "changes": [
22470 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22471 ]
22472 }
22473 !! wikitext
22474 -{raw}-
22475 !! wikitext/edited
22476 -{edited}-
22477 !! end
22478
22479 !! test
22480 LanguageConverter selser (2)
22481 !! options
22482 language=zh variant=zh-cn
22483 parsoid={
22484 "modes": ["wt2wt", "selser"],
22485 "changes": [
22486 ["span[class='x']", "contents", "text", "-{foo}-"],
22487 ["a", "contents", "text", "-{"],
22488 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22489 ]
22490 }
22491 !! wikitext
22492 <span class="x">TEXT1</span>
22493 [http://example.com TEXT2]
22494 [[Foo|TEXT3]]
22495 {{echo|TEXT4}}
22496 !! wikitext/edited
22497 <span class="x"><nowiki>-{foo}-</nowiki></span>
22498 [http://example.com -{]
22499 [[Foo|<nowiki>-{</nowiki>]]
22500 {{1x|<nowiki>-{</nowiki>}}
22501 !! end
22502
22503 # Tests LanguageVariantText in ConstrainedText
22504 !! test
22505 LanguageConverter selser (3)
22506 !! options
22507 language=zh variant=zh-cn
22508 parsoid={
22509 "modes": ["wt2wt", "selser"],
22510 "changes": [
22511 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22512 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22513 ]
22514 }
22515 !! wikitext
22516 {|
22517 |-
22518 |<span>Foo</span>
22519 |}
22520 !! wikitext/edited
22521 {|
22522 |-
22523 |<nowiki/>-{edited}-
22524 |}
22525 !! end
22526
22527 # Tests LanguageVariantText._fromSelSer
22528 !! test
22529 LanguageConverter selser (4)
22530 !! options
22531 language=zh variant=zh-cn
22532 parsoid={
22533 "modes": ["wt2wt", "selser"],
22534 "changes": [
22535 ["td > span.x", "remove"]
22536 ]
22537 }
22538 !! wikitext
22539 {|
22540 |-
22541 |<span class="x">Foo</span>-{Bar}-
22542 ||<span class="x">Foo</span>-{Bar}-
22543 |}
22544 !! wikitext/edited
22545 {|
22546 |-
22547 |<nowiki/>-{Bar}-
22548 ||-{Bar}-
22549 |}
22550 !! end
22551
22552 # Since Parsoid is starting to emit canonical wikitext for links,
22553 # [http://example.com http://example.com] will not RT back to that
22554 # form anymore.
22555 # Parsoid does not language-convert links (it is done in a
22556 # post-processing step)
22557 !! test
22558 Proper conversion of text in external links
22559 !! options
22560 language=sr variant=sr-ec
22561 parsoid=wt2html
22562 !! wikitext
22563 http://www.google.com
22564 gopher://www.google.com
22565 [http://www.google.com http://www.google.com]
22566 [gopher://www.google.com gopher://www.google.com]
22567 [https://www.google.com irc://www.google.com]
22568 [ftp://www.google.com www.google.com/ftp://dir]
22569 [//www.google.com www.google.com]
22570 !! html/php
22571 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22572 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22573 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22574 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22575 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22576 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22577 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22578 </p>
22579 !! html/parsoid
22580 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22581 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22582 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22583 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22584 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22585 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22586 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22587 !! end
22588
22589 !! test
22590 Do not convert roman numbers to language variants
22591 !! options
22592 language=sr variant=sr-ec
22593 !! wikitext
22594 Fridrih IV je car.
22595 !! html/php
22596 <p>Фридрих IV је цар.
22597 </p>
22598 !! html/parsoid
22599 <p>Fridrih IV je car.</p>
22600 !! end
22601
22602 !! test
22603 Unclosed language converter markup "-{"
22604 !! options
22605 language=sr
22606 !! wikitext
22607 -{T|hello
22608 !! html
22609 <p>-{T|hello
22610 </p>
22611 !! end
22612
22613 !! test
22614 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22615 !! options
22616 language=sr
22617 !! wikitext
22618 -{R|=&gt;}-
22619 !! html/php
22620 <p>=&gt;
22621 </p>
22622 !! html/parsoid
22623 <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>
22624 !!end
22625
22626 !! test
22627 Don't break link parsing if language converter markup is in the caption.
22628 !! options
22629 language=sr variant=sr-ec
22630 !! wikitext
22631 [[Main Page|-{R|main page}-]]
22632 !! html/php
22633 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22634 </p>
22635 !! html/parsoid
22636 <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>
22637 !! end
22638
22639 !! test
22640 T146304: Don't break template parsing if language converter markup is in the parameter.
22641 !! options
22642 language=sr variant=sr-ec
22643 !! wikitext
22644 {{echo|-{R|foo}-}}
22645 !! html/php
22646 <p>foo
22647 </p>
22648 !! html/parsoid
22649 <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>
22650 !! end
22651
22652 !! test
22653 T146305: Don't break image parsing if language converter markup is in the caption.
22654 !! options
22655 language=sr
22656 !! wikitext
22657 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22658 !! html/php
22659 <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>
22660
22661 !! html/parsoid
22662 <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>
22663 !! end
22664
22665 !! test
22666 T146305: Don't break image parsing if nested language converter markup is in the caption.
22667 !! options
22668 language=zh variant=zh-cn
22669 !! wikitext
22670 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22671 !! html/php
22672 <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>
22673
22674 !! html/parsoid
22675 <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>
22676 !! end
22677
22678 # XXX html2wt disabled because rich markup in alt is not preserved.
22679 !! test
22680 Don't break gallery if language converter markup is inside.
22681 !! options
22682 language=zh
22683 !! wikitext
22684 <gallery>
22685 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22686 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22687 </gallery>
22688 !! html/php
22689 <ul class="gallery mw-gallery-traditional">
22690 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22691 <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>
22692 <div class="gallerytext">
22693 <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>
22694 </p>
22695 </div>
22696 </div></li>
22697 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22698 <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>
22699 <div class="gallerytext">
22700 <p>This is a test template
22701 </p>
22702 </div>
22703 </div></li>
22704 </ul>
22705
22706 !! html/parsoid
22707 <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"}}'>
22708 <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>
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="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>
22710 </ul>
22711 !! end
22712
22713 !! test
22714 T153135: Don't break list handling if language converter markup is in the item.
22715 !! options
22716 language=zh variant=zh-cn
22717 !! wikitext
22718 ;-{zh-cn:AAA;zh-tw:BBB}-
22719 ;-{R|foo:bar}-
22720 !! html/php
22721 <dl><dt>AAA</dt>
22722 <dt>foo:bar</dt></dl>
22723
22724 !! html/parsoid
22725 <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>
22726 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22727 </dl>
22728 !! end
22729
22730 // Note that parsoid does not protect colons unless language converter
22731 // markup is properly nested, because it is a backtracking parser.
22732 !! test
22733 T153135: Unclosed markup in definition list (code coverage)
22734 !! options
22735 language=zh variant=zh-cn
22736 !! wikitext
22737 ;<b>foo:bar
22738 ;-{zh-cn:AAA
22739 !! html/php+tidy
22740 <dl><dt><b>foo:bar</b></dt><b>
22741 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22742 </b></p>
22743 !! html/parsoid
22744 <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}'>
22745 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22746 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22747 </b></dl>
22748 !! end
22749
22750 !! test
22751 T153135: Nested language converter markup in definition list (code coverage)
22752 !! options
22753 language=zh variant=zh-cn
22754 !! wikitext
22755 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22756 !! html/php
22757 <dl><dt>AAA foo:bar bat:baz</dt>
22758 <dd>def</dd></dl>
22759
22760 !! html/parsoid
22761 <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>
22762 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22763 </dl>
22764 !! end
22765
22766 # html2wt mode disabled due to <nowiki> insertion.
22767 !! test
22768 T153140: Don't break table handling if language converter markup is in the cell.
22769 !! options
22770 language=sr variant=sr-ec
22771 parsoid=wt2html,wt2wt,html2html
22772 !! wikitext
22773 {|
22774 |-
22775 | -{R|B}-
22776 |}
22777 !! html/php
22778 <table>
22779
22780 <tr>
22781 <td>B
22782 </td></tr></table>
22783
22784 !! html/parsoid
22785 <table>
22786 <tbody>
22787 <tr>
22788 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22789 </tr>
22790 </tbody>
22791 </table>
22792 !! end
22793
22794 !! test
22795 Language converter tricky html2wt cases (1)
22796 !! options
22797 language=sr
22798 parsoid=html2wt,wt2wt
22799 !! html/parsoid
22800 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22801 !! wikitext
22802 -{<nowiki>}-</nowiki>}-
22803 !! html/php
22804 <p>&#125;-
22805 </p>
22806 !! end
22807
22808 !! test
22809 Language converter tricky html2wt cases (2)
22810 !! options
22811 language=sr
22812 parsoid=html2wt,wt2wt
22813 !! html/parsoid
22814 <p>-{foo}-</p>
22815 !! wikitext
22816 <nowiki>-{foo}-</nowiki>
22817 !! html/php
22818 <p>-&#123;foo&#125;-
22819 </p>
22820 !! end
22821
22822 !! test
22823 Language converter tricky html2wt cases (3)
22824 !! options
22825 language=sr
22826 parsoid=html2wt,wt2wt
22827 !! html/parsoid
22828 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22829 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22830 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22831 !! wikitext
22832 -{R||}-
22833
22834 -{R|R|raw}-
22835
22836 -{<nowiki>-{foo}-</nowiki>}-
22837 !! html/php
22838 <p>|
22839 </p><p>R|raw
22840 </p><p>-&#123;foo&#125;-
22841 </p>
22842 !! end
22843
22844 !! test
22845 Language converter tricky html2wt cases (4)
22846 !! options
22847 language=sr
22848 parsoid=html2wt,wt2wt
22849 !! html/parsoid
22850 <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>
22851 !! wikitext
22852 -{R|{{echo|hey}}}-
22853 !! html/php
22854 <p>hey
22855 </p>
22856 !! end
22857
22858 # Note that the <nowiki> escaping added by parsoid for source text,
22859 # destination text, and language names only works on the PHP side
22860 # for *destination text*. (HTML entity escaping wouldn't work
22861 # any better.) This is probably a bug, at least for source texts.
22862 # (For language names PHP uses a precise regexp based on the languages
22863 # it currently knows have variants, which is fragile since this set
22864 # can grow/shrink over time.)
22865 !! test
22866 Language converter tricky html2wt cases (5)
22867 !! options
22868 language=zh variant=zh-cn
22869 !! html/parsoid
22870 <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>
22871 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22872 <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>
22873 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22874 <p>a:b=>c xyz</p>
22875 !! wikitext
22876 -{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
22877
22878 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22879
22880 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22881
22882 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22883
22884 a:b=>c xyz
22885 !! html/php+disabled
22886 <p>foobat;xyz=&gt;zh-cn:abc
22887 </p><p>A
22888 </p><p>0;zh-tw:bar
22889 </p><p>abc
22890 </p><p>a:b=&gt;c 0;zh-tw:bar
22891 </p>
22892 !! end
22893
22894 !! test
22895 T179579: Nowiki and lc interaction
22896 !! options
22897 parsoid=wt2html
22898 language=sr
22899 !! wikitext
22900 -{</nowiki>123}-
22901
22902 -{123<nowiki>|</nowiki>456}-
22903 !! html/parsoid
22904 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22905
22906 <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>
22907 !! end
22908
22909 !! test
22910 T2529: Uncovered bullet
22911 !! wikitext
22912 *Foo {{bullet}}
22913 !! html
22914 <ul><li>Foo</li>
22915 <li>Bar</li></ul>
22916
22917 !! end
22918
22919 !! test
22920 T2529: Uncovered bullet in a deeply nested list
22921 !! wikitext
22922 *******Foo {{bullet}}
22923 !! html
22924 <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>
22925 <li>Bar</li></ul>
22926
22927 !! end
22928
22929 !! test
22930 T2529: Uncovered table already at line-start
22931 !! wikitext
22932 x
22933
22934 {{table}}
22935 y
22936 !! html
22937 <p>x
22938 </p>
22939 <table>
22940 <tr>
22941 <td>1</td>
22942 <td>2
22943 </td></tr>
22944 <tr>
22945 <td>3</td>
22946 <td>4
22947 </td></tr></table>
22948 <p>y
22949 </p>
22950 !! end
22951
22952 !! test
22953 T2529: Uncovered bullet in parser function result
22954 !! wikitext
22955 *Foo {{lc:{{bullet}} }}
22956 !! html
22957 <ul><li>Foo</li>
22958 <li>bar</li></ul>
22959
22960 !! end
22961
22962 !! test
22963 T7678: Double-parsed template argument
22964 !! wikitext
22965 {{lc:{{{1}}}|hello}}
22966 !! html
22967 <p>{{{1}}}
22968 </p>
22969 !! end
22970
22971 !! test
22972 T7678: Double-parsed template invocation
22973 !! wikitext
22974 {{lc:{{paramtest {{!}} param = hello }} }}
22975 !! html
22976 <p>{{paramtest | param = hello }}
22977 </p>
22978 !! end
22979
22980 !! test
22981 Case insensitivity of parser functions for non-ASCII characters (T10143)
22982 !! options
22983 language=cs
22984 title=[[Main Page]]
22985 !! wikitext
22986 {{PRVNÍVELKÉ:ěščř}}
22987 {{prvnívelké:ěščř}}
22988 {{PRVNÍMALÉ:ěščř}}
22989 {{prvnímalé:ěščř}}
22990 {{MALÁ:ěščř}}
22991 {{malá:ěščř}}
22992 {{VELKÁ:ěščř}}
22993 {{velká:ěščř}}
22994 !! html
22995 <p>Ěščř
22996 Ěščř
22997 ěščř
22998 ěščř
22999 ěščř
23000 ěščř
23001 ĚŠČŘ
23002 ĚŠČŘ
23003 </p>
23004 !! end
23005
23006 !! test
23007 Morwen/13: Unclosed link followed by heading
23008 !! wikitext
23009 [[link
23010 ==heading==
23011 !! html
23012 <p>[[link
23013 </p>
23014 <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>
23015
23016 !! end
23017
23018 !! test
23019 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23020 !! wikitext
23021 {{foo|
23022 =heading=
23023 !! html
23024 <p>{{foo|
23025 </p>
23026 <h1><span class="mw-headline" id="heading">heading</span></h1>
23027
23028 !! end
23029
23030 !! test
23031 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23032 !! wikitext
23033 {{foo|
23034 ==heading==
23035 !! html
23036 <p>{{foo|
23037 </p>
23038 <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>
23039
23040 !! end
23041
23042 !! test
23043 Tildes in comments
23044 !! options
23045 pst
23046 !! wikitext
23047 <!-- ~~~~ -->
23048 !! html/php
23049 <!-- ~~~~ -->
23050 !! end
23051
23052 !! test
23053 Paragraphs inside divs (no extra line breaks)
23054 !! wikitext
23055 <div>Line one
23056
23057 Line two</div>
23058 !! html
23059 <div>Line one
23060 Line two</div>
23061
23062 !! end
23063
23064 !! test
23065 Paragraphs inside divs (extra line break on open)
23066 !! wikitext
23067 <div>
23068 Line one
23069
23070 Line two</div>
23071 !! html
23072 <div>
23073 <p>Line one
23074 </p>
23075 Line two</div>
23076
23077 !! end
23078
23079 !! test
23080 Paragraphs inside divs (extra line break on close)
23081 !! wikitext
23082 <div>Line one
23083
23084 Line two
23085 </div>
23086 !! html
23087 <div>Line one
23088 <p>Line two
23089 </p>
23090 </div>
23091
23092 !! end
23093
23094 !! test
23095 Paragraphs inside divs (extra line break on open and close)
23096 !! wikitext
23097 <div>
23098 Line one
23099
23100 Line two
23101 </div>
23102 !! html
23103 <div>
23104 <p>Line one
23105 </p><p>Line two
23106 </p>
23107 </div>
23108
23109 !! end
23110
23111 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23112 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23113 !! test
23114 Nesting tags, paragraphs on lines which begin with <div>
23115 !! wikitext
23116 <div></div><strong>A
23117 B</strong>
23118 !! html/php+tidy
23119 <div></div><p><strong>A
23120 </strong></p><strong></strong><p><strong>B</strong>
23121 </p>
23122 !! html/parsoid
23123 <div></div>
23124 <p><strong>A
23125 B</strong>
23126 </p>
23127 !! end
23128
23129 # T8200: <blockquote> should behave like <div> with respect to line breaks
23130 !! test
23131 T8200: paragraphs inside blockquotes (no extra line breaks)
23132 !! wikitext
23133 <blockquote>Line one
23134
23135 Line two</blockquote>
23136 !! html
23137 <blockquote>Line one
23138 Line two</blockquote>
23139
23140 !! html+tidy
23141 <blockquote><p>Line one
23142 Line two</p></blockquote>
23143 !! end
23144
23145 !! test
23146 T8200: paragraphs inside blockquotes (extra line break on open)
23147 !! wikitext
23148 <blockquote>
23149 Line one
23150
23151 Line two</blockquote>
23152 !! html
23153 <blockquote>
23154 <p>Line one
23155 </p>
23156 Line two</blockquote>
23157
23158 !! html+tidy
23159 <blockquote>
23160 <p>Line one
23161 </p><p>
23162 Line two</p></blockquote>
23163 !! end
23164
23165 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23166 !! test
23167 T8200: paragraphs inside blockquotes (extra line break on close)
23168 !! wikitext
23169 <blockquote>Line one
23170
23171 Line two
23172 </blockquote>
23173 !! html
23174 <blockquote>Line one
23175 <p>Line two
23176 </p>
23177 </blockquote>
23178
23179 !! html+tidy
23180 <blockquote><p>Line one
23181 </p><p>Line two
23182 </p>
23183 </blockquote>
23184 !! end
23185
23186 !! test
23187 T8200: paragraphs inside blockquotes (extra line break on open and close)
23188 !! wikitext
23189 <blockquote>
23190 Line one
23191
23192 Line two
23193 </blockquote>
23194 !! html
23195 <blockquote>
23196 <p>Line one
23197 </p><p>Line two
23198 </p>
23199 </blockquote>
23200
23201 !! end
23202
23203 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23204 !! test
23205 Paragraphs inside blockquotes/divs (no extra line breaks)
23206 !! wikitext
23207 <blockquote><div>Line one
23208
23209 Line two</div></blockquote>
23210 !! html
23211 <blockquote><div>Line one
23212 Line two</div></blockquote>
23213
23214 !! end
23215
23216 !! test
23217 Paragraphs inside blockquotes/divs (extra line break on open)
23218 !! wikitext
23219 <blockquote><div>
23220 Line one
23221
23222 Line two</div></blockquote>
23223 !! html
23224 <blockquote><div>
23225 <p>Line one
23226 </p>
23227 Line two</div></blockquote>
23228
23229 !! end
23230
23231 !! test
23232 Paragraphs inside blockquotes/divs (extra line break on close)
23233 !! wikitext
23234 <blockquote><div>Line one
23235
23236 Line two
23237 </div></blockquote>
23238 !! html
23239 <blockquote><div>Line one
23240 <p>Line two
23241 </p>
23242 </div></blockquote>
23243
23244 !! end
23245
23246 !! test
23247 Paragraphs inside blockquotes/divs (extra line break on open and close)
23248 !! wikitext
23249 <blockquote><div>
23250 Line one
23251
23252 Line two
23253 </div></blockquote>
23254 !! html
23255 <blockquote><div>
23256 <p>Line one
23257 </p><p>Line two
23258 </p>
23259 </div></blockquote>
23260
23261 !! end
23262
23263 !! test
23264 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23265 !! options
23266 wgLinkHolderBatchSize=0
23267 !! wikitext
23268 [[meatball:1]]
23269 [[meatball:2]]
23270 [[meatball:3]]
23271 !! html
23272 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23273 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23274 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23275 </p>
23276 !! end
23277
23278 !! test
23279 Free external link invading image caption
23280 !! wikitext
23281 [[Image:Foobar.jpg|thumb|http://x|hello]]
23282 !! html/php
23283 <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>
23284
23285 !! html/parsoid
23286 <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>
23287 !! end
23288
23289 !! test
23290 T17196: localised external link numbers
23291 !! options
23292 language=fa
23293 !! wikitext
23294 [http://en.wikipedia.org/]
23295 !! html/php
23296 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23297 </p>
23298 !! html/parsoid
23299 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23300 !! end
23301
23302 !! test
23303 Multibyte character in padleft
23304 !! wikitext
23305 {{padleft:-Hello|7|Æ}}
23306 !! html/php
23307 <p>Æ-Hello
23308 </p>
23309 !! html/parsoid
23310 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23311 !! end
23312
23313 !! test
23314 Multibyte character in padright
23315 !! wikitext
23316 {{padright:Hello-|7|Æ}}
23317 !! html/php
23318 <p>Hello-Æ
23319 </p>
23320 !! html/parsoid
23321 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23322 !! end
23323
23324 !!test
23325 formatdate parser function
23326 !! wikitext
23327 {{#formatdate:2009-03-24}}
23328 !! html
23329 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23330 </p>
23331 !! end
23332
23333 !!test
23334 formatdate parser function, with default format
23335 !! wikitext
23336 {{#formatdate:2009-03-24|mdy}}
23337 !! html
23338 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23339 </p>
23340 !! end
23341
23342 !! test
23343 Spacing of numbers in formatted dates
23344 !! wikitext
23345 {{#formatdate:January 15}}
23346 !! html
23347 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23348 </p>
23349 !! end
23350
23351 !! test
23352 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
23353 !! options
23354 language=nl title=[[MediaWiki:Common.css]]
23355 !! wikitext
23356 {{#formatdate:2009-03-24|dmy}}
23357 !! html
23358 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23359 </p>
23360 !! end
23361
23362 #
23363 #
23364 #
23365
23366 #
23367 # Edit comments
23368 #
23369
23370 !! test
23371 Edit comment with link
23372 !! options
23373 comment
23374 !! wikitext
23375 I like the [[Main Page]] a lot
23376 !! html/php
23377 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23378 !!end
23379
23380 !! test
23381 Edit comment with link and link text
23382 !! options
23383 comment
23384 !! wikitext
23385 I like the [[Main Page|best pages]] a lot
23386 !! html/php
23387 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23388 !!end
23389
23390 !! test
23391 Edit comment with link and link text with suffix
23392 !! options
23393 comment
23394 !! wikitext
23395 I like the [[Main Page|best page]]s a lot
23396 !! html/php
23397 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23398 !!end
23399
23400 !! test
23401 Edit comment with section link (non-local, eg in history list)
23402 !! options
23403 comment title=[[Main Page]]
23404 !! wikitext
23405 /* External links */ removed bogus entries
23406 !! html/php
23407 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23408 !!end
23409
23410 !! test
23411 Edit comment with section link and text before it (non-local, eg in history list)
23412 !! options
23413 comment title=[[Main Page]]
23414 !! wikitext
23415 pre-comment text /* External links */ removed bogus entries
23416 !! html/php
23417 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>
23418 !!end
23419
23420 !! test
23421 Edit comment with section link (local, eg in diff view)
23422 !! options
23423 comment local title=[[Main Page]]
23424 !! wikitext
23425 /* External links */ removed bogus entries
23426 !! html/php
23427 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23428 !!end
23429
23430 !! test
23431 Edit comment with subpage link (T16080)
23432 !! options
23433 comment
23434 subpage
23435 title=[[Subpage test]]
23436 !! wikitext
23437 Poked at a [[/subpage]] here...
23438 !! html/php
23439 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23440 !!end
23441
23442 !! test
23443 Edit comment with subpage link and link text (T16080)
23444 !! options
23445 comment
23446 subpage
23447 title=[[Subpage test]]
23448 !! wikitext
23449 Poked at a [[/subpage|neat little page]] here...
23450 !! html/php
23451 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23452 !!end
23453
23454 !! test
23455 Edit comment with bogus subpage link in non-subpage NS (T16080)
23456 !! options
23457 comment
23458 title=[[Subpage test]]
23459 !! wikitext
23460 Poked at a [[/subpage]] here...
23461 !! html/php
23462 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...
23463 !!end
23464
23465 !! test
23466 Edit comment with bare anchor link (local, as on diff)
23467 !! options
23468 comment
23469 local
23470 title=[[Main Page]]
23471 !! wikitext
23472 [[#section]]
23473 !! html/php
23474 <a href="#section">#section</a>
23475 !! end
23476
23477 !! test
23478 Edit comment with bare anchor link (non-local, as on history)
23479 !! options
23480 comment
23481 title=[[Main Page]]
23482 !! wikitext
23483 [[#section]]
23484 !! html/php
23485 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23486 !! end
23487
23488 !! test
23489 Anchor starting with underscore
23490 !! options
23491 title=[[Foo]]
23492 !! wikitext
23493 [[#_ref|One]]
23494 !! html/php
23495 <p><a href="#_ref">One</a>
23496 </p>
23497 !! html/parsoid
23498 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23499 !! end
23500
23501 !! test
23502 Id starting with underscore
23503 !! wikitext
23504 <div id="_ref"></div>
23505 !! html/*
23506 <div id="_ref"></div>
23507
23508 !! end
23509
23510 !! test
23511 Edit comment with link with more than one pipe (T99346)
23512 !! options
23513 comment
23514 !! wikitext
23515 [[Main Page|Many|pipes]]
23516 !! html/php
23517 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23518 !! end
23519
23520 !! test
23521 Complex edit comment with link with more than one pipe (T99346)
23522 !! options
23523 comment
23524 !! wikitext
23525 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23526 !! html/php
23527 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;
23528 !! end
23529
23530 !! test
23531 Space normalisation on autocomment (T24784)
23532 !! options
23533 comment
23534 title=[[Main Page]]
23535 !! wikitext
23536 /* __hello__world__ */
23537 !! html/php
23538 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23539 !! end
23540
23541 !! test
23542 percent-encoding and + signs in comments (T28410)
23543 !! options
23544 comment
23545 !! wikitext
23546 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23547 !! html/php
23548 <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>
23549 !! end
23550
23551 # Parsoid doesn't support this yet: see T75581
23552 # but it *should* omit the 'src' attribute if the image is bad.
23553 # PHP side of tests was disabled in
23554 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23555 # because of issues in the PHP parserTests infrastructure
23556 # (but the output below is indeed what the PHP side emits)
23557 !! test
23558 Bad images - basic functionality
23559 !! wikitext
23560 [[File:Bad.jpg]]
23561 !! html/php+disabled
23562 !! html/parsoid
23563 <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>
23564 !! end
23565
23566 !! test
23567 Bad images - T18039: text after bad image disappears
23568 !! wikitext
23569 Foo bar
23570 [[File:Bad.jpg]]
23571 Bar foo
23572 !! html/php+disabled
23573 <p>Foo bar
23574 </p><p>Bar foo
23575 </p>
23576 !! html/parsoid
23577 <p>Foo bar
23578 <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>
23579 Bar foo</p>
23580 !! end
23581
23582 !! test
23583 Verify that displaytitle works (T24501) no displaytitle
23584 !! options
23585 showtitle
23586 !! config
23587 wgAllowDisplayTitle=true
23588 wgRestrictDisplayTitle=false
23589 !! wikitext
23590 this is not the the title
23591 !! html/php
23592 Parser test
23593 <p>this is not the the title
23594 </p>
23595 !! end
23596
23597 !! test
23598 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23599 !! options
23600 showtitle
23601 title=[[Screen]]
23602 !! config
23603 wgAllowDisplayTitle=true
23604 wgRestrictDisplayTitle=false
23605 !! wikitext
23606 this is not the the title
23607 {{DISPLAYTITLE:whatever}}
23608 !! html/php
23609 whatever
23610 <p>this is not the the title
23611 </p>
23612 !! end
23613
23614 !! test
23615 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23616 !! options
23617 showtitle
23618 title=[[Screen]]
23619 !! config
23620 wgAllowDisplayTitle=true
23621 wgRestrictDisplayTitle=true
23622 !! wikitext
23623 this is not the the title
23624 {{DISPLAYTITLE:whatever}}
23625 !! html/php
23626 Screen
23627 <p>this is not the the title
23628 </p>
23629 !! end
23630
23631 !! test
23632 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23633 !! options
23634 showtitle
23635 title=[[Screen]]
23636 !! config
23637 wgAllowDisplayTitle=true
23638 wgRestrictDisplayTitle=true
23639 !! wikitext
23640 this is not the the title
23641 {{DISPLAYTITLE:screen}}
23642 !! html/php
23643 screen
23644 <p>this is not the the title
23645 </p>
23646 !! end
23647
23648 !! test
23649 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23650 !! options
23651 showtitle
23652 title=[[Screen]]
23653 !! config
23654 wgAllowDisplayTitle=false
23655 !! wikitext
23656 this is not the the title
23657 {{DISPLAYTITLE:screen}}
23658 !! html/php
23659 Screen
23660 <p>this is not the the title
23661 <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>
23662 </p>
23663 !! end
23664
23665 !! test
23666 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23667 !! options
23668 showtitle
23669 title=[[Screen]]
23670 !! config
23671 wgAllowDisplayTitle=false
23672 !! wikitext
23673 this is not the the title
23674 !! html/php
23675 Screen
23676 <p>this is not the the title
23677 </p>
23678 !! end
23679
23680 !! test
23681 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23682 !! options
23683 showtitle
23684 title=[[Screen]]
23685 !! config
23686 wgAllowDisplayTitle=true
23687 wgRestrictDisplayTitle=true
23688 !! wikitext
23689 this is not the the title
23690 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23691 !! html/php
23692 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23693 <p>this is not the the title
23694 </p>
23695 !! end
23696
23697 !! test
23698 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23699 !! options
23700 showtitle
23701 title=[[Screen]]
23702 !! config
23703 wgAllowDisplayTitle=true
23704 wgRestrictDisplayTitle=true
23705 !! wikitext
23706 this is not the the title
23707 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23708 !! html/php
23709 <span style="color: red;">s</span>creen
23710 <p>this is not the the title
23711 </p>
23712 !! end
23713
23714 !! test
23715 Page status indicators: Empty name is invalid
23716 !! options
23717 showindicators
23718 !! wikitext
23719 <indicator name=" "></indicator>
23720 <indicator></indicator>
23721 !! html/php
23722 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23723 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23724 </p>
23725 !! end
23726
23727 !! test
23728 Page status indicators: Weird syntaxes that are okay
23729 !! options
23730 showindicators
23731 !! wikitext
23732 <indicator name="empty" />
23733 <indicator name="name"></indicator>
23734 !! html/php
23735 empty=
23736 name=
23737 <p><br />
23738 </p>
23739 !! end
23740
23741 !! test
23742 Page status indicators: Torture test
23743 !! options
23744 showindicators
23745 !! wikitext
23746 <indicator name="01">hello world</indicator>
23747 <indicator name="02">[[Main Page]]</indicator>
23748 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23749 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23750 <indicator name="05">*foo
23751 *bar</indicator>
23752 <indicator name="06"><nowiki>foo</nowiki></indicator>
23753 <indicator name="07"> Preformatted</indicator>
23754 <indicator name="08"><div>Broken tag</indicator>
23755 <indicator name="09">{| class=wikitable
23756 |cell
23757 |}</indicator>
23758 <indicator name="10">Two
23759
23760 paragraphs</indicator>
23761 !! html/php
23762 01=hello world
23763 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23764 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" />
23765 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>
23766 05=<ul><li>foo</li>
23767 <li>bar</li></ul>
23768
23769 06=foo
23770 07=<pre>Preformatted
23771 </pre>
23772 08=<div>Broken tag</div>
23773
23774 09=<table class="wikitable">
23775 <tr>
23776 <td>cell
23777 </td></tr></table>
23778
23779 10=<p>Two
23780 </p><p>paragraphs
23781 </p>
23782 <p><br />
23783 </p><p><br />
23784 </p><p><br />
23785 </p><p><br />
23786 </p><p><br />
23787 </p>
23788 !! end
23789
23790 !! test
23791 preload: check <noinclude> and <includeonly>
23792 !! options
23793 preload
23794 !! wikitext
23795 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23796 !! html/php
23797 Hello kind world.
23798 !! end
23799
23800 !! test
23801 preload: check <onlyinclude>
23802 !! options
23803 preload
23804 !! wikitext
23805 Goodbye <onlyinclude>Hello world</onlyinclude>
23806 !! html/php
23807 Hello world
23808 !! end
23809
23810 !! test
23811 preload: can pass tags through if we want to
23812 !! options
23813 preload
23814 !! wikitext
23815 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23816 !! html/php
23817 <includeonly>Hello world</includeonly>
23818 !! end
23819
23820 !! test
23821 preload: check that it doesn't try to do tricks
23822 !! options
23823 preload
23824 !! wikitext
23825 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23826 !! html/php
23827 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23828 !! end
23829
23830 !! test
23831 Play a bit with r67090 and T5158
23832 !! wikitext
23833 <div style="width:50% !important">&nbsp;</div>
23834 <div style="width:50%&nbsp;!important">&nbsp;</div>
23835 <div style="width:50%&#160;!important">&nbsp;</div>
23836 <div style="border : solid;">&nbsp;</div>
23837 !! html/php
23838 <div style="width:50% !important">&#160;</div>
23839 <div style="width:50% !important">&#160;</div>
23840 <div style="width:50% !important">&#160;</div>
23841 <div style="border&#160;: solid;">&#160;</div>
23842
23843 !! html/parsoid
23844 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23845 <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>
23846 <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>
23847 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23848
23849 !! end
23850
23851 !! test
23852 HTML5 data attributes
23853 !! wikitext
23854 <span data-foo="bar">Baz</span>
23855 <p data-abc-def_hij="">Quuz</p>
23856 !! html/php
23857 <p><span data-foo="bar">Baz</span>
23858 </p>
23859 <p data-abc-def_hij="">Quuz</p>
23860
23861 !! html/parsoid
23862 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23863 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23864 !! end
23865
23866 !! test
23867 Strip reserved data attributes
23868 !! wikitext
23869 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23870 !! html/php
23871 <div data-ok="fred">d</div>
23872
23873 !! html/parsoid
23874 <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>
23875 !! end
23876
23877 !! test
23878 percent-encoding and + signs in internal links (T28410)
23879 !! wikitext
23880 [[User:+%]] [[Page+title%]]
23881 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23882 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23883 [[%33%45]] [[%33%45+]]
23884 !! html/php
23885 <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>
23886 <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>
23887 <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>
23888 <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>
23889 </p>
23890 !! html/parsoid
23891 <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>
23892 <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>
23893 <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>
23894 <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>
23895 !! end
23896
23897 !! test
23898 Special characters in embedded file links (T29679)
23899 !! wikitext
23900 [[File:Contains & ampersand.jpg]]
23901 [[File:Does not exist.jpg|Title with & ampersand]]
23902 !! html/php
23903 <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>
23904 <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>
23905 </p>
23906 !! html/parsoid
23907 <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>
23908 <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>
23909 !! end
23910
23911 !! test
23912 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23913 !! wikitext
23914 Text&apos;s been normalized?
23915 !! html
23916 <p>Text&#39;s been normalized?
23917 </p>
23918 !! end
23919
23920 !! test
23921 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23922 !! wikitext
23923 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23924 !! html
23925 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23926 </p>
23927 !! end
23928
23929 !! test
23930 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23931 !! wikitext
23932 [http://www.example.org/ ideograms]
23933 !! html
23934 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23935 </p>
23936 !! end
23937
23938 !! test
23939 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23940 !! wikitext
23941 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23942 !! html
23943 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23944 </p>
23945 !! end
23946
23947 !! article
23948 Mediawiki:loop1
23949 !! text
23950 {{Identical|A}}
23951 !! endarticle
23952
23953 !! article
23954 Mediawiki:loop2
23955 !! text
23956 {{Identical|B}}
23957 !! endarticle
23958
23959 !! article
23960 Template:Identical
23961 !! text
23962 {{int:loop1}}
23963 {{int:loop2}}
23964 !! endarticle
23965
23966 !! test
23967 T33098 Template which includes system messages which includes the template
23968 !! wikitext
23969 {{Identical}}
23970 !! html
23971 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23972 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23973 </p>
23974 !! end
23975
23976 !! test
23977 T33490 Turkish: ucfirst 'blah'
23978 !! options
23979 language=tr
23980 !! wikitext
23981 {{ucfirst:blah}}
23982 !! html
23983 <p>Blah
23984 </p>
23985 !! end
23986
23987 !! test
23988 T33490 Turkish: ucfirst 'ix'
23989 !! options
23990 language=tr
23991 !! wikitext
23992 {{ucfirst:ix}}
23993 !! html
23994 <p>İx
23995 </p>
23996 !! end
23997
23998 !! test
23999 T33490 Turkish: lcfirst 'BLAH'
24000 !! options
24001 language=tr
24002 !! wikitext
24003 {{lcfirst:BLAH}}
24004 !! html
24005 <p>bLAH
24006 </p>
24007 !! end
24008
24009 !! test
24010 T33490 Turkish: ucfırst (with a dotless i)
24011 !! options
24012 language=tr
24013 !! wikitext
24014 {{ucfırst:blah}}
24015 !! html
24016 <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>
24017 </p>
24018 !! end
24019
24020 !! test
24021 T33490 ucfırst (with a dotless i) with English language
24022 !! options
24023 language=en
24024 !! wikitext
24025 {{ucfırst:blah}}
24026 !! html
24027 <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>
24028 </p>
24029 !! end
24030
24031 # Note that Parsoid doesn't emit an explicit TOC.
24032 # Note also that the html2wt direction tends to emit an extra newline
24033 # between the __TOC__ magicword and the first heading unless *both*
24034 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24035 # it's "{}").
24036
24037 !! test
24038 T28375: TOC with italics
24039 !! options
24040 title=[[Main Page]]
24041 !! wikitext
24042 __TOC__
24043 ==''Lost'' episodes==
24044 !! html/php
24045 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24046 <ul>
24047 <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>
24048 </ul>
24049 </div>
24050
24051 <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>
24052
24053 !! html/parsoid
24054 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24055 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24056 !! end
24057
24058 !! test
24059 T28375: TOC with bold
24060 !! options
24061 title=[[Main Page]]
24062 !! wikitext
24063 __TOC__
24064 =='''should be bold''' then normal text==
24065 !! html/php
24066 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24067 <ul>
24068 <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>
24069 </ul>
24070 </div>
24071
24072 <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>
24073
24074 !! html/parsoid
24075 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24076 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24077 !! end
24078
24079 !! test
24080 T35845: Headings become cursive in TOC when they contain an image
24081 !! options
24082 title=[[Main Page]]
24083 !! wikitext
24084 __TOC__
24085 ==Image [[Image:foobar.jpg]]==
24086 !! html/php
24087 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24088 <ul>
24089 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24090 </ul>
24091 </div>
24092
24093 <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>
24094
24095 !! html/parsoid
24096 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24097 <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>
24098 !! end
24099
24100 !! test
24101 T35845 (2): Headings become bold in TOC when they contain a blockquote
24102 !! options
24103 title=[[Main Page]]
24104 !! wikitext
24105 __TOC__
24106 ==<blockquote>Quote</blockquote>==
24107 !! html/php
24108 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24109 <ul>
24110 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24111 </ul>
24112 </div>
24113
24114 <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>
24115
24116 !! html/php+tidy
24117 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24118 <ul>
24119 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24120 </ul>
24121 </div>
24122
24123 <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>
24124 !! html/parsoid
24125 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24126 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24127 !! end
24128
24129 !! test
24130 Unclosed tags in TOC
24131 !! config
24132 wgFragmentMode=[ 'html5', 'legacy' ]
24133 !! options
24134 title=[[Main Page]]
24135 !! wikitext
24136 __TOC__
24137 ==Proof: 2 < 3==
24138 <small>Hanc marginis exiguitas non caperet.</small>
24139 QED
24140 !! html/php
24141 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24142 <ul>
24143 <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>
24144 </ul>
24145 </div>
24146
24147 <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>
24148 <p><small>Hanc marginis exiguitas non caperet.</small>
24149 QED
24150 </p>
24151 !! html/parsoid
24152 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24153 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24154 <p><small>Hanc marginis exiguitas non caperet.</small>
24155 QED</p>
24156 !! end
24157
24158 !! test
24159 Multiple tags in TOC
24160 !! wikitext
24161 __TOC__
24162 ==<i>Foo</i> <b>Bar</b>==
24163
24164 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24165 !! html/php
24166 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24167 <ul>
24168 <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>
24169 <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>
24170 </ul>
24171 </div>
24172
24173 <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>
24174 <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>
24175
24176 !! html/php+tidy
24177 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24178 <ul>
24179 <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>
24180 <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>
24181 </ul>
24182 </div>
24183
24184 <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>
24185 <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>
24186 !! html/parsoid
24187 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24188 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24189
24190 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24191 !! end
24192
24193 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24194 # html5 tag parsing.
24195 !! test
24196 Tags with parameters in TOC
24197 !! options
24198 parsoid=wt2html
24199 !! wikitext
24200 __TOC__
24201 ==<sup class="in-h2">Hello</sup>==
24202
24203 ==<sup class="a > b">Evilbye</sup>==
24204 !! html/php
24205 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24206 <ul>
24207 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24208 <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>
24209 </ul>
24210 </div>
24211
24212 <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>
24213 <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>
24214
24215 !! html/parsoid
24216 <meta property="mw:PageProp/toc" />
24217 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24218
24219 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24220 !! end
24221
24222 !! test
24223 span tags with directionality in TOC
24224 !! wikitext
24225 __TOC__
24226 ==<span dir="ltr">C++</span>==
24227
24228 ==<span dir="rtl">זבנג!</span>==
24229
24230 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24231
24232 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24233
24234 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24235 !! html/php
24236 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24237 <ul>
24238 <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>
24239 <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>
24240 <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>
24241 <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>
24242 <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>
24243 </ul>
24244 </div>
24245
24246 <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>
24247 <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>
24248 <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>
24249 <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>
24250 <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>
24251
24252 !! html/parsoid
24253 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24254 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24255 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24256 <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>
24257 <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>
24258 <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>
24259 !! end
24260
24261 !! test
24262 T74884: bdi element in ToC
24263 !! wikitext
24264 __TOC__
24265 ==<bdi>test</bdi>==
24266 !! html/php
24267 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24268 <ul>
24269 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24270 </ul>
24271 </div>
24272
24273 <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>
24274
24275 !! html/parsoid
24276 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24277 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24278 !! end
24279
24280 !! test
24281 T35715: s/strike element in ToC
24282 !! wikitext
24283 __TOC__
24284 ==<s>test</s> test <strike>test</strike>==
24285 !! html/php
24286 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24287 <ul>
24288 <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>
24289 </ul>
24290 </div>
24291
24292 <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>
24293
24294 !! html/parsoid
24295 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24296 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24297 !! end
24298
24299 !! test
24300 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24301 !! wikitext
24302 __TOC__
24303 ==x==
24304 !! html/php
24305 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24306 <ul>
24307 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24308 </ul>
24309 </div>
24310
24311 <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>
24312
24313 !! html/parsoid
24314 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24315 <h2 id="x" data-parsoid='{}'>x</h2>
24316 !! end
24317
24318 !! article
24319 MediaWiki:T34057
24320 !! text
24321 == {{int:headline_sample}} ==
24322 !! endarticle
24323
24324 !! test
24325 T34057: Title needed when expanding <h> nodes.
24326 !! options
24327 title=[[Main Page]]
24328 !! wikitext
24329 {{int:T34057}}
24330 !! html
24331 <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>
24332
24333 !! end
24334
24335 !! test
24336 Strip marker in urlencode
24337 !! wikitext
24338 {{urlencode:x<nowiki/>y}}
24339 {{urlencode:x<nowiki/>y|wiki}}
24340 {{urlencode:x<nowiki/>y|path}}
24341 {{urlencode:x<pre id="one">two</pre>y}}
24342 !! html/php
24343 <p>xy
24344 xy
24345 xy
24346 xy
24347 </p>
24348 !! end
24349
24350 !! test
24351 Strip marker in lc
24352 !! wikitext
24353 {{lc:x<nowiki/>y}}
24354 !! html
24355 <p>xy
24356 </p>
24357 !! end
24358
24359 !! test
24360 Strip marker in uc
24361 !! wikitext
24362 {{uc:x<nowiki/>y}}
24363 !! html
24364 <p>XY
24365 </p>
24366 !! end
24367
24368 !! test
24369 Strip marker in formatNum
24370 !! wikitext
24371 {{formatnum:1<nowiki/>2}}
24372 {{formatnum:1<nowiki/>2|R}}
24373 !! html
24374 <p>12
24375 12
24376 </p>
24377 !! end
24378
24379 !! test
24380 Check noCommafy in formatNum
24381 !! options
24382 language=be-tarask
24383 !! wikitext
24384 {{formatnum:123456.78}}
24385 {{formatnum:123456.78|NOSEP}}
24386 !! html
24387 <p>123 456,78
24388 123456.78
24389 </p>
24390 !! end
24391
24392 !! test
24393 Wrong option for formatNum (T58199)
24394 !! wikitext
24395 {{formatnum:1,234.56|Random}}
24396 {{formatnum:1,234.56|EVERYTHING}}
24397 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24398 !! html
24399 <p>1,234.56
24400 1,234.56
24401 1,234.56
24402 </p>
24403 !! end
24404
24405 !! test
24406 Strip marker in grammar
24407 !! options
24408 language=fi
24409 !! wikitext
24410 {{grammar:elative|foo<nowiki/>bar}}
24411 !! html
24412 <p>foobarista
24413 </p>
24414 !! end
24415
24416 !! test
24417 Strip marker in padleft
24418 !! wikitext
24419 {{padleft:|2|x<nowiki/>y}}
24420 !! html
24421 <p>xy
24422 </p>
24423 !! end
24424
24425 !! test
24426 Strip marker in padright
24427 !! wikitext
24428 {{padright:|2|x<nowiki/>y}}
24429 !! html
24430 <p>xy
24431 </p>
24432 !! end
24433
24434 !! test
24435 Strip marker in anchorencode
24436 !! wikitext
24437 {{anchorencode:x<nowiki/>y}}
24438 !! html/php
24439 <p>xy
24440 </p>
24441 !! html/parsoid
24442 <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>
24443 !! end
24444
24445 !! test
24446 nowiki inside link inside heading (T20295)
24447 !! wikitext
24448 ==[[foo|x<nowiki>y</nowiki>z]]==
24449 !! html
24450 <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>
24451
24452 !! end
24453
24454 !! test
24455 new support for bdi element (T33817)
24456 !! wikitext
24457 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24458 !! html
24459 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24460
24461 !!end
24462
24463 !! test
24464 Ignore pipe between table row attributes
24465 !! wikitext
24466 {|
24467 |quux
24468 |- id=foo | style='color: red'
24469 |bar
24470 |}
24471 !! html
24472 <table>
24473 <tr>
24474 <td>quux
24475 </td></tr>
24476 <tr id="foo" style="color: red">
24477 <td>bar
24478 </td></tr></table>
24479
24480 !! end
24481
24482 !!test
24483 Language parser function
24484 !! wikitext
24485 {{#language:ar}}
24486 !! html
24487 <p>العربية
24488 </p>
24489 !! end
24490
24491 !!test
24492 Padleft and padright (default 0-padding)
24493 !! wikitext
24494 {{padleft:xyz|5}}
24495 {{padright:xyz|5}}
24496 !! html/php
24497 <p>00xyz
24498 xyz00
24499 </p>
24500 !! html/parsoid
24501 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24502 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24503 !! end
24504
24505 !!test
24506 Padleft and padright (partial fill)
24507 !! wikitext
24508 {{padleft:xyz|6|ab}}
24509 {{padright:xyz|6|ab}}
24510 !! html/php
24511 <p>abaxyz
24512 xyzaba
24513 </p>
24514 !! html/parsoid
24515 <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>
24516 <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>
24517 !! end
24518
24519 !!test
24520 Padleft and padright as substr
24521 !! wikitext
24522 {{padleft:|3|abcde}}
24523 {{padright:|3|abcde}}
24524 !! html/php
24525 <p>abc
24526 abc
24527 </p>
24528 !! html/parsoid
24529 <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>
24530 <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>
24531 !! end
24532
24533 !!test
24534 Special parser function
24535 !! wikitext
24536 {{#special:RandomPage}}
24537 {{#special:BaDtItLe}}
24538 {{#special:Foobar}}
24539 !! html
24540 <p>Special:Random
24541 Special:Badtitle
24542 Special:Foobar
24543 </p>
24544 !! end
24545
24546 !!test
24547 T36939 - Case insensitive link parsing ([HttP://])
24548 !! wikitext
24549 [HttP://MediaWiki.Org/]
24550 !! html/php
24551 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24552 </p>
24553 !! html/parsoid
24554 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24555 !! end
24556
24557 !!test
24558 T36939 - Case insensitive link parsing ([HttP:// title])
24559 !! wikitext
24560 [HttP://MediaWiki.Org/ MediaWiki]
24561 !! html
24562 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24563 </p>
24564 !! end
24565
24566 !!test
24567 T36939 - Case insensitive link parsing (HttP://)
24568 !! wikitext
24569 HttP://MediaWiki.Org/
24570 !! html/php
24571 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24572 </p>
24573 !! html/parsoid
24574 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24575 !! end
24576
24577 !!test
24578 Disable TOC
24579 !! options
24580 notoc
24581 !! wikitext
24582 Lead
24583 ==Section 1==
24584 ==Section 2==
24585 ==Section 3==
24586 ==Section 4==
24587 ==Section 5==
24588 !! html
24589 <p>Lead
24590 </p>
24591
24592 <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>
24593 <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>
24594 <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>
24595 <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>
24596 <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>
24597
24598 !! end
24599
24600
24601 ###
24602 ### Parsoid-specific tests
24603 ### Parsoid-PHP parser incompatibilities
24604 ###
24605 !!test
24606 1. SOL-sensitive wikitext tokens as template-args
24607 !!options
24608 parsoid=wt2html,wt2wt
24609 !! wikitext
24610 {{echo|*a}}
24611 {{echo|#a}}
24612 {{echo|:a}}
24613 !! html
24614 <span about="#mwt1" typeof="mw:Transclusion">
24615 </span><ul about="#mwt1"><li>a</li>
24616 </ul>
24617 <span about="#mwt2" typeof="mw:Transclusion">
24618 </span><ol about="#mwt2"><li>a</li>
24619 </ol>
24620 <span about="#mwt3" typeof="mw:Transclusion">
24621 </span><dl about="#mwt3"><dd>a</dd>
24622 </dl>
24623 !!end
24624
24625 #### -----------------------------------------------------------------
24626 #### Parsoid-specific functionality tests
24627 #### -----------------------------------------------------------------
24628
24629 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24630 # We know wt2wt will fail, but we expect selser to pass.
24631 # Due to the nature of our testing, wt2wt and selser tests will enter the
24632 # blacklist and we'll catch selser regressions based on changes to the
24633 # blacklist entries for selser tests.
24634 !! test
24635 1. Bad treebuilder fixup of formatting elt is cleaned up
24636 !! options
24637 parsoid=wt2html,wt2wt
24638 !! wikitext
24639 {|
24640 |
24641 <small>
24642 [[Image:Foobar.jpg|right|Test]]
24643 </small>
24644 |}
24645 !! html/parsoid
24646 <table>
24647 <tbody><tr><td>
24648 <small>
24649 <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>
24650 </small>
24651 </td></tr>
24652 </tbody></table>
24653 !! end
24654
24655 !! test
24656 2. Bad treebuilder fixup of formatting elt is cleaned up
24657 !! options
24658 parsoid=wt2html,wt2wt
24659 !! wikitext
24660 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24661
24662 <small>[[Image:Foobar.jpg|right|300px]]</small>
24663 !! html/parsoid
24664
24665 <p><b>foo</b></p>
24666 <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>
24667 <p><b>bar</b></p>
24668 <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>
24669 !! end
24670
24671 !! test
24672 3. Bad treebuilder fixup of formatting elt is cleaned up
24673 !! options
24674 parsoid=wt2html,wt2wt
24675 !! wikitext
24676 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24677 !! html/parsoid
24678 <p><small><b>foo</b></small></p>
24679 <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>
24680 <p><small><b>bar</b></small></p>
24681 !! end
24682
24683 !! test
24684 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24685 !! options
24686 parsoid=wt2html,wt2wt
24687 !! wikitext
24688 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24689 !! html/parsoid
24690 <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>
24691 !! end
24692
24693 #### ----------------------------------------------------------------
24694 #### Parsoid-only testing of Parsoid's impl of LST
24695 #### Not implemented yet, see
24696 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24697 #### ----------------------------------------------------------------
24698
24699 ## We still need to support serializing the older format while content is stored.
24700 !! test
24701 LST Sections: Backwards compatibility
24702 !! options
24703 parsoid={
24704 "suppressErrors": true,
24705 "modes": ["html2wt"]
24706 }
24707 !! wikitext
24708 <section begin="2011-05-16" />
24709 <section end="2014-04-10 (MW 1.23wmf22)" />
24710 !! html/parsoid
24711 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24712 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24713 !! end
24714
24715 !! test
24716 LST Sections: Newfangled approach
24717 !! wikitext
24718 <section begin="2011-05-16" />
24719 <section end="2014-04-10 (MW 1.23wmf22)" />
24720 !! html/parsoid
24721 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24722 </span>
24723 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24724 </span></p>
24725 !! end
24726
24727 #--------- Test stripping of empty nodes in template content ----------
24728
24729 !! test
24730 Empty LI and TR nodes should be stripped from template content
24731 !! wikitext
24732 {{EmptyLITest}}
24733 {{EmptyTRTest}}
24734 !! html/parsoid
24735 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24736 <li>a</li>
24737 <li>b</li>
24738 </ul>
24739 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24740 <tbody>
24741 <tr>
24742 <td>foo</td>
24743 </tr>
24744 <tr>
24745 <td>bar</td>
24746 </tr>
24747 </tbody>
24748 </table>
24749 !! end
24750
24751 !! test
24752 Empty LI and TR nodes should not be stripped from top-level content
24753 !! wikitext
24754 * a
24755 *
24756 * b
24757 {|
24758 |-
24759 |-
24760 |foo
24761 |}
24762 !! html/parsoid
24763 <ul>
24764 <li> a</li>
24765 <li class='mw-empty-elt'></li>
24766 <li> b</li>
24767 </ul>
24768 <table>
24769 <tbody>
24770 <tr class='mw-empty-elt'></tr>
24771 <tr>
24772 <td>foo</td>
24773 </tr>
24774 </tbody>
24775 </table>
24776 !! end
24777
24778 !! test
24779 Empty TR nodes should not be stripped if they have any attributes set
24780 !! wikitext
24781 {{EmptyTRWithHTMLAttrTest}}
24782 !! html/parsoid
24783 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24784 <tr align='center'></tr>
24785 <tr><td>foo</td></tr>
24786 <tr align='center'></tr>
24787 <tr><td>bar</td></tr>
24788 </table>
24789 !! end
24790
24791 #### ----------------------------------------------------------------
24792 #### The following section of tests are primarily to test
24793 #### wikitext escaping capabilities of Parsoid. Given that
24794 #### escaping can be done any number of ways, the wikitext (input)
24795 #### is always adjusted to reflect how Parsoid adds nowiki
24796 #### escape tags.
24797 ####
24798 #### We are marking several tests as parsoid-only since the
24799 #### HTML in the result section is different from what the
24800 #### PHP parser generates for it.
24801 #### ----------------------------------------------------------------
24802
24803
24804 #### --------------- Headings ---------------
24805 #### 0. Unnested
24806 #### 1. Nested inside html <h1>=foo=</h1>
24807 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24808 #### 3. Nested inside html with wikitext split by html tags
24809 #### 4. No escape needed
24810 #### 5. Empty headings <h1></h1>
24811 #### 6. Heading chars in SOL context
24812 #### ----------------------------------------
24813 !! test
24814 Headings: 0. Unnested
24815 !! options
24816 parsoid=html2wt
24817 !! html/parsoid
24818 <p>=foo=</p>
24819
24820 <p> =foo=
24821 <!--cmt-->
24822 =foo=</p>
24823
24824 <p>=foo<i>a</i>=</p>
24825 !! wikitext
24826 <nowiki>=foo=</nowiki>
24827
24828 <nowiki> </nowiki>=foo=
24829 <!--cmt-->
24830 <nowiki>=foo=</nowiki>
24831
24832 =foo''a''<nowiki>=</nowiki>
24833 !!end
24834
24835 # New headings and existing headings are handled differently
24836 !! test
24837 Headings: 1. Nested inside html
24838 !! options
24839 parsoid=html2wt
24840 !! html/parsoid
24841 <h1>=foo=</h1>
24842 <h2>=foo=</h2>
24843 <h3>=foo=</h3>
24844
24845 <h1 data-parsoid=''>=foo=</h1>
24846 <h2 data-parsoid=''>=foo=</h2>
24847 <h3 data-parsoid=''>=foo=</h3>
24848 <h4 data-parsoid=''>=foo=</h4>
24849 <h5 data-parsoid=''>=foo=</h5>
24850 <h6 data-parsoid=''>=foo=</h6>
24851 !! wikitext
24852 = =foo= =
24853
24854 == =foo= ==
24855
24856 === =foo= ===
24857
24858 =<nowiki>=foo=</nowiki>=
24859 ==<nowiki>=foo=</nowiki>==
24860 ===<nowiki>=foo=</nowiki>===
24861 ====<nowiki>=foo=</nowiki>====
24862 =====<nowiki>=foo=</nowiki>=====
24863 ======<nowiki>=foo=</nowiki>======
24864
24865 !!end
24866
24867 !! test
24868 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24869 !! options
24870 parsoid=html2wt
24871 !! html/parsoid
24872 <h1>foo</h1>*bar
24873 <h1>foo</h1>=bar
24874 <h1>foo</h1>=bar=
24875 !! wikitext
24876 = foo =
24877 <nowiki>*</nowiki>bar
24878
24879 = foo =
24880 =bar
24881
24882 = foo =
24883 <nowiki>=bar=</nowiki>
24884 !!end
24885
24886 !! test
24887 Headings: 3. Nested inside html with wikitext split by html tags
24888 !! options
24889 parsoid=html2wt
24890 !! html/parsoid
24891 <h1>=<b>bold</b>foo=</h1>
24892 !! wikitext
24893 = ='''bold'''foo= =
24894 !!end
24895
24896 !! test
24897 Headings: 4a. No escaping needed (testing just h1 and h2)
24898 !! options
24899 parsoid=html2wt
24900 !! html/parsoid
24901 <h1>=foo</h1>
24902 <h1>foo=</h1>
24903 <h1> =foo= </h1>
24904 <h1>=foo= bar</h1>
24905 <h2>=foo</h2>
24906 <h2>foo=</h2>
24907 <h1>=</h1>
24908 <h1><i>=</i>foo=</h1>
24909 !! wikitext
24910 = =foo =
24911
24912 = foo= =
24913
24914 = =foo= =
24915
24916 = =foo= bar =
24917
24918 == =foo ==
24919
24920 == foo= ==
24921
24922 = = =
24923
24924 = ''=''foo= =
24925 !!end
24926
24927 !! test
24928 Headings: 4b. No escaping needed (inside p-tags)
24929 !! options
24930 parsoid=html2wt
24931 !! html/parsoid
24932 <p>=foo= x
24933 =foo= <s></s>
24934 </p>
24935 !! wikitext
24936 =foo= x
24937 =foo= <s></s>
24938 !! html/php
24939 <p>=foo= x
24940 =foo= <s></s>
24941 </p>
24942 !!end
24943
24944 !! test
24945 Headings: 4c. Short headings (1)
24946 !! options
24947 parsoid=html2wt
24948 !! html/parsoid
24949 <p>===
24950 </p>
24951 !! wikitext
24952 <nowiki>===</nowiki>
24953 !! html/php
24954 <p>===
24955 </p>
24956 !! end
24957
24958 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24959 !! test
24960 Headings: 4d. Short headings (2)
24961 !! options
24962 parsoid=wt2html,html2html
24963 !! wikitext
24964 =
24965 ==
24966 ===
24967 ====
24968 =====
24969 !! html/php
24970 <p>=
24971 ==
24972 </p>
24973 <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>
24974 <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>
24975 <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>
24976
24977 !! html/parsoid
24978 <p>=
24979 ==</p>
24980 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
24981 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
24982 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
24983 !! end
24984
24985 !! test
24986 Headings: 5. Empty headings
24987 !! options
24988 parsoid=html2wt
24989 !! html/parsoid
24990 <h1 data-parsoid='{}'></h1>
24991
24992 <h2 data-parsoid='{}'></h2>
24993
24994 <h3 data-parsoid='{}'></h3>
24995
24996 <h4 data-parsoid='{}'></h4>
24997
24998 <h5 data-parsoid='{}'></h5>
24999
25000 <h6 data-parsoid='{}'></h6>
25001 !! wikitext
25002 =<nowiki/>=
25003
25004 ==<nowiki/>==
25005
25006 ===<nowiki/>===
25007
25008 ====<nowiki/>====
25009
25010 =====<nowiki/>=====
25011
25012 ======<nowiki/>======
25013 !!end
25014
25015 !! test
25016 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25017 !! options
25018 parsoid=html2wt
25019 !! html/parsoid
25020 <p>=a=</p>
25021
25022 <p>=a=</p>
25023
25024 <p>=a=</p>
25025 !! wikitext
25026 <nowiki>=a=</nowiki>
25027
25028 <nowiki>=a=</nowiki>
25029
25030 <nowiki>=a=</nowiki>
25031 !!end
25032
25033 !! test
25034 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25035 !! options
25036 parsoid=html2wt
25037 !! html/parsoid
25038 <p>=a=
25039 b</p>
25040
25041 <p>=a=
25042 b</p>
25043
25044 <p>=a=
25045 b</p>
25046 !! wikitext
25047 <nowiki>=a=</nowiki>
25048 b
25049
25050 <nowiki>=a=</nowiki>
25051 b
25052
25053 <nowiki>=a=</nowiki>
25054 b
25055 !!end
25056
25057 !! test
25058 Headings: 6c. Heading chars in SOL context (leading newline break)
25059 !! options
25060 parsoid=html2wt
25061 !! html/parsoid
25062 <p>a
25063 =b=</p>
25064 !! wikitext
25065 a
25066 <nowiki>=b=</nowiki>
25067 !!end
25068
25069 !! test
25070 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25071 !! options
25072 parsoid=html2wt
25073 !! html/parsoid
25074 <!--c0--><p>=a=</p>
25075
25076 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25077 !! wikitext
25078 <!--c0--><nowiki>=a=</nowiki>
25079
25080 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25081 !!end
25082
25083 !! test
25084 Headings: 6d. Heading chars in SOL context (No escaping needed)
25085 !! options
25086 parsoid=html2wt
25087 !! html/parsoid
25088 =a=<div>b</div>
25089 !! wikitext
25090 =a=<div>b</div>
25091 !!end
25092
25093 !! test
25094 Headings: 7. Insert a newline between new content and headings
25095 !! options
25096 parsoid=html2wt
25097 !! html/parsoid
25098 <h2>NEW</h2>
25099 <p>new</p>
25100 <h2 data-parsoid='{}'>A</h2>
25101 <p data-parsoid='{}'>a</p>
25102 !! wikitext
25103 == NEW ==
25104 new
25105
25106 ==A==
25107 a
25108
25109 !! end
25110
25111 !! test
25112 Headings: Used as horizontal rule
25113 !! config
25114 wgFragmentMode=[ 'html5', 'legacy' ]
25115 !! options
25116 parsoid=wt2html
25117 !! wikitext
25118 ===============
25119 !! html/php
25120 <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>
25121
25122 !! html/parsoid
25123 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25124 !! end
25125
25126 #### --------------- Lists ---------------
25127 #### 0. Outside nests (*foo, etc.)
25128 #### 1. Nested inside html <ul><li>*foo</li></ul>
25129 #### 2. Inside definition lists
25130 #### 3. Only bullets at start should be escaped
25131 #### 4. No escapes needed
25132 #### 5. No unnecessary escapes
25133 #### 6. Escape bullets in SOL position
25134 #### 7. Escape bullets in a multi-line context
25135 #### ----------------------------------------
25136
25137 !! test
25138 Lists: 0. Outside nests
25139 !! options
25140 parsoid=html2wt
25141 !! html/parsoid
25142 <p>*foo</p>
25143
25144 <p>#foo</p>
25145
25146 <p>;Foo:bar</p>
25147 !! wikitext
25148 <nowiki>*</nowiki>foo
25149
25150 <nowiki>#</nowiki>foo
25151
25152 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25153 !!end
25154
25155 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25156 ## to test wikitext escaping, and insignificant whitespace diffs
25157 ## cause PHP parser tests to barf
25158 !! test
25159 Lists: 1. Nested inside html (No unnecessary escapes)
25160 !! options
25161 parsoid=html2wt
25162 !! html/parsoid
25163 <ul>
25164 <li>*foo</li>
25165 <li>#foo</li>
25166 <li>:foo</li>
25167 <li>;foo</li>
25168 <li data-parsoid='{}'>*foo</li>
25169 <li data-parsoid='{}'>#foo</li>
25170 <li data-parsoid='{}'>:foo</li>
25171 <li data-parsoid='{}'>;foo</li>
25172 </ul>
25173
25174 <ol>
25175 <li>*foo</li>
25176 <li>#foo</li>
25177 <li>:foo</li>
25178 <li>;foo</li>
25179 <li data-parsoid='{}'>*foo</li>
25180 <li data-parsoid='{}'>#foo</li>
25181 <li data-parsoid='{}'>:foo</li>
25182 <li data-parsoid='{}'>;foo</li>
25183 </ol>
25184 !! wikitext
25185 * *foo
25186 * #foo
25187 * :foo
25188 * ;foo
25189 *<nowiki>*foo</nowiki>
25190 *<nowiki>#foo</nowiki>
25191 *<nowiki>:foo</nowiki>
25192 *<nowiki>;foo</nowiki>
25193
25194 # *foo
25195 # #foo
25196 # :foo
25197 # ;foo
25198 #<nowiki>*foo</nowiki>
25199 #<nowiki>#foo</nowiki>
25200 #<nowiki>:foo</nowiki>
25201 #<nowiki>;foo</nowiki>
25202 !!end
25203
25204 !! test
25205 Lists: 2. Inside definition lists
25206 !! options
25207 parsoid=html2wt
25208 !! html/parsoid
25209 <dl><dt>;foo</dt></dl>
25210 <dl><dt>:foo</dt></dl>
25211 <dl><dt>:foo</dt>
25212 <dd>bar</dd></dl>
25213 <dl><dd>:foo</dd></dl>
25214 !! wikitext
25215 ; ;foo
25216
25217 ; <nowiki>:foo</nowiki>
25218
25219 ; <nowiki>:foo</nowiki>
25220 : bar
25221
25222 : :foo
25223 !!end
25224
25225 !! test
25226 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25227 !! options
25228 parsoid=html2wt
25229 !! html/parsoid
25230 <ul>
25231 <li>*foo*bar</li>
25232 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25233 </ul>
25234 !! wikitext
25235 * *foo*bar
25236 *<nowiki>*foo</nowiki>''it''*bar
25237 !!end
25238
25239 !! test
25240 Lists: 4. No escapes needed
25241 !! options
25242 parsoid=html2wt
25243 !! html/parsoid
25244 <ul>
25245 <li>foo*bar
25246 </li>
25247 </ul>
25248 <ul>
25249 <li><i>foo</i>*bar
25250 </li>
25251 </ul>
25252 <ul>
25253 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25254 </li>
25255 </ul>
25256 <ul>
25257 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25258 </li>
25259 </ul>
25260 !! wikitext
25261 *foo*bar
25262
25263 *''foo''*bar
25264
25265 *[[Foo]]: bar
25266
25267 *[[Foo]]*bar
25268 !!end
25269
25270 !! test
25271 Lists: 5. No unnecessary escapes
25272 !! options
25273 parsoid=html2wt
25274 !! html/parsoid
25275 <ul><li> bar <span>[[foo]]</span></li></ul>
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> <s></s>: a</li></ul>
25281 <ul><li> <i>* foo</i></li></ul>
25282
25283 !! wikitext
25284 * bar <span><nowiki>[[foo]]</nowiki></span>
25285
25286 * =bar <span><nowiki>[[foo]]</nowiki></span>
25287
25288 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25289
25290 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25291
25292 * =bar <span>foo]]</span>=
25293
25294 * <s></s>: a
25295
25296 * ''* foo''
25297 !!end
25298
25299 !! test
25300 Lists: 6. Escape bullets in SOL position
25301 !! options
25302 parsoid=html2wt
25303 !! html/parsoid
25304 <p><!--cmt-->*foo</p>
25305 !! wikitext
25306 <!--cmt--><nowiki>*</nowiki>foo
25307 !!end
25308
25309 !! test
25310 Lists: 7. Escape bullets in a multi-line context
25311 !! options
25312 parsoid=html2wt
25313 !! html/parsoid
25314 <p>a
25315 *b
25316 </p>
25317 !! wikitext
25318 a
25319 <nowiki>*</nowiki>b
25320 !!end
25321
25322 !! test
25323 Lists: 8. Escape colons only if not present in tags
25324 !! options
25325 parsoid=html2wt
25326 !! html/parsoid
25327 <dl><dt>a:b<i>c:d</i></dt></dl>
25328 !! wikitext
25329 ; <nowiki>a:b</nowiki>''c:d''
25330 !! end
25331
25332 #### --------------- HRs ---------------
25333 #### 1. Single line
25334 #### -----------------------------------
25335
25336 !! test
25337 HRs: 1. Single line
25338 !! options
25339 parsoid=html2wt
25340 !! html/parsoid
25341 <hr />----
25342 <hr />=foo=
25343 <hr />*foo
25344 !! wikitext
25345 ----<nowiki>----</nowiki>
25346 ----=foo=
25347 ----*foo
25348 !! end
25349
25350 #### --------------- Tables ---------------
25351 #### 1a. Simple example
25352 #### 1b. No escaping needed (!foo)
25353 #### 1c. No escaping needed (|foo)
25354 #### 1d. No escaping needed (|}foo)
25355 ####
25356 #### 2a. Nested in td (<td>foo|bar</td>)
25357 #### 2b. Nested in td (<td>foo||bar</td>)
25358 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25359 ####
25360 #### 3a. Nested in th (<th>foo!bar</th>)
25361 #### 3b. Nested in th (<th>foo!!bar</th>)
25362 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25363 ####
25364 #### 4a. Escape -
25365 #### 4b. Escape +
25366 #### 4c. No escaping needed
25367 #### --------------------------------------
25368
25369 !! test
25370 Tables: 1a. Simple example
25371 !! options
25372 parsoid=html2wt
25373 !! html/parsoid
25374 <p>{|
25375 |}
25376 </p>
25377 !! wikitext
25378 <nowiki>{|</nowiki>
25379 |}
25380 !! end
25381
25382 !! test
25383 Tables: 1b. No escaping needed
25384 !! options
25385 parsoid=html2wt
25386 !! html/parsoid
25387 <p>!foo
25388 </p>
25389 !! wikitext
25390 !foo
25391 !! end
25392
25393 !! test
25394 Tables: 1c. No escaping needed
25395 !! options
25396 parsoid=html2wt
25397 !! html/parsoid
25398 <p>|foo
25399 </p>
25400 !! wikitext
25401 |foo
25402 !! end
25403
25404 !! test
25405 Tables: 1d. No escaping needed
25406 !! options
25407 parsoid=html2wt
25408 !! html/parsoid
25409 <p>|}foo
25410 </p>
25411 !! wikitext
25412 |}foo
25413 !! end
25414
25415 !! test
25416 Tables: 2a. Nested in td
25417 !! options
25418 parsoid=html2wt
25419 !! html/parsoid
25420 <table><tbody><tr>
25421 <td>foo|bar</td></tr>
25422 <tr><td>x<div>a|b</div></td>
25423 </tbody></table>
25424 !! wikitext
25425 {|
25426 |<nowiki>foo|bar</nowiki>
25427 |-
25428 |x<div><nowiki>a|b</nowiki></div>
25429 |}
25430 !! html/php+tidy
25431 <table>
25432 <tbody><tr>
25433 <td>foo|bar
25434 </td></tr>
25435 <tr>
25436 <td>x<div>a|b</div>
25437 </td></tr></tbody></table>
25438 !! end
25439
25440 !! test
25441 Tables: 2b. Nested in td
25442 !! options
25443 parsoid=html2wt
25444 !! html/parsoid
25445 <table><tbody><tr>
25446 <td>foo||bar</td>
25447 <td>a<i>b||c</i></td>
25448 <td>a<i><div>b||c</div></i></td>
25449 </tr></tbody></table>
25450 !! wikitext
25451 {|
25452 |<nowiki>foo||bar</nowiki>
25453 |a''<nowiki>b||c</nowiki>''
25454 |a''<div><nowiki>b||c</nowiki></div>''
25455 |}
25456 !! html/php
25457 <table>
25458 <tr>
25459 <td>foo||bar
25460 </td>
25461 <td>a<i>b||c</i>
25462 </td>
25463 <td>a<i><div>b||c</div></i>
25464 </td></tr></table>
25465
25466 !! end
25467
25468 !! test
25469 Tables: 2c. Nested in td -- no escaping needed
25470 !! options
25471 parsoid=html2wt
25472 !! html/*
25473 <table>
25474 <tr>
25475 <td>foo!!bar
25476 </td></tr></table>
25477
25478 !! wikitext
25479 {|
25480 |foo!!bar
25481 |}
25482 !! end
25483
25484 !! test
25485 Tables: 3a. Nested in th
25486 !! options
25487 parsoid=html2wt
25488 !! html/*
25489 <table>
25490 <tr>
25491 <th>foo!bar
25492 </th></tr></table>
25493
25494 !! wikitext
25495 {|
25496 !foo!bar
25497 |}
25498 !! end
25499
25500 !! test
25501 Tables: 3b. Nested in th
25502 !! options
25503 parsoid=html2wt
25504 !! html/parsoid
25505 <table><tbody>
25506 <tr><th>foo!!bar</th>
25507 <th><i>foo|bar</i></th>
25508 <th><i>foo!!bar</i></th>
25509 <th><i><span>foo!!bar</span></i></th>
25510 </tr></tbody></table>
25511 !! wikitext
25512 {|
25513 !<nowiki>foo!!bar</nowiki>
25514 !''<nowiki>foo|bar</nowiki>''
25515 !''<nowiki>foo!!bar</nowiki>''
25516 !''<span><nowiki>foo!!bar</nowiki></span>''
25517 |}
25518 !! html/php
25519 <table>
25520 <tr>
25521 <th>foo!!bar
25522 </th>
25523 <th><i>foo|bar</i>
25524 </th>
25525 <th><i>foo!!bar</i>
25526 </th>
25527 <th><i><span>foo!!bar</span></i>
25528 </th></tr></table>
25529
25530 !! end
25531
25532 !! test
25533 Tables: 3c. Nested in th
25534 !! options
25535 parsoid=html2wt
25536 !! html/parsoid
25537 <table><tbody>
25538 <tr><th>foo||bar</th>
25539 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25540 </tr></tbody></table>
25541 !! wikitext
25542 {|
25543 !<nowiki>foo||bar</nowiki>
25544 !<nowiki>foo||bar</nowiki>
25545 |}
25546 !! html/php
25547 <table>
25548 <tr>
25549 <th>foo||bar
25550 </th>
25551 <th>foo||bar
25552 </th></tr></table>
25553
25554 !! end
25555
25556 !! test
25557 Tables: 4a. Escape -
25558 !! options
25559 parsoid=html2wt
25560 !! html/*
25561 <table>
25562 <tr>
25563 <th>-bar
25564 </th></tr>
25565 <tr>
25566 <td>-bar
25567 </td></tr></table>
25568
25569 !! wikitext
25570 {|
25571 !-bar
25572 |-
25573 |<nowiki>-bar</nowiki>
25574 |}
25575 !! end
25576
25577 !! test
25578 Tables: 4b. Escape +
25579 !! options
25580 parsoid=html2wt
25581 !! html/*
25582 <table>
25583 <tr>
25584 <th>+bar
25585 </th></tr>
25586 <tr>
25587 <td>+bar
25588 </td></tr></table>
25589
25590 !! wikitext
25591 {|
25592 !+bar
25593 |-
25594 |<nowiki>+bar</nowiki>
25595 |}
25596 !! end
25597
25598 !! test
25599 Tables: 4c. No escaping needed
25600 !! options
25601 parsoid=html2wt
25602 !! html/parsoid
25603 <table><tbody>
25604 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25605 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25606 <tr><td>foo
25607 <p>bar|baz
25608 +bar
25609 -bar</p></td></tr>
25610 <tr><td>x
25611 <div>a|b</div></td>
25612 </tbody></table>
25613 !! wikitext
25614 {|
25615 |foo-bar
25616 |foo+bar
25617 |-
25618 |''foo''-bar
25619 |''foo''+bar
25620 |-
25621 |foo
25622 bar|baz
25623 +bar
25624 -bar
25625 |-
25626 |x
25627 <div>a|b</div>
25628 |}
25629 !! html/php
25630 <table>
25631 <tr>
25632 <td>foo-bar
25633 </td>
25634 <td>foo+bar
25635 </td></tr>
25636 <tr>
25637 <td><i>foo</i>-bar
25638 </td>
25639 <td><i>foo</i>+bar
25640 </td></tr>
25641 <tr>
25642 <td>foo
25643 <p>bar|baz
25644 +bar
25645 -bar
25646 </p>
25647 </td></tr>
25648 <tr>
25649 <td>x
25650 <div>a|b</div>
25651 </td></tr></table>
25652
25653 !! end
25654
25655 !! test
25656 Tables: 4d. No escaping needed
25657 !! options
25658 parsoid=html2wt
25659 !! html/parsoid
25660 <table>
25661 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25662 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25663 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25664 </tbody></table>
25665 !! wikitext
25666 {|
25667 |[[Foo]]-bar
25668 ||+1
25669 ||-2
25670 |}
25671 !! html/php
25672 <table>
25673 <tr>
25674 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25675 </td>
25676 <td>+1
25677 </td>
25678 <td>-2
25679 </td></tr></table>
25680
25681 !! end
25682
25683 !! test
25684 T97430: Don't emit empty nowiki pairs around marker meta tags
25685 !! options
25686 parsoid=html2wt
25687 !! html/parsoid
25688 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25689 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25690 !! wikitext
25691 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25692 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25693 !! end
25694
25695 !! test
25696 Unclosed xmlish element in table line shouldn't eat end delimiters
25697 !! options
25698 parsoid=html2wt
25699 !! html/parsoid
25700 <table>
25701 <tbody><tr><td> &lt;foo</td>
25702 <td> bar></td></tr>
25703 </tbody></table>
25704 !! wikitext
25705 {|
25706 | <foo
25707 | bar>
25708 |}
25709 !! html/php
25710 <table>
25711 <tr>
25712 <td>&lt;foo
25713 </td>
25714 <td>bar&gt;
25715 </td></tr></table>
25716
25717 !! end
25718
25719 #### --------------- Links ----------------
25720 #### 1. Quote marks in link text
25721 #### 2. Wikilinks: Escapes needed
25722 #### 3. Wikilinks: No escapes needed
25723 #### 4. Extlinks: Escapes needed
25724 #### 5. Extlinks: No escapes needed
25725 #### --------------------------------------
25726 !! test
25727 Links 1. WikiLinks: No escapes needed
25728 !! options
25729 parsoid=html2wt
25730 !! html/parsoid
25731 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25732 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25733 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25734 !! wikitext
25735 [[Foo|Foo''boo'']]
25736 [[Foo|[Foobar]]]
25737 [[Foo|x [Foobar] x]]
25738 !! html/php
25739 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25740 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25741 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25742 </p>
25743 !! end
25744
25745 !! test
25746 Links 2. WikiLinks: Escapes needed
25747 !! options
25748 parsoid=html2wt
25749 !! html/parsoid
25750 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25751 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25752 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25753 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25754 <a href="Foo" rel="mw:WikiLink">|Bar</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">x [[ y</a>
25758 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25759 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25760 !! wikitext
25761 [[Foo|<nowiki>Foobar]</nowiki>]]
25762 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25763 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25764 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25765 [[Foo|<nowiki>|Bar</nowiki>]]
25766 [[Foo|<nowiki>]]bar</nowiki>]]
25767 [[Foo|<nowiki>[[bar</nowiki>]]
25768 [[Foo|<nowiki>x [[ y</nowiki>]]
25769 [[Foo|<nowiki>x ]] y</nowiki>]]
25770 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25771 !! html/php
25772 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25773 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25774 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25775 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25776 <a href="/wiki/Foo" title="Foo">|Bar</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">x [[ y</a>
25780 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25781 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25782 </p>
25783 !! end
25784
25785 !! test
25786 Links 3. WikiLinks: No escapes needed
25787 !! options
25788 parsoid=html2wt
25789 !! html/parsoid
25790 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25791 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25792 !! wikitext
25793 [[Foo|[Foobar]]
25794 [[Foo|foo|bar]]
25795 !! html/php
25796 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25797 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25798 </p>
25799 !! end
25800
25801 !! test
25802 Links 4. ExtLinks: Escapes needed
25803 !! options
25804 parsoid=html2wt
25805 !! html/parsoid
25806 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25807 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25808 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25809 <p>[http://google.com]</p>
25810 <p>[http://google.com google]</p>
25811 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25812 <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>
25813 !! wikitext
25814 [http://google.com <nowiki>[google]</nowiki>]
25815 [http://google.com <nowiki>google]</nowiki>]
25816 [http://google.com <nowiki>goog] le</nowiki>]
25817
25818 <nowiki>[http://google.com]</nowiki>
25819
25820 <nowiki>[http://google.com google]</nowiki>
25821
25822 [http://google.com<nowiki>]</nowiki>
25823
25824 [{{echo|http://google.com}}<nowiki>]</nowiki>
25825 !! html/php
25826 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25827 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25828 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25829 </p><p>[http://google.com]
25830 </p><p>[http://google.com google]
25831 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25832 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25833 </p>
25834 !! end
25835
25836 !! test
25837 Links 5. ExtLinks: No escapes needed
25838 !! options
25839 parsoid=html2wt
25840 !! html/parsoid
25841 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25842 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25843 !! wikitext
25844 [http://google.com [google]
25845
25846 [[http://google.com]]
25847 !! html/php
25848 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25849 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25850 </p>
25851 !! end
25852
25853 !! test
25854 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25855 !! options
25856 parsoid=html2wt
25857 !! html/parsoid
25858 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25859 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25860 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25861 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25871 </p>
25872 !! wikitext
25873 x<nowiki/>http://example.com<nowiki/>y
25874 http://example.com<nowiki/>?x
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(x<nowiki/>)
25886 !! end
25887
25888 !! test
25889 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25890 !! options
25891 parsoid=html2wt
25892 !! html/parsoid
25893 <p>x
25894 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25895 y
25896 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
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>) foo
25899 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25900 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25901 </p>
25902 !! wikitext
25903 x
25904 http://example.com
25905 y
25906 "http://example.com"
25907 (http://example.com)
25908 (http://example.com) foo
25909 http://example.com,
25910 http://example.com, foo
25911 !! html/php
25912 <p>x
25913 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25914 y
25915 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
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>) foo
25918 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25919 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25920 </p>
25921 !! end
25922
25923 !! test
25924 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25925 !! options
25926 parsoid=html2wt
25927 !! html/parsoid
25928 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25929 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25930 !! wikitext
25931 http://example.com.,;:!?\
25932 -http://example.com:
25933 !! html/php
25934 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25935 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25936 </p>
25937 !! end
25938
25939 !! test
25940 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25941 !! options
25942 parsoid=html2wt
25943 !! html/parsoid
25944 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25945 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25946 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25947 !! wikitext
25948 RFC 123<nowiki/>4
25949 RFC 123<nowiki/>y
25950 X<nowiki/>RFC 123<nowiki/>y
25951 !! end
25952
25953 !! test
25954 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25955 !! options
25956 parsoid=html2wt
25957 !! html/parsoid
25958 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25959 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25960 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25961 </p>
25962 !! wikitext
25963 RFC 123?foo
25964 RFC 123&foo
25965 -RFC 123-
25966 !! html/php
25967 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25968 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25969 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25970 </p>
25971 !! end
25972
25973 !! test
25974 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25975 !! options
25976 parsoid=html2wt
25977 !! html/parsoid
25978 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25979 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25980 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25981 !! wikitext
25982 PMID 123<nowiki/>4
25983 PMID 123<nowiki/>y
25984 X<nowiki/>PMID 123<nowiki/>y
25985 !! end
25986
25987 !! test
25988 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25989 !! options
25990 parsoid=html2wt
25991 !! html/parsoid
25992 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25993 <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>-
25995 </p>
25996 !! wikitext
25997 PMID 123?foo
25998 PMID 123&foo
25999 -PMID 123-
26000 !! html/php
26001 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26002 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26003 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26004 </p>
26005 !! end
26006
26007 !! test
26008 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26009 !! options
26010 parsoid=html2wt
26011 !! html/parsoid
26012 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26013 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26014 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26015 </p>
26016 !! wikitext
26017 ISBN 1234567890<nowiki/>1
26018 ISBN 1234567890<nowiki/>x
26019 a<nowiki/>ISBN 1234567890<nowiki/>b
26020 !! end
26021
26022 !! test
26023 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26024 !! options
26025 parsoid=html2wt
26026 !! html/parsoid
26027 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26028 !! wikitext
26029 -ISBN 1234567890's
26030 !! html/php
26031 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26032 </p>
26033 !! end
26034
26035 !! test
26036 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26037 !! options
26038 parsoid=html2wt
26039 !! html/*
26040 <p>this is not a link: http://example.com
26041 </p>
26042 !! wikitext
26043 this is not a link: <nowiki>http://example.com</nowiki>
26044 !! end
26045
26046 !! test
26047 Links 15. Link trails can't become link prefixes.
26048 !! options
26049 language=is
26050 parsoid=html2wt
26051 !! html/parsoid
26052 <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>
26053 !! wikitext
26054 [[Söfnuður]]-[[00]]
26055 !! html/php
26056 <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>
26057 </p>
26058 !! end
26059
26060 #### --------------- Quotes ---------------
26061 #### 1. Quotes inside <b> and <i>
26062 #### 2. Link fragments separated by <i> and <b> tags
26063 #### 3. Link fragments inside <i> and <b>
26064 #### 4. No escaping needed
26065 #### --------------------------------------
26066 !! test
26067 1a. Quotes inside <b> and <i>
26068 !! options
26069 parsoid=html2wt
26070 !! html/*
26071 <p><i>'foo'</i>
26072 <i>''foo''</i>
26073 <i>'''foo'''</i>
26074 <i>foo</i>'s
26075 <b>'foo'</b>
26076 <b>''foo''</b>
26077 <b>'''foo'''</b>
26078 <b>foo'<i>bar'</i>baz</b>
26079 <b>foo</b>'s
26080 '<i>foo</i>
26081 <i>foo</i>'
26082 <i>foo'</i>'
26083 '<i>foo</i>'
26084 '<b>foo</b>
26085 <b>foo</b>'
26086 '<b>foo</b>'
26087 <i>fools'<span> errand</span></i>
26088 <i><span>fool</span>'s errand</i>
26089 '<i>foo</i> bar '<i>baz</i>
26090 a|!*#-:;+-~[]{}b'<i>x</i>
26091 </p>
26092 !! wikitext
26093 ''<nowiki/>'foo'''
26094 ''<nowiki>''foo''</nowiki>''
26095 ''<nowiki>'''foo'''</nowiki>''
26096 ''foo''<nowiki/>'s
26097 '''<nowiki/>'foo''''
26098 '''<nowiki>''foo''</nowiki>'''
26099 '''<nowiki>'''foo'''</nowiki>'''
26100 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26101 '''foo'''<nowiki/>'s
26102 '''foo''
26103 ''foo''<nowiki/>'
26104 ''foo'''<nowiki/>'
26105 '''foo''<nowiki/>'
26106 ''''foo'''
26107 '''foo'''<nowiki/>'
26108 ''''foo'''<nowiki/>'
26109 ''fools'<span> errand</span>''
26110 ''<span>fool</span>'s errand''
26111 '<nowiki/>''foo'' bar '''baz''
26112 a|!*#-:;+-~[]{}b'''x''
26113 !! end
26114
26115 !! test
26116 1b. Quotes inside <b> and <i> with other tags on same line
26117 !! options
26118 parsoid=html2wt
26119 !! html/parsoid
26120 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26121 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26122 <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>
26123 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26124 '<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>
26125 '<i>foo</i> <div title="name">test</div>
26126 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26127 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26128 <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>
26129 </ol>
26130 !! wikitext
26131 '''a'' foo ''[[bar]]''
26132 ''a''' foo ''[[bar]]''
26133 ''a''' foo '''{{echo|[[bar]]}}'''
26134 [[foo]] x'''[[bar]]''
26135 '''foo'' <ref>test</ref>
26136 '''foo'' <div title="name">test</div>
26137 '''foo'' and <br> bar
26138 <references />
26139 !! end
26140
26141 !! test
26142 2. Link fragments separated by <i> and <b> tags
26143 !! options
26144 parsoid=html2wt
26145 !! html/parsoid
26146 <p>[[<i>foo</i>hello]]</p>
26147 <p>[[<b>foo</b>hello]]</p>
26148 !! wikitext
26149 [[''foo''<nowiki>hello]]</nowiki>
26150
26151 [['''foo'''<nowiki>hello]]</nowiki>
26152 !! end
26153
26154 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26155 # this is one of the shortcomings of this format
26156 !! test
26157 3. Link fragments inside <i> and <b>
26158 !! options
26159 parsoid=html2wt
26160 !! html/parsoid
26161 <p><i>[[foo</i>]]</p>
26162 <p><b>[[foo</b>]]</p>
26163 !! wikitext
26164 ''[[foo''<nowiki>]]</nowiki>
26165
26166 '''[[foo'''<nowiki>]]</nowiki>
26167 !! end
26168
26169 !! test
26170 4. No escaping needed
26171 !! options
26172 parsoid=html2wt
26173 !! html/parsoid
26174 <p>'<span><i>bar</i></span>'
26175 '<span><b>bar</b></span>'
26176 'a:b'foo
26177 </p>
26178 !! wikitext
26179 '<span>''bar''</span>'
26180 '<span>'''bar'''</span>'
26181 'a:b'foo
26182 !! end
26183
26184 #### ----------- Paragraphs ---------------
26185 #### 1. No unnecessary escapes
26186 #### --------------------------------------
26187
26188 !! test
26189 1. No unnecessary escapes
26190 !! options
26191 parsoid=html2wt
26192 !! html/parsoid
26193 <p>bar <span>[[foo]]</span>
26194 </p><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>
26199 !! wikitext
26200 bar <span><nowiki>[[foo]]</nowiki></span>
26201
26202 =bar <span><nowiki>[[foo]]</nowiki></span>
26203
26204 [[bar <span><nowiki>[[foo]]</nowiki></span>
26205
26206 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26207
26208 =bar <span>foo]]</span><nowiki>=</nowiki>
26209 !!end
26210
26211 #### ----------------------- PRE --------------------------
26212 #### 1. Leading whitespace in SOL context should be escaped
26213 #### ------------------------------------------------------
26214 !! test
26215 1. Leading whitespace in SOL context should be escaped
26216 !! options
26217 parsoid=html2wt
26218 !! html/parsoid
26219 <p> a</p>
26220
26221 <p> a</p>
26222
26223 <p> a(tab)</p>
26224
26225 <p> a
26226 <!--cmt-->
26227 a</p>
26228
26229 <p>a
26230 b</p>
26231
26232 <p>a
26233 b</p>
26234
26235 <p>a
26236 b</p>
26237 !! wikitext
26238 <nowiki> </nowiki>a
26239
26240 <nowiki> </nowiki> a
26241
26242 a(tab)
26243
26244 <nowiki> </nowiki> a
26245 <!--cmt-->
26246 <nowiki> </nowiki>a
26247
26248 a
26249 <nowiki> </nowiki>b
26250
26251 a
26252 b
26253
26254 a
26255 b
26256 !! html/php
26257 <p> a
26258 </p><p> a
26259 </p><p> a(tab)
26260 </p><p> a
26261 a
26262 </p><p>a
26263 b
26264 </p><p>a
26265 b
26266 </p><p>a
26267 b
26268 </p>
26269 !! end
26270
26271 !! test
26272 2. Leading whitespace in non-indent-pre contexts should not be escaped
26273 !! options
26274 parsoid=html2wt
26275 !! html/parsoid
26276 <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>
26277 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26278 <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>
26279 b</span></li>
26280 </ol>
26281 !! wikitext
26282 foo <ref>''a''
26283 b</ref>
26284 <references />
26285 !! end
26286
26287 !! test
26288 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26289 !! options
26290 parsoid=html2wt
26291 !! html/parsoid
26292 <blockquote>
26293 <p>
26294 a
26295 <span>b</span>
26296 c</p>
26297 </blockquote>
26298 !! wikitext
26299 <blockquote>
26300 a
26301 <span>b</span>
26302 c
26303 </blockquote>
26304 !! end
26305
26306 !! test
26307 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26308 !! options
26309 parsoid=html2wt
26310 !! html/parsoid
26311 <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>
26312 !! wikitext
26313 [[File:Foobar.jpg|thumb|caption]]
26314 !! end
26315
26316 !! test
26317 5. Nowiki escaping should account for indent-pres
26318 !! options
26319 parsoid=html2wt
26320 !! html/parsoid
26321 <pre>==foo==</pre>
26322 !! wikitext
26323 ==foo==
26324 !! end
26325
26326 !!test
26327 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26328 !! options
26329 parsoid=html2wt
26330 !! html/parsoid
26331 <pre>
26332 * foo
26333 * bar
26334 </pre>
26335 !! wikitext
26336 * foo
26337 * bar
26338 !! end
26339
26340 #### --------------- Behavior Switches --------------------
26341
26342 !! test
26343 1. Valid behavior switches should be escaped
26344 !! options
26345 parsoid=html2wt
26346 !! html/parsoid
26347 __TOC__
26348 <i>__TOC__</i>
26349 !! wikitext
26350 <nowiki>__TOC__</nowiki>
26351 ''<nowiki>__TOC__</nowiki>''
26352 !! end
26353
26354 !! test
26355 2. Invalid behavior switches should not be escaped
26356 !! options
26357 parsoid=html2wt
26358 !! html/parsoid
26359 __TOO__
26360 __|__
26361 !! wikitext
26362 __TOO__
26363 __|__
26364 !! end
26365
26366 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26367 !! test
26368 Behavior switches should be SOL-transparent
26369 !! options
26370 parsoid=html2wt
26371 !! html/parsoid
26372 <meta property="mw:PageProp/toc" />
26373
26374 <!-- this one's bogus -->
26375 <pre>__TOO__</pre>
26376
26377 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26378
26379 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26380 !! wikitext
26381 __TOC__
26382
26383 <!-- this one's bogus -->
26384 __TOO__
26385
26386 __TOC__ foo
26387
26388 __TOC__
26389 bar
26390 !! end
26391
26392 #### --------------- HTML tags ---------------
26393 #### 1. a tags
26394 #### 2. other tags
26395 #### 3. multi-line html tag
26396 #### 4. extension tags
26397 #### -----------------------------------------
26398 !! test
26399 1. a tags
26400 !! options
26401 parsoid=html2wt
26402 !! html/parsoid
26403 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26404 !! wikitext
26405 <a href="http://google.com">google</a>
26406 !! end
26407
26408 !! test
26409 2. other tags
26410 !! options
26411 parsoid=html2wt
26412 !! html/parsoid
26413 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26414 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26415 <li> &lt;td&gt;</li></ul>
26416
26417 !! wikitext
26418 * <nowiki><div>foo</div></nowiki>
26419 * <nowiki><div style="color:red">foo</div></nowiki>
26420 * <nowiki><td></nowiki>
26421 !! end
26422
26423 !! test
26424 3. multi-line html tag
26425 !! options
26426 parsoid=html2wt
26427 !! html/parsoid
26428 <p>&lt;div
26429 &gt;foo&lt;/div
26430 &gt;
26431 </p>
26432 !! wikitext
26433 <nowiki><div
26434 >foo</div
26435 ></nowiki>
26436 !! end
26437
26438 !! test
26439 4. extension tags
26440 !! options
26441 parsoid=html2wt
26442 !! html/parsoid
26443 <p>&lt;ref&gt;foo&lt;/ref&gt;
26444 </p><p>&lt;ref&gt;bar
26445 </p><p>baz&lt;/ref&gt;
26446 </p>
26447 !! wikitext
26448 <nowiki><ref>foo</ref></nowiki>
26449
26450 <nowiki><ref>bar</nowiki>
26451
26452 baz<nowiki></ref></nowiki>
26453 !! end
26454
26455 #### --------------- Others ---------------
26456 !! test
26457 Escaping nowikis
26458 !! options
26459 parsoid=html2wt
26460 !! html/parsoid
26461 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26462 </p>
26463 !! wikitext
26464 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26465 !! end
26466
26467 ## The quote-char in the input is necessary for triggering the bug
26468 !! test
26469 (T54035) Nowiki-escaping should not get tripped by " :" in text
26470 !! options
26471 parsoid=html2wt
26472 !! html/parsoid
26473 <p>foo's bar :</p>
26474 !! wikitext
26475 foo's bar :
26476 !! end
26477
26478 #----------- End of wikitext escaping tests --------------
26479
26480 !! test
26481
26482 Tag-like HTML structures are passed through as text
26483 !! wikitext
26484 <x y>
26485
26486 <x.y>
26487
26488 <x-y>
26489
26490 1>2
26491
26492 x<y
26493
26494 a>b
26495
26496 1<d e>f
26497 !! html
26498 <p>&lt;x y&gt;
26499 </p><p>&lt;x.y&gt;
26500 </p><p>&lt;x-y&gt;
26501 </p><p>1&gt;2
26502 </p><p>x&lt;y
26503 </p><p>a&gt;b
26504 </p><p>1&lt;d e&gt;f
26505 </p>
26506 !! end
26507
26508 !! test
26509 HTML tag with necessary entities in attributes
26510 !! wikitext
26511 <span title="&amp;amp;">foo</span>
26512 !! html
26513 <p><span title="&amp;amp;">foo</span>
26514 </p>
26515 !! end
26516
26517 !! test
26518 HTML tag with 'unnecessary' entity encoding in attributes
26519 !! wikitext
26520 <span title="&amp;">foo</span>
26521 !! html
26522 <p><span title="&amp;">foo</span>
26523 </p>
26524 !! end
26525
26526 !! test
26527 HTML tag with broken attribute value quoting
26528 !! options
26529 parsoid=wt2html,html2html
26530 !! wikitext
26531 <span title="Hello world>Foo</span>
26532 !! html/php
26533 <p><span title="Hello world">Foo</span>
26534 </p>
26535 !! html/parsoid
26536 <p><span title="Hello world">Foo</span></p>
26537 !! end
26538
26539 !! test
26540 Self-closed tag with broken attribute value quoting
26541 !! options
26542 parsoid=wt2html,html2html
26543 !! wikitext
26544 <div title="Hello world />Foo
26545 !! html/php+tidy
26546 <div title="Hello world"></div><p>Foo
26547 </p>
26548 !! html/parsoid
26549 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26550 !! end
26551
26552 !! test
26553 Table with broken attribute value quoting
26554 !! options
26555 parsoid=wt2html,html2html
26556 !! wikitext
26557 {|
26558 | title="Hello world|Foo
26559 |}
26560 !! html/php
26561 <table>
26562 <tr>
26563 <td title="Hello world">Foo
26564 </td></tr></table>
26565
26566 !! html/parsoid
26567 <table>
26568 <tr>
26569 <td title="Hello world">Foo
26570 </td></tr></table>
26571
26572 !! end
26573
26574 !! test
26575 Table with broken attribute value quoting on consecutive lines
26576 !! options
26577 parsoid=wt2html,html2html
26578 !! wikitext
26579 {|
26580 | title="Hello world|Foo
26581 | style="color:red|Bar
26582 |}
26583 !! html/php
26584 <table>
26585 <tr>
26586 <td title="Hello world">Foo
26587 </td>
26588 <td style="color:red">Bar
26589 </td></tr></table>
26590
26591 !! html/parsoid
26592 <table><tbody>
26593 <tr>
26594 <td title="Hello world">Foo
26595 </td><td style="color: red">Bar
26596 </td></tr></tbody></table>
26597
26598 !! end
26599
26600 !!test
26601 Accept empty td cell attribute
26602 !! wikitext
26603 {|
26604 | align="center" |foo|| |
26605 |}
26606 !! html
26607 <table>
26608 <tr>
26609 <td align="center">foo</td>
26610 <td>
26611 </td></tr></table>
26612
26613 !!end
26614
26615 !!test
26616 Non-empty attributes in th-cells
26617 !! wikitext
26618 {|
26619 !Foo!! style="color: red" |Bar
26620 |}
26621 !! html
26622 <table>
26623 <tr>
26624 <th>Foo</th>
26625 <th style="color: red">Bar
26626 </th></tr></table>
26627
26628 !!end
26629
26630 !!test
26631 Accept empty attributes in th-cells
26632 !! wikitext
26633 {|
26634 !|foo!!|bar
26635 |}
26636 !! html
26637 <table>
26638 <tr>
26639 <th>foo</th>
26640 <th>bar
26641 </th></tr></table>
26642
26643 !!end
26644
26645 !!test
26646 Empty table rows go away
26647 !! wikitext
26648 {|
26649 |Hello
26650 |there
26651 |- class="foo"
26652 |-
26653 |}
26654 !! html
26655 <table>
26656 <tr>
26657 <td>Hello
26658 </td>
26659 <td>there
26660 </td></tr>
26661
26662 </table>
26663
26664 !! end
26665
26666 ###
26667 ### Parsoid-centric tests for testing RTing of inter-element separators
26668 ### Edge cases not tested by existing parser tests and specific to
26669 ### Parsoid-specific serialization strategies.
26670 ###
26671
26672 !!test
26673 RT-ed inter-element separators should be valid separators
26674 !! wikitext
26675 {|
26676 |- [[foo]]
26677 |}
26678 !! html/php
26679 <table>
26680
26681 </table>
26682
26683 !! html/parsoid
26684 <table>
26685 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26686 </tbody></table>
26687 !!end
26688
26689 # Parsoid-only test of a DOM pass
26690 !!test
26691 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26692 !! wikitext
26693 {|
26694 |<small>foo
26695 bar
26696 |}
26697
26698 {|
26699 |<small>foo<small>
26700 |}
26701 !! html/parsoid
26702 <table>
26703 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26704 <p>bar</p></small></td></tr>
26705 </tbody></table>
26706
26707 <table>
26708 <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>
26709 </tbody></table>
26710 !!end
26711
26712 # Note that the "style" attribute is really a template parameter here.
26713 # The = would have to be {{=}} if you wanted the literal.
26714 !!test
26715 Empty TD followed by TD with tpl-generated attribute
26716 !! wikitext
26717 {|
26718 |-
26719 |
26720 |{{echo|style='color:red'}}|foo
26721 |}
26722 !! html
26723 <table>
26724
26725 <tr>
26726 <td>
26727 </td>
26728 <td>foo
26729 </td></tr></table>
26730
26731 !!end
26732
26733 !!test
26734 Indented table with an empty td
26735 !! wikitext
26736 {|
26737 |-
26738 |
26739 |foo
26740 |}
26741 !! html
26742 <table>
26743
26744 <tr>
26745 <td>
26746 </td>
26747 <td>foo
26748 </td></tr></table>
26749
26750 !!end
26751
26752 ## We have some newline diffs RT-ing this edge case
26753 ## and it is not important enough -- we seem to be emitting
26754 ## at most 2 newlines after a </tr> and this is unrelated to
26755 ## the issue from T85627 that this is testing.
26756 !!test
26757 Indented table with blank lines in between (T85627)
26758 !! options
26759 parsoid=wt2html
26760 !! wikitext
26761 {|
26762 |foo
26763
26764
26765 |}
26766 !! html
26767 <table>
26768
26769 <tr>
26770 <td>foo
26771 </td></tr></table>
26772
26773 !!end
26774
26775 !!test
26776 Indented block & table
26777 !! wikitext
26778 <div>foo</div>
26779 {|
26780 |foo
26781 |}
26782 !! html/php
26783 <div>foo</div>
26784 <table>
26785 <tr>
26786 <td>foo
26787 </td></tr></table>
26788
26789 !! html/parsoid
26790 <div data-parsoid='{"stx":"html"}'>foo</div>
26791 <table><tbody>
26792 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26793 </tbody></table>
26794 !!end
26795
26796 !! test
26797 Indent and comment before table row
26798 !! wikitext
26799 {|
26800 <!--hi-->|-
26801 |there
26802 |}
26803 !! html/php
26804 <table>
26805
26806 <tr>
26807 <td>there
26808 </td></tr></table>
26809
26810 !! html/parsoid
26811 <table>
26812 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26813 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26814 </tbody></table>
26815 !! end
26816
26817 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26818 !!test
26819 Empty TR followed by a template-generated TR
26820 !!options
26821 parsoid
26822 !! wikitext
26823 {|
26824 |-
26825 {{echo|<tr><td>foo</td></tr>}}
26826 |}
26827 !! html
26828 <table>
26829 <tbody>
26830 <tr class='mw-empty-elt'></tr>
26831 <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}}]}'>
26832 <td>foo</td></tr>
26833 </tbody></table>
26834 !!end
26835
26836 ## PHP and parsoid output differ for this, and since this is primarily
26837 ## for testing Parsoid's serializer, marking this Parsoid only
26838 !!test
26839 Empty TR followed by mixed-ws-comment line should RT correctly
26840 !!options
26841 parsoid
26842 !! wikitext
26843 {|
26844 |-
26845 <!--c-->
26846 |-
26847 <!--c--> <!--d-->
26848 |}
26849 !! html
26850 <table>
26851 <tbody>
26852 <tr class='mw-empty-elt'></tr>
26853 <!--c-->
26854 <tr>
26855 <!--c--> </tr><!--d-->
26856 </tbody></table>
26857
26858 !!end
26859
26860 !!test
26861 Multi-line image caption generated by templates with/without trailing newlines
26862 !! wikitext
26863 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26864 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26865 !! html/parsoid
26866 <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>
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="#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>
26868 !!end
26869
26870 !! test
26871 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26872 !! options
26873 parsoid=html2wt
26874 !! html/parsoid
26875 <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>
26876
26877 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26878 !! wikitext
26879 <includeonly>foo</includeonly>
26880 new para
26881
26882 [[Category:Foo]]
26883
26884 = new heading =
26885 !! end
26886
26887 ## PHP emits broken html for this, and since this is primarily
26888 ## a Parsoid serializer test, marking this Parsoid only
26889 !!test
26890 Improperly nested inline or quotes tags with whitespace in between
26891 !! wikitext
26892 <span> <s>x</span> </s>
26893 ''' ''x''' ''
26894 !! html/parsoid
26895 <p><span> <s>x</s></span><s> </s>
26896 <b> <i>x</i></b><i> </i>
26897 </p>
26898 !!end
26899
26900 !!test
26901 Encapsulate protected attributes from wt
26902 !! wikitext
26903 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26904
26905 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26906 | ok
26907 |}
26908 !! html/parsoid
26909 <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>
26910
26911 <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">
26912 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26913 </tbody></table>
26914 !!end
26915
26916 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26917 ## Having nested or stray pre tags results in the attempt to add duplicates,
26918 ## causing an assertion fail. This test tries to prevent that situation.
26919 !!test
26920 Ensure ParagraphWrapper can deal with stray closing pre tags
26921 !!options
26922 parsoid=wt2html
26923 !! wikitext
26924 plain text</pre>
26925 !! html/parsoid
26926 plain text
26927 !!end
26928
26929 !!test
26930 1. Ensure fostered text content is wrapped in element nodes
26931 !!options
26932 parsoid=wt2html
26933 !! wikitext
26934 <table>hi</table><table>ho</table>
26935 !! html/parsoid
26936 <p>hi</p>
26937 <table></table>
26938 <p>ho</p>
26939 <table></table>
26940 !!end
26941
26942 !!test
26943 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26944 !!options
26945 parsoid=wt2html,wt2wt
26946 !! wikitext
26947 <table>
26948 <tr> || ||
26949 <td> a
26950 </table>
26951 !! html/parsoid
26952 <p> || ||
26953 </p><table>
26954 <tbody><tr><td> a</td></tr>
26955 </tbody></table>
26956 !!end
26957
26958 !!test
26959 Encapsulation properly handles null DSR information from foster box
26960 !!options
26961 parsoid=wt2html,wt2wt
26962 !! wikitext
26963 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26964 !! html/parsoid
26965 <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>
26966 !!end
26967
26968 !!test
26969 1. Encapsulate foster-parented transclusion content
26970 !!options
26971 parsoid=wt2wt,wt2html
26972 !! wikitext
26973 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26974 !! html/parsoid
26975 <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>
26976 <tbody>
26977 <tr>
26978 <td>bar</td>
26979 </tr>
26980 </tbody>
26981 </table>
26982 !!end
26983
26984 !!test
26985 2. Encapsulate foster-parented transclusion content
26986 !!options
26987 parsoid=wt2wt,wt2html
26988 !! wikitext
26989 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26990 !! html/parsoid
26991 <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>
26992 <table>
26993 <tbody>
26994 <tr>
26995 <td>bar</td>
26996 </tr>
26997 </tbody>
26998 </table>
26999 !!end
27000
27001 !!test
27002 3. Encapsulate foster-parented transclusion content
27003 !!options
27004 parsoid=wt2wt,wt2html
27005 !! wikitext
27006 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27007 !! html/parsoid
27008 <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;]}">
27009 <p>foo</p>
27010 </div>
27011 <table>
27012 <tbody>
27013 <tr>
27014 <td>bar</td>
27015 </tr>
27016 </tbody>
27017 </table>
27018 !!end
27019
27020 !!test
27021 4. Encapsulate foster-parented transclusion content
27022 !!options
27023 parsoid=wt2wt,wt2html
27024 !! wikitext
27025 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27026 !! html/parsoid
27027 <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;]}">
27028 <p>foo</p>
27029 </div>
27030 <table>
27031 <tbody>
27032 <tr>
27033 <td>bar</td>
27034 </tr>
27035 </tbody>
27036 </table>
27037 !!end
27038
27039 !!test
27040 5. Encapsulate foster-parented transclusion content
27041 !!options
27042 parsoid=wt2wt,wt2html
27043 !! wikitext
27044 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27045 !! html/parsoid
27046 <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>
27047 <table>
27048 <tbody>
27049 <tr>
27050 <td>
27051 <div>
27052 <p>foo</p>
27053 </div>
27054 </td>
27055 </tr>
27056 </tbody>
27057 </table>
27058 !!end
27059
27060 !!test
27061 6. Encapsulate foster-parented transclusion content
27062 !!options
27063 parsoid=wt2wt,wt2html
27064 !! wikitext
27065 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27066 !! html/parsoid
27067 <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>
27068 <table>
27069 <tbody>
27070 <tr>
27071 <td>
27072 <div>
27073 <p>foo</p>
27074 </div>
27075 </td>
27076 </tr>
27077 </tbody>
27078 </table>
27079 <p>ok</p>
27080 !!end
27081
27082 !!test
27083 7. Encapsulate foster-parented transclusion content
27084 !!options
27085 parsoid=wt2wt,wt2html
27086 !! wikitext
27087 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27088 !! html/parsoid
27089 <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>
27090 <table>
27091 <tbody>
27092 <tr>
27093 <td>bar</td>
27094 </tr>
27095 </tbody>
27096 </table>
27097 !!end
27098
27099 # Note that the wt is broken on purpose: the = should be {{=}} if you
27100 # don't want it to be a template parameter key.
27101 !!test
27102 8. Encapsulate foster-parented transclusion content
27103 !!options
27104 parsoid=wt2wt,wt2html
27105 !! wikitext
27106 {{echo|a
27107 }}{|{{echo|style='color:red'}}
27108 |-
27109 |b
27110 |}
27111 !! html/parsoid
27112 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27113 <span> </span>
27114 <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>
27115 <table>
27116 <tbody>
27117 <tr>
27118 <td>b</td>
27119 </tr>
27120 </tbody>
27121 </table>
27122 !!end
27123
27124 !!test
27125 9. Encapsulate foster-parented transclusion content
27126 !!options
27127 parsoid=wt2wt,wt2html
27128 !! wikitext
27129 <table>{{echo|hi</table>hello}}
27130 !! html/parsoid
27131 <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>
27132 !!end
27133
27134 !!test
27135 Table in fosterable position
27136 !!options
27137 parsoid=wt2html
27138 !! wikitext
27139 {{OpenTable}}
27140 <div>
27141 {|
27142 |}
27143 </div>
27144 |}
27145 !! html/parsoid
27146 <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">
27147 </span>
27148 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27149
27150 <table>
27151 </table>
27152 !!end
27153
27154 # Parsoid only for T66747
27155 !! test
27156 Properly encapsulate empty-content transclusions in fosterable positions
27157 !! wikitext
27158 <table>
27159 {{#if:|
27160 <td>foo</td>
27161 }}
27162 </table>
27163 !! html/parsoid
27164 <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"}]]}'>
27165
27166 </table>
27167 !! end
27168
27169 !! test
27170 Always encapsulate foster box when template range is expanded to table
27171 !! options
27172 parsoid=wt2wt
27173 !! wikitext
27174 {|
27175 hello
27176 {{OpenTable}}
27177 |}
27178 !! html/parsoid
27179
27180 !! end
27181
27182 !! test
27183 T115289: Unclosed table
27184 !! wikitext
27185 {{echo|<table>}}<!--c-->[[Category:Two]]
27186 !! html/parsoid
27187 <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>
27188 !! end
27189
27190 !! test
27191 T115289: Don't migrate newlines out of tables with fostered content
27192 !! wikitext
27193 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27194 !! html/parsoid
27195 <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>
27196 !! end
27197
27198 !! test
27199 T73074: More fostering fun
27200 !! wikitext
27201 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27202 !! html/parsoid
27203 <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>
27204 !! end
27205
27206 !!test
27207 Support <object> element with .data attribute
27208 !!options
27209 parsoid=html2wt
27210 !! html/parsoid
27211 <object data="test.swf"></object>
27212 !! wikitext
27213 <object data="test.swf"></object>
27214 !!end
27215
27216 !! test
27217 Don't block XML namespace declaration
27218 !! wikitext
27219 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27220 !! html/php
27221 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27222 </p>
27223 !! html/parsoid
27224 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27225 !! end
27226
27227 # -----------------------------------------------------------------
27228 # The following section of tests are primarily to spec requirements
27229 # around Parsoid's serialization (old, new, edited content)
27230 #
27231 # All these tests are marked Parsoid html2wt and html2html only
27232 # ----------------------------------------------------------------
27233
27234 !! test
27235 Ignore rel attribute in a-tags during serialization to url-links
27236 !! options
27237 parsoid=html2wt
27238 !! html/parsoid
27239 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27240 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27241 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27242 !! wikitext
27243 http://en.wikipedia.org/wiki/Foobar
27244 http://en.wikipedia.org/wiki/Foobar
27245 http://en.wikipedia.org/wiki/Foobar
27246 !! end
27247
27248 # 'mi' is a localinterwiki prefix as well as a language
27249 !! test
27250 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27251 !! options
27252 parsoid=html2wt
27253 !! html/parsoid
27254 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27255 !! wikitext
27256 [[Foo]]
27257 !! end
27258
27259 !! test
27260 Parsoid should accept interwiki shortcuts
27261 !! options
27262 parsoid=html2wt
27263 !! html/parsoid
27264 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27265 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27266 <a href='./fr:Foo'>Foo</a></p>
27267 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27268 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27269 <a href='fr%3AFoo'>Foo</a></p>
27270 <p><a href='FR%3AFoo'>Foo</a>
27271 <a href='./FR:Foo'>Foo</a></p>
27272 !! wikitext
27273 [[:fr:Foo|Foo]]
27274 [[:fr:Foo|Foo]]
27275 [[:fr:Foo|Foo]]
27276
27277 [[:fr:Foo|Foo]]
27278 [[:fr:Foo|Foo]]
27279 [[:fr:Foo|Foo]]
27280
27281 [[:fr:Foo|Foo]]
27282 [[:fr:Foo|Foo]]
27283 !! end
27284
27285 !! test
27286 Parsoid should not accept invalid interwiki shortcuts
27287 !! options
27288 parsoid=html2wt
27289 !! html/parsoid
27290 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27291 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27292 <a href='news:Foo'>Foo</a></p>
27293 !! wikitext
27294 [news:Foo Foo]
27295 [news:Foo Foo]
27296 [news:Foo Foo]
27297 !! end
27298
27299 # See T93839
27300 !! test
27301 New wikilinks should be serialized properly
27302 !! options
27303 parsoid=html2wt
27304 !! html/parsoid
27305 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27306 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27307 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27308 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27309 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27310 !! wikitext
27311 [[Foo]]
27312 [[Foo]]
27313 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27314 http://en.wikipedia.org/wiki/Foo
27315 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27316 !! end
27317
27318 !! test
27319 New wiki links (href variations)
27320 !! options
27321 parsoid=html2wt
27322 !! html/parsoid
27323 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
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="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27327 !! wikitext
27328 [[Foo_bar]]
27329 [[Foo_bar]]
27330 [[Foo_bar]]
27331 [[Toxine bactérienne]]
27332 !! end
27333
27334 !! test
27335 New wiki links (content string variations)
27336 !! options
27337 parsoid=html2wt
27338 !! html/parsoid
27339 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27340 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27341 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27342 !! wikitext
27343 [[Foo_bar]]
27344 [[Foo bar]]
27345 [[Foo_bar|./Foo_bar]]
27346 !! end
27347
27348 !! test
27349 New category links (href variations)
27350 !! options
27351 parsoid=html2wt
27352 !! html/parsoid
27353 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27354 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27355 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27356 !! wikitext
27357 [[Category:Toxine bactérienne]]
27358 [[Category:Toxine bactérienne]]
27359 [[Category:Toxine bactérienne]]
27360 !! end
27361
27362 !! test
27363 New sol transparent links don't need indent-pre nowiki protection
27364 !! options
27365 parsoid=html2wt
27366 language=de
27367 !! html/parsoid
27368 <link rel="mw:PageProp/redirect" href="./Main_Page">
27369 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27370 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27371 !! wikitext
27372 #WEITERLEITUNG [[Main Page]]
27373 <!-- this is good --> [[Category:Good]]
27374 <!-- this is great --> [[Kategorie:Great]]
27375 !! end
27376
27377 !! test
27378 New interlanguage links (href variations)
27379 !! options
27380 parsoid=html2wt
27381 !! html/parsoid
27382 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
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%C3%A9rienne" />
27385 !! wikitext
27386 [[es:Toxine bactérienne]]
27387 [[es:Toxine_bactérienne]]
27388 [[es:Toxine_bactérienne]]
27389 !! end
27390
27391 !! test
27392 Image: Modifying size of an image (1)
27393 !! options
27394 parsoid={
27395 "modes": ["wt2wt"],
27396 "changes": [
27397 ["img[height]", "attr", "height", "22"],
27398 ["img[width]", "attr", "width", "200"]
27399 ]
27400 }
27401 !! wikitext
27402 [[Image:Foobar.jpg|230x230px]]
27403 !! wikitext/edited
27404 [[Image:Foobar.jpg|200x200px]]
27405 !!end
27406
27407 !! test
27408 Image: Modifying size of an image (2)
27409 !! options
27410 parsoid={
27411 "modes": ["wt2wt"],
27412 "changes": [
27413 ["img[height]", "attr", "height", "100"],
27414 ["img[width]", "attr", "width", "500"]
27415 ]
27416 }
27417 !! wikitext
27418 [[Image:Foobar.jpg|230x230px]]
27419 !! wikitext/edited
27420 [[Image:Foobar.jpg|500x500px]]
27421 !!end
27422
27423 # Change in size is ignored so long as class='mw-default-size'
27424 !! test
27425 Image: Modifying size of an image (3)
27426 !! options
27427 parsoid={
27428 "modes": ["wt2wt"],
27429 "changes": [
27430 ["figure[class]", "removeClass", "mw-default-size"],
27431 ["figure img", "attr", "height", "19"],
27432 ["figure img", "attr", "width", "170"]
27433 ]
27434 }
27435 !! wikitext
27436 [[Image:Foobar.jpg|thumb]]
27437 !! wikitext/edited
27438 [[Image:Foobar.jpg|thumb|170x170px]]
27439 !!end
27440
27441 !! test
27442 Image: Modifying alignment of an image (T50665)
27443 !! options
27444 parsoid={
27445 "modes": ["wt2wt"],
27446 "changes": [
27447 ["figure[class]", "removeClass", "mw-halign-right"],
27448 ["figure[class]", "addClass", "mw-halign-left"]
27449 ]
27450 }
27451 !! wikitext
27452 [[Image:Foobar.jpg|thumb|caption|right]]
27453 !! wikitext/edited
27454 [[Image:Foobar.jpg|thumb|caption|left]]
27455 !! end
27456
27457 !! test
27458 Image: Modifying mw-default-size of an frameless image (T64805)
27459 !! options
27460 parsoid={
27461 "modes": ["wt2wt"],
27462 "changes": [
27463 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27464 ]
27465 }
27466 !! wikitext
27467 [[Image:Foobar.jpg|frameless|right]]
27468 !! wikitext/edited
27469 [[Image:Foobar.jpg|frameless|right|220x220px]]
27470 !! end
27471
27472 !! test
27473 Image: Modifying valign of an image (T51221)
27474 !! options
27475 parsoid={
27476 "modes": ["wt2wt"],
27477 "changes": [
27478 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27479 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27480 ]
27481 }
27482 !! wikitext
27483 [[File:Foobar.jpg|20px|middle]]
27484 !! wikitext/edited
27485 [[File:Foobar.jpg|20px|text-top]]
27486 !! end
27487
27488 !! test
27489 Image: Modifying alt attribute of an image (T58400)
27490 !! options
27491 parsoid={
27492 "modes": ["wt2wt"],
27493 "changes": [
27494 ["img[alt]", "attr", "alt", "some alternate edited text"]
27495 ]
27496 }
27497 !! wikitext
27498 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27499 !! wikitext/edited
27500 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27501 !!end
27502
27503 !! test
27504 Image: Modifying caption of an image
27505 !! options
27506 parsoid={
27507 "modes": ["wt2wt"],
27508 "changes": [
27509 ["figcaption", "text", "new caption"]
27510 ]
27511 }
27512 !! wikitext
27513 [[Image:Foobar.jpg|thumb|original caption]]
27514 !! wikitext/edited
27515 [[Image:Foobar.jpg|thumb|new caption]]
27516 !!end
27517
27518 !! test
27519 Image: empty alt attribute (T50924)
27520 !! options
27521 parsoid
27522 !! wikitext
27523 [[File:Foobar.jpg|thumb|alt=|bar]]
27524 !! html
27525 <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>
27526 !! end
27527
27528 !! test
27529 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27530 !! options
27531 parsoid=html2wt
27532 language=ar
27533 disabled
27534 !! html/parsoid
27535 <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>
27536 !! wikitext
27537 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27538 !! end
27539
27540 !! test
27541 Image: Block level image should have \n before and after
27542 !! wikitext
27543 123
27544 [[File:Foobar.jpg|right|thumb|150x150px]]
27545 456
27546 !! html/parsoid
27547 <p>123</p>
27548 <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>
27549 <p>456</p>
27550 !! end
27551
27552 !! test
27553 Image: New block level image should have \n before and after (existing content)
27554 !! wikitext
27555 123
27556 [[File:Foobar.jpg|right|thumb|150x150px]]
27557 456
27558 !! html/parsoid
27559 <p>123</p>
27560 <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>
27561 <p>456</p>
27562 !! end
27563
27564 !! test
27565 Image: upright option (parsoid)
27566 !! wikitext
27567 [[File:Foobar.jpg|thumb|upright|caption]]
27568 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27569 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27570 !! html/parsoid
27571 <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>
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/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
27573 <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>
27574 !! end
27575
27576 !! test
27577 Image: upright option is ignored on inline and frame images (parsoid)
27578 !! wikitext
27579 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27580 !! html/parsoid
27581 <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>
27582 !! end
27583
27584 !! test
27585 Image: in template parameter with empty parameter
27586 !! wikitext
27587 {{echo|[[File:Foobar.jpg|link=]]}}
27588 !! html/parsoid
27589 <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>
27590 !! end
27591
27592 !! test
27593 Image: from basic HTML (1)
27594 !! options
27595 parsoid=html2wt
27596 !! html/parsoid
27597 <span typeof="mw:Image">
27598 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27599 </span>
27600 !! wikitext
27601 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27602 !! end
27603
27604 !! test
27605 Image: from basic HTML (2)
27606 !! options
27607 parsoid=html2wt
27608 !! html/parsoid
27609 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27610 !! wikitext
27611 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27612 !! end
27613
27614 !! test
27615 Image: from basic HTML (3)
27616 !! options
27617 parsoid=html2wt
27618 !! html/parsoid
27619 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27620 !! wikitext
27621 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27622 !! end
27623
27624 !! test
27625 Image: from basic HTML (4)
27626 !! options
27627 parsoid=html2wt
27628 !! html/parsoid
27629 <img src="./File:Foobar.jpg">
27630 !! wikitext
27631 [[File:Foobar.jpg|link=]]
27632 !! end
27633
27634 !! test
27635 Image: Invalid title as link
27636 !! wikitext
27637 [[File:Foobar.jpg|link=<]]
27638 !! html/php
27639 <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>
27640 </p>
27641 !! html/parsoid
27642 <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>
27643 !! end
27644
27645 !! test
27646 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27647 !! options
27648 parsoid=html2wt
27649 !! html/parsoid
27650 <ul>
27651 <li><p>foo</p></li>
27652 </ul>
27653 !! wikitext
27654 * foo
27655 !! end
27656
27657 !! test
27658 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27659 !! options
27660 parsoid=html2wt
27661 !! html/parsoid
27662 <ul> <li>foo</li></ul>
27663 !! wikitext
27664 * foo
27665 !! end
27666
27667 !! test
27668 Don't strip leading whitespace when handling indent-pre suppressing tags
27669 !! options
27670 parsoid=html2wt
27671 !! html/parsoid
27672 <table>
27673 <tr><td> indented row</td></tr>
27674 </table>
27675 <blockquote><p>
27676 <b>This is very bold of you!</b>
27677 </p>
27678 <table><tr><td>
27679 indented cell (no pre-wrapping!)
27680 </td></tr></table>
27681 </blockquote>
27682 <p>foo</p>
27683 <div>bar</div>
27684 !! wikitext
27685 {|
27686 | indented row
27687 |}
27688 <blockquote>
27689 '''This is very bold of you!'''
27690
27691 {|
27692 |
27693 indented cell (no pre-wrapping!)
27694 |}
27695 </blockquote>
27696 foo
27697 <div>bar</div>
27698 !! end
27699
27700 !! test
27701 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27702 !! options
27703 parsoid=html2wt
27704 !! html/parsoid
27705 <p>foo</p>
27706 <span>bar</span>
27707
27708 <span>foo2
27709 </span>bar2
27710
27711 <div>foo</div>
27712 <span>bar</span>
27713
27714 <div>
27715 <span>foo</span>
27716 </div>
27717 !! wikitext
27718 foo
27719
27720 <span>bar</span>
27721
27722 <span>foo2
27723 <nowiki> </nowiki></span>bar2
27724
27725 <div>foo</div>
27726 <nowiki> </nowiki><span>bar</span>
27727
27728 <div>
27729 <nowiki> </nowiki><span>foo</span>
27730 </div>
27731 !! end
27732
27733 !! test
27734 Lists: Dont insert newlines in a serialized list item.
27735 !! options
27736 parsoid=html2wt
27737 !! html/parsoid
27738 <ul><li>a<br>b</li><li>c</li></ul>
27739 !! wikitext
27740 * a<br />b
27741 * c
27742 !! end
27743
27744 !! test
27745 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27746 !! options
27747 parsoid={
27748 "modes": ["html2wt"],
27749 "scrubWikitext": false
27750 }
27751 !! html/parsoid
27752 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27753 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27754
27755 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27756 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27757
27758 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27759
27760 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27761 !! wikitext
27762 == hello there [[Category:A1]] ==
27763
27764 == [[Category:A2]] hi pal ==
27765
27766 == <!--foo--> [[Category:A3]] how goes it ==
27767
27768 == it goes well [[Category:A4]] <!--bar--> ==
27769
27770 ==howdy [[Category:A5]]==
27771
27772 == __TOC__ ok ==
27773 !! end
27774
27775 !! test
27776 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27777 !! options
27778 parsoid={
27779 "modes": ["html2wt"],
27780 "scrubWikitext": true
27781 }
27782 !! html/parsoid
27783 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27784 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27785
27786 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27787 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27788
27789 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27790 !! wikitext
27791 == hello there ==
27792 [[Category:A1]]
27793 [[Category:A2]]
27794
27795 == hi pal ==
27796
27797 <!--foo--> [[Category:A3]]
27798
27799 == how goes it ==
27800
27801 == it goes well ==
27802 [[Category:A4]] <!--bar-->
27803
27804 __TOC__
27805
27806 == ok ==
27807 !! end
27808
27809 !! test
27810 Headings: Don't hoist metas that come from templates
27811 !! options
27812 parsoid={
27813 "modes": ["html2wt"],
27814 "scrubWikitext": true
27815 }
27816 !! html/parsoid
27817 <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>
27818 !! wikitext
27819 == {{echo|foo [[Category:Foo]]}} ==
27820 !! end
27821
27822 !! test
27823 Headings: Category in ref isn't hoisted
27824 !! options
27825 parsoid={
27826 "modes": ["html2wt"],
27827 "scrubWikitext": true
27828 }
27829 !! html/parsoid
27830 <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>
27831
27832 <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>
27833 !! wikitext
27834 == foo <ref>bar
27835 [[Category:Baz]] </ref> ==
27836
27837 <references />
27838 !! end
27839
27840 !! test
27841 Parsoid: Serialize positional parameters with = in them as named parameter
27842 !! options
27843 parsoid=html2wt
27844 !! html/parsoid
27845 <p about="#mwt1" typeof="mw:Transclusion"
27846 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27847
27848 <p about="#mwt1" typeof="mw:Transclusion"
27849 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27850
27851 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27852 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27853 <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>
27854 !! wikitext
27855 {{echo|1=f=oo}}
27856
27857 {{echo|1=f=oo|2=bar}}
27858
27859 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27860 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27861 {{echo|<nowiki>f=oo</nowiki>|bar}}
27862 !! end
27863
27864 !! test
27865 Parsoid: Serialize positional parameters with = in extlink as named parameter
27866 !! options
27867 parsoid=html2wt
27868 !! html/parsoid
27869 <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>
27870 !! wikitext
27871 {{echo|1=http://stuff?is=ok}}
27872 !! end
27873
27874 !! test
27875 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27876 !! options
27877 parsoid=html2wt
27878 !! html/parsoid
27879 <div>a<p>b</p></div>
27880 <div>a
27881 <p>b</p></div>
27882 <div>
27883 a
27884 <p>b</p></div>
27885 !! wikitext
27886 <div>a
27887 b
27888 </div>
27889 <div>a
27890 b
27891 </div>
27892 <div>
27893 a
27894
27895 b
27896 </div>
27897 !! end
27898
27899 !! test
27900 Substrings resembling wikitext in hrefs should not get nowiki escapes
27901 !! options
27902 parsoid=html2wt
27903 !! html/parsoid
27904 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27905 !! wikitext
27906 [[Foo''bar''baz]]
27907 !! end
27908
27909 !! test
27910 Enforce single-line context in the serializer
27911 !! options
27912 parsoid=html2wt
27913 !! html/parsoid
27914 <h2>testing
27915 123</h2>
27916
27917 <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">
27918 </span><span about="#mwt1">you</span> </h2>
27919
27920 <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>
27921
27922 <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
27923 there</span></li></ol>
27924
27925 <ul><li>asd
27926 sdf</li></ul>
27927
27928 <ul><li>foo
27929 bar
27930 baz</li>
27931 <li>foo <b>bar</b>
27932 baz</li></ul>
27933
27934 <dl><dt>hi
27935 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27936 ho</dd></dl>
27937
27938 <dl><dd> <table>
27939 <tbody><tr><td> ha
27940 ha
27941 ha</td></tr>
27942 </tbody></table></dd></dl>
27943 !! wikitext
27944 == testing 123 ==
27945
27946 == hi {{bogus|there
27947 you}} ==
27948
27949 == foo <ref>hello
27950 there</ref> ==
27951
27952 <references />
27953
27954 * asd sdf
27955
27956 * foo bar baz
27957 * foo '''bar''' baz
27958
27959 ; hi ho : hi ho
27960
27961 : {|
27962 | ha
27963 ha
27964 ha
27965 |}
27966 !! end
27967
27968 !! test
27969 Serialize new placeholder space without spans
27970 !! options
27971 parsoid=html2wt
27972 !! html/parsoid
27973 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27974
27975 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27976
27977 <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>
27978 !! wikitext
27979 foo : bar
27980
27981 foo : bar
27982
27983 <ref>foo : bar</ref>ok
27984 !! end
27985
27986
27987 #-----------------------
27988 # Tag minimization tests
27989 #-----------------------
27990
27991 !! test
27992 1. I/B quote minimization: wikitext-only tags should be combined
27993 !! options
27994 parsoid=html2wt
27995 !! html/parsoid
27996 <p><i>A</i><i>B</i></p>
27997 <p><b>A</b><b>B</b></p>
27998 <p><i>A</i><b><i>B</i></b></p>
27999 <p><b>A</b><i><b>B</b></i></p>
28000 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28001 <p><i><b>A</b></i><i><b>B</b></i></p>
28002 <p><i><b>A</b></i><b><i>B</i></b></p>
28003 <p><b><i>A</i></b><i><b>B</b></i></p>
28004 !! wikitext
28005 ''AB''
28006
28007 '''AB'''
28008
28009 ''A'''B'''''
28010
28011 '''A''B'''''
28012
28013 '''A''BC''D'''
28014
28015 '''''AB'''''
28016
28017 '''''AB'''''
28018
28019 '''''AB'''''
28020 !! end
28021
28022 !! test
28023 2. I/B quote minimization: wikitext and html tags should not be combined
28024 !! options
28025 parsoid=html2wt
28026 !! html/parsoid
28027 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28028 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28029 !! wikitext
28030 ''A''<i>B</i>
28031
28032 ''A''<nowiki/>'''<i>B</i>'''
28033 !! end
28034
28035 !! test
28036 3. I/B quote minimization: templated content stops minimization
28037 !! options
28038 parsoid=html2wt
28039 !! html/parsoid
28040 <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>
28041 <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>
28042 !! wikitext
28043 ''A''{{echo|''B''}}
28044
28045 ''A''{{echo|'''''B'''''}}
28046 !! end
28047
28048 !! test
28049 4. I/B quote minimization: new content should be mimimized with adjacent old content
28050 !! options
28051 parsoid=html2wt
28052 !! html/parsoid
28053 <p><i>A</i><i>B</i></p>
28054 <p><b>A</b><b>B</b></p>
28055 <p><i>A</i><b><i>B</i></b></p>
28056 !! wikitext
28057 ''AB''
28058
28059 '''AB'''
28060
28061 ''A'''B'''''
28062 !! end
28063
28064 !! test
28065 5a. Merge adjacent quote nodes if they've been edited
28066 !! options
28067 parsoid={
28068 "modes": ["wt2wt", "selser"],
28069 "changes": [
28070 ["p", "contents", "remove", ":contains('b')"]
28071 ]
28072 }
28073 !! wikitext
28074 ''a''b''c''
28075 !! wikitext/edited
28076 ''ac''
28077 !! end
28078
28079 !! test
28080 5b. Merge adjacent quote nodes if they've been edited
28081 !! options
28082 parsoid={
28083 "modes": ["wt2wt", "selser"],
28084 "changes": [
28085 ["#x", "remove"]
28086 ]
28087 }
28088 !! wikitext
28089 ''a''<span id="x">b</span>''c''
28090 !! wikitext/edited
28091 ''ac''
28092 !! end
28093
28094 !! test
28095 1. Merge adjacent link nodes as long as at least one element is new
28096 !! options
28097 parsoid={
28098 "modes": ["html2wt"],
28099 "scrubWikitext": true
28100 }
28101 !! html/parsoid
28102 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28103 <a data-parsoid="{}" 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 data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28105 !! wikitext
28106 [[Football]]
28107 [[Football]]
28108 [[Football|Foot]][[Football|ball]]
28109 !! end
28110
28111 !! test
28112 2. Merge adjacent link nodes and enable additional normalizations
28113 !! options
28114 parsoid={
28115 "modes": ["html2wt"],
28116 "scrubWikitext": true
28117 }
28118 !! html/parsoid
28119 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28120 !! wikitext
28121 [[Football|''Football'']]
28122 !! end
28123
28124 !! test
28125 3. Don't merge adjacent link nodes if scrubWikitext is false
28126 !! options
28127 parsoid={
28128 "modes": ["html2wt"],
28129 "scrubWikitext": false
28130 }
28131 !! html/parsoid
28132 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28133 !! wikitext
28134 [[Football|Foot]][[Football|ball]]
28135 !! end
28136
28137 #------------------------------
28138 # End of tag minimization tests
28139 #------------------------------
28140
28141 !!test
28142 T56262: New entities
28143 !! options
28144 parsoid=html2wt
28145 !! html/parsoid
28146 <span typeof="mw:Entity">&nbsp;</span>
28147 !! wikitext
28148 &nbsp;
28149 !! end
28150
28151 ## Note that there is no wikitext output for 'unknownproperty' ##
28152 ## Unknown magic words are silently dropped ##
28153
28154 !! test
28155 Magic words
28156 !! options
28157 parsoid=html2wt
28158 !! html/parsoid
28159 <meta property='mw:PageProp/toc' />
28160 <meta property='mw:PageProp/notoc' />
28161 <meta property='mw:PageProp/forcetoc' />
28162 <meta property='mw:PageProp/index' />
28163 <meta property='mw:PageProp/noindex' />
28164 <meta property='mw:PageProp/nogallery' />
28165 <meta property='mw:PageProp/noeditsection' />
28166 <meta property='mw:PageProp/notitleconvert' />
28167 <meta property='mw:PageProp/nocontentconvert' />
28168 <meta property='mw:PageProp/unknownproperty' />
28169 !! wikitext
28170 __TOC__
28171 __NOTOC__
28172 __FORCETOC__
28173 __INDEX__
28174 __NOINDEX__
28175 __NOGALLERY__
28176 __NOEDITSECTION__
28177 __NOTITLECONVERT__
28178 __NOCONTENTCONVERT__
28179 !! end
28180
28181 !! test
28182 Consecutive <pre>s should not get merged
28183 !! options
28184 parsoid=html2wt,html2html
28185 !! html/parsoid
28186 <pre>a</pre><pre>b</pre>
28187
28188 <pre>c
28189 </pre><pre>
28190 d</pre>
28191
28192 <pre>e
28193
28194 </pre><pre>
28195
28196 f</pre>
28197 !! wikitext
28198 a
28199
28200 b
28201
28202 c
28203
28204 d
28205
28206 e
28207
28208
28209
28210 f
28211 !! end
28212
28213 !! test
28214 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28215 !! options
28216 parsoid=html2wt
28217 !! html/parsoid
28218 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28219 !! wikitext
28220 [[Special:BookSources/1234567890|ISBN 1234567895]]
28221 !! end
28222
28223 !! test
28224 Edited RFC links not serializable as RFC links should serialize as extlinks
28225 !! options
28226 parsoid=html2wt
28227 !! html/parsoid
28228 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28229 !! wikitext
28230 [https://tools.ietf.org/html/rfc123 New RFC]
28231 !! end
28232
28233 !! test
28234 Edited PMID links not serializable as PMID links should serialize as extlinks
28235 !! options
28236 parsoid=html2wt
28237 !! html/parsoid
28238 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28239 !! wikitext
28240 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28241 !! end
28242
28243 !! test
28244 WTS of autolinks with trailing/surrounding context
28245 !! options
28246 parsoid=html2wt
28247 !! html/parsoid
28248 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28249 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28250 <p><b><a href="http://cscott.net">http://cscott.net</a></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>x</b></p>
28253 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28254 !! wikitext
28255 http://cscott.net'''foo'''
28256
28257 http://cscott.net<b>foo</b>
28258
28259 '''http://cscott.net'''
28260
28261 '''http://cscott.net '''
28262
28263 '''http://cscott.net<nowiki/>x'''
28264
28265 http://cscott.net<nowiki/>x
28266 !! end
28267
28268 !! test
28269 WTS of autolinks with nowikis (round-trip)
28270 !! wikitext
28271 x<nowiki/>http://cscott.net<nowiki/>x
28272 !! html/parsoid
28273 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28274 !! end
28275
28276 # this is the "easy" test because it leaves in place all the
28277 # data-parsoid information indicating this is an autolink
28278 !! test
28279 WTS of autolinks with escapes (editing)
28280 !! options
28281 parsoid={
28282 "modes": ["wt2wt"],
28283 "changes": [
28284 [ "span", "remove" ]
28285 ]
28286 }
28287 !! wikitext
28288 x<nowiki/>http://cscott.net<nowiki/>x
28289 !! wikitext/edited
28290 x<nowiki/>http://cscott.net<nowiki/>x
28291 !! end
28292
28293 !! test
28294 WTS of edited autolink-like text (T103364)
28295 !! options
28296 parsoid={
28297 "modes": ["wt2wt"],
28298 "changes": [
28299 [ "span[typeof]", "removeAttr", "typeof" ]
28300 ]
28301 }
28302 !! wikitext
28303 Not a link: <nowiki>http://example.com</nowiki>.
28304 !! wikitext/edited
28305 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28306 !! end
28307
28308 !! test
28309 WTS of newly-authored autolink-like text (T103364)
28310 !! options
28311 parsoid=html2wt
28312 !! html/parsoid
28313 <p>http://example.com is not a link.</p>
28314 !! wikitext
28315 <nowiki>http://example.com</nowiki> is not a link.
28316 !! end
28317
28318 !! test
28319 WTS of autolink-like text after an autolink (T108563)
28320 !! options
28321 parsoid=html2wt
28322 !! html/parsoid
28323 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28324 !! wikitext
28325 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28326 !! end
28327
28328 !! test
28329 Magic links inside links (not autolinked)
28330 !! wikitext
28331 [[Foo|http://example.com]]
28332 [[Foo|RFC 1234]]
28333 [[Foo|PMID 1234]]
28334 [[Foo|ISBN 123456789x]]
28335
28336 [http://foo.com http://example.com]
28337 [http://foo.com RFC 1234]
28338 [http://foo.com PMID 1234]
28339 [http://foo.com ISBN 123456789x]
28340 !! html+tidy
28341 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28342 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28343 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28344 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28345 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28346 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28347 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28348 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28349 </p>
28350 !! html/parsoid
28351 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28352 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28353 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28354 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28355
28356 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28357 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28358 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28359 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28360 !! end
28361
28362 !! test
28363 Magic links inside image captions (autolinked)
28364 !! wikitext
28365 [[File:Foobar.jpg|thumb|http://example.com]]
28366 [[File:Foobar.jpg|thumb|RFC 1234]]
28367 [[File:Foobar.jpg|thumb|PMID 1234]]
28368 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28369 !! html+tidy
28370 <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>
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 class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</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-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 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 href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div></div></div>
28374 !! html/parsoid
28375 <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>
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 href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external text">RFC 1234</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="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 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="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
28379 !! end
28380
28381 !! test
28382 WTS of magic word text (T109371)
28383 !! options
28384 parsoid=html2wt
28385 !! html/parsoid
28386 <p>RFC 1234</p>
28387 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28388 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28389 !! wikitext
28390 <nowiki>RFC 1234</nowiki>
28391
28392 [http://foo.com RFC 1234]
28393
28394 [[Foo|RFC 1234]]
28395 !! end
28396
28397 !! test
28398 Edited Redirect link should emit a non-piped wikitext link
28399 !! options
28400 parsoid=html2wt
28401 !! html/parsoid
28402 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28403 !! wikitext
28404 #REDIRECT [[Bar]]
28405 !! end
28406
28407 !! test
28408 T75121: Infer extension name from typeOf if data-mw is not present
28409 !! options
28410 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28411 !! html/parsoid
28412 <div typeOf="mw:Extension/foo"></div>
28413 !! wikitext
28414 <foo />
28415 !! end
28416
28417 # Note that the <p> wrapping isn't present in PHP parser output
28418 # The important thing for this test is that P-wrapping doesn't
28419 # interfere with the <nowiki> protection for leading - in <td>
28420 # (which isn't necessary for <th>).
28421 !! test
28422 T88318: p-wrapped dash in table.
28423 !! options
28424 parsoid=html2wt,wt2wt
28425 !! html/parsoid
28426 <table><tbody>
28427 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28428 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28429 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28430 </tbody></table>
28431 !! wikitext
28432 {|
28433 !-
28434 !-
28435 |-
28436 |<nowiki>-</nowiki>
28437 |<nowiki>- </nowiki>
28438 |-
28439 |<small>-</small>
28440 |<br />
28441 -
28442 |<br />
28443 -
28444 |}
28445 !! html/php+tidy
28446 <table>
28447 <tbody><tr>
28448 <th>-
28449 </th>
28450 <th>-
28451 </th></tr>
28452 <tr>
28453 <td>-
28454 </td>
28455 <td>-
28456 </td></tr>
28457 <tr>
28458 <td><small>-</small>
28459 </td>
28460 <td><br />
28461 <p>-
28462 </p>
28463 </td>
28464 <td><br />
28465 <p>-
28466 </p>
28467 </td></tr></tbody></table>
28468 !! end
28469
28470 !! test
28471 T149209: WTS: Handle newlines in table cells properly
28472 !! options
28473 parsoid=html2wt
28474 !! html/parsoid
28475 <table>
28476 <tbody>
28477 <tr><td>a
28478 b
28479 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28480 <tr><td><p>x</p>
28481 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28482 </tbody></table>
28483 <table>
28484 <tbody>
28485 <tr><th>a
28486 b
28487 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28488 <tr><th><p>x</h>
28489 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28490 </tbody></table>
28491 !! wikitext
28492 {|
28493 |a
28494 b
28495 |c
28496 |-
28497 |x
28498 {{!}}y
28499 |}
28500 {|
28501 !a
28502 b
28503 !c
28504 |-
28505 !x
28506 !y
28507 |}
28508 !! end
28509
28510 !! test
28511 T149209: Selser: Handle newlines in table cells properly
28512 !! options
28513 parsoid={
28514 "modes": ["selser"],
28515 "changes": [
28516 [ "#h1", "html", "a\nb\n" ],
28517 [ "#h2", "html", "a\nb\n" ],
28518 [ "#c1", "html", "a\nb\n" ],
28519 [ "#c2", "html", "<p>a</p>" ],
28520 [ "#c3", "html", "<p>a</p>" ],
28521 [ "#c4", "html", "edit-me<p>a</p>" ]
28522 ]
28523 }
28524 !! wikitext
28525 {|
28526 ! id="h1" |edit-me!!1
28527 |-
28528 ! id="h2" |edit-me||2
28529 |-
28530 | id="c1" |edit-me||3
28531 |-
28532 | id="c2" |edit-me||4
28533 |-
28534 | id="c3" |edit-me||p||q||r
28535 |-
28536 | id="c4" |edit-me||p||q||r
28537 |}
28538 !! wikitext/edited
28539 {|
28540 ! id="h1" |a
28541 b
28542 !1
28543 |-
28544 ! id="h2" |a
28545 b
28546 !2
28547 |-
28548 | id="c1" |a
28549 b
28550 |3
28551 |-
28552 | id="c2" |a
28553 |4
28554 |-
28555 | id="c3" |a
28556 |p||q||r
28557 |-
28558 | id="c4" |edit-me
28559 a
28560 |p||q||r
28561 |}
28562 !! end
28563
28564 !! test
28565 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28566 !! options
28567 parsoid=html2wt
28568 !! html/parsoid
28569 <table id='mwAb'>
28570 <td id='mwAc'>foo</td>
28571 <td id='serialize-this'>bar</td>
28572 </table>
28573 !! wikitext
28574 {|
28575 |foo
28576 | id="serialize-this" |bar
28577 |}
28578 !! end
28579
28580 !! test
28581 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28582 !! options
28583 parsoid=html2wt
28584 !! html/parsoid
28585 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28586 !! wikitext
28587 <div id="hello">ok</div>
28588 !! end
28589
28590 !! test
28591 WTS change modes
28592 !! options
28593 parsoid={
28594 "modes": ["wt2wt"],
28595 "changes": [
28596 [ "#xyz", "before", "<b>before</b> stuff " ],
28597 [ "#xyz", "after", " stuff <i>after</i>" ],
28598 [ "#xyz", "html", "x <b>y</b> z" ]
28599 ]
28600 }
28601 !! wikitext
28602 <span id="xyz">hello</span>
28603 !! wikitext/edited
28604 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28605 !! end
28606
28607 !! test
28608 Never serialize a-tag as html, regardless of what data-parsoid has to say
28609 !! options
28610 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28611 !! html/parsoid
28612 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28613 !! wikitext
28614 [[Foo]]
28615 !! end
28616
28617 ## SSS FIXME: This is broken output nevertheless.
28618 ## What might be a reasonable non-broken output for this?
28619 ## This is an edge case unlikely to be seen in production
28620 ## that I am not wasting more time on this right now.
28621 !! test
28622 Never serialize a-tag as html, no matter what attributes it has
28623 !! options
28624 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28625 !! html/parsoid
28626 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28627 !! wikitext
28628 [http://boo.org http://boohoo.org]
28629 !! end
28630
28631 # Misnested is an indication that selser can reuse the source but these have
28632 # shown to sneak through on occasion. See T101768.
28633 # The original wikitext here is: [http://test.com [[one]] two three]
28634 !! test
28635 Strip span tags added to mark misnested links
28636 !! options
28637 parsoid=html2wt
28638 !! html/parsoid
28639 <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>
28640 !! wikitext
28641 [http://test.com][[one]] two three
28642 !! end
28643
28644 !! test
28645 Catch regression when unpacking misnested links
28646 !! options
28647 parsoid=wt2html
28648 !! wikitext
28649 {{echo|hi}}[http://example.com [[ho]]]
28650 !! html/parsoid
28651 <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>
28652 !! end
28653
28654 !! test
28655 Catch regression when unpacking with trailing content
28656 !! wikitext
28657 {{echo|Foo <references/> bar}}
28658 !! html/parsoid
28659 <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>
28660 !! end
28661
28662 !! test
28663 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28664 !! options
28665 parsoid=html2wt
28666 !! html/parsoid
28667 <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|}"]}'>
28668 <tbody><tr><td>d
28669 </td></tr>
28670 </tbody></table>
28671 !! wikitext
28672 {{echo|a}}
28673 {|{{echo|c
28674 {{!}}d
28675 }}
28676 |}
28677 !! end
28678
28679 ## This test verifies the presence and computation of this attribute indirectly
28680 ## by making an edit and ensuring that the serialization is correct (which it would be
28681 ## only if firstWikitextNode is properly set).
28682 !! test
28683 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28684 !! options
28685 parsoid= {
28686 "modes": ["wt2wt"],
28687 "changes": [
28688 [ "div#x", "remove" ],
28689 [ "div", "before", "<div>new</div>" ]
28690 ]
28691 }
28692 !! wikitext
28693 <div id="x">foo</div>
28694 {|
28695 {{echo|<div>boo</div>
28696 {{!}}b}}
28697 |c
28698 |}
28699 !! wikitext/edited
28700
28701 <div>new</div>
28702 {|
28703 {{echo|<div>boo</div>
28704 {{!}}b}}
28705 |c
28706 |}
28707 !! end
28708
28709 # --------------------------------------------
28710 # Tests spec'ing wikitext serialization norms |
28711 # --------------------------------------------
28712
28713 !! test
28714 Serialize multi-line indent-pre starting with wikitext syntax
28715 !! options
28716 parsoid=html2wt
28717 !! html/parsoid
28718 <pre>* 1
28719 ** 2
28720 * 3</pre>
28721 !! wikitext
28722 * 1
28723 ** 2
28724 * 3
28725 !! end
28726
28727 !! test
28728 1. Categories should always be serialized on their own line
28729 !! options
28730 parsoid=html2wt
28731 !! html/parsoid
28732 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28733 !! wikitext
28734 foo
28735 [[Category:Foo]]
28736 bar
28737 !! end
28738
28739 !! test
28740 2. Categories that are part of templates should not introduce a line break
28741 !! wikitext
28742 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28743 !! html/parsoid
28744 <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>
28745 !! end
28746
28747 # Careful while editing these next 2 tests. There are \u200f characters
28748 # before and after the <link> tags in the HTML and following some
28749 # of the categories in wikitext
28750 # Do not remove these characters in edits.
28751 #
28752 # As part of the serialization, these bidi characters will get stripped.
28753 !! test
28754 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28755 !! options
28756 parsoid={
28757 "modes": ["html2wt"],
28758 "scrubWikitext": true
28759 }
28760 !! html/parsoid
28761 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28762 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28763 !! wikitext
28764 [[קטגוריה:טקסים]]
28765 [[קטגוריה: שיטות משפט]]
28766 !! end
28767
28768 !! test
28769 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28770 !! options
28771 parsoid={
28772 "modes": ["html2wt"],
28773 "scrubWikitext": true
28774 }
28775 !! html/parsoid
28776 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28777 !! wikitext
28778 [[קטגוריה:טקסים]]
28779 ‏y
28780 !! end
28781
28782 !! test
28783 Lists: Add space after bullets
28784 !! options
28785 parsoid=html2wt
28786 !! html/parsoid
28787 <ul>
28788 <li>foo</li>
28789 <li> bar</li>
28790 <li><span> baz</span></li>
28791 </ul>
28792 !! wikitext
28793 * foo
28794 * bar
28795 * <span> baz</span>
28796 !! end
28797
28798 !! test
28799 1. Headings: Add space before/after == (T53744)
28800 !! options
28801 parsoid=html2wt
28802 !! html/parsoid
28803 <h2>foo</h2>
28804 <h2> bar</h2>
28805 <h2>baz </h2>
28806 <h2><span> baz</span></h2>
28807 !! wikitext
28808 == foo ==
28809
28810 == bar ==
28811
28812 == baz ==
28813
28814 == <span> baz</span> ==
28815 !! end
28816
28817 !! test
28818 2. Headings: Add space before/after == even after hoisted content
28819 !! options
28820 parsoid={
28821 "modes": ["html2wt"],
28822 "scrubWikitext": true
28823 }
28824 !! html/parsoid
28825 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28826 !! wikitext
28827 [[Category:A2]]
28828
28829 == ok ==
28830 !! end
28831
28832 !! test
28833 1. Headings: suppress newly created empty headings
28834 !! options
28835 parsoid={
28836 "modes": ["html2wt"],
28837 "scrubWikitext": true
28838 }
28839 !! html/parsoid
28840 <h2></h2>
28841 !! wikitext
28842 !! end
28843
28844 !! test
28845 2. Headings: don't suppress empty headings if scrubWikitext is false
28846 !! options
28847 parsoid=html2wt
28848 !! html/parsoid
28849 <h2></h2>
28850 !! wikitext
28851 ==<nowiki/>==
28852 !! end
28853
28854 !! test
28855 3. Headings: suppress empty headings on edits
28856 !! options
28857 parsoid={
28858 "modes": ["selser"],
28859 "scrubWikitext": true,
28860 "changes": [
28861 [ "#x", "remove"]
28862 ]
28863 }
28864 !! wikitext
28865 ==<span id="x">foo</span>==
28866 !! wikitext/edited
28867 !! end
28868
28869 !! test
28870 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28871 !! options
28872 parsoid={
28873 "modes": ["html2wt"],
28874 "scrubWikitext": true
28875 }
28876 !! html/parsoid
28877 <h2>foo<br/>bar</h2>
28878 <h2>foo <span><br/>bar</span> baz</h2>
28879 !! wikitext
28880 == foo bar ==
28881
28882 == foo <span> bar</span> baz ==
28883 !! end
28884
28885 !! test
28886 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28887 !! options
28888 parsoid={
28889 "modes": ["html2wt"],
28890 "scrubWikitext": false
28891 }
28892 !! html/parsoid
28893 <h2>foo<br/>bar</h2>
28894 !! wikitext
28895 == foo<br /> bar ==
28896 !! end
28897
28898 !! test
28899 1. WT Quote Tags: suppress newly created empty style tags
28900 !! options
28901 parsoid={
28902 "modes": ["html2wt"],
28903 "scrubWikitext": true
28904 }
28905 !! html/parsoid
28906 <i></i><b></b>
28907 !! wikitext
28908 !! end
28909
28910 !! test
28911 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28912 !! options
28913 parsoid=html2wt
28914 !! html/parsoid
28915 <i></i><b></b>
28916 !! wikitext
28917 ''<nowiki/>'''''<nowiki/>'''
28918 !! end
28919
28920 !! test
28921 3. WT Quote Tags: suppress empty style tags on edits
28922 !! options
28923 parsoid={
28924 "modes": ["selser"],
28925 "scrubWikitext": true,
28926 "changes": [
28927 [ "#x", "remove"]
28928 ]
28929 }
28930 !! wikitext
28931 '''<span id="x">foo</span>'''
28932 !! wikitext/edited
28933 !! end
28934
28935 !! test
28936 1. Anchors: suppress newly created empty anchors
28937 !! options
28938 parsoid={
28939 "modes": ["html2wt"],
28940 "scrubWikitext": true
28941 }
28942 !! html/parsoid
28943 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28944 !! wikitext
28945 !! end
28946
28947 !! test
28948 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28949 !! options
28950 parsoid={
28951 "modes": ["html2wt"],
28952 "scrubWikitext": false
28953 }
28954 !! html/parsoid
28955 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28956 !! wikitext
28957 [[Test|<nowiki/>]]
28958 !! end
28959
28960 !! test
28961 3. Anchors: suppress empty anchors on edits
28962 !! options
28963 parsoid={
28964 "modes": ["selser"],
28965 "scrubWikitext": true,
28966 "changes": [
28967 [ "#x", "remove"]
28968 ]
28969 }
28970 !! wikitext
28971 [[Test|<span id="x">foo</span>]]
28972 !! wikitext/edited
28973 !! end
28974
28975 !! test
28976 3a. Anchors: do not suppress numbered extlinks
28977 !! options
28978 parsoid={
28979 "modes": ["wt2wt"],
28980 "scrubWikitext": true
28981 }
28982 !! wikitext
28983 [http://foo.com]
28984 !! html/parsoid
28985 <a rel="mw:ExtLink" href="http://foo.com"></a>
28986 !! end
28987
28988 !! test
28989 3b. Anchors: do not suppress numbered extlinks
28990 !! options
28991 parsoid={
28992 "modes": ["wt2wt"],
28993 "scrubWikitext": true,
28994 "changes": [
28995 [ "#x", "remove"]
28996 ]
28997 }
28998 !! wikitext
28999 [http://foo.com <span id="x">foo</span>]
29000 !! wikitext/edited
29001 [http://foo.com]
29002 !! end
29003
29004 !!test
29005 Normalizations should be restricted to edited content
29006 !!options
29007 parsoid={
29008 "modes": ["selser"],
29009 "scrubWikitext": true,
29010 "changes": [
29011 [ "h1", "before", "<i></i>"]
29012 ]
29013 }
29014 !!wikitext
29015 a
29016 = =
29017 b
29018 !!wikitext/edited
29019 a
29020 = =
29021 b
29022 !!end
29023
29024 !! test
29025 1. Multiple normalizations (html2wt)
29026 !! options
29027 parsoid={
29028 "modes": ["html2wt"],
29029 "scrubWikitext": true
29030 }
29031 !! html
29032 <h2><i></i></h2>
29033 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29034 </a><b><i></i></b>x</p>
29035 !! wikitext
29036
29037 [[foo]]
29038 x
29039
29040 !! end
29041
29042 !! test
29043 2. Multiple normalizations (selser)
29044 !! options
29045 parsoid={
29046 "modes": ["selser"],
29047 "scrubWikitext": true,
29048 "changes": [
29049 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29050 ]
29051 }
29052 !! wikitext
29053 <span id="x">foo</span>
29054 !! wikitext/edited
29055 <span id="x">foo</span>
29056
29057 x
29058 !! end
29059
29060 !! test
29061 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29062 !! options
29063 parsoid={
29064 "modes": ["html2wt"],
29065 "scrubWikitext": true
29066 }
29067 !! html/parsoid
29068 <p> hi</p>
29069 <p> hello</p>
29070 !! wikitext
29071 hi
29072
29073 hello
29074 !! end
29075
29076 !! test
29077 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29078 !! options
29079 parsoid=html2wt
29080 !! html/parsoid
29081 <p> hi</p>
29082 <p> hello</p>
29083 !! wikitext
29084 <nowiki> </nowiki>hi
29085
29086 <nowiki> </nowiki> hello
29087 !! end
29088
29089 !! test
29090 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29091 !! options
29092 parsoid={
29093 "modes": ["html2wt"],
29094 "scrubWikitext": true
29095 }
29096 !! html/parsoid
29097 <p>Foo
29098 bar
29099 baz</p>
29100
29101 <table><tr><td>Foo
29102 bar
29103 baz bang</td></tr></table>
29104
29105 <p><!--boo--> foo
29106 bar</p>
29107
29108 <p> foo
29109 bar<span>boo</span></p>
29110 !! wikitext
29111 Foo
29112 bar
29113 baz
29114
29115 {|
29116 |Foo
29117 bar
29118 baz bang
29119 |}
29120
29121 <!--boo-->foo
29122 bar
29123
29124 foo
29125 bar<span>boo</span>
29126 !! end
29127
29128 !! test
29129 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29130 !! options
29131 parsoid={
29132 "modes": ["selser"],
29133 "scrubWikitext": true,
29134 "changes": [
29135 [ "p", "html", " a\n b" ]
29136 ]
29137 }
29138 !! wikitext
29139 xyz
29140 !! wikitext/edited
29141 a
29142 b
29143 !! end
29144
29145 !! test
29146 1. New links that end in spaces
29147 !! options
29148 parsoid={
29149 "modes": ["html2wt"],
29150 "scrubWikitext": false
29151 }
29152 !! html/parsoid
29153 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29154 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29155 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29156 !! wikitext
29157 [[Berlin ]]<nowiki/>is the capital of Germany.
29158
29159 [[Foo ]]'''bar'''
29160
29161 [[Boston ]] is a city.
29162 !! end
29163
29164 !! test
29165 2. New links that end in spaces
29166 !! options
29167 parsoid={
29168 "modes": ["html2wt"],
29169 "scrubWikitext": true
29170 }
29171 !! html/parsoid
29172 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29173 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29174 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29175 !! wikitext
29176 [[Berlin]] is the capital of Germany.
29177
29178 [[Foo]] '''bar'''
29179
29180 [[Boston]] is a city.
29181 !! end
29182
29183 !! test
29184 1. Table cells with escapable prefixes
29185 !! options
29186 parsoid={
29187 "modes": ["html2wt"],
29188 "scrubWikitext": false
29189 }
29190 !! html
29191 <table>
29192 <tr><td>a</td></tr>
29193 <tr><td>-</td></tr>
29194 <tr><td>+</td></tr>
29195 </table>
29196 !! wikitext
29197 {|
29198 |a
29199 |-
29200 |<nowiki>-</nowiki>
29201 |-
29202 |<nowiki>+</nowiki>
29203 |}
29204 !! end
29205
29206 !! test
29207 2. Table cells with escapable prefixes
29208 !! options
29209 parsoid={
29210 "modes": ["html2wt"],
29211 "scrubWikitext": true
29212 }
29213 !! html
29214 <table>
29215 <tr><td>a</td></tr>
29216 <tr><td>-</td></tr>
29217 <tr><td>+</td></tr>
29218 </table>
29219 !! wikitext
29220 {|
29221 |a
29222 |-
29223 | -
29224 |-
29225 | +
29226 |}
29227 !! end
29228
29229 !! test
29230 3a. Table cells with escapable prefixes after edits
29231 !! options
29232 parsoid={
29233 "modes": ["selser"],
29234 "scrubWikitext": true,
29235 "changes": [
29236 [ "table tbody tr:first-child td:first-child", "remove"]
29237 ]
29238 }
29239 !! wikitext
29240 {|
29241 |a||-
29242 |}
29243 !! wikitext/edited
29244 {|
29245 | -
29246 |}
29247 !! end
29248
29249 !! test
29250 3b. Table cells with escapable prefixes after edits
29251 !! options
29252 parsoid={
29253 "modes": ["selser"],
29254 "scrubWikitext": true,
29255 "changes": [
29256 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29257 [ "#x", "remove" ]
29258 ]
29259 }
29260 !! wikitext
29261 {|
29262 |pqr
29263 |<span id="x">foo</span>+
29264 |}
29265 !! wikitext/edited
29266 {|
29267 | -
29268 | +
29269 |}
29270 !! end
29271
29272 # FIXME: This test will fail because
29273 # normalization doesn't realize that the id attribute
29274 # will eliminate the escapable scenario
29275 !! test
29276 4a. Table cells without escapable prefixes after edits
29277 !! options
29278 parsoid={
29279 "modes": ["selser"],
29280 "scrubWikitext": true,
29281 "changes": [
29282 [ "#x", "html", "-" ]
29283 ]
29284 }
29285 !! wikitext
29286 {|
29287 | id="x" |abcd
29288 |}
29289 !! wikitext/edited
29290 {|
29291 | id="x" |-
29292 |}
29293 !! end
29294
29295 ## This tests normalizer's ability to discriminate between
29296 ## cells having identical content.
29297 !! test
29298 4b. Table cells without escapable prefixes after edits
29299 !! options
29300 parsoid={
29301 "modes": ["selser"],
29302 "scrubWikitext": true,
29303 "changes": [
29304 [ "td", "html", "-" ]
29305 ]
29306 }
29307 !! wikitext
29308 {|
29309 |a||b
29310 |}
29311 !! wikitext/edited
29312 {|
29313 | -||-
29314 |}
29315 !! end
29316
29317 ## This tests normalizer's ability to not be tripped by
29318 ## comments (and whitespace)
29319 !! test
29320 4c. Table cells without escapable prefixes after edits
29321 !! options
29322 parsoid={
29323 "modes": ["selser"],
29324 "scrubWikitext": true,
29325 "changes": [
29326 [ "table tbody tr td:first-child", "remove" ]
29327 ]
29328 }
29329 !! wikitext
29330 {|
29331 |-
29332 <!--foo--> |a||-
29333 |}
29334 !! wikitext/edited
29335 {|
29336 |-
29337 <!--foo--> | -
29338 |}
29339 !! end
29340
29341 ## This tests normalizer's ability to handle HTML cells
29342 !! test
29343 4d. Table cells without escapable prefixes after edits
29344 !! options
29345 parsoid={
29346 "modes": ["selser"],
29347 "scrubWikitext": true,
29348 "changes": [
29349 [ "td", "html", "-" ]
29350 ]
29351 }
29352 !! wikitext
29353 <table>
29354 <tr><td>a</td></tr>
29355 </table>
29356 !! wikitext/edited
29357 <table>
29358 <tr><td>-</td></tr>
29359 </table>
29360 !! end
29361
29362 ## T111151 Remove font elements without attributes
29363 !! test
29364 5a. font tags without attributes should be dropped in scrubWikitext mode
29365 !! options
29366 parsoid={
29367 "modes": ["html2wt"],
29368 "scrubWikitext": true
29369 }
29370 !! html
29371 <font>foo</font>
29372 <font><font>bar</font></font>
29373 <font class="x">boo</font>
29374 !! wikitext
29375 foo
29376 bar
29377 <font class="x">boo</font>
29378 !! end
29379
29380 !! test
29381 5b. font tags should not be dropped without scrubWikitext being enabled
29382 !! options
29383 parsoid={
29384 "modes": ["html2wt"],
29385 "scrubWikitext": false
29386 }
29387 !! html
29388 <font>foo</font>
29389 !! wikitext
29390 <font>foo</font>
29391 !! end
29392
29393 !! test
29394 Escape nowiki DOM elements
29395 !! options
29396 parsoid=html2wt
29397 !! html/parsoid
29398 <nowiki><i>foo</i></nowiki>
29399 !! wikitext
29400 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29401 !! end
29402
29403 # This is meant to be an interim fix while we go about figuring out
29404 # how to not introduce these trailing <nowiki/>s in the first place.
29405 !! test
29406 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29407 !! options
29408 parsoid=html2wt
29409 !! html/parsoid
29410 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29411 y</p>
29412 <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>
29413 <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>
29414 !! wikitext
29415 x
29416 y
29417
29418 {{echo|
29419 1 = <nowiki/>}}
29420
29421 {{echo|
29422 1 = <nowiki/>
29423 }}
29424 !! end
29425
29426 # ---------------------------------------------------
29427 # End of tests spec'ing wikitext serialization norms |
29428 # ---------------------------------------------------
29429
29430 # T104032
29431 !! test
29432 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29433 !! options
29434 parsoid=html2wt
29435 !! html/parsoid
29436 a<p>b</p>
29437 <b>c</b><p>d</p>
29438 <table><tr>
29439 <td>a<p>b</p></td>
29440 <td><b>c</b><p>d</p></td>
29441 </tr></table>
29442 !! wikitext
29443 a
29444
29445 b
29446
29447 '''c'''
29448
29449 d
29450 {|
29451 |a
29452 b
29453 |'''c'''
29454 d
29455 |}
29456 !! end
29457
29458 !! test
29459 Anchor without href scenarios
29460 !! options
29461 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29462 !! html/parsoid
29463 <a class="bc"></a>
29464 <a class="no">dice</a>
29465 <a name="foo"></a>
29466 !! wikitext
29467
29468 dice
29469 <span name="foo"></span>
29470 !! end
29471
29472 !! test
29473 New transclusion added after a list should be serialized after the list
29474 !! options
29475 parsoid=html2wt
29476 !! html/parsoid
29477 <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>
29478 !! wikitext
29479 * a
29480 {{echo|foo}}
29481 !! end
29482
29483 # -----------------------------------------------------------------
29484 # End of section for Parsoid-only html2wt tests for serialization
29485 # of new content
29486 # -----------------------------------------------------------------
29487
29488 # -----------------------------------------------------------------
29489 # The following section of tests are primarily to spec behavior of
29490 # the selective serializer. All these tests have manual selser
29491 # changes. The automated selser changes for all tests handle the
29492 # wide variation of changes, but these tests here capture specs
29493 # deterministically.
29494 # ----------------------------------------------------------------
29495
29496 ## T90517
29497 !! test
29498 Selser: New comments should not be lost
29499 !! options
29500 parsoid={
29501 "modes": ["selser"],
29502 "changes": [
29503 [ "#a", "after", "<!--c1-->" ],
29504 [ "#b", "before", "<!--c2-->" ]
29505 ]
29506 }
29507 !! wikitext
29508 <span id="a">a</span>
29509
29510 <span id="b">b</span>
29511 !! wikitext/edited
29512 <span id="a">a</span><!--c1-->
29513
29514 <!--c2--><span id="b">b</span>
29515 !! end
29516
29517 ## T89383
29518 !! test
29519 Selser: Check for validity of DSR before using it
29520 !! options
29521 parsoid={
29522 "modes": ["selser"],
29523 "changes": [
29524 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29525 ]
29526 }
29527 !! wikitext
29528 <span id="a">a</span>
29529 !! wikitext/edited
29530 {{DISPLAYTITLE:foo}}
29531 <span id="a">a</span>
29532 !! end
29533
29534 !! test
29535 1. DOMDiff: Changes to <ref> content should be looked up using id
29536 !! options
29537 parsoid={
29538 "modes": ["selser"],
29539 "changes": [
29540 ["#X", "after", "bar"],
29541 ["#Y", "after", "baz"]
29542 ]
29543 }
29544 !! wikitext
29545 X <ref><span id="X">foo</span></ref>
29546 Y <ref name="a" />
29547 <references>
29548 <ref name="a"><span id="Y">foo</span></ref>
29549 </references>
29550 !! wikitext/edited
29551 X <ref><span id="X">foo</span>bar</ref>
29552 Y <ref name="a" />
29553 <references>
29554 <ref name="a"><span id="Y">foo</span>baz</ref>
29555 </references>
29556 !! end
29557
29558 !! test
29559 2. DOMDiff: Changes to <ref> content should be looked up using id
29560 !! options
29561 parsoid={
29562 "modes": ["selser"],
29563 "changes": [
29564 ["#Z", "after", "bar"]
29565 ]
29566 }
29567 !! wikitext
29568 A <ref>foo bar for a</ref>
29569 B <ref group="X" name="b" />
29570
29571 <references />
29572
29573 <references group="X">
29574 <ref name="b"><span id="Z">foo</span></ref>
29575 </references>
29576 !! wikitext/edited
29577 A <ref>foo bar for a</ref>
29578 B <ref group="X" name="b" />
29579
29580 <references />
29581
29582 <references group="X">
29583 <ref name="b"><span id="Z">foo</span>bar</ref>
29584 </references>
29585 !! end
29586
29587 !! test
29588 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29589 !! options
29590 parsoid={
29591 "modes": ["selser"],
29592 "changes": [
29593 [ "div:first-child", "text", "bar" ]
29594 ]
29595 }
29596 !! wikitext
29597 <div style="{{1x|color:red;}}%">foo</div>
29598 !! wikitext/edited
29599 <div style="{{1x|color:red;}}%">bar</div>
29600 !! end
29601
29602 !! test
29603 Empty LI (T49673)
29604 !! wikitext
29605 *a
29606 *
29607 *
29608 *b
29609 !! html+tidy
29610 <ul><li>a</li>
29611 <li class="mw-empty-elt"></li>
29612 <li class="mw-empty-elt"></li>
29613 <li>b</li></ul>
29614 !! end
29615
29616 !! test
29617 Thumbnail output
29618 !! wikitext
29619 [[File:Thumb.png|thumb]]
29620 !! html/php+tidy
29621 <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>
29622 !! html/parsoid
29623 <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>
29624 !! end
29625
29626 !! test
29627 unclosed internal link XSS (T137264)
29628 !! wikitext
29629 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29630 !! html/php
29631 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29632 </p>
29633 !! html/parsoid
29634 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29635 !! end
29636
29637 !! test
29638 Validating that <style> isn't eaten by tidy (T167349)
29639 !! options
29640 styletag=1
29641 !! wikitext
29642 <div class="foo">
29643 <style>.foo::before { content: "<foo>"; }</style>
29644 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29645 </div>
29646 !! html/php+tidy
29647 <div class="foo">
29648 <style>.foo::before { content: "<foo>"; }</style>
29649 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29650 </div>
29651 !! end
29652
29653 !! test
29654 Validating that <style> isn't wrapped in a paragraph (T186965)
29655 !! options
29656 styletag=1
29657 !! wikitext
29658 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29659
29660 <style>.foo::before { content: "<foo>"; }</style>
29661
29662 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29663
29664 But if it's on a line with other content, let it be wrapped.
29665
29666 <style>.foo::before { content: "<foo>"; }</style> bar
29667
29668 foo <style>.foo::before { content: "<foo>"; }</style>
29669
29670 foo <style>.foo::before { content: "<foo>"; }</style> bar
29671
29672 And the same if we have non-paragraph-breaking whitespace
29673
29674 foo
29675 <style>.foo::before { content: "<foo>"; }</style>
29676 bar
29677 !! html/php
29678 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29679 </p>
29680 <style>.foo::before { content: "<foo>"; }</style>
29681 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29682 <p>But if it's on a line with other content, let it be wrapped.
29683 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29684 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29685 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29686 </p><p>And the same if we have non-paragraph-breaking whitespace
29687 </p><p>foo
29688 <style>.foo::before { content: "<foo>"; }</style>
29689 bar
29690 </p>
29691 !! end
29692
29693 !! test
29694 Validating that <link> isn't wrapped in a paragraph (T186965)
29695 !! options
29696 styletag=1
29697 !! wikitext
29698 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29699
29700 <link rel="foo" href="bar"/>
29701
29702 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29703
29704 But if it's on a line with other content, let it be wrapped.
29705
29706 <link rel="foo" href="bar"/> bar
29707
29708 foo <link rel="foo" href="bar"/>
29709
29710 foo <link rel="foo" href="bar"/> bar
29711
29712 And the same if we have non-paragraph-breaking whitespace
29713
29714 foo
29715 <link rel="foo" href="bar"/>
29716 bar
29717 !! html/php
29718 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29719 </p>
29720 <link rel="foo" href="bar"/>
29721 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29722 <p>But if it's on a line with other content, let it be wrapped.
29723 </p><p><link rel="foo" href="bar"/> bar
29724 </p><p>foo <link rel="foo" href="bar"/>
29725 </p><p>foo <link rel="foo" href="bar"/> bar
29726 </p><p>And the same if we have non-paragraph-breaking whitespace
29727 </p><p>foo
29728 <link rel="foo" href="bar"/>
29729 bar
29730 </p>
29731 !! end
29732
29733 !! test
29734 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29735 !! config
29736 wgFragmentMode=[ 'html5', 'legacy' ]
29737 !! wikitext
29738 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29739 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29740 !! html/php
29741 <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>
29742 <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>
29743 </p>
29744 !! html/parsoid
29745 <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>
29746 <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>
29747 !! end
29748
29749 !! test
29750 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29751 !! config
29752 wgFragmentMode=[ 'legacy' ]
29753 !! wikitext
29754 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29755 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29756 !! html/php
29757 <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>
29758 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29759 </p>
29760 !! end
29761
29762 !! test
29763 Decoding of HTML entities in embedded HTML tags
29764 !! wikitext
29765 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29766 !! html/php
29767 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29768
29769 !! html/parsoid
29770 <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>
29771 !! end
29772
29773 !! test
29774 Decoding of HTML entities in indicator names for IDs (T104196)
29775 !! options
29776 parsoid=wt2html,html2html
29777 showindicators
29778 !! wikitext
29779 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29780 !! html/php
29781 1&2&3&amp;4&amp;amp;5=Indicator
29782
29783 !! html/parsoid
29784 <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>
29785 !! end
29786
29787 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29788 !! test
29789 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29790 !! options
29791 showindicators
29792 !! wikitext
29793 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29794 !! html/php
29795 1&2&3&amp;4&amp;amp;5=Indicator
29796
29797 !! html/parsoid
29798 <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>
29799 !! end
29800
29801 # This fragment mode is what Parsoid supports.
29802 !! test
29803 HTML5 ids: fallback to legacy
29804 !! config
29805 wgFragmentMode=[ 'html5', 'legacy' ]
29806 !! wikitext
29807 ==Foo bar==
29808
29809 ==foo Bar==
29810
29811 ==Тест==
29812
29813 ==Тест==
29814
29815 ==тест==
29816
29817 ==Hey < # " > % : '==
29818 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29819
29820 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29821
29822 <!-- These two links should produce identical HTML -->
29823 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29824
29825 !! html/php
29826 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29827 <ul>
29828 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29829 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29830 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29831 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29832 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29833 <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>
29834 </ul>
29835 </div>
29836
29837 <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>
29838 <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>
29839 <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>
29840 <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>
29841 <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>
29842 <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>
29843 <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>
29844 </p><p>💩 <span id="💩"></span>
29845 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29846 </p>
29847 !! html/parsoid
29848 <h2 id="Foo_bar">Foo bar</h2>
29849
29850 <h2 id="foo_Bar_2">foo Bar</h2>
29851
29852 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29853
29854 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29855
29856 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29857
29858 <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>
29859 <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>
29860
29861 <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>
29862
29863 <!-- These two links should produce identical HTML -->
29864 <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>
29865 !! end
29866
29867 # Parsoid doesn't support this mode
29868 !! test
29869 HTML5 ids: legacy with a fallback to modern
29870 !! config
29871 wgFragmentMode=[ 'legacy', 'html5' ]
29872 !! wikitext
29873 ==Foo bar==
29874
29875 ==foo Bar==
29876
29877 ==Тест==
29878
29879 ==Тест==
29880
29881 ==тест==
29882
29883 ==Hey < # " > % : '==
29884 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29885
29886 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29887
29888 <!-- These two links should produce identical HTML -->
29889 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29890
29891 !! html/php
29892 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29893 <ul>
29894 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29895 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29896 <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>
29897 <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>
29898 <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>
29899 <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>
29900 </ul>
29901 </div>
29902
29903 <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>
29904 <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>
29905 <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>
29906 <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>
29907 <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>
29908 <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>
29909 <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>
29910 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29911 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29912 </p>
29913 !! end
29914
29915 # Parsoid doesn't support this mode.
29916 !! test
29917 HTML5 ids: no legacy
29918 !! config
29919 wgFragmentMode=[ 'html5' ]
29920 !! wikitext
29921 ==Foo bar==
29922
29923 ==foo Bar==
29924
29925 ==Тест==
29926
29927 ==Тест==
29928
29929 ==тест==
29930
29931 ==Hey < # " > % : '==
29932 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29933
29934 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29935
29936 <!-- These two links should produce identical HTML -->
29937 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29938
29939 !! html/php
29940 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29941 <ul>
29942 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29943 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29944 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29945 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29946 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29947 <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>
29948 </ul>
29949 </div>
29950
29951 <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>
29952 <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>
29953 <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>
29954 <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>
29955 <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>
29956 <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>
29957 <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>
29958 </p><p>💩 <span id="💩"></span>
29959 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29960 </p>
29961 !! end
29962
29963 !! test
29964 T90902: Normalize weird characters in section IDs
29965 !! config
29966 wgFragmentMode=[ 'html5', 'legacy' ]
29967 !! wikitext
29968 ==Foo&nbsp;bar==
29969 [[#Foo&nbsp;bar]]
29970
29971 !! html/php
29972 <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>
29973 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29974 </p>
29975 !! html/parsoid
29976 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
29977 <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>
29978 !! end
29979
29980 !! test
29981 T51672: Test for brackets in attributes of elements in external link texts
29982 !! wikitext
29983 [http://example.com/ link <span title="title with [brackets]">span</span>]
29984 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29985
29986 !! html/php
29987 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29988 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29989 </p>
29990 !! html/parsoid
29991 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
29992 <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>
29993 !! end
29994
29995 !! test
29996 T72875: Test for brackets in attributes of elements in internal link texts
29997 !! wikitext
29998 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
29999 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30000
30001 !! html/php
30002 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30003 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30004 </p>
30005 !! html/parsoid
30006 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30007 <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>
30008 !! end
30009
30010 !! test
30011 T179544: {{anchorencode:}} output should be always usable in links
30012 !! config
30013 wgFragmentMode=[ 'html5' ]
30014 !! wikitext
30015 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30016 !! html/php
30017 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30018 </p>
30019 !! html/parsoid
30020 <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>
30021 !! end
30022
30023 ## ------------------------------
30024 ## Parsoid section-wrapping tests
30025 ## ------------------------------
30026 !! test
30027 Section wrapping for well-nested sections (no leading content)
30028 !! options
30029 parsoid={
30030 "wrapSections": true
30031 }
30032 !! wikitext
30033 =1=
30034 a
30035
30036 =2=
30037 b
30038
30039 ==2.1==
30040 c
30041
30042 ==2.2==
30043 d
30044
30045 ===2.2.1===
30046 e
30047
30048 =3=
30049 f
30050 !! html/parsoid
30051 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30052 <p>a</p>
30053
30054 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30055 <p>b</p>
30056
30057 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30058 <p>c</p>
30059
30060 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30061 <p>d</p>
30062
30063 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30064 <p>e</p>
30065
30066 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30067 <p>f</p>
30068
30069 </section>
30070 !! end
30071
30072 !! test
30073 Section wrapping for well-nested sections (with leading content)
30074 !! options
30075 parsoid={
30076 "wrapSections": true
30077 }
30078 !! wikitext
30079 Para 1.
30080
30081 Para 2 with a <div>nested in it</div>
30082
30083 Para 3.
30084
30085 =1=
30086 a
30087
30088 =2=
30089 b
30090
30091 ==2.1==
30092 c
30093 !! html/parsoid
30094 <section data-mw-section-id="0"><p>Para 1.</p>
30095
30096 <p>Para 2 with a </p><div>nested in it</div>
30097
30098 <p>Para 3.</p>
30099
30100 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30101 <p>a</p>
30102
30103 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30104 <p>b</p>
30105
30106 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30107 <p>c</p>
30108
30109 </section></section>
30110 !! end
30111
30112 !! test
30113 Section wrapping with template-generated sections (good nesting 1)
30114 !! options
30115 parsoid={
30116 "wrapSections": true
30117 }
30118 !! wikitext
30119 =1=
30120 a
30121
30122 {{echo|1=
30123 ==1.1==
30124 b
30125 }}
30126
30127 ==1.2==
30128 c
30129
30130 =2=
30131 d
30132 !! html/parsoid
30133 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30134 <p>a</p>
30135
30136 <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">
30137 </span><p about="#mwt1">b</p>
30138 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30139 <p>c</p>
30140
30141 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30142 <p>d</p></section>
30143 !! end
30144
30145 # In this example, the template scope is mildly expanded to incorporate the
30146 # trailing newline after the transclusion since that is part of section 1.1.1
30147 !! test
30148 Section wrapping with template-generated sections (good nesting 2)
30149 !! options
30150 parsoid={
30151 "wrapSections": true,
30152 "modes": ["wt2html", "wt2wt"]
30153 }
30154 !! wikitext
30155 =1=
30156 a
30157
30158 {{echo|1=
30159 ==1.1==
30160 b
30161 ===1.1.1===
30162 d
30163 }}
30164 =2=
30165 e
30166 !! html/parsoid
30167 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30168 <p>a</p>
30169
30170 <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">
30171 </span><p about="#mwt1">b</p><span about="#mwt1">
30172 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30173 </span><p about="#mwt1">d</p><span about="#mwt1">
30174 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30175 <p>e</p></section>
30176 !! end
30177
30178 # In this example, the template scope is mildly expanded to incorporate the
30179 # trailing newline after the transclusion since that is part of section 1.2.1
30180 !! test
30181 Section wrapping with template-generated sections (good nesting 3)
30182 !! options
30183 parsoid={
30184 "wrapSections": true,
30185 "modes": ["wt2html", "wt2wt"]
30186 }
30187 !! wikitext
30188 =1=
30189 a
30190
30191 {{echo|1=
30192 x
30193 ==1.1==
30194 b
30195 ==1.2==
30196 c
30197 ===1.2.1===
30198 d
30199 }}
30200 =2=
30201 e
30202 !! html/parsoid
30203 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30204 <p>a</p>
30205
30206 <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">
30207 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30208 </span><p about="#mwt1">b</p><span about="#mwt1">
30209 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30210 </span><p about="#mwt1">c</p><span about="#mwt1">
30211 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30212 </span><p about="#mwt1">d</p><span about="#mwt1">
30213 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30214 <p>e</p></section>
30215 !! end
30216
30217 # Because of section-wrapping and template-wrapping interactions,
30218 # the scope of the template is expanded so that the template markup
30219 # is valid in the presence of <section> tags.
30220 # This exercises the s1 is null scenario in the wrapSections code
30221 !! test
30222 Section wrapping with template-generated sections (bad nesting 1)
30223 !! options
30224 parsoid={
30225 "wrapSections": true
30226 }
30227 !! wikitext
30228 <div>
30229 a
30230
30231 {{echo|
30232 =1=
30233 b
30234 }}
30235
30236 c
30237 </div>
30238 !! html/parsoid
30239 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30240 <p>a</p>
30241
30242 <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"]}'>
30243 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30244 </span><p about="#mwt1">b
30245 </p><span about="#mwt1">
30246
30247 </span><p about="#mwt1">c</p><span about="#mwt1">
30248 </span></section></div></section>
30249 !! end
30250
30251 # Because of section-wrapping and template-wrapping interactions,
30252 # the scope of the template is expanded so that the template markup
30253 # is valid in the presence of <section> tags.
30254 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30255 !! test
30256 Section wrapping with template-generated sections (bad nesting 2)
30257 !! options
30258 parsoid={
30259 "wrapSections": true
30260 }
30261 !! wikitext
30262 =1=
30263 a
30264
30265 {{echo|1=
30266 =2=
30267 b
30268 ==2.1==
30269 c
30270 }}
30271
30272 d
30273
30274 =3=
30275 e
30276 !! html/parsoid
30277 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30278 <p>a</p>
30279
30280 </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">
30281 </span><p about="#mwt1">b</p><span about="#mwt1">
30282 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30283 </span><p about="#mwt1">c</p><span about="#mwt1">
30284
30285 </span><p about="#mwt1">d</p><span about="#mwt1">
30286
30287 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30288 <p>e</p></section>
30289 !! end
30290
30291 # Because of section-wrapping and template-wrapping interactions,
30292 # additional template wrappers are added to <section> tags
30293 # so that template wrapping semantics are valid whether section
30294 # tags are retained or stripped. But, the template scope can expand
30295 # greatly when accounting for section tags.
30296 # This exercises the s1 and s2 are in different subtrees scenario
30297 !! test
30298 Section wrapping with template-generated sections (bad nesting 3)
30299 !! options
30300 parsoid={
30301 "wrapSections": true,
30302 "modes": ["wt2html", "wt2wt"]
30303 }
30304 !! wikitext
30305 =1=
30306 a
30307
30308 {{echo|1=
30309 ==1.2==
30310 b
30311 =2=
30312 c
30313 }}
30314
30315 d
30316
30317 =3=
30318 e
30319 !! html/parsoid
30320 <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>
30321 <p>a</p>
30322
30323 <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">
30324 </span><p about="#mwt1">b</p><span about="#mwt1">
30325 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30326 </span><p about="#mwt1">c</p>
30327
30328 <p>d</p>
30329 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30330 <p>e</p></section>
30331 !! end
30332
30333 !! test
30334 Section wrapping with uneditable lead section + div wrapping multiple sections
30335 !! options
30336 parsoid={
30337 "wrapSections": true
30338 }
30339 !! wikitext
30340 foo
30341
30342 <div style="border:1px solid red;">
30343 =1=
30344 a
30345
30346 ==1.1==
30347 b
30348
30349 =2=
30350 c
30351 </div>
30352
30353 =3=
30354 d
30355
30356 ==3.1==
30357 e
30358 !! html/parsoid
30359 <section data-mw-section-id="-1"><p>foo</p>
30360
30361 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30362 <section data-mw-section-id="1"><h1 id="1">1</h1>
30363 <p>a</p>
30364
30365 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30366 <p>b</p>
30367
30368 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30369 <p>c</p>
30370 </section></div>
30371
30372 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30373 <p>d</p>
30374
30375 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30376 <p>e</p>
30377 </section></section>
30378 !! end
30379
30380 !! test
30381 Section wrapping with editable lead section + div overlapping multiple sections
30382 !! options
30383 parsoid={
30384 "wrapSections": true
30385 }
30386 !! wikitext
30387 foo
30388
30389 =1=
30390 a
30391 <div style="border:1px solid red;">
30392 b
30393
30394 ==1.1==
30395 c
30396
30397 =2=
30398 d
30399 </div>
30400 e
30401
30402 =3=
30403 f
30404
30405 ==3.1==
30406 g
30407 !! html/parsoid
30408 <section data-mw-section-id="0"><p>foo</p>
30409
30410 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30411 <p>a</p>
30412 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30413 <p>b</p>
30414
30415 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30416 <p>c</p>
30417
30418 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30419 <p>d</p>
30420 </section></div>
30421 <p>e</p>
30422
30423 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30424 <p>f</p>
30425
30426 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30427 <p>g</p>
30428 </section></section>
30429 !! end
30430
30431 !! test
30432 HTML header tags should not be wrapped in section tags
30433 !! options
30434 parsoid={
30435 "wrapSections": true
30436 }
30437 !! wikitext
30438 foo
30439
30440 <h1>a</h1>
30441
30442 =b=
30443
30444 <h1>c</h1>
30445
30446 =d=
30447 !! html/parsoid
30448 <section data-mw-section-id="0"><p>foo</p>
30449
30450 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30451
30452 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30453
30454 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30455
30456 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30457 !! end
30458
30459 !! test
30460 Lead section containing only whitespace and comments.
30461 !! options
30462 parsoid={
30463 "wrapSections": true
30464 }
30465 !! wikitext
30466
30467 <!-- this is a comment, presumably significant to editors -->
30468 =1=
30469 a
30470
30471 =2=
30472 b
30473 !! html/parsoid
30474 <section data-mw-section-id="0" data-parsoid="{}">
30475 <!-- this is a comment, presumably significant to editors -->
30476 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30477 <p>a</p>
30478
30479 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30480 <p>b</p></section>
30481 !! end
30482
30483 !! test
30484 Pseudo-sections emitted by templates should have id -2
30485 !! options
30486 parsoid={
30487 "wrapSections": true
30488 }
30489 !! wikitext
30490 foo
30491 {{echo|<div>
30492 ==a==
30493 ==b==
30494 </div>
30495 }}
30496 !! html/parsoid
30497 <section data-mw-section-id="-1"><p>foo</p>
30498 </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}}]}'>
30499 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30500 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30501 </section></div><span about="#mwt1">
30502 </span></section>
30503 !! end
30504
30505 ##########################################################################
30506 Tests demonstrating white-space insensitivity in input wikitext
30507 for wikitext headings, wikitext list items, and wikitext table captions,
30508 headings, and cells. HTML versions of the same should preserve whitespace.
30509 ##########################################################################
30510 !! test
30511 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30512 !! wikitext
30513 __NOTOC__
30514 == <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> ==
30515 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30516 ; <!--term to define--> term : <!--term's definition--> definition
30517 {|
30518 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30519 |-
30520 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30521 |-
30522 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30523 |-
30524 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30525 |-
30526 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30527 |}
30528 : {|
30529 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30530 |} foo <!--c1-->
30531 !! html/php+tidy
30532 <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>
30533 <ul><li>List item</li></ul>
30534 <dl><dt>term&#160;</dt>
30535 <dd>definition</dd></dl>
30536 <table>
30537 <caption>Table Caption
30538 </caption>
30539 <tbody><tr>
30540 <th>Table Heading 1</th>
30541 <th>Table Heading 2
30542 </th></tr>
30543 <tr>
30544 <td>Table Cell 1</td>
30545 <td>Table Cell 2
30546 </td></tr>
30547 <tr>
30548 <td>class="foo"</td>
30549 <td>Table Cell 3
30550 </td></tr>
30551 <tr>
30552 <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
30553 </td></tr></tbody></table>
30554 <dl><dd><table>
30555 <tbody><tr>
30556 <td>Table Cell 1</td>
30557 <td>Table Cell 2
30558 </td></tr></tbody></table> foo</dd></dl>
30559 !! end
30560
30561 # Looks like <caption> is not accepted in HTML
30562 !! test
30563 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30564 !! wikitext
30565 __NOTOC__
30566 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> <h2>
30567 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30568 <table>
30569 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30570 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30571 </table>
30572 !! html/php+tidy
30573 <h2> Heading </h2><h2>
30574 <ul><li> List item </li></ul>
30575 <table>
30576 <tbody><tr><th> Table Heading </th><th></th></tr>
30577 <tr><td> Table Cell </td><th></th></tr>
30578 </tbody></table>
30579 </h2>
30580 !! end
30581
30582 !! test
30583 Do not trim whitespace in links and quotes
30584 !! wikitext
30585 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30586 [[Foo| some text ]]
30587 !! html/php+tidy
30588 <p>foo <i> italic </i> and <b> bold </b>
30589 <a href="/wiki/Foo" title="Foo"> some text </a>
30590 </p>
30591 !! end