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