Complete coverage of Parser::getTemplateDom()
[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:redirect to foo
67 !! text
68 #REDIRECT [[Template:Foo]]
69 !! endarticle
70
71 !! article
72 Template:Blank
73 !! text
74 !! endarticle
75
76 !! article
77 Template:pipe
78 !! text
79 |
80 !! endarticle
81
82 !! article
83 Template:=
84 !! text
85 <nowiki>=</nowiki>
86 !! endarticle
87
88 !!article
89 MediaWiki:bad image list
90 !!text
91 * [[File:Bad.jpg]] except [[Nasty page]]
92 !!endarticle
93
94 !! article
95 Template:inner list
96 !! text
97 * item 1
98 !! endarticle
99
100 !! article
101 Template:tbl-start
102 !! text
103 {|
104 !! endarticle
105
106 !! article
107 Template:tbl-end
108 !! text
109 |}
110 !! endarticle
111
112 !! article
113 Template:echo
114 !! text
115 {{{1}}}
116 !! endarticle
117
118 !! article
119 Template:echo3
120 !! text
121 {{{1}}}
122 {{{1}}}
123 {{{1}}}
124 !! endarticle
125
126 // For Serbian; localize Template namespace
127 !! article
128 Шаблон:Echo
129 !! text
130 {{{1}}}
131 !! endarticle
132
133 !! article
134 Template:echo_with_span
135 !! text
136 <span>{{{1}}}</span>
137 !! endarticle
138
139 !! article
140 Template:echo_with_div
141 !! text
142 <div>{{{1}}}</div>
143 !! endarticle
144
145 !! article
146 Template:echo with depth
147 !! text
148 {{echo|{{{1}}}}}
149 !! endarticle
150
151 !! article
152 Template:blank_param
153 !! text
154 {{{1}}}
155 {{{}}}
156 !! endarticle
157
158 !! article
159 Template:table_attribs
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"|Foo
163 !! endarticle
164
165 !! article
166 Template:table_attribs_2
167 !! text
168 <noinclude>
169 |</noinclude>style="color:red;"|Foo
170 |Bar||Baz
171 !! endarticle
172
173 !! article
174 Template:table_attribs_3
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
178 !! endarticle
179
180 !! article
181 Template:table_attribs_4
182 !! text
183 | style="background-color:#DC241f;" width="10px" |
184 !! endarticle
185
186 !! article
187 Template:table_attribs_5
188 !! text
189 <noinclude>
190 |</noinclude>style="color:red;"||Bar
191 !! endarticle
192
193 !! article
194 Template:table_attribs_6
195 !! text
196 style="background: <nowiki>
197
198
199 red;</nowiki>" |
200 !! endarticle
201
202 !! article
203 Template:table_attribs_7
204 !! text
205 <noinclude>
206 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
207 !! endarticle
208
209 !! article
210 Template:table_header_cells
211 !! text
212 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
213 !! endarticle
214
215 !! article
216 Template:table_cells
217 !! text
218 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:PartialTable
223 !! text
224 {|
225 |-
226 !! endarticle
227
228 !! article
229 Template:image_attribs
230 !! text
231 <noinclude>
232 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
233 !! endarticle
234
235 ## See T48811 for details
236 !! article
237 Template:mixed_attr_content_template
238 !! text
239 style="color:red;" title="T48811"
240 |-
241 |foo
242 !! endarticle
243
244 !! article
245 Template:definition_list
246 !! text
247 one
248 ::two
249 !! endarticle
250
251 !! article
252 A?b
253 !! text
254 Weirdo titles!
255 !! endarticle
256
257 !!article
258 Template:Bullet
259 !!text
260 * Bar
261 !!endarticle
262
263 !!article
264 Template:OpenTable
265 !!text
266 {|
267 !!endarticle
268
269 !!article
270 Template:EmptyLITest
271 !!text
272 *a
273 *
274 *
275 *b
276 !!endarticle
277
278 !!article
279 Template:EmptyTRTest
280 !!text
281 {|
282 |-
283 |-
284 |foo
285 |-
286 |-
287 |bar
288 |}
289 !!endarticle
290
291 !!article
292 Template:EmptyTRWithHTMLAttrTest
293 !!text
294 <table>
295 <tr align="center"></tr>
296 <tr><td>foo</td></tr>
297 <tr align="center"></tr>
298 <tr><td>bar</td></tr>
299 </table>
300 !!endarticle
301
302 !! article
303 Template:With: Colon
304 !! text
305 Template with colon
306 !! endarticle
307
308 ###
309 ### Basic tests
310 ###
311
312 !! test
313 Blank input
314 !! wikitext
315 !! html
316 !! end
317
318 !! test
319 Simple paragraph
320 !! wikitext
321 This is a simple paragraph.
322 !! html
323 <p>This is a simple paragraph.
324 </p>
325 !! end
326
327 !! test
328 Paragraphs with extra newline spacing
329 !! wikitext
330 foo
331
332 bar
333
334
335 baz
336
337
338
339 booz
340 !! html
341 <p>foo
342 </p><p>bar
343 </p><p><br />
344 baz
345 </p><p><br />
346 </p><p>booz
347 </p>
348 !! end
349
350 !! test
351 Paragraphs with newline spacing with comment lines in between
352 !! wikitext
353 ----
354 a
355 <!--foo-->
356 b
357 ----
358 a
359 <!--foo--><!--More than 1 comment, still stripped-->
360 b
361 ----
362 a
363 <!--foo--> <!----> <!-- bar -->
364 b
365 ----
366 a
367 <!--foo-->
368
369 b
370 ----
371 a
372
373 <!--foo-->
374 b
375 ----
376 a
377 <!--foo-->
378
379
380 b
381 ----
382 a
383
384
385 <!--foo-->
386 b
387 ----
388 !! html
389 <hr />
390 <p>a
391 b
392 </p>
393 <hr />
394 <p>a
395 b
396 </p>
397 <hr />
398 <p>a
399 b
400 </p>
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p>b
408 </p>
409 <hr />
410 <p>a
411 </p><p><br />
412 b
413 </p>
414 <hr />
415 <p>a
416 </p><p><br />
417 b
418 </p>
419 <hr />
420
421 !! end
422
423 !! test
424 Paragraphs with newline spacing with non-empty white-space lines in between
425 !! wikitext
426 ----
427 a
428
429 b
430 ----
431 a
432
433
434 b
435 ----
436 !! html
437 <hr />
438 <p>a
439 </p><p>b
440 </p>
441 <hr />
442 <p>a
443 </p><p><br />
444 b
445 </p>
446 <hr />
447
448 !! end
449
450 !! test
451 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
452 !! wikitext
453 ----
454 a
455 <!--foo-->
456 b
457 ----
458 a
459 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
460 b
461 ----
462 a
463
464 <!--foo-->
465 <!--bar-->
466 b
467 ----
468 a
469
470 <!--foo-->
471 <!--bar-->
472
473 b
474 ----
475 !! html
476 <hr />
477 <p>a
478 b
479 </p>
480 <hr />
481 <p>a
482 b
483 </p>
484 <hr />
485 <p>a
486 </p><p>b
487 </p>
488 <hr />
489 <p>a
490 </p><p><br />
491 b
492 </p>
493 <hr />
494
495 !! end
496
497 !! test
498 Extra newlines: More paragraphs with indented comment
499 !! wikitext
500 a
501
502 <!--boo-->
503
504 b
505 !! html
506 <p>a
507 </p><p><br />
508 b
509 </p>
510 !!end
511
512 !! test
513 Extra newlines followed by heading
514 !! wikitext
515 a
516
517
518
519 =b=
520 [[a]]
521
522
523 =b=
524 !! html
525 <p>a
526 </p><p><br />
527 </p>
528 <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>
529 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
530 </p><p><br />
531 </p>
532 <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>
533
534 !! end
535
536 !! test
537 Extra newlines between heading and content are swallowed
538 !! wikitext
539 =b=
540
541
542
543 [[a]]
544 !! html
545 <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>
546 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
547 </p>
548 !! end
549
550 !! test
551 Heading with line break in nowiki
552 !! options
553 parsoid=wt2html
554 !! config
555 wgFragmentMode=[ 'html5', 'legacy' ]
556 !! wikitext
557 ==A <nowiki>B
558 C</nowiki>==
559 !! html/php
560 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
561 C">A B
562 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>
563
564 !! html/parsoid
565 <h2 id="A_B
566 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
567 C</span></h2>
568 !! end
569
570 !! test
571 Parsing an URL
572 !! wikitext
573 http://fr.wikipedia.org/wiki/🍺
574 <!-- EasterEgg we love beer, better be able be able to link to it -->
575 !! html
576 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
577 </p>
578 !! end
579
580 !! test
581 Simple list
582 !! wikitext
583 *Item 1
584 *Item 2
585 !! html
586 <ul><li>Item 1</li>
587 <li>Item 2</li></ul>
588
589 !! end
590
591 !! test
592 Italics and bold
593 !! wikitext
594 *plain
595 *plain''italic''plain
596 *plain''italic''plain''italic''plain
597 *plain'''bold'''plain
598 *plain'''bold'''plain'''bold'''plain
599 *plain''italic''plain'''bold'''plain
600 *plain'''bold'''plain''italic''plain
601 *plain''italic'''bold-italic'''italic''plain
602 *plain'''bold''bold-italic''bold'''plain
603 *plain'''''bold-italic'''italic''plain
604 *plain'''''bold-italic''bold'''plain
605 *plain''italic'''bold-italic'''''plain
606 *plain'''bold''bold-italic'''''plain
607 *plain l'''italic''plain
608 *plain l''''bold''' plain
609 !! html
610 <ul><li>plain</li>
611 <li>plain<i>italic</i>plain</li>
612 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
613 <li>plain<b>bold</b>plain</li>
614 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
615 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
616 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
617 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
618 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
619 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
620 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
621 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
622 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
623 <li>plain l'<i>italic</i>plain</li>
624 <li>plain l'<b>bold</b> plain</li></ul>
625
626 !! end
627
628 # this example taken from the [[simple:Moon]] article (T49326)
629 !! test
630 Italics and possessives (1)
631 !! wikitext
632 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
633 !! html
634 <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
635 </p>
636 !! end
637
638 # this example taken from [[en:Flaming Pie]] (T51926)
639 !! test
640 Italics and possessives (2)
641 !! wikitext
642 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
643 !! html
644 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
645 </p>
646 !! end
647
648 # this example taken from [[en:Dictionary]] (T51926)
649 !! test
650 Italics and possessives (3)
651 !! wikitext
652 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''.
653 !! html
654 <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>.
655 </p>
656 !! end
657
658
659 ###
660 ### 2-quote opening sequence tests
661 ###
662 !! test
663 Italics and bold: 2-quote opening sequence: (2,2)
664 !! wikitext
665 ''foo''
666 !! html
667 <p><i>foo</i>
668 </p>
669 !!end
670
671 !! test
672 Italics and bold: 2-quote opening sequence: (2,3)
673 !! wikitext
674 ''foo'''
675 !! html/*
676 <p><i>foo'</i>
677 </p>
678 !!end
679
680 !! test
681 Italics and bold: 2-quote opening sequence: (2,4)
682 !! options
683 parsoid=wt2html
684 !! wikitext
685 ''foo''''
686 !! html/*
687 <p><i>foo''</i>
688 </p>
689 !!end
690
691 # same html as previous, but wikitext adjusted to match parsoid html2wt
692 !! test
693 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
694 !! wikitext
695 ''foo<nowiki>''</nowiki>''
696 !! html
697 <p><i>foo''</i>
698 </p>
699 !! end
700
701 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
702 !! test
703 Italics and bold: 2-quote opening sequence: (2,5)
704 !! options
705 parsoid=wt2html
706 !! wikitext
707 ''foo'''''
708 !! html/php
709 <p><i>foo</i>
710 </p>
711 !! html/parsoid
712 <p><i>foo</i><b></b>
713 </p>
714 !!end
715
716 # same html as previous, but wikitext adjusted to match parsoid html2wt
717 !! test
718 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
719 !! wikitext
720 ''foo'''''<nowiki/>'''
721 !! html/php
722 <p><i>foo</i>
723 </p>
724 !! html/parsoid
725 <p><i>foo</i><b></b>
726 </p>
727 !! end
728
729
730 ###
731 ### 3-quote opening sequence tests
732 ###
733
734 !! test
735 Italics and bold: 3-quote opening sequence: (3,2)
736 !! wikitext
737 '''foo''
738 !! html/*
739 <p>'<i>foo</i>
740 </p>
741 !!end
742
743 !! test
744 Italics and bold: 3-quote opening sequence: (3,3)
745 !! wikitext
746 '''foo'''
747 !! html
748 <p><b>foo</b>
749 </p>
750 !!end
751
752 !! test
753 Italics and bold: 3-quote opening sequence: (3,4)
754 !! wikitext
755 '''foo''''
756 !! html/*
757 <p><b>foo'</b>
758 </p>
759 !!end
760
761 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
762 !! test
763 Italics and bold: 3-quote opening sequence: (3,5)
764 !! options
765 parsoid=wt2html
766 !! wikitext
767 '''foo'''''
768 !! html/php
769 <p><b>foo</b>
770 </p>
771 !! html/parsoid
772 <p><b>foo</b><i></i>
773 </p>
774 !!end
775
776 # same html as previous, but wikitext adjusted to match parsoid html2wt
777 !! test
778 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
779 !! wikitext
780 '''foo'''''<nowiki/>''
781 !! html/php
782 <p><b>foo</b>
783 </p>
784 !! html/parsoid
785 <p><b>foo</b><i></i>
786 </p>
787 !! end
788
789
790 ###
791 ### 4-quote opening sequence tests
792 ###
793
794 !! test
795 Italics and bold: 4-quote opening sequence: (4,2)
796 !! options
797 parsoid=wt2html
798 !! wikitext
799 ''''foo''
800 !! html/*
801 <p>''<i>foo</i>
802 </p>
803 !!end
804
805 # same html as previous, but wikitext adjusted to match parsoid html2wt
806 !! test
807 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
808 !! wikitext
809 <nowiki>''</nowiki>''foo''
810 !! html
811 <p>''<i>foo</i>
812 </p>
813 !! end
814
815 !! test
816 Italics and bold: 4-quote opening sequence: (4,3)
817 !! wikitext
818 ''''foo'''
819 !! html/*
820 <p>'<b>foo</b>
821 </p>
822 !!end
823
824 !! test
825 Italics and bold: 4-quote opening sequence: (4,4)
826 !! options
827 parsoid=wt2html
828 !! wikitext
829 ''''foo''''
830 !! html/*
831 <p>'<b>foo'</b>
832 </p>
833 !!end
834
835 # same html as previous, but wikitext adjusted to match parsoid html2wt
836 !! test
837 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
838 !! wikitext
839 '<nowiki/>'''foo''''
840 !! html
841 <p>'<b>foo'</b>
842 </p>
843 !! end
844
845 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
846 !! test
847 Italics and bold: 4-quote opening sequence: (4,5)
848 !! options
849 parsoid=wt2html
850 !! wikitext
851 ''''foo'''''
852 !! html/php
853 <p>'<b>foo</b>
854 </p>
855 !! html/parsoid
856 <p>'<b>foo</b><i></i>
857 </p>
858 !!end
859
860 # same html as previous, but wikitext adjusted to match parsoid html2wt
861 !! test
862 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
863 !! wikitext
864 '<nowiki/>'''foo'''''<nowiki/>''
865 !! html/php
866 <p>'<b>foo</b>
867 </p>
868 !! html/parsoid
869 <p>'<b>foo</b><i></i>
870 </p>
871 !! end
872
873
874 ###
875 ### 5-quote opening sequence tests
876 ###
877
878 !! test
879 Italics and bold: 5-quote opening sequence: (5,2)
880 !! options
881 parsoid=wt2html
882 !! wikitext
883 '''''foo''
884 !! html/*
885 <p><b><i>foo</i></b>
886 </p>
887 !!end
888
889 # same html as previous, but wikitext adjusted to match parsoid html2wt
890 !! test
891 Italics and bold: 5-quote opening sequence: (5,2+3)
892 !! wikitext
893 '''''foo'''''
894 !! html/*
895 <p><i><b>foo</b></i>
896 </p>
897 !! end
898
899 !! test
900 Italics and bold: 5-quote opening sequence: (5,3)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 '''''foo'''
905 !! html/*
906 <p><i><b>foo</b></i>
907 </p>
908 !!end
909
910 # same html as previous, but wikitext adjusted to match parsoid html2wt
911 !! test
912 Italics and bold: 5-quote opening sequence: (5,3+2)
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,4)
922 !! options
923 parsoid=wt2html
924 !! wikitext
925 '''''foo''''
926 !! html/*
927 <p><i><b>foo'</b></i>
928 </p>
929 !!end
930
931 !! test
932 Italics and bold: 5-quote opening sequence: (5,5)
933 !! wikitext
934 '''''foo'''''
935 !! html
936 <p><i><b>foo</b></i>
937 </p>
938 !!end
939
940 !! test
941 Italics and bold: 5-quote opening sequence: (5,6)
942 !! wikitext
943 '''''foo''''''
944 !! html/*
945 <p><i><b>foo'</b></i>
946 </p>
947 !! end
948
949 ###
950 ### multiple quote sequences in a line
951 ###
952
953 !! test
954 Italics and bold: multiple quote sequences: (2,4,2)
955 !! options
956 parsoid=wt2html
957 !! wikitext
958 ''foo''''bar''
959 !! html/*
960 <p><i>foo'<b>bar</b></i>
961 </p>
962 !! end
963
964 # same html as previous, but wikitext adjusted to match parsoid html2wt
965 !! test
966 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
967 !! wikitext
968 ''foo'<nowiki/>'''bar'''''
969 !! html
970 <p><i>foo'<b>bar</b></i>
971 </p>
972 !! end
973
974 !! test
975 Italics and bold: multiple quote sequences: (2,4,3)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 ''foo''''bar'''
980 !! html/*
981 <p><i>foo'<b>bar</b></i>
982 </p>
983 !! end
984
985 # same html as previous, but wikitext adjusted to match parsoid html2wt
986 !! test
987 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
988 !! wikitext
989 ''foo'<nowiki/>'''bar'''''
990 !! html
991 <p><i>foo'<b>bar</b></i>
992 </p>
993 !! end
994
995 !! test
996 Italics and bold: multiple quote sequences: (2,4,4)
997 !! options
998 parsoid=wt2html
999 !! wikitext
1000 ''foo''''bar''''
1001 !! html/*
1002 <p><i>foo'<b>bar'</b></i>
1003 </p>
1004 !! end
1005
1006 # same html as previous, but wikitext adjusted to match parsoid html2wt
1007 !! test
1008 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1009 !! wikitext
1010 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1011 !! html
1012 <p><i>foo'<b>bar'</b></i>
1013 </p>
1014 !! end
1015
1016 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1017 !! test
1018 Italics and bold: multiple quote sequences: (3,4,2)
1019 !! options
1020 parsoid=wt2html
1021 !! wikitext
1022 '''foo''''bar''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b>foo'</b>bar<i></i>
1028 </p>
1029 !! end
1030
1031 # same html as previous, but wikitext adjusted to match parsoid html2wt
1032 !! test
1033 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1034 !! wikitext
1035 '''foo''''bar''<nowiki/>''
1036 !! html/php
1037 <p><b>foo'</b>bar
1038 </p>
1039 !! html/parsoid
1040 <p><b>foo'</b>bar<i></i>
1041 </p>
1042 !! end
1043
1044 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1045 !! test
1046 Italics and bold: multiple quote sequences: (3,4,3)
1047 !! options
1048 parsoid=wt2html
1049 !! wikitext
1050 '''foo''''bar'''
1051 !! html/php
1052 <p><b>foo'</b>bar
1053 </p>
1054 !! html/parsoid
1055 <p><b>foo'</b>bar<b></b>
1056 </p>
1057 !! end
1058
1059 # same html as previous, but wikitext adjusted to match parsoid html2wt
1060 !! test
1061 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1062 !! wikitext
1063 '''foo''''bar'''<nowiki/>'''
1064 !! html/php
1065 <p><b>foo'</b>bar
1066 </p>
1067 !! html/parsoid
1068 <p><b>foo'</b>bar<b></b>
1069 </p>
1070 !! end
1071
1072 ###
1073 ### other quote tests
1074 ###
1075 !! test
1076 Italics and bold: other quote tests: (2,3,5)
1077 !! wikitext
1078 ''this is about '''foo's family'''''
1079 !! html
1080 <p><i>this is about <b>foo's family</b></i>
1081 </p>
1082 !!end
1083
1084
1085 !! test
1086 Italics and bold: other quote tests: (2,(3,3),2)
1087 !! wikitext
1088 ''this is about '''foo's''' family''
1089 !! html
1090 <p><i>this is about <b>foo's</b> family</i>
1091 </p>
1092 !!end
1093
1094
1095 !! test
1096 Italics and bold: other quote tests: (3,2,3,2)
1097 !! options
1098 parsoid=wt2html
1099 !! wikitext
1100 '''this is about ''foo'''s family''
1101 !! html/*
1102 <p><b>this is about <i>foo</i></b><i>s family</i>
1103 </p>
1104 !!end
1105
1106
1107 # same html as previous, but wikitext adjusted to match parsoid html2wt
1108 !! test
1109 Italics and bold: other quote tests: (3,2,3+2+2,2)
1110 !! wikitext
1111 '''this is about ''foo'''''<nowiki/>''s family''
1112 !! html
1113 <p><b>this is about <i>foo</i></b><i>s family</i>
1114 </p>
1115 !! end
1116
1117
1118 !! test
1119 Italics and bold: other quote tests: (3,2,3,3)
1120 !! wikitext
1121 '''this is about ''foo'''s family'''
1122 !! html/*
1123 <p>'<i>this is about </i>foo<b>s family</b>
1124 </p>
1125 !!end
1126
1127
1128 !! test
1129 Italics and bold: other quote tests: (3,(2,2),3)
1130 !! wikitext
1131 '''this is about ''foo's'' family'''
1132 !! html
1133 <p><b>this is about <i>foo's</i> family</b>
1134 </p>
1135 !!end
1136
1137
1138 !! test
1139 Italicized possessive
1140 !! wikitext
1141 The ''[[Main Page]]'''s talk page.
1142 !! html/php
1143 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1144 </p>
1145 !! html/parsoid
1146 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1147 !! end
1148
1149 !! test
1150 Quote balancing context should be restricted to td/th cells on the same wikitext line
1151 !! options
1152 parsoid=wt2html,wt2wt
1153 !! wikitext
1154 {|
1155 !''a!!''b
1156 |''a||''b
1157 |}
1158 !! html+tidy
1159 <table>
1160 <tbody><tr>
1161 <th><i>a</i></th>
1162 <th><i>b</i>
1163 </th>
1164 <td><i>a</i></td>
1165 <td><i>b</i>
1166 </td></tr></tbody></table>
1167 !! end
1168
1169 ###
1170 ### Non-html5 tags
1171 ###
1172
1173 !! test
1174 Non-html5 tags should be accepted
1175 !! wikitext
1176 <center>''foo''</center>
1177 <big>''foo''</big>
1178 <font>''foo''</font>
1179 <strike>''foo''</strike>
1180 <tt>''foo''</tt>
1181 !! html
1182 <center><i>foo</i></center>
1183 <p><big><i>foo</i></big>
1184 <font><i>foo</i></font>
1185 <strike><i>foo</i></strike>
1186 <tt><i>foo</i></tt>
1187 </p>
1188 !! end
1189
1190 !! test
1191 <wbr> is valid wikitext (T54468)
1192 !! wikitext
1193 <wbr>
1194 !! html
1195 <p><wbr />
1196 </p>
1197 !! end
1198
1199 # <strike> is HTML4, <s> is HTML4/5.
1200 !! test
1201 <s> or <strike> for strikethrough
1202 !! wikitext
1203 <strike>strike</strike>
1204
1205 <s>s</s>
1206 !! html
1207 <p><strike>strike</strike>
1208 </p><p><s>s</s>
1209 </p>
1210 !! end
1211
1212 ## a not permitted
1213 ## i,b,br omitted
1214 !! test
1215 Text-level semantic html elements in wikitext
1216 !! wikitext
1217 <em>text</em>
1218 <strong>text</strong>
1219 <small>text</small>
1220 <s>text</s>
1221 <cite>text</cite>
1222 <q>text</q>
1223 <dfn>text</dfn>
1224 <abbr>text</abbr>
1225 <data>text</data>
1226 <time>text</time>
1227 <code>text</code>
1228 <var>text</var>
1229 <samp>text</samp>
1230 <kbd>text</kbd>
1231 <sub>text</sub>
1232 <u>text</u>
1233 <mark>text</mark>
1234 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1235 <bdi>text</bdi>
1236 <bdo>text</bdo>
1237 <span>text</span>
1238 <wbr />
1239 !! html
1240 <p><em>text</em>
1241 <strong>text</strong>
1242 <small>text</small>
1243 <s>text</s>
1244 <cite>text</cite>
1245 <q>text</q>
1246 <dfn>text</dfn>
1247 <abbr>text</abbr>
1248 <data>text</data>
1249 <time>text</time>
1250 <code>text</code>
1251 <var>text</var>
1252 <samp>text</samp>
1253 <kbd>text</kbd>
1254 <sub>text</sub>
1255 <u>text</u>
1256 <mark>text</mark>
1257 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1258 <bdi>text</bdi>
1259 <bdo>text</bdo>
1260 <span>text</span>
1261 <wbr />
1262 </p>
1263 !! end
1264
1265 # test cases taken from
1266 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1267 !! test
1268 Ruby markup (W3C-style)
1269 !! wikitext
1270 ;Mono-ruby for individual base characters
1271 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1272 ;Group ruby
1273 :<ruby>今日<rt>きょう</rt></ruby>
1274 ;Jukugo ruby
1275 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1276 ;Inline ruby
1277 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1278 ;Double-sided ruby
1279 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1280
1281 <ruby>
1282 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1283 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1284 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1285 </ruby>
1286 !! html
1287 <dl><dt>Mono-ruby for individual base characters</dt>
1288 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1289 <dt>Group ruby</dt>
1290 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1291 <dt>Jukugo ruby</dt>
1292 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1293 <dt>Inline ruby</dt>
1294 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1295 <dt>Double-sided ruby</dt>
1296 <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>
1297 <p><ruby>
1298 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1299 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1300 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1301 </ruby>
1302 </p>
1303 !! end
1304
1305 # The next two test different paths in the sanitizer.
1306 !! test
1307 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1308 !! wikitext
1309 <blockquote|>a</blockquote>
1310
1311 <b→> doesn't terminate </b→>
1312
1313 <bä> doesn't terminate </bä>
1314
1315 <boo> doesn't terminate </boo>
1316
1317 <s.foo> doesn't terminate </s.foo>
1318
1319 <sub-ID#1>
1320 !! html
1321 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1322 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1323 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1324 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1325 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1326 </p><p>&lt;sub-ID#1&gt;
1327 </p>
1328 !! end
1329
1330 !! test
1331 Non-word characters don't terminate tag names
1332 !! wikitext
1333 <blockquote|>a</blockquote>
1334
1335 <b→> doesn't terminate </b→>
1336
1337 <bä> doesn't terminate </bä>
1338
1339 <boo> doesn't terminate </boo>
1340
1341 <s.foo> doesn't terminate </s.foo>
1342
1343 <sub-ID#1>
1344 !! html+tidy
1345 <p>&lt;blockquote|&gt;a
1346 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1347 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1348 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1349 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1350 </p><p>&lt;sub-ID#1&gt;
1351 </p>
1352 !! end
1353
1354 ###
1355 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1356 ### This checks that HTML5 tags (with non-word characters in the tag
1357 ### name) make it safely through the parser -- the Sanitizer will
1358 ### munge them later, as it should.
1359 ###
1360 !! test
1361 Non-word characters are valid in extension tags (T19663)
1362 !! wikitext
1363 <tåg>tåg</tåg>
1364 !! html/php
1365 <pre>
1366 'tåg'
1367 array (
1368 )
1369 </pre>
1370
1371 !! html/parsoid
1372 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1373 !! end
1374
1375 !! test
1376 Isolated close tags should be treated as literal text (T54760)
1377 !! options
1378 parsoid=wt2html
1379 !! wikitext
1380 </b>
1381
1382 <s.foo>s</s>
1383 !! html/php+tidy
1384 <p class="mw-empty-elt">
1385 </p><p>&lt;s.foo&gt;s
1386 </p>
1387 !! html/parsoid
1388 <p>&lt;s.foo&gt;s</p>
1389 !! end
1390
1391 ###
1392 ### Special characters
1393 ###
1394
1395 !! test
1396 Bare pipe character (T54363)
1397 !! wikitext
1398 |
1399 !! html
1400 <p>|
1401 </p>
1402 !! end
1403
1404 !! test
1405 Bare pipe character from a template (T54363)
1406 !! wikitext
1407 {{pipe}}
1408 !! html
1409 <p>|
1410 </p>
1411 !! end
1412
1413 ###
1414 ### <nowiki> test cases
1415 ###
1416
1417 !! test
1418 <nowiki> unordered list
1419 !! wikitext
1420 <nowiki>* This is not an unordered list item.</nowiki>
1421 !! html/php
1422 <p>* This is not an unordered list item.
1423 </p>
1424 !! html/parsoid
1425 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1426 !! end
1427
1428 !! test
1429 <nowiki> spacing
1430 !! wikitext
1431 <nowiki>Lorem ipsum dolor
1432
1433 sed abit.
1434 sed nullum.
1435
1436 :and a colon
1437 </nowiki>
1438 !! html/php
1439 <p>Lorem ipsum dolor
1440
1441 sed abit.
1442 sed nullum.
1443
1444 :and a colon
1445
1446 </p>
1447 !! html/parsoid
1448 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1449
1450 sed abit.
1451 sed nullum.
1452
1453 :and a colon
1454 </span></p>
1455 !! end
1456
1457 !! test
1458 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1459 !! wikitext
1460 <nowiki><span class="error"></nowiki>
1461 !! html/php
1462 <p>&lt;span class="error"&gt;
1463 </p>
1464 !! html/parsoid
1465 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1466 !! end
1467
1468 !! test
1469 nowiki 3
1470 !! wikitext
1471 :There is not nowiki.
1472 :There is <nowiki>nowiki</nowiki>.
1473
1474 #There is not nowiki.
1475 #There is <nowiki>nowiki</nowiki>.
1476
1477 *There is not nowiki.
1478 *There is <nowiki>nowiki</nowiki>.
1479 !! html/php
1480 <dl><dd>There is not nowiki.</dd>
1481 <dd>There is nowiki.</dd></dl>
1482 <ol><li>There is not nowiki.</li>
1483 <li>There is nowiki.</li></ol>
1484 <ul><li>There is not nowiki.</li>
1485 <li>There is nowiki.</li></ul>
1486
1487 !! html/parsoid
1488 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1489 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1490
1491 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1492 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1493
1494 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1495 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1496 !! end
1497
1498 !! test
1499 Entities inside <nowiki>
1500 !! wikitext
1501 <nowiki>&lt;</nowiki>
1502 !! html/php
1503 <p>&lt;
1504 </p>
1505 !! html/parsoid
1506 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1507 !! end
1508
1509 !! test
1510 Entities inside template parameters
1511 !! wikitext
1512 {{echo|&ndash;}}
1513 !! html/php+tidy
1514 <p>&#8211;
1515 </p>
1516 !! html/parsoid
1517 <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>
1518 !! end
1519
1520 !! test
1521 Properly escape nowiki when combined with other wiki markup
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <p>* &lt;/nowiki&gt; tag</p>
1526 !! wikitext
1527 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1528 !! end
1529
1530 !! test
1531 T93824: Put escaped HTML tags inside nowiki
1532 !! options
1533 parsoid=html2wt
1534 !! html/parsoid
1535 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1536 !! wikitext
1537 <nowiki><h2>foo</h2></nowiki>
1538 !! end
1539
1540 !! test
1541 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1542 !! options
1543 parsoid=html2wt
1544 !! html/parsoid
1545 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1546 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1547 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1548 !! wikitext
1549 This text: L'[[Foo]]
1550 This text: L<nowiki>''</nowiki>[[Foo]]
1551 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1552 !! end
1553
1554 # This test fails because wikitext whitespace is not normalized before comparing.
1555 !! test
1556 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1557 !! options
1558 parsoid=html2wt
1559 !! html/parsoid
1560 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1561 </p>
1562 !! wikitext
1563 This text : L<nowiki>''</nowiki>[[Foo]]
1564 !! end
1565
1566 # This test and the next one are html2wt only as they test that incorrect wikitext
1567 # passed in template arguments gets escaped or wrapped in nowikis where required.
1568 !! test
1569 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1570 !! options
1571 parsoid=html2wt
1572 !! html/parsoid
1573 <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>
1574 <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>
1575 !! wikitext
1576 {{echo|foo{{!}}bar}}
1577 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1578 !! end
1579
1580 !! test
1581 T53961: Output correct nowikis in template arguments
1582 !! options
1583 parsoid=html2wt
1584 !! html/parsoid
1585 <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>
1586 <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>
1587 <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>
1588 <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>
1589 <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>
1590 !! wikitext
1591 {{echo|a [ b}}
1592 {{echo|<nowiki>a }} b</nowiki>}}
1593 {{echo|<nowiki>a [[ b</nowiki>}}
1594 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1595 {{echo|a <nowiki>}</nowiki>}}
1596 !! end
1597
1598 !! test
1599 Cases where "!!" needs nowiki protection
1600 !! options
1601 parsoid=html2wt
1602 !! html/parsoid
1603 <table>
1604 <tr><th>this needs protection !! here</th></tr>
1605 </table>
1606
1607 <table>
1608 <tr><th>this does not need
1609 protection !! here</th></tr>
1610 </table>
1611 !! wikitext
1612 {|
1613 !<nowiki>this needs protection !! here</nowiki>
1614 |}
1615
1616 {|
1617 !this does not need
1618 protection !! here
1619 |}
1620 !! end
1621
1622 ###
1623 ### Comments
1624 ###
1625 !! test
1626 Comments and Indent-Pre
1627 !! wikitext
1628 <!-- comment 1 --> asdf
1629
1630 <!-- comment 1 --> asdf
1631 <!-- comment 2 -->
1632
1633 <!-- comment 1 --> asdf
1634 <!-- comment 2 -->xyz
1635
1636 <!-- comment 1 --> asdf
1637 <!-- comment 2 --> xyz
1638 !! html
1639 <pre>asdf
1640 </pre>
1641 <pre>asdf
1642 </pre>
1643 <pre>asdf
1644 </pre>
1645 <p>xyz
1646 </p>
1647 <pre>asdf
1648 xyz
1649 </pre>
1650 !! end
1651
1652 !! test
1653 Comment test 2a
1654 !! wikitext
1655 asdf
1656 <!-- comment 1 -->
1657 jkl
1658 !! html
1659 <p>asdf
1660 jkl
1661 </p>
1662 !! end
1663
1664 !! test
1665 Comment test 2b
1666 !! wikitext
1667 asdf
1668 <!-- comment 1 -->
1669
1670 jkl
1671 !! html
1672 <p>asdf
1673 </p><p>jkl
1674 </p>
1675 !! end
1676
1677 !! test
1678 Comment test 3
1679 !! wikitext
1680 asdf
1681 <!-- comment 1 -->
1682 <!-- comment 2 -->
1683 jkl
1684 !! html
1685 <p>asdf
1686 jkl
1687 </p>
1688 !! end
1689
1690 !! test
1691 Comment test 4
1692 !! wikitext
1693 asdf<!-- comment 1 -->jkl
1694 !! html
1695 <p>asdfjkl
1696 </p>
1697 !! end
1698
1699 !! test
1700 Comment spacing
1701 !! wikitext
1702 a
1703 <!-- foo --> b <!-- bar -->
1704 c
1705 !! html
1706 <p>a
1707 </p>
1708 <pre> b
1709 </pre>
1710 <p>c
1711 </p>
1712 !! end
1713
1714 !! test
1715 Comment whitespace
1716 !! wikitext
1717 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1718 !! html
1719
1720 !! end
1721
1722 !! test
1723 Comment semantics and delimiters
1724 !! wikitext
1725 <!-- --><!----><!-----><!------>
1726 !! html/php
1727
1728 !! html/parsoid
1729 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1730 !! end
1731
1732 !! test
1733 Comment semantics and delimiters, redux
1734 !! wikitext
1735 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1736 -- foo -- funky huh? ... -->
1737 !! html/php
1738
1739 !! html/parsoid
1740 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1741 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1742 !! end
1743
1744 !! test
1745 Comment semantics and delimiters: directors cut
1746 !! wikitext
1747 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1748 everything starting with < followed by !-- until the first -- and > we see,
1749 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1750 -->-->
1751 !! html/php
1752 <p>--&gt;
1753 </p>
1754 !! html/parsoid
1755 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1756 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1757 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1758 --><p>--></p>
1759 !! end
1760
1761 !! test
1762 Comment semantics: nesting
1763 !! wikitext
1764 <!--<!-- no, we're not going to do anything fancy here -->-->
1765 !! html/php
1766 <p>--&gt;
1767 </p>
1768 !! html/parsoid
1769 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1770 !! end
1771
1772 # Parsoid closes the unclosed comment, even if it means a slight
1773 # round-trip diff.
1774 !! test
1775 Comment semantics: unclosed comment at end
1776 !! options
1777 parsoid=wt2html,html2html
1778 !! wikitext
1779 <!--This comment will run out to the end of the document
1780 !! html/php
1781
1782 !! html/parsoid
1783 <!--This comment will run out to the end of the document-->
1784 !! end
1785
1786 !! test
1787 Comment semantics: normalize comments to play nice with XML and browsers
1788 !! wikitext
1789 <!-- Browsers --!> think this is closed -->
1790 <!--> This would normally be text -->
1791 <!---> As would this -->
1792 <!-- XML doesn't like trailing dashes -------->
1793 <!-- Nor doubled hyphens -- anywhere in the data -->
1794 But this is not a comment.
1795 !! html/php
1796 <p>But this is not a comment.
1797 </p>
1798 !! html/parsoid
1799 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1800 <!--&#x3E; This would normally be text -->
1801 <!--&#x2D;&#x3E; As would this -->
1802 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1803 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1804 <p>But this is not a comment.</p>
1805 !! end
1806
1807 !! test
1808 Comment semantics: round-trip even text which contains encoded -->
1809 !! wikitext
1810 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1811 !! html/parsoid
1812 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1813 !! end
1814
1815 !! test
1816 Comment in template title
1817 !! wikitext
1818 {{f<!---->oo}}
1819 !! html
1820 <p>FOO
1821 </p>
1822 !! end
1823
1824 !! test
1825 Comment on its own line post-expand
1826 !! wikitext
1827 a
1828 {{blank}}<!---->
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Comment on its own line post-expand with non-significant whitespace
1838 !! wikitext
1839 a
1840 {{blank}} <!---->
1841 b
1842 !! html
1843 <p>a
1844 </p><p>b
1845 </p>
1846 !! end
1847
1848 !! test
1849 post-expand include size being exceeded
1850 !! options
1851 maxincludesize=20
1852 !! wikitext
1853 {{echo3|1234567890}}
1854 !! html
1855 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1856 </p>
1857 !! end
1858
1859 !! test
1860 max template depth being reached
1861 !! options
1862 maxtemplatedepth=1
1863 !! wikitext
1864 {{echo with depth|too deep!}}
1865 !! html
1866 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1867 </p>
1868 !! end
1869
1870 !! test
1871 multiple templates that are redirects
1872 !! wikitext
1873 {{redirect to foo}}
1874 {{redirect to foo}}
1875 !! html
1876 <p>FOO
1877 FOO
1878 </p>
1879 !! end
1880
1881 !! test
1882 Multiple comments should still parse as SOL-transparent
1883 !! options
1884 parsoid=wt2html,wt2wt
1885 !! wikitext
1886 <!--c1-->*a
1887 <!--c2--><!--c3--><!--c4-->*b
1888 !! html/php
1889 <ul><li>a</li>
1890 <li>b</li></ul>
1891
1892 !! html/parsoid
1893 <!--c1--><ul>
1894 <li>a
1895 </li>
1896 <!--c2--><!--c3--><!--c4-->
1897 <li>b
1898 </li>
1899 </ul>
1900 !! end
1901
1902 ## Make sure ">" gets escaped in comments to avoid XSS
1903 !! test
1904 IE conditional comments
1905 !! wikitext
1906 <!--[if lt IE 9]>
1907 <script>alert('hi');</script>
1908 <![endif]-->
1909 !! html/parsoid
1910 <!--[if lt IE 9]&#x3E;
1911 <script&#x3E;alert('hi');</script&#x3E;
1912 <![endif]-->
1913 !! end
1914
1915 ###
1916 ### paragraph wrapping tests
1917 ###
1918
1919 !! test
1920 No block tags
1921 !! wikitext
1922 a
1923
1924 b
1925 !! html
1926 <p>a
1927 </p><p>b
1928 </p>
1929 !! end
1930
1931 !! test
1932 Block tag on one line (<div>)
1933 !! wikitext
1934 a <div>foo</div>
1935
1936 b
1937 !! html
1938 a <div>foo</div>
1939 <p>b
1940 </p>
1941 !! html+tidy
1942 <p>a </p><div>foo</div>
1943 <p>b
1944 </p>
1945 !! end
1946
1947 # Remex wraps empty tag runs with p-tags.
1948 # Parsoid strips them out during p-wrapping.
1949 !! test
1950 No p-wrappable content
1951 !! wikitext
1952 <span><div>x</div></span>
1953 <span><s><div>x</div></s></span>
1954 <small><em></em></small><span><s><div>x</div></s></span>
1955 !! html/php+tidy
1956 <span><div>x</div></span>
1957 <span><s><div>x</div></s></span>
1958 <p><small><em></em></small></p><span><s><div>x</div></s></span>
1959 !! html/parsoid
1960 <span><div>x</div></span>
1961 <span><s><div>x</div></s></span>
1962 <small><em></em></small><span><s><div>x</div></s></span>
1963 !! end
1964
1965 # T177612: Parsoid-only test
1966 !! test
1967 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
1968 !! wikitext
1969 {{echo|<span><div>x</div></span>}}
1970 x
1971 !! html/parsoid
1972 <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>
1973 <p>x</p>
1974 !! end
1975
1976 !! test
1977 Block tag on one line (<blockquote>)
1978 !! wikitext
1979 a <blockquote>foo</blockquote>
1980
1981 b
1982 !! html
1983 a <blockquote>foo</blockquote>
1984 <p>b
1985 </p>
1986 !! html+tidy
1987 <p>a </p><blockquote><p>foo</p></blockquote>
1988 <p>b
1989 </p>
1990 !! end
1991
1992 !! test
1993 Block tag on both lines (<div>)
1994 !! wikitext
1995 a <div>foo</div>
1996
1997 b <div>foo</div>
1998 !! html
1999 a <div>foo</div>
2000 b <div>foo</div>
2001
2002 !! html+tidy
2003 <p>a </p><div>foo</div><p>
2004 b </p><div>foo</div>
2005 !! end
2006
2007 !! test
2008 Block tag on both lines (<blockquote>)
2009 !! wikitext
2010 a <blockquote>foo</blockquote>
2011
2012 b <blockquote>foo</blockquote>
2013 !! html
2014 a <blockquote>foo</blockquote>
2015 b <blockquote>foo</blockquote>
2016
2017 !! html+tidy
2018 <p>a </p><blockquote><p>foo</p></blockquote><p>
2019 b </p><blockquote><p>foo</p></blockquote>
2020 !! end
2021
2022 !! test
2023 Multiple lines without block tags
2024 !! wikitext
2025 <div>foo</div> a
2026 b
2027 c
2028 d<!--foo--> e
2029 x <div>foo</div> z
2030 !! html
2031 <div>foo</div> a
2032 <p>b
2033 c
2034 d e
2035 </p>
2036 x <div>foo</div> z
2037
2038 !! html+tidy
2039 <div>foo</div><p> a
2040 </p><p>b
2041 c
2042 d e
2043 </p><p>
2044 x </p><div>foo</div><p> z
2045 </p>
2046 !! end
2047
2048 # The difference between Parsoid & Remex here
2049 # is because of Parsoid's Tidy-emulation code
2050 # for p-wrapping. We'll start work to remove this
2051 # emulation code in Parsoid sooner than later.
2052 # Remex wraps empty tag runs with p-tags.
2053 # Parsoid strips them out in a separate pass.
2054 !! test
2055 Empty lines between lines with block tags
2056 !! wikitext
2057 <div></div>
2058
2059
2060 <div></div>a
2061
2062 b
2063 <div>a</div>b
2064
2065 <div>b</div>d
2066
2067
2068 <div>e</div>
2069 !! html
2070 <div></div>
2071 <p><br />
2072 </p>
2073 <div></div>a
2074 <p>b
2075 </p>
2076 <div>a</div>b
2077 <div>b</div>d
2078 <p><br />
2079 </p>
2080 <div>e</div>
2081
2082 !! html+tidy
2083 <div></div>
2084 <p><br />
2085 </p>
2086 <div></div><p>a
2087 </p><p>b
2088 </p>
2089 <div>a</div><p>b
2090 </p><div>b</div><p>d
2091 </p><p><br />
2092 </p>
2093 <div>e</div>
2094 !! html/parsoid
2095 <div data-parsoid='{"stx":"html"}'></div>
2096
2097 <p><br /></p>
2098 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2099
2100 <p>b</p>
2101 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2102
2103 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2104
2105 <p><br /></p>
2106 <div data-parsoid='{"stx":"html"}'>e</div>
2107 !! end
2108
2109 !! test
2110 Unclosed HTML p-tags should be handled properly
2111 !! wikitext
2112 <div><p>foo</div>
2113 a
2114
2115 b
2116 !! html/php+tidy
2117 <div><p>foo</p></div>
2118 <p>a
2119 </p><p>b
2120 </p>
2121 !! html/parsoid
2122 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2123 <p>a</p>
2124 <p>b</p>
2125 !! end
2126
2127 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2128 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2129 ## them for now.
2130 !! test
2131 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2132 !! options
2133 parsoid=wt2html
2134 !! wikitext
2135 a [[Category:A1]] [[Category:A2]]
2136 [[Category:A3]]
2137 [[Category:A4]]
2138 !! html/parsoid
2139 <p>a</p>
2140 <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"/>
2141 !! end
2142
2143 !! test
2144 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2145 !! options
2146 parsoid=wt2html
2147 !! wikitext
2148 [[Category:A1]]a
2149 !! html/parsoid
2150 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2151 !! end
2152
2153 !! test
2154 No paragraph necessary for SOL transparent template
2155 !! wikitext
2156 <span><div>foo</div></span>
2157 [[Category:Foo]]
2158
2159 <span><div>foo</div></span>
2160 {{echo|[[Category:Foo]]}}
2161 !! html/php
2162 <span><div>foo</div></span>
2163 <span><div>foo</div></span>
2164
2165 !! html/parsoid
2166 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2167 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2168
2169 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2170 <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}}]}'/>
2171 !! end
2172
2173 !! test
2174 Avoid expanding multiline sol transparent template ranges unnecessarily
2175 !! wikitext
2176 hi
2177
2178
2179 {{echo|<br/>
2180 }}
2181
2182 [[Category:Ho]]
2183 !! html/php
2184 <p>hi
2185 </p><p><br />
2186 <br />
2187 </p>
2188 !! html/parsoid
2189 <p>hi</p>
2190
2191 <p><br />
2192 <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">
2193 </span></p>
2194
2195 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2196 !! end
2197
2198 ###
2199 ### Preformatted text
2200 ###
2201
2202 !! test
2203 Preformatted text
2204 !! wikitext
2205 This is some
2206 Preformatted text
2207 With ''italic''
2208 And '''bold'''
2209 And a [[Main Page|link]]
2210 !! html
2211 <pre>This is some
2212 Preformatted text
2213 With <i>italic</i>
2214 And <b>bold</b>
2215 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2216 </pre>
2217 !! end
2218
2219 !! test
2220 Tabs don't trigger preformatted text
2221 !! wikitext
2222 This is not
2223 preformatted text.
2224 This is preformatted text.
2225 So is this.
2226 !! html/php
2227 <p> This is not
2228 preformatted text.
2229 </p>
2230 <pre>This is preformatted text.
2231 So is this.
2232 </pre>
2233 !! html/parsoid
2234 <p> This is not
2235 preformatted text.</p>
2236 <pre>This is preformatted text.
2237 So is this.</pre>
2238 !! end
2239
2240 !! test
2241 Space before tab needs nowiki pre protection
2242 !! options
2243 parsoid=html2wt
2244 !! html/parsoid
2245 <p> a</p>
2246 !! wikitext
2247 <nowiki> </nowiki> a
2248 !! end
2249
2250 !! test
2251 Ident preformatting with inline content
2252 !! wikitext
2253 a
2254 ''b''
2255 !! html
2256 <pre>a
2257 <i>b</i>
2258 </pre>
2259 !! end
2260
2261 !! test
2262 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2263 !! wikitext
2264 <pre><nowiki>
2265 <b>
2266 <cite>
2267 <em>
2268 </nowiki></pre>
2269 !! html
2270 <pre>
2271 &lt;b&gt;
2272 &lt;cite&gt;
2273 &lt;em&gt;
2274 </pre>
2275
2276 !! end
2277
2278 !! test
2279 Regression with preformatted in <center>
2280 !! wikitext
2281 <center>
2282 Blah
2283 </center>
2284 !! html
2285 <center>
2286 <pre>Blah
2287 </pre>
2288 </center>
2289
2290 !! end
2291
2292 !! test
2293 T54763: Preformatted in <blockquote>
2294 !! wikitext
2295 <blockquote>
2296 Blah
2297 {|
2298 |
2299 indented cell (no pre-wrapping!)
2300 |}
2301 </blockquote>
2302 !! html
2303 <blockquote>
2304 <p> Blah
2305 </p>
2306 <table>
2307 <tr>
2308 <td>
2309 <p> indented cell (no pre-wrapping!)
2310 </p>
2311 </td></tr></table>
2312 </blockquote>
2313
2314 !! end
2315
2316 !! test
2317 T53086: Double newlines in blockquotes should be turned into paragraphs
2318 !! wikitext
2319 <blockquote>
2320 Foo
2321
2322 Bar
2323 </blockquote>
2324 !! html
2325 <blockquote>
2326 <p>Foo
2327 </p><p>Bar
2328 </p>
2329 </blockquote>
2330
2331 !! end
2332
2333 !! test
2334 T17491: <ins>/<del> in blockquote
2335 !! wikitext
2336 <blockquote>
2337 Foo <del>bar</del> <ins>baz</ins> quux
2338 </blockquote>
2339 !! html
2340 <blockquote>
2341 <p>Foo <del>bar</del> <ins>baz</ins> quux
2342 </p>
2343 </blockquote>
2344
2345 !! end
2346
2347 !! test
2348 T17491: <ins>/<del> in blockquote (2)
2349 !! wikitext
2350 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2351 </blockquote>
2352 !! html
2353 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2354 </blockquote>
2355
2356 !! html+tidy
2357 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2358 </p></blockquote>
2359 !! end
2360
2361 !! test
2362 <pre> with attributes (T5202)
2363 !! wikitext
2364 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2365 !! html
2366 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2367
2368 !! end
2369
2370 !! test
2371 <pre> with width attribute (T5202)
2372 !! wikitext
2373 <pre width="8">Narrow screen goodies</pre>
2374 !! html
2375 <pre width="8">Narrow screen goodies</pre>
2376
2377 !! end
2378
2379 !! test
2380 <pre> with forbidden attribute (T5202)
2381 !! wikitext
2382 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2383 !! html
2384 <pre width="8">Narrow screen goodies</pre>
2385
2386 !! end
2387
2388 !! test
2389 Entities inside <pre>
2390 !! wikitext
2391 <pre>&lt;</pre>
2392 !! html
2393 <pre>&lt;</pre>
2394
2395 !! end
2396
2397 !! test
2398 <pre> with forbidden attribute values (T5202)
2399 !! wikitext
2400 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2401 !! html
2402 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2403
2404 !! end
2405
2406 !! test
2407 <nowiki> inside <pre> (T15238)
2408 !! wikitext
2409 <pre>
2410 <nowiki>
2411 </pre>
2412 <pre>
2413 <nowiki></nowiki>
2414 </pre>
2415 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2416 !! html
2417 <pre>
2418 &lt;nowiki&gt;
2419 </pre>
2420 <pre>
2421
2422 </pre>
2423 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2424
2425 !! end
2426
2427 !! test
2428 <nowiki> inside of #tag:pre
2429 !! wikitext
2430 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2431 !! html/php
2432 <pre>Foo &#8594;bar</pre>
2433
2434 !! html/parsoid
2435 <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>
2436 !! end
2437
2438 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2439 ## aren't enclosed in nowikis.
2440 !! test
2441 <nowiki> and <pre> preference (first one wins)
2442 !! options
2443 parsoid=wt2html
2444 !! wikitext
2445 <pre>
2446 <nowiki>
2447 </pre>
2448 </nowiki>
2449 </pre>
2450
2451 <nowiki>
2452 <pre>
2453 <nowiki>
2454 </pre>
2455 </nowiki>
2456 </pre>
2457
2458 !! html/php
2459 <pre>
2460 &lt;nowiki&gt;
2461 </pre>
2462 <p>&lt;/nowiki&gt;
2463 &lt;/pre&gt;
2464 </p><p>
2465 &lt;pre&gt;
2466 &lt;nowiki&gt;
2467 &lt;/pre&gt;
2468
2469 &lt;/pre&gt;
2470 </p>
2471 !! html/parsoid
2472 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2473 </pre>
2474 <p>&lt;/nowiki></p>
2475
2476
2477 <p><span typeof="mw:Nowiki">
2478 &lt;pre>
2479 &lt;nowiki>
2480 &lt;/pre>
2481 </span></p>
2482 !! end
2483
2484 !! test
2485 </pre> inside nowiki
2486 !! wikitext
2487 <nowiki></pre></nowiki>
2488 !! html
2489 <p>&lt;/pre&gt;
2490 </p>
2491 !! end
2492
2493 !! test
2494 Empty pre; pre inside other HTML tags (T56946)
2495 !! wikitext
2496 a
2497
2498 <div><pre>
2499 foo
2500 </pre></div>
2501 <pre></pre>
2502 !! html/php+tidy
2503 <p>a
2504 </p>
2505 <div><pre>foo
2506 </pre></div>
2507 <pre></pre>
2508 !! html/parsoid
2509 <p>a</p>
2510
2511 <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
2512 </pre></div>
2513 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2514 !! end
2515
2516 !! test
2517 HTML pre followed by indent-pre
2518 !! wikitext
2519 <pre>foo</pre>
2520 bar
2521 !! html
2522 <pre>foo</pre>
2523 <pre>bar
2524 </pre>
2525 !! end
2526
2527 !! test
2528 Block tag pre
2529 !! wikitext
2530 <p><pre>foo</pre></p>
2531 !! html/php+tidy
2532 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2533 !! html/parsoid
2534 <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>
2535 !! end
2536
2537 !!test
2538 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2539 !! wikitext
2540 {{echo|}}
2541 !! html
2542
2543 !!end
2544
2545 !!test
2546 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2547 !! wikitext
2548 {{echo|
2549 foo}}
2550 !! html
2551 <p>foo
2552 </p>
2553 !!end
2554
2555 !! test
2556 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2557 !! wikitext
2558 {{echo|a
2559 b}}
2560 !! html
2561 <pre>a
2562 </pre>
2563 <p>b
2564 </p>
2565 !!end
2566
2567 !! test
2568 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2569 !! wikitext
2570 {{echo|a
2571 b
2572 c
2573 d
2574 e
2575 }}
2576 !! html
2577 <pre>a
2578 </pre>
2579 <p>b
2580 c
2581 </p>
2582 <pre>d
2583 </pre>
2584 <p>e
2585 </p>
2586 !!end
2587
2588 !!test
2589 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2590 !! wikitext
2591 {{echo| foo}}
2592
2593 {{echo| foo}}{{echo| bar}}
2594
2595 {{echo| foo}}
2596 {{echo| bar}}
2597
2598 {{echo|<!--cmt--> foo}}
2599
2600 <!--cmt-->{{echo| foo}}
2601
2602 {{echo|{{echo| }}bar}}
2603 !! html
2604 <pre>foo
2605 </pre>
2606 <pre>foo bar
2607 </pre>
2608 <pre>foo
2609 bar
2610 </pre>
2611 <pre>foo
2612 </pre>
2613 <pre>foo
2614 </pre>
2615 <pre>bar
2616 </pre>
2617 !!end
2618
2619 !! test
2620 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2621 !! wikitext
2622 {{echo| }}a
2623
2624 {{echo|
2625 }}a
2626
2627 {{echo|
2628 b}}
2629
2630 {{echo|a
2631 }}b
2632
2633 {{echo|a
2634 }} b
2635 !! html
2636 <pre>a
2637 </pre>
2638 <p><br />
2639 </p>
2640 <pre>a
2641 </pre>
2642 <p><br />
2643 </p>
2644 <pre>b
2645 </pre>
2646 <p>a
2647 </p>
2648 <pre>b
2649 </pre>
2650 <p>a
2651 </p>
2652 <pre>b
2653 </pre>
2654 !!end
2655
2656 ## Hmm, should Parsoid rt this?
2657 !! test
2658 Pres with newline attributes
2659 !! options
2660 parsoid=wt2html,html2html
2661 !! wikitext
2662 <pre class="one
2663 two">hi</pre>
2664 !! html/php
2665 <pre class="one two">hi</pre>
2666
2667 !! html/parsoid
2668 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2669 !! end
2670
2671 !! test
2672 Things that look like <pre> tags aren't treated as such
2673 !! wikitext
2674 Barack Obama <President> of the United States
2675 <President></President>
2676 !! html
2677 <p>Barack Obama &lt;President&gt; of the United States
2678 &lt;President&gt;&lt;/President&gt;
2679 </p>
2680 !! end
2681
2682 !! test
2683 Handle broken pre-like tags (T66025)
2684 !! options
2685 parsoid=wt2html
2686 !! wikitext
2687 {{echo|<pre <pre>x</pre>}}
2688
2689 <table><pre </table>
2690 !! html/php
2691 <pre>x</pre>
2692 <table>&lt;pre </table>
2693
2694 !! html/php+tidy
2695 <pre>x</pre>
2696 &lt;pre <table></table>
2697 !! html/parsoid
2698 <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>
2699
2700
2701 <p>&lt;pre </p>
2702
2703 <table></table>
2704 !! end
2705
2706 !! test
2707 Parsoid: handle pre with space after attribute
2708 !! options
2709 parsoid=wt2html
2710 !! wikitext
2711 <pre style="width:50%;" >{{echo|foo}}</pre>
2712 !! html/php
2713 <pre style="width:50%;">{{echo|foo}}</pre>
2714
2715 !! html/parsoid
2716 <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>
2717 !! end
2718
2719 # TODO / maybe: fix wt2wt for this
2720 !! test
2721 Parsoid: Don't paragraph-wrap fosterable content
2722 !! options
2723 parsoid=wt2html
2724 !! wikitext
2725 {|
2726 <td></td>
2727 <td></td>
2728
2729
2730
2731 |}
2732 !! html
2733 <table>
2734
2735 <tbody>
2736 <tr>
2737 <td></td>
2738
2739 <td></td></tr>
2740
2741
2742
2743 </tbody></table>
2744 !! end
2745
2746 !! test
2747 Self-closed pre
2748 !! wikitext
2749 <pre />
2750 !! html/php
2751 <pre></pre>
2752
2753 !! html/parsoid
2754 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2755 !! end
2756
2757 !! test
2758 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2759 !! options
2760 parsoid=wt2html
2761 !! wikitext
2762 {|
2763 <td>
2764 <td>
2765 </td>
2766
2767
2768
2769 |}
2770 !! html
2771 <table>
2772
2773 <tbody>
2774 <tr>
2775 <td></td>
2776
2777 <td>
2778 </td></tr>
2779
2780
2781
2782 </tbody></table>
2783 !! end
2784
2785
2786 #--------------------------------------------------------------------
2787 # Transclusion parameter whitespace stripping tests
2788 # Behavior is different for positional and named parameters
2789 #--------------------------------------------------------------------
2790 !! test
2791 Templates: Strip leading and trailing whitespace from named-param values
2792 !! wikitext
2793 {{echo|1= a }}
2794
2795 {{echo|1= {{echo|b}} }}
2796
2797 {{echo| 1 =
2798 c }}
2799
2800 {{echo| 1 =
2801 * d
2802 }}
2803 !! html
2804 <p>a
2805 </p><p>b
2806 </p><p>c
2807 </p>
2808 <ul><li>d</li></ul>
2809
2810 !! end
2811
2812 !! test
2813 Templates: Don't strip whitespace from positional-param values
2814 !! wikitext
2815 {{echo|a }}
2816
2817 {{echo|{{echo|b}} }}
2818
2819 {{echo| c
2820 }}
2821
2822 {{echo| {{echo|d}}
2823 }}
2824
2825 {{echo|
2826 e}}
2827
2828 {{echo|
2829 *f}}
2830
2831 {{echo|
2832 }}g
2833 !! html
2834 <p>a
2835 </p><p>b
2836 </p>
2837 <pre>c
2838 </pre>
2839 <p><br />
2840 </p>
2841 <pre>d
2842 </pre>
2843 <p><br />
2844 </p>
2845 <pre>e
2846 </pre>
2847 <p><br />
2848 </p>
2849 <ul><li>f</li></ul>
2850 <p><br />
2851 </p>
2852 <pre>g
2853 </pre>
2854 !! end
2855
2856 !! test
2857 Templates: Don't recognize targets split by newlines
2858 !! options
2859 parsoid=wt2html
2860 !! wikitext
2861 {{ech
2862 o|foo}}
2863 !! html/php
2864 <p>{{ech
2865 o|foo}}
2866 </p>
2867 !! html/parsoid
2868 <p>{{ech
2869 o|foo}}</p>
2870 !! end
2871
2872 !! test
2873 Templates: Recognize targets when newlines and comments don't split the target
2874 !! options
2875 parsoid=wt2html
2876 !! wikitext
2877 {{
2878 <!--X--> ech<!--X-->o<!--X-->
2879 <!--X--> <!--X-->
2880
2881 |foo}}
2882 !! html/php
2883 <p>foo
2884 </p>
2885 !! html/parsoid
2886 <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>
2887 !! end
2888
2889 !! test
2890 Templates: Handle empty comment-and-ws-only lines correctly
2891 !! wikitext
2892 {{echo|foo
2893 <!--should be ignored-->
2894 <!--should be ignored as well-->
2895 bar}}
2896 !! html/php
2897 <p>foo
2898 bar
2899 </p>
2900 !! html/parsoid
2901 <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>
2902 !! end
2903
2904 !! test
2905 Templates: Handle comments in the target
2906 !! wikitext
2907 {{echo
2908 <!-- should be ignored -->
2909 |foo}}
2910
2911 {{echo
2912 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2913 |foo}}
2914
2915 {{echo<!-- should be ignored -->
2916 |foo}}
2917
2918 {{echo<!-- should be ignored -->|foo}}
2919
2920 {{<!-- should be ignored -->echo|foo}}
2921 !! html/php
2922 <p>foo
2923 </p><p>foo
2924 </p><p>foo
2925 </p><p>foo
2926 </p><p>foo
2927 </p>
2928 !! html/parsoid
2929 <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>
2930
2931 <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>
2932
2933 <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>
2934
2935 <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>
2936
2937 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2938 !! end
2939
2940 !! test
2941 Templates: Handle comments in parameter names (T69657)
2942 !! wikitext
2943 {{echo|1
2944 <!-- should be ignored -->
2945 =foo}}
2946
2947 {{echo|
2948 <!-- should be ignored -->
2949 1 = foo}}
2950
2951 {{echo|1<!-- should be ignored -->=foo}}
2952
2953 {{echo|<!-- should be ignored -->1=foo}}
2954 !! html/php
2955 <p>foo
2956 </p><p>foo
2957 </p><p>foo
2958 </p><p>foo
2959 </p>
2960 !! html/parsoid
2961 <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>
2962
2963 <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>
2964
2965 <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>
2966
2967 <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>
2968 !! end
2969
2970 !! test
2971 Templates: Other wikitext in parameter names (T69657)
2972 !! wikitext
2973 {{echo|''1''=foo}}
2974 !! html/php
2975 <p>{{{1}}}
2976 </p>
2977 !! html/parsoid
2978 <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>
2979 !! end
2980
2981 !! test
2982 Templates: With colons
2983 !! wikitext
2984 {{With: Colon}}
2985 !! html/php
2986 <p>Template with colon
2987 </p>
2988 !! html/parsoid
2989 <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>
2990 !! end
2991
2992 #--------------------------------------------------------------------
2993 # Transclusion parameter escaping tests
2994 #--------------------------------------------------------------------
2995
2996 !! test
2997 Templates: Parsoid parameter escaping test 1
2998 !! wikitext
2999 {{echo|[foo]|{{echo|[bar]}}}}
3000 !! html/php+tidy
3001 <p>[foo]
3002 </p>
3003 !! html/parsoid
3004 <p about="#mwt1" typeof="mw:Transclusion"
3005 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3006 !! end
3007
3008 !! test
3009 Parsoid: Pipes in external links in template parameter
3010 !! wikitext
3011 {{echo|[{{echo|http://example.com}} link]}}
3012 !! html/php+tidy
3013 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3014 </p>
3015 !! html/parsoid
3016 <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>
3017 !! end
3018
3019 !! test
3020 Parsoid: pipe in transclusion parameter
3021 !! wikitext
3022 {{echo|http://foo.com/a&#124;b}}
3023 !! html/php+tidy
3024 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3025 </p>
3026 !! html/parsoid
3027 <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>
3028 !! end
3029
3030 !! test
3031 Parsoid: Pipe in external link target and content in template parameter
3032 !! options
3033 parsoid=html2wt,wt2wt
3034 !! wikitext
3035 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3036 !! html/php+tidy
3037 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3038 </p>
3039 !! html/parsoid
3040 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3041 typeof="mw:Transclusion"
3042 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3043 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3044 !! end
3045
3046 !! test
3047 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3048 !! options
3049 parsoid
3050 !! wikitext
3051 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3052 !! html
3053 <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>
3054 !! end
3055
3056 !! test
3057 Templates: Don't escape already nowiki-escaped text in template parameters
3058 !! options
3059 parsoid=html2wt,wt2wt
3060 !! wikitext
3061 {{echo|foo<nowiki>|</nowiki>bar}}
3062 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3063 {{echo|<nowiki></nowiki>}}
3064 !! html/php+tidy
3065 <p>foo|bar
3066 &lt;div&gt;
3067
3068 </p>
3069 !! html/parsoid
3070 <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>
3071 <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>
3072 <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>
3073 </p>
3074 !! end
3075
3076 ## T54824
3077 !! test
3078 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3079 !! options
3080 parsoid=html2wt,wt2wt
3081 !! wikitext
3082 {{echo|{{echo|1=bar}}}}
3083 !! html/php+tidy
3084 <p>bar
3085 </p>
3086 !! html/parsoid
3087 <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>
3088 !! end
3089
3090 ## T58733
3091 !! test
3092 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3093 !! wikitext
3094 {{echo|a : b}}
3095 !! html/php+tidy
3096 <p>a&#160;: b
3097 </p>
3098 !! html/parsoid
3099 <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>
3100 !! end
3101
3102 ## T73412
3103 !! test
3104 Templates: Preserve blank parameter names
3105 !! wikitext
3106 {{echo|=foo}}
3107 !! html/php+tidy
3108 <p>{{{1}}}
3109 </p>
3110 !! html/parsoid
3111 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3112 !! end
3113
3114 !! test
3115 Templates: Preserve blank parameter names in other positions
3116 !! wikitext
3117 {{blank_param|bar|=foo}}
3118 !! html/php+tidy
3119 <p>bar
3120 foo
3121 </p>
3122 !! html/parsoid
3123 <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
3124 foo</p>
3125 !! end
3126
3127 ###
3128 ### Parsoid-centric tests for testing RT edge cases for pre
3129 ###
3130
3131 !!test
3132 1a. Indent-Pre and Comments
3133 !! wikitext
3134 a
3135 <!--a-->
3136 c
3137 !! html
3138 <pre>a
3139 </pre>
3140 <p>c
3141 </p>
3142 !!end
3143
3144 !!test
3145 1b. Indent-Pre and Comments
3146 !! wikitext
3147 a
3148 <!--a-->
3149 c
3150 !! html
3151 <pre>a
3152 </pre>
3153 <p>c
3154 </p>
3155 !!end
3156
3157 !!test
3158 1c. Indent-Pre and Comments
3159 !! wikitext
3160 <!--a--> a
3161
3162 <!--a--> a
3163 !! html
3164 <pre> a
3165 </pre>
3166 <pre> a
3167 </pre>
3168 !!end
3169
3170 !!test
3171 1d. Indent-Pre and Comments
3172 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3173 !! wikitext
3174 <!--a--> a
3175
3176 <!--b-->b
3177 !! html
3178 <pre>a
3179 </pre>
3180 <pre>b
3181 </pre>
3182 !!end
3183
3184 !!test
3185 2a. Indent-Pre and tables
3186 !! wikitext
3187 {|
3188 |-
3189 !h1!!h2
3190 |foo||bar
3191 |}
3192 !! html
3193 <table>
3194
3195 <tr>
3196 <th>h1</th>
3197 <th>h2
3198 </th>
3199 <td>foo</td>
3200 <td>bar
3201 </td></tr></table>
3202
3203 !!end
3204
3205 !!test
3206 2b. Indent-Pre and tables
3207 !! wikitext
3208 {|
3209 |-
3210 |foo
3211 |}
3212 !! html
3213 <table>
3214
3215 <tr>
3216 <td>foo
3217 </td></tr></table>
3218
3219 !!end
3220
3221 !!test
3222 2c. Indent-Pre and tables (T44252)
3223 !! wikitext
3224 {|
3225 |+foo
3226 ! |bar
3227 |}
3228 !! html
3229 <table>
3230 <caption>foo
3231 </caption>
3232 <tr>
3233 <th>bar
3234 </th></tr></table>
3235
3236 !!end
3237
3238 !!test
3239 2d. Indent-Pre and tables
3240 !! wikitext
3241 a
3242 {|
3243 |b
3244 |}
3245 !! html/php
3246 <pre>a
3247 </pre>
3248 <table>
3249 <tr>
3250 <td>b
3251 </td></tr></table>
3252
3253 !! html/parsoid
3254 <pre>a</pre>
3255 <table>
3256 <tbody><tr><td> b</td></tr>
3257 </tbody></table>
3258 !!end
3259
3260 !!test
3261 2e. Indent-Pre and table-line syntax
3262 !! wikitext
3263 a
3264 | b
3265 | c
3266 !! html/php
3267 <pre>a
3268 | b
3269 | c
3270 </pre>
3271 !!end
3272
3273 !!test
3274 2f. Indent-pre started by table-line syntax
3275 !! wikitext
3276 a
3277 | b
3278 | c
3279 !! html/php
3280 <p>a
3281 </p>
3282 <pre>| b
3283 | c
3284 </pre>
3285 !! html/parsoid
3286 <p>a</p>
3287 <pre>
3288 | b
3289 | c</pre>
3290 !!end
3291
3292 !! test
3293 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3294 !! wikitext
3295 <table>
3296 <tr>
3297 <td>
3298 Text that should be rendered preformatted
3299 </td>
3300 </tr>
3301 </table>
3302 !! html
3303 <table>
3304 <tr>
3305 <td>
3306 <pre>Text that should be rendered preformatted
3307 </pre>
3308 </td>
3309 </tr>
3310 </table>
3311
3312 !! end
3313
3314 !!test
3315 3a. Indent-Pre and block tags (single-line html)
3316 !! wikitext
3317 a <p> foo </p>
3318 b <div> foo </div>
3319 c <blockquote> foo </blockquote>
3320 <span> foo </span>
3321 !! html
3322 a <p> foo </p>
3323 b <div> foo </div>
3324 c <blockquote> foo </blockquote>
3325 <pre><span> foo </span>
3326 </pre>
3327 !! html/parsoid
3328 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3329 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3330 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3331 <pre><span> foo </span>
3332 </pre>
3333 !! html/php+tidy
3334 <p> a </p><p> foo </p><p>
3335 b </p><div> foo </div><p>
3336 c </p><blockquote><p> foo </p></blockquote>
3337 <pre><span> foo </span>
3338 </pre>
3339 !! end
3340
3341 !!test
3342 3b. Indent-Pre and block tags (multi-line html)
3343 !! wikitext
3344 a <span>foo</span>
3345 b <div> foo </div>
3346 !! html
3347 <pre>a <span>foo</span>
3348 </pre>
3349 b <div> foo </div>
3350
3351 !! html/parsoid
3352 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3353 b <div data-parsoid='{"stx":"html"}'> foo </div>
3354 !! html/php+tidy
3355 <pre>a <span>foo</span>
3356 </pre><p>
3357 b </p><div> foo </div>
3358 !!end
3359
3360 !!test
3361 3c. Indent-Pre and block tags (pre-content on separate line)
3362 !! wikitext
3363 <p>
3364 foo
3365 </p>
3366
3367 <div>
3368 foo
3369 </div>
3370
3371 <center>
3372 foo
3373 </center>
3374
3375 <blockquote>
3376 foo
3377 </blockquote>
3378
3379 <blockquote>
3380 <pre>
3381 foo
3382 </pre>
3383 </blockquote>
3384
3385 <table><tr><td>
3386 foo
3387 </td></tr></table>
3388
3389 <ul><li>
3390 foo
3391 </li></ul>
3392
3393 !! html
3394 <p>
3395 foo
3396 </p>
3397 <div>
3398 <pre>foo
3399 </pre>
3400 </div>
3401 <center>
3402 <pre>foo
3403 </pre>
3404 </center>
3405 <blockquote>
3406 <p> foo
3407 </p>
3408 </blockquote>
3409 <blockquote>
3410 <pre>
3411 foo
3412 </pre>
3413 </blockquote>
3414 <table><tr><td>
3415 <pre>foo
3416 </pre>
3417 </td></tr></table>
3418 <ul><li>
3419 foo
3420 </li></ul>
3421
3422 !!end
3423
3424 !! test
3425 4. Indent-Pre and extension tags
3426 !! wikitext
3427 a <tag />
3428 !! html/php
3429 a <pre>
3430 NULL
3431 array (
3432 )
3433 </pre>
3434
3435 !! html/parsoid
3436 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3437 !! end
3438
3439 !! test
3440 5. Indent-Pre and html pre
3441 !! wikitext
3442 <pre class="123">hi</pre>
3443 !! html/php
3444 <pre class="123">hi</pre>
3445
3446 !! html/parsoid
3447 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3448 !! end
3449
3450 !!test
3451 Render paragraphs when indent-pre is suppressed in blocklevels
3452 !! wikitext
3453 <blockquote>
3454 foo
3455
3456 bar
3457 </blockquote>
3458 !! html
3459 <blockquote>
3460 <p> foo
3461 </p><p> bar
3462 </p>
3463 </blockquote>
3464
3465 !!end
3466
3467 !!test
3468 4. Multiple spaces at start-of-line
3469 !! wikitext
3470 <p> foo </p>
3471 foo
3472 {|
3473 |foo
3474 |}
3475 !! html
3476 <p> foo </p>
3477 <pre> foo
3478 </pre>
3479 <table>
3480 <tr>
3481 <td>foo
3482 </td></tr></table>
3483
3484 !!end
3485
3486 ## NOTE: the leading white-space chars on empty line are significant
3487 !! test
3488 5a. White-space in indent-pre
3489 !! wikitext
3490 a<br />
3491
3492 b
3493 !! html
3494 <pre>a<br />
3495
3496 b
3497 </pre>
3498 !! end
3499
3500 ## NOTE: the leading white-space chars on empty line are significant
3501 !! test
3502 5b. White-space in indent-pre
3503 !! wikitext
3504 a
3505
3506 b
3507
3508
3509 c
3510 !! html
3511 <pre>a
3512
3513 b
3514
3515
3516 c
3517 </pre>
3518 !! end
3519
3520 !! test
3521 5c. White-space in indent-pre
3522 !! wikitext
3523 ''a''
3524 ''b''
3525 ''c''
3526 !! html
3527 <pre><i>a</i>
3528 <i>b</i>
3529 <i>c</i>
3530 </pre>
3531 !! end
3532
3533 !! test
3534 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3535 !! wikitext
3536 a
3537
3538 <!-- continue -->
3539 b
3540
3541 c
3542
3543 d
3544 !! html
3545 <pre>a
3546
3547 b
3548 </pre>
3549 <pre>c
3550
3551 </pre>
3552 <p>d
3553 </p>
3554 !! end
3555
3556 !! test
3557 7a. Indent-pre and category links
3558 !! options
3559 parsoid=wt2html,wt2wt
3560 !! wikitext
3561 [[Category:foo]] <!-- No pre-wrapping -->
3562 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3563 !! html/php+tidy
3564 !! html/parsoid
3565 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3566 <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 -->
3567 !! end
3568
3569 ## We used to, but no longer wt2wt this test since the default serializer
3570 ## will normalize all categories to serialize on their own line.
3571 ## This wikitext usage is going to be fairly uncommon in production and
3572 ## selser will take care of preserving formatting in those scenarios.
3573 !! test
3574 7b. Indent-pre and category links
3575 !! options
3576 parsoid=wt2html
3577 !! wikitext
3578 [[Category:foo]] a
3579 [[Category:foo]] {{echo|b}}
3580 !! html/parsoid
3581 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3582 <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>
3583 !! end
3584
3585 !! test
3586 Indent-Pre: Newlines in comments shouldn't affect sol state
3587 !! wikitext
3588 a <!--
3589 foo
3590 --> b
3591 !! html/php+tidy
3592 <p>a b
3593 </p>
3594 !! html/parsoid
3595 <p>a <!--
3596 foo
3597 --> b</p>
3598 !! end
3599
3600 ###
3601 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3602 ###
3603
3604 !!test
3605 HTML-pre: 1. embedded newlines
3606 !! wikitext
3607 <pre>foo</pre>
3608
3609 <pre>
3610 foo
3611 </pre>
3612
3613 <pre>
3614
3615 foo
3616 </pre>
3617
3618 <pre>
3619
3620
3621 foo
3622 </pre>
3623 !! html/php+tidy
3624 <pre>foo</pre>
3625 <pre>foo
3626 </pre>
3627 <pre>
3628
3629 foo
3630 </pre>
3631 <pre>
3632
3633
3634 foo
3635 </pre>
3636 !! html/parsoid
3637 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3638
3639 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3640 </pre>
3641
3642 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3643
3644 foo
3645 </pre>
3646
3647 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3648
3649
3650 foo
3651 </pre>
3652 !!end
3653
3654 !! test
3655 HTML-pre: big spaces
3656 !! wikitext
3657 <pre>
3658
3659
3660
3661
3662 haha
3663
3664
3665
3666
3667 haha
3668
3669
3670
3671
3672 </pre>
3673 !! html/php+tidy
3674 <pre>
3675
3676
3677
3678
3679 haha
3680
3681
3682
3683
3684 haha
3685
3686
3687
3688
3689 </pre>
3690 !! html/parsoid
3691 <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"}}'>
3692
3693
3694
3695
3696 haha
3697
3698
3699
3700
3701 haha
3702
3703
3704
3705
3706 </pre>
3707 !! end
3708
3709 !!test
3710 HTML-pre: 2: indented text
3711 !! wikitext
3712 <pre>
3713 foo
3714 </pre>
3715 !! html
3716 <pre>
3717 foo
3718 </pre>
3719
3720 !!end
3721
3722 !!test
3723 HTML-pre: 3: other wikitext
3724 !! wikitext
3725 <pre>
3726 * foo
3727 # bar
3728 = no-h =
3729 '' no-italic ''
3730 [[ NoLink ]]
3731 </pre>
3732 !! html/php
3733 <pre>
3734 * foo
3735 # bar
3736 = no-h =
3737 '' no-italic ''
3738 [[ NoLink ]]
3739 </pre>
3740
3741 !! html/parsoid
3742 <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
3743 # bar
3744 = no-h =
3745 '' no-italic ''
3746 [[ NoLink ]]
3747 </pre>
3748 !!end
3749
3750 ###
3751 ### Definition lists
3752 ###
3753 !! test
3754 Simple definition
3755 !! wikitext
3756 ;name :Definition
3757 !! html
3758 <dl><dt>name&#160;</dt>
3759 <dd>Definition</dd></dl>
3760
3761 !! end
3762
3763 !! test
3764 Definition list for indentation only
3765 !! wikitext
3766 :Indented text
3767 !! html
3768 <dl><dd>Indented text</dd></dl>
3769
3770 !! end
3771
3772 !! test
3773 Definition list with no space
3774 !! wikitext
3775 ;name:Definition
3776 !! html
3777 <dl><dt>name</dt>
3778 <dd>Definition</dd></dl>
3779
3780 !!end
3781
3782 !! test
3783 Definition list with URL link
3784 !! wikitext
3785 ;http://example.com/ :definition
3786 !! html
3787 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3788 <dd>definition</dd></dl>
3789
3790 !! end
3791
3792 !! test
3793 Definition list with bracketed URL link
3794 !! wikitext
3795 ;[http://www.example.com/ Example]:Something about it
3796 !! html
3797 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3798 <dd>Something about it</dd></dl>
3799
3800 !! end
3801
3802 !! test
3803 Definition list with wikilink containing colon
3804 !! wikitext
3805 ; [[Help:FAQ]]:The least-read page on Wikipedia
3806 !! html
3807 <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>
3808 <dd>The least-read page on Wikipedia</dd></dl>
3809
3810 !! end
3811
3812 # At Brion's and JeLuF's insistence... :)
3813 !! test
3814 Definition list with news link containing colon
3815 !! wikitext
3816 ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
3817 !! html/php
3818 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3819 <dd>This isn't even a real newsgroup!</dd></dl>
3820
3821 !! html/parsoid
3822 <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>
3823 !! end
3824
3825 !! test
3826 Malformed definition list with colon
3827 !! wikitext
3828 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3829 !! html
3830 <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>
3831
3832 !! end
3833
3834 !! test
3835 Definition lists: colon in external link text
3836 !! wikitext
3837 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
3838 !! html
3839 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
3840 <dd>OK, I made that up</dd></dl>
3841
3842 !! end
3843
3844 !! test
3845 Definition lists: colon in HTML attribute
3846 !! wikitext
3847 ;<b style="display: inline">bold</b>
3848 !! html
3849 <dl><dt><b style="display: inline">bold</b></dt></dl>
3850
3851 !! end
3852
3853 !! test
3854 Definition lists: self-closed tag
3855 !! wikitext
3856 ;one<br/>two :two-line fun
3857 !! html
3858 <dl><dt>one<br />two&#160;</dt>
3859 <dd>two-line fun</dd></dl>
3860
3861 !! end
3862
3863 !! test
3864 Definition lists: ignore colons inside tags
3865 !! wikitext
3866 ;one <b>two : tag <i>fun:</i>:</b>:def
3867 !! html
3868 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3869 <dd>def</dd></dl>
3870
3871 !! end
3872
3873 !! test
3874 Definition lists: excess closed tags
3875 !! wikitext
3876 ;one</b>two :bad tag fun
3877 !! html/php+tidy
3878 <dl><dt>onetwo&#160;</dt>
3879 <dd>bad tag fun</dd></dl>
3880 !! html/parsoid
3881 <dl>
3882 <dt>onetwo</dt>
3883 <dd>bad tag fun</dd>
3884 </dl>
3885 !! end
3886
3887 !! test
3888 T13748: Literal closing tags
3889 !! wikitext
3890 <dl>
3891 <dt>test 1</dt>
3892 <dd>test test test test test</dd>
3893 <dt>test 2</dt>
3894 <dd>test test test test test</dd>
3895 </dl>
3896 !! html
3897 <dl>
3898 <dt>test 1</dt>
3899 <dd>test test test test test</dd>
3900 <dt>test 2</dt>
3901 <dd>test test test test test</dd>
3902 </dl>
3903
3904 !! end
3905
3906 !! test
3907 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3908 !! wikitext
3909 <ul><li>
3910 ;term :description
3911 *unordered
3912 </li></ul>
3913 !! html
3914 <ul><li>
3915 <dl><dt>term&#160;</dt>
3916 <dd>description</dd></dl>
3917 <ul><li>unordered</li></ul>
3918 </li></ul>
3919
3920 !! end
3921
3922 !! test
3923 Definition list with empty definition and following paragraph
3924 !! wikitext
3925 ;term:
3926
3927 Paragraph text
3928 !! html
3929 <dl><dt>term</dt>
3930 <dd></dd></dl>
3931 <p>Paragraph text
3932 </p>
3933 !! end
3934
3935 !! test
3936 Nested definition lists using html syntax
3937 !! wikitext
3938 <dl><dt>x</dt>
3939 <dd>a</dd>
3940 <dd>b</dd></dl>
3941 !! html
3942 <dl><dt>x</dt>
3943 <dd>a</dd>
3944 <dd>b</dd></dl>
3945
3946 !! end
3947
3948 !! test
3949 Definition Lists: No nesting: Multiple dd's
3950 !! wikitext
3951 ;x
3952 :a
3953 :b
3954 !! html
3955 <dl><dt>x</dt>
3956 <dd>a</dd>
3957 <dd>b</dd></dl>
3958
3959 !! end
3960
3961 !! test
3962 Definition Lists: Indentation: Regular
3963 !! wikitext
3964 :i1
3965 ::i2
3966 :::i3
3967 !! html
3968 <dl><dd>i1
3969 <dl><dd>i2
3970 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3971
3972 !! end
3973
3974 !! test
3975 Definition Lists: Indentation: Missing 1st level
3976 !! wikitext
3977 ::i2
3978 :::i3
3979 !! html
3980 <dl><dd><dl><dd>i2
3981 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3982
3983 !! end
3984
3985 !! test
3986 Definition Lists: Indentation: Multi-level indent
3987 !! wikitext
3988 :::i3
3989 !! html
3990 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3991
3992 !! end
3993
3994 !! test
3995 Definition Lists: Hacky use to indent tables
3996 !! wikitext
3997 ::{|
3998 |foo
3999 |bar
4000 |}
4001 this text
4002 should be left alone
4003 !! html
4004 <dl><dd><dl><dd><table>
4005 <tr>
4006 <td>foo
4007 </td>
4008 <td>bar
4009 </td></tr></table></dd></dl></dd></dl>
4010 <p>this text
4011 should be left alone
4012 </p>
4013 !! end
4014
4015 !! test
4016 Definition Lists: Hacky use to indent tables (with content following table)
4017 !! wikitext
4018 :{|
4019 |foo
4020 |bar
4021 |} <!--c1--> this text should be part of the dl
4022 !! html/php+tidy
4023 <dl><dd><table>
4024 <tbody><tr>
4025 <td>foo
4026 </td>
4027 <td>bar
4028 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4029 !! html/parsoid
4030 <dl><dd><table>
4031 <tbody><tr>
4032 <td>foo
4033 </td>
4034 <td>bar
4035 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4036 !! end
4037
4038 !! test
4039 Definition Lists: Hacky use to indent tables, with comments (T65979)
4040 !! wikitext
4041 <!-- foo -->
4042 ::{|
4043 |foo
4044 |bar
4045 |}<!-- bar -->
4046 this text
4047 should be left alone
4048 !! html/parsoid
4049 <!-- foo -->
4050 <dl><dd><dl><dd><table><tr>
4051 <td>foo</td>
4052 <td>bar</td>
4053 </tr></table><!-- bar --></dd></dl></dd></dl>
4054 <p>this text
4055 should be left alone</p>
4056 !! end
4057
4058 !! test
4059 Definition Lists: Hacky use to indent tables, with comment before table
4060 !! wikitext
4061 ::<!-- foo -->{|
4062 |foo
4063 |}
4064 !! html/parsoid
4065 <dl><dd><dl><dd><!-- foo --><table><tr>
4066 <td>foo</td>
4067 </tr></table></dd></dl></dd></dl>
4068 !! end
4069
4070 # The trailing whitespace in this test is to catch a regression in
4071 # Parsoid after T54473.
4072 !! test
4073 Definition Lists: Hacky use to indent tables (WS-insensitive)
4074 !! wikitext
4075 : {|
4076 |a
4077 |}
4078 !! html/php
4079 <dl><dd><table>
4080 <tr>
4081 <td>a
4082 </td></tr></table></dd></dl>
4083
4084 !! html/parsoid
4085 <dl><dd> <table>
4086 <tbody><tr><td>a</td></tr>
4087 </tbody></table> </dd></dl>
4088 !! end
4089
4090 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4091 ## as an empty dt item. It also ignores all but the last ";" when followed
4092 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4093 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4094 ## ";"s.
4095 ##
4096 ## Ex: ";;t2 ::d2" is transformed into:
4097 ##
4098 ## <dl>
4099 ## <dt>t2 </dt>
4100 ## <dd>
4101 ## <dl>
4102 ## <dt></dt>
4103 ## <dd>d2</dd>
4104 ## </dl>
4105 ## </dd>
4106 ## </dl>
4107 ##
4108 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4109 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4110 ##
4111 ## <dl>
4112 ## <dt>
4113 ## <dl>
4114 ## <dt>t2 </dt>
4115 ## <dd>:d2</dd>
4116 ## </dl>
4117 ## </dt>
4118 ## </dl>
4119 ##
4120 ## All Parsoid only definition list tests have this difference.
4121 ##
4122 ## See also: https://phabricator.wikimedia.org/T8569
4123 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4124
4125 !! test
4126 Table / list interaction: indented table with lists in table contents
4127 !! wikitext
4128 :{|
4129 |-
4130 |a
4131
4132 *b
4133 |-
4134 |c
4135
4136 *d
4137 |}
4138 !! html
4139 <dl><dd><table>
4140
4141 <tr>
4142 <td>a
4143 <ul><li>b</li></ul>
4144 </td></tr>
4145 <tr>
4146 <td>c
4147 <ul><li>d</li></ul>
4148 </td></tr></table></dd></dl>
4149
4150 !! end
4151
4152 !!test
4153 Table / list interaction: lists nested in tables nested in indented lists
4154 !! wikitext
4155 :{|
4156 |
4157 :a
4158 :b
4159 |
4160 *c
4161 *d
4162 |}
4163
4164 *e
4165 *f
4166 !! html
4167 <dl><dd><table>
4168 <tr>
4169 <td>
4170 <dl><dd>a</dd>
4171 <dd>b</dd></dl>
4172 </td>
4173 <td>
4174 <ul><li>c</li>
4175 <li>d</li></ul>
4176 </td></tr></table></dd></dl>
4177 <ul><li>e</li>
4178 <li>f</li></ul>
4179
4180 !!end
4181
4182 !! test
4183 Definition Lists: Nesting: Multi-level (Parsoid only)
4184 !! wikitext
4185 ;t1 :d1
4186 ;;t2 ::d2
4187 ;;;t3 :::d3
4188 !! html/parsoid
4189 <dl>
4190 <dt>t1 </dt>
4191 <dd>d1</dd>
4192 <dt>
4193 <dl>
4194 <dt>t2 </dt>
4195 <dd>:d2</dd>
4196 <dt>
4197 <dl>
4198 <dt>t3 </dt>
4199 <dd>::d3</dd>
4200 </dl>
4201 </dt>
4202 </dl>
4203 </dt>
4204 </dl>
4205
4206
4207 !! end
4208
4209
4210 !! test
4211 Definition Lists: Nesting: Test 2
4212 !! wikitext
4213 ;t1
4214 ::d2
4215 !! html+tidy
4216 <dl><dt>t1</dt>
4217 <dd>
4218 <dl><dd>d2</dd></dl></dd></dl>
4219 !! end
4220