Merge "parser: Update outdated comment about ImageGallery"
[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 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <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>
296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./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>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <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>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <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>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <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>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Heading with line break in nowiki
533 !! options
534 parsoid=wt2html
535 !! wikitext
536 == A <nowiki>B
537 C</nowiki> ==
538 !! html
539 <h2><span class="mw-headline" id="A_B.0AC">A B
540 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>
541
542 !! html/parsoid
543 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
544 C</span> </h2>
545 !! end
546
547 !! test
548 Parsing an URL
549 !! wikitext
550 http://fr.wikipedia.org/wiki/🍺
551 <!-- EasterEgg we love beer, better be able be able to link to it -->
552 !! html
553 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
554 </p>
555 !! end
556
557 # Note that the html+tidy output removes the spaces after the <li>,
558 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
559 # This is an issue for all tests with lists. We intentionally do
560 # *not* add html+tidy clauses for these, as we don't want to
561 # document/test the broken behavior. (Parsoid matches the non-tidy
562 # output in these cases.)
563
564 !! test
565 Simple list
566 !! wikitext
567 * Item 1
568 * Item 2
569 !! html
570 <ul><li> Item 1</li>
571 <li> Item 2</li></ul>
572
573 !! end
574
575 !! test
576 Italics and bold
577 !! wikitext
578 * plain
579 * plain''italic''plain
580 * plain''italic''plain''italic''plain
581 * plain'''bold'''plain
582 * plain'''bold'''plain'''bold'''plain
583 * plain''italic''plain'''bold'''plain
584 * plain'''bold'''plain''italic''plain
585 * plain''italic'''bold-italic'''italic''plain
586 * plain'''bold''bold-italic''bold'''plain
587 * plain'''''bold-italic'''italic''plain
588 * plain'''''bold-italic''bold'''plain
589 * plain''italic'''bold-italic'''''plain
590 * plain'''bold''bold-italic'''''plain
591 * plain l'''italic''plain
592 * plain l''''bold''' plain
593 !! html
594 <ul><li> plain</li>
595 <li> plain<i>italic</i>plain</li>
596 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
597 <li> plain<b>bold</b>plain</li>
598 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
599 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
600 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
601 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
603 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
604 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
605 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
606 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
607 <li> plain l'<i>italic</i>plain</li>
608 <li> plain l'<b>bold</b> plain</li></ul>
609
610 !! end
611
612 # this example taken from the [[simple:Moon]] article (bug 47326)
613 !! test
614 Italics and possessives (1)
615 !! wikitext
616 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
617 !! html
618 <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
619 </p>
620 !! end
621
622 # this example taken from [[en:Flaming Pie]] (bug 49926)
623 !! test
624 Italics and possessives (2)
625 !! wikitext
626 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
627 !! html
628 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
629 </p>
630 !! end
631
632 # this example taken from [[en:Dictionary]] (bug 49926)
633 !! test
634 Italics and possessives (3)
635 !! wikitext
636 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''.
637 !! html
638 <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>.
639 </p>
640 !! end
641
642
643 ###
644 ### 2-quote opening sequence tests
645 ###
646 !! test
647 Italics and bold: 2-quote opening sequence: (2,2)
648 !! wikitext
649 ''foo''
650 !! html
651 <p><i>foo</i>
652 </p>
653 !!end
654
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,3)
657 !! wikitext
658 ''foo'''
659 !! html/*
660 <p><i>foo'</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 2-quote opening sequence: (2,4)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''foo''''
670 !! html/*
671 <p><i>foo''</i>
672 </p>
673 !!end
674
675 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
678 !! wikitext
679 ''foo<nowiki>''</nowiki>''
680 !! html
681 <p><i>foo''</i>
682 </p>
683 !! end
684
685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
686 !! test
687 Italics and bold: 2-quote opening sequence: (2,5)
688 !! options
689 parsoid=wt2html
690 !! wikitext
691 ''foo'''''
692 !! html/php
693 <p><i>foo</i>
694 </p>
695 !! html/parsoid
696 <p><i>foo</i><b></b>
697 </p>
698 !!end
699
700 # same html as previous, but wikitext adjusted to match parsoid html2wt
701 !! test
702 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
703 !! wikitext
704 ''foo'''''<nowiki/>'''
705 !! html/php
706 <p><i>foo</i>
707 </p>
708 !! html/parsoid
709 <p><i>foo</i><b></b>
710 </p>
711 !! end
712
713
714 ###
715 ### 3-quote opening sequence tests
716 ###
717
718 !! test
719 Italics and bold: 3-quote opening sequence: (3,2)
720 !! wikitext
721 '''foo''
722 !! html/*
723 <p>'<i>foo</i>
724 </p>
725 !!end
726
727 !! test
728 Italics and bold: 3-quote opening sequence: (3,3)
729 !! wikitext
730 '''foo'''
731 !! html
732 <p><b>foo</b>
733 </p>
734 !!end
735
736 !! test
737 Italics and bold: 3-quote opening sequence: (3,4)
738 !! wikitext
739 '''foo''''
740 !! html/*
741 <p><b>foo'</b>
742 </p>
743 !!end
744
745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
746 !! test
747 Italics and bold: 3-quote opening sequence: (3,5)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''foo'''''
752 !! html/php
753 <p><b>foo</b>
754 </p>
755 !! html/parsoid
756 <p><b>foo</b><i></i>
757 </p>
758 !!end
759
760 # same html as previous, but wikitext adjusted to match parsoid html2wt
761 !! test
762 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
763 !! wikitext
764 '''foo'''''<nowiki/>''
765 !! html/php
766 <p><b>foo</b>
767 </p>
768 !! html/parsoid
769 <p><b>foo</b><i></i>
770 </p>
771 !! end
772
773
774 ###
775 ### 4-quote opening sequence tests
776 ###
777
778 !! test
779 Italics and bold: 4-quote opening sequence: (4,2)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''''foo''
784 !! html/*
785 <p>''<i>foo</i>
786 </p>
787 !!end
788
789 # same html as previous, but wikitext adjusted to match parsoid html2wt
790 !! test
791 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
792 !! wikitext
793 <nowiki>''</nowiki>''foo''
794 !! html
795 <p>''<i>foo</i>
796 </p>
797 !! end
798
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,3)
801 !! wikitext
802 ''''foo'''
803 !! html/*
804 <p>'<b>foo</b>
805 </p>
806 !!end
807
808 !! test
809 Italics and bold: 4-quote opening sequence: (4,4)
810 !! options
811 parsoid=wt2html
812 !! wikitext
813 ''''foo''''
814 !! html/*
815 <p>'<b>foo'</b>
816 </p>
817 !!end
818
819 # same html as previous, but wikitext adjusted to match parsoid html2wt
820 !! test
821 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
822 !! wikitext
823 '<nowiki/>'''foo''''
824 !! html
825 <p>'<b>foo'</b>
826 </p>
827 !! end
828
829 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
830 !! test
831 Italics and bold: 4-quote opening sequence: (4,5)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 ''''foo'''''
836 !! html/php
837 <p>'<b>foo</b>
838 </p>
839 !! html/parsoid
840 <p>'<b>foo</b><i></i>
841 </p>
842 !!end
843
844 # same html as previous, but wikitext adjusted to match parsoid html2wt
845 !! test
846 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
847 !! wikitext
848 '<nowiki/>'''foo'''''<nowiki/>''
849 !! html/php
850 <p>'<b>foo</b>
851 </p>
852 !! html/parsoid
853 <p>'<b>foo</b><i></i>
854 </p>
855 !! end
856
857
858 ###
859 ### 5-quote opening sequence tests
860 ###
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,2)
864 !! options
865 parsoid=wt2html
866 !! wikitext
867 '''''foo''
868 !! html/*
869 <p><b><i>foo</i></b>
870 </p>
871 !!end
872
873 # same html as previous, but wikitext adjusted to match parsoid html2wt
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,2+3)
876 !! wikitext
877 '''''foo'''''
878 !! html/*
879 <p><i><b>foo</b></i>
880 </p>
881 !! end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,3)
885 !! options
886 parsoid=wt2html
887 !! wikitext
888 '''''foo'''
889 !! html/*
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,3+2)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !! end
903
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,4)
906 !! options
907 parsoid=wt2html
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,5)
917 !! wikitext
918 '''''foo'''''
919 !! html
920 <p><i><b>foo</b></i>
921 </p>
922 !!end
923
924 !! test
925 Italics and bold: 5-quote opening sequence: (5,6)
926 !! wikitext
927 '''''foo''''''
928 !! html/*
929 <p><i><b>foo'</b></i>
930 </p>
931 !! end
932
933 ###
934 ### multiple quote sequences in a line
935 ###
936 !! test
937 Italics and bold: multiple quote sequences: (2,4,2)
938 !! options
939 parsoid=wt2html
940 !! wikitext
941 ''foo''''bar''
942 !! html/*
943 <p><i>foo'<b>bar</b></i>
944 </p>
945 !!end
946
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
957
958
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !!end
969
970
971 # same html as previous, but wikitext adjusted to match parsoid html2wt
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
974 !! wikitext
975 ''foo'<nowiki/>'''bar'''''
976 !! html
977 <p><i>foo'<b>bar</b></i>
978 </p>
979 !! end
980
981
982 !! test
983 Italics and bold: multiple quote sequences: (2,4,4)
984 !! options
985 parsoid=wt2html
986 !! wikitext
987 ''foo''''bar''''
988 !! html/*
989 <p><i>foo'<b>bar'</b></i>
990 </p>
991 !!end
992
993
994 # same html as previous, but wikitext adjusted to match parsoid html2wt
995 !! test
996 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
997 !! wikitext
998 ''foo'<nowiki/>'''bar'<nowiki/>'''''
999 !! html
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,2)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<i></i>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1023 !! options
1024 parsoid
1025 !! wikitext
1026 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1027 !! html/php
1028 <p><b>foo'</b>bar
1029 </p>
1030 !! html/parsoid
1031 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1032 </p>
1033 !! end
1034
1035
1036 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1037 !! test
1038 Italics and bold: multiple quote sequences: (3,4,3)
1039 !! options
1040 parsoid=wt2html
1041 !! wikitext
1042 '''foo''''bar'''
1043 !! html/php
1044 <p><b>foo'</b>bar
1045 </p>
1046 !! html/parsoid
1047 <p><b>foo'</b>bar<b></b>
1048 </p>
1049 !!end
1050
1051 # same html as previous, but wikitext adjusted to match parsoid html2wt
1052 !! test
1053 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1054 !! wikitext
1055 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1056 !! html/php
1057 <p><b>foo'</b>bar
1058 </p>
1059 !! html/parsoid
1060 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1061 </p>
1062 !! end
1063
1064 ###
1065 ### other quote tests
1066 ###
1067 !! test
1068 Italics and bold: other quote tests: (2,3,5)
1069 !! wikitext
1070 ''this is about '''foo's family'''''
1071 !! html
1072 <p><i>this is about <b>foo's family</b></i>
1073 </p>
1074 !!end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (2,(3,3),2)
1079 !! wikitext
1080 ''this is about '''foo's''' family''
1081 !! html
1082 <p><i>this is about <b>foo's</b> family</i>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,2,3,2)
1089 !! options
1090 parsoid=wt2html
1091 !! wikitext
1092 '''this is about ''foo'''s family''
1093 !! html/*
1094 <p><b>this is about <i>foo</i></b><i>s family</i>
1095 </p>
1096 !!end
1097
1098
1099 # same html as previous, but wikitext adjusted to match parsoid html2wt
1100 !! test
1101 Italics and bold: other quote tests: (3,2,3+2+2,2)
1102 !! wikitext
1103 '''this is about ''foo'''''<nowiki/>''s family''
1104 !! html
1105 <p><b>this is about <i>foo</i></b><i>s family</i>
1106 </p>
1107 !! end
1108
1109
1110 !! test
1111 Italics and bold: other quote tests: (3,2,3,3)
1112 !! wikitext
1113 '''this is about ''foo'''s family'''
1114 !! html/*
1115 <p>'<i>this is about </i>foo<b>s family</b>
1116 </p>
1117 !!end
1118
1119
1120 !! test
1121 Italics and bold: other quote tests: (3,(2,2),3)
1122 !! wikitext
1123 '''this is about ''foo's'' family'''
1124 !! html
1125 <p><b>this is about <i>foo's</i> family</b>
1126 </p>
1127 !!end
1128
1129
1130 !! test
1131 Italicized possessive
1132 !! wikitext
1133 The ''[[Main Page]]'''s talk page.
1134 !! html/php
1135 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1136 </p>
1137 !! html/parsoid
1138 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1139 !! end
1140
1141 !! test
1142 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1143 (Requires tidy for PHP parser output to be fixed up)
1144 !! options
1145 parsoid=wt2html,wt2wt
1146 !! wikitext
1147 {|
1148 !''a!!''b
1149 |''a||''b
1150 |}
1151 !! html/php+tidy
1152 <table>
1153 <tr>
1154 <th><i>a</i></th>
1155 <th><i>b</i></th>
1156 <td><i>a</i></td>
1157 <td><i>b</i></td>
1158 </tr>
1159 </table>
1160 !! html/parsoid
1161 <table>
1162 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1163 <td><i>a</i></td><td><i>b</i></td></tr>
1164 </tbody></table>
1165 !! end
1166
1167 ###
1168 ### Non-html5 tags
1169 ###
1170
1171 !! test
1172 Non-html5 tags should be accepted
1173 !! wikitext
1174 <center>''foo''</center>
1175 <big>''foo''</big>
1176 <font>''foo''</font>
1177 <strike>''foo''</strike>
1178 <tt>''foo''</tt>
1179 !! html
1180 <center><i>foo</i></center>
1181 <p><big><i>foo</i></big>
1182 <font><i>foo</i></font>
1183 <strike><i>foo</i></strike>
1184 <tt><i>foo</i></tt>
1185 </p>
1186 !! end
1187
1188 !! test
1189 <wbr> is valid wikitext (bug 52468)
1190 !! wikitext
1191 <wbr>
1192 !! html
1193 <p><wbr />
1194 </p>
1195 !! end
1196
1197 # <strike> is HTML4, <s> is HTML4/5.
1198 !! test
1199 <s> or <strike> for strikethrough
1200 !! wikitext
1201 <strike>strike</strike>
1202
1203 <s>s</s>
1204 !! html
1205 <p><strike>strike</strike>
1206 </p><p><s>s</s>
1207 </p>
1208 !! end
1209
1210 ## a not permitted
1211 ## i,b,br omitted
1212 !! test
1213 Text-level semantic html elements in wikitext
1214 !! wikitext
1215 <em>text</em>
1216 <strong>text</strong>
1217 <small>text</small>
1218 <s>text</s>
1219 <cite>text</cite>
1220 <q>text</q>
1221 <dfn>text</dfn>
1222 <abbr>text</abbr>
1223 <data>text</data>
1224 <time>text</time>
1225 <code>text</code>
1226 <var>text</var>
1227 <samp>text</samp>
1228 <kbd>text</kbd>
1229 <sub>text</sub>
1230 <u>text</u>
1231 <mark>text</mark>
1232 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1233 <bdi>text</bdi>
1234 <bdo>text</bdo>
1235 <span>text</span>
1236 <wbr />
1237 !! html
1238 <p><em>text</em>
1239 <strong>text</strong>
1240 <small>text</small>
1241 <s>text</s>
1242 <cite>text</cite>
1243 <q>text</q>
1244 <dfn>text</dfn>
1245 <abbr>text</abbr>
1246 <data>text</data>
1247 <time>text</time>
1248 <code>text</code>
1249 <var>text</var>
1250 <samp>text</samp>
1251 <kbd>text</kbd>
1252 <sub>text</sub>
1253 <u>text</u>
1254 <mark>text</mark>
1255 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1256 <bdi>text</bdi>
1257 <bdo>text</bdo>
1258 <span>text</span>
1259 <wbr />
1260 </p>
1261 !! end
1262
1263 # test cases taken from
1264 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1265 !! test
1266 Ruby markup (W3C-style)
1267 !! wikitext
1268 ; Mono-ruby for individual base characters
1269 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1270 ; Group ruby
1271 : <ruby>今日<rt>きょう</rt></ruby>
1272 ; Jukugo ruby
1273 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1274 ; Inline ruby
1275 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1276 ; Double-sided ruby
1277 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1278 <ruby>
1279 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1280 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1281 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1282 </ruby>
1283 !! html
1284 <dl><dt> Mono-ruby for individual base characters</dt>
1285 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1286 <dt> Group ruby</dt>
1287 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1288 <dt> Jukugo ruby</dt>
1289 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1290 <dt> Inline ruby</dt>
1291 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1292 <dt> Double-sided ruby</dt>
1293 <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>
1294 <p><ruby>
1295 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1296 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1297 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1298 </ruby>
1299 </p>
1300 !! end
1301
1302 # The next two test different paths in the sanitizer.
1303 !! test
1304 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1305 !! wikitext
1306 <blockquote|>a</blockquote>
1307
1308 <b→> doesn't terminate </b→>
1309
1310 <bä> doesn't terminate </bä>
1311
1312 <boo> doesn't terminate </boo>
1313
1314 <s.foo> doesn't terminate </s.foo>
1315
1316 <sub-ID#1>
1317 !! html
1318 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1319 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1320 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1321 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1322 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1323 </p><p>&lt;sub-ID#1&gt;
1324 </p>
1325 !! end
1326
1327 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1328 # If the non-word-character tag made it through the sanitizer, tidy
1329 # would munge it up.
1330 !! test
1331 Non-word characters don't terminate tag names + tidy
1332 !! wikitext
1333 <blockquote|>a</blockquote>
1334
1335 <b→> doesn't terminate </b→>
1336
1337 <bä> doesn't terminate </bä>
1338
1339 <boo> doesn't terminate </boo>
1340
1341 <s.foo> doesn't terminate </s.foo>
1342
1343 <sub-ID#1>
1344 !! html+tidy
1345 <p>&lt;blockquote|&gt;a</p>
1346 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1347 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1348 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1349 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1350 <p>&lt;sub-ID#1&gt;</p>
1351 !! end
1352
1353 ###
1354 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1355 ### This checks that HTML5 tags (with non-word characters in the tag
1356 ### name) make it safely through the parser -- the Sanitizer will
1357 ### munge them later, as it should.
1358 ###
1359 !! test
1360 Non-word characters are valid in extension tags (T19663)
1361 !! wikitext
1362 <tåg>tåg</tåg>
1363 !! html/php
1364 <pre>
1365 'tåg'
1366 array (
1367 )
1368 </pre>
1369
1370 !! html/parsoid
1371 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1372 !! end
1373
1374 !! test
1375 Isolated close tags should be treated as literal text (bug 52760)
1376 !! options
1377 parsoid=wt2html
1378 !! wikitext
1379 </b>
1380
1381 <s.foo>s</s>
1382 !! html/php+tidy
1383 <p>&lt;s.foo&gt;s</p>
1384 !! html/parsoid
1385 <p>&lt;s.foo&gt;s</p>
1386 !! end
1387
1388 ###
1389 ### Special characters
1390 ###
1391
1392 !! test
1393 Bare pipe character (bug 52363)
1394 !! wikitext
1395 |
1396 !! html
1397 <p>|
1398 </p>
1399 !! end
1400
1401 !! test
1402 Bare pipe character from a template (bug 52363)
1403 !! wikitext
1404 {{pipe}}
1405 !! html
1406 <p>|
1407 </p>
1408 !! end
1409
1410 ###
1411 ### <nowiki> test cases
1412 ###
1413
1414 !! test
1415 <nowiki> unordered list
1416 !! wikitext
1417 <nowiki>* This is not an unordered list item.</nowiki>
1418 !! html/php
1419 <p>* This is not an unordered list item.
1420 </p>
1421 !! html/parsoid
1422 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1423 !! end
1424
1425 !! test
1426 <nowiki> spacing
1427 !! wikitext
1428 <nowiki>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434 </nowiki>
1435 !! html/php
1436 <p>Lorem ipsum dolor
1437
1438 sed abit.
1439 sed nullum.
1440
1441 :and a colon
1442
1443 </p>
1444 !! html/parsoid
1445 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1446
1447 sed abit.
1448 sed nullum.
1449
1450 :and a colon
1451 </span></p>
1452 !! end
1453
1454 !! test
1455 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1456 !! wikitext
1457 <nowiki><span class="error"></nowiki>
1458 !! html/php
1459 <p>&lt;span class="error"&gt;
1460 </p>
1461 !! html/parsoid
1462 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1463 !! end
1464
1465 !! test
1466 nowiki 3
1467 !! wikitext
1468 :There is not nowiki.
1469 :There is <nowiki>nowiki</nowiki>.
1470
1471 #There is not nowiki.
1472 #There is <nowiki>nowiki</nowiki>.
1473
1474 *There is not nowiki.
1475 *There is <nowiki>nowiki</nowiki>.
1476 !! html/php
1477 <dl><dd>There is not nowiki.</dd>
1478 <dd>There is nowiki.</dd></dl>
1479 <ol><li>There is not nowiki.</li>
1480 <li>There is nowiki.</li></ol>
1481 <ul><li>There is not nowiki.</li>
1482 <li>There is nowiki.</li></ul>
1483
1484 !! html/parsoid
1485 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1486 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1487
1488 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1489 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1490
1491 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1492 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1493 !! end
1494
1495 !! test
1496 Entities inside <nowiki>
1497 !! wikitext
1498 <nowiki>&lt;</nowiki>
1499 !! html
1500 <p>&lt;
1501 </p>
1502 !! end
1503
1504 !! test
1505 Entities inside template parameters
1506 !! wikitext
1507 {{echo|&ndash;}}
1508 !! html/php+tidy
1509 <p>–</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 ###
1864 ### paragraph wrapping tests
1865 ###
1866 !! test
1867 No block tags
1868 !! wikitext
1869 a
1870
1871 b
1872 !! html
1873 <p>a
1874 </p><p>b
1875 </p>
1876 !! end
1877
1878 !! test
1879 Block tag on one line (<div>)
1880 !! wikitext
1881 a <div>foo</div>
1882
1883 b
1884 !! html
1885 a <div>foo</div>
1886 <p>b
1887 </p>
1888 !! html+tidy
1889 <p>a</p>
1890 <div>foo</div>
1891 <p>b</p>
1892 !! end
1893
1894 !! test
1895 Block tag on one line (<blockquote>)
1896 !! wikitext
1897 a <blockquote>foo</blockquote>
1898
1899 b
1900 !! html
1901 a <blockquote>foo</blockquote>
1902 <p>b
1903 </p>
1904 !! html+tidy
1905 <p>a</p>
1906 <blockquote>
1907 <p>foo</p>
1908 </blockquote>
1909 <p>b</p>
1910 !! end
1911
1912 !! test
1913 Block tag on both lines (<div>)
1914 !! wikitext
1915 a <div>foo</div>
1916
1917 b <div>foo</div>
1918 !! html
1919 a <div>foo</div>
1920 b <div>foo</div>
1921
1922 !! html+tidy
1923 <p>a</p>
1924 <div>foo</div>
1925 <p>b</p>
1926 <div>foo</div>
1927 !! end
1928
1929 !! test
1930 Block tag on both lines (<blockquote>)
1931 !! wikitext
1932 a <blockquote>foo</blockquote>
1933
1934 b <blockquote>foo</blockquote>
1935 !! html
1936 a <blockquote>foo</blockquote>
1937 b <blockquote>foo</blockquote>
1938
1939 !! html+tidy
1940 <p>a</p>
1941 <blockquote>
1942 <p>foo</p>
1943 </blockquote>
1944 <p>b</p>
1945 <blockquote>
1946 <p>foo</p>
1947 </blockquote>
1948 !! end
1949
1950 !! test
1951 Multiple lines without block tags
1952 !! wikitext
1953 <div>foo</div> a
1954 b
1955 c
1956 d<!--foo--> e
1957 x <div>foo</div> z
1958 !! html
1959 <div>foo</div> a
1960 <p>b
1961 c
1962 d e
1963 </p>
1964 x <div>foo</div> z
1965
1966 !! html+tidy
1967 <div>foo</div>
1968 <p>a</p>
1969 <p>b c d e</p>
1970 <p>x</p>
1971 <div>foo</div>
1972 <p>z</p>
1973 !! end
1974
1975 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1976 # So, we have a separate section for Parsoid. We don't want
1977 # to mimic this stripping behavior in Parsoid. It affects
1978 # editing experience and also requires us to maintain additional
1979 # info for RT-ing.
1980 !! test
1981 Empty lines between lines with block tags
1982 !! wikitext
1983 <div></div>
1984
1985
1986 <div></div>a
1987
1988 b
1989 <div>a</div>b
1990
1991 <div>b</div>d
1992
1993
1994 <div>e</div>
1995 !! html
1996 <div></div>
1997 <p><br />
1998 </p>
1999 <div></div>a
2000 <p>b
2001 </p>
2002 <div>a</div>b
2003 <div>b</div>d
2004 <p><br />
2005 </p>
2006 <div>e</div>
2007
2008 !! html+tidy
2009 <p><br /></p>
2010 <p>a</p>
2011 <p>b</p>
2012 <div>a</div>
2013 <p>b</p>
2014 <div>b</div>
2015 <p>d</p>
2016 <p><br /></p>
2017 <div>e</div>
2018 !! html/parsoid
2019 <div data-parsoid='{"stx":"html"}'></div>
2020
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2023
2024 <p>b</p>
2025 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2026
2027 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2028
2029 <p><br /></p>
2030 <div data-parsoid='{"stx":"html"}'>e</div>
2031 !! end
2032
2033 ## PHP parser emits output which is broken
2034 !! test
2035 Unclosed HTML p-tags should be handled properly
2036 !! wikitext
2037 <div><p>foo</div>
2038 a
2039
2040 b
2041 !! html/php+tidy
2042 <div>
2043 <p>foo</p>
2044 </div>
2045 <p>a</p>
2046 <p>b</p>
2047 !! html/parsoid
2048 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2049 <p>a</p>
2050 <p>b</p>
2051 !! end
2052
2053 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2054 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2055 ## them for now.
2056 !! test
2057 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2058 !! options
2059 parsoid=wt2html
2060 !! wikitext
2061 a [[Category:A1]] [[Category:A2]]
2062 [[Category:A3]]
2063 [[Category:A4]]
2064 !! html/parsoid
2065 <p>a</p>
2066 <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"/>
2067 !! end
2068
2069 !! test
2070 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2071 !! options
2072 parsoid=wt2html
2073 !! wikitext
2074 [[Category:A1]]a
2075 !! html/parsoid
2076 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2077 !! end
2078
2079 ###
2080 ### Preformatted text
2081 ###
2082 !! test
2083 Preformatted text
2084 !! wikitext
2085 This is some
2086 Preformatted text
2087 With ''italic''
2088 And '''bold'''
2089 And a [[Main Page|link]]
2090 !! html
2091 <pre>This is some
2092 Preformatted text
2093 With <i>italic</i>
2094 And <b>bold</b>
2095 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 Tabs don't trigger preformatted text
2101 !! wikitext
2102 This is not
2103 preformatted text.
2104 This is preformatted text.
2105 So is this.
2106 !! html/php
2107 <p> This is not
2108 preformatted text.
2109 </p>
2110 <pre>This is preformatted text.
2111 So is this.
2112 </pre>
2113 !! html/parsoid
2114 <p> This is not
2115 preformatted text.</p>
2116 <pre>This is preformatted text.
2117 So is this.</pre>
2118 !! end
2119
2120 !! test
2121 Space before tab needs nowiki pre protection
2122 !! options
2123 parsoid=html2wt
2124 !! html/parsoid
2125 <p> a</p>
2126 !! wikitext
2127 <nowiki> </nowiki> a
2128 !! end
2129
2130 !! test
2131 Ident preformatting with inline content
2132 !! wikitext
2133 a
2134 ''b''
2135 !! html
2136 <pre>a
2137 <i>b</i>
2138 </pre>
2139 !! end
2140
2141 !! test
2142 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2143 !! wikitext
2144 <pre><nowiki>
2145 <b>
2146 <cite>
2147 <em>
2148 </nowiki></pre>
2149 !! html
2150 <pre>
2151 &lt;b&gt;
2152 &lt;cite&gt;
2153 &lt;em&gt;
2154 </pre>
2155
2156 !! end
2157
2158 !! test
2159 Regression with preformatted in <center>
2160 !! wikitext
2161 <center>
2162 Blah
2163 </center>
2164 !! html
2165 <center>
2166 <pre>Blah
2167 </pre>
2168 </center>
2169
2170 !! end
2171
2172 !! test
2173 Bug 52763: Preformatted in <blockquote>
2174 !! wikitext
2175 <blockquote>
2176 Blah
2177 {|
2178 |
2179 indented cell (no pre-wrapping!)
2180 |}
2181 </blockquote>
2182 !! html
2183 <blockquote>
2184 <p> Blah
2185 </p>
2186 <table>
2187 <tr>
2188 <td>
2189 <p> indented cell (no pre-wrapping!)
2190 </p>
2191 </td></tr></table>
2192 </blockquote>
2193
2194 !! end
2195
2196 !! test
2197 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2198 !! wikitext
2199 <blockquote>
2200 Foo
2201
2202 Bar
2203 </blockquote>
2204 !! html
2205 <blockquote>
2206 <p>Foo
2207 </p><p>Bar
2208 </p>
2209 </blockquote>
2210
2211 !! end
2212
2213 !! test
2214 Bug 15491: <ins>/<del> in blockquote
2215 !! wikitext
2216 <blockquote>
2217 Foo <del>bar</del> <ins>baz</ins> quux
2218 </blockquote>
2219 !! html
2220 <blockquote>
2221 <p>Foo <del>bar</del> <ins>baz</ins> quux
2222 </p>
2223 </blockquote>
2224
2225 !! end
2226
2227 # Note that the p-wrapping is newline sensitive, which could be
2228 # considered a bug: tidy will wrap only the 'Foo' in the example
2229 # below in a <p> tag. (see comment 23-25 of bug #6200)
2230 !! test
2231 Bug 15491: <ins>/<del> in blockquote (2)
2232 !! wikitext
2233 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2234 </blockquote>
2235 !! html
2236 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2237 </blockquote>
2238
2239 !! html+tidy
2240 <blockquote>
2241 <p>Foo</p>
2242 <del>bar</del> <ins>baz</ins> quux</blockquote>
2243 !! end
2244
2245 !! test
2246 <pre> with attributes (bug 3202)
2247 !! wikitext
2248 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2249 !! html
2250 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2251
2252 !! end
2253
2254 !! test
2255 <pre> with width attribute (bug 3202)
2256 !! wikitext
2257 <pre width="8">Narrow screen goodies</pre>
2258 !! html
2259 <pre width="8">Narrow screen goodies</pre>
2260
2261 !! end
2262
2263 !! test
2264 <pre> with forbidden attribute (bug 3202)
2265 !! wikitext
2266 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2267 !! html
2268 <pre width="8">Narrow screen goodies</pre>
2269
2270 !! end
2271
2272 !! test
2273 Entities inside <pre>
2274 !! wikitext
2275 <pre>&lt;</pre>
2276 !! html
2277 <pre>&lt;</pre>
2278
2279 !! end
2280
2281 !! test
2282 <pre> with forbidden attribute values (bug 3202)
2283 !! wikitext
2284 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2285 !! html
2286 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2287
2288 !! end
2289
2290 !! test
2291 <nowiki> inside <pre> (bug 13238)
2292 !! wikitext
2293 <pre>
2294 <nowiki>
2295 </pre>
2296 <pre>
2297 <nowiki></nowiki>
2298 </pre>
2299 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2300 !! html
2301 <pre>
2302 &lt;nowiki&gt;
2303 </pre>
2304 <pre>
2305
2306 </pre>
2307 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2308
2309 !! end
2310
2311 !! test
2312 <nowiki> inside of #tag:pre
2313 !! wikitext
2314 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2315 !! html/php
2316 <pre>Foo &#8594;bar</pre>
2317
2318 !! html/parsoid
2319 <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>
2320 !! end
2321
2322 !! test
2323 <nowiki> and <pre> preference (first one wins)
2324 !! wikitext
2325 <pre>
2326 <nowiki>
2327 </pre>
2328 </nowiki>
2329 </pre>
2330
2331 <nowiki>
2332 <pre>
2333 <nowiki>
2334 </pre>
2335 </nowiki>
2336 </pre>
2337
2338 !! html/php
2339 <pre>
2340 &lt;nowiki&gt;
2341 </pre>
2342 <p>&lt;/nowiki&gt;
2343 &lt;/pre&gt;
2344 </p><p>
2345 &lt;pre&gt;
2346 &lt;nowiki&gt;
2347 &lt;/pre&gt;
2348
2349 &lt;/pre&gt;
2350 </p>
2351 !! html/parsoid
2352 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2353 </pre>
2354 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2355 &lt;/pre></p>
2356
2357 <p><span typeof="mw:Nowiki">
2358 &lt;pre>
2359 &lt;nowiki>
2360 &lt;/pre>
2361 </span>
2362 &lt;/pre></p>
2363 !! end
2364
2365 !! test
2366 </pre> inside nowiki
2367 !! wikitext
2368 <nowiki></pre></nowiki>
2369 !! html
2370 <p>&lt;/pre&gt;
2371 </p>
2372 !! end
2373
2374 # Parsoid doesn't strip empty tags, like Tidy does.
2375 !! test
2376 Empty pre; pre inside other HTML tags (bug 54946)
2377 !! options
2378 parsoid=wt2html,wt2wt
2379 !! wikitext
2380 a
2381
2382 <div><pre>
2383 foo
2384 </pre></div>
2385 <pre></pre>
2386 !! html/php
2387 <p>a
2388 </p>
2389 <div><pre>
2390 foo
2391 </pre></div>
2392 <pre></pre>
2393
2394 !! html/php+tidy
2395 <p>a</p>
2396 <div>
2397 <pre>
2398 foo
2399 </pre></div>
2400 !! html/parsoid
2401 <p>a</p>
2402
2403 <div><pre>foo
2404 </pre></div>
2405 <pre></pre>
2406 !! end
2407
2408 !! test
2409 HTML pre followed by indent-pre
2410 !! wikitext
2411 <pre>foo</pre>
2412 bar
2413 !! html
2414 <pre>foo</pre>
2415 <pre>bar
2416 </pre>
2417 !! end
2418
2419 # Note that tidy removes the empty <p> tags from the start and end.
2420 # Parsoid does not, by design.
2421 !!test
2422 Block tag pre
2423 !! wikitext
2424 <p><pre>foo</pre></p>
2425 !! html/php+tidy
2426 <pre>
2427 foo
2428 </pre>
2429 !! html/parsoid
2430 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2431 !!end
2432
2433 !!test
2434 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2435 !! wikitext
2436 {{echo|}}
2437 !! html
2438
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2443 !! wikitext
2444 {{echo|
2445 foo}}
2446 !! html
2447 <p>foo
2448 </p>
2449 !!end
2450
2451 !! test
2452 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2453 !! wikitext
2454 {{echo|a
2455 b}}
2456 !! html
2457 <pre>a
2458 </pre>
2459 <p>b
2460 </p>
2461 !!end
2462
2463 !! test
2464 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2465 !! wikitext
2466 {{echo|a
2467 b
2468 c
2469 d
2470 e
2471 }}
2472 !! html
2473 <pre>a
2474 </pre>
2475 <p>b
2476 c
2477 </p>
2478 <pre>d
2479 </pre>
2480 <p>e
2481 </p>
2482 !!end
2483
2484 !!test
2485 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2486 !! wikitext
2487 {{echo| foo}}
2488
2489 {{echo| foo}}{{echo| bar}}
2490
2491 {{echo| foo}}
2492 {{echo| bar}}
2493
2494 {{echo|<!--cmt--> foo}}
2495
2496 <!--cmt-->{{echo| foo}}
2497
2498 {{echo|{{echo| }}bar}}
2499 !! html
2500 <pre>foo
2501 </pre>
2502 <pre>foo bar
2503 </pre>
2504 <pre>foo
2505 bar
2506 </pre>
2507 <pre>foo
2508 </pre>
2509 <pre>foo
2510 </pre>
2511 <pre>bar
2512 </pre>
2513 !!end
2514
2515 !! test
2516 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2517 !! wikitext
2518 {{echo| }}a
2519
2520 {{echo|
2521 }}a
2522
2523 {{echo|
2524 b}}
2525
2526 {{echo|a
2527 }}b
2528
2529 {{echo|a
2530 }} b
2531 !! html
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>a
2537 </pre>
2538 <p><br />
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 <p>a
2547 </p>
2548 <pre>b
2549 </pre>
2550 !!end
2551
2552 !! test
2553 Pres with newline attributes
2554 !! wikitext
2555 <pre class="one
2556 two">hi</pre>
2557 !! html/php
2558 <pre class="one two">hi</pre>
2559
2560 !! html/parsoid
2561 <pre class="one
2562 two" data-parsoid='{"stx":"html"}'>hi</pre>
2563 !! end
2564
2565 !! test
2566 Things that look like <pre> tags aren't treated as such
2567 !! wikitext
2568 Barack Obama <President> of the United States
2569 <President></President>
2570 !! html
2571 <p>Barack Obama &lt;President&gt; of the United States
2572 &lt;President&gt;&lt;/President&gt;
2573 </p>
2574 !! end
2575
2576 !! test
2577 Handle broken pre-like tags (bug 64025)
2578 !! options
2579 parsoid=wt2html
2580 !! wikitext
2581 {{echo|<pre <pre>x</pre>}}
2582
2583 <table><pre </table>
2584 !! html/php
2585 <pre>x</pre>
2586 <table>&lt;pre </table>
2587
2588 !! html/php+tidy
2589 <pre>
2590 x
2591 </pre>
2592 <p>&lt;pre</p>
2593 !! html/parsoid
2594 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2595
2596
2597 <p>&lt;pre </p>
2598
2599 <table></table>
2600 !! end
2601
2602 !! test
2603 Parsoid: handle pre with space after attribute
2604 !! options
2605 parsoid=wt2html
2606 !! wikitext
2607 <pre style="width:50%;" >{{echo|foo}}</pre>
2608 !! html/php
2609 <pre style="width:50%;">{{echo|foo}}</pre>
2610
2611 !! html/parsoid
2612 <pre style="width:50%;">{{echo|foo}}</pre>
2613 !! end
2614
2615 # TODO / maybe: fix wt2wt for this
2616 !! test
2617 Parsoid: Don't paragraph-wrap fosterable content
2618 !! options
2619 parsoid=wt2html
2620 !! wikitext
2621 {|
2622 <td></td>
2623 <td></td>
2624
2625
2626
2627 |}
2628 !! html
2629 <table>
2630
2631 <tbody>
2632 <tr>
2633 <td></td>
2634
2635 <td></td></tr>
2636
2637
2638
2639 </tbody></table>
2640 !! end
2641
2642 !! test
2643 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2644 !! options
2645 parsoid=wt2html
2646 !! wikitext
2647 {|
2648 <td>
2649 <td>
2650 </td>
2651
2652
2653
2654 |}
2655 !! html
2656 <table>
2657
2658 <tbody>
2659 <tr>
2660 <td></td>
2661
2662 <td>
2663 </td></tr>
2664
2665
2666
2667 </tbody></table>
2668 !! end
2669
2670
2671 #--------------------------------------------------------------------
2672 # Transclusion parameter whitespace stripping tests
2673 # Behavior is different for positional and named parameters
2674 #--------------------------------------------------------------------
2675 !! test
2676 Templates: Strip leading and trailing whitespace from named-param values
2677 !! wikitext
2678 {{echo|1= a }}
2679
2680 {{echo|1= {{echo|b}} }}
2681
2682 {{echo| 1 =
2683 c }}
2684
2685 {{echo| 1 =
2686 * d
2687 }}
2688 !! html
2689 <p>a
2690 </p><p>b
2691 </p><p>c
2692 </p>
2693 <ul><li> d</li></ul>
2694
2695 !! end
2696
2697 !! test
2698 Templates: Don't strip whitespace from positional-param values
2699 !! wikitext
2700 {{echo|a }}
2701
2702 {{echo|{{echo|b}} }}
2703
2704 {{echo| c
2705 }}
2706
2707 {{echo| {{echo|d}}
2708 }}
2709
2710 {{echo|
2711 e}}
2712
2713 {{echo|
2714 * f}}
2715
2716 {{echo|
2717 }}g
2718 !! html
2719 <p>a
2720 </p><p>b
2721 </p>
2722 <pre>c
2723 </pre>
2724 <p><br />
2725 </p>
2726 <pre>d
2727 </pre>
2728 <p><br />
2729 </p>
2730 <pre>e
2731 </pre>
2732 <p><br />
2733 </p>
2734 <ul><li> f</li></ul>
2735 <p><br />
2736 </p>
2737 <pre>g
2738 </pre>
2739 !! end
2740
2741 !! test
2742 Templates: Handle empty comment-and-ws-only lines correctly
2743 !! wikitext
2744 {{echo|foo
2745 <!--should be ignored-->
2746 <!--should be ignored as well-->
2747 bar}}
2748 !! html/php
2749 <p>foo
2750 bar
2751 </p>
2752 !! html/parsoid
2753 <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>
2754 !! end
2755
2756 !! test
2757 Templates: Handle comments in the target
2758 !! wikitext
2759 {{echo
2760 <!-- should be ignored -->
2761 |foo}}
2762
2763 {{echo
2764 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2765 |foo}}
2766
2767 {{echo<!-- should be ignored -->
2768 |foo}}
2769
2770 {{echo<!-- should be ignored -->|foo}}
2771
2772 {{<!-- should be ignored -->echo|foo}}
2773 !! html/php
2774 <p>foo
2775 </p><p>foo
2776 </p><p>foo
2777 </p><p>foo
2778 </p><p>foo
2779 </p>
2780 !! html/parsoid
2781 <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>
2782
2783 <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>
2784
2785 <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>
2786
2787 <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>
2788
2789 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2790 !!end
2791
2792 !! test
2793 Templates: Handle comments in parameter names (bug 67657)
2794 !! wikitext
2795 {{echo|1
2796 <!-- should be ignored -->
2797 =foo}}
2798
2799 {{echo|
2800 <!-- should be ignored -->
2801 1 = foo}}
2802
2803 {{echo|1<!-- should be ignored -->=foo}}
2804
2805 {{echo|<!-- should be ignored -->1=foo}}
2806 !! html/php
2807 <p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p><p>foo
2811 </p>
2812 !! html/parsoid
2813 <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>
2814
2815 <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>
2816
2817 <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>
2818
2819 <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>
2820 !!end
2821
2822 !! test
2823 Templates: Other wikitext in parameter names (bug 67657)
2824 !! wikitext
2825 {{echo|''1''=foo}}
2826 !! html/php
2827 <p>{{{1}}}
2828 </p>
2829 !! html/parsoid
2830 <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>
2831 !!end
2832
2833 #--------------------------------------------------------------------
2834 # Transclusion parameter escaping tests
2835 #--------------------------------------------------------------------
2836 !! test
2837 Templates: Parsoid parameter escaping test 1
2838 !! wikitext
2839 {{echo|[foo]|{{echo|[bar]}}}}
2840 !! html/php+tidy
2841 <p>[foo]</p>
2842 !! html/parsoid
2843 <p about="#mwt1" typeof="mw:Transclusion"
2844 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2845 !! end
2846
2847 !! test
2848 Parsoid: Pipes in external links in template parameter
2849 !! wikitext
2850 {{echo|[{{echo|http://example.com}} link]}}
2851 !! html/php+tidy
2852 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2853 !! html/parsoid
2854 <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>
2855 !! end
2856
2857 !! test
2858 Parsoid: pipe in transclusion parameter
2859 !! wikitext
2860 {{echo|http://foo.com/a&#124;b}}
2861 !! html/php+tidy
2862 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2863 !! html/parsoid
2864 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2865 typeof="mw:Transclusion"
2866 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2867 !! end
2868
2869 !! test
2870 Parsoid: Pipe in external link target and content in template parameter
2871 !! options
2872 parsoid=html2wt,wt2wt
2873 !! wikitext
2874 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2875 !! html/php+tidy
2876 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2877 !! html/parsoid
2878 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2879 typeof="mw:Transclusion"
2880 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2881 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2882 !! end
2883
2884 !! test
2885 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2886 !! options
2887 parsoid
2888 !! wikitext
2889 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2890 !! html
2891 <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>
2892 !! end
2893
2894 !! test
2895 Templates: Don't escape already nowiki-escaped text in template parameters
2896 !! options
2897 parsoid=html2wt,wt2wt
2898 !! wikitext
2899 {{echo|foo<nowiki>|</nowiki>bar}}
2900 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2901 {{echo|<nowiki></nowiki>}}
2902 !! html/php+tidy
2903 <p>foo|bar &lt;div&gt;</p>
2904 !! html/parsoid
2905 <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>
2906 <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>
2907 <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>
2908 </p>
2909 !! end
2910
2911 ## Bug 52824
2912 !! test
2913 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2914 !! options
2915 parsoid=html2wt,wt2wt
2916 !! wikitext
2917 {{echo|{{echo|1=bar}}}}
2918 !! html/php+tidy
2919 <p>bar</p>
2920 !! html/parsoid
2921 <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>
2922 !! end
2923
2924 ## Bug 56733
2925 !! test
2926 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2927 !! wikitext
2928 {{echo|a : b}}
2929 !! html/php+tidy
2930 <p>a&#160;: b</p>
2931 !! html/parsoid
2932 <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>
2933 !! end
2934
2935 ## Bug T73412
2936 !! test
2937 Templates: Preserve blank parameter names
2938 !! wikitext
2939 {{echo|=foo}}
2940 !! html/php+tidy
2941 <p>{{{1}}}</p>
2942 !! html/parsoid
2943 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2944 !! end
2945
2946 !! test
2947 Templates: Preserve blank parameter names in other positions
2948 !! wikitext
2949 {{blank_param|bar|=foo}}
2950 !! html/php+tidy
2951 <p>bar foo</p>
2952 !! html/parsoid
2953 <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
2954 foo</p>
2955 !! end
2956
2957 ###
2958 ### Parsoid-centric tests for testing RT edge cases for pre
2959 ###
2960
2961 !!test
2962 1a. Indent-Pre and Comments
2963 !! wikitext
2964 a
2965 <!--a-->
2966 c
2967 !! html
2968 <pre>a
2969 </pre>
2970 <p>c
2971 </p>
2972 !!end
2973
2974 !!test
2975 1b. Indent-Pre and Comments
2976 !! wikitext
2977 a
2978 <!--a-->
2979 c
2980 !! html
2981 <pre>a
2982 </pre>
2983 <p>c
2984 </p>
2985 !!end
2986
2987 !!test
2988 1c. Indent-Pre and Comments
2989 !! wikitext
2990 <!--a--> a
2991
2992 <!--a--> a
2993 !! html
2994 <pre> a
2995 </pre>
2996 <pre> a
2997 </pre>
2998 !!end
2999
3000 !!test
3001 1d. Indent-Pre and Comments
3002 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3003 !! wikitext
3004 <!--a--> a
3005
3006 <!--b-->b
3007 !! html
3008 <pre>a
3009 </pre>
3010 <pre>b
3011 </pre>
3012 !!end
3013
3014 !!test
3015 2a. Indent-Pre and tables
3016 !! wikitext
3017 {|
3018 |-
3019 !h1!!h2
3020 |foo||bar
3021 |}
3022 !! html
3023 <table>
3024
3025 <tr>
3026 <th>h1</th>
3027 <th>h2
3028 </th>
3029 <td>foo</td>
3030 <td>bar
3031 </td></tr></table>
3032
3033 !!end
3034
3035 !!test
3036 2b. Indent-Pre and tables
3037 !! wikitext
3038 {|
3039 |-
3040 |foo
3041 |}
3042 !! html
3043 <table>
3044
3045 <tr>
3046 <td>foo
3047 </td></tr></table>
3048
3049 !!end
3050
3051 !!test
3052 2c. Indent-Pre and tables (bug 42252)
3053 !! wikitext
3054 {|
3055 |+ foo
3056 ! | bar
3057 |}
3058 !! html
3059 <table>
3060 <caption> foo
3061 </caption>
3062 <tr>
3063 <th> bar
3064 </th></tr></table>
3065
3066 !!end
3067
3068 !!test
3069 2d. Indent-Pre and tables
3070 !! wikitext
3071 a
3072 {|
3073 | b
3074 |}
3075 !! html/php
3076 <pre>a
3077 </pre>
3078 <table>
3079 <tr>
3080 <td> b
3081 </td></tr></table>
3082
3083 !! html/parsoid
3084 <pre>a</pre>
3085 <table>
3086 <tbody><tr><td> b</td></tr>
3087 </tbody></table>
3088 !!end
3089
3090 !!test
3091 2e. Indent-Pre and table-line syntax
3092 !! wikitext
3093 a
3094 | b
3095 | c
3096 !! html/php
3097 <pre>a
3098 | b
3099 | c
3100 </pre>
3101 !!end
3102
3103 !!test
3104 2f. Indent-pre started by table-line syntax
3105 !! wikitext
3106 a
3107 | b
3108 | c
3109 !! html/php
3110 <p>a
3111 </p>
3112 <pre>| b
3113 | c
3114 </pre>
3115 !! html/parsoid
3116 <p>a</p>
3117 <pre>
3118 | b
3119 | c</pre>
3120 !!end
3121
3122 !! test
3123 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3124 !! wikitext
3125 <table>
3126 <tr>
3127 <td>
3128 Text that should be rendered preformatted
3129 </td>
3130 </tr>
3131 </table>
3132 !! html
3133 <table>
3134 <tr>
3135 <td>
3136 <pre>Text that should be rendered preformatted
3137 </pre>
3138 </td>
3139 </tr>
3140 </table>
3141
3142 !! end
3143
3144 !!test
3145 3a. Indent-Pre and block tags (single-line html)
3146 !! wikitext
3147 a <p> foo </p>
3148 b <div> foo </div>
3149 c <blockquote> foo </blockquote>
3150 <span> foo </span>
3151 !! html
3152 a <p> foo </p>
3153 b <div> foo </div>
3154 c <blockquote> foo </blockquote>
3155 <pre><span> foo </span>
3156 </pre>
3157 !! html/parsoid
3158 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3159 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3160 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3161 <pre><span> foo </span>
3162 </pre>
3163 !! html+tidy
3164 <p>a</p>
3165 <p>foo</p>
3166 <p>b</p>
3167 <div>foo</div>
3168 <p>c</p>
3169 <blockquote>
3170 <p>foo</p>
3171 </blockquote>
3172 <pre>
3173 <span> foo </span>
3174 </pre>
3175 !! end
3176
3177 !!test
3178 3b. Indent-Pre and block tags (multi-line html)
3179 !! wikitext
3180 a <span>foo</span>
3181 b <div> foo </div>
3182 !! html
3183 <pre>a <span>foo</span>
3184 </pre>
3185 b <div> foo </div>
3186
3187 !! html/parsoid
3188 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3189 b <div data-parsoid='{"stx":"html"}'> foo </div>
3190 !! html+tidy
3191 <pre>
3192 a <span>foo</span>
3193 </pre>
3194 <p>b</p>
3195 <div>foo</div>
3196 !!end
3197
3198 !!test
3199 3c. Indent-Pre and block tags (pre-content on separate line)
3200 !! wikitext
3201 <p>
3202 foo
3203 </p>
3204
3205 <div>
3206 foo
3207 </div>
3208
3209 <center>
3210 foo
3211 </center>
3212
3213 <blockquote>
3214 foo
3215 </blockquote>
3216
3217 <blockquote>
3218 <pre>
3219 foo
3220 </pre>
3221 </blockquote>
3222
3223 <table><tr><td>
3224 foo
3225 </td></tr></table>
3226
3227 <ul><li>
3228 foo
3229 </li></ul>
3230
3231 !! html
3232 <p>
3233 foo
3234 </p>
3235 <div>
3236 <pre>foo
3237 </pre>
3238 </div>
3239 <center>
3240 <pre>foo
3241 </pre>
3242 </center>
3243 <blockquote>
3244 <p> foo
3245 </p>
3246 </blockquote>
3247 <blockquote>
3248 <pre>
3249 foo
3250 </pre>
3251 </blockquote>
3252 <table><tr><td>
3253 <pre>foo
3254 </pre>
3255 </td></tr></table>
3256 <ul><li>
3257 foo
3258 </li></ul>
3259
3260 !!end
3261
3262 !! test
3263 4. Indent-Pre and extension tags
3264 !! wikitext
3265 a <tag />
3266 !! html/php
3267 a <pre>
3268 NULL
3269 array (
3270 )
3271 </pre>
3272
3273 !! html/parsoid
3274 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3275 !! end
3276
3277 !!test
3278 Render paragraphs when indent-pre is suppressed in blocklevels
3279 !! wikitext
3280 <blockquote>
3281 foo
3282
3283 bar
3284 </blockquote>
3285 !! html
3286 <blockquote>
3287 <p> foo
3288 </p><p> bar
3289 </p>
3290 </blockquote>
3291
3292 !!end
3293
3294 !!test
3295 4. Multiple spaces at start-of-line
3296 !! wikitext
3297 <p> foo </p>
3298 foo
3299 {|
3300 |foo
3301 |}
3302 !! html
3303 <p> foo </p>
3304 <pre> foo
3305 </pre>
3306 <table>
3307 <tr>
3308 <td>foo
3309 </td></tr></table>
3310
3311 !!end
3312
3313 ## NOTE: the leading white-space chars on empty line are significant
3314 !! test
3315 5a. White-space in indent-pre
3316 !! wikitext
3317 a<br />
3318
3319 b
3320 !! html
3321 <pre>a<br />
3322
3323 b
3324 </pre>
3325 !! end
3326
3327 ## NOTE: the leading white-space chars on empty line are significant
3328 !! test
3329 5b. White-space in indent-pre
3330 !! wikitext
3331 a
3332
3333 b
3334
3335
3336 c
3337 !! html
3338 <pre>a
3339
3340 b
3341
3342
3343 c
3344 </pre>
3345 !! end
3346
3347 !! test
3348 5c. White-space in indent-pre
3349 !! wikitext
3350 ''a''
3351 ''b''
3352 ''c''
3353 !! html
3354 <pre><i>a</i>
3355 <i>b</i>
3356 <i>c</i>
3357 </pre>
3358 !! end
3359
3360 !! test
3361 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3362 !! wikitext
3363 a
3364
3365 <!-- continue -->
3366 b
3367
3368 c
3369
3370 d
3371 !! html
3372 <pre>a
3373
3374 b
3375 </pre>
3376 <pre>c
3377
3378 </pre>
3379 <p>d
3380 </p>
3381 !! end
3382
3383 !! test
3384 7a. Indent-pre and category links
3385 !! options
3386 parsoid=wt2html,wt2wt
3387 !! wikitext
3388 [[Category:foo]] <!-- No pre-wrapping -->
3389 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3390 !! html/php+tidy
3391 !! html/parsoid
3392 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3393 <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 -->
3394 !! end
3395
3396 ## We used to, but no longer wt2wt this test since the default serializer
3397 ## will normalize all categories to serialize on their own line.
3398 ## This wikitext usage is going to be fairly uncommon in production and
3399 ## selser will take care of preserving formatting in those scenarios.
3400 !! test
3401 7b. Indent-pre and category links
3402 !! options
3403 parsoid=wt2html
3404 !! wikitext
3405 [[Category:foo]] a
3406 [[Category:foo]] {{echo|b}}
3407 !! html/parsoid
3408 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3409 <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>
3410 !! end
3411
3412 !! test
3413 Indent-Pre: Newlines in comments shouldn't affect sol state
3414 !! wikitext
3415 a <!--
3416 foo
3417 --> b
3418 !! html/php+tidy
3419 <p>a b</p>
3420 !! html/parsoid
3421 <p>a <!--
3422 foo
3423 --> b</p>
3424 !! end
3425
3426 ###
3427 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3428 ###
3429
3430 !!test
3431 HTML-pre: 1. embedded newlines
3432 !! wikitext
3433 <pre>foo</pre>
3434
3435 <pre>
3436 foo
3437 </pre>
3438
3439 <pre>
3440
3441 foo
3442 </pre>
3443
3444 <pre>
3445
3446
3447 foo
3448 </pre>
3449 !! html/php+tidy
3450 <pre>
3451 foo
3452 </pre>
3453 <pre>
3454 foo
3455 </pre>
3456 <pre>
3457
3458 foo
3459 </pre>
3460 <pre>
3461
3462
3463 foo
3464 </pre>
3465 !! html/parsoid
3466 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3467
3468 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3469 foo
3470 </pre>
3471
3472 <pre data-parsoid='{"stx":"html"}'>
3473
3474 foo
3475 </pre>
3476
3477 <pre data-parsoid='{"stx":"html"}'>
3478
3479
3480 foo
3481 </pre>
3482 !!end
3483
3484 !! test
3485 HTML-pre: big spaces
3486 !! wikitext
3487 <pre>
3488
3489
3490
3491
3492 haha
3493
3494
3495
3496
3497 haha
3498
3499
3500
3501
3502 </pre>
3503 !! html/php+tidy
3504 <pre>
3505
3506
3507
3508
3509 haha
3510
3511
3512
3513
3514 haha
3515
3516
3517
3518
3519 </pre>
3520 !! html/parsoid
3521 <pre data-parsoid='{"stx":"html"}'>
3522
3523
3524
3525
3526 haha
3527
3528
3529
3530
3531 haha
3532
3533
3534
3535
3536 </pre>
3537 !! end
3538
3539 !!test
3540 HTML-pre: 2: indented text
3541 !! wikitext
3542 <pre>
3543 foo
3544 </pre>
3545 !! html
3546 <pre>
3547 foo
3548 </pre>
3549
3550 !!end
3551
3552 !!test
3553 HTML-pre: 3: other wikitext
3554 !! wikitext
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562 !! html/php
3563 <pre>
3564 * foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570
3571 !! html/parsoid
3572 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3573 # bar
3574 = no-h =
3575 '' no-italic ''
3576 [[ NoLink ]]
3577 </pre>
3578 !!end
3579
3580 ###
3581 ### Definition lists
3582 ###
3583 !! test
3584 Simple definition
3585 !! wikitext
3586 ; name : Definition
3587 !! html
3588 <dl><dt> name&#160;</dt>
3589 <dd> Definition</dd></dl>
3590
3591 !! end
3592
3593 !! test
3594 Definition list for indentation only
3595 !! wikitext
3596 : Indented text
3597 !! html
3598 <dl><dd> Indented text</dd></dl>
3599
3600 !! end
3601
3602 !! test
3603 Definition list with no space
3604 !! wikitext
3605 ;name:Definition
3606 !! html
3607 <dl><dt>name</dt>
3608 <dd>Definition</dd></dl>
3609
3610 !!end
3611
3612 !! test
3613 Definition list with URL link
3614 !! wikitext
3615 ; http://example.com/ : definition
3616 !! html
3617 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3618 <dd> definition</dd></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition list with bracketed URL link
3624 !! wikitext
3625 ;[http://www.example.com/ Example]:Something about it
3626 !! html
3627 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3628 <dd>Something about it</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Definition list with wikilink containing colon
3634 !! wikitext
3635 ; [[Help:FAQ]]: The least-read page on Wikipedia
3636 !! html
3637 <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>
3638 <dd> The least-read page on Wikipedia</dd></dl>
3639
3640 !! end
3641
3642 # At Brion's and JeLuF's insistence... :)
3643 !! test
3644 Definition list with news link containing colon
3645 !! wikitext
3646 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3647 !! html/php
3648 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3649 <dd> This isn't even a real newsgroup!</dd></dl>
3650
3651 !! html/parsoid
3652 <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>
3653 !! end
3654
3655 !! test
3656 Malformed definition list with colon
3657 !! wikitext
3658 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3659 !! html
3660 <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>
3661
3662 !! end
3663
3664 !! test
3665 Definition lists: colon in external link text
3666 !! wikitext
3667 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3668 !! html
3669 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3670 <dd> OK, I made that up</dd></dl>
3671
3672 !! end
3673
3674 !! test
3675 Definition lists: colon in HTML attribute
3676 !! wikitext
3677 ;<b style="display: inline">bold</b>
3678 !! html
3679 <dl><dt><b style="display: inline">bold</b></dt></dl>
3680
3681 !! end
3682
3683 !! test
3684 Definition lists: self-closed tag
3685 !! wikitext
3686 ;one<br/>two : two-line fun
3687 !! html
3688 <dl><dt>one<br />two&#160;</dt>
3689 <dd> two-line fun</dd></dl>
3690
3691 !! end
3692
3693 !! test
3694 Bug 11748: Literal closing tags
3695 !! wikitext
3696 <dl>
3697 <dt>test 1</dt>
3698 <dd>test test test test test</dd>
3699 <dt>test 2</dt>
3700 <dd>test test test test test</dd>
3701 </dl>
3702 !! html
3703 <dl>
3704 <dt>test 1</dt>
3705 <dd>test test test test test</dd>
3706 <dt>test 2</dt>
3707 <dd>test test test test test</dd>
3708 </dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3714 !! wikitext
3715 <ul><li>
3716 ; term : description
3717 * unordered
3718 </li></ul>
3719 !! html
3720 <ul><li>
3721 <dl><dt> term&#160;</dt>
3722 <dd> description</dd></dl>
3723 <ul><li> unordered</li></ul>
3724 </li></ul>
3725
3726 !! end
3727
3728 !! test
3729 Definition list with empty definition and following paragraph
3730 !! wikitext
3731 ; term:
3732 Paragraph text
3733 !! html
3734 <dl><dt> term</dt>
3735 <dd></dd></dl>
3736 <p>Paragraph text
3737 </p>
3738 !! end
3739
3740 !! test
3741 Nested definition lists using html syntax
3742 !! wikitext
3743 <dl><dt>x</dt>
3744 <dd>a</dd>
3745 <dd>b</dd></dl>
3746 !! html
3747 <dl><dt>x</dt>
3748 <dd>a</dd>
3749 <dd>b</dd></dl>
3750
3751 !! end
3752
3753 !! test
3754 Definition Lists: No nesting: Multiple dd's
3755 !! wikitext
3756 ;x
3757 :a
3758 :b
3759 !! html
3760 <dl><dt>x</dt>
3761 <dd>a</dd>
3762 <dd>b</dd></dl>
3763
3764 !! end
3765
3766 !! test
3767 Definition Lists: Indentation: Regular
3768 !! wikitext
3769 :i1
3770 ::i2
3771 :::i3
3772 !! html
3773 <dl><dd>i1
3774 <dl><dd>i2
3775 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3776
3777 !! end
3778
3779 !! test
3780 Definition Lists: Indentation: Missing 1st level
3781 !! wikitext
3782 ::i2
3783 :::i3
3784 !! html
3785 <dl><dd><dl><dd>i2
3786 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition Lists: Indentation: Multi-level indent
3792 !! wikitext
3793 :::i3
3794 !! html
3795 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition Lists: Hacky use to indent tables
3801 !! wikitext
3802 ::{|
3803 |foo
3804 |bar
3805 |}
3806 this text
3807 should be left alone
3808 !! html
3809 <dl><dd><dl><dd><table>
3810 <tr>
3811 <td>foo
3812 </td>
3813 <td>bar
3814 </td></tr></table></dd></dl></dd></dl>
3815 <p>this text
3816 should be left alone
3817 </p>
3818 !! end
3819
3820 !! test
3821 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3822 !! wikitext
3823 <!-- foo -->
3824 ::{|
3825 |foo
3826 |bar
3827 |}<!-- bar -->
3828 this text
3829 should be left alone
3830 !! html/parsoid
3831 <!-- foo -->
3832 <dl><dd><dl><dd><table><tr>
3833 <td>foo</td>
3834 <td>bar</td>
3835 </tr></table><!-- bar --></dd></dl></dd></dl>
3836 <p>this text
3837 should be left alone</p>
3838 !! end
3839
3840 !! test
3841 Definition Lists: Hacky use to indent tables, with comment before table
3842 !! wikitext
3843 ::<!-- foo -->{|
3844 |foo
3845 |}
3846 !! html/parsoid
3847 <dl><dd><dl><dd><!-- foo --><table><tr>
3848 <td>foo</td>
3849 </tr></table></dd></dl></dd></dl>
3850 !! end
3851
3852 # The trailing whitespace in this test is to catch a regression in
3853 # Parsoid after T54473.
3854 !! test
3855 Definition Lists: Hacky use to indent tables (WS-insensitive)
3856 !! wikitext
3857 : {|
3858 |a
3859 |}
3860 !! html/php
3861 <dl><dd><table>
3862 <tr>
3863 <td>a
3864 </td></tr></table></dd></dl>
3865
3866 !! html/parsoid
3867 <dl><dd> <table>
3868 <tbody><tr><td>a</td></tr>
3869 </tbody></table> </dd></dl>
3870 !! end
3871
3872 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3873 ## as an empty dt item. It also ignores all but the last ";" when followed
3874 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3875 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3876 ## ";"s.
3877 ##
3878 ## Ex: ";;t2 ::d2" is transformed into:
3879 ##
3880 ## <dl>
3881 ## <dt>t2 </dt>
3882 ## <dd>
3883 ## <dl>
3884 ## <dt></dt>
3885 ## <dd>d2</dd>
3886 ## </dl>
3887 ## </dd>
3888 ## </dl>
3889 ##
3890 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3891 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3892 ##
3893 ## <dl>
3894 ## <dt>
3895 ## <dl>
3896 ## <dt>t2 </dt>
3897 ## <dd>:d2</dd>
3898 ## </dl>
3899 ## </dt>
3900 ## </dl>
3901 ##
3902 ## All Parsoid only definition list tests have this difference.
3903 ##
3904 ## See also: https://phabricator.wikimedia.org/T8569
3905 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3906
3907 !! test
3908 Table / list interaction: indented table with lists in table contents
3909 !! wikitext
3910 :{|
3911 |-
3912 | a
3913 * b
3914 |-
3915 | c
3916 * d
3917 |}
3918 !! html
3919 <dl><dd><table>
3920
3921 <tr>
3922 <td> a
3923 <ul><li> b</li></ul>
3924 </td></tr>
3925 <tr>
3926 <td> c
3927 <ul><li> d</li></ul>
3928 </td></tr></table></dd></dl>
3929
3930 !! end
3931
3932 !!test
3933 Table / list interaction: lists nested in tables nested in indented lists
3934 !! wikitext
3935 :{|
3936 |
3937 :a
3938 :b
3939 |
3940 *c
3941 *d
3942 |}
3943
3944 *e
3945 *f
3946 !! html
3947 <dl><dd><table>
3948 <tr>
3949 <td>
3950 <dl><dd>a</dd>
3951 <dd>b</dd></dl>
3952 </td>
3953 <td>
3954 <ul><li>c</li>
3955 <li>d</li></ul>
3956 </td></tr></table></dd></dl>
3957 <ul><li>e</li>
3958 <li>f</li></ul>
3959
3960 !!end
3961
3962 !! test
3963 Definition Lists: Nesting: Multi-level (Parsoid only)
3964 !! options
3965 parsoid
3966 !! wikitext
3967 ;t1 :d1
3968 ;;t2 ::d2
3969 ;;;t3 :::d3
3970 !! html
3971 <dl>
3972 <dt>t1 </dt>
3973 <dd>d1</dd>
3974 <dt>
3975 <dl>
3976 <dt>t2 </dt>
3977 <dd>:d2</dd>
3978 <dt>
3979 <dl>
3980 <dt>t3 </dt>
3981 <dd>::d3</dd>
3982 </dl>
3983 </dt>
3984 </dl>
3985 </dt>
3986 </dl>
3987
3988
3989 !! end
3990
3991
3992 !! test
3993 Definition Lists: Nesting: Test 2 (Parsoid only)
3994 !! wikitext
3995 ;t1
3996 ::d2
3997 !! html/php+tidy
3998 <dl>
3999 <dt>t1</dt>
4000 <dd>
4001 <dl>
4002 <dd>d2</dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 !! html/parsoid
4007 <dl>
4008 <dt>t1</dt>
4009 <dd>
4010 <dl>
4011 <dd>d2</dd>
4012 </dl>
4013 </dd>
4014 </dl>
4015
4016 !! end
4017
4018
4019 !! test
4020 Definition Lists: Nesting: Test 3 (Parsoid only)
4021 !! wikitext
4022 :;t1
4023 ::::d2
4024 !! html/php+tidy
4025 <dl>
4026 <dd>
4027 <dl>
4028 <dt>t1</dt>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <dl>
4033 <dd>d2</dd>
4034 </dl>
4035 </dd>
4036 </dl>
4037 </dd>
4038 </dl>
4039 </dd>
4040 </dl>
4041 !! html/parsoid
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dt>t1</dt>
4046 <dd>
4047 <dl>
4048 <dd>
4049 <dl>
4050 <dd>d2</dd>
4051 </dl>
4052 </dd>
4053 </dl>
4054 </dd>
4055 </dl>
4056 </dd>
4057 </dl>
4058
4059 !! end
4060
4061
4062 !! test
4063 Definition Lists: Nesting: Test 4
4064 !! wikitext
4065 ::;t3
4066 :::d3
4067 !! html
4068 <dl><dd><dl><dd><dl><dt>t3</dt>
4069 <dd>d3</dd></dl></dd></dl></dd></dl>
4070
4071 !! end
4072
4073
4074 ## The Parsoid team believes the following three test exposes a
4075 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4076 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4077 ## It also exposes a "misfeature" in tidy, which doesn't like
4078 ## <dl> tags with a single <dt> child; it converts the <dt> into
4079 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4080 !! test
4081 Definition Lists: Mixed Lists: Test 1
4082 !! wikitext
4083 :;* foo
4084 ::* bar
4085 :; baz
4086 !! html/php
4087 <dl><dd><dl><dt><ul><li> foo</li>
4088 <li> bar</li></ul></dt></dl>
4089 <dl><dt> baz</dt></dl></dd></dl>
4090
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dd>
4096 <ul>
4097 <li>foo</li>
4098 <li>bar</li>
4099 </ul>
4100 </dd>
4101 </dl>
4102 <dl>
4103 <dt>baz</dt>
4104 </dl>
4105 </dd>
4106 </dl>
4107 !! html/parsoid
4108 <dl>
4109 <dd><dl>
4110 <dt><ul>
4111 <li> foo
4112 </li>
4113 </ul></dt>
4114 <dd><ul>
4115 <li> bar
4116 </li>
4117 </ul></dd>
4118 <dt> baz</dt>
4119 </dl></dd>
4120 </dl>
4121 !! end
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 2
4125 !! wikitext
4126 *: d1
4127 *: d2
4128 !! html
4129 <ul><li><dl><dd> d1</dd>
4130 <dd> d2</dd></dl></li></ul>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 3
4137 !! wikitext
4138 *::: d1
4139 *::: d2
4140 !! html
4141 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4142 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 4
4149 !! wikitext
4150 *;d1 :d2
4151 *;d3 :d4
4152 !! html
4153 <ul><li><dl><dt>d1&#160;</dt>
4154 <dd>d2</dd>
4155 <dt>d3&#160;</dt>
4156 <dd>d4</dd></dl></li></ul>
4157
4158 !! end
4159
4160
4161 !! test
4162 Definition Lists: Mixed Lists: Test 5
4163 !! wikitext
4164 *:d1
4165 *:: d2
4166 !! html
4167 <ul><li><dl><dd>d1
4168 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4169
4170 !! end
4171
4172
4173 !! test
4174 Definition Lists: Mixed Lists: Test 6
4175 !! wikitext
4176 #*:d1
4177 #*::: d3
4178 !! html
4179 <ol><li><ul><li><dl><dd>d1
4180 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4181
4182 !! end
4183
4184
4185 !! test
4186 Definition Lists: Mixed Lists: Test 7
4187 !! wikitext
4188 :* d1
4189 :* d2
4190 !! html
4191 <dl><dd><ul><li> d1</li>
4192 <li> d2</li></ul></dd></dl>
4193
4194 !! end
4195
4196
4197 !! test
4198 Definition Lists: Mixed Lists: Test 8
4199 !! wikitext
4200 :* d1
4201 ::* d2
4202 !! html
4203 <dl><dd><ul><li> d1</li></ul>
4204 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4205
4206 !! end
4207
4208
4209 !! test
4210 Definition Lists: Mixed Lists: Test 9
4211 !! wikitext
4212 *;foo :bar
4213 !! html
4214 <ul><li><dl><dt>foo&#160;</dt>
4215 <dd>bar</dd></dl></li></ul>
4216
4217 !! end
4218
4219
4220 !! test
4221 Definition Lists: Mixed Lists: Test 10
4222 !! wikitext
4223 *#;foo :bar
4224 !! html
4225 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4226 <dd>bar</dd></dl></li></ol></li></ul>
4227
4228 !! end
4229
4230 # The Parsoid team disagrees with the PHP parser's seemingly-random
4231 # rules regarding dd/dt on the next two tests. Parsoid is more
4232 # consistent, and recognizes the shared nesting and keeps the
4233 # still-open tags around until the nesting is complete.
4234 # (And tidy again converts <dt> to <dd> before 'bar'.)
4235
4236 !! test
4237 Definition Lists: Mixed Lists: Test 11
4238 !! wikitext
4239 *#*#;*;;foo :bar
4240 *#*#;boo :baz
4241 !! html/php
4242 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4243 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4244 <dl><dt>boo&#160;</dt>
4245 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4246
4247 !! html/php+tidy
4248 <ul>
4249 <li>
4250 <ol>
4251 <li>
4252 <ul>
4253 <li>
4254 <ol>
4255 <li>
4256 <dl>
4257 <dt>foo&#160;</dt>
4258 <dd>
4259 <ul>
4260 <li>
4261 <dl>
4262 <dd>
4263 <dl>
4264 <dt>bar</dt>
4265 </dl>
4266 </dd>
4267 </dl>
4268 </li>
4269 </ul>
4270 </dd>
4271 </dl>
4272 <dl>
4273 <dt>boo&#160;</dt>
4274 <dd>baz</dd>
4275 </dl>
4276 </li>
4277 </ol>
4278 </li>
4279 </ul>
4280 </li>
4281 </ol>
4282 </li>
4283 </ul>
4284 !! html/parsoid
4285 <ul>
4286 <li>
4287 <ol>
4288 <li>
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dt>
4299 <dl>
4300 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4301 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4302 </dl></dt>
4303 </dl></li>
4304 </ul></dt>
4305 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4306 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4307 </dl></li>
4308 </ol></li>
4309 </ul></li>
4310 </ol></li>
4311 </ul>
4312 !! end
4313
4314
4315 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4316 # From whitelist:
4317 # * The test is wrong, there are two colons where there should be :;
4318 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4319 !! test
4320 Definition Lists: Weird Ones: Test 1
4321 !! wikitext
4322 *#;*::;; foo : bar (who uses this?)
4323 !! html/php
4324 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4325 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4326
4327 !! html/php+tidy
4328 <ul>
4329 <li>
4330 <ol>
4331 <li>
4332 <dl>
4333 <dt>foo&#160;</dt>
4334 <dd>
4335 <ul>
4336 <li>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dd>
4341 <dl>
4342 <dd>
4343 <dl>
4344 <dt>bar (who uses this?)</dt>
4345 </dl>
4346 </dd>
4347 </dl>
4348 </dd>
4349 </dl>
4350 </dd>
4351 </dl>
4352 </li>
4353 </ul>
4354 </dd>
4355 </dl>
4356 </li>
4357 </ol>
4358 </li>
4359 </ul>
4360 !! html/parsoid
4361 <ul>
4362 <li>
4363 <ol>
4364 <li>
4365 <dl>
4366 <dt>
4367 <ul>
4368 <li>
4369 <dl>
4370 <dd>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dt>
4375 <dl>
4376 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4377 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4378 </dl></dt>
4379 </dl></dd>
4380 </dl></dd>
4381 </dl></li>
4382 </ul></dt>
4383 </dl></li>
4384 </ol></li>
4385 </ul>
4386 !! end
4387
4388 !! test
4389 Definition Lists: colons occurring in tags
4390 !! wikitext
4391 ;a:b
4392 ;'''a:b'''
4393 ;<i>a:b</i>
4394 ;<span>a:b</span>
4395 ;<div>a:b</div>
4396 ;<div>a
4397 :b</div>
4398 ;{{echo|a:b}}
4399 ;{{echo|''a:b''}}
4400 ;;;''a:b''
4401 !! html+tidy
4402 <dl>
4403 <dt>a</dt>
4404 <dd>b</dd>
4405 <dt><b>a:b</b></dt>
4406 <dt><i>a:b</i></dt>
4407 <dt><span>a:b</span></dt>
4408 <dd>
4409 <div>a:b</div>
4410 </dd>
4411 <dd>
4412 <div>a
4413 <dl>
4414 <dd>b</dd>
4415 </dl>
4416 </div>
4417 </dd>
4418 <dt>a</dt>
4419 <dd>b</dd>
4420 <dt><i>a:b</i></dt>
4421 </dl>
4422 <dl>
4423 <dd>
4424 <dl>
4425 <dd>
4426 <dl>
4427 <dt><i>a:b</i></dt>
4428 </dl>
4429 </dd>
4430 </dl>
4431 </dd>
4432 </dl>
4433 !! html/parsoid
4434 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4435 <dt><b>a:b</b></dt>
4436 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4437 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4438 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4439 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4440 <dd>b</dd>
4441 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4442 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4443 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4444 !! end
4445
4446 !! test
4447 Definition Lists: colons and tables 1
4448 !! wikitext
4449 :{|
4450 | x
4451 |}
4452 :{|
4453 | y
4454 |}
4455 !! html
4456 <dl><dd><table>
4457 <tr>
4458 <td> x
4459 </td></tr></table></dd></dl>
4460 <dl><dd><table>
4461 <tr>
4462 <td> y
4463 </td></tr></table></dd></dl>
4464
4465 !! end
4466
4467 # Parsoid's output (as documented below) differs from php's in this case.
4468 # This is probably a bug. If we fixup parsoid to match php's output, the
4469 # above test should pass and the below test case can be removed. It is
4470 # unclear which output is more desirable.
4471
4472 !! test
4473 Definition Lists: colons and tables 2
4474 !! wikitext
4475 :{|
4476 | x
4477 |}
4478 :{|
4479 | y
4480 |}
4481 !! html/parsoid
4482 <dl><dd><table>
4483 <tr>
4484 <td> x
4485 </td></tr></table></dd>
4486 <dd><table>
4487 <tr>
4488 <td> y
4489 </td></tr></table></dd></dl>
4490 !! end
4491
4492 !! test
4493 Definition Lists: template interaction
4494 !! wikitext
4495 ::{{definition_list}}
4496
4497 :one
4498 ::{{definition_list}}
4499 :::two
4500 :::three
4501 ::four
4502 !! html/parsoid
4503 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4504 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4505
4506 <dl><dd data-parsoid='{}'>one
4507 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4508 </span><dd about="#mwt2">two
4509 <dl><dd>two</dd>
4510 <dd>three</dd></dl></dd>
4511 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4512 !! end
4513
4514
4515 ###
4516 ### External links
4517 ###
4518 !! test
4519 External links: non-bracketed
4520 !! wikitext
4521 Non-bracketed: http://example.com
4522 !! html
4523 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4524 </p>
4525 !! end
4526
4527 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4528 !! test
4529 External links: numbered
4530 !! wikitext
4531 Numbered: [http://example.com]
4532 Numbered: [http://example.net]
4533 Numbered: [http://example.com]
4534 !! html/php
4535 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4536 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4537 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4538 </p>
4539 !! html/parsoid
4540 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4541 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4542 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4543 !!end
4544
4545 !! test
4546 External links: specified text
4547 !! wikitext
4548 Specified text: [http://example.com link]
4549 !! html
4550 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: trail
4556 !! wikitext
4557 Linktrails should not work for external links: [http://example.com link]s
4558 !! html
4559 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4560 </p>
4561 !! end
4562
4563 !! test
4564 External links: dollar sign in URL
4565 !! wikitext
4566 http://example.com/1$2345
4567 !! html
4568 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: dollar sign in URL (autonumber)
4575 !! wikitext
4576 [http://example.com/1$2345]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4582 !!end
4583
4584 !! test
4585 External links: open square bracket forbidden in URL (bug 4377)
4586 !! options
4587 parsoid=wt2html,wt2wt,html2html
4588 !! wikitext
4589 http://example.com/1[2345
4590 !! html/php
4591 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4592 </p>
4593 !! html/parsoid
4594 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4595 !! end
4596
4597 !! test
4598 External links: open square bracket forbidden in URL (named) (bug 4377)
4599 !! options
4600 parsoid=wt2html,html2html
4601 !! wikitext
4602 [http://example.com/1[2345]
4603 !! html/php
4604 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4608 !!end
4609
4610 # parsoid adds a space before the link name
4611 !! test
4612 External links: open square bracket forbidden in URL (named) (bug 4377)
4613 Parsoid variant.
4614 !! wikitext
4615 [http://example.com/1 [2345]
4616 !! html
4617 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4618 </p>
4619 !!end
4620
4621 !! test
4622 External links: nowiki in URL link text (bug 6230)
4623 !! wikitext
4624 [http://example.com/ <nowiki>''example site''</nowiki>]
4625 !! html
4626 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: newline forbidden in text (bug 6230 regression check)
4632 !! wikitext
4633 [http://example.com/ first
4634 second]
4635 !! html
4636 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4637 second]
4638 </p>
4639 !!end
4640
4641 !! test
4642 External links: Pipe char between url and text
4643 !! wikitext
4644 [http://example.com | link]
4645 !! html
4646 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4647 </p>
4648 !!end
4649
4650 !! test
4651 External links: protocol-relative URL in brackets
4652 !! wikitext
4653 [//example.com/ Test]
4654 !! html
4655 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4656 </p>
4657 !! end
4658
4659 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4660 !! test
4661 External links: protocol-relative URL in brackets without text
4662 !! wikitext
4663 [//example.com]
4664 !! html/php
4665 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4666 </p>
4667 !! html/parsoid
4668 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4669 !! end
4670
4671 !! test
4672 External links: protocol-relative URL in free text is left alone
4673 !! wikitext
4674 //example.com/Foo
4675 !! html
4676 <p>//example.com/Foo
4677 </p>
4678 !!end
4679
4680 !! test
4681 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4682 !! wikitext
4683 foo//example.com/Foo
4684 !! html
4685 <p>foo//example.com/Foo
4686 </p>
4687 !! end
4688
4689 !! test
4690 External links: with no contents
4691 !! wikitext
4692 [http://en.wikipedia.org/wiki/Foo]
4693
4694 [[wikipedia:Foo|Bar]]
4695
4696 [[wikipedia:Foo|<span>Bar</span>]]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4699 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4701 </p>
4702 !! html/parsoid
4703 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4704 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4705 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4706 !! end
4707
4708 !! test
4709 External links: Free with trailing punctuation
4710 !! wikitext
4711 http://example.com,
4712 http://example.com;
4713 http://example.com\
4714 http://example.com.
4715 http://example.com:
4716 http://example.com!
4717 http://example.com?
4718 http://example.com)
4719 http://example.com/url_with_(brackets)
4720 (http://example.com/url_without_brackets)
4721 http://example.com/url_with_entity&amp;
4722 http://example.com/url_with_entity&#x26;
4723 http://example.com/url_with_entity&#038;
4724 http://example.com/url_with_entity&nbsp;
4725 http://example.com/url_with_entity&#xA0;
4726 http://example.com/url_with_entity&#160;
4727 http://example.com/url_with_entity&lt;
4728 http://example.com/url_with_entity&#x3C;
4729 http://example.com/url_with_entity&#60;
4730 !! html/php
4731 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4732 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4740 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4750 </p>
4751 !! html/parsoid
4752 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4753 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4754 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4755 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4756 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4757 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4758 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4759 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4760 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4761 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4762 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4763 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4766 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4767 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4768 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4769 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4770 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4771 !! end
4772
4773 !! test
4774 External links: tricky Parsoid html2html case
4775 !! options
4776 parsoid=wt2html,wt2wt,html2html
4777 !! wikitext
4778 http://example.com/url_with_entity&amp;amp;
4779 !! html/php
4780 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4781 </p>
4782 !! html/parsoid
4783 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4784 !! end
4785
4786 !! test
4787 External links: Free with trailing quotes (T113666)
4788 !! wikitext
4789 '''News:''' Stuff here
4790
4791 news:'a'b''c''d e
4792 !! html/php
4793 <p><b>News:</b> Stuff here
4794 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4795 </p>
4796 !! html/parsoid
4797 <p><b>News:</b> Stuff here</p>
4798 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4799 !! end
4800
4801 !! test
4802 External links: Lone protocols are never linked (T105697)
4803 !! wikitext
4804 http://
4805 http://;
4806 (http://)
4807 bitcoin:
4808 bitcoin:;
4809 (bitcoin:)
4810 !! html
4811 <p>http://
4812 http://;
4813 (http://)
4814 bitcoin:
4815 bitcoin:;
4816 (bitcoin:)
4817 </p>
4818 !! end
4819
4820 !! test
4821 External links: No preceding word characters allowed (bug 65278)
4822 !! wikitext
4823 NOPEhttp://example.com
4824 N0http://example.com
4825 ok:http://example.com
4826 ok-http://example.com
4827 !! html
4828 <p>NOPEhttp://example.com
4829 N0http://example.com
4830 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4831 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: nofollow domain exception
4837 !! wikitext
4838 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4839 !! html
4840 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4841 </p>
4842 !!end
4843
4844 !! test
4845 External image
4846 !! wikitext
4847 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4848 !! html
4849 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4850 </p>
4851 !! end
4852
4853 !! test
4854 External image from https
4855 !! wikitext
4856 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4857 !! html
4858 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4859 </p>
4860 !! end
4861
4862 !! test
4863 External image (when not allowed)
4864 !! options
4865 wgAllowExternalImages=0
4866 !! wikitext
4867 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4868 !! html
4869 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4870 </p>
4871 !! end
4872
4873 !! test
4874 Link to non-http image, no img tag
4875 !! wikitext
4876 Link to non-http image, no img tag: ftp://example.com/test.jpg
4877 !! html
4878 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4879 </p>
4880 !! end
4881
4882 !! test
4883 External links: terminating separator
4884 !! wikitext
4885 Terminating separator: http://example.com/thing,
4886 !! html
4887 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4888 </p>
4889 !! end
4890
4891 !! test
4892 External links: intervening separator
4893 !! wikitext
4894 Intervening separator: http://example.com/1,2,3
4895 !! html
4896 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4897 </p>
4898 !! end
4899
4900 !! test
4901 External links: old bug with URL in query
4902 !! wikitext
4903 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4904 !! html
4905 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4906 </p>
4907 !! end
4908
4909 !! test
4910 External links: old URL-in-URL bug, mixed protocols
4911 !! wikitext
4912 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4913 !! html
4914 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4915 </p>
4916 !!end
4917
4918 # Since Parsoid is starting to emit canonical wikitext for links,
4919 # [http://example.com http://example.com] will not RT back to that
4920 # form anymore.
4921 !! test
4922 External links: URL in text
4923 !! options
4924 parsoid=wt2html
4925 !! wikitext
4926 URL in text: [http://example.com http://example.com]
4927 !! html/php
4928 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4929 </p>
4930 !! html/parsoid
4931 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4932 !! end
4933
4934 !! test
4935 External links: Clickable images
4936 !! wikitext
4937 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4938 !! html/php
4939 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4940 </p>
4941 !! html/parsoid
4942 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4943 !! end
4944
4945 !! test
4946 External links: raw ampersand
4947 !! wikitext
4948 Old &amp; use: http://x&y
4949 !! html
4950 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4951 </p>
4952 !! end
4953
4954 !! test
4955 External links: encoded ampersand
4956 !! wikitext
4957 Old &amp; use: http://x&amp;y
4958 !! html/php
4959 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4960 </p>
4961 !! html/parsoid
4962 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4963 !! end
4964
4965 !! test
4966 External links: encoded equals (bug 6102)
4967 !! wikitext
4968 http://example.com/?foo&#61;bar
4969 !! html/php
4970 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4971 </p>
4972 !! html/parsoid
4973 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4974 !! end
4975
4976 ##
4977 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4978 ## does it number them. As discussed in bug 53505, we can identify
4979 ## autonumbered links via CSS.
4980 ##
4981
4982 !! test
4983 External links: [raw ampersand]
4984 !! wikitext
4985 Old &amp; use: [http://x&y]
4986 !! html/php
4987 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4988 </p>
4989 !! html/parsoid
4990 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4991 !! end
4992
4993 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4994 # mode will return the [raw ampersand] wikitext
4995 !! test
4996 External links: [encoded ampersand]
4997 !! options
4998 parsoid=wt2html,wt2wt,html2html
4999 !! wikitext
5000 Old &amp; use: [http://x&amp;y]
5001 !! html/php
5002 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5003 </p>
5004 !! html/parsoid
5005 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5006 !! end
5007
5008 !! test
5009 External links: [raw equals]
5010 !! wikitext
5011 [http://example.com/?foo=bar]
5012 !! html/php
5013 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5014 </p>
5015 !! html/parsoid
5016 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5017 !! end
5018
5019 # note that parsoid html is identical to [raw equals] case; so html2wt
5020 # mode will return the [raw equals] wikitext
5021 !! test
5022 External links: [encoded equals] (bug 6102)
5023 !! options
5024 parsoid=wt2html,wt2wt,html2html
5025 !! wikitext
5026 [http://example.com/?foo&#61;bar]
5027 !! html/php
5028 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5029 </p>
5030 !! html/parsoid
5031 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5032 !! end
5033
5034 # xxx parsoid strips the IDN character, so the round-trip tests will
5035 # obviously fail and are disabled. --cscott
5036 !! test
5037 External links: [IDN ignored character reference in hostname; strip it right off]
5038 !! options
5039 parsoid=wt2html,wt2wt,html2html
5040 !! wikitext
5041 [http://e&zwnj;xample.com/]
5042 !! html/php
5043 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5047 !! end
5048
5049 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5050 # Where an external link could easily circumvent the sanitization of the text of
5051 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5052 # test demands a higher standard. That's a bit strange.
5053 #
5054 # Example:
5055 #
5056 # http://e‌xample.com -> [http://example.com|http://example.com]
5057 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5058 #
5059 # The first example is sanitized, but the second is not. Any security benefits
5060 # from this production are trivial to circumvent. Either remove this test and
5061 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5062 # the test accordingly.
5063 #
5064 # All our love,
5065 # The Parsoid team.
5066 # xxx parsoid strips the IDN character, so the round-trip tests will
5067 # obviously fail and are disabled. --cscott
5068 !! test
5069 External links: IDN ignored character reference in hostname; strip it right off
5070 !! options
5071 parsoid=wt2html,html2html
5072 !! wikitext
5073 http://e&zwnj;xample.com/
5074 !! html/php
5075 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5076 </p>
5077 !! html/parsoid
5078 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5079 !! end
5080
5081 !! test
5082 External links: www.jpeg.org (bug 554)
5083 !! wikitext
5084 http://www.jpeg.org
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5087 </p>
5088 !! end
5089
5090 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5091 !! test
5092 External links: URL within URL (original bug 2)
5093 !! wikitext
5094 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5095 !! html/php
5096 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5097 </p>
5098 !! html/parsoid
5099 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5100 !! end
5101
5102 !! test
5103 BUG 361: URL inside bracketed URL
5104 !! wikitext
5105 [http://www.example.com/foo http://www.example.com/bar]
5106 !! html
5107 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5108 </p>
5109 !! end
5110
5111 !! test
5112 BUG 361: URL within URL, not bracketed
5113 !! wikitext
5114 http://www.example.com/foo?=http://www.example.com/bar
5115 !! html
5116 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5117 </p>
5118 !! end
5119
5120 !! test
5121 BUG 289: ">"-token in URL-tail
5122 !! wikitext
5123 http://www.example.com/<hello>
5124 !! html
5125 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5126 </p>
5127 !!end
5128
5129 !! test
5130 BUG 289: literal ">"-token in URL-tail
5131 !! wikitext
5132 http://www.example.com/<b>html</b>
5133 !! html/php
5134 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5135 </p>
5136 !! html/parsoid
5137 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5138 !! end
5139
5140 !! test
5141 BUG 289: ">"-token in bracketed URL
5142 !! wikitext
5143 [http://www.example.com/<hello> stuff]
5144 !! html
5145 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5146 </p>
5147 !!end
5148
5149 !! test
5150 BUG 289: literal ">"-token in bracketed URL
5151 !! wikitext
5152 [http://www.example.com/<b>html</b> stuff]
5153 !! html
5154 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5155 </p>
5156 !!end
5157
5158 !! test
5159 BUG 289: literal double quote at end of URL
5160 !! wikitext
5161 http://www.example.com/"hello"
5162 !! html
5163 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5164 </p>
5165 !!end
5166
5167 !! test
5168 BUG 289: literal double quote in bracketed URL
5169 !! wikitext
5170 [http://www.example.com/"hello" stuff]
5171 !! html
5172 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5173 </p>
5174 !!end
5175
5176 !! test
5177 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5178 !! wikitext
5179 [http://www.example.com test]
5180 !! html
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5182 </p>
5183 !! end
5184
5185 !! test
5186 External links: link text with spaces
5187 !! wikitext
5188 [http://www.example.com a b c]
5189 [http://www.example.com ''a'' ''b'']
5190 !! html
5191 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5192 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 External links: wiki links within external link (Bug 3695)
5198 !! options
5199 parsoid=wt2html,html2html
5200 !! wikitext
5201 [http://example.com [[wikilink]] embedded in ext link]
5202 !! html/php
5203 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5204 </p>
5205 !! html/parsoid
5206 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5207 !! end
5208
5209 !! test
5210 BUG 787: Links with one slash after the url protocol are invalid
5211 !! wikitext
5212 http:/example.com
5213
5214 [http:/example.com title]
5215 !! html
5216 <p>http:/example.com
5217 </p><p>[http:/example.com title]
5218 </p>
5219 !! end
5220
5221 !! test
5222 Bracketed external links with template-generated invalid target
5223 !! wikitext
5224 [{{echo|http:/example.com}} title]
5225 !! html
5226 <p>[http:/example.com title]
5227 </p>
5228 !! end
5229
5230 !! test
5231 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5232 !! wikitext
5233 ''[http://example.com text'']
5234 [http://example.com '''text]'''
5235 ''Something [http://example.com in italic'']
5236 ''Something [http://example.com mixed''''', even bold]'''
5237 '''''Now [http://example.com both''''']
5238 !! html
5239 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5240 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5241 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5242 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5243 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5244 </p>
5245 !! end
5246
5247
5248 !! test
5249 Bug 4781: %26 in URL
5250 !! wikitext
5251 http://www.example.com/?title=AT%26T
5252 !! html/php
5253 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5254 </p>
5255 !! html/parsoid
5256 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5257 !! end
5258
5259 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5260 # % is actually legal in HTML5. Any change in output would need testing though.
5261 !! test
5262 Bug 4781, 5267: %25 in URL
5263 !! wikitext
5264 http://www.example.com/?title=100%25_Bran
5265 !! html/php
5266 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %28, %29 in URL
5274 !! wikitext
5275 http://www.example.com/?title=Ben-Hur_%281959_film%29
5276 !! html/php
5277 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5281 !! end
5282
5283
5284 !! test
5285 Bug 4781: %26 in autonumber URL
5286 !! wikitext
5287 [http://www.example.com/?title=AT%26T]
5288 !! html/php
5289 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5290 </p>
5291 !! html/parsoid
5292 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5293 !! end
5294
5295 !! test
5296 Bug 4781, 5267: %26 in autonumber URL
5297 !! wikitext
5298 [http://www.example.com/?title=100%25_Bran]
5299 !! html/php
5300 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5304 !! end
5305
5306 !! test
5307 Bug 4781, 5267: %28, %29 in autonumber URL
5308 !! wikitext
5309 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5310 !! html/php
5311 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5312 </p>
5313 !! html/parsoid
5314 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5315 !! end
5316
5317
5318 !! test
5319 Bug 4781: %26 in bracketed URL
5320 !! wikitext
5321 [http://www.example.com/?title=AT%26T link]
5322 !! html/php
5323 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5324 </p>
5325 !! html/parsoid
5326 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5327 !! end
5328
5329 !! test
5330 Bug 4781, 5267: %25 in bracketed URL
5331 !! wikitext
5332 [http://www.example.com/?title=100%25_Bran link]
5333 !! html
5334 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5335 </p>
5336 !! end
5337
5338 !! test
5339 Bug 4781, 5267: %28, %29 in bracketed URL
5340 !! wikitext
5341 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5342 !! html/php
5343 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5344 </p>
5345 !! html/parsoid
5346 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5347 !! end
5348
5349 !! test
5350 External link containing a period in the anchor. (bug 63947)
5351 !! wikitext
5352 [//foo.org/bar#baz. bang]
5353
5354 [//foo.org/bar. bang]
5355 !! html/php
5356 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5357 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5358 </p>
5359 !! html/parsoid
5360 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5361 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5362 !! end
5363
5364 !! test
5365 External link containing a single quote. (bug 63947)
5366 !! wikitext
5367 [//foo.org/bar'baz]
5368
5369 [//foo.org/bar'baz bang]
5370 !! html/php
5371 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5372 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5373 </p>
5374 !! html/parsoid
5375 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5376 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5377 !! end
5378
5379 !! test
5380 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5381 !! wikitext
5382 Some [http://example.com/ pretty ''italics'' and stuff]!
5383 !! html
5384 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5385 </p>
5386 !! end
5387
5388 !! test
5389 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5390 !! wikitext
5391 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5392 !! html
5393 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5394 </p>
5395 !! end
5396
5397 !! test
5398 External link containing double-single-quotes with no space separating the url from text in italics
5399 !! wikitext
5400 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5401 !! html/php
5402 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5403 </p>
5404 !! html/php+tidy
5405 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5406 !! html/parsoid
5407 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5408 !! end
5409
5410 !! test
5411 External link with comments in link text
5412 !! wikitext
5413 [http://www.google.com Google <!-- comment -->]
5414 !! html/php
5415 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5416 </p>
5417 !! html/parsoid
5418 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5419 !! end
5420
5421 !! test
5422 External link to bare IPv4 address
5423 !! wikitext
5424 [http://192.168.0.1 Link]
5425 !! html/php
5426 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5427 </p>
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5430 !! end
5431
5432 !! test
5433 URL-encoding in URL functions (single parameter)
5434 !! wikitext
5435 {{localurl:Some page|amp=&}}
5436 !! html
5437 <p>/index.php?title=Some_page&amp;amp=&amp;
5438 </p>
5439 !! end
5440
5441 !! test
5442 URL-encoding in URL functions (multiple parameters)
5443 !! wikitext
5444 {{localurl:Some page|q=?&amp=&}}
5445 !! html
5446 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5447 </p>
5448 !! end
5449
5450 !! test
5451 Brackets in urls
5452 !! wikitext
5453 http://example.com/index.php?foozoid%5B%5D=bar
5454
5455 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5456 !! html/php
5457 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5458 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5459 </p>
5460 !! html/parsoid
5461 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5462
5463 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5464 !! end
5465
5466 !! test
5467 IPv6 urls, autolink format (T23261)
5468 !! wikitext
5469 http://[2404:130:0:1000::187:2]/index.php
5470
5471 Examples from RFC 2373, section 2.2:
5472 * http://[1080::8:800:200C:417A]/unicast
5473 * http://[FF01::101]/multicast
5474 * http://[::1]/loopback
5475 * http://[::]/unspecified
5476 * http://[::13.1.68.3]/ipv4compat
5477 * http://[::FFFF:129.144.52.38]/ipv4compat
5478
5479 Examples from RFC 2732, section 2:
5480 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5481 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5482 * http://[3ffe:2a00:100:7031::1]
5483 * http://[1080::8:800:200C:417A]/foo
5484 * http://[::192.9.5.5]/ipng
5485 * http://[::FFFF:129.144.52.38]:80/index.html
5486 * http://[2010:836B:4179::836B:4179]
5487
5488 !! html/php
5489 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5490 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5491 </p>
5492 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5493 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5494 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5495 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5496 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5497 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5498 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5499 </p>
5500 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5501 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5502 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5503 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5504 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5505 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5506 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5507
5508 !! html/parsoid
5509 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5510
5511 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5512 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5515 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5518
5519 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5520 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5524 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5525 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5526 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5527 !! end
5528
5529 !! test
5530 IPv6 urls, bracketed format (T23261)
5531 !! wikitext
5532 [http://[2404:130:0:1000::187:2]/index.php test]
5533
5534 Examples from RFC 2373, section 2.2:
5535 * [http://[1080::8:800:200C:417A] unicast]
5536 * [http://[FF01::101] multicast]
5537 * [http://[::1]/ loopback]
5538 * [http://[::] unspecified]
5539 * [http://[::13.1.68.3] ipv4compat]
5540 * [http://[::FFFF:129.144.52.38] ipv4compat]
5541
5542 Examples from RFC 2732, section 2:
5543 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5544 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5545 * [http://[3ffe:2a00:100:7031::1] 3]
5546 * [http://[1080::8:800:200C:417A]/foo 4]
5547 * [http://[::192.9.5.5]/ipng 5]
5548 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5549 * [http://[2010:836B:4179::836B:4179] 7]
5550
5551 !! html/php
5552 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5553 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5554 </p>
5555 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5556 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5557 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5558 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5561 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5562 </p>
5563 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5564 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5565 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5566 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5567 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5568 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5569 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5570
5571 !! html/parsoid
5572 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5573
5574 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5575 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5576 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5577 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5578 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5581
5582 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5583 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5584 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5585 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5586 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5587 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5588 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5589 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5590 !! end
5591
5592 !! test
5593 Non-extlinks in brackets
5594 !! wikitext
5595 [foo]
5596 [foo bar]
5597 [foo ''bar'']
5598 [fool's] errand
5599 [fool's errand]
5600 [{{echo|foo}}]
5601 [{{echo|foo}} bar]
5602 [{{echo|foo}} ''bar'']
5603 [{{echo|foo}}l's] errand
5604 [{{echo|foo}}l's errand]
5605 [url={{echo|foo}}]
5606 [url=http://example.com]
5607 [http:// bare protocols don't count]
5608 !! html/php
5609 <p>[foo]
5610 [foo bar]
5611 [foo <i>bar</i>]
5612 [fool's] errand
5613 [fool's errand]
5614 [foo]
5615 [foo bar]
5616 [foo <i>bar</i>]
5617 [fool's] errand
5618 [fool's errand]
5619 [url=foo]
5620 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5621 [http:// bare protocols don't count]
5622 </p>
5623 !! html/parsoid
5624 <p>[foo]
5625 [foo bar]
5626 [foo <i>bar</i>]
5627 [fool's] errand
5628 [fool's errand]
5629 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5630 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5631 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5632 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5633 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5634 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5635 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5636 [http:// bare protocols don't count]</p>
5637 !! end
5638
5639 !! test
5640 Percent encoding in external links
5641 !! wikitext
5642 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5643 !! html/php
5644 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5645 </p>
5646 !! html/parsoid
5647 <p><a rel="mw:ExtLink"
5648 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5649 !! end
5650
5651 !! test
5652 Use url link syntax for links where the content is equal the link target
5653 !! wikitext
5654 http://example.com
5655 !! html/php
5656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5657 </p>
5658 !! html/parsoid
5659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5660 !! end
5661
5662 !! test
5663 Parenthesis in external links, especially URL links
5664 !! wikitext
5665 http://example.com)
5666
5667 http://example.com/test)
5668
5669 http://example.com/(test)
5670
5671 http://example.com/((test)
5672
5673 (http://example.com/(test))
5674
5675 (http://example.com/(test)))))
5676
5677 http://example.com/a)b
5678
5679 [http://example.com) foo]
5680 !! html/php
5681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5682 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5683 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5684 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5685 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5686 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5687 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5688 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5689 </p>
5690 !! html/parsoid
5691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5692 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5693 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5694 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5695 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5696 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5697 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5698 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5699 !! end
5700
5701 !! test
5702 Parenthesis in external links, w/ transclusion or comment
5703 !! wikitext
5704 (http://example.com/{{echo|hi}})
5705
5706 (http://example.com<!-- hi -->)
5707 !! html/php
5708 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5709 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5710 </p>
5711 !! html/parsoid
5712 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5713
5714 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5715 !! end
5716
5717 !! test
5718 Serialize <a> tags with invalid link targets as plain text
5719 !! options
5720 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5721 !! html/parsoid
5722 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5723 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5724 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5725 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5726 !! wikitext
5727 text
5728 <nowiki>*</nowiki>text
5729 <nowiki>[[foo]]</nowiki>
5730 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5731 !! end
5732
5733 !! test
5734 mw:ExtLink -vs- mw:WikiLink (T94723)
5735 !! options
5736 parsoid=html2wt
5737 !! html/parsoid
5738 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5739 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5740 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5741 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5742 <p>
5743 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5744 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5745 </p>
5746 !! wikitext
5747 [[Foo|Bar]]
5748 [[Foo|Bar]]
5749 [[wikipedia:Foo|Bar]]
5750 [[wikipedia:Foo|Bar]]
5751
5752 [[wikipedia:European_Robin|European Robin]]
5753 [[wikipedia:European_Robin|European Robin]]
5754 !! end
5755
5756 !! test
5757 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5758 !! options
5759 parsoid=wt2wt
5760 !! wikitext
5761 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5762 !! html/parsoid
5763 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5764 !! end
5765
5766
5767 ###
5768 ### Quotes
5769 ###
5770
5771 !! test
5772 Quotes
5773 !! wikitext
5774 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5775
5776 Normal text. '''''Bold italic text.''''' Normal text.
5777 !! html
5778 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5779 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5780 </p>
5781 !! end
5782
5783
5784 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5785 # parser strips. The wikitext contains just the first half of the bold
5786 # quote pair.
5787 !! test
5788 Unclosed and unmatched quotes
5789 !! wikitext
5790 '''''Bold italic text '''with bold deactivated''' in between.'''''
5791
5792 '''''Bold italic text ''with italic deactivated'' in between.'''''
5793
5794 '''Bold text..
5795
5796 ..spanning two paragraphs (should not work).'''
5797
5798 '''Bold tag left open
5799
5800 ''Italic tag left open
5801
5802 Normal text.
5803
5804 <!-- Unmatching number of opening, closing tags: -->
5805 '''This year''''s election ''should'' beat '''last year''''s.
5806
5807 ''Tom'''s car is bigger than ''Susan'''s.
5808
5809 Plain ''italic'''s plain
5810 !! html/php
5811 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5812 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5813 </p><p><b>Bold text..</b>
5814 </p><p>..spanning two paragraphs (should not work).
5815 </p><p><b>Bold tag left open</b>
5816 </p><p><i>Italic tag left open</i>
5817 </p><p>Normal text.
5818 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5819 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5820 </p><p>Plain <i>italic'</i>s plain
5821 </p>
5822 !! html/parsoid
5823 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5824 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5825 </p><p><b>Bold text..</b>
5826 </p><p>..spanning two paragraphs (should not work).<b></b>
5827 </p><p><b>Bold tag left open</b>
5828 </p><p><i>Italic tag left open</i>
5829 </p><p>Normal text.
5830 </p>
5831 <!-- Unmatching number of opening, closing tags: -->
5832 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5834 </p><p>Plain <i>italic'</i>s plain
5835 </p>
5836 !! end
5837
5838 ###
5839 ### Tables
5840 ###
5841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5842 ###
5843
5844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5845 # is the bare minimum required by the spec, see:
5846 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5847 # Parsoid team replies: empty table tags are legal in HTML5
5848 !! test
5849 A table with no data.
5850 !! options
5851 parsoid=wt2html
5852 !! wikitext
5853 {||}
5854 !! html/php
5855
5856 !! html/parsoid
5857 <table></table>
5858
5859 !! end
5860
5861 !! test
5862 A table with stray table end tags on start tag line (wt2html)
5863 !! options
5864 parsoid=wt2html
5865 !! wikitext
5866 {|style="color: red;"|}
5867
5868 {|style="color: red;" |}
5869 |foo
5870 |}
5871
5872 {|style="color: red;"|} id="foo"
5873 |foo
5874 |}
5875
5876 {|style="color: red;" |} id="foo"
5877 |foo
5878 |}
5879 !! html
5880 <table style="color: red;"></table>
5881
5882 <table style="color: red;">
5883 <tbody><tr>
5884 <td>foo</td>
5885 </tr></tbody>
5886 </table>
5887
5888 <table style="color: red;" id="foo">
5889 <tbody><tr>
5890 <td>foo</td>
5891 </tr></tbody>
5892 </table>
5893
5894 <table style="color: red;" id="foo">
5895 <tbody><tr>
5896 <td>foo</td>
5897 </tr></tbody>
5898 </table>
5899
5900 !! end
5901
5902 !! test
5903 A table with no data (take 2)
5904 !! wikitext
5905 {|
5906 |}
5907 !! html/parsoid
5908 <table></table>
5909 !! end
5910
5911 # A table with nothing but a caption is invalid XHTML, we might want to render
5912 # this as <p>caption</p>
5913 # Parsoid team replies: table with only a caption is legal in HTML5
5914 !! test
5915 A table with nothing but a caption
5916 !! wikitext
5917 {|
5918 |+ caption
5919 |}
5920 !! html/php
5921 <table>
5922 <caption> caption
5923 </caption><tr><td></td></tr></table>
5924
5925 !! html/parsoid
5926 <table><caption> caption</caption></table>
5927 !! end
5928
5929 !! test
5930 A table with caption with default-spaced attributes and a table row
5931 !! wikitext
5932 {|
5933 |+ style="color: red;" | caption1
5934 |-
5935 | foo
5936 |}
5937 !! html
5938 <table>
5939 <caption style="color: red;"> caption1
5940 </caption>
5941 <tr>
5942 <td> foo
5943 </td></tr></table>
5944
5945 !! end
5946
5947 !! test
5948 A table with captions with non-default spaced attributes and a table row
5949 !! wikitext
5950 {|
5951 |+style="color: red;"|caption2
5952 |+ style="color: red;"| caption3
5953 |-
5954 | foo
5955 |}
5956 !! html
5957 <table>
5958 <caption style="color: red;">caption2
5959 </caption>
5960 <caption style="color: red;"> caption3
5961 </caption>
5962 <tr>
5963 <td> foo
5964 </td></tr></table>
5965
5966 !! end
5967
5968 !! test
5969 Table td-cell syntax variations
5970 !! wikitext
5971 {|
5972 | foo bar foo | baz
5973 | foo bar foo || baz
5974 | style='color:red;' | baz
5975 | style='color:red;' || baz
5976 |}
5977 !! html
5978 <table>
5979 <tr>
5980 <td> baz
5981 </td>
5982 <td> foo bar foo </td>
5983 <td> baz
5984 </td>
5985 <td style="color:red;"> baz
5986 </td>
5987 <td> style='color:red;' </td>
5988 <td> baz
5989 </td></tr></table>
5990
5991 !! end
5992
5993 !! test
5994 Simple table
5995 !! wikitext
5996 {|
5997 | 1 || 2
5998 |-
5999 | 3 || 4
6000 |}
6001 !! html
6002 <table>
6003 <tr>
6004 <td> 1 </td>
6005 <td> 2
6006 </td></tr>
6007 <tr>
6008 <td> 3 </td>
6009 <td> 4
6010 </td></tr></table>
6011
6012 !! end
6013
6014 !! test
6015 Simple table but with multiple dashes for row wikitext
6016 !! wikitext
6017 {|
6018 | foo
6019 |-----
6020 | bar
6021 |}
6022 !! html
6023 <table>
6024 <tr>
6025 <td> foo
6026 </td></tr>
6027 <tr>
6028 <td> bar
6029 </td></tr></table>
6030
6031 !! end
6032
6033 !! test
6034 Multiplication table
6035 !! wikitext
6036 {| border="1" cellpadding="2"
6037 |+Multiplication table
6038 |-
6039 ! &times; !! 1 !! 2 !! 3
6040 |-
6041 ! 1
6042 | 1 || 2 || 3
6043 |-
6044 ! 2
6045 | 2 || 4 || 6
6046 |-
6047 ! 3
6048 | 3 || 6 || 9
6049 |-
6050 ! 4
6051 | 4 || 8 || 12
6052 |-
6053 ! 5
6054 | 5 || 10 || 15
6055 |}
6056 !! html
6057 <table border="1" cellpadding="2">
6058 <caption>Multiplication table
6059 </caption>
6060 <tr>
6061 <th> &#215; </th>
6062 <th> 1 </th>
6063 <th> 2 </th>
6064 <th> 3
6065 </th></tr>
6066 <tr>
6067 <th> 1
6068 </th>
6069 <td> 1 </td>
6070 <td> 2 </td>
6071 <td> 3
6072 </td></tr>
6073 <tr>
6074 <th> 2
6075 </th>
6076 <td> 2 </td>
6077 <td> 4 </td>
6078 <td> 6
6079 </td></tr>
6080 <tr>
6081 <th> 3
6082 </th>
6083 <td> 3 </td>
6084 <td> 6 </td>
6085 <td> 9
6086 </td></tr>
6087 <tr>
6088 <th> 4
6089 </th>
6090 <td> 4 </td>
6091 <td> 8 </td>
6092 <td> 12
6093 </td></tr>
6094 <tr>
6095 <th> 5
6096 </th>
6097 <td> 5 </td>
6098 <td> 10 </td>
6099 <td> 15
6100 </td></tr></table>
6101
6102 !! end
6103
6104 !! test
6105 Accept "||" in table headings
6106 !! wikitext
6107 {|
6108 !h1 || h2
6109 |}
6110 !! html
6111 <table>
6112 <tr>
6113 <th>h1 </th>
6114 <th> h2
6115 </th></tr></table>
6116
6117 !! end
6118
6119 !! test
6120 Accept "!!" in table data
6121 !! wikitext
6122 {|
6123 | Foo!! ||
6124 |}
6125 !! html
6126 <table>
6127 <tr>
6128 <td> Foo!! </td>
6129 <td>
6130 </td></tr></table>
6131
6132 !! html/parsoid
6133 <table>
6134 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6135 </tbody></table>
6136 !! end
6137
6138 !! test
6139 Accept "||" in indented table headings
6140 !! wikitext
6141 :{|
6142 !h1 || h2
6143 |}
6144 !! html
6145 <dl><dd><table>
6146 <tr>
6147 <th>h1 </th>
6148 <th> h2
6149 </th></tr></table></dd></dl>
6150
6151 !! end
6152
6153 !! test
6154 Accept "!!" in templates
6155 !! wikitext
6156 {|
6157 !a {{echo|b!!c}}
6158 |}
6159 !! html/php
6160 <table>
6161 <tr>
6162 <th>a b</th>
6163 <th>c
6164 </th></tr></table>
6165
6166 !! html/parsoid
6167 <table>
6168 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6169 !! end
6170
6171 !! test
6172 Accept "!!" in table headings after newline
6173 !! wikitext
6174 {|
6175 !a
6176 b!!c
6177 |}
6178 !! html/php
6179 <table>
6180 <tr>
6181 <th>a
6182 <p>b!!c
6183 </p>
6184 </th></tr></table>
6185
6186 !! html/parsoid
6187 <table>
6188 <tbody><tr><th>a
6189 <p>b!!c</p></th></tr>
6190 </tbody></table>
6191 !! end
6192
6193 !! test
6194 Accept "!!" in table data of mixed wikitext / html syntax
6195 !! wikitext
6196 {|
6197 !a
6198 <tr><td>b!!c</td></tr>
6199 |}
6200 !! html+tidy
6201 <table>
6202 <tr>
6203 <th>a</th>
6204 </tr>
6205 <tr>
6206 <td>b!!c</td>
6207 </tr>
6208 </table>
6209 !! html/parsoid
6210 <table>
6211 <tbody><tr><th>a</th></tr>
6212 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6213 </tbody></table>
6214 !! end
6215
6216 !! test
6217 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6218 !! wikitext
6219 {|
6220 !| h1
6221 || a
6222 |}
6223 !! html
6224 <table>
6225 <tr>
6226 <th> h1
6227 </th>
6228 <td> a
6229 </td></tr></table>
6230
6231 !! end
6232
6233 !!test
6234 Accept "| !" at start of line in tables (ignore !-attribute)
6235 !! wikitext
6236 {|
6237 |-
6238 | !style="color:red" | bar
6239 |}
6240 !! html
6241 <table>
6242
6243 <tr>
6244 <td> bar
6245 </td></tr></table>
6246
6247 !!end
6248
6249 !!test
6250 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6251 !! wikitext
6252 {|
6253 |-
6254 |style='color:red;'|+1
6255 |style='color:blue;'|-1
6256 |-
6257 | 1 || 2 || 3
6258 | 1 ||+2 ||-3
6259 |-
6260 | +1
6261 | -1
6262 |}
6263 !! html
6264 <table>
6265
6266 <tr>
6267 <td style="color:red;">+1
6268 </td>
6269 <td style="color:blue;">-1
6270 </td></tr>
6271 <tr>
6272 <td> 1 </td>
6273 <td> 2 </td>
6274 <td> 3
6275 </td>
6276 <td> 1 </td>
6277 <td>+2 </td>
6278 <td>-3
6279 </td></tr>
6280 <tr>
6281 <td> +1
6282 </td>
6283 <td> -1
6284 </td></tr></table>
6285
6286 !!end
6287
6288 !! test
6289 Table rowspan
6290 !! wikitext
6291 {| border=1
6292 | Cell 1, row 1
6293 |rowspan=2| Cell 2, row 1 (and 2)
6294 | Cell 3, row 1
6295 |-
6296 | Cell 1, row 2
6297 | Cell 3, row 2
6298 |}
6299 !! html
6300 <table border="1">
6301 <tr>
6302 <td> Cell 1, row 1
6303 </td>
6304 <td rowspan="2"> Cell 2, row 1 (and 2)
6305 </td>
6306 <td> Cell 3, row 1
6307 </td></tr>
6308 <tr>
6309 <td> Cell 1, row 2
6310 </td>
6311 <td> Cell 3, row 2
6312 </td></tr></table>
6313
6314 !! end
6315
6316 !! test
6317 Nested table
6318 !! wikitext
6319 {| border=1
6320 | &alpha;
6321 |
6322 {| bgcolor=#ABCDEF border=2
6323 |nested
6324 |-
6325 |table
6326 |}
6327 |the original table again
6328 |}
6329 !! html
6330 <table border="1">
6331 <tr>
6332 <td> &#945;
6333 </td>
6334 <td>
6335 <table bgcolor="#ABCDEF" border="2">
6336 <tr>
6337 <td>nested
6338 </td></tr>
6339 <tr>
6340 <td>table
6341 </td></tr></table>
6342 </td>
6343 <td>the original table again
6344 </td></tr></table>
6345
6346 !! end
6347
6348 !! test
6349 Invalid attributes in table cell (bug 1830)
6350 !! wikitext
6351 {|
6352 |Cell:|broken
6353 |}
6354 !! html
6355 <table>
6356 <tr>
6357 <td>broken
6358 </td></tr></table>
6359
6360 !! end
6361
6362 !! test
6363 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6364 !! wikitext
6365 {|
6366 | title="foo" |bar
6367 | title="foo<nowiki>|</nowiki>" |bar
6368 | title="foo<nowiki>|</nowiki>" bar
6369 |}
6370 !! html/php
6371 <table>
6372 <tr>
6373 <td title="foo">bar
6374 </td>
6375 <td title="foo&#124;">bar
6376 </td>
6377 <td> title="foo|" bar
6378 </td></tr></table>
6379
6380 !! html/parsoid
6381 <table>
6382 <tbody><tr><td title="foo">bar</td>
6383 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6384 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6385 </tbody></table>
6386 !! end
6387
6388 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6389 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6390 # *2wt modes will fail.
6391 !! test
6392 Table security: embedded pipes
6393 !! options
6394 parsoid=wt2html,html2html
6395 !! wikitext
6396 {|
6397 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6398 !! html/php
6399 <table>
6400 <tr>
6401 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6402 <td>]" onmouseover="alert(document.cookie)"&gt;test
6403 </td>
6404 </tr>
6405 </table>
6406
6407 !! html/parsoid
6408 <table><tbody>
6409 <tr>
6410 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6411 !! end
6412
6413 !! test
6414 Element attributes with double ! should not be broken up by <th>
6415 !! wikitext
6416 {|
6417 ! hi <div class="!!">ha</div> ho
6418 |}
6419 !! html/php
6420 <table>
6421 <tr>
6422 <th> hi <div class="!!">ha</div> ho
6423 </th></tr></table>
6424
6425 !! html/parsoid
6426 <table>
6427 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6428 </tbody></table>
6429 !! end
6430
6431 !! test
6432 ! and || in element attributes should not be parsed as <th>/<td>
6433 !! wikitext
6434 {|
6435 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6436 |}
6437 !! html/php
6438 <table>
6439 <tr>
6440 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6441 </td></tr></table>
6442
6443 !! html/parsoid
6444 <table>
6445 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6446 </tbody></table>
6447 !! end
6448
6449 # FIXME: The output seems broken. Filed as T110268.
6450 !! test
6451 ! and || in td attributes should not be parsed as <th>/<td>
6452 !! options
6453 parsoid=wt2html
6454 !! wikitext
6455 {|
6456 | style="color: red !important;" data-contrived="put this here ||" | foo
6457 |}
6458 !! html/php
6459 <table>
6460 <tr>
6461 <td> style="color: red !important;" data-contrived="put this here </td>
6462 <td> foo
6463 </td></tr></table>
6464
6465 !! html/parsoid
6466 <table>
6467 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6468 </tbody></table>
6469 !! end
6470
6471 !! test
6472 Break on | in element attribute in template
6473 !! options
6474 parsoid=wt2html,html2html
6475 !! wikitext
6476 {{echo|1=<div class="hi|ho">ha</div>}}
6477 !! html/php
6478 <p>ho"&gt;ha&lt;/div&gt;
6479 </p>
6480 !! html/parsoid
6481 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6482 !! end
6483
6484 !! test
6485 Break on | in element attribute name in template
6486 !! wikitext
6487 {{echo|<div cla|ss="hiho">ha</div>}}
6488 !! html/parsoid
6489 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6490 !! end
6491
6492 !! test
6493 Don't break on | in extension attribute in template
6494 !! wikitext
6495 {{echo|<ref name="hi|ho">ha</ref>}}
6496
6497 <references />
6498 !! html/parsoid
6499 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6500
6501 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6502 !! end
6503
6504 ## We don't support roundtripping of these attributes in Parsoid.
6505 ## Selective serialization takes care of preventing dirty diffs.
6506 ## But, on edits, we dirty-diff the invalid attribute text.
6507 !! test
6508 Invalid text in table attributes should be discarded
6509 !! options
6510 parsoid=wt2html
6511 !! wikitext
6512 {| <span>boo</span> style='border:1px solid black'
6513 | <span>boo</span> style='color:blue' | 1
6514 |<span>boo</span> style='color:blue'| 2
6515 |}
6516 !! html/php
6517 <table style="border:1px solid black">
6518 <tr>
6519 <td style="color:blue"> 1
6520 </td>
6521 <td style="color:blue"> 2
6522 </td></tr></table>
6523
6524 !! html/parsoid
6525 <table style="border:1px solid black">
6526 <tr>
6527 <td style="color:blue"> 1</td>
6528 <td style="color:blue"> 2</td>
6529 </tr>
6530 </table>
6531 !! end
6532
6533 !! test
6534 Invalid text in table attributes should be preserved by selective serializer
6535 !! options
6536 parsoid={
6537 "modes": ["selser"],
6538 "changes": [
6539 ["td:first-child", "text", "abc"],
6540 ["td + td", "text", "xyz"]
6541 ]
6542 }
6543 !! wikitext
6544 {| <span>boo</span> style='border:1px solid black'
6545 | <span>boo</span> style='color:blue' | 1
6546 |<span>boo</span> style='color:blue'| 2
6547 |}
6548 !! wikitext/edited
6549 {| <span>boo</span> style='border:1px solid black'
6550 | <span>boo</span> style='color:blue' |abc
6551 |<span>boo</span> style='color:blue'|xyz
6552 |}
6553 !! end
6554
6555 !! test
6556 1. Template-generated table cell attributes and cell content
6557 !! wikitext
6558 {|
6559 |{{table_attribs}}
6560 | {{table_attribs}}
6561 || {{table_attribs_5}}
6562 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6563 |align=center {{table_attribs}}
6564 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6565 |}
6566 !! html
6567 <table>
6568 <tr>
6569 <td style="color:red;">Foo
6570 </td>
6571 <td style="color:red;">Foo
6572 </td>
6573 <td> style="color:red;"</td>
6574 <td>Bar
6575 </td>
6576 <td style="color:red;">Foo
6577 </td>
6578 <td align="center" style="color:red;">Foo
6579 </td>
6580 <td align="center" style="color:red;">Foo
6581 </td></tr></table>
6582
6583 !! end
6584
6585 !! test
6586 2. Template-generated table cell attributes and cell content
6587 !! wikitext
6588 {|
6589 |{{table_attribs_2}}
6590 |}
6591 !! html/php
6592 <table>
6593 <tr>
6594 <td style="color:red;">Foo
6595 </td>
6596 <td>Bar</td>
6597 <td>Baz
6598 </td></tr></table>
6599
6600 !! html/parsoid
6601 <table>
6602 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6603 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6604 </tbody></table>
6605 !! end
6606
6607 !! test
6608 3. Template-generated table cell attributes and cell content
6609 !! wikitext
6610 {|
6611 !align=center {{table_header_cells}}
6612 |-
6613 |align=center {{table_cells}}
6614 |}
6615 !! html/php
6616 <table>
6617 <tr>
6618 <th align="center" style="color:red;">Foo</th>
6619 <th style="color:red;"><i>Bar</i></th>
6620 <th style="color:brown;"><i>Foo</i> and Baz
6621 </th></tr>
6622 <tr>
6623 <td align="center" style="color:red;">Foo</td>
6624 <td style="color:red;"><i>Bar</i></td>
6625 <td style="color:brown;"><i>Foo</i> and Baz
6626 </td></tr></table>
6627
6628 !! html/parsoid
6629 <table>
6630 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6631 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6632 </tbody></table>
6633 !! end
6634
6635 !! test
6636 4. Template-generated table cell attributes and cell content inside a templated table
6637 !! wikitext
6638 {{tbl-start}}
6639 !align=center {{table_header_cells}}
6640 |-
6641 |align=center {{table_cells}}
6642 {{tbl-end}}
6643 !! html/php
6644 <table>
6645 <tr>
6646 <th align="center" style="color:red;">Foo</th>
6647 <th style="color:red;"><i>Bar</i></th>
6648 <th style="color:brown;"><i>Foo</i> and Baz
6649 </th></tr>
6650 <tr>
6651 <td align="center" style="color:red;">Foo</td>
6652 <td style="color:red;"><i>Bar</i></td>
6653 <td style="color:brown;"><i>Foo</i> and Baz
6654 </td></tr></table>
6655
6656 !! html/parsoid
6657 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6658 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6659 <tr>
6660 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6661 </tbody></table>
6662 !! end
6663
6664 ## Edge case fix to prevent future regressions
6665 !! test
6666 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6667 !! wikitext
6668 {|
6669 |{{table_attribs_7}}
6670 |}
6671 <references />
6672 !! html/parsoid
6673 <table>
6674 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6675 </tbody></table>
6676 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6677 !! end
6678
6679 !! test
6680 Table with row followed by newlines and table heading
6681 !! options
6682 parsoid=wt2html,html2html
6683 !! wikitext
6684 {|
6685 |-
6686
6687 ! foo
6688 |}
6689 !! html/*
6690 <table>
6691
6692
6693 <tr>
6694 <th> foo
6695 </th></tr></table>
6696
6697 !! end
6698
6699 !! test
6700 Table with empty line following the start tag
6701 !! options
6702 parsoid=wt2html,html2html
6703 !! wikitext
6704 {|
6705
6706 |-
6707 | foo
6708 |}
6709 !! html/*
6710 <table>
6711
6712
6713 <tr>
6714 <td> foo
6715 </td></tr></table>
6716
6717 !! end
6718
6719 !! test
6720 Table attributes with empty value
6721 !! options
6722 parsoid=wt2html,html2html
6723 !! wikitext
6724 {|
6725 | style=| hello
6726 |}
6727 !! html/php
6728 <table>
6729 <tr>
6730 <td style=""> hello
6731 </td></tr></table>
6732
6733 !! html/parsoid
6734 <table>
6735 <tbody><tr><td style=""> hello</td></tr>
6736 </tbody></table>
6737 !! end
6738
6739 !! test
6740 Wikitext table with a lot of comments
6741 !! wikitext
6742 {|
6743 <!-- c0 -->
6744 | foo
6745 <!-- c1 -->
6746 |-<!-- c2 -->
6747 <!-- c3 -->
6748 |<!-- c4 -->
6749 <!-- c5 -->
6750 |}
6751 !! html
6752 <table>
6753 <tr>
6754 <td> foo
6755 </td></tr>
6756 <tr>
6757 <td>
6758 </td></tr></table>
6759
6760 !! end
6761
6762 !! test
6763 Wikitext table comments represented in parsoid dom
6764 !! wikitext
6765 {|<!--c1--><!--c2-->
6766 |-<!--c3-->
6767 | x
6768 |}
6769 !! html/php+tidy
6770 <table>
6771 <tr>
6772 <td>x</td>
6773 </tr>
6774 </table>
6775 !! html/parsoid
6776 <table><!--c1--><!--c2-->
6777 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6778 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6779 </tbody></table>
6780 !! end
6781
6782 !! test
6783 Wikitext table with double-line table cell
6784 !! wikitext
6785 {|
6786 |a
6787 b
6788 |}
6789 !! html
6790 <table>
6791 <tr>
6792 <td>a
6793 <p>b
6794 </p>
6795 </td></tr></table>
6796
6797 !! end
6798
6799 !! test
6800 Table cell with a single comment
6801 !! wikitext
6802 {|
6803 | <!-- c1 -->
6804 | a
6805 |}
6806 !! html
6807 <table>
6808 <tr>
6809 <td>
6810 </td>
6811 <td> a
6812 </td></tr></table>
6813
6814 !! end
6815
6816 !! test
6817 Table-cell after a comment-only-empty-line
6818 !! wikitext
6819 {|
6820 |a
6821 <!--c1-->
6822 <!--c2-->| b
6823 |}
6824 !! html
6825 <table>
6826 <tr>
6827 <td>a
6828 </td>
6829 <td> b
6830 </td></tr></table>
6831
6832 !! html/parsoid
6833 <table>
6834 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6835 <!--c1-->
6836 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6837 </tbody></table>
6838
6839 !! end
6840
6841 !! test
6842 Build table with {{!}}
6843 !! wikitext
6844 {{{!}} class="wikitable"
6845 ! header
6846 ! second header
6847 {{!}}- style="color:red;"
6848 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6849 {{!}}}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header
6854 </th>
6855 <th> second header
6856 </th></tr>
6857 <tr style="color:red;">
6858 <td> data </td>
6859 <td style="color:red;"> second data
6860 </td></tr></table>
6861
6862 !! end
6863
6864 !! test
6865 Build table with pipe as data
6866 !! wikitext
6867 {| class="wikitable"
6868 ! header
6869 ! second header
6870 |- style="color:red;"
6871 | data || style="color:red;" | second data
6872 |-
6873 | style="color:red;" | data with | || style="color:red;" | second data with |
6874 |-
6875 || data with | ||| second data with |
6876 |}
6877 !! html
6878 <table class="wikitable">
6879 <tr>
6880 <th> header
6881 </th>
6882 <th> second header
6883 </th></tr>
6884 <tr style="color:red;">
6885 <td> data </td>
6886 <td style="color:red;"> second data
6887 </td></tr>
6888 <tr>
6889 <td style="color:red;"> data with | </td>
6890 <td style="color:red;"> second data with |
6891 </td></tr>
6892 <tr>
6893 <td> data with | </td>
6894 <td> second data with |
6895 </td></tr></table>
6896
6897 !! end
6898
6899 !! test
6900 Build table with wikilink
6901 !! wikitext
6902 {| class="wikitable"
6903 ! header || second header
6904 |- style="color:red;"
6905 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6906 |-
6907 | data || second data [[Main Page|link|text with pipe]]
6908 |}
6909 !! html
6910 <table class="wikitable">
6911 <tr>
6912 <th> header </th>
6913 <th> second header
6914 </th></tr>
6915 <tr style="color:red;">
6916 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6917 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6918 </td></tr>
6919 <tr>
6920 <td> data </td>
6921 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6922 </td></tr></table>
6923
6924 !! end
6925
6926 # The expected HTML structure in this test is debatable. The PHP parser does
6927 # not parse this kind of table at all. The main focus for Parsoid is on
6928 # round-tripping, so this output is ok for now. TODO: revisit!
6929 !! test
6930 Wikitext table with html-syntax row
6931 !! wikitext
6932 {|
6933 |-
6934 <td>foo</td>
6935 |}
6936 !! html/parsoid
6937 <table>
6938 <tbody>
6939 <tr>
6940 <td>foo</td></tr></tbody></table>
6941 !! end
6942
6943 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6944 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6945 ## PHP parser, which tidy then compounds by fostering the content
6946 ## entirely out of the table. Parsoid recognizes the table context
6947 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6948 ## depends on PHP's treatment of broken table markup!
6949 !! test
6950 Implicit <td> after a |-
6951 !! options
6952 parsoid=wt2html,html2html
6953 !! wikitext
6954 {|
6955 |-
6956 a
6957 |}
6958 !! html/php
6959 <table>
6960
6961 a
6962 </table>
6963
6964 !! html/php+tidy
6965 <p>a</p>
6966 !! html/parsoid
6967 <table>
6968 <tr><td>a</td></tr>
6969 </table>
6970 !! end
6971
6972 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6973 !! test
6974 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6975 !! options
6976 parsoid=wt2html,html2html
6977 !! wikitext
6978 {|
6979 |-
6980 |
6981 a
6982 |-
6983 b
6984 |}
6985 !! html/php
6986 <table>
6987
6988 <tr>
6989 <td>
6990 <pre>a
6991 </pre>
6992 </td></tr>
6993 b
6994 </table>
6995
6996 !! html/php+tidy
6997 <p>b</p>
6998 <table>
6999 <tr>
7000 <td>
7001 <pre>
7002 a
7003 </pre></td>
7004 </tr>
7005 </table>
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr><td><pre>a</pre></td></tr>
7010 <tr><td> b</td></tr>
7011 </tbody>
7012 </table>
7013 !! end
7014
7015 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7016 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7017 !! test
7018 Lists should be recognized in an implicit <td> context
7019 !! options
7020 parsoid=wt2html,html2html
7021 !! wikitext
7022 {|
7023 |-
7024 *a
7025 |}
7026 !! html/php
7027 <table>
7028
7029 <ul><li>a</li></ul>
7030 </table>
7031
7032 !! html/php+tidy
7033 <ul>
7034 <li>a</li>
7035 </ul>
7036 !! html/parsoid
7037 <table>
7038 <tr>
7039 <td><ul>
7040 <li>a</li>
7041 </ul></td>
7042 </tr>
7043 </table>
7044 !! end
7045
7046 !! test
7047 Table cells not properly parsed in an implicit-td context
7048 !! wikitext
7049 {|
7050 |-
7051 {{table_attribs_4}} || a || b
7052 |}
7053 !! html/php+tidy
7054 <table>
7055 <tr>
7056 <td style="background-color:#DC241f;" width="10px"></td>
7057 <td>a</td>
7058 <td>b</td>
7059 </tr>
7060 </table>
7061 !! html/parsoid
7062 <table>
7063 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7064 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
7065 </tbody></table>
7066 !! end
7067
7068 !! test
7069 Parsoid: Round-trip tables directly followed by content (bug 51219)
7070 !! options
7071 parsoid=wt2html,wt2wt
7072 !! wikitext
7073 {|
7074 |foo
7075 |} bar
7076
7077 {|
7078 |baz
7079 |}<b>quux</b>
7080 !! html+tidy
7081 <table>
7082 <tr>
7083 <td>foo</td>
7084 </tr>
7085 </table>
7086 <p>bar</p>
7087 <table>
7088 <tr>
7089 <td>baz</td>
7090 </tr>
7091 </table>
7092 <p><b>quux</b></p>
7093 !! end
7094
7095 !! test
7096 Parsoid: Default to a newline after tables in new content (bug 51219)
7097 !! options
7098 parsoid=html2wt
7099 !! html/parsoid
7100 <table><tbody>
7101 <tr><td>foo</td></tr></tbody></table> bar
7102 <table><tbody>
7103 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7104 !! wikitext
7105 {|
7106 |foo
7107 |}
7108 <nowiki> </nowiki>bar
7109 {|
7110 |baz
7111 |}
7112 '''quux'''
7113 !! end
7114
7115 !! test
7116 Parsoid: newline inducing block nodes don't suppress <nowiki>
7117 !! options
7118 parsoid=html2wt
7119 !! html/parsoid
7120 a<h1>foo</h1>
7121 !! wikitext
7122 <nowiki> </nowiki>a
7123
7124 = foo =
7125 !! end
7126
7127 !! test
7128 Parsoid: Row-syntax table headings followed by comment & table cells
7129 !! options
7130 parsoid=wt2html,wt2wt
7131 !! wikitext
7132 {|
7133 ! foo || bar
7134 <!-- foo --> || baz || quux
7135 |}
7136 !! html/php
7137 <table>
7138 <tr>
7139 <th> foo </th>
7140 <th> bar
7141 </th>
7142 <td> baz </td>
7143 <td> quux
7144 </td></tr></table>
7145
7146 !! html/parsoid
7147 <table>
7148 <tbody><tr><th> foo </th><th> bar
7149 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7150 </tbody></table>
7151 !! end
7152
7153 !!test
7154 Parsoid: Recover better from broken table attributes
7155 !!options
7156 parsoid=wt2html
7157 !!wikitext
7158 {| class="foo
7159 | class="bar" |
7160 foo
7161 |}
7162 !!html/php+tidy
7163 <table class="foo">
7164 <tr>
7165 <td class="bar">
7166 <p>foo</p>
7167 </td>
7168 </tr>
7169 </table>
7170 !!html/parsoid
7171 <table class="foo">
7172 <tr>
7173 <td class="bar">
7174 <p>foo</p></td></tr>
7175 </tbody></table>
7176 !!end
7177
7178 !! test
7179 Tables: Digest broken attributes on table and tr tag
7180 !! options
7181 parsoid=wt2html
7182 !! wikitext
7183 {| || |} ++
7184 |- || || ++ --
7185 |- > [
7186 |}
7187 !! html
7188 <table>
7189 <tbody>
7190 <tr></tr>
7191 <tr></tr>
7192 </tbody></table>
7193 !! end
7194
7195 # T137406: Whitespace in the HTML
7196 !! test
7197 1. Generate correct wikitext for tables with thead/tbody/tfoot
7198 !! options
7199 parsoid=html2wt
7200 !! html/parsoid
7201 <table>
7202 <caption>Test</caption>
7203 <thead>
7204 <tr>
7205 <th>Month</th>
7206 <th>Savings</th>
7207 </tr>
7208 </thead>
7209 <tbody>
7210 <tr>
7211 <td>January</td>
7212 <td>$100</td>
7213 </tr>
7214 <tr>
7215 <td>February</td>
7216 <td>$80</td>
7217 </tr>
7218 </tbody>
7219 <tfoot>
7220 <tr>
7221 <td>Sum</td>
7222 <td>$180</td>
7223 </tr>
7224 </tfoot>
7225 </table>
7226 !! wikitext
7227 {|
7228 |+Test
7229 !Month
7230 !Savings
7231 |-
7232 |January
7233 |$100
7234 |-
7235 |February
7236 |$80
7237 |-
7238 |Sum
7239 |$180
7240 |}
7241 !! html/php+tidy
7242 <table>
7243 <caption>Test</caption>
7244 <tr>
7245 <th>Month</th>
7246 <th>Savings</th>
7247 </tr>
7248 <tr>
7249 <td>January</td>
7250 <td>$100</td>
7251 </tr>
7252 <tr>
7253 <td>February</td>
7254 <td>$80</td>
7255 </tr>
7256 <tr>
7257 <td>Sum</td>
7258 <td>$180</td>
7259 </tr>
7260 </table>
7261 !! end
7262
7263 # T137406: No whitespace in the HTML
7264 !! test
7265 2. Generate correct wikitext for tables with thead/tbody/tfoot
7266 !! options
7267 parsoid=html2wt
7268 !! html/parsoid
7269 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7270 !! wikitext
7271 {|
7272 !heading
7273 |-
7274 |foo
7275 |}
7276 !! end
7277
7278 !! test
7279 Testing serialization after deletion in references
7280 !! options
7281 parsoid={
7282 "modes": ["wt2wt"],
7283 "changes": [
7284 ["#x", "remove"]
7285 ]
7286 }
7287 !! wikitext
7288 hi <ref><div id="x">ho</div></ref>
7289
7290 <references />
7291 !! wikitext/edited
7292 hi <ref></ref>
7293
7294 <references />
7295 !! end
7296
7297 !!test
7298 Testing serialization after deletion of table cells
7299 !!options
7300 parsoid={
7301 "modes": ["wt2wt", "selser"],
7302 "changes": [
7303 ["#x", "remove"]
7304 ]
7305 }
7306 !!wikitext
7307 {|
7308 !h1 !!h2 !!h3
7309 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7310 |}
7311 !! wikitext/edited
7312 {|
7313 !h1 !!h2 !!h3
7314 |c2 |||c3
7315 |}
7316 !!end
7317
7318 !! test
7319 Testing selser after addition of new row before first row (T125419)
7320 !! options
7321 parsoid={
7322 "modes": ["wt2wt", "selser"],
7323 "changes": [
7324 [ "tr", "before", "<tr><td>X</td></tr>" ]
7325 ]
7326 }
7327 !! wikitext
7328 {|
7329 |a
7330 |}
7331 !! wikitext/edited
7332 {|
7333 |X
7334 |-
7335 |a
7336 |}
7337 !! end
7338
7339 !! test
7340 Serialize new table rows in a HTML table using HTML tags
7341 !! options
7342 parsoid={
7343 "modes": ["wt2wt", "selser"],
7344 "changes": [
7345 [ "tr", "before", "<tr><td>X</td></tr>" ]
7346 ]
7347 }
7348 !! wikitext
7349 <table><tr><td>a</td></tr></table>
7350 !! wikitext/edited
7351 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7352 !! end
7353
7354 !! test
7355 Serialize new table cells in a HTML row using HTML tags
7356 !! options
7357 parsoid={
7358 "modes": ["wt2wt", "selser"],
7359 "changes": [
7360 [ "td", "before", "<td>X</td>" ]
7361 ]
7362 }
7363 !! wikitext
7364 <table><tr><td>a</td></tr></table>
7365 !! wikitext/edited
7366 <table><tr><td>X</td><td>a</td></tr></table>
7367 !! end
7368
7369 !! test
7370 Wikitext tables can be nested inside HTML tables
7371 !! options
7372 parsoid=html2wt
7373 !! html
7374 <table data-parsoid='{"stx":"html"}'>
7375 <tr><td>
7376 <table>
7377 <tr><td>foo</td></tr>
7378 </table>
7379 </td></tr>
7380 </table>
7381 !! wikitext
7382 <table>
7383 <tr><td>
7384 {|
7385 |foo
7386 |}
7387 </td></tr>
7388 </table>
7389 !! end
7390
7391 !! test
7392 Serialize wikitext list items as HTML list items when embedded in a HTML list
7393 !! options
7394 parsoid=html2wt
7395 !! html
7396 <ul data-parsoid='{"stx": "html"}'>
7397 <li data-parsoid='{}'>a</li>
7398 <li>b</li>
7399 </ul>
7400 !! wikitext
7401 <ul>
7402 <li>a</li>
7403 <li>b</li>
7404 </ul>
7405 !! end
7406
7407 # SSS FIXME: Is this actually a good thing given the
7408 # odd nested list output that is generated by MW?
7409 # <ul><li>foo<ul>..</ul></li></ul> instead of
7410 # <ul><li>foo</li><ul>..</ul></ul>
7411 !! test
7412 Wikitext lists can be nested inside HTML lists
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{"stx": "html"}'>a
7418 <ul><li>b</li></ul>
7419 </li>
7420 </ul>
7421
7422 <ul data-parsoid='{"stx": "html"}'>
7423 <li>x
7424 <ul><li>y</li></ul>
7425 </li>
7426 </ul>
7427 !! wikitext
7428 <ul>
7429 <li>a
7430 * b
7431 </li>
7432 </ul>
7433
7434 <ul>
7435 <li>x
7436 * y
7437 </li>
7438 </ul>
7439 !! end
7440
7441 ###
7442 ### Internal links
7443 ###
7444 !! test
7445 Plain link, capitalized
7446 !! wikitext
7447 [[Main Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Plain link, uncapitalized
7455 !! wikitext
7456 [[main Page]]
7457 !! html
7458 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Piped link
7464 !! wikitext
7465 [[Main Page|The Main Page]]
7466 !! html
7467 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7468 </p>
7469 !! end
7470
7471 !! test
7472 Piped link with comment in link text
7473 !! wikitext
7474 [[Main Page|The Main<!--front--> Page]]
7475 !! html
7476 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7477 </p>
7478 !! end
7479
7480 !! test
7481 Piped link with multiple pipe characters in link text
7482 !! wikitext
7483 [[Main Page||The|Main|Page|]]
7484 !! html/php
7485 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7486 </p>
7487 !! html/parsoid
7488 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7489 !! end
7490
7491 !! test
7492 Piped link with no link text
7493 !! wikitext
7494 [[Thomas Bek (bishop of St David's)|]]
7495 !! html/php
7496 <p>[[Thomas Bek (bishop of St David's)|]]
7497 </p>
7498 !! html/parsoid
7499 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7500 !! end
7501
7502 !! test
7503 Piped link with empty link text
7504 !! wikitext
7505 [[Main Page|<nowiki />]] - empty nowiki
7506 [[Main Page| ]] - empty space
7507 [[Main Page|&nbsp;]] - empty non breaking space
7508 !! html/php
7509 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7510 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7511 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7512 </p>
7513 !! html/parsoid
7514 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7515 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7516 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7517 !! end
7518
7519 !! test
7520 Broken link
7521 !! wikitext
7522 [[Zigzagzogzagzig]]
7523 !! html
7524 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Broken link with fragment
7530 !! wikitext
7531 [[Zigzagzogzagzig#zug]]
7532 !! html
7533 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Special page link with fragment
7539 !! wikitext
7540 [[Special:Version#anchor]]
7541 !! html
7542 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7543 </p>
7544 !! end
7545
7546 !! test
7547 Nonexistent special page link with fragment
7548 !! wikitext
7549 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7550 !! html
7551 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7552 </p>
7553 !! end
7554
7555 !! test
7556 Link with prefix
7557 !! wikitext
7558 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7559 !! html
7560 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7561 </p>
7562 !! end
7563
7564 !! test
7565 Link with suffix
7566 !! wikitext
7567 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7568 !! html
7569 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7570 </p>
7571 !! end
7572
7573 !! article
7574 prefixed article
7575 !! text
7576 Some text
7577 !! endarticle
7578
7579 !! test
7580 Bug 43661: Piped links with identical prefixes
7581 !! wikitext
7582 [[prefixed article|prefixed articles with spaces]]
7583
7584 [[prefixed article|prefixed articlesaoeu]]
7585
7586 [[Main Page|Main Page test]]
7587 !! html
7588 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7589 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7590 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7591 </p>
7592 !! end
7593
7594
7595 !! test
7596 Link with HTML entity in suffix / tail
7597 !! wikitext
7598 [[Main Page]]&quot;, [[Main Page]]&#97;
7599 !! html/php
7600 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7601 </p>
7602 !! html/parsoid
7603 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7604 !! end
7605
7606 !! test
7607 Link with 3 brackets
7608 !! wikitext
7609 [[[Main Page]]]
7610 Foo [[[Main Page]]]
7611 !! html
7612 <p>[[[Main Page]]]
7613 Foo [[[Main Page]]]
7614 </p>
7615 !! end
7616
7617 !! test
7618 Link with 4 brackets
7619 !! wikitext
7620 [[[[Main Page]]]]
7621 !! html
7622 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7623 </p>
7624 !! end
7625
7626 !! test
7627 Piped link with 3 brackets
7628 !! wikitext
7629 [[[main page|the main page]]]
7630 !! html
7631 <p>[[[main page|the main page]]]
7632 </p>
7633 !! end
7634
7635 !! test
7636 Piped link with extlink-like text
7637 !! wikitext
7638 [[Main Page|[bar]]]
7639 [[Main Page|This is a [bar]]]
7640 !! html/php
7641 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7642 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7643 </p>
7644 !! html/parsoid
7645 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7646 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7647 !! end
7648
7649 !! test
7650 Link with multiple pipes
7651 !! wikitext
7652 [[Main Page|The|Main|Page]]
7653 !! html
7654 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7655 </p>
7656 !! end
7657
7658 !! test
7659 Anchor containing a #. (bug 63430)
7660 !! wikitext
7661 [[Main Page#And#Link]]
7662 !! html/php
7663 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7664 </p>
7665 !! html/parsoid
7666 <p><a rel="mw:WikiLink" href="./Main_Page#And.23Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And.23Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7667 !! end
7668
7669 !! test
7670 Link to namespaces
7671 !! wikitext
7672 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7673 !! html
7674 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7675 </p>
7676 !! end
7677
7678 !! test
7679 Link with space in namespace
7680 !! wikitext
7681 [[User talk:Foo bar]]
7682 !! html
7683 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7684 </p>
7685 !! end
7686
7687 !! article
7688 MemoryAlpha:AlphaTest
7689 !! text
7690 This is an article in the MemoryAlpha namespace
7691 (which shadows the memoryalpha interwiki link).
7692 !! endarticle
7693
7694 !! test
7695 Namespace takes precedence over interwiki link (bug 51680)
7696 !! wikitext
7697 [[MemoryAlpha:AlphaTest]]
7698 !! html
7699 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7700 </p>
7701 !! end
7702
7703 # The previous test doesn't work correctly in html2*, due to not recognizing the
7704 # link as an internal one. This one checks for the correct behavior.
7705 !! test
7706 Link to namespace preferred over interwiki with correct rel attribute
7707 !! options
7708 parsoid=html2wt,html2html
7709 !! html/parsoid
7710 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7711 !! wikitext
7712 [[MemoryAlpha:AlphaTest]]
7713 !! end
7714
7715 !! test
7716 Piped link to namespace
7717 !! wikitext
7718 [[Meta:Disclaimers|The disclaimers]]
7719 !! html
7720 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7721 </p>
7722 !! end
7723
7724 !! test
7725 Link containing }
7726 !! wikitext
7727 [[Usually caused by a typo (oops}]]
7728 !! html
7729 <p>[[Usually caused by a typo (oops}]]
7730 </p>
7731 !! end
7732
7733 !! article
7734 7% Solution
7735 !! text
7736 Just a test of an article title containing a percent.
7737 !! endarticle
7738
7739 !! test
7740 Link containing % (not as a hex sequence)
7741 !! wikitext
7742 [[7% Solution]]
7743 [[7% Solution|7%25 Solution]]
7744 !! html/php
7745 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7746 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7747 </p>
7748 !! html/parsoid
7749 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7750 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7751 !! end
7752
7753 # note that the parsoid HTML is identical to the previous test output,
7754 # so the previous test ensures that the html2wt mode will generate the
7755 # "not as a hex sequence" wikitext.
7756 !! test
7757 Link containing % as a single hex sequence interpreted to char
7758 !! options
7759 parsoid=wt2wt,wt2html,html2html
7760 !! wikitext
7761 [[7%25 Solution]]
7762 [[7%25 Solution|7%25 Solution]]
7763 !! html/php
7764 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7765 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7766 </p>
7767 !! html/parsoid
7768 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7769 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7770 !!end
7771
7772 !! test
7773 Link containing % as a double hex sequence interpreted to hex sequence
7774 !! wikitext
7775 [[7%2525 Solution]]
7776 !! html
7777 <p>[[7%2525 Solution]]
7778 </p>
7779 !!end
7780
7781 ## Example for such a section: == < ==
7782 !! test
7783 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7784 !! wikitext
7785 [[%23%3c]][[%23%3e]]
7786 !! html/php
7787 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7788 </p>
7789 !! html/parsoid
7790 <p><a rel="mw:WikiLink" href="./Main_Page#.3C" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3C"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#.3E" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3E"},"sa":{"href":"%23%3e"}}'>#></a></p>
7791 !! end
7792
7793 !! test
7794 Link containing "<#" and ">#" as a hex sequences
7795 !! wikitext
7796 [[%3c%23]][[%3e%23]]
7797 !! html
7798 <p>[[%3c%23]][[%3e%23]]
7799 </p>
7800 !! end
7801
7802 !! test
7803 Link containing an equals sign
7804 !! wikitext
7805 [[Special:BookSources/isbn=4-00-026157-6]]
7806 !! html/php
7807 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7808 </p>
7809 !! html/parsoid
7810 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7811 !! end
7812
7813 !! article
7814 Foo~bar
7815 !! text
7816 Just a test of an article title containing a tilde.
7817 !! endarticle
7818
7819 # note that links containing signatures, like [[Foo~~~~]], are
7820 # massaged by the pre-save transform (PST) and so the tildes are never
7821 # seen by the parser.
7822 !! test
7823 Link containing a tilde
7824 !! wikitext
7825 [[Foo~bar]]
7826 !! html/php
7827 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7828 </p>
7829 !! html/parsoid
7830 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7831 !! end
7832
7833 !! test
7834 Link containing double-single-quotes '' (bug 4598)
7835 !! wikitext
7836 [[Lista d''e paise d''o munno]]
7837 !! html/php
7838 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7839 </p>
7840 !! html/parsoid
7841 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7842 !! end
7843
7844 !! test
7845 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7846 !! wikitext
7847 Some [[Link|pretty ''italics'' and stuff]]!
7848 !! html/php
7849 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7850 </p>
7851 !! html/parsoid
7852 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7853 !! end
7854
7855 !! test
7856 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7857 !! wikitext
7858 ''Some [[Link|pretty ''italics'' and stuff]]!''
7859 !! html
7860 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7861 </p>
7862 !! end
7863
7864 !! test
7865 Link with double quotes in title part (literal) and alternate part (interpreted)
7866 !! wikitext
7867 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7868
7869 [[''Pentecoste'']]
7870
7871 [[''Pentecoste''|Pentecoste]]
7872
7873 [[''Pentecoste''|''Pentecoste'']]
7874 !! html/php
7875 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7876 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7877 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7878 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7879 </p>
7880 !! html/parsoid
7881 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7882 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7883 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7884 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7885 !! end
7886
7887 !! test
7888 Broken image links with HTML captions (bug 39700)
7889 !! wikitext
7890 [[File:Nonexistent|<script></script>]]
7891 [[File:Nonexistent|100x100px|<script></script>]]
7892 [[File:Nonexistent|&lt;]]
7893 [[File:Nonexistent|a<i>b</i>c]]
7894 !! html/php
7895 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7896 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7897 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7898 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7899 </p>
7900 !! html/parsoid
7901 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7902 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7903 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7904 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7905 !! end
7906
7907 !! test
7908 Plain link to URL
7909 !! wikitext
7910 [[http://www.example.com]]
7911 !! html/php
7912 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7913 </p>
7914 !! html/parsoid
7915 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7916 !! end
7917
7918 !! test
7919 Plain link to URL with link text
7920 !! wikitext
7921 [[http://www.example.com Link text]]
7922 !! html
7923 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7924 </p>
7925 !! end
7926
7927 !! test
7928 Plain link to protocol-relative URL
7929 !! wikitext
7930 [[//www.example.com]]
7931 !! html/php
7932 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7933 </p>
7934 !! html/parsoid
7935 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7936 !! end
7937
7938 !! test
7939 Plain link to protocol-relative URL with link text
7940 !! wikitext
7941 [[//www.example.com Link text]]
7942 !! html
7943 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7944 </p>
7945 !! end
7946
7947 !! test
7948 Plain link to page with question mark in title
7949 !! wikitext
7950 [[A?b]]
7951
7952 [[A?b|Baz]]
7953 !! html
7954 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7955 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7956 </p>
7957 !! end
7958
7959
7960 # I'm fairly sure the expected result here is wrong.
7961 # We want these to be URL links, not pseudo-pages with URLs for titles....
7962 # However the current output is also pretty screwy.
7963 #
7964 # ----
7965 # I'm changing it to match the current output--it arguably makes more
7966 # sense in the light of the test above. Old expected result was:
7967 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7968 #</p>
7969 # But I think this test is bordering on "garbage in, garbage out" anyway.
7970 # -- wtm
7971 !! test
7972 Piped link to URL
7973 !! wikitext
7974 Piped link to URL: [[http://www.example.com|an example URL]]
7975 !! html/php
7976 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7977 </p>
7978 !! html/parsoid
7979 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7980 !! end
7981
7982 !! test
7983 BUG 2: [[page|http://url/]] should link to page, not http://url/
7984 !! wikitext
7985 [[Main Page|http://url/]]
7986 !! html/php
7987 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7991 !! end
7992
7993 # Parsoid does not mark self-links, by design.
7994 !! test
7995 BUG 337: Escaped self-links should be bold
7996 !! options
7997 title=[[Bug462]]
7998 !! wikitext
7999 [[Bu&#103;462]] [[Bug462]]
8000 !! html/php
8001 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8002 </p>
8003 !! html/php+tidy
8004 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8005 !! html/parsoid
8006 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8007 !! end
8008
8009 !! test
8010 Self-link to section should not be bold
8011 !! options
8012 title=[[Main Page]]
8013 !! wikitext
8014 [[Main Page#section]]
8015 !! html
8016 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8017 </p>
8018 !! end
8019
8020 !! article
8021 00
8022 !! text
8023 This is 00.
8024 !! endarticle
8025
8026 !!test
8027 Self-link to numeric title
8028 !!options
8029 title=[[0]]
8030 !! wikitext
8031 [[0]]
8032 !! html
8033 <p><strong class="selflink">0</strong>
8034 </p>
8035 !!end
8036
8037 !!test
8038 Link to numeric-equivalent title
8039 !!options
8040 title=[[0]]
8041 !! wikitext
8042 [[00]]
8043 !! html
8044 <p><a href="/wiki/00" title="00">00</a>
8045 </p>
8046 !!end
8047
8048 !! test
8049 <nowiki> inside a link
8050 !! wikitext
8051 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8052 !! html
8053 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8054 </p>
8055 !! end
8056
8057 !! test
8058 Non-breaking spaces in title
8059 !! wikitext
8060 [[&nbsp; Main &nbsp; Page &nbsp;]]
8061 !! html
8062 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8063 </p>
8064 !!end
8065
8066 !! test
8067 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8068 !! options
8069 language=ca
8070 !! wikitext
8071 '''[[Main Page]]'''
8072 !! html
8073 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8074 </p>
8075 !! end
8076
8077 !! test
8078 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8079 !! options
8080 language=ca
8081 !! wikitext
8082 ''[[Main Page]]''
8083 !! html
8084 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8085 </p>
8086 !! end
8087
8088 !! test
8089 Internal link with en linktrail: no apostrophes (bug 27473)
8090 !! options
8091 language=en
8092 !! wikitext
8093 [[Something]]'nice
8094 !! html
8095 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8096 </p>
8097 !! end
8098
8099 !! test
8100 Internal link with ca linktrail with apostrophes (bug 27473)
8101 !! options
8102 language=ca
8103 !! wikitext
8104 [[Something]]'nice
8105 !! html
8106 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8107 </p>
8108 !! end
8109
8110 !! test
8111 Internal link with kaa linktrail with apostrophes (bug 27473)
8112 !! options
8113 language=kaa
8114 !! wikitext
8115 [[Something]]'nice
8116 !! html
8117 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8118 </p>
8119 !! end
8120
8121 !! test
8122 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8123 !! wikitext
8124 [[User:Foo/Test/63636:Bar|Test]]
8125 !! html/php
8126 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8127 </p>
8128 !! html/parsoid
8129 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8130 !! end
8131
8132 ## Mainly a sanity check for Parsoid
8133 !! test
8134 Handle title parsing for subpages
8135 !! options
8136 title=[[/123123]]
8137 !! wikitext
8138 123
8139 !! html/parsoid
8140 <p>123</p>
8141 !! end
8142
8143 ## FIXME: Add a working php section here
8144 !! test
8145 Link to a subpage from a namespace other than main
8146 !! options
8147 title=[[User:test]]
8148 !! wikitext
8149 [[/123]]
8150 !! html/parsoid
8151 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8152 !! end
8153
8154 !! test
8155 Ensure that transclusion titles are not url-decoded
8156 !! options
8157 subpage title=[[Test]]
8158 parsoid=wt2html
8159 !! wikitext
8160 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8161 !! html/php
8162 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8163 </p>
8164 !! html/parsoid
8165 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8166 !! end
8167
8168 !! test
8169 Purely hash wikilink
8170 !! options
8171 title=[[User:test/123]]
8172 !! wikitext
8173 [[#a|b]]
8174 !! html/php
8175 <p><a href="#a">b</a>
8176 </p>
8177 !! html/parsoid
8178 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8179 !! end
8180
8181 !! test
8182 1. Interaction of linktrail and template encapsulation
8183 !! options
8184 parsoid
8185 !! wikitext
8186 {{echo|[[Foo]]}}l
8187 !! html
8188 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8189 !! end
8190
8191 !! test
8192 2. Interaction of linktrail and template encapsulation
8193 !! options
8194 parsoid
8195 !! wikitext
8196 {{echo|Some [[Fool]]}}s
8197 !! html
8198 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8199 !! end
8200
8201 !! test
8202 3. Interaction of linktrail and template encapsulation
8203 !! options
8204 parsoid
8205 !! wikitext
8206 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8207 !! html
8208 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8209 !! end
8210
8211 !! article
8212 Söfnuður
8213 !! text
8214 Test.
8215 !! endarticle
8216
8217 !! test
8218 Internal link with is link prefix
8219 !! options
8220 language=is
8221 !! wikitext
8222 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8223 !! html
8224 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8225 </p>
8226 !! end
8227
8228 !! article
8229 Mótmælendatrú
8230 !! text
8231 Test.
8232 !! endarticle
8233
8234 !! test
8235 Internal link with is link trail and link prefix
8236 !! options
8237 language=is
8238 !! wikitext
8239 [[mótmælendatrú|xxx]]ar
8240 [[mótmælendatrú]]ar
8241 mótmælenda[[söfnuður]]
8242 mótmælenda[[söfnuður|söfnuðir]]
8243 mótmælenda[[söfnuður|söfnuðir]]xxx
8244 !! html
8245 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8246 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8247 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8248 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8249 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8250 </p>
8251 !! end
8252
8253 !! test
8254 Parsoid link trail escaping
8255 !! options
8256 parsoid=html2wt,html2html
8257 !! html/parsoid
8258 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8259 !! wikitext
8260 [[apple]]<nowiki/>s
8261 !! end
8262
8263 !! test
8264 Parsoid link prefix escaping
8265 !! options
8266 language=is
8267 parsoid=html2wt,html2html
8268 !! html/parsoid
8269 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8270 !! wikitext
8271 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8272 !! end
8273
8274 !! test
8275 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8276 !! wikitext
8277 [[Foo| bar]]
8278
8279 [[Foo| ''bar'']]
8280
8281 [http://wp.org foo]
8282
8283 [http://wp.org ''foo'']
8284 !! html
8285 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8286 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8287 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8288 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8289 </p>
8290 !! end
8291
8292 !! test
8293 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8294 !! options
8295 parsoid
8296 !! wikitext
8297 [[Foo|{{echo|a}} b {{echo|c}}]]
8298 !! html
8299 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8300 !! end
8301
8302 !! test
8303 Link with angle bracket after anchor
8304 !! wikitext
8305 [[Foo#<bar>]]
8306 !! html/php
8307 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8308 </p>
8309 !! html/parsoid
8310 <p><a rel="mw:WikiLink" href="./Foo#.3Cbar.3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#.3Cbar.3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8311 !! end
8312
8313 ###
8314 ### Interwiki links (see maintenance/interwiki.sql)
8315 ###
8316
8317 !! test
8318 Inline interwiki link
8319 !! options
8320 parsoid=wt2html,wt2wt,html2html
8321 !! wikitext
8322 [[MeatBall:SoftSecurity]]
8323 !! html/php
8324 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8325 </p>
8326 !! html/parsoid
8327 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8328 !! end
8329
8330 !! test
8331 Inline interwiki link with empty title (bug 2372)
8332 !! options
8333 parsoid=wt2html,wt2wt,html2html
8334 !! wikitext
8335 [[MeatBall:]]
8336 !! html/php
8337 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8338 </p>
8339 !! html/parsoid
8340 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8341 !! end
8342
8343 !! test
8344 Interwiki link encoding conversion (bug 1636)
8345 !! wikitext
8346 *[[Wikipedia:ro:Olteni&#0355;a]]
8347 *[[Wikipedia:ro:Olteni&#355;a]]
8348 !! html
8349 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8350 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8351
8352 !! html+tidy
8353 <ul>
8354 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8355 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8356 </ul>
8357 !! end
8358
8359 !! test
8360 Interwiki link with fragment (bug 2130)
8361 !! wikitext
8362 [[MeatBall:SoftSecurity#foo]]
8363 !! html
8364 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8365 </p>
8366 !! end
8367
8368 !! test
8369 Link scenarios with escaped fragments
8370 !! wikitext
8371 [[#Is this great?]]
8372 [[Foo#Is this great?]]
8373 [[meatball:Foo#Is this great?]]
8374 !! html/php
8375 <p><a href="#Is_this_great.3F">#Is this great?</a>
8376 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8377 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8378 </p>
8379 !! html/parsoid
8380 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great.3F" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great.3F"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8381 <a rel="mw:WikiLink" href="./Foo#Is_this_great.3F" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great.3F"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8382 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8383 !! end
8384
8385 # Ideally the wikipedia: prefix here should be proto-relative too
8386 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8387 # define the 'en' prefix, and originally the test used 'wikipedia',
8388 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8389 # article.
8390 !! test
8391 Different interwiki prefixes mapping to the same URL
8392 !! wikitext
8393 [[:en:Foo]]
8394
8395 [[:en:Foo|Foo]]
8396
8397 [[wikipedia:Foo]]
8398
8399 [[:wikipedia:Foo|Foo]]
8400
8401 [[wikipedia:en:Foo]]
8402
8403 [[:wikipedia:en:Foo]]
8404
8405 [[ wikiPEdia :Foo]]
8406 !! html/parsoid
8407 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8408
8409 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8410
8411 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8412
8413 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8414
8415 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8416
8417 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8418
8419 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8420 !! end
8421
8422 !! test
8423 Interwiki links that cannot be represented in wiki syntax
8424 !! wikitext
8425 [[meatball:ok]]
8426 [[meatball:ok#foo|ok with fragment]]
8427 [[meatball:ok_as_well?|ok ending with ? mark]]
8428 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8429 [http://de.wikipedia.org/wiki/#foo is just fragment]
8430
8431 !! html/php
8432 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8433 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8434 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8435 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8436 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8437 </p>
8438 !! html/parsoid
8439 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8440 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8441 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8442 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8443 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8444 !! end
8445
8446 !! test
8447 Interwiki links: trail
8448 !! wikitext
8449 [[wikipedia:Foo|Ba]]r
8450 !! html/php
8451 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8452 </p>
8453 !! html/parsoid
8454 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8455 !! end
8456
8457 !! test
8458 Local interwiki link
8459 !! options
8460 parsoid=wt2html,wt2wt,html2html
8461 !! wikitext
8462 [[local:Template:Foo]]
8463 !! html/php
8464 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8465 </p>
8466 !! html/parsoid
8467 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8468 !! end
8469
8470 # Parsoid does not mark self-links, by design.
8471 !! test
8472 Local interwiki link: self-link to current page
8473 !! options
8474 title=[[Main Page]]
8475 parsoid=wt2html,wt2wt,html2html
8476 !! wikitext
8477 [[local:Main Page]]
8478 !! html/php
8479 <p><strong class="selflink">local:Main Page</strong>
8480 </p>
8481 !! html/parsoid
8482 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8483 !! end
8484
8485 !! test
8486 Local interwiki link: prefix only (bug 64167)
8487 !! options
8488 parsoid=wt2html,wt2wt,html2html
8489 !! wikitext
8490 [[local:]]
8491 !! html/php
8492 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8493 </p>
8494 !! html/parsoid
8495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8496 !! end
8497
8498 !! test
8499 Local interwiki link: with additional interwiki prefix (bug 61357)
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[local:meatball:Hello]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8509 !! end
8510
8511 !! test
8512 Multiple local interwiki link prefixes
8513 !! wikitext
8514 [[local:local:local:local:mi:local:Foo]]
8515 !! options
8516 parsoid=wt2html,wt2wt,html2html
8517 !! html/php
8518 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8522 !! end
8523
8524 ###
8525 ### Interlanguage links
8526 ### Language links (so that searching for '### language' matches..)
8527 ###
8528
8529 !! test
8530 Interlanguage link
8531 !! wikitext
8532 Blah blah blah
8533 [[zh:Chinese]]
8534 !! html/php
8535 <p>Blah blah blah
8536 </p>
8537 !! html/parsoid
8538 <p>Blah blah blah</p>
8539 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8540 !! end
8541
8542 ## parsoid html2wt will lose the space variations
8543 !! test
8544 Interlanguage link with spacing
8545 !! options
8546 parsoid=wt2html,wt2wt,html2html
8547 !! wikitext
8548 Blah blah blah
8549 [[ zh : Chinese ]]
8550 !! html/php
8551 <p>Blah blah blah
8552 </p>
8553 !! html/parsoid
8554 <p>Blah blah blah</p>
8555 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8556 !! end
8557
8558 !! test
8559 Double interlanguage link
8560 !! wikitext
8561 Blah blah blah
8562 [[es:Spanish]]
8563 [[zh:Chinese]]
8564 !! html/php
8565 <p>Blah blah blah
8566 </p>
8567 !! html/parsoid
8568 <p>Blah blah blah</p>
8569 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8570 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8571 !! end
8572
8573 ## parsoid html2wt will lose the space variations
8574 !! test
8575 Interlanguage link variations
8576 !! options
8577 parsoid=wt2html,wt2wt,html2html
8578 !! wikitext
8579 Blah blah blah
8580 [[ es :Spanish]]
8581 [[ ZH :Chinese]]
8582 [[es:Foo_bar]]
8583 !! html/php
8584 <p>Blah blah blah
8585 </p>
8586 !! html/parsoid
8587 <p>Blah blah blah</p>
8588 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8589 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8590 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8591 !! end
8592
8593 ## parsoid html2wt will normalize the space to _
8594 !! test
8595 Space and question mark encoding in interlanguage links (T95473)
8596 !! options
8597 parsoid=wt2html,wt2wt,html2html
8598 !! wikitext
8599 Blah blah blah
8600 [[es:Foo bar?]]
8601 !! html/php
8602 <p>Blah blah blah
8603 </p>
8604 !! html/parsoid
8605 <p>Blah blah blah</p>
8606 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8607 !! end
8608
8609 !! test
8610 Interlanguage link, with prefix links
8611 !! options
8612 language=ln
8613 !! wikitext
8614 Blah blah blah
8615 [[zh:Chinese]]
8616 !! html/php
8617 <p>Blah blah blah
8618 </p>
8619 !! html/parsoid
8620 <p>Blah blah blah</p>
8621 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8622 !! end
8623
8624 !! test
8625 Double interlanguage link, with prefix links (bug 8897)
8626 !! options
8627 language=ln
8628 !! wikitext
8629 Blah blah blah
8630 [[es:Spanish]]
8631 [[zh:Chinese]]
8632 !! html/php
8633 <p>Blah blah blah
8634 </p>
8635 !! html/parsoid
8636 <p>Blah blah blah</p>
8637 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8638 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8639 !! end
8640
8641 !! test
8642 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8643 !! wikitext
8644 Blah blah blah
8645 [[mul:Article]]
8646 !! html/php
8647 <p>Blah blah blah
8648 </p>
8649 !! html/parsoid
8650 <p>Blah blah blah</p>
8651 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8652 !! end
8653
8654 ## PHP parser tests script needs an update
8655 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8656 !! test
8657 Language links render as inline links if $wgInterwikiMagic=false
8658 !! options
8659 wgInterwikiMagic=false
8660 parsoid=wt2html,wt2wt,html2html
8661 !! wikitext
8662 Blah blah blah
8663 [[zh:Chinese]]
8664 !! html/parsoid
8665 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8666 !! end
8667
8668 ## PHP parser tests script needs an update
8669 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8670 !! test
8671 Language links render as inline links in the Talk namespace
8672 !! options
8673 title=Talk:Foo
8674 parsoid=wt2html,wt2wt,html2html
8675 !! wikitext
8676 Blah blah blah
8677 [[zh:Chinese]]
8678 !! html/parsoid
8679 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8680 !! end
8681
8682 !! test
8683 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8684 !! options
8685 language=ln
8686 !! wikitext
8687 [[WW&nbsp;II]]
8688 !! html
8689 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8690 </p>
8691 !! end
8692
8693 !! test
8694 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8695 !! options
8696 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8697 !! html/parsoid
8698 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8699 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8700 !! wikitext
8701 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8702
8703 He&amp;nbsp;llo He&amp;nbsp;llo
8704 !! html/php
8705 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8706 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8707 </p>
8708 !! end
8709
8710 # html2wt will fail because of title normalization without data-parsoid
8711 !! test
8712 Parsoid: handle constructor well
8713 !! options
8714 parsoid=wt2html,wt2wt
8715 !! wikitext
8716 [[constructor]]
8717
8718 [[constructor:foo]]
8719 !! html/php
8720 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8721 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8722 </p>
8723 !! html/parsoid
8724 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8725
8726 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8727 !! end
8728
8729 !! article
8730 ko:
8731 !! text
8732 Test.
8733 !! endarticle
8734
8735 # Note that `ko` isn't a known interlanguage prefix
8736 !! test
8737 Parsoid: recognize interlanguage links without a target page
8738 !! options
8739 ill
8740 !! wikitext
8741 [[es:]]
8742
8743 [[ko:]]
8744 !! html/php
8745 es:
8746 !! html/parsoid
8747 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8748
8749 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8750 !! end
8751
8752 # Note that `ko` isn't a known interwiki prefix
8753 !! test
8754 Parsoid: recognize interwiki links without a target page
8755 !! options
8756 parsoid=wt2html,wt2wt,html2html
8757 !! wikitext
8758 [[:es:]]
8759
8760 [[:ko:]]
8761 !! html/php
8762 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8763 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8764 </p>
8765 !! html/parsoid
8766 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8767 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8768 !! end
8769
8770 !! test
8771 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8772 !! wikitext
8773 [[mi:Foo]]
8774 !! html/php
8775 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8776 </p>
8777 !! html/parsoid
8778 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8779 !! end
8780
8781 !! test
8782 Interlanguage link with preceding local interwiki link (bug 68085)
8783 !! options
8784 parsoid=wt2html,wt2wt,html2html
8785 !! wikitext
8786 Blah blah blah
8787 [[local:es:Spanish]]
8788 !! html/php
8789 <p>Blah blah blah
8790 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8791 </p>
8792 !! html/parsoid
8793 <p>Blah blah blah
8794 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8795 !! end
8796
8797 !! test
8798 Looks like an interlanguage link, but is actually a local interwiki
8799 !! options
8800 parsoid=wt2html,wt2wt,html2html
8801 !! wikitext
8802 Blah blah blah
8803 [[mi:Template:Foo]]
8804 !! html/php
8805 <p>Blah blah blah
8806 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8807 </p>
8808 !! html/parsoid
8809 <p>Blah blah blah
8810 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8811 !! end
8812
8813 ###
8814 ### Redirects, Parsoid-only
8815 ###
8816
8817 !! test
8818 1. Simple redirect to page
8819 !! wikitext
8820 #REDIRECT [[Main Page]]
8821 !! html/parsoid
8822 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8823 !! end
8824
8825 !! test
8826 2. Other redirect variants
8827 !! wikitext
8828 #REDIRECT [[Main_Page]]
8829 !! html/parsoid
8830 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8831 !! end
8832
8833 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8834 # This tests the Parsoid bail-out code.
8835 !! test
8836 3. Other redirect variants
8837 !! wikitext
8838 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8839 !! html/parsoid
8840 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8841 !! end
8842
8843 !! test
8844 4. Redirect to a templated destination
8845 !! wikitext
8846 #REDIRECT [[{{echo|Foo}}bar]]
8847 !! html/parsoid
8848 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8849 !! end
8850
8851 !! test
8852 Empty redirect
8853 !! options
8854 parsoid=wt2html,wt2wt
8855 !! wikitext
8856 #REDIRECT [[]]
8857 !! html/parsoid
8858 <ol>
8859 <li>REDIRECT [[]]</li></ol>
8860 !! end
8861
8862 !! test
8863 Optional colon in #REDIRECT
8864 !! options
8865 # the colon is archaic syntax. we support it for wt2html, but we
8866 # don't care that it roundtrips back to the modern syntax.
8867 parsoid=wt2html,html2html
8868 !! wikitext
8869 #REDIRECT:[[Main Page]]
8870 !! html/parsoid
8871 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8872 !! end
8873
8874 !! test
8875 Whitespace in #REDIRECT with optional colon
8876 !! options
8877 # the colon and gratuitous whitespace is archaic syntax. we support
8878 # it for wt2html, but we don't care that it roundtrips back to the
8879 # modern syntax (without extra whitespace)
8880 parsoid=wt2html,html2html
8881 !! wikitext
8882
8883 #REDIRECT
8884 :
8885 [[Main Page]]
8886 !! html/parsoid
8887 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8888 !! end
8889
8890 !! test
8891 Piped link in #REDIRECT
8892 !! options
8893 # content after piped link is ignored. we support this syntax,
8894 # but don't care that the piped link is lost when we roundtrip this.
8895 parsoid=wt2html
8896 !! wikitext
8897 #REDIRECT [[Main Page|bar]]
8898 !! html/parsoid
8899 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8900 !! end
8901
8902 !! test
8903 Redirect to category (T104502)
8904 !! options
8905 parsoid=wt2html,wt2wt
8906 !! wikitext
8907 #REDIRECT [[Category:Foo]]
8908 !! html/parsoid
8909 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8910 !! end
8911
8912 !! test
8913 Redirect to category with URL encoding (T104502)
8914 !! options
8915 parsoid=wt2html
8916 !! wikitext
8917 #REDIRECT [[Category%3AFoo]]
8918 !! html/parsoid
8919 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8920 !! end
8921
8922 !! test
8923 Redirect to category page
8924 !! wikitext
8925 #REDIRECT [[:Category:Foo]]
8926 !! html/parsoid
8927 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8928 !! end
8929
8930 !! test
8931 Redirect to image page (1)
8932 !! wikitext
8933 #REDIRECT [[File:Wiki.png]]
8934 !! html/parsoid
8935 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8936 !! end
8937
8938 !! test
8939 Redirect to image page (2)
8940 !! wikitext
8941 #REDIRECT [[Image:Wiki.png]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8944 !! end
8945
8946 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8947 # Next test confirms this.
8948 !! test
8949 Redirect to language (1) (T104918)
8950 !! options
8951 parsoid=wt2html,wt2wt,html2html
8952 !! wikitext
8953 #REDIRECT [[en:File:Wiki.png]]
8954 !! html/parsoid
8955 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8956 !! end
8957
8958 !! test
8959 Redirect to language (2) (T104918)
8960 !! wikitext
8961 #REDIRECT [[:en:File:Wiki.png]]
8962 !! html/parsoid
8963 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8964 !! end
8965
8966 !! test
8967 Redirect to interwiki (T104918)
8968 !! wikitext
8969 #REDIRECT [[meatball:File:Wiki.png]]
8970 !! html/parsoid
8971 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8972 !! end
8973
8974 !! test
8975 Non-English #REDIRECT
8976 !! options
8977 language=is
8978 !! wikitext
8979 #TILVÍSUN [[Main Page]]
8980 !! html/parsoid
8981 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8982 !! end
8983
8984 !! test
8985 Redirect syntax under text isn't considered a redirect
8986 !! wikitext
8987 some text
8988 #redirect [[Main Page]]
8989 !! html/parsoid
8990 <p>some text</p>
8991 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
8992 !! end
8993
8994 # FIXME: Should hoist the redirect to the top of the page and ensure there
8995 # is only one.
8996 !! test
8997 New redirect
8998 !! options
8999 parsoid=html2wt
9000 !! html/parsoid
9001 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9002 !! wikitext
9003 Foo
9004 #REDIRECT [[Foo]]
9005 !! end
9006
9007 ##
9008 ## XHTML tidiness
9009 ###
9010
9011 !! test
9012 <br> to <br />
9013 !! wikitext
9014 1<br>2<br />3
9015 !! html
9016 <p>1<br />2<br />3
9017 </p>
9018 !! end
9019
9020 !! test
9021 Broken br tag sanitization
9022 !! wikitext
9023 </br>
9024 !! html/php
9025 <p>&lt;/br&gt;
9026 </p>
9027 !! end
9028
9029 # TODO: Fix html2html mode (bug 51055)!
9030 !! test
9031 Parsoid: Broken br tag recognition
9032 !! options
9033 parsoid=wt2html
9034 !! wikitext
9035 </br>
9036
9037 <br/ >
9038 !! html+tidy
9039 <p><br /></p>
9040 <p><br /></p>
9041 !! end
9042
9043 !! test
9044 Incorrecly removing closing slashes from correctly formed XHTML
9045 !! wikitext
9046 <br style="clear:both;" />
9047 !! html
9048 <p><br style="clear:both;" />
9049 </p>
9050 !! end
9051
9052 !! test
9053 Failing to transform badly formed HTML into correct XHTML
9054 !! wikitext
9055 <br style="clear: left;">
9056 <br style="clear: right;">
9057 <br style="clear: both;">
9058 !! html
9059 <p><br style="clear: left;" />
9060 <br style="clear: right;" />
9061 <br style="clear: both;" />
9062 </p>
9063 !!end
9064
9065 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9066 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9067 !! test
9068 Handling html with a div self-closing tag
9069 !! wikitext
9070 <div title />
9071 <div title/>
9072 <div title/ >
9073 <div title=bar />
9074 <div title=bar/>
9075 <div title=bar/ >
9076 !! html/php
9077 <p>&lt;div title /&gt;
9078 &lt;div title/&gt;
9079 </p>
9080 <div>
9081 <p>&lt;div title=bar /&gt;
9082 &lt;div title=bar/&gt;
9083 </p>
9084 <div title="bar/"></div>
9085 </div>
9086
9087 !! html/parsoid
9088 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9089 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9090 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9091 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9092 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9093 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9094 !! end
9095
9096 !! test
9097 Handling html with a br self-closing tag
9098 !! wikitext
9099 <br title />
9100 <br title/>
9101 <br title/ >
9102 <br title=bar />
9103 <br title=bar/>
9104 <br title=bar/ >
9105 !! html/php
9106 <p><br title="" />
9107 <br title="" />
9108 <br />
9109 <br title="bar" />
9110 <br title="bar" />
9111 <br title="bar/" />
9112 </p>
9113 !! html/parsoid
9114 <p><br title="" />
9115 <br title="" />
9116 <br title="" />
9117 <br title="bar" />
9118 <br title="bar" />
9119 <br title="bar/" />
9120 </p>
9121 !! end
9122
9123 !! test
9124 Horizontal ruler (should it add that extra space?)
9125 !! wikitext
9126 <hr>
9127 <hr >
9128 foo <hr
9129 > bar
9130 !! html+tidy
9131 <hr />
9132 <hr />
9133 <p>foo</p>
9134 <hr />
9135 <p>bar</p>
9136 !! end
9137
9138 !! test
9139 Horizontal ruler -- 4+ dashes render hr
9140 !! wikitext
9141 ----
9142 !! html
9143 <hr />
9144
9145 !! end
9146
9147 !! test
9148 Horizontal ruler -- eats additional dashes on the same line
9149 !! wikitext
9150 ---------
9151 !! html
9152 <hr />
9153
9154 !! end
9155
9156 !! test
9157 Horizontal ruler -- does not collapse dashes on consecutive lines
9158 !! wikitext
9159 ----
9160 ----
9161 !! html
9162 <hr />
9163 <hr />
9164
9165 !! end
9166
9167 !! test
9168 Horizontal ruler -- <4 dashes render as plain text
9169 !! wikitext
9170 ---
9171 !! html
9172 <p>---
9173 </p>
9174 !! end
9175
9176 !! test
9177 Horizontal ruler -- Supports content following dashes on same line
9178 !! wikitext
9179 ---- Foo
9180 !! html
9181 <hr /> Foo
9182
9183 !! html+tidy
9184 <hr />
9185 <p>Foo</p>
9186 !! end
9187
9188 ###
9189 ### Block-level elements
9190 ###
9191 !! test
9192 Common list
9193 !! wikitext
9194 *Common list
9195 * item 2
9196 *item 3
9197 !! html
9198 <ul><li>Common list</li>
9199 <li> item 2</li>
9200 <li>item 3</li></ul>
9201
9202 !! end
9203
9204 !! test
9205 Numbered list
9206 !! wikitext
9207 #Numbered list
9208 #item 2
9209 # item 3
9210 !! html
9211 <ol><li>Numbered list</li>
9212 <li>item 2</li>
9213 <li> item 3</li></ol>
9214
9215 !! end
9216
9217 !! test
9218 Mixed list
9219 !! wikitext
9220 *Mixed list
9221 *# with numbers
9222 ** and bullets
9223 *# and numbers
9224 *bullets again
9225 **bullet level 2
9226 ***bullet level 3
9227 ***#Number on level 4
9228 **bullet level 2
9229 **#Number on level 3
9230 **#Number on level 3
9231 *#number level 2
9232 *Level 1
9233 *** Level 3
9234 #** Level 3, but ordered
9235 !! html
9236 <ul><li>Mixed list
9237 <ol><li> with numbers</li></ol>
9238 <ul><li> and bullets</li></ul>
9239 <ol><li> and numbers</li></ol></li>
9240 <li>bullets again
9241 <ul><li>bullet level 2
9242 <ul><li>bullet level 3
9243 <ol><li>Number on level 4</li></ol></li></ul></li>
9244 <li>bullet level 2
9245 <ol><li>Number on level 3</li>
9246 <li>Number on level 3</li></ol></li></ul>
9247 <ol><li>number level 2</li></ol></li>
9248 <li>Level 1
9249 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9250 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9251
9252 !! end
9253
9254 !! test
9255 1. Nested mixed wikitext and html list
9256 !! wikitext
9257 * hi
9258 * <ul><li>ho</li></ul>
9259 * hi
9260 ** ho
9261 !! html/php
9262 <ul><li> hi</li>
9263 <li> <ul><li>ho</li></ul></li>
9264 <li> hi
9265 <ul><li> ho</li></ul></li></ul>
9266
9267 !! html/parsoid
9268 <ul><li> hi</li>
9269 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9270 <li> hi
9271 <ul><li> ho</li></ul></li></ul>
9272 !! end
9273
9274 !! test
9275 2. Nested mixed wikitext and html list (incompatible)
9276 !! wikitext
9277 ; hi
9278 : {{echo|<li>ho</li>}}
9279 !! html/php
9280 <dl><dt> hi</dt>
9281 <dd> <li>ho</li></dd></dl>
9282
9283 !! html/parsoid
9284 <dl><dt> hi</dt>
9285 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9286 !! end
9287
9288 !! test
9289 Nested lists 1
9290 !! wikitext
9291 *foo
9292 **bar
9293 !! html
9294 <ul><li>foo
9295 <ul><li>bar</li></ul></li></ul>
9296
9297 !! end
9298
9299 !! test
9300 Nested lists 2
9301 !! wikitext
9302 **foo
9303 *bar
9304 !! html
9305 <ul><li><ul><li>foo</li></ul></li>
9306 <li>bar</li></ul>
9307
9308 !! end
9309
9310 !! test
9311 Nested lists 3 (first element empty)
9312 !! wikitext
9313 *
9314 **bar
9315 !! html
9316 <ul><li>
9317 <ul><li>bar</li></ul></li></ul>
9318
9319 !! end
9320
9321 !! test
9322 Nested lists 4 (first element empty)
9323 !! wikitext
9324 **
9325 *bar
9326 !! html
9327 <ul><li><ul><li></li></ul></li>
9328 <li>bar</li></ul>
9329
9330 !! end
9331
9332 !! test
9333 Nested lists 5 (both elements empty)
9334 !! wikitext
9335 **
9336 *
9337 !! html
9338 <ul><li><ul><li></li></ul></li>
9339 <li></li></ul>
9340
9341 !! end
9342
9343 !! test
9344 Nested lists 6 (both elements empty)
9345 !! wikitext
9346 *
9347 **
9348 !! html
9349 <ul><li>
9350 <ul><li></li></ul></li></ul>
9351
9352 !! end
9353
9354 !! test
9355 Nested lists 7 (skip initial nesting levels)
9356 !! wikitext
9357 *** foo
9358 !! html
9359 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9360
9361 !! end
9362
9363 !! test
9364 Nested lists 8 (multiple nesting transitions)
9365 !! wikitext
9366 * foo
9367 *** bar
9368 ** baz
9369 * boo
9370 !! html
9371 <ul><li> foo
9372 <ul><li><ul><li> bar</li></ul></li>
9373 <li> baz</li></ul></li>
9374 <li> boo</li></ul>
9375
9376 !! end
9377
9378 !! test
9379 Nested lists 9 (extension interaction)
9380 !! options
9381 parsoid
9382 !! wikitext
9383 *<references />
9384 !! html/parsoid
9385 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9386 !! end
9387
9388 !! test
9389 1. Lists with start-of-line-transparent tokens before bullets: Comments
9390 !! wikitext
9391 *foo
9392 *<!--cmt-->bar
9393 <!--cmt-->*baz
9394 !! html
9395 <ul><li>foo</li>
9396 <li>bar</li>
9397 <li>baz</li></ul>
9398
9399 !! end
9400
9401 !! test
9402 2. Lists with start-of-line-transparent tokens before bullets: Template close
9403 !! wikitext
9404 *foo {{echo|bar
9405 }}*baz
9406 !! html
9407 <ul><li>foo bar</li>
9408 <li>baz</li></ul>
9409
9410 !! end
9411
9412 !! test
9413 List items are not parsed correctly following a <pre> block (bug 785)
9414 !! wikitext
9415 * <pre>foo</pre>
9416 * <pre>bar</pre>
9417 * zar
9418 !! html/php
9419 <ul><li> <pre>foo</pre></li>
9420 <li> <pre>bar</pre></li>
9421 <li> zar</li></ul>
9422
9423 !! html/parsoid
9424 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9425 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9426 <li> zar</li></ul>
9427 !! end
9428
9429 !! test
9430 List items from template
9431 !! wikitext
9432
9433 {{inner list}}
9434 * item 2
9435
9436 * item 0
9437 {{inner list}}
9438 * item 2
9439
9440 * item 0
9441 * notSOL{{inner list}}
9442 * item 2
9443 !! html
9444 <ul><li> item 1</li>
9445 <li> item 2</li></ul>
9446 <ul><li> item 0</li>
9447 <li> item 1</li>
9448 <li> item 2</li></ul>
9449 <ul><li> item 0</li>
9450 <li> notSOL</li>
9451 <li> item 1</li>
9452 <li> item 2</li></ul>
9453
9454 !! end
9455
9456 !! test
9457 List interrupted by empty line or heading
9458 !! wikitext
9459 * foo
9460
9461 ** bar
9462 == A heading ==
9463 * Another list item
9464 !! html
9465 <ul><li> foo</li></ul>
9466 <ul><li><ul><li> bar</li></ul></li></ul>
9467 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9468 <ul><li> Another list item</li></ul>
9469
9470 !!end
9471
9472 !!test
9473 Multiple list tags generated by templates
9474 !! wikitext
9475 {{echo|<li>}}a
9476 {{echo|<li>}}b
9477 {{echo|<li>}}c
9478 !! html
9479 <li>a
9480 <li>b
9481 <li>c</li>
9482 </li>
9483 </li>
9484
9485 !! html+tidy
9486 <ul>
9487 <li>a</li>
9488 <li>b</li>
9489 <li>c</li>
9490 </ul>
9491 !!end
9492
9493 !!test
9494 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9495 !! wikitext
9496 *a
9497 <!--This line will NOT split the list-->
9498 *b
9499 <!--This line will NOT split the list either-->
9500 *c
9501 <!--foo--> <!----> <!--This line NOT split the list either-->
9502 *d
9503 !! html
9504 <ul><li>a</li>
9505 <li>b</li>
9506 <li>c</li>
9507 <li>d</li></ul>
9508
9509 !!end
9510
9511 !!test
9512 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9513 !! wikitext
9514 *a
9515 <!--This line will NOT split the list-->
9516 *b
9517 <!--This line will NOT split the list either-->
9518 *c
9519 <!--foo--> <!----> <!--This line NOT split the list
9520 either-->
9521 *d
9522 !! html
9523 <ul><li>a</li>
9524 <li>b</li>
9525 <li>c</li>
9526 <li>d</li></ul>
9527
9528 !!end
9529
9530 !!test
9531 Test the li-hack
9532 (The PHP parser relies on Tidy for the hack)
9533 !!options
9534 parsoid=wt2html,wt2wt
9535 !! wikitext
9536 * foo
9537 * <li>li-hack
9538 * {{echo|<li>templated li-hack}}
9539 * <!--foo--> <li> unsupported li-hack with preceding comments
9540
9541 <ul>
9542 <li><li>not a li-hack
9543 </li>
9544 </ul>
9545 !! html+tidy
9546 <ul>
9547 <li>foo</li>
9548 <li>li-hack</li>
9549 <li>templated li-hack</li>
9550 <li>unsupported li-hack with preceding comments</li>
9551 </ul>
9552 <ul>
9553 <li>not a li-hack</li>
9554 </ul>
9555 !!end
9556
9557 !! test
9558 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9559 !! options
9560 parsoid
9561 !! wikitext
9562 # foo
9563 ## bar
9564 * foo
9565 ** bar
9566 : foo
9567 :: bar
9568 !! html
9569 <ol>
9570 <li> foo<ol>
9571 <li> bar</li>
9572 </ol></li>
9573 </ol><ul>
9574 <li> foo<ul>
9575 <li> bar</li>
9576 </ul></li>
9577 </ul><dl>
9578 <dd> foo<dl>
9579 <dd> bar</dd>
9580 </dl></dd>
9581 </dl>
9582 !! end
9583
9584 !! test
9585 Parsoid: Test of whitespace serialization with Templated bullets
9586 !! options
9587 parsoid
9588 !! wikitext
9589 * {{bullet}}
9590 !! html
9591 <ul>
9592 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9593 </ul>
9594 !! end
9595
9596 # ------------------------------------------------------------------------
9597 # The next set of tests are about Parsoid's ability to handle badly nested
9598 # tags (parse, minimize scope of fixup, and roundtrip back)
9599 # ------------------------------------------------------------------------
9600
9601 !! test
9602 Unbalanced closing block tags break a list
9603 (php parser relies on Tidy to fix up)
9604 !! wikitext
9605 <div>
9606 *a</div><div>
9607 *b</div>
9608 !! html+tidy
9609 <div>
9610 <ul>
9611 <li>a</li>
9612 </ul>
9613 </div>
9614 <div>
9615 <ul>
9616 <li>b</li>
9617 </ul>
9618 </div>
9619 !! end
9620
9621 # Parsoid fails this test, but it might be tricky to support properly.
9622 # See bug 68395.
9623 !! test
9624 Unbalanced closing non-block tags don't break a list
9625 (php parser relies on Tidy to fix up)
9626 !! wikitext
9627 <span>
9628 *a</span><span>
9629 *b</span>
9630 !! html/php+tidy
9631 <ul>
9632 <li><span>a</span></li>
9633 <li><span>b</span></li>
9634 </ul>
9635 !! html/parsoid
9636 <span>
9637 <ul>
9638 <li>a<span></span>
9639 </li>
9640 <li>b
9641 </li>
9642 </ul>
9643 </span>
9644 !! end
9645
9646 !! test
9647 Unclosed formatting tags that straddle lists are closed and reopened
9648 (php parser relies on Tidy to fix up)
9649 !! options
9650 parsoid=wt2html,wt2wt,html2html
9651 !! wikitext
9652 # <s> a
9653 # b </s>
9654 !! html/php+tidy
9655 <ol>
9656 <li><s>a</s></li>
9657 <li><s>b</s></li>
9658 </ol>
9659 !! html/parsoid
9660 <ol><li> <s> a</s></li>
9661 <li><s> b </s></li></ol>
9662 !! end
9663
9664 # See bug 68395.
9665 !!test
9666 1. List embedded in a formatting tag
9667 !! wikitext
9668 <small>
9669 * foo
9670 </small>
9671 !! html/php+tidy
9672 <ul>
9673 <li><small>foo</small></li>
9674 </ul>
9675 !! html/parsoid
9676 <small>
9677 <ul>
9678 <li> foo</li>
9679 </ul>
9680 </small>
9681 !!end
9682
9683 ## Ugly Parsoid output here
9684 ## Not sure what the right output is.
9685 !!test
9686 2. List embedded in a formatting tag
9687 !! wikitext
9688 <small>
9689 *a
9690 *b</small>
9691 !! html/php+tidy
9692 <ul>
9693 <li><small>a</small></li>
9694 <li><small>b</small></li>
9695 </ul>
9696 !! html/parsoid
9697 <small></small>
9698 <ul><small>
9699 <li>a</li>
9700 </small>
9701 <li><small>b</small></li>
9702 </ul>
9703 !!end
9704
9705 # Ugly Parsoid and PHP parser output here
9706 # Not sure if we want to make this a test!
9707 #
9708 ## !!test
9709 ## 3. Unclosed formatting tags in list elements
9710 ## !! wikitext
9711 ## *<small>a
9712 ## *<small>b
9713 ## !! html/php+tidy
9714 ## <ul>
9715 ## <li><small>a</small></li>
9716 ## <li><small><small>b</small></small></li>
9717 ## </ul>
9718 ## !! html/parsoid
9719 ## <ul>
9720 ## <li><small>a</small></li>
9721 ## <small>
9722 ## <li><small>b</small></li>
9723 ## </small></ul>
9724 ## !!end
9725
9726 # This is a bug in the PHP parser + tidy combination.
9727 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9728 # and then fostered out of the table by tidy.)
9729 # We believe the Parsoid output to be correct.
9730 !! test
9731 Table with missing opening <tr> tag
9732 !! options
9733 parsoid=wt2html,wt2wt
9734 !! wikitext
9735 <table>
9736 <td>foo</td>
9737 </tr>
9738 </table>
9739 !! html+tidy
9740 <table>
9741 <tr>
9742 <td>foo</td>
9743 </tr>
9744 </table>
9745 !! end
9746
9747 ###
9748 ### Magic Words
9749 ###
9750
9751 # Note that the current date is hard-coded as
9752 # 1970-01-01T00:02:03Z (a Thursday)
9753 # when running parser tests. The timezone is also fixed to GMT, so
9754 # local date will be identical to current date.
9755
9756 !! test
9757 Magic Word: {{CURRENTDAY}}
9758 !! wikitext
9759 {{CURRENTDAY}}
9760 !! html
9761 <p>1
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{CURRENTDAY2}}
9767 !! wikitext
9768 {{CURRENTDAY2}}
9769 !! html
9770 <p>01
9771 </p>
9772 !! end
9773
9774 !! test
9775 Magic Word: {{CURRENTDAYNAME}}
9776 !! wikitext
9777 {{CURRENTDAYNAME}}
9778 !! html
9779 <p>Thursday
9780 </p>
9781 !! end
9782
9783 !! test
9784 Magic Word: {{CURRENTDOW}}
9785 !! wikitext
9786 {{CURRENTDOW}}
9787 !! html
9788 <p>4
9789 </p>
9790 !! end
9791
9792 !! test
9793 Magic Word: {{CURRENTMONTH}}
9794 !! wikitext
9795 {{CURRENTMONTH}}
9796 !! html
9797 <p>01
9798 </p>
9799 !! end
9800
9801 !! test
9802 Magic Word: {{CURRENTMONTH1}}
9803 !! wikitext
9804 {{CURRENTMONTH1}}
9805 !! html
9806 <p>1
9807 </p>
9808 !! end
9809
9810 !! test
9811 Magic Word: {{CURRENTMONTHABBREV}}
9812 !! wikitext
9813 {{CURRENTMONTHABBREV}}
9814 !! html
9815 <p>Jan
9816 </p>
9817 !! end
9818
9819 !! test
9820 Magic Word: {{CURRENTMONTHNAME}}
9821 !! wikitext
9822 {{CURRENTMONTHNAME}}
9823 !! html
9824 <p>January
9825 </p>
9826 !! end
9827
9828 !! test
9829 Magic Word: {{CURRENTMONTHNAMEGEN}}
9830 !! wikitext
9831 {{CURRENTMONTHNAMEGEN}}
9832 !! html
9833 <p>January
9834 </p>
9835 !! end
9836
9837 !! test
9838 Magic Word: {{CURRENTTIME}}
9839 !! wikitext
9840 {{CURRENTTIME}}
9841 !! html
9842 <p>00:02
9843 </p>
9844 !! end
9845
9846 !! test
9847 Magic Word: {{CURRENTHOUR}}
9848 !! wikitext
9849 {{CURRENTHOUR}}
9850 !! html
9851 <p>00
9852 </p>
9853 !! end
9854
9855 !! test
9856 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9857 !! wikitext
9858 {{CURRENTWEEK}}
9859 !! html
9860 <p>1
9861 </p>
9862 !! end
9863
9864 !! test
9865 Magic Word: {{CURRENTYEAR}}
9866 !! wikitext
9867 {{CURRENTYEAR}}
9868 !! html
9869 <p>1970
9870 </p>
9871 !! end
9872
9873 !! test
9874 Magic Word: {{CURRENTTIMESTAMP}}
9875 !! wikitext
9876 {{CURRENTTIMESTAMP}}
9877 !! html
9878 <p>19700101000203
9879 </p>
9880 !! end
9881
9882 !! test
9883 Magic Words LOCAL (UTC)
9884 !! wikitext
9885 * {{LOCALMONTH}}
9886 * {{LOCALMONTH1}}
9887 * {{LOCALMONTHNAME}}
9888 * {{LOCALMONTHNAMEGEN}}
9889 * {{LOCALMONTHABBREV}}
9890 * {{LOCALDAY}}
9891 * {{LOCALDAY2}}
9892 * {{LOCALDAYNAME}}
9893 * {{LOCALYEAR}}
9894 * {{LOCALTIME}}
9895 * {{LOCALHOUR}}
9896 * {{LOCALWEEK}}
9897 * {{LOCALDOW}}
9898 * {{LOCALTIMESTAMP}}
9899 !! html
9900 <ul><li> 01</li>
9901 <li> 1</li>
9902 <li> January</li>
9903 <li> January</li>
9904 <li> Jan</li>
9905 <li> 1</li>
9906 <li> 01</li>
9907 <li> Thursday</li>
9908 <li> 1970</li>
9909 <li> 00:02</li>
9910 <li> 00</li>
9911 <li> 1</li>
9912 <li> 4</li>
9913 <li> 19700101000203</li></ul>
9914
9915 !! end
9916
9917 !! test
9918 Magic Word: {{FULLPAGENAME}}
9919 !! options
9920 title=[[User:Ævar Arnfjörð Bjarmason]]
9921 !! wikitext
9922 {{FULLPAGENAME}}
9923 !! html
9924 <p>User:Ævar Arnfjörð Bjarmason
9925 </p>
9926 !! end
9927
9928 !! test
9929 Magic Word: {{FULLPAGENAMEE}}
9930 !! options
9931 title=[[User:Ævar Arnfjörð Bjarmason]]
9932 !! wikitext
9933 {{FULLPAGENAMEE}}
9934 !! html
9935 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9936 </p>
9937 !! end
9938
9939 !! test
9940 Magic Word: {{TALKSPACE}}
9941 !! options
9942 title=[[User:Ævar Arnfjörð Bjarmason]]
9943 !! wikitext
9944 {{TALKSPACE}}
9945 !! html
9946 <p>User talk
9947 </p>
9948 !! end
9949
9950 !! test
9951 Magic Word: {{TALKSPACE}}, same namespace
9952 !! options
9953 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9954 !! wikitext
9955 {{TALKSPACE}}
9956 !! html
9957 <p>User talk
9958 </p>
9959 !! end
9960
9961 !! test
9962 Magic Word: {{TALKSPACE}}, main namespace
9963 !! options
9964 title=[[Parser Test]]
9965 !! wikitext
9966 {{TALKSPACE}}
9967 !! html
9968 <p>Talk
9969 </p>
9970 !! end
9971
9972 !! test
9973 Magic Word: {{TALKSPACEE}}
9974 !! options
9975 title=[[User:Ævar Arnfjörð Bjarmason]]
9976 !! wikitext
9977 {{TALKSPACEE}}
9978 !! html
9979 <p>User_talk
9980 </p>
9981 !! end
9982
9983 !! test
9984 Magic Word: {{SUBJECTSPACE}}
9985 !! options
9986 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9987 !! wikitext
9988 {{SUBJECTSPACE}}
9989 !! html
9990 <p>User
9991 </p>
9992 !! end
9993
9994 !! test
9995 Magic Word: {{SUBJECTSPACE}}, same namespace
9996 !! options
9997 title=[[User:Ævar Arnfjörð Bjarmason]]
9998 !! wikitext
9999 {{SUBJECTSPACE}}
10000 !! html
10001 <p>User
10002 </p>
10003 !! end
10004
10005 !! test
10006 Magic Word: {{SUBJECTSPACE}}, main namespace
10007 !! options
10008 title=[[Parser Test]]
10009 !! wikitext
10010 {{SUBJECTSPACE}}
10011 !! html
10012
10013 !! end
10014
10015 !! test
10016 Magic Word: {{SUBJECTSPACEE}}
10017 !! options
10018 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10019 !! wikitext
10020 {{SUBJECTSPACEE}}
10021 !! html
10022 <p>User
10023 </p>
10024 !! end
10025
10026 !! test
10027 Magic Word: {{NAMESPACE}}
10028 !! options
10029 title=[[User:Ævar Arnfjörð Bjarmason]]
10030 !! wikitext
10031 {{NAMESPACE}}
10032 !! html
10033 <p>User
10034 </p>
10035 !! end
10036
10037 !! test
10038 Magic Word: {{NAMESPACEE}}
10039 !! options
10040 title=[[User:Ævar Arnfjörð Bjarmason]]
10041 !! wikitext
10042 {{NAMESPACEE}}
10043 !! html
10044 <p>User
10045 </p>
10046 !! end
10047
10048 !! test
10049 Magic Word: {{NAMESPACENUMBER}}
10050 !! options
10051 title=[[User:Ævar Arnfjörð Bjarmason]]
10052 !! wikitext
10053 {{NAMESPACENUMBER}}
10054 !! html
10055 <p>2
10056 </p>
10057 !! end
10058
10059 !! test
10060 Magic Word: {{SUBPAGENAME}}
10061 !! options
10062 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10063 !! wikitext
10064 {{SUBPAGENAME}}
10065 !! html
10066 <p>sub ö
10067 </p>
10068 !! end
10069
10070 !! test
10071 Magic Word: {{SUBPAGENAMEE}}
10072 !! options
10073 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10074 !! wikitext
10075 {{SUBPAGENAMEE}}
10076 !! html
10077 <p>sub_%C3%B6
10078 </p>
10079 !! end
10080
10081 !! test
10082 Magic Word: {{ROOTPAGENAME}}
10083 !! options
10084 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10085 !! wikitext
10086 {{ROOTPAGENAME}}
10087 !! html
10088 <p>Ævar Arnfjörð Bjarmason
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{ROOTPAGENAMEE}}
10094 !! options
10095 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10096 !! wikitext
10097 {{ROOTPAGENAMEE}}
10098 !! html
10099 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10100 </p>
10101 !! end
10102
10103 !! test
10104 Magic Word: {{BASEPAGENAME}}
10105 !! options
10106 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10107 !! wikitext
10108 {{BASEPAGENAME}}
10109 !! html
10110 <p>Ævar Arnfjörð Bjarmason
10111 </p>
10112 !! end
10113
10114 !! test
10115 Magic Word: {{BASEPAGENAMEE}}
10116 !! options
10117 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10118 !! wikitext
10119 {{BASEPAGENAMEE}}
10120 !! html
10121 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{TALKPAGENAME}}
10127 !! options
10128 title=[[User:Ævar Arnfjörð Bjarmason]]
10129 !! wikitext
10130 {{TALKPAGENAME}}
10131 !! html
10132 <p>User talk:Ævar Arnfjörð Bjarmason
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{TALKPAGENAMEE}}
10138 !! options
10139 title=[[User:Ævar Arnfjörð Bjarmason]]
10140 !! wikitext
10141 {{TALKPAGENAMEE}}
10142 !! html
10143 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10144 </p>
10145 !! end
10146
10147 !! test
10148 Magic Word: {{SUBJECTPAGENAME}}
10149 !! options
10150 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10151 !! wikitext
10152 {{SUBJECTPAGENAME}}
10153 !! html
10154 <p>User:Ævar Arnfjörð Bjarmason
10155 </p>
10156 !! end
10157
10158 !! test
10159 Magic Word: {{SUBJECTPAGENAMEE}}
10160 !! options
10161 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10162 !! wikitext
10163 {{SUBJECTPAGENAMEE}}
10164 !! html
10165 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10166 </p>
10167 !! end
10168
10169 !! test
10170 Magic Word: {{NUMBEROFFILES}}
10171 !! wikitext
10172 {{NUMBEROFFILES}}
10173 !! html
10174 <p>7
10175 </p>
10176 !! end
10177
10178 !! test
10179 Magic Word: {{PAGENAME}}
10180 !! options
10181 title=[[User:Ævar Arnfjörð Bjarmason]]
10182 !! wikitext
10183 {{PAGENAME}}
10184 !! html
10185 <p>Ævar Arnfjörð Bjarmason
10186 </p>
10187 !! end
10188
10189 !! test
10190 Magic Word: {{PAGENAME}} with metacharacters
10191 !! options
10192 title=[['foo & bar = baz']]
10193 !! wikitext
10194 ''{{PAGENAME}}''
10195 !! html/php
10196 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10197 </p>
10198 !! html+tidy
10199 <p><i>'foo &amp; bar = baz'</i></p>
10200 !! end
10201
10202 !! test
10203 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10204 !! options
10205 title=[[*RFC 1234 http://example.com/]]
10206 !! wikitext
10207 {{PAGENAME}}
10208 !! html/php
10209 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10210 </p>
10211 !! html+tidy
10212 <p>*RFC 1234 http://example.com/</p>
10213 !! end
10214
10215 !! test
10216 Magic Word: {{PAGENAMEE}}
10217 !! options
10218 title=[[User:Ævar Arnfjörð Bjarmason]]
10219 !! wikitext
10220 {{PAGENAMEE}}
10221 !! html
10222 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10223 </p>
10224 !! end
10225
10226 !! test
10227 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10228 !! options
10229 title=[[*RFC 1234 http://example.com/]]
10230 !! wikitext
10231 {{PAGENAMEE}}
10232 !! html/php
10233 <p>&#42;RFC_1234_http&#58;//example.com/
10234 </p>
10235 !! html+tidy
10236 <p>*RFC_1234_http://example.com/</p>
10237 !! end
10238
10239 !! test
10240 Magic Word: {{REVISIONID}}
10241 !! wikitext
10242 {{REVISIONID}}
10243 !! html
10244 <p>1337
10245 </p>
10246 !! end
10247
10248 !! test
10249 Magic Word: {{SCRIPTPATH}}
10250 !! wikitext
10251 {{SCRIPTPATH}}
10252 !! html
10253
10254 !! end
10255
10256 !! test
10257 Magic Word: {{STYLEPATH}}
10258 !! wikitext
10259 {{STYLEPATH}}
10260 !! html
10261 <p>/skins
10262 </p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{SERVER}}
10267 !! wikitext
10268 {{SERVER}}
10269 !! html
10270 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10271 </p>
10272 !! end
10273
10274 !! test
10275 Magic Word: {{SERVERNAME}}
10276 !! wikitext
10277 {{SERVERNAME}}
10278 !! html
10279 <p>example.org
10280 </p>
10281 !! end
10282
10283 !! test
10284 Magic Word: {{SITENAME}}
10285 !! wikitext
10286 {{SITENAME}}
10287 !! html
10288 <p>MediaWiki
10289 </p>
10290 !! end
10291
10292 !! test
10293 Case-sensitive magic words, when cased differently, should just be template transclusions
10294 !! wikitext
10295 {{CurrentMonth}}
10296 {{currentday}}
10297 {{cURreNTweEK}}
10298 {{currentHour}}
10299 !! html
10300 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10301 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10302 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10303 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10304 </p>
10305 !! end
10306
10307 !! test
10308 Case-insensitive magic words should still work with weird casing.
10309 !! wikitext
10310 {{sErVeRNaMe}}
10311 {{LCFirst:AOEU}}
10312 {{ucFIRST:aoeu}}
10313 {{SERver}}
10314 !! html
10315 <p>example.org
10316 aOEU
10317 Aoeu
10318 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10319 </p>
10320 !! end
10321
10322 # From plwiki:PLOS_ONE
10323 !! test
10324 Parsoid: Page property magic word with magic word contents
10325 !! wikitext
10326 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10327 !! html/parsoid
10328 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10329 !! end
10330
10331 !! test
10332 Parsoid: Template-generated DISPLAYTITLE
10333 !! wikitext
10334 {{{{echo|DISPLAYTITLE}}:Foo}}
10335 !! html/parsoid
10336 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10337 !! end
10338
10339 !! test
10340 Namespace 1 {{ns:1}}
10341 !! wikitext
10342 {{ns:1}}
10343 !! html
10344 <p>Talk
10345 </p>
10346 !! end
10347
10348 !! test
10349 Namespace 1 {{ns:01}}
10350 !! wikitext
10351 {{ns:01}}
10352 !! html
10353 <p>Talk
10354 </p>
10355 !! end
10356
10357 !! test
10358 Namespace 0 {{ns:0}} (bug 4783)
10359 !! wikitext
10360 {{ns:0}}
10361 !! html
10362
10363 !! end
10364
10365 !! test
10366 Namespace 0 {{ns:00}} (bug 4783)
10367 !! wikitext
10368 {{ns:00}}
10369 !! html
10370
10371 !! end
10372
10373 !! test
10374 Namespace -1 {{ns:-1}}
10375 !! wikitext
10376 {{ns:-1}}
10377 !! html
10378 <p>Special
10379 </p>
10380 !! end
10381
10382 !! test
10383 Namespace User {{ns:User}}
10384 !! wikitext
10385 {{ns:User}}
10386 !! html
10387 <p>User
10388 </p>
10389 !! end
10390
10391 !! test
10392 Namespace User talk {{ns:User_talk}}
10393 !! wikitext
10394 {{ns:User_talk}}
10395 !! html
10396 <p>User talk
10397 </p>
10398 !! end
10399
10400 !! test
10401 Namespace User talk {{ns:uSeR tAlK}}
10402 !! wikitext
10403 {{ns:uSeR tAlK}}
10404 !! html
10405 <p>User talk
10406 </p>
10407 !! end
10408
10409 !! test
10410 Namespace File {{ns:File}}
10411 !! wikitext
10412 {{ns:File}}
10413 !! html
10414 <p>File
10415 </p>
10416 !! end
10417
10418 !! test
10419 Namespace File {{ns:Image}}
10420 !! wikitext
10421 {{ns:Image}}
10422 !! html
10423 <p>File
10424 </p>
10425 !! end
10426
10427 !! test
10428 Namespace (lang=de) Benutzer {{ns:User}}
10429 !! options
10430 language=de
10431 !! wikitext
10432 {{ns:User}}
10433 !! html
10434 <p>Benutzer
10435 </p>
10436 !! end
10437
10438 !! test
10439 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10440 !! options
10441 language=de
10442 !! wikitext
10443 {{ns:3}}
10444 !! html
10445 <p>Benutzer Diskussion
10446 </p>
10447 !! end
10448
10449 !! test
10450 Urlencode
10451 !! wikitext
10452 {{urlencode:hi world?!}}
10453 {{urlencode:hi world?!|WIKI}}
10454 {{urlencode:hi world?!|PATH}}
10455 {{urlencode:hi world?!|QUERY}}
10456 !! html/php
10457 <p>hi+world%3F%21
10458 hi_world%3F!
10459 hi%20world%3F%21
10460 hi+world%3F%21
10461 </p>
10462 !! end
10463
10464 !! test
10465 Magic Word: prioritize type info over data-parsoid
10466 !! options
10467 parsoid=html2wt
10468 !! html/parsoid
10469 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10470 !! wikitext
10471 __FORCETOC__
10472 !! end
10473
10474 !! test
10475 Magic Word: serialize on separate line (parsoid)
10476 !! options
10477 parsoid=wt2wt,html2wt
10478 !! wikitext
10479 foo
10480 __NOTOC__
10481 bar
10482 !! html/parsoid
10483 foo<meta property="mw:PageProp/notoc"/>bar
10484 !! end
10485
10486 !! test
10487 Magic Word: rt non-english wikis
10488 !! options
10489 parsoid=wt2wt
10490 language=de
10491 !! wikitext
10492 __NOEDITSECTION__
10493 !! html/parsoid
10494 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10495 !! end
10496
10497 !!test
10498 __proto__ is treated as normal wikitext (T105997)
10499 !!wikitext
10500 __proto__
10501 !!html
10502 <p>__proto__
10503 </p>
10504 !!end
10505
10506 ###
10507 ### Magic links
10508 ###
10509 !! test
10510 Magic links: internal link to RFC (bug 479)
10511 !! wikitext
10512 [[RFC 123]]
10513 !! html/php
10514 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
10515 </p>
10516 !! html/parsoid
10517 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10518 !! end
10519
10520 !! test
10521 Magic links: RFC (bug 479)
10522 !! wikitext
10523 RFC 822
10524 !! html/php
10525 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10526 </p>
10527 !! html/parsoid
10528 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10529 !! end
10530
10531 !! test
10532 Magic links: RFC (bug 65278)
10533 !! wikitext
10534 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10535 !! html/php
10536 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10537 </p>
10538 !! html/parsoid
10539 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10540 !! end
10541
10542 !! test
10543 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10544 !! wikitext
10545 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10546 RFC
10547 822
10548 !! html/php
10549 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10550 RFC
10551 822
10552 </p>
10553 !! html/parsoid
10554 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10555 RFC
10556 822</p>
10557 !! end
10558
10559 !! test
10560 Magic links: ISBN (bug 1937)
10561 !! wikitext
10562 ISBN 0-306-40615-2
10563 !! html/php
10564 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10565 </p>
10566 !! html/parsoid
10567 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10568 !! end
10569
10570 !! test
10571 Magic links: ISBN (bug 65278)
10572 !! wikitext
10573 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10574 !! html/php
10575 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10576 </p>
10577 !! html/parsoid
10578 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10579 !! end
10580
10581 !! test
10582 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10583 !! wikitext
10584 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10585 ISBN
10586 9780316098113
10587 ISBN 978
10588 0316098113
10589 !! html/php
10590 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10591 ISBN
10592 9780316098113
10593 ISBN 978
10594 0316098113
10595 </p>
10596 !! html/parsoid
10597 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10598 ISBN
10599 9780316098113
10600 ISBN 978
10601 0316098113</p>
10602 !! end
10603
10604 !! test
10605 Magic links: PMID incorrectly converts space to underscore
10606 !! wikitext
10607 PMID 1234
10608 !! html/php
10609 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10610 </p>
10611 !! html/parsoid
10612 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10613 !! end
10614
10615 !! test
10616 Magic links: PMID (bug 65278)
10617 !! wikitext
10618 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10619 !! html/php
10620 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
10621 </p>
10622 !! html/parsoid
10623 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10624 !! end
10625
10626 !! test
10627 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10628 !! wikitext
10629 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10630 PMID
10631 1234
10632 !! html/php
10633 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10634 PMID
10635 1234
10636 </p>
10637 !! html/parsoid
10638 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10639 PMID
10640 1234</p>
10641 !! end
10642
10643 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10644 # since these are ExtLinkText, not MagicLinkText
10645 !! test
10646 Magic links: use appropriate serialization for "almost" magic links.
10647 !! wikitext
10648 X[[Special:BookSources/0978739256|foo]]
10649
10650 X[//tools.ietf.org/html/rfc1234 foo]
10651 !! html/php
10652 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10653 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10654 </p>
10655 !! html/parsoid
10656 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10657 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10658 !! end
10659
10660 !! test
10661 Magic links: All disabled (T47942)
10662 !! options
10663 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10664 !! wikitext
10665 ISBN 0-306-40615-2
10666 PMID 1234
10667 RFC 4321
10668 !! html/php
10669 <p>ISBN 0-306-40615-2
10670 PMID 1234
10671 RFC 4321
10672 </p>
10673 !! end
10674
10675 ###
10676 ### Templates
10677 ####
10678
10679 !! test
10680 Nonexistent template
10681 !! wikitext
10682 {{thistemplatedoesnotexist}}
10683 !! html
10684 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
10685 </p>
10686 !! end
10687
10688 !! test
10689 Template with invalid target containing tags
10690 !! wikitext
10691 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10692 !! html
10693 <p>{{a<b>b</b>|foo|a=b|a = b}}
10694 </p>
10695 !! end
10696
10697 !! test
10698 Template with invalid target containing unclosed tag
10699 !! wikitext
10700 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10701 !! html
10702 <p>{{a<b>|foo|a=b|a = b}}</b>
10703 </p>
10704 !! end
10705
10706 !! test
10707 Template with invalid target containing wikilink
10708 !! wikitext
10709 {{[[Main Page]]}}
10710 !! html/php
10711 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10712 </p>
10713 !! html/parsoid
10714 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
10715 !! end
10716
10717 !! test
10718 Template with just whitespace in it, bug #68421
10719 !! wikitext
10720 {{echo|{{ }}}}
10721 !! html/parsoid
10722 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10723 !! end
10724
10725 !! article
10726 Template:test
10727 !! text
10728 This is a test template
10729 !! endarticle
10730
10731 !! test
10732 Simple template
10733 !! wikitext
10734 {{test}}
10735 !! html
10736 <p>This is a test template
10737 </p>
10738 !! end
10739
10740 !! test
10741 Template with explicit namespace
10742 !! wikitext
10743 {{Template:test}}
10744 !! html
10745 <p>This is a test template
10746 </p>
10747 !! end
10748
10749
10750 !! article
10751 Template:paramtest
10752 !! text
10753 This is a test template with parameter {{{param}}}
10754 !! endarticle
10755
10756 !! test
10757 Template parameter
10758 !! wikitext
10759 {{paramtest|param=foo}}
10760 !! html
10761 <p>This is a test template with parameter foo
10762 </p>
10763 !! end
10764
10765 !! article
10766 Template:paramtestnum
10767 !! text
10768 [[{{{1}}}|{{{2}}}]]
10769 !! endarticle
10770
10771 !! test
10772 Template unnamed parameter
10773 !! wikitext
10774 {{paramtestnum|Main Page|the main page}}
10775 !! html
10776 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10777 </p>
10778 !! end
10779
10780 !! article
10781 Template:templatesimple
10782 !! text
10783 (test)
10784 !! endarticle
10785
10786 !! article
10787 Template:templateredirect
10788 !! text
10789 #redirect [[Template:templatesimple]]
10790 !! endarticle
10791
10792 !! article
10793 Template:templateasargtestnum
10794 !! text
10795 {{{{{1}}}}}
10796 !! endarticle
10797
10798 !! article
10799 Template:templateasargtest
10800 !! text
10801 {{template{{{templ}}}}}
10802 !! endarticle
10803
10804 !! article
10805 Template:templateasargtest2
10806 !! text
10807 {{{{{templ}}}}}
10808 !! endarticle
10809
10810 !! test
10811 Template with template name as unnamed argument
10812 !! wikitext
10813 {{templateasargtestnum|templatesimple}}
10814 !! html
10815 <p>(test)
10816 </p>
10817 !! end
10818
10819 !! test
10820 Template with template name as argument
10821 !! wikitext
10822 {{templateasargtest|templ=simple}}
10823 !! html
10824 <p>(test)
10825 </p>
10826 !! end
10827
10828 !! test
10829 Template with template name as argument (2)
10830 !! wikitext
10831 {{templateasargtest2|templ=templatesimple}}
10832 !! html
10833 <p>(test)
10834 </p>
10835 !! end
10836
10837 !! article
10838 Template:templateasargtestdefault
10839 !! text
10840 {{{{{templ|templatesimple}}}}}
10841 !! endarticle
10842
10843 !! article
10844 Template:templa
10845 !! text
10846 '''templ'''
10847 !! endarticle
10848
10849 !! test
10850 Template with default value
10851 !! wikitext
10852 {{templateasargtestdefault}}
10853 !! html
10854 <p>(test)
10855 </p>
10856 !! end
10857
10858 !! test
10859 Template with default value (value set)
10860 !! wikitext
10861 {{templateasargtestdefault|templ=templa}}
10862 !! html
10863 <p><b>templ</b>
10864 </p>
10865 !! end
10866
10867 !! test
10868 Template redirect
10869 !! wikitext
10870 {{templateredirect}}
10871 !! html/php
10872 <p>(test)
10873 </p>
10874 !! html/parsoid
10875 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10876 !! end
10877
10878 !! test
10879 Template with argument in separate line
10880 !! wikitext
10881 {{ templateasargtest |
10882 templ = simple }}
10883 !! html
10884 <p>(test)
10885 </p>
10886 !! end
10887
10888 !! test
10889 Template with complex template as argument
10890 !! wikitext
10891 {{paramtest|
10892 param ={{ templateasargtest |
10893 templ = simple }}}}
10894 !! html
10895 <p>This is a test template with parameter (test)
10896 </p>
10897 !! end
10898
10899 !! test
10900 Template with thumb image (with link in description)
10901 !! wikitext
10902 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10903 !! html/php
10904 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
10905
10906 !! html+tidy
10907 <p>This is a test template with parameter</p>
10908 <div class="thumb tright">
10909 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
10910 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
10911 </div>
10912 </div>
10913 !! html/parsoid
10914 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10915 !! end
10916
10917 !! article
10918 Template:complextemplate
10919 !! text
10920 {{{1}}} {{paramtest|
10921 param ={{{param}}}}}
10922 !! endarticle
10923
10924 !! test
10925 Template with complex arguments
10926 !! wikitext
10927 {{complextemplate|
10928 param ={{ templateasargtest |
10929 templ = simple }}|[[Template:complextemplate|link]]}}
10930 !! html
10931 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10932 </p>
10933 !! end
10934
10935 !! test
10936 BUG 553: link with two variables in a piped link
10937 !! wikitext
10938 {|
10939 |[[{{{1}}}|{{{2}}}]]
10940 |}
10941 !! html/php
10942 <table>
10943 <tr>
10944 <td>[[{{{1}}}|{{{2}}}]]
10945 </td></tr></table>
10946
10947 !! html/parsoid
10948 <table>
10949 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
10950 </tbody></table>
10951 !! end
10952
10953 # See: T2553
10954 !! test
10955 Abort table cell attribute parsing on wikilink
10956 !! wikitext
10957 {|
10958 | testing [[one|two]] | three || four
10959 | testing one two | three || four
10960 | testing="[[one|two]]" | three || four
10961 |}
10962 !! html/php
10963 <table>
10964 <tr>
10965 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
10966 <td> four
10967 </td>
10968 <td> three </td>
10969 <td> four
10970 </td>
10971 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
10972 <td> four
10973 </td></tr></table>
10974
10975 !! html/parsoid
10976 <table>
10977 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10978 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10979 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10980 </tbody></table>
10981 !! end
10982
10983 !! test
10984 Don't abort table cell attribute parsing if wikilink is found in template arg
10985 !! wikitext
10986 {|
10987 | Test {{#tag:ref|One two "[[three]]" four}}
10988 |}
10989 !! html/parsoid
10990 <table>
10991 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10992 </tbody></table>
10993 !! end
10994
10995 !! test
10996 Magic variable as template parameter
10997 !! wikitext
10998 {{paramtest|param={{SITENAME}}}}
10999 !! html
11000 <p>This is a test template with parameter MediaWiki
11001 </p>
11002 !! end
11003
11004 !! article
11005 Template:linktest
11006 !! text
11007 [[{{{param}}}|link]]
11008 !! endarticle
11009
11010 !! test
11011 Template parameter as link source
11012 !! wikitext
11013 {{linktest|param=Main Page}}
11014 !! html
11015 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11016 </p>
11017 !! end
11018
11019 !!article
11020 Template:paramtest2
11021 !! text
11022 including another template, {{paramtest|param={{{arg}}}}}
11023 !! endarticle
11024
11025 !! test
11026 Template passing argument to another template
11027 !! wikitext
11028 {{paramtest2|arg='hmm'}}
11029 !! html
11030 <p>including another template, This is a test template with parameter 'hmm'
11031 </p>
11032 !! end
11033
11034 !! article
11035 Template:Linktest2
11036 !! text
11037 Main Page
11038 !! endarticle
11039
11040 !! test
11041 Template as link source
11042 !! wikitext
11043 [[{{linktest2}}]]
11044
11045 [[{{linktest2}}|Main Page]]
11046
11047 [[{{linktest2}}]]Page
11048 !! html
11049 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11050 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11051 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11052 </p>
11053 !! end
11054
11055
11056 !! article
11057 Template:loop1
11058 !! text
11059 {{loop2}}
11060 !! endarticle
11061
11062 !! article
11063 Template:loop2
11064 !! text
11065 {{loop1}}
11066 !! endarticle
11067
11068 !! test
11069 Template infinite loop
11070 !! wikitext
11071 {{loop1}}
11072 !! html
11073 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11074 </p>
11075 !! end
11076
11077 !! test
11078 Template from main namespace
11079 !! wikitext
11080 {{:Main Page}}
11081 !! html
11082 <p>blah blah
11083 </p>
11084 !! end
11085
11086 !! article
11087 Template:table
11088 !! text
11089 {|
11090 | 1 || 2
11091 |-
11092 | 3 || 4
11093 |}
11094 !! endarticle
11095
11096 !! test
11097 BUG 529: Template with table, not included at beginning of line
11098 !! wikitext
11099 foo {{table}}
11100 !! html
11101 <p>foo
11102 </p>
11103 <table>
11104 <tr>
11105 <td> 1 </td>
11106 <td> 2
11107 </td></tr>
11108 <tr>
11109 <td> 3 </td>
11110 <td> 4
11111 </td></tr></table>
11112
11113 !! end
11114
11115 !! test
11116 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11117 !! wikitext
11118 foo
11119 {{table}}
11120 !! html
11121 <p>foo
11122 </p>
11123 <table>
11124 <tr>
11125 <td> 1 </td>
11126 <td> 2
11127 </td></tr>
11128 <tr>
11129 <td> 3 </td>
11130 <td> 4
11131 </td></tr></table>
11132
11133 !! end
11134
11135 !! test
11136 BUG 41: Template parameters shown as broken links
11137 !! wikitext
11138 {{{parameter}}}
11139 !! html
11140 <p>{{{parameter}}}
11141 </p>
11142 !! end
11143
11144 !! test
11145 Template with targets containing wikilinks
11146 !! wikitext
11147 {{[[foo]]}}
11148
11149 {{[[{{echo|foo}}]]}}
11150
11151 {{{{echo|[[foo}}]]}}
11152 !! html
11153 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11154 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11155 </p><p>{{[[foo}}]]
11156 </p>
11157 !! end
11158
11159 !! article
11160 Template:''
11161 !! text
11162 bar
11163 !! endarticle
11164
11165 !! test
11166 Templates: Double quotes as template target
11167 !! wikitext
11168 foo {{''}} baz
11169 !! html/php
11170 <p>foo bar baz
11171 </p>
11172 !! html/parsoid
11173 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11174 </p>
11175 !! end
11176
11177 ## This test is about making sure Parsoid's data-mw is well formed in the
11178 ## face of multiple templates with intersecting and overlapping ranges. The
11179 ## wikitext itself is wretched.
11180 !! test
11181 Templates with intersecting and overlapping ranges
11182 !! wikitext
11183 {|{{echo|
11184 <p>ha</p>}}
11185 {|{{echo|
11186 <p>ho</p>}}
11187 {{echo|{{!}}hi}}
11188 |}
11189 !! html/php+tidy
11190 <p>ha</p>
11191 <p>ho</p>
11192 <table>
11193 <tr>
11194 <td></td>
11195 </tr>
11196 <tr>
11197 <td>hi</td>
11198 </tr>
11199 </table>
11200 <table>
11201 <tr>
11202 <td></td>
11203 </tr>
11204 </table>
11205 !! html/parsoid
11206 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11207
11208 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11209
11210 <tbody><tr><td>hi</td></tr>
11211 </tbody></table>
11212 !! end
11213
11214 !! article
11215 Template:MSGNW test
11216 !! text
11217 ''None'' of '''this''' should be
11218 * interpreted
11219 but rather passed unmodified
11220 {{test}}
11221 <gallery>
11222 File:Foobar.jpg
11223 </gallery>
11224 <!-- comment -->
11225 !! endarticle
11226
11227 # hmm, fix this or just deprecate msgnw and document its behavior?
11228 !! test
11229 msgnw keyword
11230 !! wikitext
11231 {{msgnw:MSGNW test}}
11232 !! html/php
11233 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11234 &#42; interpreted
11235 &#32;but rather passed unmodified
11236 &#123;&#123;test&#125;&#125;
11237 &#60;gallery&#62;
11238 File:Foobar.jpg
11239 &#60;/gallery&#62;
11240 &#60;!-- comment --&#62;
11241 </p>
11242 !! end
11243
11244 !! test
11245 int keyword
11246 !! wikitext
11247 {{int:youhavenewmessages|lots of money|not!}}
11248 !! html
11249 <p>You have lots of money (not!).
11250 </p>
11251 !! end
11252
11253 !! test
11254 int keyword - non-existing message
11255 !! wikitext
11256 {{int:var}}
11257 !! html
11258 <p>⧼var⧽
11259 </p>
11260 !! end
11261
11262 !! article
11263 Template:Includes
11264 !! text
11265 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11266 !! endarticle
11267
11268 !! test
11269 <includeonly> and <noinclude> being included
11270 !! wikitext
11271 {{Includes}}
11272 !! html
11273 <p>Foobar
11274 </p>
11275 !! end
11276
11277 !! article
11278 Template:Includes2
11279 !! text
11280 <onlyinclude>Foo</onlyinclude>bar
11281 !! endarticle
11282
11283 !! test
11284 <onlyinclude> being included
11285 !! wikitext
11286 {{Includes2}}
11287 !! html
11288 <p>Foo
11289 </p>
11290 !! end
11291
11292
11293 !! article
11294 Template:Includes3
11295 !! text
11296 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11297 !! endarticle
11298
11299 !! test
11300 <onlyinclude> and <includeonly> being included
11301 !! wikitext
11302 {{Includes3}}
11303 !! html
11304 <p>Foo
11305 </p>
11306 !! end
11307
11308 !! test
11309 <includeonly> and <noinclude> on a page
11310 !! wikitext
11311 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11312 !! html
11313 <p>Foozar
11314 </p>
11315 !! end
11316
11317 !! test
11318 Un-closed <noinclude>
11319 !! wikitext
11320 <noinclude>
11321 !! html
11322 !! end
11323
11324 !! test
11325 <onlyinclude> on a page
11326 !! wikitext
11327 <onlyinclude>Foo</onlyinclude>bar
11328 !! html
11329 <p>Foobar
11330 </p>
11331 !! end
11332
11333 !! test
11334 Un-closed <onlyinclude>
11335 !! wikitext
11336 <onlyinclude>
11337 !! html
11338 !! end
11339
11340 !!test
11341 Self-closed noinclude, includeonly, onlyinclude tags
11342 !! wikitext
11343 <noinclude />
11344 <includeonly />
11345 <onlyinclude />
11346 !! html
11347 <p><br />
11348 </p>
11349 !!end
11350
11351 !!test
11352 Unbalanced includeonly and noinclude tags
11353 !! wikitext
11354 {|
11355 |a</noinclude>
11356 |b</noinclude></noinclude>
11357 |c</noinclude></includeonly>
11358 |d</includeonly></includeonly>
11359 |}
11360 !! html
11361 <table>
11362 <tr>
11363 <td>a
11364 </td>
11365 <td>b
11366 </td>
11367 <td>c&lt;/includeonly&gt;
11368 </td>
11369 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11370 </td></tr></table>
11371
11372 !!end
11373
11374 !! article
11375 Template:Includeonly section
11376 !! text
11377 <includeonly>
11378 ==Includeonly section==
11379 </includeonly>
11380 ==Section T-1==
11381 !!endarticle
11382
11383 !! test
11384 Bug 6563: Edit link generation for section shown by <includeonly>
11385 !! wikitext
11386 {{includeonly section}}
11387 !! html
11388 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11389 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11390
11391 !! end
11392
11393 # Uses same input as the contents of [[Template:Includeonly section]]
11394 !! test
11395 Bug 6563: Section extraction for section shown by <includeonly>
11396 !! options
11397 section=T-2
11398 !! wikitext
11399 <includeonly>
11400 ==Includeonly section==
11401 </includeonly>
11402 ==Section T-2==
11403 !! html
11404 ==Section T-2==
11405 !! end
11406
11407 !! test
11408 Bug 6563: Edit link generation for section suppressed by <includeonly>
11409 !! wikitext
11410 <includeonly>
11411 ==Includeonly section==
11412 </includeonly>
11413 ==Section 1==
11414 !! html
11415 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11416
11417 !! end
11418
11419 !! test
11420 Bug 6563: Section extraction for section suppressed by <includeonly>
11421 !! options
11422 section=1
11423 !! wikitext
11424 <includeonly>
11425 ==Includeonly section==
11426 </includeonly>
11427 ==Section 1==
11428 !! html
11429 ==Section 1==
11430 !! end
11431
11432 !! test
11433 Un-closed <includeonly>
11434 !! wikitext
11435 <includeonly>
11436 !! html/php
11437 !! html/parsoid
11438 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11439 !! end
11440
11441 ## We used to, but no longer wt2wt this test since the default serializer
11442 ## will normalize the include directives to serialize on their own line.
11443 ## Selser will take care of preserving formatting in scenarios where they
11444 ## intermingled with other wikitext.
11445 !! test
11446 Includes and comments at SOL
11447 !! options
11448 parsoid=wt2html,html2html
11449 !! wikitext
11450 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11451
11452 <noinclude>
11453 some
11454 </noinclude>* stuff
11455 * here
11456
11457 <includeonly>can have stuff</includeonly>=== here ===
11458
11459 !! html/php
11460 <h2><span class="mw-headline" id="hu">hu</span></h2>
11461 <p>some
11462 </p>
11463 <ul><li> stuff</li>
11464 <li> here</li></ul>
11465 <h3><span class="mw-headline" id="here">here</span></h3>
11466
11467 !! html/parsoid
11468 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
11469
11470 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11471 <p>some</p>
11472 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11473 <li> here</li></ul>
11474
11475 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
11476
11477 !! end
11478
11479 # TODO: test with DOM fragment reuse!
11480 !! test
11481 Parsoid: DOM fragment reuse
11482 !! options
11483 parsoid=wt2wt,wt2html
11484 !! wikitext
11485 a{{echo|b<table></table>c}}d
11486
11487 a{{echo|b
11488 <table></table>
11489 c}}d
11490
11491 {{echo|a
11492
11493 <table></table>
11494
11495 b}}
11496 !! html
11497 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11498
11499 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11500 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11501 </span><p about="#mwt2">cd</p>
11502
11503 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11504
11505 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11506
11507 </span><p about="#mwt3">b</p>
11508 !! end
11509
11510 !! test
11511 Parsoid: Merge double tds (T52603)
11512 !! options
11513 parsoid
11514 !! wikitext
11515 {|
11516 |{{echo|{{!}} foo}}
11517 |}
11518 !! html
11519 <table><tbody>
11520 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
11521 </tbody></table>
11522 !! end
11523
11524 !! test
11525 Parsoid: Merge double tds in nested transclusion content (T52603)
11526 !! options
11527 parsoid
11528 !! wikitext
11529 {{echo|<div>}}
11530 {|
11531 |{{echo|{{!}} foo}}
11532 |}
11533 {{echo|</div>}}
11534 !! html
11535 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
11536 <table><tbody>
11537 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11538 </tbody></table>
11539 </div>
11540 !! end
11541
11542 ###
11543 ### <includeonly> and <noinclude> in attributes
11544 ###
11545 !!test
11546 0. includeonly around the entire attribute
11547 !! wikitext
11548 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11549 !! html
11550 <p><span id="v2">bar</span>
11551 </p>
11552 !!end
11553
11554 !!test
11555 1. includeonly in html attr key
11556 !! wikitext
11557 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11558 !! html
11559 <p><span id="foo">bar</span>
11560 </p>
11561 !!end
11562
11563 !!test
11564 2. includeonly in html attr value
11565 !! wikitext
11566 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11567 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11568 !! html
11569 <p><span id="v1">bar</span>
11570 <span id="v1">bar</span>
11571 </p>
11572 !!end
11573
11574 !!test
11575 3. includeonly in part of an attr value
11576 !! wikitext
11577 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11578 !! html
11579 <p><span style="color:red;">bar</span>
11580 </p>
11581 !!end
11582
11583 !!test
11584 4. includeonly in table attributes
11585 !! wikitext
11586 {|
11587 |- <noinclude>
11588 |-
11589 |a
11590 </noinclude>
11591 |- <includeonly>
11592 |-
11593 |b
11594 </includeonly>
11595 |}
11596 !! html
11597 <table>
11598
11599
11600 <tr>
11601 <td>a
11602 </td></tr>
11603 </table>
11604
11605 !!end
11606
11607 ###
11608 ### Token Stream Patcher tests
11609 ###
11610 ### These tests won't always pass wt2wt and other modes because
11611 ### on serialization, the table will be output on a new line.
11612 ### For now, we are blacklisting them, and using this to test selser.
11613 ###
11614
11615 !!test
11616 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11617 !!options
11618 parsoid=wt2html,wt2wt
11619 !!wikitext
11620 {{echo|}}{| width = '100%'
11621 |foo
11622 |}
11623 !!html/parsoid
11624 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11625 <tbody><tr><td>foo</td></tr>
11626 </tbody></table>
11627 !!end
11628
11629 ## We used to, but no longer wt2wt this test since the default serializer
11630 ## will normalize the include directives to serialize on their own line.
11631 ## Selser will take care of preserving formatting in scenarios where they
11632 ## intermingled with other wikitext.
11633 !!test
11634 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11635 !!options
11636 parsoid=wt2html
11637 !!wikitext
11638 <includeonly>a</includeonly>{| {{{b}}}
11639 |c
11640 |}
11641 !!html/parsoid
11642 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11643 <tbody><tr><td>c</td></tr>
11644 </tbody></table>
11645 !!end
11646
11647 !! test
11648 Table wikitext syntax outside wiki-tables
11649 !! wikitext
11650 a
11651 |+ not a caption
11652 ! not a table heading
11653 |- not a table row
11654 | not a table cell
11655 | class="foo bar" | baz
11656 b
11657 |}
11658 |-
11659 c
11660 !! html
11661 <p>a
11662 |+ not a caption
11663 ! not a table heading
11664 |- not a table row
11665 | not a table cell
11666 | class="foo bar" | baz
11667 b
11668 |}
11669 |-
11670 c
11671 </p>
11672 !! end
11673
11674 ###
11675 ### Testing parsing of templates where a template arg
11676 ### has the same name as the template itself.
11677 ###
11678
11679 !! article
11680 Template:quote
11681 !! text
11682 {{{quote|{{{1}}}}}}
11683 !! endarticle
11684
11685 !!test
11686 Templates: Template Name/Arg clash: 1. Use of positional param
11687 !! wikitext
11688 {{quote|foo}}
11689 !! html
11690 <p>foo
11691 </p>
11692 !!end
11693
11694 !!test
11695 Templates: Template Name/Arg clash: 2. Use of named param
11696 !! wikitext
11697 {{quote|quote=foo}}
11698 !! html
11699 <p>foo
11700 </p>
11701 !!end
11702
11703 !!test
11704 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11705 !! wikitext
11706 {{quote|quote}}
11707 !! html
11708 <p>quote
11709 </p>
11710 !!end
11711
11712 ###
11713 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11714 ###
11715
11716 !!test
11717 Templates: 1. Simple use
11718 !! wikitext
11719 {{echo|Foo}}
11720 !! html
11721 <p>Foo
11722 </p>
11723 !!end
11724
11725 !!test
11726 Templates: 2. Inside a block tag
11727 !! wikitext
11728 <div>{{echo|Foo}}</div>
11729 <blockquote>{{echo|Foo}}</blockquote>
11730 !! html
11731 <div>Foo</div>
11732 <blockquote>Foo</blockquote>
11733
11734 !! html+tidy
11735 <div>Foo</div>
11736 <blockquote>
11737 <p>Foo</p>
11738 </blockquote>
11739 !!end
11740
11741 !!test
11742 Templates: P-wrapping: 1a. Templates on consecutive lines
11743 !! wikitext
11744 {{echo|Foo}}
11745 {{echo|bar}}
11746 !! html
11747 <p>Foo
11748 bar
11749 </p>
11750 !!end
11751
11752 !!test
11753 Templates: P-wrapping: 1b. Templates on consecutive lines
11754 !! wikitext
11755 Foo
11756
11757 {{echo|bar}}
11758 {{echo|baz}}
11759 !! html
11760 <p>Foo
11761 </p><p>bar
11762 baz
11763 </p>
11764 !!end
11765
11766 !!test
11767 Templates: P-wrapping: 1c. Templates on consecutive lines
11768 !! wikitext
11769 {{echo|Foo}}
11770 {{echo|bar}} <div>baz</div>
11771 !! html
11772 <p>Foo
11773 </p>
11774 bar <div>baz</div>
11775
11776 !! html+tidy
11777 <p>Foo</p>
11778 <p>bar</p>
11779 <div>baz</div>
11780 !! end
11781
11782 !!test
11783 Templates: P-wrapping: 1d. Template preceded by comment-only line
11784 !!options
11785 parsoid
11786 !! wikitext
11787 <!-- foo -->
11788 {{echo|Bar}}
11789 !! html
11790 <!-- foo -->
11791
11792 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11793 !!end
11794
11795 !!test
11796 Templates: Inline Text: 1. Multiple template uses
11797 !! wikitext
11798 {{echo|Foo}}bar{{echo|baz}}
11799 !! html
11800 <p>Foobarbaz
11801 </p>
11802 !!end
11803
11804 !!test
11805 Templates: Inline Text: 2. Back-to-back template uses
11806 !! wikitext
11807 {{echo|Foo}}{{echo|bar}}
11808 !! html
11809 <p>Foobar
11810 </p>
11811 !!end
11812
11813 !!test
11814 Templates: Block Tags: 1. Multiple template uses
11815 !! wikitext
11816 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11817 !! html
11818 <div>Foo</div><div>bar</div><div>baz</div>
11819
11820 !!end
11821
11822 !!test
11823 Templates: Block Tags: 2. Back-to-back template uses
11824 !! wikitext
11825 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11826 !! html
11827 <div>Foo</div><div>bar</div>
11828
11829 !!end
11830
11831 # This is an edge case relating to paragraph wrapping.
11832 !!test
11833 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11834 !! wikitext
11835 {{echo|a
11836 b</p>}}
11837 !! html/parsoid
11838 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
11839 b</p>
11840 !!end
11841
11842 !!test
11843 Templates: Links: 1. Simple example
11844 !! wikitext
11845 {{echo|[[Foo|bar]]}}
11846 !! html
11847 <p><a href="/wiki/Foo" title="Foo">bar</a>
11848 </p>
11849 !!end
11850
11851 !!test
11852 Templates: Links: 2. Generation of link href
11853 !! wikitext
11854 [[{{echo|Foo}}|bar]]
11855 !! html
11856 <p><a href="/wiki/Foo" title="Foo">bar</a>
11857 </p>
11858 !!end
11859
11860 !!test
11861 Templates: Links: 3. Generation of part of a link href
11862 !! wikitext
11863 [[Fo{{echo|o}}|bar]]
11864
11865 [[Foo{{echo|bar}}]]
11866
11867 [[Foo{{echo|bar}}baz]]
11868
11869 [[Foo{{echo|bar}}|bar]]
11870
11871 [[:Foo{{echo|bar}}]]
11872
11873 [[:Foo{{echo|bar}}|bar]]
11874 !! html
11875 <p><a href="/wiki/Foo" title="Foo">bar</a>
11876 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11877 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11878 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11879 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11880 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11881 </p>
11882 !!end
11883
11884 !!test
11885 Templates: Links: 4. Multiple templates generating link href
11886 !! wikitext
11887 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11888 !! html
11889 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11890 </p>
11891 !!end
11892
11893 !!test
11894 Templates: Links: 5. Generation of link text
11895 !! wikitext
11896 [[Foo|{{echo|bar}}]]
11897 !! html
11898 <p><a href="/wiki/Foo" title="Foo">bar</a>
11899 </p>
11900 !!end
11901
11902 !!test
11903 Templates: Links: 5. Nested templates (only outermost template should be marked)
11904 !! wikitext
11905 {{echo|[[{{echo|Foo}}|bar]]}}
11906 !! html
11907 <p><a href="/wiki/Foo" title="Foo">bar</a>
11908 </p>
11909 !!end
11910
11911 !!test
11912 Templates: HTML Tag: 1. Generation of HTML attr. key
11913 !! wikitext
11914 <div {{echo|style}}="color:red;">foo</div>
11915 !! html
11916 <div style="color:red;">foo</div>
11917
11918 !!end
11919
11920 !!test
11921 Templates: HTML Tag: 2. Generation of HTML attr. value
11922 !! wikitext
11923 <div style={{echo|'color:red;'}}>foo</div>
11924 !! html
11925 <div style="color:red;">foo</div>
11926
11927 !!end
11928
11929 !!test
11930 Templates: HTML Tag: 3. Generation of HTML attr key and value
11931 !! wikitext
11932 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11933 !! html
11934 <div style="color:red;">foo</div>
11935
11936 !!end
11937
11938 !!test
11939 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11940 !! wikitext
11941 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11942 !! html
11943 <div title="This is a long title with just one piece templated">foo</div>
11944
11945 !!end
11946
11947 !!test
11948 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11949 !! wikitext
11950 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11951 !! html
11952 <div title="This is a long title with just one piece templated">foo</div>
11953
11954 !!end
11955
11956 !!test
11957 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11958 !! wikitext
11959 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11960 !! html
11961 <div title="This is a long title with just one piece templated">foo</div>
11962
11963 !!end
11964
11965 # SSS FIXME: While it is great we added support for all this,
11966 # do we want to make this part of the spec? Maybe we want to
11967 # deprecate this kind of usage in the future?
11968 !!test
11969 Templates: HTML Tag: 7. Generation of partial attribute key string
11970 !! wikitext
11971 <div st{{echo|yle}}="color:red;">foo</div>
11972 !! html
11973 <div style="color:red;">foo</div>
11974
11975 !!end
11976
11977 !! test
11978 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11979 !! wikitext
11980 <div {{echo|1=id="v1"}}>bar</div>
11981 !! html
11982 <div id="v1">bar</div>
11983
11984 !!end
11985
11986 !! test
11987 Templates: HTML Tag: 9. Multiple template-generated attributes
11988 !! wikitext
11989 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11990 !! html
11991 <div id="v1" title="foo">bar</div>
11992
11993 !!end
11994
11995 !! test
11996 Templates: Support for templates generating attributes and content
11997 !! wikitext
11998 {| {{mixed_attr_content_template}}
11999 |-
12000 |bar
12001 |}
12002 !! html/php
12003 <table style="color:red;" title="T48811">
12004
12005 <tr>
12006 <td>foo
12007 </td></tr>
12008 <tr>
12009 <td>bar
12010 </td></tr></table>
12011
12012 !! html/parsoid
12013 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
12014 <tbody><tr>
12015 <td>foo</td></tr>
12016 <tr>
12017 <td>bar</td></tr>
12018 </tbody></table>
12019 !!end
12020
12021 !! test
12022 1. Entities and nowikis inside templated attributes should be handled correctly
12023 !! wikitext
12024 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12025 !! html/php
12026 <div style="background:#f9f9f9;">foo</div>
12027
12028 !! html/parsoid
12029 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
12030 !! end
12031
12032 !! test
12033 2. Entities and nowikis inside templated attributes should be handled correctly
12034 !! wikitext
12035 {|
12036 |{{table_attribs_3}}
12037 |}
12038 !! html/php
12039 <table>
12040 <tr>
12041 <td style="background:#f9f9f9;">Foo
12042 </td></tr></table>
12043
12044 !! html/parsoid
12045 <table>
12046 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
12047 </tbody></table>
12048 !! end
12049
12050 !! test
12051 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12052 !! wikitext
12053 {{tbl-start}}
12054 |{{table_attribs_3}}
12055 {{tbl-end}}
12056 !! html/php
12057 <table>
12058 <tr>
12059 <td style="background:#f9f9f9;">Foo
12060 </td></tr></table>
12061
12062 !! html/parsoid
12063 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
12064 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12065 </tbody></table>
12066 !! end
12067
12068 # T107622
12069 !! test
12070 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12071 !! wikitext
12072 {|
12073 | {{table_attribs_6}} hi
12074 |}
12075 !! html/php
12076 <table>
12077 <tr>
12078 <td style="background: red;"> hi
12079 </td></tr></table>
12080
12081 !! html/parsoid
12082 <table>
12083 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
12084 </tbody></table>
12085 !! end
12086
12087 !!test
12088 Templates: HTML Tables: 1. Generating start of a HTML table
12089 !! wikitext
12090 {{echo|<table><tr><td>foo</td>}}</tr></table>
12091 !! html
12092 <table><tr><td>foo</td></tr></table>
12093
12094 !!end
12095
12096 !!test
12097 Templates: HTML Tables: 2a. Generating middle of a HTML table
12098 !! wikitext
12099 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12100 !! html
12101 <table><tr><td>foo</td></tr></table>
12102
12103 !!end
12104
12105 !!test
12106 Templates: HTML Tables: 2b. Generating middle of a HTML table
12107 !! wikitext
12108 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12109 !! html
12110 <table><tr><td>foo</td></tr></table>
12111
12112 !!end
12113
12114 !!test
12115 Templates: HTML Tables: 3. Generating end of a HTML table
12116 !! wikitext
12117 <table><tr>{{echo|<td>foo</td></tr></table>}}
12118 !! html
12119 <table><tr><td>foo</td></tr></table>
12120
12121 !!end
12122
12123 !!test
12124 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12125 !! wikitext
12126 {{echo|<table>}}<tr><td>foo</td></tr></table>
12127 !! html
12128 <table><tr><td>foo</td></tr></table>
12129
12130 !!end
12131
12132 !!test
12133 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12134 !! wikitext
12135 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12136 !! html
12137 <table><tr><td>foo</td></tr></table>
12138
12139 !!end
12140
12141 !!test
12142 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12143 !! wikitext
12144 <table><tr>{{echo|<td>}}foo</td></tr></table>
12145 !! html
12146 <table><tr><td>foo</td></tr></table>
12147
12148 !!end
12149
12150 !!test
12151 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12152 !! wikitext
12153 <table><tr><td>foo{{echo|</td>}}</tr></table>
12154 !! html
12155 <table><tr><td>foo</td></tr></table>
12156
12157 !!end
12158
12159 !!test
12160 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12161 !! wikitext
12162 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12163 !! html
12164 <table><tr><td>foo</td></tr></table>
12165
12166 !!end
12167
12168 !!test
12169 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12170 !! wikitext
12171 <table><tr><td>foo</td></tr>{{echo|</table>}}
12172 !! html
12173 <table><tr><td>foo</td></tr></table>
12174
12175 !!end
12176
12177 !!test
12178 Templates: HTML Tables: 5. Proper fostering of categories from inside
12179 !!options
12180 parsoid=wt2html,wt2wt
12181 !! wikitext
12182 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12183 <!--Two categories (Bug 50330)-->
12184 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12185 !! html
12186 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12187 <!--Two categories (Bug 50330)-->
12188 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
12189 !!end
12190
12191 !!test
12192 Templates: Wiki Tables: 1a. Fostering of entire template content
12193 !! wikitext
12194 {|
12195 {{echo|a}}
12196 |}
12197 !! html
12198 <table>
12199 a
12200 <tr><td></td></tr></table>
12201
12202 !! html+tidy
12203 <p>a</p>
12204 <table>
12205 <tr>
12206 <td></td>
12207 </tr>
12208 </table>
12209 !! end
12210
12211 !!test
12212 Templates: Wiki Tables: 1b. Fostering of entire template content
12213 !! wikitext
12214 {|
12215 {{echo|<div>}}
12216 foo
12217 {{echo|</div>}}
12218 |}
12219 !! html
12220 <table>
12221 <div>
12222 <p>foo
12223 </p>
12224 </div>
12225 <tr><td></td></tr></table>
12226
12227 !! html+tidy
12228 <div>
12229 <p>foo</p>
12230 </div>
12231 <table>
12232 <tr>
12233 <td></td>
12234 </tr>
12235 </table>
12236 !! end
12237
12238 !!test
12239 Templates: Wiki Tables: 2. Fostering of partial template content
12240 !! wikitext
12241 {|
12242 {{echo|a
12243 <div>b</div>}}
12244 |}
12245 !! html
12246 <table>
12247 a
12248 <div>b</div>
12249 <tr><td></td></tr></table>
12250
12251 !! html+tidy
12252 <p>a</p>
12253 <div>b</div>
12254 <table>
12255 <tr>
12256 <td></td>
12257 </tr>
12258 </table>
12259 !! end
12260
12261 !!test
12262 Templates: Wiki Tables: 3. td-content via multiple templates
12263 !! wikitext
12264 {|
12265 {{echo|{{pipe}}a}}{{echo|b}}
12266 |}
12267 !! html
12268 <table>
12269 <tr>
12270 <td>ab
12271 </td></tr></table>
12272
12273 !!end
12274
12275 !!test
12276 Templates: Wiki Tables: 4. Templated tags, no content
12277 !! wikitext
12278 {{tbl-start}}
12279 {{tbl-end}}
12280 !! html
12281 <table>
12282 <tr><td></td></tr></table>
12283
12284 !!end
12285
12286 !!test
12287 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12288 !! wikitext
12289 {{tbl-start}}
12290 |foo
12291 {{tbl-end}}
12292 !! html
12293 <table>
12294 <tr>
12295 <td>foo
12296 </td></tr></table>
12297
12298 !!end
12299
12300 !!test
12301 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12302 !! wikitext
12303 {{tbl-start}}
12304 {{!}}foo
12305 {{tbl-end}}
12306 !! html
12307 <table>
12308 <tr>
12309 <td>foo
12310 </td></tr></table>
12311
12312 !!end
12313
12314 ## This test case is very specific to Parsoid's internals
12315 ## and is hence only tested for Parsoid's code. Parsoid uses
12316 ## a <meta> marker tag for <ref> tags and they are expanded
12317 ## much later. We are verifying that this <meta> tag usage
12318 ## doesn't prevent foster parenting.
12319 !!test
12320 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12321 !!wikitext
12322 {{PartialTable}}<ref>foo</ref>
12323 |}
12324
12325 <references />
12326 !!html/parsoid
12327 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12328 <tbody>
12329 </tbody></table>
12330
12331 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
12332 !!end
12333
12334 !! test
12335 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12336 !! wikitext
12337 {{echo|
12338 {{{!}}
12339 {{!}}-}}
12340 <onlyinclude>
12341 |foo
12342 </onlyinclude>
12343 {{!}}}
12344 !! html/parsoid
12345 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
12346 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12347 <tbody><tr>
12348
12349 <td>foo
12350 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12351 </tbody></table>
12352 !! end
12353
12354 !!test
12355 Templates: Lists: Multi-line list-items via templates
12356 !! wikitext
12357 *{{echo|a {{nonexistent|
12358 unused}}}}
12359 *{{echo|b {{nonexistent|
12360 unused}}}}
12361 !! html
12362 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
12363 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
12364
12365 !!end
12366
12367 !!test
12368 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12369 !! wikitext
12370 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12371 !! html
12372 <p><i>ab</i>c<i>d</i>e
12373 </p>
12374 !!end
12375
12376 !!test
12377 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12378 (PHP parser generates misnested html)
12379 !! wikitext
12380 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12381 !! html/parsoid
12382 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
12383 !!end
12384
12385 !!test
12386 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12387 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12388 !! options
12389 parsoid=wt2html,wt2wt
12390 !! wikitext
12391 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12392 !! html
12393 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
12394 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
12395 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
12396 !!end
12397
12398 !!test
12399 Templates: Ugly nesting: 4. Divs opened/closed across templates
12400 !! wikitext
12401 a<div>b{{echo|c</div>d}}e
12402 !! html
12403 a<div>bc</div>de
12404
12405 !! html+tidy
12406 <p>a</p>
12407 <div>bc</div>
12408 <p>de</p>
12409 !! end
12410
12411 !!test
12412 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12413 (Parsoid-centric)
12414 !! options
12415 parsoid
12416 !! wikitext
12417 {|
12418 |{{echo|foo</table>}}
12419 |bar
12420 |}
12421 !! html
12422 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
12423
12424 <tbody>
12425 <tr>
12426 <td>foo</td></tr></tbody></table><span about="#mwt1">
12427 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12428 |}</span>
12429 !!end
12430
12431 !!test
12432 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12433 (Parsoid-centric)
12434 !! options
12435 parsoid
12436 !! wikitext
12437 <table>
12438 <tr>
12439 <td>
12440 <table>
12441 <tr>
12442 <td>1. {{echo|foo </table>}}</td>
12443 <td> bar </td>
12444 <td>2. {{echo|baz </table>}}</td>
12445 </tr>
12446 <tr>
12447 <td>abc</td>
12448 </tr>
12449 </table>
12450 </td>
12451 </tr>
12452 <tr>
12453 <td>xyz</td>
12454 </tr>
12455 </table>
12456 !! html
12457 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
12458 <tbody><tr>
12459 <td>
12460 <table>
12461 <tbody><tr>
12462 <td>1. foo </td></tr></tbody></table></td>
12463 <td> bar </td>
12464 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12465 </span><span about="#mwt2">
12466 </span><span about="#mwt2">
12467 </span><span about="#mwt2">abc</span><span about="#mwt2">
12468 </span><span about="#mwt2">
12469 </span><span about="#mwt2">
12470 </span><span about="#mwt2">
12471 </span><span about="#mwt2">
12472 </span><span about="#mwt2">
12473 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12474 </span><span about="#mwt2">
12475 </span>
12476 !!end
12477
12478 !! test
12479 Templates: Ugly templates: 3. newline-only template parameter
12480 !! wikitext
12481 foo {{echo|
12482 }}
12483 !! html
12484 <p>foo
12485 </p>
12486 !! end
12487
12488 # This looks like a bug: a single newline triggers p/br for some reason.
12489 !! test
12490 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12491 !! wikitext
12492 {{echo|
12493 }}
12494 !! html
12495 <p><br />
12496 </p>
12497 !! end
12498
12499 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12500 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12501 !! test
12502 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12503 !! wikitext
12504 {{echo|<table>}}
12505 {{echo|<div>foo}}
12506 {{echo|</table>}}
12507 !! html/parsoid
12508 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
12509 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12510 </table>
12511 !! end
12512
12513 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12514 # that are "identical" and generate nesting cycles in the algorithm
12515 !! test
12516 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12517 !! wikitext
12518 {{echo|<table><tr><td><table>}}
12519 {{echo|<div>}}
12520 {{echo|</div>}}
12521 !! html/parsoid
12522 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
12523 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12524 </table></td></tr></tbody></table>
12525 !! end
12526
12527 !! test
12528 Templates: Parameters substituted at the top-level
12529 !! wikitext
12530 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12531
12532 {{{foo|bar|baz}}}
12533 !! html/php
12534 <p><i>who</i> me? <b>never!</b>
12535 </p><p>bar
12536 </p>
12537 !! html/parsoid
12538 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
12539
12540 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12541 !! end
12542
12543 !!test
12544 Parser Functions: 1. Simple example
12545 !! wikitext
12546 {{uc:foo}}
12547 !! html
12548 <p>FOO
12549 </p>
12550 !!end
12551
12552 !!test
12553 Parser Functions: 2. Nested use (only outermost should be marked up)
12554 !! wikitext
12555 {{uc:{{lc:FOO}}}}
12556 !! html
12557 <p>FOO
12558 </p>
12559 !!end
12560
12561 ###
12562 ### Pre-save transform tests
12563 ###
12564 !! test
12565 pre-save transform: subst:
12566 !! options
12567 pst
12568 !! wikitext
12569 {{subst:test}}
12570 !! html/php
12571 This is a test template
12572 !! end
12573
12574 !! test
12575 pre-save transform: normal template
12576 !! options
12577 pst
12578 !! wikitext
12579 {{test}}
12580 !! html/php
12581 {{test}}
12582 !! end
12583
12584 !! test
12585 pre-save transform: nonexistent template
12586 !! options
12587 pst
12588 !! wikitext
12589 {{thistemplatedoesnotexist}}
12590 !! html/php
12591 {{thistemplatedoesnotexist}}
12592 !! end
12593
12594 !! test
12595 pre-save transform: subst magic variables
12596 !! options
12597 pst
12598 !! wikitext
12599 {{subst:SITENAME}}
12600 !! html/php
12601 MediaWiki
12602 !! end
12603
12604 # This is bug 89, which I fixed. -- wtm
12605 !! test
12606 pre-save transform: subst: templates with parameters
12607 !! options
12608 pst
12609 !! wikitext
12610 {{subst:paramtest|param="something else"}}
12611 !! html/php
12612 This is a test template with parameter "something else"
12613 !! end
12614
12615 !! article
12616 Template:nowikitest
12617 !! text
12618 <nowiki>'''not wiki'''</nowiki>
12619 !! endarticle
12620
12621 !! test
12622 pre-save transform: nowiki in subst (bug 1188)
12623 !! options
12624 pst
12625 !! wikitext
12626 {{subst:nowikitest}}
12627 !! html/php
12628 <nowiki>'''not wiki'''</nowiki>
12629 !! end
12630
12631 !! article
12632 Template:commenttest
12633 !! text
12634 This template has <!-- a comment --> in it.
12635 !! endarticle
12636
12637 !! test
12638 pre-save transform: comment in subst (bug 1936)
12639 !! options
12640 pst
12641 !! wikitext
12642 {{subst:commenttest}}
12643 !! html/php
12644 This template has <!-- a comment --> in it.
12645 !! end
12646
12647 !! test
12648 pre-save transform: unclosed tag
12649 !! options
12650 pst
12651 !! wikitext
12652 <nowiki>'''not wiki'''
12653 !! html/php
12654 <nowiki>'''not wiki'''
12655 !! end
12656
12657 !! test
12658 pre-save transform: mixed tag case
12659 !! options
12660 pst
12661 !! wikitext
12662 <NOwiki>'''not wiki'''</noWIKI>
12663 !! html/php
12664 <NOwiki>'''not wiki'''</noWIKI>
12665 !! end
12666
12667 !! test
12668 pre-save transform: unclosed comment in <nowiki>
12669 !! options
12670 pst
12671 !! wikitext
12672 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12673 !! html/php
12674 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12675 !!end
12676
12677 # Leading @ in this template definition works around a limitation
12678 # in parsoid's parserTests which otherwise strips the <span> from the
12679 # result (confusing it for a template wrapper)
12680 !! article
12681 Template:dangerous
12682 !!text
12683 @<span onmouseover="alert('crap')">Oh no</span>
12684 !!endarticle
12685
12686 !!test
12687 (confirming safety of fix for subst bug 1936)
12688 !! wikitext
12689 {{Template:dangerous}}
12690 !! html
12691 <p>@<span>Oh no</span>
12692 </p>
12693 !! end
12694
12695 !! test
12696 pre-save transform: comment containing gallery (bug 5024)
12697 !! options
12698 pst
12699 !! wikitext
12700 <!-- <gallery>data</gallery> -->
12701 !! html/php
12702 <!-- <gallery>data</gallery> -->
12703 !!end
12704
12705 !! test
12706 pre-save transform: comment containing extension
12707 !! options
12708 pst
12709 !! wikitext
12710 <!-- <tag>data</tag> -->
12711 !! html/php
12712 <!-- <tag>data</tag> -->
12713 !!end
12714
12715 !! test
12716 pre-save transform: comment containing nowiki
12717 !! options
12718 pst
12719 !! wikitext
12720 <!-- <nowiki>data</nowiki> -->
12721 !! html/php
12722 <!-- <nowiki>data</nowiki> -->
12723 !!end
12724
12725 !! test
12726 pre-save transform: <noinclude> in subst (bug 3298)
12727 !! options
12728 pst
12729 !! wikitext
12730 {{subst:Includes}}
12731 !! html/php
12732 Foobar
12733 !! end
12734
12735 !! test
12736 pre-save transform: <onlyinclude> in subst (bug 3298)
12737 !! options
12738 pst
12739 !! wikitext
12740 {{subst:Includes2}}
12741 !! html/php
12742 Foo
12743 !! end
12744
12745 !! article
12746 Template:SubstTest
12747 !!text
12748 {{<includeonly>subst:</includeonly>Includes}}
12749 !! endarticle
12750
12751 !! article
12752 Template:SafeSubstTest
12753 !! text
12754 {{<includeonly>safesubst:</includeonly>Includes}}
12755 !! endarticle
12756
12757 !! test
12758 bug 22297: safesubst: works during PST
12759 !! options
12760 pst
12761 !! wikitext
12762 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12763 !! html/php
12764 FoobarFoobar
12765 !! end
12766
12767 !! test
12768 bug 22297: safesubst: works during normal parse
12769 !! wikitext
12770 {{SafeSubstTest}}
12771 !! html
12772 <p>Foobar
12773 </p>
12774 !! end
12775
12776 !! test
12777 subst: does not work during normal parse
12778 !! wikitext
12779 {{SubstTest}}
12780 !! html
12781 <p>{{subst:Includes}}
12782 </p>
12783 !! end
12784
12785 !! test
12786 pre-save transform: context links ("pipe trick")
12787 !! options
12788 pst
12789 !! wikitext
12790 [[Article (context)|]]
12791 [[Bar:Article|]]
12792 [[:Bar:Article|]]
12793 [[Bar:Article (context)|]]
12794 [[:Bar:Article (context)|]]
12795 [[|Article]]
12796 [[|Article (context)]]
12797 [[Bar:X (Y) Z|]]
12798 [[:Bar:X (Y) Z|]]
12799 !! html/php
12800 [[Article (context)|Article]]
12801 [[Bar:Article|Article]]
12802 [[:Bar:Article|Article]]
12803 [[Bar:Article (context)|Article]]
12804 [[:Bar:Article (context)|Article]]
12805 [[Article]]
12806 [[Article (context)]]
12807 [[Bar:X (Y) Z|X (Y) Z]]
12808 [[:Bar:X (Y) Z|X (Y) Z]]
12809 !! end
12810
12811 !! test
12812 pre-save transform: context links ("pipe trick") with interwiki prefix
12813 !! options
12814 pst
12815 !! wikitext
12816 [[interwiki:Article|]]
12817 [[:interwiki:Article|]]
12818 [[interwiki:Bar:Article|]]
12819 [[:interwiki:Bar:Article|]]
12820 !! html/php
12821 [[interwiki:Article|Article]]
12822 [[:interwiki:Article|Article]]
12823 [[interwiki:Bar:Article|Bar:Article]]
12824 [[:interwiki:Bar:Article|Bar:Article]]
12825 !! end
12826
12827 !! test
12828 pre-save transform: context links ("pipe trick") with parens in title
12829 !! options
12830 pst title=[[Somearticle (context)]]
12831 !! wikitext
12832 [[|Article]]
12833 !! html/php
12834 [[Article (context)|Article]]
12835 !! end
12836
12837 !! test
12838 pre-save transform: context links ("pipe trick") with comma in title
12839 !! options
12840 pst title=[[Someplace, Somewhere]]
12841 !! wikitext
12842 [[|Otherplace]]
12843 [[Otherplace, Elsewhere|]]
12844 [[Otherplace, Elsewhere, Anywhere|]]
12845 !! html/php
12846 [[Otherplace, Somewhere|Otherplace]]
12847 [[Otherplace, Elsewhere|Otherplace]]
12848 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12849 !! end
12850
12851 !! test
12852 pre-save transform: context links ("pipe trick") with parens and comma
12853 !! options
12854 pst title=[[Someplace (IGNORED), Somewhere]]
12855 !! wikitext
12856 [[|Otherplace]]
12857 [[Otherplace (place), Elsewhere|]]
12858 !! html/php
12859 [[Otherplace, Somewhere|Otherplace]]
12860 [[Otherplace (place), Elsewhere|Otherplace]]
12861 !! end
12862
12863 !! test
12864 pre-save transform: context links ("pipe trick") with comma and parens
12865 !! options
12866 pst title=[[Who, me? (context)]]
12867 !! wikitext
12868 [[|Yes, you.]]
12869 [[Me, Myself, and I (1937 song)|]]
12870 !! html/php
12871 [[Yes, you. (context)|Yes, you.]]
12872 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12873 !! end
12874
12875 !! test
12876 pre-save transform: context links ("pipe trick") with namespace
12877 !! options
12878 pst title=[[Ns:Somearticle]]
12879 !! wikitext
12880 [[|Article]]
12881 !! html/php
12882 [[Ns:Article|Article]]
12883 !! end
12884
12885 !! test
12886 pre-save transform: context links ("pipe trick") with namespace and parens
12887 !! options
12888 pst title=[[Ns:Somearticle (context)]]
12889 !! wikitext
12890 [[|Article]]
12891 !! html/php
12892 [[Ns:Article (context)|Article]]
12893 !! end
12894
12895 !! test
12896 pre-save transform: context links ("pipe trick") with namespace and comma
12897 !! options
12898 pst title=[[Ns:Somearticle, Context, Whatever]]
12899 !! wikitext
12900 [[|Article]]
12901 !! html/php
12902 [[Ns:Article, Context, Whatever|Article]]
12903 !! end
12904
12905 !! test
12906 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12907 !! options
12908 pst title=[[Ns:Somearticle, Context (context)]]
12909 !! wikitext
12910 [[|Article]]
12911 !! html/php
12912 [[Ns:Article (context)|Article]]
12913 !! end
12914
12915 !! test
12916 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12917 !! options
12918 pst title=[[Ns:Somearticle (IGNORED), Context]]
12919 !! wikitext
12920 [[|Article]]
12921 !! html/php
12922 [[Ns:Article, Context|Article]]
12923 !! end
12924
12925 !! test
12926 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12927 !! options
12928 pst
12929 !! wikitext
12930 [[Article(context)|]]
12931 [[Bar:Article(context)|]]
12932 [[:Bar:Article(context)|]]
12933 [[|Article(context)]]
12934 [[Bar:X(Y)Z|]]
12935 [[:Bar:X(Y)Z|]]
12936 !! html/php
12937 [[Article(context)|Article]]
12938 [[Bar:Article(context)|Article]]
12939 [[:Bar:Article(context)|Article]]
12940 [[Article(context)]]
12941 [[Bar:X(Y)Z|X(Y)Z]]
12942 [[:Bar:X(Y)Z|X(Y)Z]]
12943 !! end
12944
12945 !! test
12946 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12947 !! options
12948 pst
12949 !! wikitext
12950 [[Article (context)|]]
12951 [[Bar:Article (context)|]]
12952 [[:Bar:Article (context)|]]
12953 [[|Article (context)]]
12954 [[Bar:X (Y) Z|]]
12955 [[:Bar:X (Y) Z|]]
12956 !! html/php
12957 [[Article (context)|Article]]
12958 [[Bar:Article (context)|Article]]
12959 [[:Bar:Article (context)|Article]]
12960 [[Article (context)]]
12961 [[Bar:X (Y) Z|X (Y) Z]]
12962 [[:Bar:X (Y) Z|X (Y) Z]]
12963 !! end
12964
12965 !! test
12966 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12967 !! options
12968 pst
12969 !! wikitext
12970 [[Article(context)|]]
12971 [[Bar:Article(context)|]]
12972 [[:Bar:Article(context)|]]
12973 [[|Article(context)]]
12974 [[Bar:X(Y)Z|]]
12975 [[:Bar:X(Y)Z|]]
12976 !! html/php
12977 [[Article(context)|Article]]
12978 [[Bar:Article(context)|Article]]
12979 [[:Bar:Article(context)|Article]]
12980 [[Article(context)]]
12981 [[Bar:X(Y)Z|X(Y)Z]]
12982 [[:Bar:X(Y)Z|X(Y)Z]]
12983 !! end
12984
12985 !! test
12986 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12987 !! options
12988 pst
12989 !! wikitext
12990 [[Article (context), context|]]
12991 [[Article (context),context|]]
12992 [[Bar:Article (context), context|]]
12993 [[Bar:Article (context),context|]]
12994 [[:Bar:Article (context), context|]]
12995 [[:Bar:Article (context),context|]]
12996 !! html/php
12997 [[Article (context), context|Article]]
12998 [[Article (context),context|Article]]
12999 [[Bar:Article (context), context|Article]]
13000 [[Bar:Article (context),context|Article]]
13001 [[:Bar:Article (context), context|Article]]
13002 [[:Bar:Article (context),context|Article]]
13003 !! end
13004
13005 !! test
13006 pre-save transform: trim trailing empty lines
13007 !! options
13008 pst
13009 !! wikitext
13010 Empty lines are trimmed
13011
13012
13013
13014
13015 !! html/php
13016 Empty lines are trimmed
13017 !! end
13018
13019 !! test
13020 pre-save transform: Signature expansion
13021 !! options
13022 pst
13023 !! wikitext
13024 * ~~~
13025 * <noinclude>~~~</noinclude>
13026 * <includeonly>~~~</includeonly>
13027 * <onlyinclude>~~~</onlyinclude>
13028 !! html/php
13029 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13030 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13031 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13032 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13033 !! end
13034
13035
13036 !! test
13037 pre-save transform: Signature expansion in nowiki tags (bug 93)
13038 !! options
13039 pst disabled
13040 !! wikitext
13041 Shall not expand:
13042
13043 <nowiki>~~~~</nowiki>
13044
13045 <includeonly><nowiki>~~~~</nowiki></includeonly>
13046
13047 <noinclude><nowiki>~~~~</nowiki></noinclude>
13048
13049 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13050
13051 {{subst:Foo}} shall be converted to FOO
13052
13053 As well as inside noinclude/onlyinclude
13054 <noinclude>{{subst:Foo}}</noinclude>
13055 <onlyinclude>{{subst:Foo}}</onlyinclude>
13056
13057 But not inside includeonly
13058 <includeonly>{{subst:Foo}}</includeonly>
13059 !! html/php
13060 Shall not expand:
13061
13062 <nowiki>~~~~</nowiki>
13063
13064 <includeonly><nowiki>~~~~</nowiki></includeonly>
13065
13066 <noinclude><nowiki>~~~~</nowiki></noinclude>
13067
13068 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13069
13070 FOO shall be converted to FOO
13071
13072 As well as inside noinclude/onlyinclude
13073 <noinclude>FOO</noinclude>
13074 <onlyinclude>FOO</onlyinclude>
13075
13076 But not inside includeonly
13077 <includeonly>{{subst:Foo}}</includeonly>
13078 !! end
13079
13080 !! test
13081 Parsoid: Recognize nowiki with trailing space in tags
13082 !! options
13083 parsoid=wt2html
13084 !! wikitext
13085 <nowiki ><div>[[foo]]</nowiki >
13086
13087 a<nowiki / >b
13088
13089 c<nowiki />d
13090
13091 e<nowiki/ >f
13092 !! html
13093 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13094 <p>ab</p>
13095 <p>cd</p>
13096 <p>ef</p>
13097 !! end
13098
13099 !! test
13100 Parsoid: Recognize nowiki with odd capitalization
13101 !! options
13102 parsoid=wt2html
13103 !! wikitext
13104 <noWikI ><div>[[foo]]</Nowiki >
13105 !! html
13106 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13107 !! end
13108
13109
13110 !! test
13111 Parsoid: Escape nowiki with trailing space in tags
13112 !! options
13113 parsoid=html2wt
13114 !! html/parsoid
13115 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13116 <p>a&lt;nowiki /&gt;b</p>
13117 <p>c&lt;nowiki/ &gt;d</p>
13118 !! wikitext
13119 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13120
13121 a&lt;nowiki /&gt;b
13122
13123 c&lt;nowiki/ &gt;d
13124 !! end
13125
13126 !! test
13127 Parsoid: Escape weird noWikI capitalizations
13128 !! options
13129 parsoid=html2wt
13130 !! html/parsoid
13131 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13132 !! wikitext
13133 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13134 !! end
13135
13136 ###
13137 ### Message transform tests
13138 ###
13139 !! test
13140 message transform: magic variables
13141 !! options
13142 msg
13143 !! wikitext
13144 {{SITENAME}}
13145 !! html
13146 MediaWiki
13147 !! end
13148
13149 !! test
13150 message transform: should not transform wiki markup
13151 !! options
13152 msg
13153 !! wikitext
13154 ''test''
13155 !! html
13156 ''test''
13157 !! end
13158
13159 !! test
13160 message transform: <noinclude> in transcluded template (bug 4926)
13161 !! options
13162 msg
13163 !! wikitext
13164 {{Includes}}
13165 !! html
13166 Foobar
13167 !! end
13168
13169 !! test
13170 message transform: <onlyinclude> in transcluded template (bug 4926)
13171 !! options
13172 msg
13173 !! wikitext
13174 {{Includes2}}
13175 !! html
13176 Foo
13177 !! end
13178
13179 !! test
13180 {{#special:}} page name, known
13181 !! options
13182 msg
13183 !! wikitext
13184 {{#special:Recentchanges}}
13185 !! html
13186 Special:RecentChanges
13187 !! end
13188
13189 !! test
13190 {{#special:}} page name with subpage, known
13191 !! options
13192 msg
13193 !! wikitext
13194 {{#special:Recentchanges/param}}
13195 !! html
13196 Special:RecentChanges/param
13197 !! end
13198
13199 !! test
13200 {{#special:}} page name, unknown
13201 !! options
13202 msg
13203 !! wikitext
13204 {{#special:foobar nonexistent}}
13205 !! html
13206 Special:Foobar nonexistent
13207 !! end
13208
13209 !! test
13210 {{#speciale:}} page name, known
13211 !! options
13212 msg
13213 !! wikitext
13214 {{#speciale:Recentchanges}}
13215 !! html
13216 Special:RecentChanges
13217 !! end
13218
13219 !! test
13220 {{#speciale:}} page name with subpage, known
13221 !! options
13222 msg
13223 !! wikitext
13224 {{#speciale:Recentchanges/param}}
13225 !! html
13226 Special:RecentChanges/param
13227 !! end
13228
13229 !! test
13230 {{#speciale:}} page name, unknown
13231 !! options
13232 msg
13233 !! wikitext
13234 {{#speciale:foobar nonexistent}}
13235 !! html
13236 Special:Foobar_nonexistent
13237 !! end
13238
13239 ###
13240 ### Images
13241 ###
13242 ### For Parsoid-specific tests, see
13243 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13244
13245 !! test
13246 Simple image
13247 !! options
13248 parsoid=wt2html,wt2wt,html2html
13249 !! wikitext
13250 [[Image:foobar.jpg]]
13251 !! html/php
13252 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13253 </p>
13254 !! html/parsoid
13255 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13256 !! end
13257
13258 !! test
13259 Simple image (using File: namespace, now canonical)
13260 !! wikitext
13261 [[File:Foobar.jpg]]
13262 !! html/php
13263 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13264 </p>
13265 !! html/parsoid
13266 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13267 !! end
13268
13269 !! test
13270 Right-aligned image
13271 !! wikitext
13272 [[File:Foobar.jpg|right]]
13273 !! html/php
13274 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13275
13276 !! html/parsoid
13277 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13278 !! end
13279
13280 !! test
13281 Image with caption
13282 !! wikitext
13283 [[File:Foobar.jpg|right|Caption text]]
13284 !! html/php
13285 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13286
13287 !! html/parsoid
13288 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13289 !! end
13290
13291 !! test
13292 Image with caption, bug 53312 #1
13293 !! wikitext
13294 [[File:Foobar.jpg|right|Caption page stuff]]
13295 !! html/php
13296 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13297
13298 !! html/parsoid
13299 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
13300 !! end
13301
13302 !! test
13303 Image with caption, bug 53312 #2
13304 !! wikitext
13305 [[File:Foobar.jpg|right|Caption page=]]
13306 !! html/php
13307 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13308
13309 !! html/parsoid
13310 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
13311 !! end
13312
13313 !! test
13314 Image with caption, bug 53312 #3
13315 !! wikitext
13316 [[File:Foobar.jpg|right|Caption page=stuff]]
13317 !! html/php
13318 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13319
13320 !! html/parsoid
13321 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
13322 !! end
13323
13324 !! test
13325 Allow empty links in image captions (Bug 60753)
13326 !! options
13327 thumbsize=220
13328 !! wikitext
13329 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13330 [[]]
13331 [[Link2]]
13332 ]]
13333 !! html/php
13334 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
13335
13336 !! html/parsoid
13337 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
13338 [[]]
13339 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13340 </figcaption></figure>
13341 !! end
13342
13343 !! test
13344 Titles in unlinked images (T23454)
13345 !! wikitext
13346 [[File:Foobar.jpg|link=|stuff]]
13347 !! html/php
13348 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13349 </p>
13350 !! end
13351
13352 !! test
13353 Link with empty target
13354 !! wikitext
13355 [[]]
13356 !! html
13357 <p>[[]]
13358 </p>
13359 !! end
13360
13361 !! test
13362 Image with link trail
13363 !! wikitext
13364 Linktrails should not work for images: [[File:Foobar.jpg]]s
13365 !! html/php
13366 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
13367 </p>
13368 !! html/parsoid
13369 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
13370 !! end
13371
13372 !! test
13373 Image with empty attribute
13374 !! options
13375 parsoid=wt2html,wt2wt,html2html
13376 !! wikitext
13377 [[File:Foobar.jpg|right||Caption text]]
13378 !! html/php
13379 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13380
13381 !! html/parsoid
13382 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13383 !! end
13384
13385 !! test
13386 1. Block image with individual attributes from templates
13387 !! wikitext
13388 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13389 !! html/php
13390 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
13391
13392 !! html/parsoid
13393 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13394 !! end
13395
13396 !! test
13397 2. Block Image with individual attributes from templates
13398 !! wikitext
13399 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13400 !! html/php
13401 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
13402
13403 !! html/parsoid
13404 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13405 !! end
13406
13407 !! test
13408 3. Inline image with individual attributes from templates
13409 !! wikitext
13410 [[File:Foobar.jpg|{{echo|50px}}]]
13411 !! html/php
13412 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
13413 </p>
13414 !! html/parsoid
13415 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13416 !! end
13417
13418 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13419 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13420 !! test
13421 Image with multiple attributes from the same template
13422 !! wikitext
13423 [[File:Foobar.jpg|{{image_attribs}}]]
13424 !! html/php
13425 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13426
13427 !! html/parsoid
13428 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13429 !! end
13430
13431 !! test
13432 Image with link tails
13433 !! options
13434 thumbsize=220
13435 !! wikitext
13436 123[[File:Foobar.jpg]]456
13437 123[[File:Foobar.jpg|right]]456
13438 123[[File:Foobar.jpg|thumb]]456
13439 !! html/php
13440 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
13441 </p>
13442 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
13443 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
13444
13445 !! html/php+tidy
13446 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
13447 <p>123</p>
13448 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13449 <p>456 123</p>
13450 <div class="thumb tright">
13451 <div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
13452 <div class="thumbcaption">
13453 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13454 </div>
13455 </div>
13456 </div>
13457 <p>456</p>
13458 !! html/parsoid
13459 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
13460 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
13461 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
13462 !! end
13463
13464 !! test
13465 Image with multiple captions -- only last one is accepted
13466 !! wikitext
13467 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13468 !! html/php
13469 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13470
13471 !! html/parsoid
13472 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
13473 !! end
13474
13475 !! test
13476 Image with multiple widths -- use last
13477 !! wikitext
13478 [[File:Foobar.jpg|200px|300px|caption]]
13479 !! html/php
13480 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
13481 </p>
13482 !! html/parsoid
13483 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
13484 !! end
13485
13486 !! test
13487 Image with multiple alignments -- use first (bug 48664)
13488 !! options
13489 thumbsize=220
13490 !! wikitext
13491 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13492
13493 [[File:Foobar.jpg|middle|text-top|caption]]
13494 !! html/php
13495 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13496 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
13497 </p>
13498 !! html/parsoid
13499 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13500 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13501 !! end
13502
13503 !! test
13504 Image with width attribute at different positions
13505 !! wikitext
13506 [[File:Foobar.jpg|200px|right|Caption]]
13507 [[File:Foobar.jpg|right|200px|Caption]]
13508 [[File:Foobar.jpg|right|Caption|200px]]
13509 !! html/php
13510 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13511 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13512 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13513
13514 !! html/parsoid
13515 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13516 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13517 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13518 !! end
13519
13520 # a sad bit of backward-compatibility
13521 !! test
13522 Image with size specified with pxpx (bug 13500, 51628)
13523 !! options
13524 parsoid=wt2html,wt2wt,html2html
13525 !! wikitext
13526 [[File:Foobar.jpg|20pxpx]]
13527 [[File:Foobar.jpg|200x20pxpx]]
13528 !! html/php
13529 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
13530 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
13531 </p>
13532 !! html/parsoid
13533 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
13534 !! end
13535
13536 !! test
13537 Image with link parameter, wiki target
13538 !! wikitext
13539 [[File:Foobar.jpg|link=Main Page]]
13540 !! html/php
13541 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13542 </p>
13543 !! html/parsoid
13544 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13545 !! end
13546
13547 # parsoid bug 49293 (part 1)
13548 !! test
13549 Image with link parameter, URL target
13550 !! wikitext
13551 [[File:Foobar.jpg|link=http://example.com/]]
13552 !! html/php
13553 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13554 </p>
13555 !! html/parsoid
13556 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13557 !! end
13558
13559 # parsoid bug 49293 (part 2)
13560 !! test
13561 Image with link parameter, protocol-less URL target
13562 !! wikitext
13563 [[File:Foobar.jpg|link=//example.com/]]
13564 !! html/php
13565 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13566 </p>
13567 !! html/parsoid
13568 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13569 !! end
13570
13571 !! test
13572 Escaping non-block captions (T107435)
13573 !! options
13574 parsoid={
13575 "modes": ["wt2wt"],
13576 "changes": [
13577 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13578 ]
13579 }
13580 !! wikitext
13581 [[Image:Foobar.jpg|caption]]
13582 !! wikitext/edited
13583 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13584 !! end
13585
13586 # wgExternalLinkTarget not supported by Parsoid
13587 !! test
13588 Image with link parameter, wgExternalLinkTarget
13589 !! wikitext
13590 [[Image:foobar.jpg|link=http://example.com/]]
13591 !! config
13592 wgExternalLinkTarget='foobar'
13593 !! html/php
13594 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13595 </p>
13596 !! end
13597
13598 !! test
13599 Image with link parameter, wgNoFollowLinks set to false
13600 !! wikitext
13601 [[Image:foobar.jpg|link=http://example.com/]]
13602 !! config
13603 wgNoFollowLinks=false
13604 !! html
13605 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13606 </p>
13607 !! end
13608
13609 !! test
13610 Image with link parameter, wgNoFollowDomainExceptions
13611 !! wikitext
13612 [[Image:foobar.jpg|link=http://example.com/]]
13613 !! config
13614 wgNoFollowDomainExceptions='example.com'
13615 !! html
13616 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13617 </p>
13618 !! end
13619
13620 # wgExternalLinkTarget not supported by Parsoid
13621 !! test
13622 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13623 !! wikitext
13624 [[Image:foobar.jpg|link=http://example.com/|Title]]
13625 !! config
13626 wgExternalLinkTarget='foobar'
13627 !! html/php
13628 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13629 </p>
13630 !! end
13631
13632 !! test
13633 Image with empty link parameter
13634 !! wikitext
13635 [[File:Foobar.jpg|link=]]
13636 !! html/php
13637 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13638 </p>
13639 !! html/parsoid
13640 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
13641 !! end
13642
13643 !! test
13644 Image with link parameter (wiki target) and unnamed parameter
13645 !! wikitext
13646 [[File:Foobar.jpg|link=Main_Page|Title]]
13647 !! html/php
13648 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13649 </p>
13650 !! html/parsoid
13651 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13652 !! end
13653
13654 !! test
13655 Image with link parameter (URL target) and unnamed parameter
13656 !! wikitext
13657 [[File:Foobar.jpg|link=http://example.com/|Title]]
13658 !! html/php
13659 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13660 </p>
13661 !! html/parsoid
13662 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13663 !! end
13664
13665 !! test
13666 Thumbnail image with link parameter
13667 !! options
13668 thumbsize=220
13669 parsoid=wt2html,wt2wt,html2html
13670 !! wikitext
13671 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13672 !! html/php
13673 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13674
13675 !! html/parsoid
13676 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
13677 !! end
13678
13679 !! test
13680 Manually-specified thumbnail image
13681 !! options
13682 thumbsize=220
13683 !! wikitext
13684 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13685 !! html/php
13686 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13687
13688 !! html/parsoid
13689 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13690 !! end
13691
13692 !! test
13693 Manually-specified thumbnail image with explicit link to wiki page
13694 !! options
13695 thumbsize=220
13696 parsoid=wt2html,wt2wt,html2html
13697 !! wikitext
13698 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13699 !! html/php
13700 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13701
13702 !! html/parsoid
13703 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13704 !! end
13705
13706 !! test
13707 Manually-specified thumbnail image with explicit link to url
13708 !! options
13709 thumbsize=220
13710 parsoid=wt2html,wt2wt,html2html
13711 !! wikitext
13712 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13713 !! html/php
13714 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13715
13716 !! html/parsoid
13717 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13718 !! end
13719
13720 !! test
13721 Manually-specified thumbnail image with explicit no link
13722 !! options
13723 thumbsize=220
13724 parsoid=wt2html,wt2wt,html2html
13725 !! wikitext
13726 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13727 !! html/php
13728 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13729
13730 !! html/parsoid
13731 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
13732 !! end
13733
13734 !! test
13735 Manually-specified thumbnail image with explicit link and alt text
13736 !! options
13737 thumbsize=220
13738 parsoid=wt2html,wt2wt,html2html
13739 !! wikitext
13740 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13741 !! html/php
13742 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13743
13744 !! html/parsoid
13745 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13746 !! end
13747
13748 !! test
13749 Image with frame and link
13750 !! options
13751 parsoid=wt2html,wt2wt,html2html
13752 !! wikitext
13753 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13754 !! html/php
13755 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
13756
13757 !! html/parsoid
13758 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
13759 !! end
13760
13761 !! test
13762 Image with frame and link and explicit alt
13763 !! options
13764 parsoid=wt2html,wt2wt,html2html
13765 !! wikitext
13766 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13767 !! html/php
13768 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
13769
13770 !! html/parsoid
13771 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
13772 !! end
13773
13774 !! test
13775 Image with wiki markup in implicit alt
13776 !! wikitext
13777 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13778
13779 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13780 !! html/php
13781 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13782 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13783 </p>
13784 !! html/parsoid
13785 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13786
13787 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13788 !! end
13789
13790 !! test
13791 Alt image option should handle most kinds of wikitext without barfing
13792 !! wikitext
13793 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13794 !! html/php
13795 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
13796
13797 !! html/parsoid
13798 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13799 !! end
13800
13801 ###################
13802 # Conflicting image format options.
13803 # First option specified should 'win'.
13804 # All three cases in each test should be identical.
13805
13806 !! test
13807 Image with 'frameless' first.
13808 !! options
13809 parsoid=wt2html,wt2wt,html2html
13810 !! wikitext
13811 [[File:Foobar.jpg|frameless|caption]]
13812
13813 [[File:Foobar.jpg|frameless|frame|caption]]
13814
13815 [[File:Foobar.jpg|frameless|thumb|caption]]
13816 !! html/php
13817 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13818 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13819 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13820 </p>
13821 !! html/parsoid
13822 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13823 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13824 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13825 !! end
13826
13827 !! test
13828 Image with 'frame' first.
13829 !! options
13830 parsoid=wt2html,wt2wt,html2html
13831 !! wikitext
13832 [[File:Foobar.jpg|frame|caption]]
13833 [[File:Foobar.jpg|frame|frameless|caption]]
13834 [[File:Foobar.jpg|frame|thumb|caption]]
13835 !! html/php
13836 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13837 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13838 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13839
13840 !! html/parsoid
13841 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13842 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13843 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13844 !! end
13845
13846 !! test
13847 Image with 'thumb' first.
13848 !! options
13849 parsoid=wt2html,wt2wt,html2html
13850 !! wikitext
13851 [[File:Foobar.jpg|thumb|caption]]
13852 [[File:Foobar.jpg|thumb|frameless|caption]]
13853 [[File:Foobar.jpg|thumb|frame|caption]]
13854 !! html/php
13855 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13856 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13857 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13858
13859 !! html/parsoid
13860 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13861 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13862 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13863 !! end
13864
13865 ###################
13866 # Image sizing.
13867 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13868 # and https://phabricator.wikimedia.org/T64258
13869 # Foobar has actual size of 1941x220
13870 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13871 # a scalable format.
13872 # 2. Framed images always ignore size options; always render at default size.
13873 # 3. "Unspecified format" and border are the only types which can be
13874 # enlarged.
13875
13876 !! test
13877 Image: "unspecified format" and border enlarge
13878 !! options
13879 parsoid=wt2html,wt2wt,html2html
13880 !! wikitext
13881 [[File:Foobar.jpg|2000px]]
13882
13883 [[File:Foobar.jpg|border|2000px]]
13884 !! html/php
13885 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
13886 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
13887 </p>
13888 !! html/parsoid
13889 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
13890 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
13891 !! end
13892
13893 !! test
13894 Image: "unspecified format" and border reduce
13895 !! options
13896 parsoid=wt2html,wt2wt,html2html
13897 !! wikitext
13898 [[File:Foobar.jpg|1000px]]
13899
13900 [[File:Foobar.jpg|border|1000px]]
13901 !! html/php
13902 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
13903 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
13904 </p>
13905 !! html/parsoid
13906 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13907 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13908 !! end
13909
13910 !! test
13911 Image: thumbs reduce
13912 !! options
13913 parsoid=wt2html,wt2wt,html2html
13914 !! wikitext
13915 [[File:Foobar.jpg|thumb|50px]]
13916 !! html/php
13917 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
13918
13919 !! html/parsoid
13920 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
13921 !! end
13922
13923 !! test
13924 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13925 !! options
13926 parsoid=wt2html,wt2wt,html2html
13927 !! wikitext
13928 [[File:Foobar.jpg|thumb|2000px]]
13929
13930 [[File:Foobar.svg|thumb|2000px]]
13931 !! html/php
13932 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
13933 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
13934
13935 !! html/parsoid
13936 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13937 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
13938 !! end
13939
13940 !! test
13941 Image: frameless can reduce in size
13942 !! options
13943 parsoid=wt2html,wt2wt,html2html
13944 !! wikitext
13945 [[File:Foobar.jpg|frameless|50px]]
13946 !! html/php
13947 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
13948 </p>
13949 !! html/parsoid
13950 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13951 !! end
13952
13953 !! test
13954 Image: bitmap frameless can't be enlarged past original size, but vector can
13955 !! options
13956 parsoid=wt2html,wt2wt,html2html
13957 !! wikitext
13958 [[File:Foobar.jpg|frameless|2000px]]
13959
13960 [[File:Foobar.svg|frameless|2000px]]
13961 !! html/php
13962 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13963 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
13964 </p>
13965 !! html/parsoid
13966 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13967 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
13968 !! end
13969
13970 !! test
13971 Image: framed images are always unscaled.
13972 !! options
13973 parsoid=wt2html,wt2wt,html2html
13974 !! wikitext
13975 [[File:Foobar.jpg|frame]]
13976
13977 [[File:Foobar.jpg|frame|50px]]
13978
13979 [[File:Foobar.jpg|frame|50x50px]]
13980
13981 [[File:Foobar.jpg|frame|2000px]]
13982 !! html/php
13983 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13984 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13985 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13986 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13987
13988 !! html/parsoid
13989 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13990 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13991 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13992 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13993 !! end
13994
13995 ###################
13996
13997 !! test
13998 Link to image page- image page normally doesn't exists, hence edit link
13999 Add test with existing image page
14000 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14001 !! wikitext
14002 [[:Image:test]]
14003 !! html
14004 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
14005 </p>
14006 !! end
14007
14008 !! test
14009 bug 18784 Link to non-existent image page with caption should use caption as link text
14010 !! wikitext
14011 [[:Image:test|caption]]
14012 !! html
14013 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
14014 </p>
14015 !! end
14016
14017 !! test
14018 Frameless image caption with a free URL
14019 !! wikitext
14020 [[File:Foobar.jpg|http://example.com]]
14021 !! html/php
14022 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14023 </p>
14024 !! html/parsoid
14025 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14026 !! end
14027
14028 !! test
14029 Thumbnail image caption with a free URL
14030 !! options
14031 thumbsize=220
14032 !! wikitext
14033 [[File:Foobar.jpg|thumb|http://example.com]]
14034 !! html/php
14035 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
14036
14037 !! html/parsoid
14038 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
14039 !! end
14040
14041 !! test
14042 Thumbnail image caption with a free URL and explicit alt
14043 !! options
14044 thumbsize=220
14045 parsoid=wt2html,wt2wt,html2html
14046 !! wikitext
14047 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14048 !! html/php
14049 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
14050
14051 !! html/parsoid
14052 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
14053 !! end
14054
14055 !! test
14056 SVG thumbnails with no language set
14057 !! options
14058 !! wikitext
14059 [[File:Foobar.svg|thumb|caption]]
14060 !! html/php
14061 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14062
14063 !! html/parsoid
14064 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14065 !! end
14066
14067 !! test
14068 SVG thumbnails with language de
14069 !! options
14070 parsoid=wt2html,wt2wt,html2html
14071 !! wikitext
14072 [[File:Foobar.svg|thumb|caption|lang=de]]
14073 !! html/php
14074 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14075
14076 !! html/parsoid
14077 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14078 !! end
14079
14080 !! test
14081 SVG thumbnails with invalid language code
14082 !! options
14083 parsoid=wt2html,wt2wt,html2html
14084 !! wikitext
14085 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14086 !! html/php
14087 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
14088
14089 !! html/parsoid
14090 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
14091 !! end
14092
14093 !! test
14094 BUG 1887: A ISBN with a thumbnail
14095 !! wikitext
14096 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14097 !! html/php
14098 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
14099
14100 !! html/parsoid
14101 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
14102 !! end
14103
14104 !! test
14105 BUG 1887: A RFC with a thumbnail
14106 !! wikitext
14107 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14108 !! html/php
14109 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
14110
14111 !! html/parsoid
14112 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
14113 !! end
14114
14115 !! test
14116 BUG 1887: A mailto link with a thumbnail
14117 !! wikitext
14118 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14119 !! html/php
14120 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
14121
14122 !! html/parsoid
14123 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
14124 !! end
14125
14126 # Pending resolution to bug 368
14127 !! test
14128 BUG 648: Frameless image caption with a link
14129 !! wikitext
14130 [[File:Foobar.jpg|text with a [[link]] in it]]
14131 !! html/php
14132 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14133 </p>
14134 !! html/parsoid
14135 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14136 !! end
14137
14138 !! test
14139 BUG 648: Frameless image caption with a link (suffix)
14140 !! wikitext
14141 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14142 !! html/php
14143 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14144 </p>
14145 !! html/parsoid
14146 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14147 !! end
14148
14149 !! test
14150 BUG 648: Frameless image caption with an interwiki link
14151 !! wikitext
14152 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14153 !! html/php
14154 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14155 </p>
14156 !! html/parsoid
14157 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14158 !! end
14159
14160 !! test
14161 BUG 648: Frameless image caption with a piped interwiki link
14162 !! wikitext
14163 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14164 !! html/php
14165 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14166 </p>
14167 !! html/parsoid
14168 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14169 !! end
14170
14171 !! test
14172 T107474: Frameless image caption with <nowiki>
14173 !! wikitext
14174 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14175 !! html/parsoid
14176 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14177 !! end
14178
14179 !! test
14180 Escape HTML special chars in image alt text
14181 !! wikitext
14182 [[File:Foobar.jpg|& < > "]]
14183 !! html/php
14184 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14185 </p>
14186 !! html/parsoid
14187 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14188 !! end
14189
14190 !! test
14191 Escape HTML special chars in image alt text with LanguageConverter
14192 !! options
14193 language=zh
14194 !! wikitext
14195 [[File:Foobar.jpg|& < > "]]
14196 !! html/php
14197 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14198 </p>
14199 !! html/parsoid
14200 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14201 !! end
14202
14203 !! test
14204 Entities in file name and attributes
14205 !! wikitext
14206 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14207 !! html/php
14208 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14209 </p>
14210 !! html/parsoid
14211 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14212 !! end
14213
14214 !! test
14215 BUG 499: Alt text should have &#1234;, not &amp;1234;
14216 !! wikitext
14217 [[File:Foobar.jpg|&#9792;]]
14218 !! html/php
14219 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14220 </p>
14221 !! html/parsoid
14222 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14223 !! end
14224
14225 !! test
14226 Broken image caption with link
14227 !! options
14228 parsoid=wt2html,wt2wt,html2html
14229 !! wikitext
14230 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14231 !! html/php
14232 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
14233 </p>
14234 !! html/parsoid
14235 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
14236 !! end
14237
14238 !! test
14239 Image caption containing another image
14240 !! wikitext
14241 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14242 !! html/php
14243 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
14244
14245 !! html/parsoid
14246 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
14247 !! end
14248
14249 !! test
14250 Image: caption containing a newline
14251 !! wikitext
14252 [[File:Foobar.jpg|This
14253 *is some text]]
14254 !! html/php
14255 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14256 </p>
14257 !! html/parsoid
14258 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14259 !!end
14260
14261 !!test
14262 Image: caption containing leading space
14263 (The leading space should not trigger nowiki escaping in wt2wt mode)
14264 !! wikitext
14265 [[File:Foobar.jpg|thumb| bar]]
14266 !! html/php
14267 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
14268
14269 !! html/parsoid
14270 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
14271 !!end
14272
14273 !! test
14274 Image: caption containing a table
14275 !! options
14276 parsoid=wt2html,wt2wt,html2html
14277 !! wikitext
14278 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14279 {|
14280 ! Foo !! Bar
14281 |-
14282 | Foo1 || Bar1
14283 |}
14284 and some more text.]]
14285 !! html/php
14286 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
14287
14288 !! html/parsoid
14289 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
14290 <table>
14291 <tbody>
14292 <tr><th>Foo </th><th>Bar</th></tr>
14293 <tr>
14294 <td>Foo1 </td>
14295 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14296 !! end
14297
14298 !! test
14299 Bug 3090: External links other than http: in image captions
14300 !! wikitext
14301 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14302 !! html/php
14303 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
14304
14305 !! html/parsoid
14306 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
14307 !! end
14308
14309 !! test
14310 Custom class
14311 !! options
14312 parsoid=wt2html,wt2wt,html2html
14313 !! wikitext
14314 [[Image:foobar.jpg|a|class=b]]
14315 !! html/php
14316 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
14317 </p>
14318 !! html/parsoid
14319 <p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14320 !! end
14321
14322 !! test
14323 Localized image handling (1).
14324 !! options
14325 parsoid=wt2html,wt2wt,html2html
14326 language=es
14327 !! wikitext
14328 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14329 !! html/php
14330 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14331
14332 !! html/parsoid
14333 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14334 !! end
14335
14336 !! test
14337 Localized image handling (2).
14338 !! options
14339 thumbsize=220
14340 parsoid=wt2html,wt2wt,html2html
14341 language=es
14342 !! wikitext
14343 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14344 !! html/php
14345 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
14346
14347 !! html/parsoid
14348 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14349 !! end
14350
14351 !! test
14352 Localized image handling (3).
14353 !! options
14354 language=fa
14355 parsoid=html2wt
14356 !! html/parsoid
14357 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
14358 !! wikitext
14359 [[File:Foobar.jpg|بندانگشتی]]
14360 !! end
14361
14362 !! test
14363 "border", "frameless" and "class" attributes on an image.
14364 !! options
14365 thumbsize=220
14366 parsoid=wt2html,wt2wt,html2html
14367 !! wikitext
14368 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14369 !! html/php
14370 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
14371 </p>
14372 !! html/parsoid
14373 <p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
14374 !! end
14375
14376 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14377 !! test
14378 Invalid image attributes (bug 62500)
14379 !! options
14380 thumbsize=220
14381 parsoid=wt2html,wt2wt,html2html
14382 !! wikitext
14383 [[File:Foobar.jpg|thumb|float|left|caption]]
14384
14385 [[File:Foobar.jpg|thumb|righ|caption]]
14386
14387 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14388 !! html/php
14389 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14390 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14391 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14392
14393 !! html/parsoid
14394 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14395 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14396 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14397 !! end
14398
14399 !! article
14400 File:Barfoo.jpg
14401 !! text
14402 #REDIRECT [[File:Barfoo.jpg]]
14403 !! endarticle
14404
14405 # FIXME: Parsoid should run this test -- but we'd need to teach the
14406 # mockAPI about the redirected Barfoo.jpg image.
14407 !! test
14408 Redirected image
14409 !! wikitext
14410 [[Image:Barfoo.jpg]]
14411 !! html/php
14412 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14413 </p>
14414 !! end
14415
14416 !! test
14417 Missing image with uploads disabled
14418 !! options
14419 wgEnableUploads=0
14420 !! wikitext
14421 [[File:Foobaz.jpg]]
14422 !! html/php
14423 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14424 </p>
14425 !! html/parsoid
14426 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
14427 !! end
14428
14429 # Parsoid-specific testing for images
14430 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14431 # Currently imperfect due to a flaw in the Parsoid testrunner
14432 # Work in progress
14433 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14434 # image tests.
14435
14436 !! test
14437 Parsoid-specific image handling - simple image with size and middle alignment
14438 !! wikitext
14439 [[File:Foobar.jpg|middle|50px]]
14440 !! html/parsoid
14441 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14442 !! end
14443
14444 !! test
14445 Parsoid-specific image handling - simple image with size, middle alignment,
14446 non-standard namespace alias
14447 !! options
14448 parsoid=wt2wt,wt2html,html2html
14449 !! wikitext
14450 [[Image:Foobar.jpg|middle|50px]]
14451 !! html/parsoid
14452 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14453 !! end
14454
14455 !! test
14456 Parsoid-specific image handling - simple image with size and middle alignment
14457 (existing content)
14458 !! wikitext
14459 [[File:Foobar.jpg|50px|middle]]
14460 !! html/parsoid
14461 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14462 !! end
14463
14464 !! test
14465 Parsoid-specific image handling - simple image with size and middle alignment
14466 and non-standard namespace name
14467 !! options
14468 parsoid=wt2html,wt2wt,html2html
14469 !! wikitext
14470 [[Image:Foobar.jpg|50px|middle]]
14471 !! html/parsoid
14472 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14473 !! end
14474
14475 !! test
14476 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14477 !! wikitext
14478 [[File:Foobar.jpg|500x10px|baseline|caption]]
14479 !! html/parsoid
14480 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14481 !! end
14482
14483 !! test
14484 Parsoid-specific image handling - simple image with border and size spec
14485 !! wikitext
14486 [[File:Foobar.jpg|50px|border|caption]]
14487 !! html/parsoid
14488 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14489 !! end
14490
14491 !! test
14492 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14493 !! wikitext
14494 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14495 !! html/parsoid
14496 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
14497 !! end
14498
14499 !! test
14500 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14501 (existing content)
14502 !! wikitext
14503 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14504 !! html/parsoid
14505 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
14506 !! end
14507
14508 !! test
14509 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14510 !! wikitext
14511 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14512 !! html/parsoid
14513 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
14514 !! end
14515
14516 !! test
14517 Parsoid-specific image handling - thumbnail with specific size, halign,
14518 valign, and caption (existing content)
14519 !! wikitext
14520 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14521 !! html/parsoid
14522 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
14523 !! end
14524
14525 !! test
14526 Parsoid-specific image handling - framed image with specific size and caption
14527 (size is ignored)
14528 !! options
14529 parsoid=wt2html,wt2wt,html2html
14530 !! wikitext
14531 [[File:Foobar.jpg|frame|500x50px|caption]]
14532 !! html/parsoid
14533 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14534 !! end
14535
14536 !! test
14537 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14538 (size is ignored)
14539 !! options
14540 parsoid=wt2html,wt2wt,html2html
14541 !! wikitext
14542 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14543 !! html/parsoid
14544 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14545 !! end
14546
14547 !! test
14548 Parsoid-specific image handling - frameless image with specific size, border, and caption
14549 !! wikitext
14550 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14551 !! html/parsoid
14552 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14553 !! end
14554
14555 !! test
14556 Parsoid-specific image handling - simple image with a formatted caption
14557 !! wikitext
14558 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14559 !! html/parsoid
14560 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14561 !! end
14562
14563 !! test
14564 Parsoid-specific image handling - caption with a template in it
14565 !! wikitext
14566 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14567 !! html/parsoid
14568 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
14569 !! end
14570
14571 !! test
14572 Parsoid-specific image handling - caption with unbalanced tags in it
14573 !! options
14574 parsoid=wt2html,wt2wt,html2html
14575 !! wikitext
14576 foo
14577 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14578 bar
14579 !! html/parsoid
14580 <p>foo</p>
14581 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
14582 <p>bar</p>
14583 !! end
14584
14585 !! test
14586 Parsoid-specific image handling - empty caption (1)
14587 !! options
14588 parsoid=wt2html,wt2wt
14589 !! wikitext
14590 [[File:Foobar.jpg|thumb|]]
14591 !! html/parsoid
14592 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
14593 !! end
14594
14595 # empty captions don't get serialized unless we're in the "round trip" case
14596 !! test
14597 Parsoid-specific image handling - empty caption (2)
14598 !! options
14599 parsoid=html2wt
14600 !! html/parsoid
14601 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14602 <a href="./File:Foobar.jpg">
14603 <img resource="./File:Foobar.jpg"
14604 src="//example.com/images/3/3a/Foobar.jpg"
14605 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14606 height="25" width="220"/>
14607 </a>
14608 <figcaption></figcaption>
14609 </figure>
14610 !! wikitext
14611 [[File:Foobar.jpg|thumb]]
14612 !! end
14613
14614 !! test
14615 Parsoid-specific image handling - whitespace caption
14616 !! wikitext
14617 [[File:Foobar.jpg|thumb| ]]
14618 !! html/parsoid
14619 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
14620 !! end
14621
14622 !! test
14623 Parsoid-specific image handling - lang option
14624 !! wikitext
14625 foo
14626 [[File:Foobar.svg|lang=de|caption]]
14627 bar
14628 !! html/parsoid
14629 <p>foo
14630 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
14631 bar</p>
14632 !! end
14633
14634 ## Edge case bugs in Parsoid from T93580
14635 !! test
14636 T93580: 1. Templated <ref> inside block images
14637 !! wikitext
14638 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14639
14640 <references />
14641 !! html/parsoid
14642 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14643
14644 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14645 !! end
14646
14647 !! test
14648 T93580: 2. <ref> inside inline images
14649 !! wikitext
14650 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14651
14652 <references />
14653 !! html/parsoid
14654 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14655
14656 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14657 !! end
14658
14659 !! test
14660 T93580: 3. Templated <ref> inside inline images
14661 !! wikitext
14662 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14663
14664 <references />
14665 !! html/parsoid
14666 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14667
14668 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14669 !! end
14670
14671 ###
14672 ### Subpages
14673 ###
14674 !! article
14675 Subpage test/subpage
14676 !! text
14677 foo
14678 !! endarticle
14679
14680 !! test
14681 Subpage link
14682 !! options
14683 subpage title=[[Subpage test]]
14684 !! wikitext
14685 [[/subpage]]
14686 !! html
14687 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14688 </p>
14689 !! end
14690
14691 !! test
14692 Subpage noslash link
14693 !! options
14694 subpage title=[[Subpage test]]
14695 !! wikitext
14696 [[/subpage/]]
14697 !! html
14698 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14699 </p>
14700 !! end
14701
14702 !! article
14703 Subpage test/1/2/subpage
14704 !! text
14705 blah
14706 !! endarticle
14707
14708 !! test
14709 Relative subpage noslash link
14710 !! options
14711 parsoid=wt2wt,wt2html,html2html
14712 subpage title=[[Subpage test/1/2/3/4]]
14713 !! wikitext
14714 [[../../subpage/]]
14715
14716 [[../../subpage]]
14717 !! html/php
14718 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14719 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14720 </p>
14721 !! html/parsoid
14722 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14723 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14724 !! end
14725
14726 !! test
14727 Parsoid: dot-slash prefixed wikilinks
14728 !! wikitext
14729 [[./foo]]
14730
14731 [[././bar]]
14732
14733 [[././baz/]]
14734 !! html/php
14735 <p>[[./foo]]
14736 </p><p>[[././bar]]
14737 </p><p>[[././baz/]]
14738 </p>
14739 !! html/parsoid
14740 <p>[[./foo]]
14741 </p><p>[[././bar]]
14742 </p><p>[[././baz/]]
14743 </p>
14744 !! end
14745
14746 !! test
14747 Render invalid page names as plain text (bug 51090)
14748 !! wikitext
14749 [[./../foo|bar]]
14750 [[foo�|bar]]
14751 [[foo/.|bar]]
14752 [[foo/..|bar]]
14753 [[foo~~~bar]]
14754 [[foo>bar]]
14755 [[foo[bar]]
14756 [[.]]
14757 [[..]]
14758 [[foo././bar]]
14759
14760 [[{{echo|./../foo}}|bar]]
14761 [[{{echo|foo/.}}|bar]]
14762 [[{{echo|foo/..}}|bar]]
14763 [[{{echo|foo~~~~bar}}]]
14764 [[{{echo|foo>bar}}]]
14765 [[{{echo|foo././bar}}]]
14766 [[{{echo|foo{bar}}]]
14767 [[{{echo|foo}bar}}]]
14768 [[{{echo|foo[bar}}]]
14769 [[{{echo|foo]bar}}]]
14770 [[{{echo|foo<bar}}]]
14771 !!html/php
14772 <p>[[./../foo|bar]]
14773 [[foo�|bar]]
14774 [[foo/.|bar]]
14775 [[foo/..|bar]]
14776 [[foo~~~bar]]
14777 [[foo&gt;bar]]
14778 [[foo[bar]]
14779 [[.]]
14780 [[..]]
14781 [[foo././bar]]
14782 </p><p>[[./../foo|bar]]
14783 [[foo/.|bar]]
14784 [[foo/..|bar]]
14785 [[foo~~~~bar]]
14786 [[foo&gt;bar]]
14787 [[foo././bar]]
14788 [[foo{bar]]
14789 [[foo}bar]]
14790 [[foo[bar]]
14791 [[foo]bar]]
14792 [[foo&lt;bar]]
14793 </p>
14794 !!html/parsoid
14795 <p>[[./../foo|bar]]
14796 [[foo�|bar]]
14797 [[foo/.|bar]]
14798 [[foo/..|bar]]
14799 [[foo~~~bar]]
14800 [[foo>bar]]
14801 [[foo[bar]]
14802 [[.]]
14803 [[..]]
14804 [[foo././bar]]</p>
14805
14806 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14807 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14808 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14809 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14810 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14811 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14812 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14813 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14814 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14815 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14816 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14817 !!end
14818
14819 !! test
14820 Disabled subpages
14821 !! wikitext
14822 [[/subpage]]
14823 !! html
14824 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14825 </p>
14826 !! end
14827
14828 !! test
14829 BUG 561: {{/Subpage}}
14830 !! options
14831 subpage title=[[Page]]
14832 !! wikitext
14833 {{/Subpage}}
14834 !! html
14835 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
14836 </p>
14837 !! end
14838
14839 ###
14840 ### Categories
14841 ###
14842 !! article
14843 Category:MediaWiki User's Guide
14844 !! text
14845 blah
14846 !! endarticle
14847
14848 !! test
14849 Link to category
14850 !! wikitext
14851 [[:Category:MediaWiki User's Guide]]
14852 !! html
14853 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14854 </p>
14855 !! end
14856
14857 !! test
14858 Simple category
14859 !! options
14860 cat
14861 !! wikitext
14862 [[Category:MediaWiki User's Guide]]
14863 !! html/php
14864 cat=MediaWiki_User's_Guide sort=
14865 !! html/parsoid
14866 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14867 !! end
14868
14869 !! test
14870 PAGESINCATEGORY invalid title fatal (r33546 fix)
14871 !! wikitext
14872 {{PAGESINCATEGORY:<bogus>}}
14873 !! html
14874 <p>0
14875 </p>
14876 !! end
14877
14878 !! test
14879 Category with different sort key
14880 !! options
14881 cat
14882 !! wikitext
14883 [[Category:MediaWiki User's Guide|Foo]]
14884 !! html/php
14885 cat=MediaWiki_User's_Guide sort=Foo
14886 !! html/parsoid
14887 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14888 !! end
14889
14890 !! test
14891 Category with identical sort key
14892 !! options
14893 cat
14894 !! wikitext
14895 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14896 !! html/php
14897 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14898 !! html/parsoid
14899 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14900 !! end
14901
14902 !! test
14903 Category with empty sort key
14904 !! options
14905 cat
14906 pst
14907 !! wikitext
14908 [[Category:MediaWiki User's Guide|]]
14909 !! html/php
14910 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14911 !! end
14912
14913 !! test
14914 Category with empty sort key and parentheses
14915 !! options
14916 cat
14917 pst
14918 !! wikitext
14919 [[Category:Foo (bar)|]]
14920 !! html/php
14921 [[Category:Foo (bar)|Foo]]
14922 !! end
14923
14924 !! test
14925 Category with link tail
14926 !! options
14927 cat
14928 pst
14929 !! wikitext
14930 123[[Category:Foo]]456
14931 !! html/php
14932 123[[Category:Foo]]456
14933 !! end
14934
14935 !! test
14936 Category with template
14937 !! options
14938 cat
14939 pst
14940 !! wikitext
14941 [[Category:{{echo|Foo}}]]
14942 !! html/php
14943 [[Category:{{echo|Foo}}]]
14944 !! end
14945
14946 !! test
14947 Category with template in sort key
14948 !! options
14949 cat
14950 pst
14951 !! wikitext
14952 [[Category:Foo|{{echo|Bar}}]]
14953 !! html/php
14954 [[Category:Foo|{{echo|Bar}}]]
14955 !! end
14956
14957 !! test
14958 Category with template in sort key and title
14959 !! options
14960 cat
14961 pst
14962 !! wikitext
14963 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14964 !! html/php
14965 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14966 !! end
14967
14968 ## We used to, but no longer wt2wt this test since the default serializer
14969 ## will normalize all categories to serialize on their own line.
14970 ## This wikitext usage is going to be fairly uncommon in production and
14971 ## selser will take care of preserving formatting in those scenarios.
14972 !! test
14973 Category / paragraph interactions
14974 !! options
14975 parsoid=wt2html
14976 !! wikitext
14977 Foo [[Category:Baz]] Bar
14978
14979 Foo [[Category:Baz]]
14980 Bar
14981
14982 Foo
14983 [[Category:Baz]]
14984 Bar
14985
14986 Foo
14987 [[Category:Baz]] Bar
14988
14989 Foo
14990 [[Category:Baz]]
14991 [[Category:Baz]]
14992 [[Category:Baz]]
14993 Bar
14994
14995 [[Category:Baz]]
14996 [[Category:Baz]]
14997 [[Category:Baz]]
14998
14999 [[Category:Baz]]
15000 {{echo|[[Category:Baz]]}}
15001 [[Category:Baz]]
15002 !! html/php
15003 <p>Foo Bar
15004 </p><p>Foo
15005 Bar
15006 </p><p>Foo
15007 Bar
15008 </p><p>Foo Bar
15009 </p><p>Foo
15010 Bar
15011 </p>
15012 !! html/parsoid
15013 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15014 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15015 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15016 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15017 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
15018 <link rel="mw:PageProp/Category" href="Category:Baz"/>
15019 !! end
15020
15021 ## We used to, but no longer wt2wt this test since the default serializer
15022 ## will normalize all categories to serialize on their own line.
15023 ## This wikitext usage is going to be fairly uncommon in production and
15024 ## selser will take care of preserving formatting in those scenarios.
15025 ##
15026 ## The whitespace on the empty line is part of the test. Please do not delete
15027 !! test
15028 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15029 !! options
15030 parsoid=wt2html
15031 !! wikitext
15032 This
15033
15034 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15035
15036 {{echo|[[Category:Foo]] and so should this!}}
15037 !! html/php
15038 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15039 </p>
15040 !! html/parsoid
15041 <p>This
15042
15043 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15044
15045 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
15046 !! end
15047
15048 ## Parsoid will not try to wt2wt this while preserving newlines because
15049 ## it suppresses excess newlines within list items -- and we don't want to
15050 ## introduce a special case just for categories, which is, in reality somewhat
15051 ## odd behavior -- categories are unlikely to be used in list items like this
15052 ## in top-level pages and are only likely to show up in template-generated
15053 ## list items where this RT-ing is a non-issue.
15054 ##
15055 ## The whitespace on the empty line is part of the test. Please do not delete
15056 !! test
15057 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15058 !! options
15059 parsoid=wt2html
15060 !! wikitext
15061 * This
15062
15063 [[Category:Foo]] and this should be part of the same list item
15064 * So should this
15065
15066 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15067 !! html
15068 <ul><li>This and this should be part of the same list item</li>
15069 <li>So should this and this should be part of the same list item</li></ul>
15070 !! html/parsoid
15071 <ul>
15072 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15073 <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
15074 </ul>
15075 !! end
15076
15077 ## Newlines and categories that follow the last item of a list
15078 ## are treated differently because this (list followed by categories)
15079 ## is an extremely common pattern on wikis.
15080 !! test
15081 3. Categories and newlines: newline suppression for last list item should RT properly
15082 !! wikitext
15083 * a
15084 * b
15085
15086 [[Category:Foo]]
15087
15088 [[Category:Bar]]
15089 [[Category:Baz]]
15090 !! html/parsoid
15091 <ul><li> a</li>
15092 <li> b</li></ul>
15093
15094 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15095
15096 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15097 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15098 !! end
15099
15100 !! test
15101 4. Categories and newlines: newline suppression for last list item should RT properly
15102 !! wikitext
15103 * a
15104 **** b
15105
15106 [[Category:Foo]]
15107 !! html/parsoid
15108 <ul><li> a
15109 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15110
15111 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15112 !! end
15113
15114 ## only wt2html for this to make sure the algo only applies to the rightmost path
15115 !! test
15116 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15117 !! options
15118 parsoid=wt2html
15119 !! wikitext
15120 * a
15121 ** b
15122 [[Category:Foo]]
15123 * c
15124 ** d
15125 [[Category:Foo]]
15126 !! html/parsoid
15127 <ul><li> a
15128 <ul><li> b
15129 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15130 <li> c
15131 <ul><li> d</li></ul></li></ul>
15132 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15133 !! end
15134
15135 ## We used to, but no longer wt2wt this test since the default serializer
15136 ## will normalize all categories to serialize on their own line.
15137 ## This wikitext usage is going to be fairly uncommon in production and
15138 ## selser will take care of preserving formatting in those scenarios.
15139 !! test
15140 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15141 !! options
15142 parsoid=wt2html
15143 !! wikitext
15144 * a [[Category:Foo]]
15145 !! html/parsoid
15146 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
15147 !! end
15148
15149 # This test also demonstrates because of newline+category tunneling
15150 # through the list hander, template wrapping doesn't expand to the
15151 # containing list when the list item swallows the category.
15152 !! test
15153 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15154 !! wikitext
15155 * {{echo|a
15156 [[Category:Foo]]}}
15157 !! html/parsoid
15158 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
15159 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
15160 !! end
15161
15162 !! test
15163 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15164 !! wikitext
15165 * a
15166
15167 {{echo|[[Category:Foo]]
15168 [[Category:Bar]]}}
15169 [[Category:Baz]]
15170 !! html/parsoid
15171 <ul><li> a</li></ul>
15172
15173 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
15174 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15175 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15176 !! end
15177
15178 !! test
15179 Category links with multiple namespaces
15180 !! wikitext
15181 [[Category:Project:Foo]]
15182 !! html/parsoid
15183 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15184 !! end
15185
15186 !! test
15187 Parsoid: Serialize link to category page with colon escape
15188 !! options
15189 parsoid
15190 !! wikitext
15191
15192 [[:Category:Foo]]
15193 [[:Category:Foo|Bar]]
15194 !! html
15195 <p>
15196 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15197 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15198 </p>
15199 !! end
15200
15201 # We used to, but no longer wt2wt this test since the default serializer
15202 # will normalize all categories to serialize on their own line.
15203 # This wikitext usage is going to be fairly uncommon in production and
15204 # selser will take care of preventing whitespace insertion if this
15205 # occurs in an article.
15206 #
15207 # html2html disabled for the same reason (whitespace insertion between
15208 # x and y).
15209 #
15210 # html2wt disabled because it localizes the "Category" namespace.
15211 !! test
15212 Link prefix/suffixes aren't applied to category links
15213 !! options
15214 parsoid=wt2html
15215 language=is
15216 !! wikitext
15217 x[[Category:Foo]]y
15218 !! html/php
15219 <p>xy
15220 </p>
15221 !! html/parsoid
15222 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15223 !! end
15224
15225 !! test
15226 Parsoid: Serialize link to file page with colon escape
15227 !! options
15228 parsoid
15229 !! wikitext
15230
15231 [[:File:Foo.png]]
15232 [[:File:Foo.png|Bar]]
15233 !! html
15234 <p>
15235 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15236 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15237 </p>
15238 !! end
15239
15240 !! test
15241 Parsoid: Serialize a genuine category link without colon escape
15242 !! options
15243 parsoid
15244 !! wikitext
15245 [[Category:Foo]]
15246 [[Category:Foo|Bar]]
15247 !! html
15248 <link rel="mw:PageProp/Category" href="./Category:Foo">
15249 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15250 !! end
15251
15252 !! test
15253 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15254 !! options
15255 parsoid=html2wt
15256 !! html/parsoid
15257 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15258 !! wikitext
15259 [[Category:Toxine bactérienne]]
15260 !! end
15261
15262 !! test
15263 Parsoid: Defaultsort
15264 !! wikitext
15265 {{DEFAULTSORT:Foo}}
15266 !! html/parsoid
15267 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15268 !! end
15269
15270 !! test
15271 Parsoid: Defaultsort (template-generated)
15272 !! wikitext
15273 {{{{echo|DEFAULTSORT}}:Foo}}
15274 !! html/parsoid
15275 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15276 !! end
15277
15278 ###
15279 ### Inter-language links
15280 ###
15281 !! test
15282 Interlanguage links
15283 !! options
15284 ill
15285 !! wikitext
15286 [[es:Alimento]]
15287 [[fr:Nourriture]]
15288 [[zh:食品]]
15289 !! html/php
15290 es:Alimento fr:Nourriture zh:食品
15291 !! html/parsoid
15292 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15293 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15294 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15295 !! end
15296
15297 !! test
15298 Duplicate interlanguage links (bug 24502)
15299 !! options
15300 ill
15301 !! wikitext
15302 [[es:1]]
15303 [[es:2]]
15304 [[fr:1]]
15305 [[fr:2]]
15306 !! html/php
15307 es:1 fr:1
15308 !! html/parsoid
15309 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15310 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15311 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15312 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15313 !! end
15314
15315 ###
15316 ### Sections
15317 ###
15318 !! test
15319 Basic section headings
15320 !! wikitext
15321 == Headline 1 ==
15322 Some text
15323
15324 ==Headline 2==
15325 More
15326 ===Smaller headline===
15327 Blah blah
15328 !! html
15329 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15330 <p>Some text
15331 </p>
15332 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15333 <p>More
15334 </p>
15335 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15336 <p>Blah blah
15337 </p>
15338 !! end
15339
15340 !! test
15341 Section headings with TOC
15342 !! wikitext
15343 == Headline 1 ==
15344 === Subheadline 1 ===
15345 ===== Skipping a level =====
15346 ====== Skipping a level ======
15347
15348 == Headline 2 ==
15349 Some text
15350 ===Another headline===
15351 !! html
15352 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15353 <ul>
15354 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15355 <ul>
15356 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15357 <ul>
15358 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
15359 <ul>
15360 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
15361 </ul>
15362 </li>
15363 </ul>
15364 </li>
15365 </ul>
15366 </li>
15367 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15368 <ul>
15369 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15370 </ul>
15371 </li>
15372 </ul>
15373 </div>
15374
15375 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15376 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15377 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
15378 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15379 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15380 <p>Some text
15381 </p>
15382 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15383
15384 !! end
15385
15386 !! test
15387 TOC anchors don't collide
15388 !! wikitext
15389 __FORCETOC__
15390 == Headline 2 ==
15391 == Headline ==
15392 == Headline 2 ==
15393 == Headline ==
15394 !! html/php
15395 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15396 <ul>
15397 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15398 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15399 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15400 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15401 </ul>
15402 </div>
15403
15404 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15405 <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15406 <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15407 <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15408
15409 !! end
15410
15411 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15412 !! test
15413 Handling of sections up to level 6 and beyond
15414 !! wikitext
15415 = Level 1 Heading=
15416 == Level 2 Heading==
15417 === Level 3 Heading===
15418 ==== Level 4 Heading====
15419 ===== Level 5 Heading=====
15420 ====== Level 6 Heading======
15421 ======= Level 7 Heading=======
15422 ======== Level 8 Heading========
15423 ========= Level 9 Heading=========
15424 ========== Level 10 Heading==========
15425 !! html
15426 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15427 <ul>
15428 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15429 <ul>
15430 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
15431 <ul>
15432 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
15433 <ul>
15434 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
15435 <ul>
15436 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
15437 <ul>
15438 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
15439 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
15440 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
15441 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
15442 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
15443 </ul>
15444 </li>
15445 </ul>
15446 </li>
15447 </ul>
15448 </li>
15449 </ul>
15450 </li>
15451 </ul>
15452 </li>
15453 </ul>
15454 </div>
15455
15456 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15457 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15458 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15459 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15460 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
15461 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15462 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15463 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15464 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15465 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
15466
15467 !! end
15468
15469 !! test
15470 TOC regression (T11764)
15471 !! wikitext
15472 == title 1 ==
15473 === title 1.1 ===
15474 ==== title 1.1.1 ====
15475 === title 1.2 ===
15476 == title 2 ==
15477 === title 2.1 ===
15478 !! html
15479 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15480 <ul>
15481 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15482 <ul>
15483 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
15484 <ul>
15485 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
15486 </ul>
15487 </li>
15488 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
15489 </ul>
15490 </li>
15491 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15492 <ul>
15493 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
15494 </ul>
15495 </li>
15496 </ul>
15497 </div>
15498
15499 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15500 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15501 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15502 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15503 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15504 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15505
15506 !! end
15507
15508 !! test
15509 TOC for heading containing <span id="..."></span> (T96153)
15510 !! wikitext
15511 __FORCETOC__
15512 ==<span id="old-anchor"></span>New title==
15513 !! html/php
15514 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15515 <ul>
15516 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15517 </ul>
15518 </div>
15519
15520 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15521
15522 !! end
15523
15524 !! test
15525 TOC with wgMaxTocLevel=3 (bug 6204)
15526 !! options
15527 wgMaxTocLevel=3
15528 !! wikitext
15529 == title 1 ==
15530 === title 1.1 ===
15531 ==== title 1.1.1 ====
15532 === title 1.2 ===
15533 == title 2 ==
15534 === title 2.1 ===
15535 !! html
15536 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15537 <ul>
15538 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15539 <ul>
15540 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
15541 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
15542 </ul>
15543 </li>
15544 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15545 <ul>
15546 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
15547 </ul>
15548 </li>
15549 </ul>
15550 </div>
15551
15552 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15553 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15554 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15555 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15556 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15557 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15558
15559 !! end
15560
15561 !! test
15562 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15563 !! options
15564 wgMaxTocLevel=3
15565 !! wikitext
15566 ==Section 1==
15567 ===Section 1.1===
15568 ====Section 1.1.1====
15569 ====Section 1.1.1.1====
15570 ==Section 2==
15571 !! html
15572 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15573 <ul>
15574 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15575 <ul>
15576 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
15577 </ul>
15578 </li>
15579 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15580 </ul>
15581 </div>
15582
15583 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15584 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15585 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15586 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
15587 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15588
15589 !! end
15590
15591
15592 !! test
15593 Resolving duplicate section names
15594 !! wikitext
15595 == Foo bar ==
15596 == Foo bar ==
15597 !! html
15598 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15599 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15600
15601 !! end
15602
15603 !! test
15604 Resolving duplicate section names with differing case (bug 10721)
15605 !! wikitext
15606 == Foo bar ==
15607 == Foo Bar ==
15608 !! html
15609 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15610 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15611
15612 !! end
15613
15614 !! article
15615 Template:sections
15616 !! text
15617 ===Section 1===
15618 ==Section 2==
15619 !! endarticle
15620
15621 !! test
15622 Template with sections, __NOTOC__
15623 !! wikitext
15624 __NOTOC__
15625 ==Section 0==
15626 {{sections}}
15627 ==Section 4==
15628 !! html
15629 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15630 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15631 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15632 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15633
15634 !! end
15635
15636 !! test
15637 __NOEDITSECTION__ keyword
15638 !! wikitext
15639 __NOEDITSECTION__
15640 ==Section 1==
15641 ==Section 2==
15642 !! html
15643 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15644 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15645
15646 !! end
15647
15648 !! test
15649 Link inside a section heading
15650 !! wikitext
15651 ==Section with a [[Main Page|link]] in it==
15652 !! html
15653 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15654
15655 !! end
15656
15657 !! test
15658 TOC regression (T14077)
15659 !! wikitext
15660 __TOC__
15661 == title 1 ==
15662 === title 1.1 ===
15663 == title 2 ==
15664 !! html
15665 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15666 <ul>
15667 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15668 <ul>
15669 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
15670 </ul>
15671 </li>
15672 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15673 </ul>
15674 </div>
15675
15676 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15677 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15678 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15679
15680 !! end
15681
15682 !! test
15683 BUG 1219 URL next to image (good)
15684 !! wikitext
15685 http://example.com [[File:Foobar.jpg]]
15686 !! html/php
15687 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15688 </p>
15689 !! html/parsoid
15690 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15691 !!end
15692
15693 !! test
15694 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15695 !! wikitext
15696 ===
15697 The line above must have a trailing space!
15698 === <!--
15699 --> <!-- -->
15700 But just in case it doesn't...
15701 !! html
15702 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15703 <p>The line above must have a trailing space!
15704 </p>
15705 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15706 <p>But just in case it doesn't...
15707 </p>
15708 !! end
15709
15710 !! test
15711 Header with special characters (bug 25462)
15712 !! wikitext
15713 The tooltips shall not show entities to the user (ie. be double escaped)
15714
15715 == text > text ==
15716 section 1
15717
15718 == text < text ==
15719 section 2
15720
15721 == text & text ==
15722 section 3
15723
15724 == text ' text ==
15725 section 4
15726
15727 == text " text ==
15728 section 5
15729 !! html
15730 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15731 </p>
15732 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15733 <ul>
15734 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
15735 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
15736 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
15737 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15738 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15739 </ul>
15740 </div>
15741
15742 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15743 <p>section 1
15744 </p>
15745 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15746 <p>section 2
15747 </p>
15748 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15749 <p>section 3
15750 </p>
15751 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15752 <p>section 4
15753 </p>
15754 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15755 <p>section 5
15756 </p>
15757 !! end
15758
15759 !! test
15760 Header with space, plus and underscore as entity
15761 !! wikitext
15762 Id should not contain + for spaces
15763
15764 == Space between Text ==
15765 section 1
15766
15767 == Space-Entity&#32;between&#32;Text ==
15768 section 2
15769
15770 == Plus+between+Text ==
15771 section 3
15772
15773 == Plus-Entity&#43;between&#43;Text ==
15774 section 4
15775
15776 == Underscore_between_Text ==
15777 section 5
15778
15779 == Underscore-Entity&#95;between&#95;Text ==
15780 section 6
15781
15782 [[#Space between Text]]
15783 [[#Space-Entity&#32;between&#32;Text]]
15784 [[#Plus+between+Text]]
15785 [[#Plus-Entity&#43;between&#43;Text]]
15786 [[#Underscore_between_Text]]
15787 [[#Underscore-Entity&#95;between&#95;Text]]
15788 !! html
15789 <p>Id should not contain + for spaces
15790 </p>
15791 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15792 <ul>
15793 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
15794 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
15795 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
15796 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
15797 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
15798 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
15799 </ul>
15800 </div>
15801
15802 <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15803 <p>section 1
15804 </p>
15805 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15806 <p>section 2
15807 </p>
15808 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15809 <p>section 3
15810 </p>
15811 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15812 <p>section 4
15813 </p>
15814 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15815 <p>section 5
15816 </p>
15817 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15818 <p>section 6
15819 </p><p><a href="#Space_between_Text">#Space between Text</a>
15820 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15821 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15822 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15823 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15824 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15825 </p>
15826 !! end
15827
15828 !! test
15829 Headers with excess '=' characters
15830 (Are similar tests necessary beyond the 1st level?)
15831 !! wikitext
15832 =foo==
15833 ==foo=
15834 =''italic'' heading==
15835 ==''italic'' heading=
15836 !! html
15837 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15838 <ul>
15839 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15840 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15841 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
15842 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
15843 </ul>
15844 </div>
15845
15846 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15847 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15848 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15849 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
15850
15851 !! end
15852
15853 !! test
15854 HTML headers vs TOC (bug 23393)
15855 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15856 !! wikitext
15857 <h1>Header 1</h1>
15858 == Header 1.1 ==
15859 == Header 1.2 ==
15860
15861 <h1>Header 2
15862 </h1>
15863 == Header 2.1 ==
15864 == Header 2.2 ==
15865 __NOEDITSECTION__
15866 !! html
15867 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15868 <ul>
15869 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15870 <ul>
15871 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
15872 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
15873 </ul>
15874 </li>
15875 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15876 <ul>
15877 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
15878 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
15879 </ul>
15880 </li>
15881 </ul>
15882 </div>
15883
15884 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15885 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15886 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15887 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15888 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15889 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15890
15891 !! end
15892
15893 !! test
15894 Single-line or multiline-comments can follow headings
15895 !! options
15896 parsoid=wt2html,wt2wt
15897 !! wikitext
15898 ==foo==<!---->
15899 ==bar==<!--c1-->
15900 ==baz==<!--
15901 c2
15902 c3-->
15903 !! html
15904 <h2><span class="mw-headline" id="foo">foo</span></h2>
15905 <h2><span class="mw-headline" id="bar">bar</span></h2>
15906 <h2><span class="mw-headline" id="baz">baz</span></h2>
15907
15908 !! end
15909
15910 !! test
15911 BUG 1219 URL next to image (broken)
15912 !! wikitext
15913 http://example.com[[File:Foobar.jpg]]
15914 !! html/php
15915 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15916 </p>
15917 !! html/parsoid
15918 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15919 !!end
15920
15921 !! test
15922 Bug 1186 news: in the middle of text
15923 !! wikitext
15924 http://en.wikinews.org/wiki/Wikinews:Workplace
15925 !! html
15926 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15927 </p>
15928 !!end
15929
15930
15931 !! test
15932 Namespaced link must have a title
15933 !! wikitext
15934 [[Project:]]
15935 !! html
15936 <p>[[Project:]]
15937 </p>
15938 !!end
15939
15940 !! test
15941 Namespaced link must have a title (bad fragment version)
15942 !! wikitext
15943 [[Project:#fragment]]
15944 !! html
15945 <p>[[Project:#fragment]]
15946 </p>
15947 !!end
15948
15949
15950 ###
15951 ### HTML tags and HTML attributes
15952 ###
15953
15954 !! test
15955 div with no attributes
15956 !! wikitext
15957 <div>HTML rocks</div>
15958 !! html
15959 <div>HTML rocks</div>
15960
15961 !! end
15962
15963 !! test
15964 div with double-quoted attribute
15965 !! wikitext
15966 <div id="rock">HTML rocks</div>
15967 !! html
15968 <div id="rock">HTML rocks</div>
15969
15970 !! end
15971
15972 !! test
15973 div with single-quoted attribute
15974 !! wikitext
15975 <div id='rock'>HTML rocks</div>
15976 !! html
15977 <div id="rock">HTML rocks</div>
15978
15979 !! end
15980
15981 !! test
15982 div with unquoted attribute
15983 !! wikitext
15984 <div id=rock>HTML rocks</div>
15985 !! html
15986 <div id="rock">HTML rocks</div>
15987
15988 !! end
15989
15990 !! test
15991 div with illegal double attributes
15992 !! wikitext
15993 <div id="a" id="b">HTML rocks</div>
15994 !! html
15995 <div id="b">HTML rocks</div>
15996
15997 !!end
15998
15999 !! test
16000 div with empty attribute value, space before equals
16001 !! options
16002 parsoid=wt2html,html2html
16003 !! wikitext
16004 <div class =>HTML rocks</div>
16005 !! html/php
16006 <div class="">HTML rocks</div>
16007
16008 !! html/parsoid
16009 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16010 !! end
16011
16012 !! test
16013 div with multiple empty attribute values
16014 !! options
16015 parsoid=wt2html,html2html
16016 !! wikitext
16017 <div id= title=>HTML rocks</div>
16018 !! html/php
16019 <div id="title.3D">HTML rocks</div>
16020
16021 !! html/parsoid
16022 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16023 !! end
16024
16025 !! test
16026 table with multiple empty attribute values
16027 !! options
16028 parsoid=wt2html,html2html
16029 !! wikitext
16030 {| title= id=
16031 | hi
16032 |}
16033 !! html/php
16034 <table title="id=">
16035 <tr>
16036 <td> hi
16037 </td></tr></table>
16038
16039 !! html/parsoid
16040 <table title="id=">
16041 <tbody><tr><td> hi</td></tr>
16042 </tbody></table>
16043 !! end
16044
16045 !! test
16046 div with braces in attribute value
16047 !! wikitext
16048 <div title="{}">Foo</div>
16049 !! html/php
16050 <div title="&#123;}">Foo</div>
16051
16052 !! html/parsoid
16053 <div title="{}">Foo</div>
16054 !! end
16055
16056 !! test
16057 div with empty attribute value, no space before equals
16058 !! options
16059 parsoid=wt2html,html2html
16060 !! wikitext
16061 <div class=>HTML rocks</div>
16062 !! html/php
16063 <div class="">HTML rocks</div>
16064
16065 !! html/parsoid
16066 <div class="">HTML rocks</div>
16067 !! end
16068
16069 !! test
16070 HTML multiple attributes correction
16071 !! wikitext
16072 <p class="error" class="awesome">Awesome!</p>
16073 !! html
16074 <p class="awesome">Awesome!</p>
16075
16076 !!end
16077
16078 !! test
16079 Table multiple attributes correction
16080 !! wikitext
16081 {|
16082 !+ class="error" class="awesome"| status
16083 |}
16084 !! html
16085 <table>
16086 <tr>
16087 <th class="awesome"> status
16088 </th></tr></table>
16089
16090 !!end
16091
16092 !! test
16093 DIV IN UPPERCASE
16094 !! wikitext
16095 <DIV ID="x">HTML ROCKS</DIV>
16096 !! html
16097 <div id="x">HTML ROCKS</div>
16098
16099 !!end
16100
16101 !! test
16102 Non-ASCII pseudo-tags are rendered as text
16103 !! wikitext
16104 <khyô>
16105 !! html
16106 <p>&lt;khyô&gt;
16107 </p>
16108 !! end
16109
16110 !! test
16111 Pseudo-tag with URL 'name' renders as url link
16112 !! wikitext
16113 <http://example.com/>
16114 !! html
16115 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16116 </p>
16117 !! end
16118
16119 !! test
16120 text with amp in the middle of nowhere
16121 !! wikitext
16122 Remember AT&T?
16123 !! html
16124 <p>Remember AT&amp;T?
16125 </p>
16126 !! end
16127
16128 !! test
16129 text with character entity: eacute
16130 !! wikitext
16131 I always thought &eacute; was a cute letter.
16132 !! html
16133 <p>I always thought &#233; was a cute letter.
16134 </p>
16135 !! html+tidy
16136 <p>I always thought é was a cute letter.</p>
16137 !! end
16138
16139 !! test
16140 text with entity-escaped character entity-like string: eacute
16141 !! wikitext
16142 I always thought &amp;eacute; was a cute letter.
16143 !! html
16144 <p>I always thought &amp;eacute; was a cute letter.
16145 </p>
16146 !! end
16147
16148 !! test
16149 text with undefined character entity: xacute
16150 !! wikitext
16151 I always thought &xacute; was a cute letter.
16152 !! html
16153 <p>I always thought &amp;xacute; was a cute letter.
16154 </p>
16155 !! end
16156
16157 !! test
16158 HTML5 tags
16159 !! wikitext
16160 <data value="5">five</data>
16161 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16162 <mark>This highlighted text</mark>
16163 !! html
16164 <p><data value="5">five</data>
16165 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16166 <mark>This highlighted text</mark>
16167 </p>
16168 !! end
16169
16170 !! test
16171 HTML tag with leading space is parsed as text
16172 !! wikitext
16173 < div>foo< /div>
16174 !! html
16175 <p>&lt; div&gt;foo&lt; /div&gt;
16176 </p>
16177 !! end
16178
16179 ###
16180 ### Nesting tests (see bug 41545, 50604, 51081)
16181 ###
16182
16183 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16184 # Note that html2wt is considerably more difficult if we use <b> in
16185 # the test case, instead of <big>
16186 !! test
16187 Ensure that HTML adoption agency algorithm is properly implemented.
16188 !! wikitext
16189 <big>X<big>Y</big>Z</big>
16190 !! html
16191 <p><big>X<big>Y</big>Z</big>
16192 </p>
16193 !! end
16194
16195 # This was bug 41545 in the PHP parser.
16196 # Note that tidy doesn't handle this correctly.
16197 !! test
16198 Nesting of <kbd>
16199 !! wikitext
16200 <kbd>X<kbd>Y</kbd>Z</kbd>
16201 !! html
16202 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16203 </p>
16204 !! end
16205
16206 # The following cases were bug 51081 in the PHP parser.
16207 # Note that there are some other nestable tags (b, i, etc) which are
16208 # not covered; see bug 51081 for discussion.
16209
16210 # Note that tidy doesn't handle this correctly.
16211 !! test
16212 Nesting of <em>
16213 !! wikitext
16214 <em>X<em>Y</em>Z</em>
16215 !! html
16216 <p><em>X<em>Y</em>Z</em>
16217 </p>
16218 !! end
16219
16220 # Note that tidy doesn't handle this correctly.
16221 !! test
16222 Nesting of <strong>
16223 !! wikitext
16224 <strong>X<strong>Y</strong>Z</strong>
16225 !! html
16226 <p><strong>X<strong>Y</strong>Z</strong>
16227 </p>
16228 !! end
16229
16230 !! test
16231 Nesting of <q>
16232 !! wikitext
16233 <q>X<q>Y</q>Z</q>
16234 !! html+tidy
16235 <p><q>X<q>Y</q>Z</q></p>
16236 !! end
16237
16238 # Note that tidy doesn't handle this correctly.
16239 !! test
16240 Nesting of <ruby>
16241 !! wikitext
16242 <ruby>X<ruby>Y</ruby>Z</ruby>
16243 !! html
16244 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16245 </p>
16246 !! end
16247
16248 # Note that tidy doesn't handle this correctly.
16249 !! test
16250 Nesting of <bdo>
16251 !! wikitext
16252 <bdo>X<bdo>Y</bdo>Z</bdo>
16253 !! html
16254 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16255 </p>
16256 !! end
16257
16258
16259 ###
16260 ### Media links
16261 ###
16262
16263 !! test
16264 Media link
16265 !! wikitext
16266 [[Media:Foobar.jpg]]
16267 !! html
16268 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16269 </p>
16270 !! end
16271
16272 !! test
16273 Media link with text
16274 !! wikitext
16275 [[Media:Foobar.jpg|A neat file to look at]]
16276 !! html
16277 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16278 </p>
16279 !! end
16280
16281 # FIXME: this is still bad HTML tag nesting
16282 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16283 !! test
16284 Media link with nasty text
16285 !! wikitext
16286 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16287 !! html
16288 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
16289
16290 !! html+tidy
16291 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16292 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16293 !! end
16294
16295 !! test
16296 Media link to nonexistent file (bug 1702)
16297 !! wikitext
16298 [[Media:No such.jpg]]
16299 !! html
16300 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16301 </p>
16302 !! end
16303
16304 !! test
16305 Image link to nonexistent file (bug 1850 - good)
16306 !! wikitext
16307 [[File:No_such.jpg]]
16308 !! html/php
16309 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
16310 </p>
16311 !! html/parsoid
16312 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
16313 !! end
16314
16315 !! test
16316 :Image link to nonexistent file (bug 1850 - bad)
16317 !! wikitext
16318 [[:Image:No such.jpg]]
16319 !! html/php
16320 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
16321 </p>
16322 !! html/parsoid
16323 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16324 !! end
16325
16326
16327
16328 !! test
16329 Character reference normalization in link text (bug 1938)
16330 !! wikitext
16331 [[Main Page|this&that]]
16332 !! html
16333 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16334 </p>
16335 !!end
16336
16337 !! article
16338 אַ
16339 !! text
16340 Test for unicode normalization
16341
16342 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16343 !! endarticle
16344
16345 !! test
16346 (bug 19451) Links should refer to the normalized form.
16347 !! wikitext
16348 [[&#xFB2E;]]
16349 [[&#x5d0;&#x5b7;]]
16350 [[&#x5d0;ַ]]
16351 [[א&#x5b7;]]
16352 [[אַ]]
16353 !! html
16354 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16355 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16356 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16357 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16358 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16359 </p>
16360 !! end
16361
16362 !! test
16363 Empty attribute crash test (bug 2067)
16364 !! wikitext
16365 <font color="">foo</font>
16366 !! html
16367 <p><font color="">foo</font>
16368 </p>
16369 !! end
16370
16371 !! test
16372 Empty attribute crash test single-quotes (bug 2067)
16373 !! wikitext
16374 <font color=''>foo</font>
16375 !! html
16376 <p><font color="">foo</font>
16377 </p>
16378 !! end
16379
16380 !! test
16381 Attribute test: equals, then nothing
16382 !! options
16383 parsoid=wt2html,html2html
16384 !! wikitext
16385 <font color=>foo</font>
16386 !! html/php
16387 <p><font color="">foo</font>
16388 </p>
16389 !! html/parsoid
16390 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16391 !! end
16392
16393 !! test
16394 Attribute test: unquoted value
16395 !! options
16396 parsoid=wt2html,html2html
16397 !! wikitext
16398 <font color=x>foo</font>
16399 !! html/php
16400 <p><font color="x">foo</font>
16401 </p>
16402 !! html/parsoid
16403 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16404 !! end
16405
16406 !! test
16407 Attribute test: unquoted but illegal value (hash)
16408 !! wikitext
16409 <font color=#x>foo</font>
16410 !! html
16411 <p><font color="#x">foo</font>
16412 </p>
16413 !! end
16414
16415 # Parsoid does not serialize to empty attribute syntax,
16416 # so wt2wt and html2wt cases are skipped
16417 !! test
16418 Attribute test: no value (T54330)
16419 !! options
16420 parsoid=wt2html,html2html
16421 !! wikitext
16422 <font color>foo</font>
16423 !! html/php
16424 <p><font color="">foo</font>
16425 </p>
16426 !! html/parsoid
16427 <p><font color="">foo</font></p>
16428 !! end
16429
16430 !! test
16431 Bug 2095: link with three closing brackets
16432 !! wikitext
16433 [[Main Page]]]
16434 !! html/php
16435 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16436 </p>
16437 !! html/parsoid
16438 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16439 !! end
16440
16441 !! test
16442 Bug 2095: link with pipe and three closing brackets
16443 !! wikitext
16444 [[Main Page|link]]]
16445 !! html/php
16446 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16447 </p>
16448 !! html/parsoid
16449 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16450 !! end
16451
16452 !! test
16453 Bug 2095: link with pipe and three closing brackets, version 2
16454 !! wikitext
16455 [[Main Page|[http://example.com/]]]
16456 !! html/php
16457 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16458 </p>
16459 !! html/parsoid
16460 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16461 !! end
16462
16463
16464 ###
16465 ### Safety
16466 ###
16467
16468 !! article
16469 Template:Dangerous attribute
16470 !! text
16471 " onmouseover="alert(document.cookie)
16472 !! endarticle
16473
16474 !! article
16475 Template:Dangerous style attribute
16476 !! text
16477 border-size: expression(alert(document.cookie))
16478 !! endarticle
16479
16480 !! article
16481 Template:Div style
16482 !! text
16483 <div style="float: right; {{{1}}}">Magic div</div>
16484 !! endarticle
16485
16486 !! test
16487 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16488 !! wikitext
16489 <div title="{{test}}"></div>
16490 !! html
16491 <div title="This is a test template"></div>
16492
16493 !! end
16494
16495 # Parsoid has enough context to handle this case
16496 !! test
16497 Bug 2304: HTML attribute safety (dangerous template; 2309)
16498 !! wikitext
16499 <div title="{{dangerous attribute}}"></div>
16500 !! html/php
16501 <div title=""></div>
16502
16503 !! html/parsoid
16504 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16505 !! end
16506
16507 !! test
16508 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16509 !! wikitext
16510 <div style="{{dangerous style attribute}}"></div>
16511 !! html
16512 <div style="/* insecure input */"></div>
16513
16514 !! end
16515
16516 !! test
16517 Bug 2304: HTML attribute safety (safe parameter; 2309)
16518 !! wikitext
16519 {{div style|width: 200px}}
16520 !! html
16521 <div style="float: right; width: 200px">Magic div</div>
16522
16523 !! end
16524
16525 !! test
16526 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16527 !! wikitext
16528 {{div style|width: expression(alert(document.cookie))}}
16529 !! html
16530 <div style="/* insecure input */">Magic div</div>
16531
16532 !! end
16533
16534 !! test
16535 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16536 !! wikitext
16537 {{div style|"><script>alert(document.cookie)</script>}}
16538 !! html
16539 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16540
16541 !! end
16542
16543 !! test
16544 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16545 !! wikitext
16546 {{div style|" ><script>alert(document.cookie)</script>}}
16547 !! html
16548 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16549
16550 !! end
16551
16552 !! test
16553 Bug 2304: HTML attribute safety (link)
16554 !! wikitext
16555 <div title="[[Main Page]]"></div>
16556 !! html
16557 <div title="&#91;&#91;Main Page]]"></div>
16558
16559 !! end
16560
16561 !! test
16562 Bug 2304: HTML attribute safety (italics)
16563 !! wikitext
16564 <div title="''foobar''"></div>
16565 !! html
16566 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16567
16568 !! end
16569
16570 !! test
16571 Bug 2304: HTML attribute safety (bold)
16572 !! wikitext
16573 <div title="'''foobar'''"></div>
16574 !! html
16575 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16576
16577 !! end
16578
16579
16580 !! test
16581 Bug 2304: HTML attribute safety (ISBN)
16582 !! wikitext
16583 <div title="ISBN 1234567890"></div>
16584 !! html
16585 <div title="&#73;SBN 1234567890"></div>
16586
16587 !! end
16588
16589 !! test
16590 Bug 2304: HTML attribute safety (RFC)
16591 !! wikitext
16592 <div title="RFC 1234"></div>
16593 !! html
16594 <div title="&#82;FC 1234"></div>
16595
16596 !! end
16597
16598 !! test
16599 Bug 2304: HTML attribute safety (PMID)
16600 !! wikitext
16601 <div title="PMID 1234567890"></div>
16602 !! html
16603 <div title="&#80;MID 1234567890"></div>
16604
16605 !! end
16606
16607 !! test
16608 Bug 2304: HTML attribute safety (web link)
16609 !! wikitext
16610 <div title="http://example.com/"></div>
16611 !! html
16612 <div title="http&#58;//example.com/"></div>
16613
16614 !! end
16615
16616 !! test
16617 Bug 2304: HTML attribute safety (named web link)
16618 !! wikitext
16619 <div title="[http://example.com/ link]"></div>
16620 !! html
16621 <div title="&#91;http&#58;//example.com/ link]"></div>
16622
16623 !! end
16624
16625 !! test
16626 Bug 3244: HTML attribute safety (extension; safe)
16627 !! wikitext
16628 <div style="<nowiki>background:blue</nowiki>"></div>
16629 !! html
16630 <div style="background:blue"></div>
16631
16632 !! end
16633
16634 !! test
16635 Bug 3244: HTML attribute safety (extension; unsafe)
16636 !! wikitext
16637 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16638 !! html
16639 <div style="/* insecure input */"></div>
16640
16641 !! end
16642
16643 # More MSIE fun discovered by Tom Gilder
16644
16645 !! test
16646 MSIE CSS safety test: spurious slash
16647 !! wikitext
16648 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16649 !! html
16650 <div style="/* insecure input */">evil</div>
16651
16652 !! end
16653
16654 !! test
16655 MSIE CSS safety test: hex code
16656 !! wikitext
16657 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16658 !! html
16659 <div style="/* insecure input */">evil</div>
16660
16661 !! end
16662
16663 !! test
16664 MSIE CSS safety test: comment in url
16665 !! wikitext
16666 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16667 !! html
16668 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16669
16670 !! end
16671
16672 !! test
16673 MSIE CSS safety test: comment in expression
16674 !! wikitext
16675 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16676 !! html
16677 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16678
16679 !! end
16680
16681 !! test
16682 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16683 !! wikitext
16684 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16685 !! html
16686 <p style="/* invalid control char */">A</p>
16687
16688 !! end
16689
16690 !! test
16691 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16692 !! wikitext
16693 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16694 <div style="top:EXPRESSION(alert())">B</div>
16695 !! html
16696 <p style="/* insecure input */">A</p>
16697 <div style="/* insecure input */">B</div>
16698
16699 !! end
16700
16701 !! test
16702 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16703 !! wikitext
16704 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16705 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16706 !! html
16707 <div style="/* insecure input */">A</div>
16708 <p style="/* insecure input */">B</p>
16709
16710 !! end
16711
16712 !! test
16713 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16714 !! wikitext
16715 <div style="background-image:url⁽javascript:alert())">A</div>
16716 <div style="background-image:url₍javascript:alert())">B</div>
16717 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16718 !! html
16719 <div style="/* insecure input */">A</div>
16720 <div style="/* insecure input */">B</div>
16721 <p style="/* insecure input */">C</p>
16722
16723 !! end
16724
16725 # FIXME: Parsoid fails to sanitize this! See T58846.
16726 !! test
16727 Opera -o-link CSS
16728 !! wikitext
16729 <div
16730 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
16731 style="-o-link:attr(title);-o-link-source:current">X</div>
16732 !! html
16733 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16734
16735 !! end
16736
16737 !! test
16738 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16739 !! wikitext
16740 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16741 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16742 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16743 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16744 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16745 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16746 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16747 !! html
16748 <p style="/* insecure input */">A</p>
16749 <p style="/* insecure input */">B</p>
16750 <p style="/* insecure input */">C</p>
16751 <p style="/* insecure input */">D</p>
16752 <p style="/* insecure input */">E</p>
16753 <p style="/* insecure input */">F</p>
16754 <p style="/* insecure input */">G</p>
16755
16756 !! end
16757
16758 !! test
16759 Table attribute legitimate extension
16760 !! wikitext
16761 {|
16762 !+ style="<nowiki>color:blue</nowiki>"| status
16763 |}
16764 !! html
16765 <table>
16766 <tr>
16767 <th style="color:blue"> status
16768 </th></tr></table>
16769
16770 !!end
16771
16772 !! test
16773 Table attribute safety
16774 !! wikitext
16775 {|
16776 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16777 |}
16778 !! html
16779 <table>
16780 <tr>
16781 <th style="/* insecure input */"> status
16782 </th></tr></table>
16783
16784 !! end
16785
16786 !! test
16787 CSS line continuation 1
16788 !! wikitext
16789 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16790 !! html
16791 <div style="/* insecure input */"></div>
16792
16793 !! end
16794
16795 !! test
16796 CSS line continuation 2
16797 !! wikitext
16798 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16799 !! html
16800 <div style="/* invalid control char */"></div>
16801
16802 !! end
16803
16804 !! article
16805 Template:Identity
16806 !! text
16807 {{{1}}}
16808 !! endarticle
16809
16810 !! test
16811 Expansion of multi-line templates in attribute values (bug 6255)
16812 !! wikitext
16813 <div style="background: {{identity|#00FF00}}">-</div>
16814 !! html
16815 <div style="background: #00FF00">-</div>
16816
16817 !! end
16818
16819
16820 !! test
16821 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16822 !! wikitext
16823 <div style="background:
16824 #00FF00">-</div>
16825 !! html/php
16826 <div style="background: #00FF00">-</div>
16827
16828 !! html/parsoid
16829 <div style="background:
16830 #00FF00">-</div>
16831 !! end
16832
16833 !! test
16834 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16835 !! wikitext
16836 <div style="background: &#10;#00FF00">-</div>
16837 !! html
16838 <div style="background: &#10;#00FF00">-</div>
16839
16840 !! end
16841
16842 !! test
16843 Tags which are hidden from Tidy cannot pass through the Sanitizer
16844 !! wikitext
16845 <mw:toc><script>alert();</script></mw:toc>
16846 !! html+tidy
16847 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16848 !! end
16849
16850 ###
16851 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16852 ###
16853 !! test
16854 Parser hook: empty input
16855 !! wikitext
16856 <tag></tag>
16857 !! html/php
16858 <pre>
16859 ''
16860 array (
16861 )
16862 </pre>
16863
16864 !! html/parsoid
16865 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16866 !! end
16867
16868 ## Don't expect parsoid to rt this form.
16869 !! test
16870 Parser hook: empty input using terminated empty elements
16871 !! options
16872 parsoid=wt2html,html2html
16873 !! wikitext
16874 <tag/>
16875 !! html/php
16876 <pre>
16877 NULL
16878 array (
16879 )
16880 </pre>
16881
16882 !! html/parsoid
16883 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16884 !! end
16885
16886 !! test
16887 Parser hook: empty input using terminated empty elements (space before)
16888 !! wikitext
16889 <tag />
16890 !! html/php
16891 <pre>
16892 NULL
16893 array (
16894 )
16895 </pre>
16896
16897 !! html/parsoid
16898 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16899 !! end
16900
16901 !! test
16902 Parser hook: basic input
16903 !! wikitext
16904 <tag>input</tag>
16905 !! html/php
16906 <pre>
16907 'input'
16908 array (
16909 )
16910 </pre>
16911
16912 !! html/parsoid
16913 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16914 !! end
16915
16916 ## Don't expect parsoid to rt this form.
16917 !! test
16918 Parser hook: case insensitive
16919 !! options
16920 parsoid=wt2html,html2html
16921 !! wikitext
16922 <TAG>input</TAG>
16923 !! html/php
16924 <pre>
16925 'input'
16926 array (
16927 )
16928 </pre>
16929
16930 !! html/parsoid
16931 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16932 !! end
16933
16934 ## Don't expect parsoid to rt this form.
16935 !! test
16936 Parser hook: case insensitive, redux
16937 !! options
16938 parsoid=wt2html,html2html
16939 !! wikitext
16940 <TaG>input</TAg>
16941 !! html/php
16942 <pre>
16943 'input'
16944 array (
16945 )
16946 </pre>
16947
16948 !! html/parsoid
16949 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16950 !! end
16951
16952 !! test
16953 Parser hook: nested tags
16954 !! wikitext
16955 <tag><tag></tag></tag>
16956 !! html/php
16957 <pre>
16958 '<tag>'
16959 array (
16960 )
16961 </pre>&lt;/tag&gt;
16962
16963 !! html/parsoid
16964 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16965 !! end
16966
16967 !! test
16968 Parser hook: basic arguments
16969 !! wikitext
16970 <tag width="200" height="100" depth="50" square=""></tag>
16971 !! html/php
16972 <pre>
16973 ''
16974 array (
16975 'width' => '200',
16976 'height' => '100',
16977 'depth' => '50',
16978 'square' => '',
16979 )
16980 </pre>
16981
16982 !! html/parsoid
16983 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16984 !! end
16985
16986 ## Don't expect parsoid to rt this form.
16987 !! test
16988 Parser hook: basic arguments, variations
16989 !! options
16990 parsoid=wt2html,html2html
16991 !! wikitext
16992 <tag width=200 height = "100" depth = '50' square></tag>
16993 !! html/php
16994 <pre>
16995 ''
16996 array (
16997 'width' => '200',
16998 'height' => '100',
16999 'depth' => '50',
17000 'square' => '',
17001 )
17002 </pre>
17003
17004 !! html/parsoid
17005 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17006 !! end
17007
17008 !! test
17009 Parser hook: argument containing a forward slash (bug 5344)
17010 !! wikitext
17011 <tag filename="/tmp/bla"></tag>
17012 !! html/php
17013 <pre>
17014 ''
17015 array (
17016 'filename' => '/tmp/bla',
17017 )
17018 </pre>
17019
17020 !! html/parsoid
17021 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17022 !! end
17023
17024 ## Don't expect parsoid to rt this form.
17025 !! test
17026 Parser hook: empty input using terminated empty elements (bug 2374)
17027 !! options
17028 parsoid=wt2html,html2html
17029 !! wikitext
17030 <tag foo=bar/>text
17031 !! html/php
17032 <pre>
17033 NULL
17034 array (
17035 'foo' => 'bar',
17036 )
17037 </pre>text
17038
17039 !! html/parsoid
17040 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17041 !! end
17042
17043 ## </tag> should be output literally since there is no matching tag that begins it
17044 ## Don't expect parsoid to rt this form.
17045 !! test
17046 Parser hook: basic arguments using terminated empty elements (bug 2374)
17047 !! options
17048 parsoid=wt2html
17049 !! wikitext
17050 <tag width=200 height = "100" depth = '50' square/>
17051 other stuff
17052 </tag>
17053 !! html/php
17054 <pre>
17055 NULL
17056 array (
17057 'width' => '200',
17058 'height' => '100',
17059 'depth' => '50',
17060 'square' => '',
17061 )
17062 </pre>
17063 <p>other stuff
17064 &lt;/tag&gt;
17065 </p>
17066 !! html/parsoid
17067 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
17068 &lt;/tag></p>
17069 !! end
17070
17071 ## Don't expect parsoid to rt this form.
17072 !! test
17073 Parser hook: Don't allow unclosed extension tags
17074 !! options
17075 parsoid=wt2html
17076 !! wikitext
17077 test <tag>123
17078
17079 this is a '''test'''
17080 !! html/php
17081 <p>test &lt;tag&gt;123
17082 </p><p>this is a <b>test</b>
17083 </p>
17084 !! html/parsoid
17085 <p>test &lt;tag>123</p>
17086
17087 <p>this is a <b>test</b></p>
17088 !! end
17089
17090 ###
17091 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17092 ###
17093
17094 !! test
17095 Parser hook: static parser hook not inside a comment
17096 !! wikitext
17097 <statictag>hello, world</statictag>
17098
17099 <statictag action="flush" />
17100 !! html/php
17101 <p><br />
17102 hello, world
17103 </p>
17104 !! html/parsoid
17105 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17106 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17107 !! end
17108
17109 !! test
17110 Parser hook: static parser hook inside a comment
17111 !! wikitext
17112 <!-- <statictag>hello, world</statictag> -->
17113 <statictag action="flush" />
17114 !! html/php
17115 <p><br />
17116 </p>
17117 !! html/parsoid
17118 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17119 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17120 !! end
17121
17122 # Nested template calls; this case was broken by Parser.php rev 1.506,
17123 # since reverted.
17124
17125 !! article
17126 Template:One-parameter
17127 !! text
17128 (My parameter is: {{{1}}})
17129 !! endarticle
17130
17131 !! article
17132 Template:Map-one-parameter
17133 !! text
17134 {{{{{1}}}|{{{2}}}}}
17135 !! endarticle
17136
17137 !! test
17138 Nested template calls
17139 !! wikitext
17140 {{Map-one-parameter|One-parameter|param}}
17141 !! html
17142 <p>(My parameter is: param)
17143 </p>
17144 !! end
17145
17146
17147 ###
17148 ### Sanitizer
17149 ###
17150
17151 # HTML+Tidy effectively strips out the empty tags completely
17152 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17153 # which Tidy would have done for the PHP parser had there been content inside it.
17154 !! test
17155 Sanitizer: Closing of open tags
17156 !! wikitext
17157 <s></s><table></table>
17158 !! html
17159 <s></s><table></table>
17160
17161 !! html/parsoid
17162 <p><s></s></p><table></table>
17163 !! end
17164
17165 !! test
17166 Sanitizer: Closing of open but not closed tags
17167 !! wikitext
17168 <s>foo
17169 !! html
17170 <p><s>foo</s>
17171 </p>
17172 !! end
17173
17174 !! test
17175 Sanitizer: Closing of closed but not open tags
17176 !! options
17177 parsoid=wt2html
17178 !! wikitext
17179 </s>
17180 !! html/php+tidy
17181 !! html/parsoid
17182 !! end
17183
17184 !! test
17185 Sanitizer: Closing of closed but not open table tags
17186 !! options
17187 parsoid=wt2html
17188 !! wikitext
17189 Table not started</td></tr></table>
17190 !! html/php+tidy
17191 <p>Table not started</p>
17192 !! html/parsoid
17193 <p>Table not started</p>
17194 !! end
17195
17196 !! test
17197 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17198 !! wikitext
17199 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17200 !! html/php
17201 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17202 </p>
17203 !! html/parsoid
17204 <p><span id=".C3.A6:_v" data-parsoid='{"stx":"html","a":{"id":".C3.A6:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#.C3.A6:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#.C3.A6:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
17205 !! end
17206
17207 # In HTML5, the restrictions are that id must contain at least one character,
17208 # and must not contain any space characters.
17209 !! test
17210 Sanitizer: Validating the contents of the id attribute (bug 4515)
17211 !! options
17212 disabled
17213 !! wikitext
17214 <br id="" /><br id="a space" />
17215 !! html
17216 Something ...
17217 !! end
17218
17219 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17220 !! test
17221 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17222 !! options
17223 disabled
17224 !! wikitext
17225 <br id="foo" /><br id="foo" />
17226 !! html
17227 Something need to be done. foo-2 ?
17228 !! end
17229
17230 !! test
17231 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17232 !! wikitext
17233 <div itemscope>
17234 <meta itemprop="hello" content="world">
17235 <meta http-equiv="refresh" content="5">
17236 <meta itemprop="hello" http-equiv="refresh" content="5">
17237 <link itemprop="hello" href="{{SERVER}}">
17238 <link rel="stylesheet" href="{{SERVER}}">
17239 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17240 </div>
17241 !! html
17242 <div itemscope="">
17243 <p> <meta itemprop="hello" content="world" />
17244 &lt;meta http-equiv="refresh" content="5"&gt;
17245 <meta itemprop="hello" content="5" />
17246 </p>
17247 <link itemprop="hello" href="http&#58;//example.org" />
17248 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17249 <link itemprop="hello" href="http&#58;//example.org" />
17250 </div>
17251
17252 !! end
17253
17254 !! test
17255 Language converter: output gets cut off unexpectedly (bug 5757)
17256 !! options
17257 language=zh
17258 !! wikitext
17259 this bit is safe: }-
17260
17261 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17262
17263 then we get cut off here: }-
17264
17265 all additional text is vanished
17266 !! html
17267 <p>this bit is safe: }-
17268 </p><p>but if we add a conversion instance: xxx
17269 </p><p>then we get cut off here: }-
17270 </p><p>all additional text is vanished
17271 </p>
17272 !! end
17273
17274 !! test
17275 Self closed html pairs (bug 5487)
17276 !! options
17277 !! wikitext
17278 <center><font id="bug" />Centered text</center>
17279 <div><font id="bug2" />In div text</div>
17280 !! html
17281 <center>&lt;font id="bug" /&gt;Centered text</center>
17282 <div>&lt;font id="bug2" /&gt;In div text</div>
17283
17284 !! end
17285
17286 #
17287 #
17288 #
17289
17290 !! test
17291 Punctuation: nbsp before exclamation
17292 !! wikitext
17293 C'est grave !
17294 !! html
17295 <p>C'est grave&#160;!
17296 </p>
17297 !! end
17298
17299 !! test
17300 Punctuation: CSS !important (bug 11874)
17301 !! wikitext
17302 <div style="width:50% !important">important</div>
17303 !! html
17304 <div style="width:50% !important">important</div>
17305
17306 !!end
17307
17308 !! test
17309 Punctuation: CSS ! important (bug 11874; with space after)
17310 !! wikitext
17311 <div style="width:50% ! important">important</div>
17312 !! html
17313 <div style="width:50% ! important">important</div>
17314
17315 !!end
17316
17317 !! test
17318 HTML bullet list, closed tags (bug 5497)
17319 !! wikitext
17320 <ul>
17321 <li>One</li>
17322 <li>Two</li>
17323 </ul>
17324 !! html/php
17325 <ul>
17326 <li>One</li>
17327 <li>Two</li>
17328 </ul>
17329
17330 !! html/parsoid
17331 <ul data-parsoid='{"stx":"html"}'>
17332 <li data-parsoid='{"stx":"html"}'>One</li>
17333 <li data-parsoid='{"stx":"html"}'>Two</li>
17334 </ul>
17335
17336 !! end
17337
17338 !! test
17339 HTML bullet list, unclosed tags (bug 5497)
17340 !! wikitext
17341 <ul>
17342 <li>One
17343 <li>Two
17344 </ul>
17345 !! html/php+tidy
17346 <ul>
17347 <li>One</li>
17348 <li>Two</li>
17349 </ul>
17350 !! html/parsoid
17351 <ul data-parsoid='{"stx":"html"}'>
17352 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17353 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17354 </ul>
17355
17356 !! end
17357
17358 !! test
17359 HTML ordered list, closed tags (bug 5497)
17360 !! wikitext
17361 <ol>
17362 <li>One</li>
17363 <li>Two</li>
17364 </ol>
17365 !! html/php
17366 <ol>
17367 <li>One</li>
17368 <li>Two</li>
17369 </ol>
17370
17371 !! html/parsoid
17372 <ol data-parsoid='{"stx":"html"}'>
17373 <li data-parsoid='{"stx":"html"}'>One</li>
17374 <li data-parsoid='{"stx":"html"}'>Two</li>
17375 </ol>
17376
17377 !! end
17378
17379 !! test
17380 HTML ordered list, unclosed tags (bug 5497)
17381 !! options
17382 !! wikitext
17383 <ol>
17384 <li>One
17385 <li>Two
17386 </ol>
17387 !! html/php+tidy
17388 <ol>
17389 <li>One</li>
17390 <li>Two</li>
17391 </ol>
17392 !! html/parsoid
17393 <ol data-parsoid='{"stx":"html"}'>
17394 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17395 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17396 </ol>
17397
17398 !! end
17399
17400 !! test
17401 HTML nested bullet list, closed tags (bug 5497)
17402 !! wikitext
17403 <ul>
17404 <li>One</li>
17405 <li>Two:
17406 <ul>
17407 <li>Sub-one</li>
17408 <li>Sub-two</li>
17409 </ul>
17410 </li>
17411 </ul>
17412 !! html/php
17413 <ul>
17414 <li>One</li>
17415 <li>Two:
17416 <ul>
17417 <li>Sub-one</li>
17418 <li>Sub-two</li>
17419 </ul>
17420 </li>
17421 </ul>
17422
17423 !! html/parsoid
17424 <ul data-parsoid='{"stx":"html"}'>
17425 <li data-parsoid='{"stx":"html"}'>One</li>
17426 <li data-parsoid='{"stx":"html"}'>Two:
17427 <ul data-parsoid='{"stx":"html"}'>
17428 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17429 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17430 </ul>
17431 </li>
17432 </ul>
17433 !! end
17434
17435 !! test
17436 HTML nested bullet list, open tags (bug 5497)
17437 !! wikitext
17438 <ul>
17439 <li>One
17440 <li>Two:
17441 <ul>
17442 <li>Sub-one
17443 <li>Sub-two
17444 </ul>
17445 </ul>
17446 !! html/php+tidy
17447 <ul>
17448 <li>One</li>
17449 <li>Two:
17450 <ul>
17451 <li>Sub-one</li>
17452 <li>Sub-two</li>
17453 </ul>
17454 </li>
17455 </ul>
17456 !! html/parsoid
17457 <ul>
17458 <li>One
17459 </li>
17460 <li>Two:
17461 <ul>
17462 <li>Sub-one
17463 </li>
17464 <li>Sub-two
17465 </li>
17466 </ul>
17467 </li>
17468 </ul>
17469
17470 !! end
17471
17472 !! test
17473 HTML nested ordered list, closed tags (bug 5497)
17474 !! wikitext
17475 <ol>
17476 <li>One</li>
17477 <li>Two:
17478 <ol>
17479 <li>Sub-one</li>
17480 <li>Sub-two</li>
17481 </ol>
17482 </li>
17483 </ol>
17484 !! html
17485 <ol>
17486 <li>One</li>
17487 <li>Two:
17488 <ol>
17489 <li>Sub-one</li>
17490 <li>Sub-two</li>
17491 </ol>
17492 </li>
17493 </ol>
17494
17495 !! end
17496
17497 !! test
17498 HTML nested ordered list, open tags (bug 5497)
17499 !! wikitext
17500 <ol>
17501 <li>One
17502 <li>Two:
17503 <ol>
17504 <li>Sub-one
17505 <li>Sub-two
17506 </ol>
17507 </ol>
17508 !! html/php
17509 <ol>
17510 <li>One
17511 <li>Two:
17512 <ol>
17513 <li>Sub-one
17514 <li>Sub-two
17515 </ol>
17516 </ol>
17517
17518 !! html/parsoid
17519 <ol>
17520 <li>One
17521 </li>
17522 <li>Two:
17523 <ol>
17524 <li>Sub-one
17525 </li>
17526 <li>Sub-two
17527 </li>
17528 </ol>
17529 </li>
17530 </ol>
17531
17532 !! end
17533
17534 !! test
17535 HTML ordered list item with parameters oddity
17536 !! wikitext
17537 <ol><li id="fragment">One</li>
17538 </ol>
17539 !! html
17540 <ol><li id="fragment">One</li>
17541 </ol>
17542
17543 !! end
17544
17545 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17546 !!test
17547 bug 5918: autonumbering
17548 !! wikitext
17549 [http://first/] [http://second] [ftp://ftp]
17550
17551 ftp://inlineftp
17552
17553 [mailto:enclosed@mail.tld With target]
17554
17555 [mailto:enclosed@mail.tld]
17556
17557 mailto:inline@mail.tld
17558 !! html/php
17559 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
17560 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17561 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17562 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17563 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17564 </p>
17565 !! html/parsoid
17566 <p><a rel="mw:ExtLink" href="http://first/"></a> <a rel="mw:ExtLink" href="http://second"></a> <a rel="mw:ExtLink" href="ftp://ftp"></a></p>
17567 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17568 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17569 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17570 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17571 !! end
17572
17573
17574 #
17575 # Security and HTML correctness
17576 # From Nick Jenkins' fuzz testing
17577 #
17578
17579 !! test
17580 Fuzz testing: Parser13
17581 !! wikitext
17582 {|
17583 | http://a|
17584 !! html
17585 <table>
17586 <tr>
17587 <td>
17588 </td>
17589 </tr>
17590 </table>
17591
17592 !! end
17593
17594 !! test
17595 Fuzz testing: Parser14
17596 !! wikitext
17597 == onmouseover= ==
17598 http://__TOC__
17599 !! html
17600 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17601 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17602 <ul>
17603 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17604 </ul>
17605 </div>
17606
17607
17608 !! html+tidy
17609 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17610 <p>http://</p>
17611 <div id="toc" class="toc">
17612 <div id="toctitle">
17613 <h2>Contents</h2>
17614 </div>
17615 <ul>
17616 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17617 </ul>
17618 </div>
17619 <p></p>
17620 !! end
17621
17622 !! test
17623 Fuzz testing: Parser14-table
17624 !! options
17625 parsoid=wt2html,html2html
17626 !! wikitext
17627 ==a==
17628 {| STYLE=__TOC__
17629 !! html
17630 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17631 <table style="&#95;_TOC&#95;_">
17632 <tr><td></td></tr>
17633 </table>
17634
17635 !! html+tidy
17636 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17637 <table style="__TOC__">
17638 <tr>
17639 <td></td>
17640 </tr>
17641 </table>
17642 !! html/parsoid
17643 <h2>a</h2>
17644 <table style="__TOC__"></table>
17645 !! end
17646
17647 # Known to produce bogus xml (extra </td>)
17648 !! test
17649 Fuzz testing: Parser16
17650 !! wikitext
17651 {|
17652 !https://||||||
17653 !! html
17654 <table>
17655 <tr>
17656 <th>https://</th>
17657 <th></th>
17658 <th></th>
17659 <th>
17660 </td>
17661 </tr>
17662 </table>
17663
17664 !! html+tidy
17665 <table>
17666 <tr>
17667 <th>https://</th>
17668 <th></th>
17669 <th></th>
17670 <th></th>
17671 </tr>
17672 </table>
17673 !! end
17674
17675 !! test
17676 Fuzz testing: Parser21
17677 !! wikitext
17678 {|
17679 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17680 |
17681 !! html
17682 <table>
17683 <tr>
17684 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17685 </th>
17686 <td>
17687 </td>
17688 </tr>
17689 </table>
17690
17691 !! end
17692
17693 !! test
17694 Fuzz testing: Parser22
17695 !! wikitext
17696 http://===r:::https://b
17697
17698 {|
17699 !! html
17700 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17701 </p>
17702 <table>
17703 <tr><td></td></tr>
17704 </table>
17705
17706 !! end
17707
17708 # Known to produce bad XML for now
17709 !! test
17710 Fuzz testing: Parser24
17711 !! options
17712 parsoid=wt2html
17713 !! wikitext
17714 {|
17715 {{{|
17716 <u CLASS=
17717 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17718 <br style="onmouseover='alert(document.cookie);' " />
17719
17720 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17721 |
17722 !! html/php
17723 <table>
17724 {{{|
17725 <u class="&#124;">}}}} &gt;
17726 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17727
17728 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17729 <tr>
17730 <td></u>
17731 </td>
17732 </tr>
17733 </table>
17734
17735 !! html/parsoid
17736 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17737 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17738 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17739
17740
17741
17742 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17743 !! end
17744
17745 # Note: the current result listed for this is not what the original one was,
17746 # but the original bug was JavaScript injection, which is fixed in any case.
17747 # It's not clear that the original result listed was any more correct than the
17748 # current one. Original result:
17749 # <p>{{{|
17750 # </p>
17751 # <li class="&#124;&#124;">
17752 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17753 !!test
17754 Fuzz testing: Parser25 (bug 6055)
17755 !! wikitext
17756 {{{
17757 |
17758 <LI CLASS=||
17759 >
17760 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17761 !! html/php
17762 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17763 </p>
17764 !! html/parsoid
17765 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
17766 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17767 !! end
17768
17769 !!test
17770 Fuzz testing: URL adjacent extension (with space, clean)
17771 !! wikitext
17772 http://example.com <nowiki>junk</nowiki>
17773 !! html/php
17774 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17775 </p>
17776 !! html/parsoid
17777 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17778 !! end
17779
17780 !!test
17781 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17782 !! wikitext
17783 http://example.com<nowiki>junk</nowiki>
17784 !! html/php
17785 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17786 </p>
17787 !! html/parsoid
17788 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17789 !! end
17790
17791 !!test
17792 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17793 !! wikitext
17794 http://example.com<pre>junk</pre>
17795 !! html/php
17796 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17797
17798 !! html/php+tidy
17799 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17800 <pre>
17801 junk
17802 </pre>
17803 !! html/parsoid
17804 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
17805 !!end
17806
17807 !!test
17808 Fuzz testing: image with bogus manual thumbnail
17809 !! wikitext
17810 [[Image:foobar.jpg|thumbnail= ]]
17811 !! html/php
17812 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17813
17814 !! html/parsoid
17815 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17816 !!end
17817
17818 !! test
17819 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17820 !! wikitext
17821 <pre dir="&#10;"></pre>
17822 !! html
17823 <pre dir="&#10;"></pre>
17824
17825 !! end
17826
17827 !! test
17828 Parsing optional HTML elements (Bug 6171)
17829 !! options
17830 !! wikitext
17831 <table>
17832 <tr>
17833 <td> Some tabular data</td>
17834 <td> More tabular data ...
17835 <td> And yet som tabular data</td>
17836 </tr>
17837 </table>
17838 !! html
17839 <table>
17840 <tr>
17841 <td> Some tabular data</td>
17842 <td> More tabular data ...
17843 </td><td> And yet som tabular data</td>
17844 </tr>
17845 </table>
17846
17847 !! end
17848
17849 !! test
17850 Correct handling of <td>, <tr> (Bug 6171)
17851 !! options
17852 !! wikitext
17853 <table>
17854 <tr>
17855 <td> Some tabular data</td>
17856 <td> More tabular data ...</td>
17857 <td> And yet som tabular data</td>
17858 </tr>
17859 </table>
17860 !! html
17861 <table>
17862 <tr>
17863 <td> Some tabular data</td>
17864 <td> More tabular data ...</td>
17865 <td> And yet som tabular data</td>
17866 </tr>
17867 </table>
17868
17869 !! end
17870
17871
17872 !! test
17873 Parsing crashing regression (fr:JavaScript)
17874 !! wikitext
17875 </body></x>
17876 !! html
17877 <p>&lt;/body&gt;&lt;/x&gt;
17878 </p>
17879 !! end
17880
17881 !! test
17882 Inline wiki vs wiki block nesting
17883 !! wikitext
17884 '''Bold paragraph
17885
17886 New wiki paragraph
17887 !! html
17888 <p><b>Bold paragraph</b>
17889 </p><p>New wiki paragraph
17890 </p>
17891 !! end
17892
17893 # FIXME: The current php output is documented
17894 # and desired output is the parsoid target.
17895 !! test
17896 Inline HTML vs wiki block nesting
17897 !! wikitext
17898 <b>Bold paragraph
17899
17900 New wiki paragraph
17901 !! html/php
17902 <p><b>Bold paragraph
17903 </p><p>New wiki paragraph</b>
17904 </p>
17905 !! html/parsoid
17906 <p><b>Bold paragraph</b>
17907 </p><p>New wiki paragraph
17908 </p>
17909 !! end
17910
17911 # Original result was this:
17912 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17913 # </p>
17914 # While that might be marginally more intuitive, maybe, the six-apostrophe
17915 # construct is clearly pathological and the result stated here (which is what
17916 # the parser actually does) is about as reasonable as anything.
17917 !!test
17918 Mixing markup for italics and bold
17919 !! options
17920 !! wikitext
17921 '''bold''''''bold''bolditalics'''''
17922 !! html
17923 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17924 </p>
17925 !! end
17926
17927
17928 !! article
17929 Xyzzyx
17930 !! text
17931 Article for special page transclusion test
17932 !! endarticle
17933
17934 !! test
17935 Special page transclusion
17936 !! options
17937 !! wikitext
17938 {{Special:Prefixindex/Xyzzyx}}
17939 !! html
17940 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17941 </ul>
17942
17943 !! end
17944
17945 !! test
17946 Special page transclusion twice (bug 5021)
17947 !! options
17948 !! wikitext
17949 {{Special:Prefixindex/Xyzzyx}}
17950 {{Special:Prefixindex/Xyzzyx}}
17951 !! html
17952 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17953 </ul>
17954 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17955 </ul>
17956
17957 !! end
17958
17959 !! test
17960 Transclusion of default MediaWiki message
17961 !! wikitext
17962 {{MediaWiki:Mainpage}}
17963 !! html
17964 <p>Main Page
17965 </p>
17966 !! end
17967
17968 !! test
17969 Transclusion of nonexistent MediaWiki message
17970 !! wikitext
17971 {{MediaWiki:Mainpagexxx}}
17972 !! html
17973 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
17974 </p>
17975 !! end
17976
17977 !! test
17978 Transclusion of MediaWiki message with underscore
17979 !! wikitext
17980 {{MediaWiki:history_short}}
17981 !! html
17982 <p>History
17983 </p>
17984 !! end
17985
17986 !! test
17987 Transclusion of MediaWiki message with space
17988 !! wikitext
17989 {{MediaWiki:history short}}
17990 !! html
17991 <p>History
17992 </p>
17993 !! end
17994
17995 !! test
17996 Invalid header with following text
17997 !! wikitext
17998 = x = y
17999 !! html
18000 <p>= x = y
18001 </p>
18002 !! end
18003
18004
18005 !! test
18006 Section extraction test (section 0)
18007 !! options
18008 section=0
18009 !! wikitext
18010 start
18011 ==a==
18012 ===aa===
18013 ====aaa====
18014 ==b==
18015 ===ba===
18016 ===bb===
18017 ====bba====
18018 ===bc===
18019 ==c==
18020 ===ca===
18021 !! html/php
18022 start
18023 !! end
18024
18025 !! test
18026 Section extraction test (section 1)
18027 !! options
18028 section=1
18029 !! wikitext
18030 start
18031 ==a==
18032 ===aa===
18033 ====aaa====
18034 ==b==
18035 ===ba===
18036 ===bb===
18037 ====bba====
18038 ===bc===
18039 ==c==
18040 ===ca===
18041 !! html/php
18042 ==a==
18043 ===aa===
18044 ====aaa====
18045 !! end
18046
18047 !! test
18048 Section extraction test (section 2)
18049 !! options
18050 section=2
18051 !! wikitext
18052 start
18053 ==a==
18054 ===aa===
18055 ====aaa====
18056 ==b==
18057 ===ba===
18058 ===bb===
18059 ====bba====
18060 ===bc===
18061 ==c==
18062 ===ca===
18063 !! html/php
18064 ===aa===
18065 ====aaa====
18066 !! end
18067
18068 !! test
18069 Section extraction test (section 3)
18070 !! options
18071 section=3
18072 !! wikitext
18073 start
18074 ==a==
18075 ===aa===
18076 ====aaa====
18077 ==b==
18078 ===ba===
18079 ===bb===
18080 ====bba====
18081 ===bc===
18082 ==c==
18083 ===ca===
18084 !! html/php
18085 ====aaa====
18086 !! end
18087
18088 !! test
18089 Section extraction test (section 4)
18090 !! options
18091 section=4
18092 !! wikitext
18093 start
18094 ==a==
18095 ===aa===
18096 ====aaa====
18097 ==b==
18098 ===ba===
18099 ===bb===
18100 ====bba====
18101 ===bc===
18102 ==c==
18103 ===ca===
18104 !! html/php
18105 ==b==
18106 ===ba===
18107 ===bb===
18108 ====bba====
18109 ===bc===
18110 !! end
18111
18112 !! test
18113 Section extraction test (section 5)
18114 !! options
18115 section=5
18116 !! wikitext
18117 start
18118 ==a==
18119 ===aa===
18120 ====aaa====
18121 ==b==
18122 ===ba===
18123 ===bb===
18124 ====bba====
18125 ===bc===
18126 ==c==
18127 ===ca===
18128 !! html/php
18129 ===ba===
18130 !! end
18131
18132 !! test
18133 Section extraction test (section 6)
18134 !! options
18135 section=6
18136 !! wikitext
18137 start
18138 ==a==
18139 ===aa===
18140 ====aaa====
18141 ==b==
18142 ===ba===
18143 ===bb===
18144 ====bba====
18145 ===bc===
18146 ==c==
18147 ===ca===
18148 !! html/php
18149 ===bb===
18150 ====bba====
18151 !! end
18152
18153 !! test
18154 Section extraction test (section 7)
18155 !! options
18156 section=7
18157 !! wikitext
18158 start
18159 ==a==
18160 ===aa===
18161 ====aaa====
18162 ==b==
18163 ===ba===
18164 ===bb===
18165 ====bba====
18166 ===bc===
18167 ==c==
18168 ===ca===
18169 !! html/php
18170 ====bba====
18171 !! end
18172
18173 !! test
18174 Section extraction test (section 8)
18175 !! options
18176 section=8
18177 !! wikitext
18178 start
18179 ==a==
18180 ===aa===
18181 ====aaa====
18182 ==b==
18183 ===ba===
18184 ===bb===
18185 ====bba====
18186 ===bc===
18187 ==c==
18188 ===ca===
18189 !! html/php
18190 ===bc===
18191 !! end
18192
18193 !! test
18194 Section extraction test (section 9)
18195 !! options
18196 section=9
18197 !! wikitext
18198 start
18199 ==a==
18200 ===aa===
18201 ====aaa====
18202 ==b==
18203 ===ba===
18204 ===bb===
18205 ====bba====
18206 ===bc===
18207 ==c==
18208 ===ca===
18209 !! html/php
18210 ==c==
18211 ===ca===
18212 !! end
18213
18214 !! test
18215 Section extraction test (section 10)
18216 !! options
18217 section=10
18218 !! wikitext
18219 start
18220 ==a==
18221 ===aa===
18222 ====aaa====
18223 ==b==
18224 ===ba===
18225 ===bb===
18226 ====bba====
18227 ===bc===
18228 ==c==
18229 ===ca===
18230 !! html/php
18231 ===ca===
18232 !! end
18233
18234 !! test
18235 Section extraction test (nonexistent section 11)
18236 !! options
18237 section=11
18238 !! wikitext
18239 start
18240 ==a==
18241 ===aa===
18242 ====aaa====
18243 ==b==
18244 ===ba===
18245 ===bb===
18246 ====bba====
18247 ===bc===
18248 ==c==
18249 ===ca===
18250 !! html/php
18251 !! end
18252
18253 !! test
18254 Section extraction test with bogus heading (section 1)
18255 !! options
18256 section=1
18257 !! wikitext
18258 ==a==
18259 ==bogus== not a legal section
18260 ==b==
18261 !! html/php
18262 ==a==
18263 ==bogus== not a legal section
18264 !! end
18265
18266 !! test
18267 Section extraction test with bogus heading (section 2)
18268 !! options
18269 section=2
18270 !! wikitext
18271 ==a==
18272 ==bogus== not a legal section
18273 ==b==
18274 !! html/php
18275 ==b==
18276 !! end
18277
18278 !! test
18279 Section extraction test with comment after heading (section 1)
18280 !! options
18281 section=1
18282 !! wikitext
18283 ==a==
18284 ==b== <!-- -->
18285 ==c==
18286 !! html/php
18287 ==a==
18288 !! end
18289
18290 !! test
18291 Section extraction test with comment after heading (section 2)
18292 !! options
18293 section=2
18294 !! wikitext
18295 ==a==
18296 ==b== <!-- -->
18297 ==c==
18298 !! html/php
18299 ==b== <!-- -->
18300 !! end
18301
18302 !! test
18303 Section extraction test with bogus <nowiki> heading (section 1)
18304 !! options
18305 section=1
18306 !! wikitext
18307 ==a==
18308 ==bogus== <nowiki>not a legal section</nowiki>
18309 ==b==
18310 !! html/php
18311 ==a==
18312 ==bogus== <nowiki>not a legal section</nowiki>
18313 !! end
18314
18315 !! test
18316 Section extraction test with bogus <nowiki> heading (section 2)
18317 !! options
18318 section=2
18319 !! wikitext
18320 ==a==
18321 ==bogus== <nowiki>not a legal section</nowiki>
18322 ==b==
18323 !! html/php
18324 ==b==
18325 !! end
18326
18327 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18328 # instead of respecting commented sections
18329 !! test
18330 Section extraction prefixed by comment (section 1)
18331 !! options
18332 section=1
18333 !! wikitext
18334 <!-- -->==sec1==
18335 ==sec2==
18336 !! html/php
18337 ==sec2==
18338 !!end
18339
18340 !! test
18341 Section extraction prefixed by comment (section 2)
18342 !! options
18343 section=2
18344 !! wikitext
18345 <!-- -->==sec1==
18346 ==sec2==
18347 !! html/php
18348
18349 !!end
18350
18351 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18352 # instead of respecting HTML-style headings
18353 !! test
18354 Section extraction, mixed wiki and html (section 1)
18355 !! options
18356 section=1
18357 !! wikitext
18358 <h2>unmarked</h2>
18359 unmarked
18360 ==1==
18361 one
18362 ==2==
18363 two
18364 !! html/php
18365 ==1==
18366 one
18367 !! end
18368
18369 !! test
18370 Section extraction, mixed wiki and html (section 2)
18371 !! options
18372 section=2
18373 !! wikitext
18374 <h2>unmarked</h2>
18375 unmarked
18376 ==1==
18377 one
18378 ==2==
18379 two
18380 !! html/php
18381 ==2==
18382 two
18383 !! end
18384
18385
18386 # Formerly testing for bug 3342
18387 !! test
18388 Section extraction, heading surrounded by <noinclude>
18389 !! options
18390 section=1
18391 !! wikitext
18392 <noinclude>==unmarked==</noinclude>
18393 ==marked==
18394 !! html/php
18395 ==marked==
18396 !!end
18397
18398 # Test behavior of bug 19910
18399 !! test
18400 Sectiion with all-equals
18401 !! options
18402 section=2
18403 !! wikitext
18404 ===
18405 The line above must have a trailing space
18406 === <!--
18407 --> <!-- -->
18408 But just in case it doesn't...
18409 !! html/php
18410 === <!--
18411 --> <!-- -->
18412 But just in case it doesn't...
18413 !! end
18414
18415 !! test
18416 Section replacement test (section 0)
18417 !! options
18418 replace=0,"xxx"
18419 !! wikitext
18420 start
18421 ==a==
18422 ===aa===
18423 ====aaa====
18424 ==b==
18425 ===ba===
18426 ===bb===
18427 ====bba====
18428 ===bc===
18429 ==c==
18430 ===ca===
18431 !! html/php
18432 xxx
18433
18434 ==a==
18435 ===aa===
18436 ====aaa====
18437 ==b==
18438 ===ba===
18439 ===bb===
18440 ====bba====
18441 ===bc===
18442 ==c==
18443 ===ca===
18444 !! end
18445
18446 !! test
18447 Section replacement test (section 1)
18448 !! options
18449 replace=1,"xxx"
18450 !! wikitext
18451 start
18452 ==a==
18453 ===aa===
18454 ====aaa====
18455 ==b==
18456 ===ba===
18457 ===bb===
18458 ====bba====
18459 ===bc===
18460 ==c==
18461 ===ca===
18462 !! html/php
18463 start
18464 xxx
18465
18466 ==b==
18467 ===ba===
18468 ===bb===
18469 ====bba====
18470 ===bc===
18471 ==c==
18472 ===ca===
18473 !! end
18474
18475 !! test
18476 Section replacement test (section 2)
18477 !! options
18478 replace=2,"xxx"
18479 !! wikitext
18480 start
18481 ==a==
18482 ===aa===
18483 ====aaa====
18484 ==b==
18485 ===ba===
18486 ===bb===
18487 ====bba====
18488 ===bc===
18489 ==c==
18490 ===ca===
18491 !! html/php
18492 start
18493 ==a==
18494 xxx
18495
18496 ==b==
18497 ===ba===
18498 ===bb===
18499 ====bba====
18500 ===bc===
18501 ==c==
18502 ===ca===
18503 !! end
18504
18505 !! test
18506 Section replacement test (section 3)
18507 !! options
18508 replace=3,"xxx"
18509 !! wikitext
18510 start
18511 ==a==
18512 ===aa===
18513 ====aaa====
18514 ==b==
18515 ===ba===
18516 ===bb===
18517 ====bba====
18518 ===bc===
18519 ==c==
18520 ===ca===
18521 !! html/php
18522 start
18523 ==a==
18524 ===aa===
18525 xxx
18526
18527 ==b==
18528 ===ba===
18529 ===bb===
18530 ====bba====
18531 ===bc===
18532 ==c==
18533 ===ca===
18534 !! end
18535
18536 !! test
18537 Section replacement test (section 4)
18538 !! options
18539 replace=4,"xxx"
18540 !! wikitext
18541 start
18542 ==a==
18543 ===aa===
18544 ====aaa====
18545 ==b==
18546 ===ba===
18547 ===bb===
18548 ====bba====
18549 ===bc===
18550 ==c==
18551 ===ca===
18552 !! html/php
18553 start
18554 ==a==
18555 ===aa===
18556 ====aaa====
18557 xxx
18558
18559 ==c==
18560 ===ca===
18561 !! end
18562
18563 !! test
18564 Section replacement test (section 5)
18565 !! options
18566 replace=5,"xxx"
18567 !! wikitext
18568 start
18569 ==a==
18570 ===aa===
18571 ====aaa====
18572 ==b==
18573 ===ba===
18574 ===bb===
18575 ====bba====
18576 ===bc===
18577 ==c==
18578 ===ca===
18579 !! html/php
18580 start
18581 ==a==
18582 ===aa===
18583 ====aaa====
18584 ==b==
18585 xxx
18586
18587 ===bb===
18588 ====bba====
18589 ===bc===
18590 ==c==
18591 ===ca===
18592 !! end
18593
18594 !! test
18595 Section replacement test (section 6)
18596 !! options
18597 replace=6,"xxx"
18598 !! wikitext
18599 start
18600 ==a==
18601 ===aa===
18602 ====aaa====
18603 ==b==
18604 ===ba===
18605 ===bb===
18606 ====bba====
18607 ===bc===
18608 ==c==
18609 ===ca===
18610 !! html/php
18611 start
18612 ==a==
18613 ===aa===
18614 ====aaa====
18615 ==b==
18616 ===ba===
18617 xxx
18618
18619 ===bc===
18620 ==c==
18621 ===ca===
18622 !! end
18623
18624 !! test
18625 Section replacement test (section 7)
18626 !! options
18627 replace=7,"xxx"
18628 !! wikitext
18629 start
18630 ==a==
18631 ===aa===
18632 ====aaa====
18633 ==b==
18634 ===ba===
18635 ===bb===
18636 ====bba====
18637 ===bc===
18638 ==c==
18639 ===ca===
18640 !! html/php
18641 start
18642 ==a==
18643 ===aa===
18644 ====aaa====
18645 ==b==
18646 ===ba===
18647 ===bb===
18648 xxx
18649
18650 ===bc===
18651 ==c==
18652 ===ca===
18653 !! end
18654
18655 !! test
18656 Section replacement test (section 8)
18657 !! options
18658 replace=8,"xxx"
18659 !! wikitext
18660 start
18661 ==a==
18662 ===aa===
18663 ====aaa====
18664 ==b==
18665 ===ba===
18666 ===bb===
18667 ====bba====
18668 ===bc===
18669 ==c==
18670 ===ca===
18671 !! html/php
18672 start
18673 ==a==
18674 ===aa===
18675 ====aaa====
18676 ==b==
18677 ===ba===
18678 ===bb===
18679 ====bba====
18680 xxx
18681
18682 ==c==
18683 ===ca===
18684 !!end
18685
18686 !! test
18687 Section replacement test (section 9)
18688 !! options
18689 replace=9,"xxx"
18690 !! wikitext
18691 start
18692 ==a==
18693 ===aa===
18694 ====aaa====
18695 ==b==
18696 ===ba===
18697 ===bb===
18698 ====bba====
18699 ===bc===
18700 ==c==
18701 ===ca===
18702 !! html/php
18703 start
18704 ==a==
18705 ===aa===
18706 ====aaa====
18707 ==b==
18708 ===ba===
18709 ===bb===
18710 ====bba====
18711 ===bc===
18712 xxx
18713 !! end
18714
18715 !! test
18716 Section replacement test (section 10)
18717 !! options
18718 replace=10,"xxx"
18719 !! wikitext
18720 start
18721 ==a==
18722 ===aa===
18723 ====aaa====
18724 ==b==
18725 ===ba===
18726 ===bb===
18727 ====bba====
18728 ===bc===
18729 ==c==
18730 ===ca===
18731 !! html/php
18732 start
18733 ==a==
18734 ===aa===
18735 ====aaa====
18736 ==b==
18737 ===ba===
18738 ===bb===
18739 ====bba====
18740 ===bc===
18741 ==c==
18742 xxx
18743 !! end
18744
18745 !! test
18746 Section replacement test with initial whitespace (bug 13728)
18747 !! options
18748 replace=2,"xxx"
18749 !! wikitext
18750 Preformatted initial line
18751 ==a==
18752 ===a===
18753 !! html/php
18754 Preformatted initial line
18755 ==a==
18756 xxx
18757 !! end
18758
18759
18760 !! test
18761 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18762 !! options
18763 section=1
18764 !! wikitext
18765 ==a==
18766 a
18767 !! html/php
18768 ==a==
18769 a
18770 !! end
18771
18772 !! test
18773 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18774 !! options
18775 section=1
18776 !! wikitext
18777 ==a==
18778 a
18779 !! html/php
18780 ==a==
18781 a
18782 !! end
18783
18784
18785 !! test
18786 Section extraction, <pre> around bogus header (bug 10309)
18787 !! options
18788 section=2
18789 !! wikitext
18790 == Section One ==
18791 <pre>
18792 =======
18793 </pre>
18794
18795 == Section Two ==
18796 stuff
18797 !! html/php
18798 == Section Two ==
18799 stuff
18800 !! end
18801
18802 !! test
18803 Section replacement, <pre> around bogus header (bug 10309)
18804 !! options
18805 replace=2,"xxx"
18806 !! wikitext
18807 == Section One ==
18808 <pre>
18809 =======
18810 </pre>
18811
18812 == Section Two ==
18813 stuff
18814 !! html/php
18815 == Section One ==
18816 <pre>
18817 =======
18818 </pre>
18819
18820 xxx
18821 !! end
18822
18823
18824 !! test
18825 Handling of &#x0A; in URLs
18826 !! wikitext
18827 ** irc://&#x0A;a
18828 !! html/php
18829 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18830
18831 !! html/parsoid
18832 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18833 a">irc://
18834 a</a></li></ul></li></ul>
18835 !! end
18836
18837 !! test
18838 Handling of %0A in URLs
18839 !! wikitext
18840 ** irc://%0Aa
18841 !! html/php
18842 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18843
18844 !! html/parsoid
18845 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18846 !! end
18847
18848
18849 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18850 !! test
18851 5 quotes, code coverage +1 line
18852 !! options
18853 parsoid=wt2html
18854 !! wikitext
18855 '''''
18856 !! html/php
18857 !! html/parsoid
18858 <p><b><i></i></b></p>
18859 !! end
18860
18861 # same html as previous, but wikitext adjusted to match parsoid html2wt
18862 # note that wt2html and html2html will put the <i> before the <b>
18863 !! test
18864 5 quotes, code coverage +1 line w/ nowiki (1)
18865 !! options
18866 parsoid=wt2wt,html2wt
18867 !! wikitext
18868 '''''<nowiki/>'''''
18869 !! html/php
18870 <p><i></i>
18871 </p>
18872 !! html/parsoid
18873 <p><b><i></i></b></p>
18874 !! end
18875
18876 # same as previous, just swapping the <i> and <b>
18877 !! test
18878 5 quotes, code coverage +1 line w/ nowiki (2)
18879 !! wikitext
18880 '''''<nowiki/>'''''
18881 !! html/php
18882 <p><i></i>
18883 </p>
18884 !! html/parsoid
18885 <p><i><b></b></i></p>
18886 !! end
18887
18888 !! test
18889 Special:Search page linking.
18890 !! wikitext
18891 {{Special:search}}
18892 !! html
18893 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18894 </p>
18895 !! end
18896
18897 !! test
18898 {{!}} is a magic word
18899 !! wikitext
18900 {{!}} is a magic word there and {{!}} is still a magic word here
18901 | is not a magic word here but {{!}} is still a magic word here
18902 !! html/php
18903 <p>| is a magic word there and | is still a magic word here
18904 | is not a magic word here but | is still a magic word here
18905 </p>
18906 !! html/parsoid
18907 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
18908 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
18909
18910 !! end
18911
18912 !! test
18913 Say the magic word
18914 !! options
18915 title=[[Parser test]]
18916 !! wikitext
18917 * {{PAGENAME}}
18918 * {{PAGENAMEE}}
18919 * {{FULLPAGENAME}}
18920 * {{FULLPAGENAMEE}}
18921 * {{BASEPAGENAME}}
18922 * {{BASEPAGENAMEE}}
18923 * {{SUBPAGENAME}}
18924 * {{SUBPAGENAMEE}}
18925 * {{ROOTPAGENAME}}
18926 * {{ROOTPAGENAMEE}}
18927 * {{TALKPAGENAME}}
18928 * {{TALKPAGENAMEE}}
18929 * {{SUBJECTPAGENAME}}
18930 * {{SUBJECTPAGENAMEE}}
18931 * {{NAMESPACEE}}
18932 * {{NAMESPACE}}
18933 * {{NAMESPACENUMBER}}
18934 * {{TALKSPACE}}
18935 * {{TALKSPACEE}}
18936 * {{SUBJECTSPACE}}
18937 * {{SUBJECTSPACEE}}
18938 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18939 !! html
18940 <ul><li> Parser test</li>
18941 <li> Parser_test</li>
18942 <li> Parser test</li>
18943 <li> Parser_test</li>
18944 <li> Parser test</li>
18945 <li> Parser_test</li>
18946 <li> Parser test</li>
18947 <li> Parser_test</li>
18948 <li> Parser test</li>
18949 <li> Parser_test</li>
18950 <li> Talk:Parser test</li>
18951 <li> Talk:Parser_test</li>
18952 <li> Parser test</li>
18953 <li> Parser_test</li>
18954 <li> </li>
18955 <li> </li>
18956 <li> 0</li>
18957 <li> Talk</li>
18958 <li> Talk</li>
18959 <li> </li>
18960 <li> </li>
18961 <li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a></li></ul>
18962
18963 !! end
18964 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18965
18966 ## Parsoid thinks the "centre" here is a property, not a caption.
18967 !! test
18968 Gallery
18969 !! options
18970 parsoid={
18971 "modes": ["wt2html"],
18972 "nativeGallery": true
18973 }
18974 !! wikitext
18975 <gallery>
18976 image1.png |
18977 image2.gif|||||
18978
18979 image3|
18980 image4 |300px| centre
18981 image5.svg| http://///////
18982 [[x|xx]]]]
18983 * image6
18984 </gallery>
18985 !! html/php
18986 <ul class="gallery mw-gallery-traditional">
18987 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18988 <div class="thumb" style="height: 150px;">Image1.png</div>
18989 <div class="gallerytext">
18990 </div>
18991 </div></li>
18992 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18993 <div class="thumb" style="height: 150px;">Image2.gif</div>
18994 <div class="gallerytext">
18995 </div>
18996 </div></li>
18997 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18998 <div class="thumb" style="height: 150px;">Image3</div>
18999 <div class="gallerytext">
19000 </div>
19001 </div></li>
19002 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19003 <div class="thumb" style="height: 150px;">Image4</div>
19004 <div class="gallerytext">
19005 <pre>centre
19006 </pre>
19007 </div>
19008 </div></li>
19009 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19010 <div class="thumb" style="height: 150px;">Image5.svg</div>
19011 <div class="gallerytext">
19012 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19013 </p>
19014 </div>
19015 </div></li>
19016 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19017 <div class="thumb" style="height: 150px;">* image6</div>
19018 <div class="gallerytext">
19019 </div>
19020 </div></li>
19021 </ul>
19022
19023 !! html/parsoid
19024 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19025 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image1.png </span></div><div class="gallerytext"></div></li>
19026 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image2.gif</span></div><div class="gallerytext"></div></li>
19027 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image3</span></div><div class="gallerytext"></div></li>
19028 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image4 </span></div><div class="gallerytext"></div></li>
19029 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;"> image5.svg</span></div><div class="gallerytext"> <a rel="mw:ExtLink" href="http://///////">http://///////</a></div></li>
19030 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">* image6</span></div><div class="gallerytext"></div></li>
19031 </ul>
19032 !! end
19033
19034 !! test
19035 Gallery (with options, html)
19036 !! options
19037 parsoid={
19038 "modes": ["wt2html", "html2html"],
19039 "nativeGallery": true
19040 }
19041 !! wikitext
19042 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19043 File:Nonexistent.jpg|caption
19044 File:Nonexistent.jpg
19045 image:foobar.jpg|some '''caption''' [[Main Page]]
19046 image:foobar.jpg
19047 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19048 </gallery>
19049 !! html/php
19050 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19051 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19052 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19053 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19054 <div class="gallerytext">
19055 <p>caption
19056 </p>
19057 </div>
19058 </div></li>
19059 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19060 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19061 <div class="gallerytext">
19062 </div>
19063 </div></li>
19064 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19065 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
19066 <div class="gallerytext">
19067 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19068 </p>
19069 </div>
19070 </div></li>
19071 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19072 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
19073 <div class="gallerytext">
19074 </div>
19075 </div></li>
19076 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19077 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
19078 <div class="gallerytext">
19079 <p>blabla.
19080 </p>
19081 </div>
19082 </div></li>
19083 </ul>
19084
19085 !! html/parsoid
19086 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2"},"body":{}}'>
19087 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19088 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19089 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19090 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
19091 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext"></div></li>
19092 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">blabla.</div></li>
19093 </ul>
19094 !! end
19095
19096 !! test
19097 Gallery (with options, extsrc)
19098 !! options
19099 parsoid={
19100 "nativeGallery": false
19101 }
19102 !! wikitext
19103 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19104 File:Nonexistent.jpg|caption
19105 File:Nonexistent.jpg
19106 image:foobar.jpg|some '''caption''' [[Main Page]]
19107 image:foobar.jpg
19108 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19109 </gallery>
19110 !! html/php
19111 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19112 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19113 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19114 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19115 <div class="gallerytext">
19116 <p>caption
19117 </p>
19118 </div>
19119 </div></li>
19120 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19121 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19122 <div class="gallerytext">
19123 </div>
19124 </div></li>
19125 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19126 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
19127 <div class="gallerytext">
19128 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19129 </p>
19130 </div>
19131 </div></li>
19132 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19133 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
19134 <div class="gallerytext">
19135 </div>
19136 </div></li>
19137 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19138 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
19139 <div class="gallerytext">
19140 <p>blabla.
19141 </p>
19142 </div>
19143 </div></li>
19144 </ul>
19145
19146 !! html/parsoid
19147 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-parsoid='{}' data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &#39;&#39;&#39;caption&#39;&#39;&#39; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
19148 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19149 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19150 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19151 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
19152 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext"></div></li>
19153 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">blabla.</div></li>
19154 </ul>
19155 !! end
19156
19157 !! test
19158 Gallery with link that has fragment
19159 !! options
19160 parsoid={
19161 "modes": ["wt2html", "html2html"],
19162 "nativeGallery": true
19163 }
19164 !! wikitext
19165 <gallery>
19166 image:foobar.jpg|link=Main_Page
19167 image:foobar.jpg|link=Main_Page#section
19168 image:foobar.jpg|link=Main Page#section|caption
19169 </gallery>
19170 !! html/php
19171 <ul class="gallery mw-gallery-traditional">
19172 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19173 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19174 <div class="gallerytext">
19175 </div>
19176 </div></li>
19177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19178 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19179 <div class="gallerytext">
19180 </div>
19181 </div></li>
19182 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19183 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19184 <div class="gallerytext">
19185 <p>caption
19186 </p>
19187 </div>
19188 </div></li>
19189 </ul>
19190
19191 !! html/parsoid
19192 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19193 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19194 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19195 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext">caption</div></li>
19196 </ul>
19197 !! end
19198
19199 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19200 !! test
19201 Gallery with template inside caption
19202 !! options
19203 parsoid={
19204 "nativeGallery": true
19205 }
19206 !! wikitext
19207 <gallery caption="{{echo|hi}}">
19208 File:Foobar.jpg|{{echo|ho}}
19209 </gallery>
19210 !! html/php
19211 <ul class="gallery mw-gallery-traditional">
19212 <li class='gallerycaption'>{{echo|hi}}</li>
19213 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19214 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19215 <div class="gallerytext">
19216 <p>ho
19217 </p>
19218 </div>
19219 </div></li>
19220 </ul>
19221
19222 !! html/parsoid
19223 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19224 <li class="gallerycaption"><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span></li>
19225 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho"}},"i":0}}]}'>ho</span></div></li>
19226 </ul>
19227 !! end
19228
19229 !! test
19230 Gallery with wikitext inside caption
19231 !! options
19232 parsoid={
19233 "nativeGallery": true
19234 }
19235 !! wikitext
19236 <gallery>
19237 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19238 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19239 </gallery>
19240 !! html/php
19241 <ul class="gallery mw-gallery-traditional">
19242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19243 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19244 <div class="gallerytext">
19245 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
19246 </p>
19247 </div>
19248 </div></li>
19249 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19250 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19251 <div class="gallerytext">
19252 <p>This is a test template
19253 </p>
19254 </div>
19255 </div></li>
19256 </ul>
19257
19258 !! html/parsoid
19259 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19260 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><span typeof="mw:Image" data-mw='{"caption":"desc"}'><a href="./File:Foobar.jpg"><img alt="inneralt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span></div></li>
19261 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"param"}},"i":0}}]}'>This is a test template</span></div></li>
19262 </ul>
19263 !! end
19264
19265 !! test
19266 Gallery (with showfilename option)
19267 !! options
19268 parsoid={
19269 "nativeGallery": true
19270 }
19271 !! wikitext
19272 <gallery showfilename="">
19273 File:Nonexistent.jpg|caption
19274 File:Nonexistent.jpg
19275 File:Foobar.jpg|some '''caption''' [[Main Page]]
19276 File:Foobar.jpg
19277 </gallery>
19278 !! html/php
19279 <ul class="gallery mw-gallery-traditional">
19280 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19281 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19282 <div class="gallerytext">
19283 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19284 caption
19285 </p>
19286 </div>
19287 </div></li>
19288 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19289 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19290 <div class="gallerytext">
19291 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19292 </p>
19293 </div>
19294 </div></li>
19295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19296 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19297 <div class="gallerytext">
19298 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19299 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19300 </p>
19301 </div>
19302 </div></li>
19303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19304 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19305 <div class="gallerytext">
19306 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19307 </p>
19308 </div>
19309 </div></li>
19310 </ul>
19311
19312 !! html/parsoid
19313 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19314 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
19315 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
19316 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
19317 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
19318 </ul>
19319 !! end
19320
19321 ## Should Parsoid be preserving these variations?
19322 !! test
19323 Gallery (with namespace-less filenames)
19324 !! options
19325 parsoid={
19326 "modes": ["wt2html", "html2html"],
19327 "nativeGallery": true
19328 }
19329 !! wikitext
19330 <gallery>
19331 File:Nonexistent.jpg
19332 Nonexistent.jpg
19333 image:foobar.jpg
19334 foobar.jpg
19335 </gallery>
19336 !! html/php
19337 <ul class="gallery mw-gallery-traditional">
19338 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19339 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19340 <div class="gallerytext">
19341 </div>
19342 </div></li>
19343 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19344 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19345 <div class="gallerytext">
19346 </div>
19347 </div></li>
19348 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19349 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19350 <div class="gallerytext">
19351 </div>
19352 </div></li>
19353 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19354 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19355 <div class="gallerytext">
19356 </div>
19357 </div></li>
19358 </ul>
19359
19360 !! html/parsoid
19361 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19362 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19363 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19364 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19365 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19366 </ul>
19367 !! end
19368
19369 !! test
19370 Gallery override link with WikiLink (T36852)
19371 !! options
19372 parsoid={
19373 "nativeGallery": true
19374 }
19375 !! wikitext
19376 <gallery>
19377 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19378 </gallery>
19379 !! html/php
19380 <ul class="gallery mw-gallery-traditional">
19381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19382 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19383 <div class="gallerytext">
19384 </div>
19385 </div></li>
19386 </ul>
19387
19388 !! html/parsoid
19389 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-parsoid='{"dsr":[0,70,2,2]}' data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19390 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./InterWikiLink"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19391 </ul>
19392 !! end
19393
19394 !! test
19395 Gallery override link with absolute external link (T36852)
19396 !! options
19397 parsoid={
19398 "nativeGallery": true
19399 }
19400 !! wikitext
19401 <gallery>
19402 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19403 </gallery>
19404 !! html/php
19405 <ul class="gallery mw-gallery-traditional">
19406 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19407 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19408 <div class="gallerytext">
19409 </div>
19410 </div></li>
19411 </ul>
19412
19413 !! html/parsoid
19414 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19415 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19416 </ul>
19417 !! end
19418
19419 !! test
19420 Gallery override link with malicious javascript (T36852)
19421 !! options
19422 parsoid={
19423 "modes": ["wt2html", "html2html"],
19424 "nativeGallery": true
19425 }
19426 !! wikitext
19427 <gallery>
19428 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19429 </gallery>
19430 !! html/php
19431 <ul class="gallery mw-gallery-traditional">
19432 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19433 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19434 <div class="gallerytext">
19435 </div>
19436 </div></li>
19437 </ul>
19438
19439 !! html/parsoid
19440 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19441 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./&quot;_onclick=&quot;alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19442 </ul>
19443 !! end
19444
19445 !! test
19446 Gallery with invalid title as link (T45964)
19447 !! options
19448 parsoid={
19449 "modes": ["wt2html", "html2html"],
19450 "nativeGallery": true
19451 }
19452 !! wikitext
19453 <gallery>
19454 File:Foobar.jpg|link=<
19455 </gallery>
19456 !! html/php
19457 <ul class="gallery mw-gallery-traditional">
19458 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19459 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19460 <div class="gallerytext">
19461 </div>
19462 </div></li>
19463 </ul>
19464
19465 !! html/parsoid
19466 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19467 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext">link=&lt;</div></li>
19468 </ul>
19469 !! end
19470
19471 !! test
19472 HTML Hex character encoding (spells the word "JavaScript")
19473 !! options
19474 parsoid=wt2html,wt2wt,html2html
19475 !! wikitext
19476 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19477 !! html/php
19478 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19479 </p>
19480 !! html/php+tidy
19481 <p>JavaScript</p>
19482 !! html/parsoid
19483 <p><span typeof="mw:Entity">J</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">v</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">S</span><span typeof="mw:Entity">c</span><span typeof="mw:Entity">r</span><span typeof="mw:Entity">i</span><span typeof="mw:Entity">p</span><span typeof="mw:Entity">t</span></p>
19484 !! end
19485
19486 !! test
19487 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19488 !! wikitext
19489 &#xsee;&#XSEE;
19490 !! html/php
19491 <p>&amp;#xsee;&amp;#XSEE;
19492 </p>
19493 !! html/parsoid
19494 <p>&amp;#xsee;&amp;#XSEE;</p>
19495 !! end
19496
19497 !! test
19498 HTML Hex character encoding mixed case
19499 !! options
19500 parsoid=wt2html,wt2wt,html2html
19501 !! wikitext
19502 &#xEE;&#Xee;
19503 !! html/php
19504 <p>&#xee;&#xee;
19505 </p>
19506 !! html/php+tidy
19507 <p>îî</p>
19508 !! html/parsoid
19509 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19510 !! end
19511
19512 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19513 # Note that U+000C (form feed) is not a valid XML character, so
19514 # it is banned even though allowed in HTML5.
19515 !! test
19516 Illegal character references (T106578)
19517 !! wikitext
19518 ; Null: &#00;
19519 ; FF: &#xC;
19520 ; CR: &#xD;
19521 ; Control (low): &#8;
19522 ; Control (high): &#x7F; &#x9F;
19523 ; Surrogate: &#xD83D;&#xDCA9;
19524 ; This is an okay astral character: &#x1F4A9;
19525 !! html+tidy
19526 <dl>
19527 <dt>Null</dt>
19528 <dd>&amp;#00;</dd>
19529 <dt>FF</dt>
19530 <dd>&amp;#xC;</dd>
19531 <dt>CR</dt>
19532 <dd>&amp;#xD;</dd>
19533 <dt>Control (low)</dt>
19534 <dd>&amp;#8;</dd>
19535 <dt>Control (high)</dt>
19536 <dd>&amp;#x7F; &amp;#x9F;</dd>
19537 <dt>Surrogate</dt>
19538 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19539 <dt>This is an okay astral character</dt>
19540 <dd>💩</dd>
19541 </dl>
19542 !! end
19543
19544 !! test
19545 __FORCETOC__ override
19546 !! wikitext
19547 __NEWSECTIONLINK__
19548 __FORCETOC__
19549 !! html/php
19550 <p><br />
19551 </p>
19552 !! end
19553
19554 !! test
19555 ISBN code coverage
19556 !! wikitext
19557 ISBN 978-0-1234-56&#x20;789
19558 !! html
19559 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19560 </p>
19561 !! html+tidy
19562 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19563 !! html/parsoid
19564 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
19565 !! end
19566
19567 !! test
19568 ISBN followed by 5 spaces
19569 !! wikitext
19570 ISBN
19571 !! html
19572 <p>ISBN
19573 </p>
19574 !! end
19575
19576 !! test
19577 Double ISBN
19578 !! wikitext
19579 ISBN ISBN 1234567890
19580 !! html/php
19581 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19582 </p>
19583 !! html/parsoid
19584 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19585 !! end
19586
19587 # Uppercase X and lowercase x as well
19588 !! test
19589 ISBN with an X
19590 !! wikitext
19591 ISBN 3-462-04561-X
19592 ISBN 3-462-04561-x
19593 ISBN 080442957X
19594 ISBN 080442957x
19595 ISBN 978080442957X
19596 ISBN 978080442957x
19597 !! html/php
19598 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19599 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19600 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19601 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19602 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19603 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19604 </p>
19605 !! html/parsoid
19606 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19607 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19608 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19609 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19610 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19611 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19612 !! end
19613
19614 !! test
19615 ISBN with empty prefix (parsoid test)
19616 !! wikitext
19617 ISBN 1234567890
19618 !! html/php
19619 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19620 </p>
19621 !! html/parsoid
19622 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19623 !! end
19624
19625 !! test
19626 Bug 22905: <abbr> followed by ISBN followed by </a>
19627 !! wikitext
19628 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19629 !! html/php
19630 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
19631 </p>
19632 !! html/parsoid
19633 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
19634 !! end
19635
19636 !! test
19637 Double RFC
19638 !! wikitext
19639 RFC RFC 1234
19640 !! html
19641 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19642 </p>
19643 !! end
19644
19645 !! test
19646 Double RFC with a wiki link
19647 !! wikitext
19648 RFC [[RFC 1234]]
19649 !! html
19650 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
19651 </p>
19652 !! end
19653
19654 !! test
19655 RFC code coverage
19656 !! wikitext
19657 RFC 983&#x20;987
19658 !! html
19659 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19660 </p>
19661 !! html+tidy
19662 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19663 !! end
19664
19665 !! test
19666 Centre-aligned image
19667 !! wikitext
19668 [[Image:foobar.jpg|centre]]
19669 !! html
19670 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
19671
19672 !!end
19673
19674 !! test
19675 None-aligned image
19676 !! wikitext
19677 [[Image:foobar.jpg|none]]
19678 !! html
19679 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
19680
19681 !!end
19682
19683 !! test
19684 Width + Height sized image (using px) (height is ignored)
19685 !! wikitext
19686 [[Image:foobar.jpg|640x480px]]
19687 !! html
19688 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
19689 </p>
19690 !!end
19691
19692 !! test
19693 Width-sized image (using px, no following whitespace)
19694 !! wikitext
19695 [[Image:foobar.jpg|640px]]
19696 !! html
19697 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
19698 </p>
19699 !!end
19700
19701 !! test
19702 Width-sized image (using px, with following whitespace - test regression from r39467)
19703 !! wikitext
19704 [[Image:foobar.jpg|640px ]]
19705 !! html
19706 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
19707 </p>
19708 !!end
19709
19710 !! test
19711 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19712 !! wikitext
19713 [[Image:foobar.jpg| 640px]]
19714 !! html
19715 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
19716 </p>
19717 !!end
19718
19719 !! test
19720 Image with page parameter
19721 !! options
19722 djvu
19723 !! wikitext
19724 [[File:LoremIpsum.djvu|page=2]]
19725 !! html/php
19726 <p><a href="/index.php?title=File:LoremIpsum.djvu&amp;page=2" class="image"><img alt="LoremIpsum.djvu" src="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg" width="2480" height="3508" srcset="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg 1.5x, http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg 2x" /></a>
19727 </p>
19728 !! html/parsoid
19729 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
19730 !! end
19731
19732 !! test
19733 Another italics / bold test
19734 !! wikitext
19735 ''' ''x'
19736 !! html
19737 <pre>'<i> </i>x'
19738 </pre>
19739 !!end
19740
19741 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19742 !! test
19743 dt/dd/dl test
19744 !! wikitext
19745 :;;;::
19746 !! html/php
19747 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19748
19749 !! html/parsoid
19750 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19751
19752 !!end
19753
19754
19755 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19756 !! test
19757 Images with the "|" character in the comment
19758 !! wikitext
19759 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19760 !! html/php
19761 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
19762
19763 !! html/parsoid
19764 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
19765 !! end
19766
19767 !! test
19768 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19769 !! wikitext
19770 <html><script>alert(1);</script></html>
19771 !! html
19772 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19773 </p>
19774 !! end
19775
19776 !! test
19777 HTML with raw HTML ($wgRawHtml==true)
19778 !! options
19779 wgRawHtml=1
19780 !! wikitext
19781 <html><script>alert(1);</script></html>
19782 !! html
19783 <p><script>alert(1);</script>
19784 </p>
19785 !! end
19786
19787 !! test
19788 Parents of subpages, one level up
19789 !! options
19790 subpage title=[[Subpage test/L1/L2/L3]]
19791 !! wikitext
19792 [[../|L2]]
19793 !! html
19794 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
19795 </p>
19796 !! end
19797
19798
19799 !! test
19800 Parents of subpages, one level up, not named
19801 !! options
19802 subpage title=[[Subpage test/L1/L2/L3]]
19803 !! wikitext
19804 [[../]]
19805 !! html
19806 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
19807 </p>
19808 !! end
19809
19810
19811
19812 !! test
19813 Parents of subpages, two levels up
19814 !! options
19815 subpage title=[[Subpage test/L1/L2/L3]]
19816 !! wikitext
19817 [[../../|L1]]2
19818
19819 [[../../|L1]]l
19820 !! html
19821 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
19822 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
19823 </p>
19824 !! end
19825
19826 !! test
19827 Parents of subpages, two levels up, without trailing slash or name.
19828 !! options
19829 subpage title=[[Subpage test/L1/L2/L3]]
19830 !! wikitext
19831 [[../..]]
19832 !! html
19833 <p>[[../..]]
19834 </p>
19835 !! end
19836
19837 !! test
19838 Parents of subpages, two levels up, with lots of extra trailing slashes.
19839 !! options
19840 subpage title=[[Subpage test/L1/L2/L3]]
19841 !! wikitext
19842 [[../../////]]
19843 !! html
19844 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
19845 </p>
19846 !! end
19847
19848 !! article
19849 Subpage test/L1/L2/L3Sibling
19850 !! text
19851 Sibling article
19852 !! endarticle
19853
19854 !! test
19855 Transclusion of a sibling page (one level up)
19856 !! options
19857 subpage title=[[Subpage test/L1/L2/L3]]
19858 !! wikitext
19859 {{../L3Sibling}}
19860 !! html
19861 <p>Sibling article
19862 </p>
19863 !! end
19864
19865 !! test
19866 Transclusion of a child page
19867 !! options
19868 subpage title=[[Subpage test/L1/L2]]
19869 !! wikitext
19870 {{/L3Sibling}}
19871 !! html
19872 <p>Sibling article
19873 </p>
19874 !! end
19875
19876 # This is wt2html only in Parsoid because we add <nowiki>
19877 # because of {{..}} and we don't expect to fix that to
19878 # eliminate the nowikis selective for {{..}} markup.
19879 !! test
19880 Non-transclusion because of too many up levels
19881 !! options
19882 subpage title=[[Subpage test/L1/L2/L3]]
19883 parsoid=wt2html
19884 !! wikitext
19885 {{../../../../More than parent}}
19886 !! html/php
19887 <p>{{../../../../More than parent}}
19888 </p>
19889 !! html/parsoid
19890 <p>{{../../../../More than parent}}</p>
19891 !! end
19892
19893 !! test
19894 Definition list code coverage
19895 !! wikitext
19896 ; title : def
19897 ; title : def
19898 ;title: def
19899 !! html/php
19900 <dl><dt> title &#160;</dt>
19901 <dd> def</dd>
19902 <dt> title&#160;</dt>
19903 <dd> def</dd>
19904 <dt>title</dt>
19905 <dd> def</dd></dl>
19906
19907 !! html/parsoid
19908 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19909 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19910 <dt>title</dt><dd> def</dd></dl>
19911 !! end
19912
19913 !! test
19914 Don't fall for the self-closing div
19915 !! wikitext
19916 <div>hello world</div/>
19917 !! html
19918 <div>hello world</div>
19919
19920 !! end
19921
19922 !! test
19923 MSGNW magic word
19924 !! wikitext
19925 {{MSGNW:msg}}
19926 !! html/php
19927 <p>&#91;&#91;:Template:Msg&#93;&#93;
19928 </p>
19929 !! end
19930
19931 !! test
19932 RAW magic word
19933 !! wikitext
19934 {{RAW:QUERTY}}
19935 !! html
19936 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
19937 </p>
19938 !! end
19939
19940 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19941 !! test
19942 Always escape literal '>' in output, not just after '<'
19943 !! wikitext
19944 ><>
19945 !! html
19946 <p>&gt;&lt;&gt;
19947 </p>
19948 !! end
19949
19950 !! test
19951 Template caching
19952 !! wikitext
19953 {{Test}}
19954 {{Test}}
19955 !! html
19956 <p>This is a test template
19957 This is a test template
19958 </p>
19959 !! end
19960
19961
19962 !! article
19963 MediaWiki:Fake
19964 !! text
19965 ==header==
19966 !! endarticle
19967
19968 !! test
19969 Inclusion of !userCanEdit() content
19970 !! wikitext
19971 {{MediaWiki:Fake}}
19972 !! html
19973 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19974
19975 !! end
19976
19977
19978 !! test
19979 Out-of-order TOC heading levels
19980 !! wikitext
19981 ==2==
19982 ======6======
19983 ===3===
19984 =1=
19985 =====5=====
19986 ==2==
19987 !! html
19988 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19989 <ul>
19990 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19991 <ul>
19992 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19993 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19994 </ul>
19995 </li>
19996 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19997 <ul>
19998 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19999 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20000 </ul>
20001 </li>
20002 </ul>
20003 </div>
20004
20005 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20006 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
20007 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
20008 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
20009 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
20010 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20011
20012 !! end
20013
20014
20015 !! test
20016 ISBN with a dummy number
20017 !! wikitext
20018 ISBN ---
20019 !! html
20020 <p>ISBN ---
20021 </p>
20022 !! end
20023
20024
20025 !! test
20026 ISBN with space-delimited number
20027 !! wikitext
20028 ISBN 92 9017 032 8
20029 !! html
20030 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20031 </p>
20032 !! end
20033
20034
20035 !! test
20036 ISBN with multiple spaces, no number
20037 !! wikitext
20038 ISBN foo
20039 !! html
20040 <p>ISBN foo
20041 </p>
20042 !! end
20043
20044
20045 !! test
20046 ISBN length
20047 !! wikitext
20048 ISBN 123456789
20049
20050 ISBN 1234567890
20051
20052 ISBN 12345678901
20053 !! html
20054 <p>ISBN 123456789
20055 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20056 </p><p>ISBN 12345678901
20057 </p>
20058 !! end
20059
20060
20061 !! test
20062 ISBN with trailing year (bug 8110)
20063 !! wikitext
20064 ISBN 1-234-56789-0 - 2006
20065
20066 ISBN 1 234 56789 0 - 2006
20067 !! html
20068 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20069 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20070 </p>
20071 !! end
20072
20073
20074 !! test
20075 anchorencode
20076 !! wikitext
20077 {{anchorencode:foo bar©#%n}}
20078 !! html
20079 <p>foo_bar.C2.A9.23.25n
20080 </p>
20081 !! end
20082
20083 !! test
20084 anchorencode trims spaces
20085 !! wikitext
20086 {{anchorencode: __pretty__please__}}
20087 !! html
20088 <p>pretty_please
20089 </p>
20090 !! end
20091
20092 !! test
20093 anchorencode deals with links
20094 !! wikitext
20095 {{anchorencode: [[hello|world]] [[hi]]}}
20096 !! html
20097 <p>world_hi
20098 </p>
20099 !! end
20100
20101 !! test
20102 anchorencode deals with templates
20103 !! wikitext
20104 {{anchorencode: {{Foo}} }}
20105 !! html
20106 <p>FOO
20107 </p>
20108 !! end
20109
20110 !! test
20111 anchorencode encodes like the TOC generator: (bug 18431)
20112 !! wikitext
20113 === _ +:.3A%3A&&amp;]] ===
20114 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20115 __NOEDITSECTION__
20116 !! html
20117 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20118 <p>.2B:.3A.253A.26.26.5D.5D
20119 </p>
20120 !! end
20121
20122 !! test
20123 Bug 6200: blockquotes and paragraph formatting
20124 !! wikitext
20125 <blockquote>
20126 foo
20127 </blockquote>
20128
20129 bar
20130
20131 baz
20132 !! html
20133 <blockquote>
20134 <p>foo
20135 </p>
20136 </blockquote>
20137 <p>bar
20138 </p>
20139 <pre>baz
20140 </pre>
20141 !! end
20142
20143 !! test
20144 Bug 8293: Use of center tag ruins paragraph formatting
20145 !! wikitext
20146 <center>
20147 foo
20148 </center>
20149
20150 bar
20151
20152 baz
20153 !! html
20154 <center>
20155 <p>foo
20156 </p>
20157 </center>
20158 <p>bar
20159 </p>
20160 <pre>baz
20161 </pre>
20162 !! end
20163
20164 !!test
20165 Parsing of overlapping (improperly nested) inline html tags
20166 !! wikitext
20167 <span><s>x</span></s>
20168 !! html/php
20169 <p><span><s>x&lt;/span&gt;</s></span>
20170 </p>
20171 !! html/parsoid
20172 <p><span><s>x</s></span>
20173 </p>
20174 !!end
20175
20176 ###
20177 ### Language variants related tests
20178 ###
20179 !! test
20180 Self-link in language variants
20181 !! options
20182 title=[[Dunav]] language=sr
20183 !! wikitext
20184 Both [[Dunav]] and [[Дунав]] are names for this river.
20185 !! html
20186 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20187 </p>
20188 !!end
20189
20190 !! article
20191 Дуна
20192 !! text
20193 content
20194 !! endarticle
20195
20196 !! test
20197 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20198 !! options
20199 title=[[Duna]] language=sr
20200 !! wikitext
20201 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20202 !! html
20203 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
20204 </p>
20205 !! end
20206
20207 !! test
20208 Link to a section of a variant of this title shouldn't be parsed as self-link
20209 !! options
20210 title=[[Duna]] language=sr
20211 !! wikitext
20212 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20213 !! html
20214 <p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
20215 </p>
20216 !! end
20217
20218 !! test
20219 Link to pages in language variants
20220 !! options
20221 language=sr
20222 !! wikitext
20223 Main Page can be written as [[Маин Паге]]
20224 !! html
20225 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20226 </p>
20227 !!end
20228
20229
20230 !! test
20231 Multiple links to pages in language variants
20232 !! options
20233 language=sr
20234 !! wikitext
20235 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20236 !! html
20237 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
20238 </p>
20239 !!end
20240
20241
20242 !! test
20243 Simple template in language variants
20244 !! options
20245 language=sr
20246 !! wikitext
20247 {{тест}}
20248 !! html
20249 <p>This is a test template
20250 </p>
20251 !! end
20252
20253
20254 !! test
20255 Template with explicit namespace in language variants
20256 !! options
20257 language=sr
20258 !! wikitext
20259 {{Template:тест}}
20260 !! html
20261 <p>This is a test template
20262 </p>
20263 !! end
20264
20265
20266 !! test
20267 Basic test for template parameter in language variants
20268 !! options
20269 language=sr
20270 !! wikitext
20271 {{парамтест|param=foo}}
20272 !! html
20273 <p>This is a test template with parameter foo
20274 </p>
20275 !! end
20276
20277 !! test
20278 Simple category in language variants
20279 !! options
20280 language=sr cat
20281 !! wikitext
20282 [[Category:МедиаWики Усер'с Гуиде]]
20283 !! html/php
20284 cat=МедиаWики_Усер'с_Гуиде sort=
20285 !! html/parsoid
20286 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20287 !! end
20288
20289 !! article
20290 Category:分类
20291 !! text
20292 blah
20293 !! endarticle
20294
20295 !! article
20296 Category:分類
20297 !! text
20298 blah
20299 !! endarticle
20300
20301 ## We used to, but no longer wt2wt this test since the default serializer
20302 ## will normalize all categories to serialize on their own line.
20303 ## This wikitext usage is going to be fairly uncommon in production and
20304 ## selser will take care of preserving formatting in those scenarios.
20305 !! test
20306 Don't convert blue categorylinks to another variant (bug 33210)
20307 !! options
20308 cat
20309 language=zh
20310 parsoid=wt2html
20311 !! wikitext
20312 [[A]][[Category:分类]]
20313 !! html/php
20314 cat=分类 sort=
20315 !! html/parsoid
20316 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20317 <link rel="mw:PageProp/Category" href="Category:分类"/>
20318 !! end
20319
20320 !! test
20321 Stripping -{}- tags (language variants)
20322 !! options
20323 language=sr
20324 !! wikitext
20325 Latin proverb: -{Ne nuntium necare}-
20326 !! html
20327 <p>Latin proverb: Ne nuntium necare
20328 </p>
20329 !! end
20330
20331
20332 !! test
20333 Prevent conversion with -{}- tags (language variants)
20334 !! options
20335 language=sr variant=sr-ec
20336 !! wikitext
20337 Latinski: -{Ne nuntium necare}-
20338 !! html
20339 <p>Латински: Ne nuntium necare
20340 </p>
20341 !! end
20342
20343
20344 !! test
20345 Prevent conversion of text with -{}- tags (language variants)
20346 !! options
20347 language=sr variant=sr-ec
20348 !! wikitext
20349 Latinski: -{Ne nuntium necare}-
20350 !! html
20351 <p>Латински: Ne nuntium necare
20352 </p>
20353 !! end
20354
20355
20356 !! test
20357 Prevent conversion of links with -{}- tags (language variants)
20358 !! options
20359 language=sr variant=sr-ec
20360 !! wikitext
20361 -{[[Main Page]]}-
20362 !! html
20363 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20364 </p>
20365 !! end
20366
20367
20368 !! test
20369 -{}- tags within headlines (within html for parserConvert())
20370 !! options
20371 language=sr variant=sr-ec
20372 !! wikitext
20373 == -{Naslov}- ==
20374 !! html
20375 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
20376
20377 !! end
20378
20379
20380 !! test
20381 Explicit definition of language variant alternatives
20382 !! options
20383 language=zh variant=zh-tw
20384 !! wikitext
20385 -{zh:China;zh-tw:Taiwan}-, not China
20386 !! html
20387 <p>Taiwan, not China
20388 </p>
20389 !! end
20390
20391
20392 !! test
20393 Conversion around HTML tags
20394 !! options
20395 language=sr variant=sr-ec
20396 !! wikitext
20397 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20398 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20399 !! html
20400 <p>
20401 <span title="ЛаCтин">ски</span>
20402 </p>
20403 !! end
20404
20405
20406 !! test
20407 Explicit session-wise language variant mapping (A flag and - flag)
20408 !! options
20409 language=zh variant=zh-tw
20410 !! wikitext
20411 Taiwan is not China.
20412 But -{A|zh:China;zh-tw:Taiwan}- is China,
20413 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20414 and -{China}- is China.
20415 !! html
20416 <p>Taiwan is not China.
20417 But Taiwan is Taiwan,
20418 (This should be stripped!)
20419 and China is China.
20420 </p>
20421 !! end
20422
20423 !! test
20424 Explicit session-wise language variant mapping (H flag for hide)
20425 !! options
20426 language=zh variant=zh-tw
20427 !! wikitext
20428 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20429 Taiwan is China.
20430 !! html
20431 <p>(This should be stripped!)
20432 Taiwan is Taiwan.
20433 </p>
20434 !! end
20435
20436 !! test
20437 Adding explicit conversion rule for title (T flag)
20438 !! options
20439 language=zh variant=zh-tw showtitle
20440 !! wikitext
20441 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20442 !! html
20443 Taiwan
20444 <p>Should be stripped!
20445 </p>
20446 !! end
20447
20448 !! test
20449 Testing that changing the language variant here in the tests actually works
20450 !! options
20451 language=zh variant=zh showtitle
20452 !! wikitext
20453 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20454 !! html
20455 China
20456 <p>Should be stripped!
20457 </p>
20458 !! end
20459
20460 !! test
20461 Recursive conversion of alt and title attrs shouldn't clear converter state
20462 !! options
20463 language=zh variant=zh-cn showtitle
20464 !! wikitext
20465 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20466 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20467 !! html
20468 China
20469 <p>
20470 Should be stripped<span title="Exclamation">!</span>
20471 </p>
20472 !! end
20473
20474 !! test
20475 Bug 24072: more test on conversion rule for title
20476 !! options
20477 language=zh variant=zh-tw showtitle
20478 !! wikitext
20479 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20480 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20481 !! html
20482 Taiwan
20483 <p>This should be stripped!
20484 This won't take interferes with the title rule.
20485 </p>
20486 !! end
20487
20488 !! test
20489 Partly disable title conversion if variant == main language code
20490 !! options
20491 language=zh variant=zh title=[[ZH]] showtitle
20492 !! wikitext
20493 -{T|zh-cn:CN;zh-tw:TW}-
20494 !! html
20495 ZH
20496 <p>
20497 </p>
20498 !! end
20499
20500 !! test
20501 Partly disable title conversion if variant == main language code, more
20502 !! options
20503 language=zh variant=zh title=[[ZH]] showtitle
20504 !! wikitext
20505 -{T|TW}-
20506 !! html
20507 ZH
20508 <p>
20509 </p>
20510 !! end
20511
20512 !! test
20513 Raw output of variant escape tags (R flag)
20514 !! options
20515 language=zh variant=zh-tw
20516 !! wikitext
20517 Raw: -{R|zh:China;zh-tw:Taiwan}-
20518 !! html
20519 <p>Raw: zh:China;zh-tw:Taiwan
20520 </p>
20521 !! end
20522
20523 !! test
20524 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20525 !! options
20526 language=zh variant=zh-cn
20527 !! input
20528 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20529 !! result
20530 <p>0
20531 </p>
20532 !! end
20533
20534 !! test
20535 Conversion rules from [numeric-only string] to [something else] (T48634)
20536 !! options
20537 language=zh variant=zh-cn
20538 !! input
20539 -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345
20540 !! result
20541 <p>D12345EE12345
20542 </p>
20543 !! end
20544
20545 !! test
20546 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20547 !! options
20548 language=zh variant=zh-cn
20549 !! input
20550 -{H|zh-cn:foo;zh-tw:;}-foobar
20551 !! result
20552 <p>foobar
20553 </p>
20554 !! end
20555
20556 !! test
20557 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20558 !! options
20559 language=zh variant=zh-cn
20560 !! input
20561 -{H|=>zh-cn:foo;}-foobar
20562 !! result
20563 <p>foobar
20564 </p>
20565 !! end
20566
20567 !! test
20568 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20569 !! options
20570 language=zh variant=zh-cn
20571 !! input
20572 -{H|}-foobar
20573 !! result
20574 <p>foobar
20575 </p>
20576 !! end
20577
20578 !! test
20579 Nested using of manual convert syntax
20580 !! options
20581 language=zh variant=zh-hk
20582 !! wikitext
20583 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20584 !! html
20585 <p>Nested: Hello Hong Kong!
20586 </p>
20587 !! end
20588
20589 # Since Parsoid is starting to emit canonical wikitext for links,
20590 # [http://example.com http://example.com] will not RT back to that
20591 # form anymore.
20592 !! test
20593 Proper conversion of text in external links
20594 !! options
20595 language=sr variant=sr-ec
20596 parsoid=wt2html
20597 !! wikitext
20598 http://www.google.com
20599 gopher://www.google.com
20600 [http://www.google.com http://www.google.com]
20601 [gopher://www.google.com gopher://www.google.com]
20602 [https://www.google.com irc://www.google.com]
20603 [ftp://www.google.com www.google.com/ftp://dir]
20604 [//www.google.com www.google.com]
20605 !! html/php
20606 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20607 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20608 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20609 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20610 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20611 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20612 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20613 </p>
20614 !! html/parsoid
20615 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20616 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20617 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20618 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20619 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20620 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20621 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20622 !! end
20623
20624 !! test
20625 Do not convert roman numbers to language variants
20626 !! options
20627 language=sr variant=sr-ec
20628 !! wikitext
20629 Fridrih IV je car.
20630 !! html
20631 <p>Фридрих IV је цар.
20632 </p>
20633 !! end
20634
20635 !! test
20636 Unclosed language converter markup "-{"
20637 !! options
20638 language=sr
20639 !! wikitext
20640 -{T|hello
20641 !! html
20642 <p>-{T|hello
20643 </p>
20644 !! end
20645
20646 !! test
20647 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20648 !! options
20649 language=sr
20650 !! wikitext
20651 -{R|=&gt;}-
20652 !! html
20653 <p>=&gt;
20654 </p>
20655 !!end
20656
20657 !! test
20658 Don't break link parsing if language converter markup is in the caption.
20659 !! options
20660 language=sr variant=sr-ec
20661 !! wikitext
20662 [[Main Page|-{R|main page}-]]
20663 !! html
20664 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20665 </p>
20666 !! end
20667
20668 # FIXME: This test is currently broken in the PHP parser T153761
20669 !! test
20670 T146304: Don't break template parsing if language converter markup is in the parameter.
20671 !! options
20672 language=sr variant=sr-ec
20673 disabled
20674 !! wikitext
20675 {{echo|-{R|foo}-}}
20676 !! html/php
20677 <p>foo
20678 </p>
20679 !! end
20680
20681 !! test
20682 T146305: Don't break image parsing if language converter markup is in the caption.
20683 !! options
20684 language=sr
20685 !! wikitext
20686 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20687 !! html/php
20688 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећај"></a></div>caption:</div></div></div>
20689
20690 !! html/parsoid
20691 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./Датотека:Foobar.jpg"><img resource="./Датотека:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"caption:"}'></span></figcaption></figure>
20692 !! end
20693
20694 !! test
20695 T146305: Don't break image parsing if nested language converter markup is in the caption.
20696 !! options
20697 language=zh variant=zh-cn
20698 !! wikitext
20699 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20700 !! html/php
20701 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="放大"></a></div>blog (hk: WEBJOURNAL, tw: WEBLOG)</div></div></div>
20702
20703 !! html/parsoid
20704 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"blog (hk: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[42,64,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBJOURNAL\"}&#39;>&lt;/span>, tw: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[70,88,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBLOG\"}&#39;>&lt;/span>)"}],"show":true}'></span></figcaption></figure>
20705 !! end
20706
20707 !! test
20708 Don't break gallery if language converter markup is inside.
20709 !! options
20710 language=zh
20711 !! wikitext
20712 <gallery>
20713 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20714 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20715 </gallery>
20716 !! html
20717 <ul class="gallery mw-gallery-traditional">
20718 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20719 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="bat" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20720 <div class="gallerytext">
20721 <p><a href="/wiki/File:Foobar.jpg" class="image" title="bar"><img alt="foo" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
20722 </p>
20723 </div>
20724 </div></li>
20725 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20726 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20727 <div class="gallerytext">
20728 <p>This is a test template
20729 </p>
20730 </div>
20731 </div></li>
20732 </ul>
20733
20734 !! end
20735
20736 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20737 !! test
20738 Don't break list handling if language converter markup is in the item.
20739 !! options
20740 language=zh variant=zh-cn
20741 !! wikitext
20742 ;-{zh-cn:AAA;zh-tw:BBB}-
20743 !! html/php
20744 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20745
20746 !! html/parsoid
20747 <dl><dt>AAA
20748 </dt></dl>
20749 !! end
20750
20751 !! test
20752 T153140: Don't break table handling if language converter markup is in the cell.
20753 !! options
20754 language=sr variant=sr-ec
20755 !! wikitext
20756 {|
20757 |-
20758 | -{R|B}-
20759 |}
20760 !! html/php
20761 <table>
20762
20763 <tr>
20764 <td> B
20765 </td></tr></table>
20766
20767 !! html/parsoid
20768 <table>
20769
20770 <tr>
20771 <td> B
20772 </td></tr></table>
20773
20774 !! end
20775
20776 !! test
20777 Bug 529: Uncovered bullet
20778 !! wikitext
20779 * Foo {{bullet}}
20780 !! html
20781 <ul><li> Foo </li>
20782 <li> Bar</li></ul>
20783
20784 !! end
20785
20786 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20787 # Templates in Wikipedia rely on this behavior, as tidy has always been
20788 # enabled there. These tests are normally run *without* tidy, so specify the
20789 # full output here.
20790 # To test realistic parsing behavior, apply a tidy-like transformation to both
20791 # the expected output and your parser's output.
20792 !! test
20793 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20794 !! wikitext
20795 ******* Foo {{bullet}}
20796 !! html
20797 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo </li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li>
20798 <li> Bar</li></ul>
20799
20800 !! end
20801
20802 !! test
20803 Bug 529: Uncovered table already at line-start
20804 !! wikitext
20805 x
20806
20807 {{table}}
20808 y
20809 !! html
20810 <p>x
20811 </p>
20812 <table>
20813 <tr>
20814 <td> 1 </td>
20815 <td> 2
20816 </td></tr>
20817 <tr>
20818 <td> 3 </td>
20819 <td> 4
20820 </td></tr></table>
20821 <p>y
20822 </p>
20823 !! end
20824
20825 !! test
20826 Bug 529: Uncovered bullet in parser function result
20827 !! wikitext
20828 * Foo {{lc:{{bullet}} }}
20829 !! html
20830 <ul><li> Foo </li>
20831 <li> bar</li></ul>
20832
20833 !! end
20834
20835 !! test
20836 Bug 5678: Double-parsed template argument
20837 !! wikitext
20838 {{lc:{{{1}}}|hello}}
20839 !! html
20840 <p>{{{1}}}
20841 </p>
20842 !! end
20843
20844 !! test
20845 Bug 5678: Double-parsed template invocation
20846 !! wikitext
20847 {{lc:{{paramtest {{!}} param = hello }} }}
20848 !! html
20849 <p>{{paramtest | param = hello }}
20850 </p>
20851 !! end
20852
20853 !! test
20854 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20855 !! options
20856 language=cs
20857 title=[[Main Page]]
20858 !! wikitext
20859 {{PRVNÍVELKÉ:ěščř}}
20860 {{prvnívelké:ěščř}}
20861 {{PRVNÍMALÉ:ěščř}}
20862 {{prvnímalé:ěščř}}
20863 {{MALÁ:ěščř}}
20864 {{malá:ěščř}}
20865 {{VELKÁ:ěščř}}
20866 {{velká:ěščř}}
20867 !! html
20868 <p>Ěščř
20869 Ěščř
20870 ěščř
20871 ěščř
20872 ěščř
20873 ěščř
20874 ĚŠČŘ
20875 ĚŠČŘ
20876 </p>
20877 !! end
20878
20879 !! test
20880 Morwen/13: Unclosed link followed by heading
20881 !! wikitext
20882 [[link
20883 ==heading==
20884 !! html
20885 <p>[[link
20886 </p>
20887 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20888
20889 !! end
20890
20891 !! test
20892 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20893 !! wikitext
20894 {{foo|
20895 =heading=
20896 !! html
20897 <p>{{foo|
20898 </p>
20899 <h1><span class="mw-headline" id="heading">heading</span></h1>
20900
20901 !! end
20902
20903 !! test
20904 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20905 !! wikitext
20906 {{foo|
20907 ==heading==
20908 !! html
20909 <p>{{foo|
20910 </p>
20911 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20912
20913 !! end
20914
20915 !! test
20916 Tildes in comments
20917 !! options
20918 pst
20919 !! wikitext
20920 <!-- ~~~~ -->
20921 !! html/php
20922 <!-- ~~~~ -->
20923 !! end
20924
20925 !! test
20926 Paragraphs inside divs (no extra line breaks)
20927 !! wikitext
20928 <div>Line one
20929
20930 Line two</div>
20931 !! html
20932 <div>Line one
20933 Line two</div>
20934
20935 !! end
20936
20937 !! test
20938 Paragraphs inside divs (extra line break on open)
20939 !! wikitext
20940 <div>
20941 Line one
20942
20943 Line two</div>
20944 !! html
20945 <div>
20946 <p>Line one
20947 </p>
20948 Line two</div>
20949
20950 !! end
20951
20952 !! test
20953 Paragraphs inside divs (extra line break on close)
20954 !! wikitext
20955 <div>Line one
20956
20957 Line two
20958 </div>
20959 !! html
20960 <div>Line one
20961 <p>Line two
20962 </p>
20963 </div>
20964
20965 !! end
20966
20967 !! test
20968 Paragraphs inside divs (extra line break on open and close)
20969 !! wikitext
20970 <div>
20971 Line one
20972
20973 Line two
20974 </div>
20975 !! html
20976 <div>
20977 <p>Line one
20978 </p><p>Line two
20979 </p>
20980 </div>
20981
20982 !! end
20983
20984 !! test
20985 Nesting tags, paragraphs on lines which begin with <div>
20986 !! wikitext
20987 <div></div><strong>A
20988 B</strong>
20989 !! html/php+tidy
20990 <p><strong>A</strong></p>
20991 <p><strong>B</strong></p>
20992 !! html/parsoid
20993 <div></div>
20994 <p><strong>A
20995 B</strong>
20996 </p>
20997 !! end
20998
20999 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21000 !! test
21001 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21002 !! wikitext
21003 <blockquote>Line one
21004
21005 Line two</blockquote>
21006 !! html
21007 <blockquote>Line one
21008 Line two</blockquote>
21009
21010 !! html+tidy
21011 <blockquote>
21012 <p>Line one Line two</p>
21013 </blockquote>
21014 !! end
21015
21016 !! test
21017 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21018 !! wikitext
21019 <blockquote>
21020 Line one
21021
21022 Line two</blockquote>
21023 !! html
21024 <blockquote>
21025 <p>Line one
21026 </p>
21027 Line two</blockquote>
21028
21029 !! html+tidy
21030 <blockquote>
21031 <p>Line one</p>
21032 Line two</blockquote>
21033 !! end
21034
21035 !! test
21036 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21037 !! wikitext
21038 <blockquote>Line one
21039
21040 Line two
21041 </blockquote>
21042 !! html
21043 <blockquote>Line one
21044 <p>Line two
21045 </p>
21046 </blockquote>
21047
21048 !! html+tidy
21049 <blockquote>
21050 <p>Line one</p>
21051 <p>Line two</p>
21052 </blockquote>
21053 !! end
21054
21055 !! test
21056 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21057 !! wikitext
21058 <blockquote>
21059 Line one
21060
21061 Line two
21062 </blockquote>
21063 !! html
21064 <blockquote>
21065 <p>Line one
21066 </p><p>Line two
21067 </p>
21068 </blockquote>
21069
21070 !! html+tidy
21071 <blockquote>
21072 <p>Line one</p>
21073 <p>Line two</p>
21074 </blockquote>
21075 !! end
21076
21077 !! test
21078 Paragraphs inside blockquotes/divs (no extra line breaks)
21079 !! wikitext
21080 <blockquote><div>Line one
21081
21082 Line two</div></blockquote>
21083 !! html
21084 <blockquote><div>Line one
21085 Line two</div></blockquote>
21086
21087 !! end
21088
21089 !! test
21090 Paragraphs inside blockquotes/divs (extra line break on open)
21091 !! wikitext
21092 <blockquote><div>
21093 Line one
21094
21095 Line two</div></blockquote>
21096 !! html
21097 <blockquote><div>
21098 <p>Line one
21099 </p>
21100 Line two</div></blockquote>
21101
21102 !! end
21103
21104 !! test
21105 Paragraphs inside blockquotes/divs (extra line break on close)
21106 !! wikitext
21107 <blockquote><div>Line one
21108
21109 Line two
21110 </div></blockquote>
21111 !! html
21112 <blockquote><div>Line one
21113 <p>Line two
21114 </p>
21115 </div></blockquote>
21116
21117 !! end
21118
21119 !! test
21120 Paragraphs inside blockquotes/divs (extra line break on open and close)
21121 !! wikitext
21122 <blockquote><div>
21123 Line one
21124
21125 Line two
21126 </div></blockquote>
21127 !! html
21128 <blockquote><div>
21129 <p>Line one
21130 </p><p>Line two
21131 </p>
21132 </div></blockquote>
21133
21134 !! end
21135
21136 !! test
21137 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21138 !! options
21139 wgLinkHolderBatchSize=0
21140 !! wikitext
21141 [[meatball:1]]
21142 [[meatball:2]]
21143 [[meatball:3]]
21144 !! html
21145 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21146 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21147 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21148 </p>
21149 !! end
21150
21151 !! test
21152 Free external link invading image caption
21153 !! wikitext
21154 [[Image:Foobar.jpg|thumb|http://x|hello]]
21155 !! html
21156 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>hello</div></div></div>
21157
21158 !! end
21159
21160 !! test
21161 Bug 15196: localised external link numbers
21162 !! options
21163 language=fa
21164 !! wikitext
21165 [http://en.wikipedia.org/]
21166 !! html/php
21167 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21168 </p>
21169 !! html/parsoid
21170 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21171 !! end
21172
21173 !! test
21174 Multibyte character in padleft
21175 !! wikitext
21176 {{padleft:-Hello|7|Æ}}
21177 !! html
21178 <p>Æ-Hello
21179 </p>
21180 !! end
21181
21182 !! test
21183 Multibyte character in padright
21184 !! wikitext
21185 {{padright:Hello-|7|Æ}}
21186 !! html
21187 <p>Hello-Æ
21188 </p>
21189 !! end
21190
21191 !!test
21192 formatdate parser function
21193 !! wikitext
21194 {{#formatdate:2009-03-24}}
21195 !! html
21196 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21197 </p>
21198 !! end
21199
21200 !!test
21201 formatdate parser function, with default format
21202 !! wikitext
21203 {{#formatdate:2009-03-24|mdy}}
21204 !! html
21205 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21206 </p>
21207 !! end
21208
21209 !! test
21210 Spacing of numbers in formatted dates
21211 !! wikitext
21212 {{#formatdate:January 15}}
21213 !! html
21214 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21215 </p>
21216 !! end
21217
21218 !! test
21219 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
21220 !! options
21221 language=nl title=[[MediaWiki:Common.css]]
21222 !! wikitext
21223 {{#formatdate:2009-03-24|dmy}}
21224 !! html
21225 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21226 </p>
21227 !! end
21228
21229 #
21230 #
21231 #
21232
21233 #
21234 # Edit comments
21235 #
21236
21237 !! test
21238 Edit comment with link
21239 !! options
21240 comment
21241 !! wikitext
21242 I like the [[Main Page]] a lot
21243 !! html/php
21244 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21245 !!end
21246
21247 !! test
21248 Edit comment with link and link text
21249 !! options
21250 comment
21251 !! wikitext
21252 I like the [[Main Page|best pages]] a lot
21253 !! html/php
21254 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21255 !!end
21256
21257 !! test
21258 Edit comment with link and link text with suffix
21259 !! options
21260 comment
21261 !! wikitext
21262 I like the [[Main Page|best page]]s a lot
21263 !! html/php
21264 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21265 !!end
21266
21267 !! test
21268 Edit comment with section link (non-local, eg in history list)
21269 !! options
21270 comment title=[[Main Page]]
21271 !! wikitext
21272 /* External links */ removed bogus entries
21273 !! html/php
21274 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21275 !!end
21276
21277 !! test
21278 Edit comment with section link and text before it (non-local, eg in history list)
21279 !! options
21280 comment title=[[Main Page]]
21281 !! wikitext
21282 pre-comment text /* External links */ removed bogus entries
21283 !! html/php
21284 pre-comment text <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21285 !!end
21286
21287 !! test
21288 Edit comment with section link (local, eg in diff view)
21289 !! options
21290 comment local title=[[Main Page]]
21291 !! wikitext
21292 /* External links */ removed bogus entries
21293 !! html/php
21294 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21295 !!end
21296
21297 !! test
21298 Edit comment with subpage link (bug 14080)
21299 !! options
21300 comment
21301 subpage
21302 title=[[Subpage test]]
21303 !! wikitext
21304 Poked at a [[/subpage]] here...
21305 !! html/php
21306 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21307 !!end
21308
21309 !! test
21310 Edit comment with subpage link and link text (bug 14080)
21311 !! options
21312 comment
21313 subpage
21314 title=[[Subpage test]]
21315 !! wikitext
21316 Poked at a [[/subpage|neat little page]] here...
21317 !! html/php
21318 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21319 !!end
21320
21321 !! test
21322 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21323 !! options
21324 comment
21325 title=[[Subpage test]]
21326 !! wikitext
21327 Poked at a [[/subpage]] here...
21328 !! html/php
21329 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
21330 !!end
21331
21332 !! test
21333 Edit comment with bare anchor link (local, as on diff)
21334 !! options
21335 comment
21336 local
21337 title=[[Main Page]]
21338 !! wikitext
21339 [[#section]]
21340 !! html/php
21341 <a href="#section">#section</a>
21342 !! end
21343
21344 !! test
21345 Edit comment with bare anchor link (non-local, as on history)
21346 !! options
21347 comment
21348 title=[[Main Page]]
21349 !! wikitext
21350 [[#section]]
21351 !! html/php
21352 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21353 !! end
21354
21355 !! test
21356 Anchor starting with underscore
21357 !! options
21358 title=[[Foo]]
21359 !! wikitext
21360 [[#_ref|One]]
21361 !! html/php
21362 <p><a href="#_ref">One</a>
21363 </p>
21364 !! html/parsoid
21365 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21366 !! end
21367
21368 !! test
21369 Id starting with underscore
21370 !! wikitext
21371 <div id="_ref"></div>
21372 !! html/*
21373 <div id="_ref"></div>
21374
21375 !! end
21376
21377 !! test
21378 Edit comment with link with more than one pipe (T99346)
21379 !! options
21380 comment
21381 !! wikitext
21382 [[Main Page|Many|pipes]]
21383 !! html/php
21384 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21385 !! end
21386
21387 !! test
21388 Complex edit comment with link with more than one pipe (T99346)
21389 !! options
21390 comment
21391 !! wikitext
21392 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21393 !! html/php
21394 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
21395 !! end
21396
21397 !! test
21398 Space normalisation on autocomment (bug 22784)
21399 !! options
21400 comment
21401 title=[[Main Page]]
21402 !! wikitext
21403 /* __hello__world__ */
21404 !! html/php
21405 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21406 !! end
21407
21408 !! test
21409 percent-encoding and + signs in comments (Bug 26410)
21410 !! options
21411 comment
21412 !! wikitext
21413 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21414 !! html/php
21415 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
21416 !! end
21417
21418 # Parsoid doesn't support this yet: see bug 73581
21419 # but it *should* omit the 'src' attribute if the image is bad.
21420 # PHP side of tests was disabled in
21421 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21422 # because of issues in the PHP parserTests infrastructure
21423 # (but the output below is indeed what the PHP side emits)
21424 !! test
21425 Bad images - basic functionality
21426 !! wikitext
21427 [[File:Bad.jpg]]
21428 !! DISABLED/html/php
21429 !! html/parsoid
21430 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
21431 !! end
21432
21433 !! test
21434 Bad images - bug 16039: text after bad image disappears
21435 !! wikitext
21436 Foo bar
21437 [[File:Bad.jpg]]
21438 Bar foo
21439 !! DISABLED/html/php
21440 <p>Foo bar
21441 </p><p>Bar foo
21442 </p>
21443 !! html/parsoid
21444 <p>Foo bar
21445 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
21446 Bar foo</p>
21447 !! end
21448
21449 !! test
21450 Verify that displaytitle works (bug #22501) no displaytitle
21451 !! options
21452 showtitle
21453 !! config
21454 wgAllowDisplayTitle=true
21455 wgRestrictDisplayTitle=false
21456 !! wikitext
21457 this is not the the title
21458 !! html/php
21459 Parser test
21460 <p>this is not the the title
21461 </p>
21462 !! end
21463
21464 !! test
21465 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21466 !! options
21467 showtitle
21468 title=[[Screen]]
21469 !! config
21470 wgAllowDisplayTitle=true
21471 wgRestrictDisplayTitle=false
21472 !! wikitext
21473 this is not the the title
21474 {{DISPLAYTITLE:whatever}}
21475 !! html/php
21476 whatever
21477 <p>this is not the the title
21478 </p>
21479 !! end
21480
21481 !! test
21482 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21483 !! options
21484 showtitle
21485 title=[[Screen]]
21486 !! config
21487 wgAllowDisplayTitle=true
21488 wgRestrictDisplayTitle=true
21489 !! wikitext
21490 this is not the the title
21491 {{DISPLAYTITLE:whatever}}
21492 !! html/php
21493 Screen
21494 <p>this is not the the title
21495 </p>
21496 !! end
21497
21498 !! test
21499 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21500 !! options
21501 showtitle
21502 title=[[Screen]]
21503 !! config
21504 wgAllowDisplayTitle=true
21505 wgRestrictDisplayTitle=true
21506 !! wikitext
21507 this is not the the title
21508 {{DISPLAYTITLE:screen}}
21509 !! html/php
21510 screen
21511 <p>this is not the the title
21512 </p>
21513 !! end
21514
21515 !! test
21516 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21517 !! options
21518 showtitle
21519 title=[[Screen]]
21520 !! config
21521 wgAllowDisplayTitle=false
21522 !! wikitext
21523 this is not the the title
21524 {{DISPLAYTITLE:screen}}
21525 !! html/php
21526 Screen
21527 <p>this is not the the title
21528 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
21529 </p>
21530 !! end
21531
21532 !! test
21533 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21534 !! options
21535 showtitle
21536 title=[[Screen]]
21537 !! config
21538 wgAllowDisplayTitle=false
21539 !! wikitext
21540 this is not the the title
21541 !! html/php
21542 Screen
21543 <p>this is not the the title
21544 </p>
21545 !! end
21546
21547 !! test
21548 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21549 !! options
21550 showtitle
21551 title=[[Screen]]
21552 !! config
21553 wgAllowDisplayTitle=true
21554 wgRestrictDisplayTitle=true
21555 !! wikitext
21556 this is not the the title
21557 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21558 !! html/php
21559 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21560 <p>this is not the the title
21561 </p>
21562 !! end
21563
21564 !! test
21565 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21566 !! options
21567 showtitle
21568 title=[[Screen]]
21569 !! config
21570 wgAllowDisplayTitle=true
21571 wgRestrictDisplayTitle=true
21572 !! wikitext
21573 this is not the the title
21574 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21575 !! html/php
21576 <span style="color: red;">s</span>creen
21577 <p>this is not the the title
21578 </p>
21579 !! end
21580
21581 !! test
21582 Page status indicators: Empty name is invalid
21583 !! options
21584 showindicators
21585 !! wikitext
21586 <indicator name=" "></indicator>
21587 <indicator></indicator>
21588 !! html
21589 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21590 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21591 </p>
21592 !! end
21593
21594 !! test
21595 Page status indicators: Weird syntaxes that are okay
21596 !! options
21597 showindicators
21598 !! wikitext
21599 <indicator name="empty" />
21600 <indicator name="name"></indicator>
21601 !! html
21602 empty=
21603 name=
21604 <p><br />
21605 </p>
21606 !! end
21607
21608 !! test
21609 Page status indicators: Torture test
21610 !! options
21611 showindicators
21612 !! wikitext
21613 <indicator name="01">hello world</indicator>
21614 <indicator name="02">[[Main Page]]</indicator>
21615 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21616 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21617 <indicator name="05">* foo
21618 * bar</indicator>
21619 <indicator name="06"><nowiki>foo</nowiki></indicator>
21620 <indicator name="07"> Preformatted</indicator>
21621 <indicator name="08"><div>Broken tag</indicator>
21622 <indicator name="09">{| class=wikitable
21623 | cell
21624 |}</indicator>
21625 <indicator name="10">Two
21626
21627 paragraphs</indicator>
21628 !! html
21629 01=hello world
21630 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21631 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
21632 04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
21633 05=<ul><li> foo</li>
21634 <li> bar</li></ul>
21635
21636 06=foo
21637 07=<pre>Preformatted
21638 </pre>
21639 08=<div>Broken tag</div>
21640
21641 09=<table class="wikitable">
21642 <tr>
21643 <td> cell
21644 </td></tr></table>
21645
21646 10=<p>Two
21647 </p><p>paragraphs
21648 </p>
21649 <p><br />
21650 </p><p><br />
21651 </p><p><br />
21652 </p><p><br />
21653 </p><p><br />
21654 </p>
21655 !! end
21656
21657 !! test
21658 preload: check <noinclude> and <includeonly>
21659 !! options
21660 preload
21661 !! wikitext
21662 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21663 !! html/php
21664 Hello kind world.
21665 !! end
21666
21667 !! test
21668 preload: check <onlyinclude>
21669 !! options
21670 preload
21671 !! wikitext
21672 Goodbye <onlyinclude>Hello world</onlyinclude>
21673 !! html/php
21674 Hello world
21675 !! end
21676
21677 !! test
21678 preload: can pass tags through if we want to
21679 !! options
21680 preload
21681 !! wikitext
21682 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21683 !! html/php
21684 <includeonly>Hello world</includeonly>
21685 !! end
21686
21687 !! test
21688 preload: check that it doesn't try to do tricks
21689 !! options
21690 preload
21691 !! wikitext
21692 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21693 !! html/php
21694 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21695 !! end
21696
21697 !! test
21698 Play a bit with r67090 and bug 3158
21699 !! wikitext
21700 <div style="width:50% !important">&nbsp;</div>
21701 <div style="width:50%&nbsp;!important">&nbsp;</div>
21702 <div style="width:50%&#160;!important">&nbsp;</div>
21703 <div style="border : solid;">&nbsp;</div>
21704 !! html/php
21705 <div style="width:50% !important">&#160;</div>
21706 <div style="width:50% !important">&#160;</div>
21707 <div style="width:50% !important">&#160;</div>
21708 <div style="border&#160;: solid;">&#160;</div>
21709
21710 !! html/parsoid
21711 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21712 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21713 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21714 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21715
21716 !! end
21717
21718 !! test
21719 HTML5 data attributes
21720 !! wikitext
21721 <span data-foo="bar">Baz</span>
21722 <p data-abc-def_hij="">Quuz</p>
21723 !! html/php
21724 <p><span data-foo="bar">Baz</span>
21725 </p>
21726 <p data-abc-def_hij="">Quuz</p>
21727
21728 !! html/parsoid
21729 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21730 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21731 !! end
21732
21733 !! test
21734 Strip reserved data attributes
21735 !! wikitext
21736 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21737 !! html/php
21738 <div data-ok="fred">d</div>
21739
21740 !! html/parsoid
21741 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
21742 !! end
21743
21744 !! test
21745 percent-encoding and + signs in internal links (Bug 26410)
21746 !! wikitext
21747 [[User:+%]] [[Page+title%]]
21748 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21749 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21750 [[%33%45]] [[%33%45+]]
21751 !! html/php
21752 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
21753 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
21754 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
21755 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
21756 </p>
21757 !! html/parsoid
21758 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
21759 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
21760 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
21761 <a rel="mw:WikiLink" href="./3E" title="3E" data-parsoid='{"stx":"simple","a":{"href":"./3E"},"sa":{"href":"%33%45"}}'>3E</a> <a rel="mw:WikiLink" href="./3E+" title="3E+" data-parsoid='{"stx":"simple","a":{"href":"./3E+"},"sa":{"href":"%33%45+"}}'>3E+</a></p>
21762 !! end
21763
21764 !! test
21765 Special characters in embedded file links (bug 27679)
21766 !! wikitext
21767 [[File:Contains & ampersand.jpg]]
21768 [[File:Does not exist.jpg|Title with & ampersand]]
21769 !! html/php
21770 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
21771 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
21772 </p>
21773 !! html/parsoid
21774 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
21775 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
21776 !! end
21777
21778 !! test
21779 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21780 !! wikitext
21781 Text&apos;s been normalized?
21782 !! html
21783 <p>Text&#39;s been normalized?
21784 </p>
21785 !! end
21786
21787 !! test
21788 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21789 !! wikitext
21790 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21791 !! html
21792 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21793 </p>
21794 !! end
21795
21796 !! test
21797 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21798 !! wikitext
21799 [http://www.example.org/ ideograms]
21800 !! html
21801 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21802 </p>
21803 !! end
21804
21805 !! test
21806 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21807 !! wikitext
21808 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21809 !! html
21810 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21811 </p>
21812 !! end
21813
21814 !! article
21815 Mediawiki:loop1
21816 !! text
21817 {{Identical|A}}
21818 !! endarticle
21819
21820 !! article
21821 Mediawiki:loop2
21822 !! text
21823 {{Identical|B}}
21824 !! endarticle
21825
21826 !! article
21827 Template:Identical
21828 !! text
21829 {{int:loop1}}
21830 {{int:loop2}}
21831 !! endarticle
21832
21833 !! test
21834 Bug 31098 Template which includes system messages which includes the template
21835 !! wikitext
21836 {{Identical}}
21837 !! html
21838 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21839 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21840 </p>
21841 !! end
21842
21843 !! test
21844 Bug31490 Turkish: ucfirst 'blah'
21845 !! options
21846 language=tr
21847 !! wikitext
21848 {{ucfirst:blah}}
21849 !! html
21850 <p>Blah
21851 </p>
21852 !! end
21853
21854 !! test
21855 Bug31490 Turkish: ucfirst 'ix'
21856 !! options
21857 language=tr
21858 !! wikitext
21859 {{ucfirst:ix}}
21860 !! html
21861 <p>İx
21862 </p>
21863 !! end
21864
21865 !! test
21866 Bug31490 Turkish: lcfirst 'BLAH'
21867 !! options
21868 language=tr
21869 !! wikitext
21870 {{lcfirst:BLAH}}
21871 !! html
21872 <p>bLAH
21873 </p>
21874 !! end
21875
21876 !! test
21877 Bug31490 Turkish: ucfırst (with a dotless i)
21878 !! options
21879 language=tr
21880 !! wikitext
21881 {{ucfırst:blah}}
21882 !! html
21883 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
21884 </p>
21885 !! end
21886
21887 !! test
21888 Bug31490 ucfırst (with a dotless i) with English language
21889 !! options
21890 language=en
21891 !! wikitext
21892 {{ucfırst:blah}}
21893 !! html
21894 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
21895 </p>
21896 !! end
21897
21898 !! test
21899 Bug 26375: TOC with italics
21900 !! options
21901 title=[[Main Page]]
21902 !! wikitext
21903 __TOC__
21904 == ''Lost'' episodes ==
21905 !! html
21906 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21907 <ul>
21908 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
21909 </ul>
21910 </div>
21911
21912 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21913
21914 !! end
21915
21916 !! test
21917 Bug 26375: TOC with bold
21918 !! options
21919 title=[[Main Page]]
21920 !! wikitext
21921 __TOC__
21922 == '''should be bold''' then normal text ==
21923 !! html
21924 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21925 <ul>
21926 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
21927 </ul>
21928 </div>
21929
21930 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21931
21932 !! end
21933
21934 !! test
21935 Bug 33845: Headings become cursive in TOC when they contain an image
21936 !! options
21937 title=[[Main Page]]
21938 !! wikitext
21939 __TOC__
21940 == Image [[Image:foobar.jpg]] ==
21941 !! html
21942 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21943 <ul>
21944 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21945 </ul>
21946 </div>
21947
21948 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21949
21950 !! end
21951
21952 !! test
21953 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21954 !! options
21955 title=[[Main Page]]
21956 !! wikitext
21957 __TOC__
21958 == <blockquote>Quote</blockquote> ==
21959 !! html
21960 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21961 <ul>
21962 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21963 </ul>
21964 </div>
21965
21966 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21967
21968 !! html+tidy
21969 <p></p>
21970 <div id="toc" class="toc">
21971 <div id="toctitle">
21972 <h2>Contents</h2>
21973 </div>
21974 <ul>
21975 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21976 </ul>
21977 </div>
21978 <p></p>
21979 <h2><span class="mw-headline" id="Quote"></span></h2>
21980 <blockquote>
21981 <p><span class="mw-headline" id="Quote">Quote</span></p>
21982 </blockquote>
21983 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></p>
21984 !! end
21985
21986 !! test
21987 Unclosed tags in TOC
21988 !! options
21989 title=[[Main Page]]
21990 !! wikitext
21991 __TOC__
21992 == Proof: 2 < 3 ==
21993 <small>Hanc marginis exiguitas non caperet.</small>
21994 QED
21995 !! html
21996 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21997 <ul>
21998 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
21999 </ul>
22000 </div>
22001
22002 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22003 <p><small>Hanc marginis exiguitas non caperet.</small>
22004 QED
22005 </p>
22006 !! end
22007
22008 !! test
22009 Multiple tags in TOC
22010 !! wikitext
22011 __TOC__
22012 == <i>Foo</i> <b>Bar</b> ==
22013
22014 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22015 !! html
22016 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22017 <ul>
22018 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
22019 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
22020 </ul>
22021 </div>
22022
22023 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22024 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22025
22026 !! html+tidy
22027 <p></p>
22028 <div id="toc" class="toc">
22029 <div id="toctitle">
22030 <h2>Contents</h2>
22031 </div>
22032 <ul>
22033 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
22034 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
22035 </ul>
22036 </div>
22037 <p></p>
22038 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22039 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22040 <blockquote>
22041 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22042 </blockquote>
22043 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></p>
22044 !! end
22045
22046 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22047 # html5 tag parsing.
22048 !! test
22049 Tags with parameters in TOC
22050 !! options
22051 parsoid=wt2html
22052 !! wikitext
22053 __TOC__
22054 == <sup class="in-h2">Hello</sup> ==
22055
22056 == <sup class="a > b">Evilbye</sup> ==
22057 !! html/php
22058 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22059 <ul>
22060 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22061 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
22062 </ul>
22063 </div>
22064
22065 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22066 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22067
22068 !! html/parsoid
22069 <meta property="mw:PageProp/toc" />
22070 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22071
22072 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22073 !! end
22074
22075 !! test
22076 span tags with directionality in TOC
22077 !! wikitext
22078 __TOC__
22079 == <span dir="ltr">C++</span> ==
22080
22081 == <span dir="rtl">זבנג!</span> ==
22082
22083 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22084
22085 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22086
22087 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22088 !! html
22089 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22090 <ul>
22091 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
22092 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
22093 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
22094 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
22095 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
22096 </ul>
22097 </div>
22098
22099 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22100 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22101 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22102 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22103 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22104
22105 !! end
22106
22107 !! test
22108 Bug 72884: bdi element in ToC
22109 !! wikitext
22110 __TOC__
22111 == <bdi>test</bdi> ==
22112 !! html
22113 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22114 <ul>
22115 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22116 </ul>
22117 </div>
22118
22119 <h2><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22120
22121 !! end
22122
22123 !! test
22124 T35715: s/strike element in ToC
22125 !! wikitext
22126 __TOC__
22127 == <s>test</s> test <strike>test</strike> ==
22128 !! html
22129 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22130 <ul>
22131 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
22132 </ul>
22133 </div>
22134
22135 <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22136
22137 !! end
22138
22139 # Note that the html output does not have the <p></p>, but the
22140 # html+tidy output *does*. This is because the empty <p></p> is
22141 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22142 !! test
22143 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22144 !! wikitext
22145 __TOC__
22146 == x ==
22147 !! html
22148 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22149 <ul>
22150 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22151 </ul>
22152 </div>
22153
22154 <h2><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22155
22156 !! html+tidy
22157 <p></p>
22158 <div id="toc" class="toc">
22159 <div id="toctitle">
22160 <h2>Contents</h2>
22161 </div>
22162 <ul>
22163 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22164 </ul>
22165 </div>
22166 <p></p>
22167 <h2><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22168 !! end
22169
22170 !! article
22171 MediaWiki:Bug32057
22172 !! text
22173 == {{int:headline_sample}} ==
22174 !! endarticle
22175
22176 !! test
22177 Bug 32057: Title needed when expanding <h> nodes.
22178 !! options
22179 title=[[Main Page]]
22180 !! wikitext
22181 {{int:Bug32057}}
22182 !! html
22183 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22184
22185 !! end
22186
22187 !! test
22188 Strip marker in urlencode
22189 !! wikitext
22190 {{urlencode:x<nowiki/>y}}
22191 {{urlencode:x<nowiki/>y|wiki}}
22192 {{urlencode:x<nowiki/>y|path}}
22193 {{urlencode:x<pre id="one">two</pre>y}}
22194 !! html/php
22195 <p>xy
22196 xy
22197 xy
22198 xy
22199 </p>
22200 !! end
22201
22202 !! test
22203 Strip marker in lc
22204 !! wikitext
22205 {{lc:x<nowiki/>y}}
22206 !! html
22207 <p>xy
22208 </p>
22209 !! end
22210
22211 !! test
22212 Strip marker in uc
22213 !! wikitext
22214 {{uc:x<nowiki/>y}}
22215 !! html
22216 <p>XY
22217 </p>
22218 !! end
22219
22220 !! test
22221 Strip marker in formatNum
22222 !! wikitext
22223 {{formatnum:1<nowiki/>2}}
22224 {{formatnum:1<nowiki/>2|R}}
22225 !! html
22226 <p>12
22227 12
22228 </p>
22229 !! end
22230
22231 !! test
22232 Check noCommafy in formatNum
22233 !! options
22234 language=be-tarask
22235 !! wikitext
22236 {{formatnum:123456.78}}
22237 {{formatnum:123456.78|NOSEP}}
22238 !! html
22239 <p>123 456,78
22240 123456.78
22241 </p>
22242 !! end
22243
22244 !! test
22245 Wrong option for formatNum (bug 56199)
22246 !! wikitext
22247 {{formatnum:1,234.56|Random}}
22248 {{formatnum:1,234.56|EVERYTHING}}
22249 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22250 !! html
22251 <p>1,234.56
22252 1,234.56
22253 1,234.56
22254 </p>
22255 !! end
22256
22257 !! test
22258 Strip marker in grammar
22259 !! options
22260 language=fi
22261 !! wikitext
22262 {{grammar:elative|foo<nowiki/>bar}}
22263 !! html
22264 <p>foobarista
22265 </p>
22266 !! end
22267
22268 !! test
22269 Strip marker in padleft
22270 !! wikitext
22271 {{padleft:|2|x<nowiki/>y}}
22272 !! html
22273 <p>xy
22274 </p>
22275 !! end
22276
22277 !! test
22278 Strip marker in padright
22279 !! wikitext
22280 {{padright:|2|x<nowiki/>y}}
22281 !! html
22282 <p>xy
22283 </p>
22284 !! end
22285
22286 !! test
22287 Strip marker in anchorencode
22288 !! wikitext
22289 {{anchorencode:x<nowiki/>y}}
22290 !! html
22291 <p>xy
22292 </p>
22293 !! end
22294
22295 !! test
22296 nowiki inside link inside heading (bug 18295)
22297 !! wikitext
22298 ==[[foo|x<nowiki>y</nowiki>z]]==
22299 !! html
22300 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22301
22302 !! end
22303
22304 !! test
22305 new support for bdi element (bug 31817)
22306 !! wikitext
22307 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22308 !! html
22309 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22310
22311 !!end
22312
22313 !! test
22314 Ignore pipe between table row attributes
22315 !! wikitext
22316 {|
22317 | quux
22318 |- id=foo | style='color: red'
22319 | bar
22320 |}
22321 !! html
22322 <table>
22323 <tr>
22324 <td> quux
22325 </td></tr>
22326 <tr id="foo" style="color: red">
22327 <td> bar
22328 </td></tr></table>
22329
22330 !! end
22331
22332 !!test
22333 Gallery override link with WikiLink (bug 34852)
22334 !! wikitext
22335 <gallery>
22336 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22337 </gallery>
22338 !! html
22339 <ul class="gallery mw-gallery-traditional">
22340 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22341 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
22342 <div class="gallerytext">
22343 <p>caption
22344 </p>
22345 </div>
22346 </div></li>
22347 </ul>
22348
22349 !! end
22350
22351 !!test
22352 Gallery override link with absolute external link (bug 34852)
22353 !! wikitext
22354 <gallery>
22355 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22356 </gallery>
22357 !! html
22358 <ul class="gallery mw-gallery-traditional">
22359 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22360 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
22361 <div class="gallerytext">
22362 <p>caption
22363 </p>
22364 </div>
22365 </div></li>
22366 </ul>
22367
22368 !! end
22369
22370 !! test
22371 Gallery override link with absolute external link with LanguageConverter
22372 !! options
22373 language=zh
22374 !! input
22375 <gallery>
22376 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22377 </gallery>
22378 !! result
22379 <ul class="gallery mw-gallery-traditional">
22380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22381 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
22382 <div class="gallerytext">
22383 <p>caption
22384 </p>
22385 </div>
22386 </div></li>
22387 </ul>
22388
22389 !! end
22390
22391 !!test
22392 Gallery override link with malicious javascript (bug 34852)
22393 !! wikitext
22394 <gallery>
22395 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
22396 </gallery>
22397 !! html
22398 <ul class="gallery mw-gallery-traditional">
22399 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22400 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
22401 <div class="gallerytext">
22402 <p>caption
22403 </p>
22404 </div>
22405 </div></li>
22406 </ul>
22407
22408 !! end
22409
22410 !!test
22411 Gallery with invalid title as link (bug 43964)
22412 !! wikitext
22413 <gallery>
22414 File:foobar.jpg|link=<
22415 </gallery>
22416 !! html
22417 <ul class="gallery mw-gallery-traditional">
22418 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22419 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
22420 <div class="gallerytext">
22421 </div>
22422 </div></li>
22423 </ul>
22424
22425 !! end
22426
22427 !!test
22428 Language parser function
22429 !! wikitext
22430 {{#language:ar}}
22431 !! html
22432 <p>العربية
22433 </p>
22434 !! end
22435
22436 !!test
22437 Padleft and padright as substr
22438 !! wikitext
22439 {{padleft:|3|abcde}}
22440 {{padright:|3|abcde}}
22441 !! html
22442 <p>abc
22443 abc
22444 </p>
22445 !! end
22446
22447 !!test
22448 Special parser function
22449 !! wikitext
22450 {{#special:RandomPage}}
22451 {{#special:BaDtItLe}}
22452 {{#special:Foobar}}
22453 !! html
22454 <p>Special:Random
22455 Special:Badtitle
22456 Special:Foobar
22457 </p>
22458 !! end
22459
22460 !!test
22461 Bug 34939 - Case insensitive link parsing ([HttP://])
22462 !! wikitext
22463 [HttP://MediaWiki.Org/]
22464 !! html/php
22465 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22466 </p>
22467 !! html/parsoid
22468 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22469 !! end
22470
22471 !!test
22472 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22473 !! wikitext
22474 [HttP://MediaWiki.Org/ MediaWiki]
22475 !! html
22476 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22477 </p>
22478 !! end
22479
22480 !!test
22481 Bug 34939 - Case insensitive link parsing (HttP://)
22482 !! wikitext
22483 HttP://MediaWiki.Org/
22484 !! html/php
22485 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22486 </p>
22487 !! html/parsoid
22488 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22489 !! end
22490
22491 !!test
22492 Disable TOC
22493 !! options
22494 notoc
22495 !! wikitext
22496 Lead
22497 == Section 1 ==
22498 == Section 2 ==
22499 == Section 3 ==
22500 == Section 4 ==
22501 == Section 5 ==
22502 !! html
22503 <p>Lead
22504 </p>
22505
22506 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22507 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22508 <h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22509 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22510 <h2><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22511
22512 !! end
22513
22514
22515 ###
22516 ### Parsoid-specific tests
22517 ### Parsoid-PHP parser incompatibilities
22518 ###
22519 !!test
22520 1. SOL-sensitive wikitext tokens as template-args
22521 !!options
22522 parsoid=wt2html,wt2wt
22523 !! wikitext
22524 {{echo|*a}}
22525 {{echo|#a}}
22526 {{echo|:a}}
22527 !! html
22528 <span about="#mwt1" typeof="mw:Transclusion">
22529 </span><ul about="#mwt1"><li>a</li>
22530 </ul>
22531 <span about="#mwt2" typeof="mw:Transclusion">
22532 </span><ol about="#mwt2"><li>a</li>
22533 </ol>
22534 <span about="#mwt3" typeof="mw:Transclusion">
22535 </span><dl about="#mwt3"><dd>a</dd>
22536 </dl>
22537 !!end
22538
22539 #### -----------------------------------------------------------------
22540 #### Parsoid-specific functionality tests
22541 #### -----------------------------------------------------------------
22542
22543 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22544 # We know wt2wt will fail, but we expect selser to pass.
22545 # Due to the nature of our testing, wt2wt and selser tests will enter the
22546 # blacklist and we'll catch selser regressions based on changes to the
22547 # blacklist entries for selser tests.
22548 !! test
22549 1. Bad treebuilder fixup of formatting elt is cleaned up
22550 !! options
22551 parsoid=wt2html,wt2wt
22552 !! wikitext
22553 {|
22554 |
22555 <small>
22556 [[Image:Foobar.jpg|right|Test]]
22557 </small>
22558 |}
22559 !! html/parsoid
22560 <table>
22561 <tbody><tr><td>
22562 <small>
22563 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure>
22564 </small>
22565 </td></tr>
22566 </tbody></table>
22567 !! end
22568
22569 !! test
22570 2. Bad treebuilder fixup of formatting elt is cleaned up
22571 !! options
22572 parsoid=wt2html,wt2wt
22573 !! wikitext
22574 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22575
22576 <small>[[Image:Foobar.jpg|right|300px]]</small>
22577 !! html/parsoid
22578
22579 <p><b>foo</b></p>
22580 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
22581 <p><b>bar</b></p>
22582 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
22583 !! end
22584
22585 !! test
22586 3. Bad treebuilder fixup of formatting elt is cleaned up
22587 !! options
22588 parsoid=wt2html,wt2wt
22589 !! wikitext
22590 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22591 !! html/parsoid
22592 <p><small><b>foo</b></small></p>
22593 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><small><b>caption</b></small></figcaption></figure>
22594 <p><small><b>bar</b></small></p>
22595 !! end
22596
22597 !! test
22598 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22599 !! options
22600 parsoid=wt2html,wt2wt
22601 !! wikitext
22602 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22603 !! html/parsoid
22604 <p><b><small></small></b></p>
22605 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure>
22606 <p></p>
22607 !! end
22608
22609 #### ----------------------------------------------------------------
22610 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22611 #### tags. Parsoid's output for these tags differs from that of the
22612 #### PHP parser.
22613 #### ----------------------------------------------------------------
22614
22615 !!test
22616 Ref: 1. ref-location should be replaced with an index span
22617 !! wikitext
22618 A <ref>foo</ref>
22619 B <ref name="x">foo</ref>
22620 C <ref name="y" />
22621 <references />
22622 !! html/parsoid
22623 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22624 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
22625 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="./Main_Page#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
22626 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22627 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22628 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Main_Page#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
22629 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Main_Page#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
22630 </ol>
22631 !!end
22632
22633 !!test
22634 Ref: 2. ref-tags with identical names should all get the same index
22635 !! wikitext
22636 A <ref name="x">foo</ref>
22637 B <ref name="x" />
22638 <references />
22639 !! html/parsoid
22640 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22641 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22642 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22643 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22644 </ol>
22645 !!end
22646
22647 !!test
22648 Ref: 3. spaces in ref-names should be ignored
22649 !! wikitext
22650 A <ref name="x">foo</ref>
22651 B <ref name=" x " />
22652 C <ref name= x />
22653 <references />
22654 !! html/parsoid
22655 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22656 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22657 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22658 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22659 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22660 </ol>
22661 !!end
22662
22663 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22664 !!test
22665 Ref: 4. 'constructor' should be accepted as a valid ref-name
22666 !! wikitext
22667 A <ref name="constructor">foo</ref>
22668 <references />
22669 !! html/parsoid
22670 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="./Main_Page#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22671 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22672 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Main_Page#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
22673 </ol>
22674 !!end
22675
22676 !!test
22677 Ref: 5. body should accept generic wikitext
22678 !! wikitext
22679 A <ref>
22680 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22681 </ref>
22682
22683 <references />
22684 !! html/parsoid
22685 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22686
22687 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22688 <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">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
22689 </span></li>
22690 </ol>
22691 !!end
22692
22693 !!test
22694 Ref: 6. indent-pres should not be output in ref-body
22695 !! wikitext
22696 A <ref>
22697 foo
22698 bar
22699 baz
22700 </ref>
22701
22702 <references />
22703 !! html/parsoid
22704 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22705
22706 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22707 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
22708 bar
22709 baz
22710 </span></li>
22711 </ol>
22712 !!end
22713
22714 !!test
22715 Ref: 7. No p-wrapping in ref-body
22716 !! wikitext
22717 A <ref>
22718 foo
22719
22720 bar
22721
22722
22723 baz
22724
22725
22726
22727 booz
22728 </ref>
22729
22730 <references />
22731 !! html/parsoid
22732 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22733
22734 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22735 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
22736
22737 bar
22738
22739
22740 baz
22741
22742
22743
22744 booz
22745 </span></li>
22746 </ol>
22747 !!end
22748
22749 !!test
22750 Ref: 8. transclusion wikitext has lower precedence
22751 !! wikitext
22752 A <ref> foo {{echo|</ref> B C}}
22753
22754 <references />
22755 !! html/parsoid
22756 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
22757 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22758 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
22759 </ol>
22760 !!end
22761
22762 !!test
22763 Ref: 9. unclosed comments should not leak out of ref-body
22764 !! wikitext
22765 A <ref> foo <!--</ref> B C
22766 <references />
22767 !! html/parsoid
22768 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22770 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
22771 </ol>
22772 !!end
22773
22774 !!test
22775 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22776 !! wikitext
22777 A <ref> <b> foo </ref> B C
22778
22779 <references />
22780 !! html/parsoid
22781 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22782
22783
22784 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22785 <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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
22786 </ol>
22787 !!end
22788
22789 !!test
22790 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22791 !! wikitext
22792 A <ref>foo</ref> B
22793 C <ref>bar</ref> D
22794 <references />
22795 !! html/parsoid
22796 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
22797 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22798 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22799 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22800 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22801 </ol>
22802 !!end
22803
22804 !!test
22805 Ref: 12. ref-tags act as trailing newline migration barrier
22806 !! wikitext
22807 <!--the newline at the end of this line moves out of the p tag-->a
22808
22809 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22810 <ref />
22811
22812 c
22813 <references />
22814 !! html/parsoid
22815 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22816
22817
22818 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22819 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22820
22821 <p>c</p>
22822 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22823 <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"></span></li>
22824 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
22825 !!end
22826
22827 !!test
22828 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22829 !! wikitext
22830 <ref>foo</ref> A
22831 <ref>bar
22832 </ref> B
22833 <references />
22834 !! html/parsoid
22835 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
22836 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22837 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22838 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22839 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
22840 </span></li>
22841 </ol>
22842 !!end
22843
22844 ## Roundtripping fails because of nowiki'ing
22845 !! test
22846 Ref: 14. A nested ref-tag should be emitted as plain text
22847 !! options
22848 parsoid=wt2html
22849 !! wikitext
22850 <ref>foo <ref>bar</ref> baz</ref>
22851
22852 <references />
22853 !! html/parsoid
22854 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
22855
22856 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo &lt;ref>bar</span></li></ol>
22857 !! end
22858
22859 !!test
22860 Ref: 15. ref-tags with identical names should get identical indexes
22861 !! wikitext
22862 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22863 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22864
22865 <references />
22866 !! html/parsoid
22867 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22868 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22869
22870 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22871 </ol>
22872 !!end
22873
22874 ## We don't bother wt2wt-ing non-standard whitespace
22875 !!test
22876 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22877 !!options
22878 parsoid=wt2html
22879 !! wikitext
22880 A <ref >foo</ref >
22881
22882 <references />
22883 !! html/parsoid
22884 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22885 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22886 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22887 !!end
22888
22889 !!test
22890 Ref: 17. Generate valid HTML5 id/about attributes
22891 !!wikitext
22892 <ref name="a b">foo</ref>
22893 <ref name=":0">ve-created name</ref>
22894
22895 <references />
22896 !!html/parsoid
22897 <p><span about="#mwt2" class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="./Main_Page#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span>
22898 <span about="#mwt4" class="mw-ref" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-:0-2"},"attrs":{"name":":0"}}'><a href="./Main_Page#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></span>
22899
22900 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Main_Page#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Main_Page#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol>
22901
22902 !!end
22903
22904 !!test
22905 Ref: 18. T58916: Extension attributes should be parsed as plain text
22906 !!wikitext
22907 <ref name="{{echo|a}}">foo</ref>
22908
22909 <references />
22910 !!html/parsoid
22911 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="./Main_Page#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
22912 </p>
22913
22914 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22915 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="./Main_Page#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
22916 </ol>
22917 !!end
22918
22919 !!test
22920 Ref: 19. ref-tags with identical name encodings should get identical indexes
22921 !! wikitext
22922 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22923
22924 <references />
22925 !! html/parsoid
22926 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22927 </p>
22928 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22929 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
22930 </ol>
22931 !!end
22932
22933 !!test
22934 Ref: 20. ref-tags with identical names but different content should keep it
22935 !! wikitext
22936 A <ref name="foo">Foo one</ref>
22937 B <ref name="foo">Foo two</ref>
22938 C <ref name="foo" />
22939
22940 <references />
22941 !! html/parsoid
22942 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22943 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22944 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22945
22946 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
22947 </ol>
22948 !!end
22949
22950 !!test
22951 References: 1. references tag without any refs should be handled properly
22952 !! wikitext
22953 <references />
22954 !! html/parsoid
22955 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22956 !!end
22957
22958 !!test
22959 References: 2. references tag with group only outputs references from that group
22960 !! wikitext
22961 A <ref group="a">foo</ref>
22962 B <ref group="b">bar</ref>
22963 C <ref>baz</ref>
22964
22965 <references group="a" />
22966 <references />
22967 <references group="b" />
22968 !! html/parsoid
22969 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22970 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="./Main_Page#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
22971 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
22972
22973 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22974 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22975 </ol>
22976 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22977 <li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
22978 </ol>
22979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22980 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22981 </ol>
22982 !!end
22983
22984 !!test
22985 References: 3. ref list should be cleared after processing references
22986 !! wikitext
22987 A <ref>foo</ref>
22988
22989 <references />
22990
22991 B <ref>bar</ref>
22992
22993 <references />
22994 !! html/parsoid
22995 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22996
22997 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22998 </ol>
22999
23000 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23001
23002 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23003 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23004 </ol>
23005 !!end
23006
23007 !!test
23008 References: 4. only referenced group should be cleared after processing references
23009 !! wikitext
23010 A <ref group="a">afoo</ref>
23011 B <ref>bfoo</ref>
23012
23013 <references group="a" />
23014
23015 C <ref>cfoo</ref>
23016
23017 <references />
23018 !! html/parsoid
23019 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
23020 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23021
23022 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
23023 </ol>
23024
23025 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
23026
23027 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
23028 </ol>
23029 !!end
23030
23031 ## Don't expect this to rt since we're dropping content
23032 !! test
23033 References: 5. ref tags in references should be processed while ignoring all other content
23034 !! options
23035 parsoid=wt2html,html2html
23036 !! wikitext
23037 A <ref name="a" />
23038 B <ref name="b">bar</ref>
23039
23040 <references>
23041 <ref name="a">foo</ref>
23042 This should just get lost.
23043 </references>
23044 !! html/parsoid
23045 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
23046 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
23047
23048
23049 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Main_Page#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
23050 </ol>
23051 !! end
23052
23053 !! test
23054 References: 6. <references /> from a transclusion
23055 !! wikitext
23056 <ref>Foo</ref> {{echo|<references />}}
23057 !! html/parsoid
23058 <p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
23059 </ol>
23060 !! end
23061
23062 !! test
23063 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23064 !! wikitext
23065 A <ref>foo bar for a</ref>
23066 B <ref group="X" name="b" />
23067
23068 <references />
23069
23070 <references group="X">
23071 <ref name="b">foo</ref>
23072 </references>
23073 !! html/parsoid
23074 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
23075 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="./Main_Page#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
23076 </p>
23077
23078 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23079 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
23080 </ol>
23081
23082 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
23083 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
23084 </ol>
23085 !! end
23086
23087 !! test
23088 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23089 !! wikitext
23090 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23091 <references />
23092 !! html/parsoid
23093 <p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23094 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
23095 </ol>
23096 !!end
23097
23098 # This test only works in wt2html now as the <references /> are always generated
23099 # unless selser is active. Once T72722 is fixed, we should add a changes test
23100 # here to ensure that unrelated changes don't add the new <references />
23101 # when selser is active.
23102 !! test
23103 References: 9. Generate missing references list at the end
23104 !! wikitext
23105 A <ref>foo</ref>
23106 B <ref group="inexistent">bar</ref>
23107 !! html/parsoid
23108 <p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="./Main_Page#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
23109 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23110 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
23111 </ol>
23112 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23113 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23114 </ol>
23115 !! end
23116
23117 !! test
23118 References: 10. New <references/> shouldn't be added for unrelated edits.
23119 !! options
23120 parsoid={
23121 "modes": ["selser"],
23122 "changes": [["#x", "remove"]],
23123 "selser": "noauto"
23124 }
23125 !! wikitext
23126 Unrelated text<span id="x"> that's going to disappear</span>.
23127 A <ref>foo</ref>
23128 !! wikitext/edited
23129 Unrelated text.
23130 A <ref>foo</ref>
23131 !!end
23132
23133 !! test
23134 Entities in ref name
23135 !! wikitext
23136 <ref name="test &amp; me">hi</ref>
23137 <references />
23138 !! html/parsoid
23139 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="./Main_Page#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23140 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23141 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="./Main_Page#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
23142 </ol>
23143 !! end
23144
23145 ## The output here may look funny, but it's what the php parser will do. The
23146 ## unclosed references tag becomes escaped text, and then a new references
23147 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23148 ## nowiki tags, and the auto-generated references tag is only dropped in
23149 ## rtTestMode.
23150 !! test
23151 Generate references for unclosed references tag
23152 !! options
23153 parsoid=wt2html
23154 !! wikitext
23155 a<ref>foo</ref>
23156
23157 <references>
23158 !! html/parsoid
23159 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
23160
23161 <p>&lt;references></p>
23162 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
23163 !! end
23164
23165 !! test
23166 New reference serializes on its own line
23167 !! options
23168 parsoid=wt2wt,html2wt
23169 !! wikitext
23170 foo
23171 <references />
23172 !! html/parsoid
23173 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23174 !! end
23175
23176 #### ----------------------------------------------------------------
23177 #### Parsoid-only testing of Parsoid's impl of LST
23178 #### Not implemented yet, see
23179 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23180 #### ----------------------------------------------------------------
23181
23182 ## We still need to support serializing the older format while content is stored.
23183 !! test
23184 LST Sections: Backwards compatibility
23185 !! options
23186 parsoid={
23187 "suppressErrors": true,
23188 "modes": ["html2wt"]
23189 }
23190 !! wikitext
23191 <section begin="2011-05-16" />
23192 <section end="2014-04-10 (MW 1.23wmf22)" />
23193 !! html/parsoid
23194 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23195 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23196 !! end
23197
23198 ## The unconventional output is the result of `usePHPPreProcessor` being
23199 ## disabled in parserTests.js. This test is mainly just to show <section> is
23200 ## recognized as an extension tag w/o a native handler.
23201 !! test
23202 LST Sections: Newfangled approach
23203 !! options
23204 parsoid={ "suppressErrors": true }
23205 !! wikitext
23206 <section begin="2011-05-16" />
23207 <section end="2014-04-10 (MW 1.23wmf22)" />
23208 !! html/parsoid
23209 <p><span typeof="mw:Extension/section" about="#mwt1" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section begin=\"2011-05-16\" />","tagWidths":[30,0]}'>&lt;section begin="2011-05-16" /></span>
23210 <span typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section end=\"2014-04-10 (MW 1.23wmf22)\" />","tagWidths":[43,0]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
23211 !! end
23212
23213 #--------- Test stripping of empty nodes in template content ----------
23214 !!test
23215 Empty LI and TR nodes should be stripped from template content
23216 !!wikitext
23217 {{EmptyLITest}}
23218 {{EmptyTRTest}}
23219 !!html/parsoid
23220 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23221 <li>a</li>
23222 <li>b</li>
23223 </ul>
23224 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23225 <tbody>
23226 <tr>
23227 <td>foo</td>
23228 </tr>
23229 <tr>
23230 <td>bar</td>
23231 </tr>
23232 </tbody>
23233 </table>
23234 !!end
23235
23236 !!test
23237 Empty LI and TR nodes should not be stripped from top-level content
23238 !!wikitext
23239 * a
23240 *
23241 * b
23242 {|
23243 |-
23244 |-
23245 |foo
23246 |}
23247 !!html/parsoid
23248 <ul>
23249 <li> a</li>
23250 <li></li>
23251 <li> b</li>
23252 </ul>
23253 <table>
23254 <tbody>
23255 <tr></tr>
23256 <tr>
23257 <td>foo</td>
23258 </tr>
23259 </tbody>
23260 </table>
23261 !!end
23262
23263 !!test
23264 Empty TR nodes should not be stripped if they have any attributes set
23265 !!wikitext
23266 {{EmptyTRWithHTMLAttrTest}}
23267 !!html/parsoid
23268 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23269 <tr align="center"></tr>
23270 <tr><td>foo</td></tr>
23271 <tr align="center"></tr>
23272 <tr><td>bar</td></tr>
23273 </table>
23274 !!end
23275
23276 #### ----------------------------------------------------------------
23277 #### The following section of tests are primarily to test
23278 #### wikitext escaping capabilities of Parsoid. Given that
23279 #### escaping can be done any number of ways, the wikitext (input)
23280 #### is always adjusted to reflect how Parsoid adds nowiki
23281 #### escape tags.
23282 ####
23283 #### We are marking several tests as parsoid-only since the
23284 #### HTML in the result section is different from what the
23285 #### PHP parser generates for it.
23286 #### ----------------------------------------------------------------
23287
23288
23289 #### --------------- Headings ---------------
23290 #### 0. Unnested
23291 #### 1. Nested inside html <h1>=foo=</h1>
23292 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23293 #### 3. Nested inside html with wikitext split by html tags
23294 #### 4. No escape needed
23295 #### 5. Empty headings <h1></h1>
23296 #### 6. Heading chars in SOL context
23297 #### ----------------------------------------
23298 !! test
23299 Headings: 0. Unnested
23300 !! options
23301 parsoid=html2wt
23302 !! html/parsoid
23303 <p>=foo=</p>
23304
23305 <p> =foo=
23306 <!--cmt-->
23307 =foo=</p>
23308
23309 <p>=foo<i>a</i>=</p>
23310 !! wikitext
23311 <nowiki>=foo=</nowiki>
23312
23313 <nowiki> </nowiki>=foo=
23314 <!--cmt-->
23315 <nowiki>=foo=</nowiki>
23316
23317 =foo''a''<nowiki>=</nowiki>
23318 !!end
23319
23320 # New headings and existing headings are handled differently
23321 !! test
23322 Headings: 1. Nested inside html
23323 !! options
23324 parsoid=html2wt
23325 !! html/parsoid
23326 <h1>=foo=</h1>
23327 <h2>=foo=</h2>
23328 <h3>=foo=</h3>
23329
23330 <h1 data-parsoid=''>=foo=</h1>
23331 <h2 data-parsoid=''>=foo=</h2>
23332 <h3 data-parsoid=''>=foo=</h3>
23333 <h4 data-parsoid=''>=foo=</h4>
23334 <h5 data-parsoid=''>=foo=</h5>
23335 <h6 data-parsoid=''>=foo=</h6>
23336 !! wikitext
23337 = =foo= =
23338
23339 == =foo= ==
23340
23341 === =foo= ===
23342
23343 =<nowiki>=foo=</nowiki>=
23344 ==<nowiki>=foo=</nowiki>==
23345 ===<nowiki>=foo=</nowiki>===
23346 ====<nowiki>=foo=</nowiki>====
23347 =====<nowiki>=foo=</nowiki>=====
23348 ======<nowiki>=foo=</nowiki>======
23349
23350 !!end
23351
23352 !! test
23353 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23354 !! options
23355 parsoid=html2wt
23356 !! html/parsoid
23357 <h1>foo</h1>*bar
23358 <h1>foo</h1>=bar
23359 <h1>foo</h1>=bar=
23360 !! wikitext
23361 = foo =
23362 <nowiki>*</nowiki>bar
23363
23364 = foo =
23365 =bar
23366
23367 = foo =
23368 <nowiki>=bar=</nowiki>
23369 !!end
23370
23371 !! test
23372 Headings: 3. Nested inside html with wikitext split by html tags
23373 !! options
23374 parsoid=html2wt
23375 !! html/parsoid
23376 <h1>=<b>bold</b>foo=</h1>
23377 !! wikitext
23378 = ='''bold'''foo= =
23379 !!end
23380
23381 !! test
23382 Headings: 4a. No escaping needed (testing just h1 and h2)
23383 !! options
23384 parsoid=html2wt
23385 !! html/parsoid
23386 <h1>=foo</h1>
23387 <h1>foo=</h1>
23388 <h1> =foo= </h1>
23389 <h1>=foo= bar</h1>
23390 <h2>=foo</h2>
23391 <h2>foo=</h2>
23392 <h1>=</h1>
23393 <h1><i>=</i>foo=</h1>
23394 !! wikitext
23395 = =foo =
23396
23397 = foo= =
23398
23399 = =foo= =
23400
23401 = =foo= bar =
23402
23403 == =foo ==
23404
23405 == foo= ==
23406
23407 = = =
23408
23409 = ''=''foo= =
23410 !!end
23411
23412 !! test
23413 Headings: 4b. No escaping needed (inside p-tags)
23414 !! options
23415 parsoid=html2wt
23416 !! html/parsoid
23417 <p>===
23418 =foo= x
23419 =foo= <s></s>
23420 </p>
23421 !! wikitext
23422 ===
23423 =foo= x
23424 =foo= <s></s>
23425 !!end
23426
23427 !! test
23428 Headings: 5. Empty headings
23429 !! options
23430 parsoid=html2wt
23431 !! html/parsoid
23432 <h1 data-parsoid='{}'></h1>
23433
23434 <h2 data-parsoid='{}'></h2>
23435
23436 <h3 data-parsoid='{}'></h3>
23437
23438 <h4 data-parsoid='{}'></h4>
23439
23440 <h5 data-parsoid='{}'></h5>
23441
23442 <h6 data-parsoid='{}'></h6>
23443 !! wikitext
23444 =<nowiki/>=
23445
23446 ==<nowiki/>==
23447
23448 ===<nowiki/>===
23449
23450 ====<nowiki/>====
23451
23452 =====<nowiki/>=====
23453
23454 ======<nowiki/>======
23455 !!end
23456
23457 !! test
23458 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23459 !! options
23460 parsoid=html2wt
23461 !! html/parsoid
23462 <p>=a=</p>
23463
23464 <p>=a=</p>
23465
23466 <p>=a=</p>
23467 !! wikitext
23468 <nowiki>=a=</nowiki>
23469
23470 <nowiki>=a=</nowiki>
23471
23472 <nowiki>=a=</nowiki>
23473 !!end
23474
23475 !! test
23476 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23477 !! options
23478 parsoid=html2wt
23479 !! html/parsoid
23480 <p>=a=
23481 b</p>
23482
23483 <p>=a=
23484 b</p>
23485
23486 <p>=a=
23487 b</p>
23488 !! wikitext
23489 <nowiki>=a=</nowiki>
23490 b
23491
23492 <nowiki>=a=</nowiki>
23493 b
23494
23495 <nowiki>=a=</nowiki>
23496 b
23497 !!end
23498
23499 !! test
23500 Headings: 6c. Heading chars in SOL context (leading newline break)
23501 !! options
23502 parsoid=html2wt
23503 !! html/parsoid
23504 <p>a
23505 =b=</p>
23506 !! wikitext
23507 a
23508 <nowiki>=b=</nowiki>
23509 !!end
23510
23511 !! test
23512 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23513 !! options
23514 parsoid=html2wt
23515 !! html/parsoid
23516 <!--c0--><p>=a=</p>
23517
23518 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23519 !! wikitext
23520 <!--c0--><nowiki>=a=</nowiki>
23521
23522 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23523 !!end
23524
23525 !! test
23526 Headings: 6d. Heading chars in SOL context (No escaping needed)
23527 !! options
23528 parsoid=html2wt
23529 !! html/parsoid
23530 =a=<div>b</div>
23531 !! wikitext
23532 =a=<div>b</div>
23533 !!end
23534
23535 !! test
23536 Headings: 7. Insert a newline between new content and headings
23537 !! options
23538 parsoid=html2wt
23539 !! html/parsoid
23540 <h2>NEW</h2>
23541 <p>new</p>
23542 <h2 data-parsoid='{}'>A</h2>
23543 <p data-parsoid='{}'>a</p>
23544 !! wikitext
23545 == NEW ==
23546 new
23547
23548 ==A==
23549 a
23550
23551 !! end
23552
23553 #### --------------- Lists ---------------
23554 #### 0. Outside nests (*foo, etc.)
23555 #### 1. Nested inside html <ul><li>*foo</li></ul>
23556 #### 2. Inside definition lists
23557 #### 3. Only bullets at start should be escaped
23558 #### 4. No escapes needed
23559 #### 5. No unnecessary escapes
23560 #### 6. Escape bullets in SOL position
23561 #### 7. Escape bullets in a multi-line context
23562 #### ----------------------------------------
23563
23564 !! test
23565 Lists: 0. Outside nests
23566 !! options
23567 parsoid=html2wt
23568 !! html/parsoid
23569 <p>*foo</p>
23570
23571 <p>#foo</p>
23572
23573 <p>;Foo:bar</p>
23574 !! wikitext
23575 <nowiki>*</nowiki>foo
23576
23577 <nowiki>#</nowiki>foo
23578
23579 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23580 !!end
23581
23582 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23583 ## to test wikitext escaping, and insignificant whitespace diffs
23584 ## cause PHP parser tests to barf
23585 !! test
23586 Lists: 1. Nested inside html (No unnecessary escapes)
23587 !! options
23588 parsoid=html2wt
23589 !! html/parsoid
23590 <ul>
23591 <li>*foo</li>
23592 <li>#foo</li>
23593 <li>:foo</li>
23594 <li>;foo</li>
23595 <li data-parsoid='{}'>*foo</li>
23596 <li data-parsoid='{}'>#foo</li>
23597 <li data-parsoid='{}'>:foo</li>
23598 <li data-parsoid='{}'>;foo</li>
23599 </ul>
23600
23601 <ol>
23602 <li>*foo</li>
23603 <li>#foo</li>
23604 <li>:foo</li>
23605 <li>;foo</li>
23606 <li data-parsoid='{}'>*foo</li>
23607 <li data-parsoid='{}'>#foo</li>
23608 <li data-parsoid='{}'>:foo</li>
23609 <li data-parsoid='{}'>;foo</li>
23610 </ol>
23611 !! wikitext
23612 * *foo
23613 * #foo
23614 * :foo
23615 * ;foo
23616 *<nowiki>*foo</nowiki>
23617 *<nowiki>#foo</nowiki>
23618 *<nowiki>:foo</nowiki>
23619 *<nowiki>;foo</nowiki>
23620
23621 # *foo
23622 # #foo
23623 # :foo
23624 # ;foo
23625 #<nowiki>*foo</nowiki>
23626 #<nowiki>#foo</nowiki>
23627 #<nowiki>:foo</nowiki>
23628 #<nowiki>;foo</nowiki>
23629 !!end
23630
23631 !! test
23632 Lists: 2. Inside definition lists
23633 !! options
23634 parsoid=html2wt
23635 !! html/parsoid
23636 <dl><dt>;foo</dt></dl>
23637 <dl><dt>:foo</dt></dl>
23638 <dl><dt>:foo</dt>
23639 <dd>bar</dd></dl>
23640 <dl><dd>:foo</dd></dl>
23641 !! wikitext
23642 ; ;foo
23643
23644 ; <nowiki>:foo</nowiki>
23645
23646 ; <nowiki>:foo</nowiki>
23647 : bar
23648
23649 : :foo
23650 !!end
23651
23652 !! test
23653 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23654 !! options
23655 parsoid=html2wt
23656 !! html/parsoid
23657 <ul>
23658 <li>*foo*bar</li>
23659 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23660 </ul>
23661 !! wikitext
23662 * *foo*bar
23663 *<nowiki>*foo</nowiki>''it''*bar
23664 !!end
23665
23666 !! test
23667 Lists: 4. No escapes needed
23668 !! options
23669 parsoid=html2wt
23670 !! html/parsoid
23671 <ul>
23672 <li>foo*bar
23673 </li>
23674 </ul>
23675 <ul>
23676 <li><i>foo</i>*bar
23677 </li>
23678 </ul>
23679 <ul>
23680 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23681 </li>
23682 </ul>
23683 <ul>
23684 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23685 </li>
23686 </ul>
23687 !! wikitext
23688 *foo*bar
23689
23690 *''foo''*bar
23691
23692 *[[Foo]]: bar
23693
23694 *[[Foo]]*bar
23695 !!end
23696
23697 !! test
23698 Lists: 5. No unnecessary escapes
23699 !! options
23700 parsoid=html2wt
23701 !! html/parsoid
23702 <ul><li> bar <span>[[foo]]</span></li></ul>
23703 <ul><li> =bar <span>[[foo]]</span></li></ul>
23704 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23705 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23706 <ul><li> =bar <span>foo]]</span>=</li></ul>
23707 <ul><li> <s></s>: a</li></ul>
23708 <ul><li> <i>* foo</i></li></ul>
23709
23710 !! wikitext
23711 * bar <span><nowiki>[[foo]]</nowiki></span>
23712
23713 * =bar <span><nowiki>[[foo]]</nowiki></span>
23714
23715 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23716
23717 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23718
23719 * =bar <span>foo]]</span>=
23720
23721 * <s></s>: a
23722
23723 * ''* foo''
23724 !!end
23725
23726 !! test
23727 Lists: 6. Escape bullets in SOL position
23728 !! options
23729 parsoid=html2wt
23730 !! html/parsoid
23731 <p><!--cmt-->*foo</p>
23732 !! wikitext
23733 <!--cmt--><nowiki>*</nowiki>foo
23734 !!end
23735
23736 !! test
23737 Lists: 7. Escape bullets in a multi-line context
23738 !! options
23739 parsoid=html2wt
23740 !! html/parsoid
23741 <p>a
23742 *b
23743 </p>
23744 !! wikitext
23745 a
23746 <nowiki>*</nowiki>b
23747 !!end
23748
23749 !! test
23750 Lists: 8. Escape colons only if not present in tags
23751 !! options
23752 parsoid=html2wt
23753 !! html/parsoid
23754 <dl><dt>a:b<i>c:d</i></dt></dl>
23755 !! wikitext
23756 ; <nowiki>a:b</nowiki>''c:d''
23757 !! end
23758
23759 #### --------------- HRs ---------------
23760 #### 1. Single line
23761 #### -----------------------------------
23762
23763 !! test
23764 HRs: 1. Single line
23765 !! options
23766 parsoid=html2wt
23767 !! html/parsoid
23768 <hr />----
23769 <hr />=foo=
23770 <hr />*foo
23771 !! wikitext
23772 ----<nowiki>----</nowiki>
23773 ----=foo=
23774 ----*foo
23775 !! end
23776
23777 #### --------------- Tables ---------------
23778 #### 1a. Simple example
23779 #### 1b. No escaping needed (!foo)
23780 #### 1c. No escaping needed (|foo)
23781 #### 1d. No escaping needed (|}foo)
23782 ####
23783 #### 2a. Nested in td (<td>foo|bar</td>)
23784 #### 2b. Nested in td (<td>foo||bar</td>)
23785 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23786 ####
23787 #### 3a. Nested in th (<th>foo!bar</th>)
23788 #### 3b. Nested in th (<th>foo!!bar</th>)
23789 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23790 ####
23791 #### 4a. Escape -
23792 #### 4b. Escape +
23793 #### 4c. No escaping needed
23794 #### --------------------------------------
23795
23796 !! test
23797 Tables: 1a. Simple example
23798 !! options
23799 parsoid=html2wt
23800 !! html/parsoid
23801 <p>{|
23802 |}
23803 </p>
23804 !! wikitext
23805 <nowiki>{|</nowiki>
23806 |}
23807 !! end
23808
23809 !! test
23810 Tables: 1b. No escaping needed
23811 !! options
23812 parsoid=html2wt
23813 !! html/parsoid
23814 <p>!foo
23815 </p>
23816 !! wikitext
23817 !foo
23818 !! end
23819
23820 !! test
23821 Tables: 1c. No escaping needed
23822 !! options
23823 parsoid=html2wt
23824 !! html/parsoid
23825 <p>|foo
23826 </p>
23827 !! wikitext
23828 |foo
23829 !! end
23830
23831 !! test
23832 Tables: 1d. No escaping needed
23833 !! options
23834 parsoid=html2wt
23835 !! html/parsoid
23836 <p>|}foo
23837 </p>
23838 !! wikitext
23839 |}foo
23840 !! end
23841
23842 !! test
23843 Tables: 2a. Nested in td
23844 !! options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 <table><tbody><tr>
23848 <td>foo|bar</td></tr>
23849 <tr><td>x<div>a|b</div></td>
23850 </tbody></table>
23851 !! wikitext
23852 {|
23853 |<nowiki>foo|bar</nowiki>
23854 |-
23855 |x<div><nowiki>a|b</nowiki></div>
23856 |}
23857 !! html/php+tidy
23858 <table>
23859 <tr>
23860 <td>foo|bar</td>
23861 </tr>
23862 <tr>
23863 <td>x
23864 <div>a|b</div>
23865 </td>
23866 </tr>
23867 </table>
23868 !! end
23869
23870 !! test
23871 Tables: 2b. Nested in td
23872 !! options
23873 parsoid=html2wt
23874 !! html/parsoid
23875 <table><tbody><tr>
23876 <td>foo||bar</td>
23877 <td>a<i>b||c</i></td>
23878 <td>a<i><div>b||c</div></i></td>
23879 </tr></tbody></table>
23880 !! wikitext
23881 {|
23882 |<nowiki>foo||bar</nowiki>
23883 |a''<nowiki>b||c</nowiki>''
23884 |a''<div><nowiki>b||c</nowiki></div>''
23885 |}
23886 !! html/php
23887 <table>
23888 <tr>
23889 <td>foo||bar
23890 </td>
23891 <td>a<i>b||c</i>
23892 </td>
23893 <td>a<i><div>b||c</div></i>
23894 </td></tr></table>
23895
23896 !! end
23897
23898 !! test
23899 Tables: 2c. Nested in td -- no escaping needed
23900 !! options
23901 parsoid=html2wt
23902 !! html/*
23903 <table>
23904 <tr>
23905 <td>foo!!bar
23906 </td></tr></table>
23907
23908 !! wikitext
23909 {|
23910 |foo!!bar
23911 |}
23912 !! end
23913
23914 !! test
23915 Tables: 3a. Nested in th
23916 !! options
23917 parsoid=html2wt
23918 !! html/*
23919 <table>
23920 <tr>
23921 <th>foo!bar
23922 </th></tr></table>
23923
23924 !! wikitext
23925 {|
23926 !foo!bar
23927 |}
23928 !! end
23929
23930 !! test
23931 Tables: 3b. Nested in th
23932 !! options
23933 parsoid=html2wt
23934 !! html/parsoid
23935 <table><tbody>
23936 <tr><th>foo!!bar</th>
23937 <th><i>foo|bar</i></th>
23938 <th><i>foo!!bar</i></th>
23939 <th><i><span>foo!!bar</span></i></th>
23940 </tr></tbody></table>
23941 !! wikitext
23942 {|
23943 !<nowiki>foo!!bar</nowiki>
23944 !''<nowiki>foo|bar</nowiki>''
23945 !''<nowiki>foo!!bar</nowiki>''
23946 !''<span><nowiki>foo!!bar</nowiki></span>''
23947 |}
23948 !! html/php
23949 <table>
23950 <tr>
23951 <th>foo!!bar
23952 </th>
23953 <th><i>foo|bar</i>
23954 </th>
23955 <th><i>foo!!bar</i>
23956 </th>
23957 <th><i><span>foo!!bar</span></i>
23958 </th></tr></table>
23959
23960 !! end
23961
23962 !! test
23963 Tables: 3c. Nested in th
23964 !! options
23965 parsoid=html2wt
23966 !! html/parsoid
23967 <table><tbody>
23968 <tr><th>foo||bar</th>
23969 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23970 </tr></tbody></table>
23971 !! wikitext
23972 {|
23973 !<nowiki>foo||bar</nowiki>
23974 !<nowiki>foo||bar</nowiki>
23975 |}
23976 !! html/php
23977 <table>
23978 <tr>
23979 <th>foo||bar
23980 </th>
23981 <th>foo||bar
23982 </th></tr></table>
23983
23984 !! end
23985
23986 !! test
23987 Tables: 4a. Escape -
23988 !! options
23989 parsoid=html2wt
23990 !! html/*
23991 <table>
23992 <tr>
23993 <th>-bar
23994 </th></tr>
23995 <tr>
23996 <td>-bar
23997 </td></tr></table>
23998
23999 !! wikitext
24000 {|
24001 !-bar
24002 |-
24003 |<nowiki>-bar</nowiki>
24004 |}
24005 !! end
24006
24007 !! test
24008 Tables: 4b. Escape +
24009 !! options
24010 parsoid=html2wt
24011 !! html/*
24012 <table>
24013 <tr>
24014 <th>+bar
24015 </th></tr>
24016 <tr>
24017 <td>+bar
24018 </td></tr></table>
24019
24020 !! wikitext
24021 {|
24022 !+bar
24023 |-
24024 |<nowiki>+bar</nowiki>
24025 |}
24026 !! end
24027
24028 !! test
24029 Tables: 4c. No escaping needed
24030 !! options
24031 parsoid=html2wt
24032 !! html/parsoid
24033 <table><tbody>
24034 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24035 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24036 <tr><td>foo
24037 <p>bar|baz
24038 +bar
24039 -bar</p></td></tr>
24040 <tr><td>x
24041 <div>a|b</div></td>
24042 </tbody></table>
24043 !! wikitext
24044 {|
24045 |foo-bar
24046 |foo+bar
24047 |-
24048 |''foo''-bar
24049 |''foo''+bar
24050 |-
24051 |foo
24052 bar|baz
24053 +bar
24054 -bar
24055 |-
24056 |x
24057 <div>a|b</div>
24058 |}
24059 !! html/php
24060 <table>
24061 <tr>
24062 <td>foo-bar
24063 </td>
24064 <td>foo+bar
24065 </td></tr>
24066 <tr>
24067 <td><i>foo</i>-bar
24068 </td>
24069 <td><i>foo</i>+bar
24070 </td></tr>
24071 <tr>
24072 <td>foo
24073 <p>bar|baz
24074 +bar
24075 -bar
24076 </p>
24077 </td></tr>
24078 <tr>
24079 <td>x
24080 <div>a|b</div>
24081 </td></tr></table>
24082
24083 !! end
24084
24085 !! test
24086 Tables: 4d. No escaping needed
24087 !! options
24088 parsoid=html2wt
24089 !! html/parsoid
24090 <table>
24091 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24092 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24093 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24094 </tbody></table>
24095 !! wikitext
24096 {|
24097 |[[Foo]]-bar
24098 ||+1
24099 ||-2
24100 |}
24101 !! html/php
24102 <table>
24103 <tr>
24104 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24105 </td>
24106 <td>+1
24107 </td>
24108 <td>-2
24109 </td></tr></table>
24110
24111 !! end
24112
24113 !! test
24114 T97430: Don't emit empty nowiki pairs around marker meta tags
24115 !! options
24116 parsoid=html2wt
24117 !! html/parsoid
24118 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24119 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24120 !! wikitext
24121 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24122 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24123 !! end
24124
24125 !! test
24126 Unclosed xmlish element in table line shouldn't eat end delimiters
24127 !! options
24128 parsoid=html2wt
24129 !! html/parsoid
24130 <table>
24131 <tbody><tr><td> &lt;foo</td>
24132 <td> bar></td></tr>
24133 </tbody></table>
24134 !! wikitext
24135 {|
24136 | <foo
24137 | bar>
24138 |}
24139 !! html/php
24140 <table>
24141 <tr>
24142 <td> &lt;foo
24143 </td>
24144 <td> bar&gt;
24145 </td></tr></table>
24146
24147 !! end
24148
24149 #### --------------- Links ----------------
24150 #### 1. Quote marks in link text
24151 #### 2. Wikilinks: Escapes needed
24152 #### 3. Wikilinks: No escapes needed
24153 #### 4. Extlinks: Escapes needed
24154 #### 5. Extlinks: No escapes needed
24155 #### --------------------------------------
24156 !! test
24157 Links 1. WikiLinks: No escapes needed
24158 !! options
24159 parsoid=html2wt
24160 !! html/parsoid
24161 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24162 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24163 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24164 !! wikitext
24165 [[Foo|Foo''boo'']]
24166 [[Foo|[Foobar]]]
24167 [[Foo|x [Foobar] x]]
24168 !! html/php
24169 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24170 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24171 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24172 </p>
24173 !! end
24174
24175 !! test
24176 Links 2. WikiLinks: Escapes needed
24177 !! options
24178 parsoid=html2wt
24179 !! html/parsoid
24180 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24181 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24182 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24183 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24184 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24185 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24186 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24187 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24188 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24189 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24190 !! wikitext
24191 [[Foo|<nowiki>Foobar]</nowiki>]]
24192 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24193 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24194 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24195 [[Foo|<nowiki>|Bar</nowiki>]]
24196 [[Foo|<nowiki>]]bar</nowiki>]]
24197 [[Foo|<nowiki>[[bar</nowiki>]]
24198 [[Foo|<nowiki>x [[ y</nowiki>]]
24199 [[Foo|<nowiki>x ]] y</nowiki>]]
24200 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24201 !! html/php
24202 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24203 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24204 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24205 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24206 <a href="/wiki/Foo" title="Foo">|Bar</a>
24207 <a href="/wiki/Foo" title="Foo">]]bar</a>
24208 <a href="/wiki/Foo" title="Foo">[[bar</a>
24209 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24210 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24211 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24212 </p>
24213 !! end
24214
24215 !! test
24216 Links 3. WikiLinks: No escapes needed
24217 !! options
24218 parsoid=html2wt
24219 !! html/parsoid
24220 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24221 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24222 !! wikitext
24223 [[Foo|[Foobar]]
24224 [[Foo|foo|bar]]
24225 !! html/php
24226 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24227 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24228 </p>
24229 !! end
24230
24231 !! test
24232 Links 4. ExtLinks: Escapes needed
24233 !! options
24234 parsoid=html2wt
24235 !! html/parsoid
24236 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24237 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24238 <p>[http://google.com]</p>
24239 <p>[http://google.com google]</p>
24240 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24241 <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
24242 !! wikitext
24243 [http://google.com <nowiki>[google]</nowiki>]
24244 [http://google.com <nowiki>google]</nowiki>]
24245
24246 <nowiki>[http://google.com]</nowiki>
24247
24248 <nowiki>[http://google.com google]</nowiki>
24249
24250 [http://google.com<nowiki>]</nowiki>
24251
24252 [{{echo|http://google.com}}<nowiki>]</nowiki>
24253 !! html/php
24254 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24255 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24256 </p><p>[http://google.com]
24257 </p><p>[http://google.com google]
24258 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24259 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24260 </p>
24261 !! end
24262
24263 !! test
24264 Links 5. ExtLinks: No escapes needed
24265 !! options
24266 parsoid=html2wt
24267 !! html/parsoid
24268 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24269 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24270 !! wikitext
24271 [http://google.com [google]
24272
24273 [[http://google.com]]
24274 !! html/php
24275 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24276 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24277 </p>
24278 !! end
24279
24280 !! test
24281 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24282 !! options
24283 parsoid=html2wt
24284 !! html/parsoid
24285 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24286 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24287 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24288 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24289 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24290 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24291 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24292 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24293 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24294 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24295 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24296 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24297 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24298 </p>
24299 !! wikitext
24300 x<nowiki/>http://example.com<nowiki/>y
24301 http://example.com<nowiki/>?x
24302 http://example.com<nowiki/>&x
24303 http://example.com<nowiki/>'x
24304 http://example.com<nowiki/>,x
24305 http://example.com<nowiki/>.x
24306 http://example.com<nowiki/>;x
24307 http://example.com<nowiki/>:x
24308 http://example.com<nowiki/>;x
24309 http://example.com<nowiki/>!x
24310 http://example.com<nowiki/>=x
24311 http://example.com<nowiki/>(x)
24312 http://example.com(x<nowiki/>)
24313 !! end
24314
24315 !! test
24316 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24317 !! options
24318 parsoid=html2wt
24319 !! html/parsoid
24320 <p>x
24321 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24322 y
24323 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24324 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24325 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24326 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24327 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24328 </p>
24329 !! wikitext
24330 x
24331 http://example.com
24332 y
24333 "http://example.com"
24334 (http://example.com)
24335 (http://example.com) foo
24336 http://example.com,
24337 http://example.com, foo
24338 !! html/php
24339 <p>x
24340 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24341 y
24342 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24343 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24344 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24345 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24346 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24347 </p>
24348 !! end
24349
24350 !! test
24351 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24352 !! options
24353 parsoid=html2wt
24354 !! html/parsoid
24355 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24356 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24357 !! wikitext
24358 http://example.com.,;:!?\
24359 -http://example.com:
24360 !! html/php
24361 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24362 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24363 </p>
24364 !! end
24365
24366 !! test
24367 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24368 !! options
24369 parsoid=html2wt
24370 !! html/parsoid
24371 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24372 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24373 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24374 !! wikitext
24375 RFC 123<nowiki/>4
24376 RFC 123<nowiki/>y
24377 X<nowiki/>RFC 123<nowiki/>y
24378 !! end
24379
24380 !! test
24381 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24382 !! options
24383 parsoid=html2wt
24384 !! html/parsoid
24385 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24386 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24387 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24388 </p>
24389 !! wikitext
24390 RFC 123?foo
24391 RFC 123&foo
24392 -RFC 123-
24393 !! html/php
24394 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24395 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24396 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24397 </p>
24398 !! end
24399
24400 !! test
24401 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24402 !! options
24403 parsoid=html2wt
24404 !! html/parsoid
24405 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24406 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24407 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24408 !! wikitext
24409 PMID 123<nowiki/>4
24410 PMID 123<nowiki/>y
24411 X<nowiki/>PMID 123<nowiki/>y
24412 !! end
24413
24414 !! test
24415 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24416 !! options
24417 parsoid=html2wt
24418 !! html/parsoid
24419 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24420 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24421 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24422 </p>
24423 !! wikitext
24424 PMID 123?foo
24425 PMID 123&foo
24426 -PMID 123-
24427 !! html/php
24428 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24429 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24430 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24431 </p>
24432 !! end
24433
24434 !! test
24435 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24436 !! options
24437 parsoid=html2wt
24438 !! html/parsoid
24439 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24440 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24441 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24442 </p>
24443 !! wikitext
24444 ISBN 1234567890<nowiki/>1
24445 ISBN 1234567890<nowiki/>x
24446 a<nowiki/>ISBN 1234567890<nowiki/>b
24447 !! end
24448
24449 !! test
24450 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24451 !! options
24452 parsoid=html2wt
24453 !! html/parsoid
24454 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24455 !! wikitext
24456 -ISBN 1234567890's
24457 !! html/php
24458 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24459 </p>
24460 !! end
24461
24462 !! test
24463 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24464 !! options
24465 parsoid=html2wt
24466 !! html/*
24467 <p>this is not a link: http://example.com
24468 </p>
24469 !! wikitext
24470 this is not a link: <nowiki>http://example.com</nowiki>
24471 !! end
24472
24473 !! test
24474 Links 15. Link trails can't become link prefixes.
24475 !! options
24476 language=is
24477 parsoid=html2wt
24478 !! html/parsoid
24479 <p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
24480 !! wikitext
24481 [[Söfnuður]]-[[00]]
24482 !! html/php
24483 <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
24484 </p>
24485 !! end
24486
24487 #### --------------- Quotes ---------------
24488 #### 1. Quotes inside <b> and <i>
24489 #### 2. Link fragments separated by <i> and <b> tags
24490 #### 3. Link fragments inside <i> and <b>
24491 #### 4. No escaping needed
24492 #### --------------------------------------
24493 !! test
24494 1a. Quotes inside <b> and <i>
24495 !! options
24496 parsoid=html2wt
24497 !! html/*
24498 <p><i>'foo'</i>
24499 <i>''foo''</i>
24500 <i>'''foo'''</i>
24501 <i>foo</i>'s
24502 <b>'foo'</b>
24503 <b>''foo''</b>
24504 <b>'''foo'''</b>
24505 <b>foo'<i>bar'</i>baz</b>
24506 <b>foo</b>'s
24507 '<i>foo</i>
24508 <i>foo</i>'
24509 <i>foo'</i>'
24510 '<i>foo</i>'
24511 '<b>foo</b>
24512 <b>foo</b>'
24513 '<b>foo</b>'
24514 <i>fools'<span> errand</span></i>
24515 <i><span>fool</span>'s errand</i>
24516 '<i>foo</i> bar '<i>baz</i>
24517 a|!*#-:;+-~[]{}b'<i>x</i>
24518 </p>
24519 !! wikitext
24520 ''<nowiki/>'foo'''
24521 ''<nowiki>''foo''</nowiki>''
24522 ''<nowiki>'''foo'''</nowiki>''
24523 ''foo''<nowiki/>'s
24524 '''<nowiki/>'foo''''
24525 '''<nowiki>''foo''</nowiki>'''
24526 '''<nowiki>'''foo'''</nowiki>'''
24527 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24528 '''foo'''<nowiki/>'s
24529 '''foo''
24530 ''foo''<nowiki/>'
24531 ''foo'''<nowiki/>'
24532 '''foo''<nowiki/>'
24533 ''''foo'''
24534 '''foo'''<nowiki/>'
24535 ''''foo'''<nowiki/>'
24536 ''fools'<span> errand</span>''
24537 ''<span>fool</span>'s errand''
24538 '<nowiki/>''foo'' bar '''baz''
24539 a|!*#-:;+-~[]{}b'''x''
24540 !! end
24541
24542 !! test
24543 1b. Quotes inside <b> and <i> with other tags on same line
24544 !! options
24545 parsoid=html2wt
24546 !! html/parsoid
24547 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24548 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24549 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
24550 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24551 '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
24552 '<i>foo</i> <div title="name">test</div>
24553 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24554 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24555 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
24556 </ol>
24557 !! wikitext
24558 '''a'' foo ''[[bar]]''
24559 ''a''' foo ''[[bar]]''
24560 ''a''' foo '''{{echo|[[bar]]}}'''
24561 [[foo]] x'''[[bar]]''
24562 '''foo'' <ref>test</ref>
24563 '''foo'' <div title="name">test</div>
24564 '''foo'' and <br> bar
24565 <references />
24566 !! end
24567
24568 !! test
24569 2. Link fragments separated by <i> and <b> tags
24570 !! options
24571 parsoid=html2wt
24572 !! html/parsoid
24573 <p>[[<i>foo</i>hello]]</p>
24574 <p>[[<b>foo</b>hello]]</p>
24575 !! wikitext
24576 [[''foo''<nowiki>hello]]</nowiki>
24577
24578 [['''foo'''<nowiki>hello]]</nowiki>
24579 !! end
24580
24581 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24582 # this is one of the shortcomings of this format
24583 !! test
24584 3. Link fragments inside <i> and <b>
24585 !! options
24586 parsoid=html2wt
24587 !! html/parsoid
24588 <p><i>[[foo</i>]]</p>
24589 <p><b>[[foo</b>]]</p>
24590 !! wikitext
24591 ''[[foo''<nowiki>]]</nowiki>
24592
24593 '''[[foo'''<nowiki>]]</nowiki>
24594 !! end
24595
24596 !! test
24597 4. No escaping needed
24598 !! options
24599 options=html2wt
24600 !! html/parsoid
24601 <p>'<span><i>bar</i></span>'
24602 '<span><b>bar</b></span>'
24603 'a:b'foo
24604 </p>
24605 !! wikitext
24606 '<span>''bar''</span>'
24607 '<span>'''bar'''</span>'
24608 'a:b'foo
24609 !! end
24610
24611 #### ----------- Paragraphs ---------------
24612 #### 1. No unnecessary escapes
24613 #### --------------------------------------
24614
24615 !! test
24616 1. No unnecessary escapes
24617 !! options
24618 parsoid=html2wt
24619 !! html/parsoid
24620 <p>bar <span>[[foo]]</span>
24621 </p><p>=bar <span>[[foo]]</span>
24622 </p><p>[[bar <span>[[foo]]</span>
24623 </p><p>]]bar <span>[[foo]]</span>
24624 </p><p>=bar <span>foo]]</span>=
24625 </p>
24626 !! wikitext
24627 bar <span><nowiki>[[foo]]</nowiki></span>
24628
24629 =bar <span><nowiki>[[foo]]</nowiki></span>
24630
24631 [[bar <span><nowiki>[[foo]]</nowiki></span>
24632
24633 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24634
24635 =bar <span>foo]]</span><nowiki>=</nowiki>
24636 !!end
24637
24638 #### ----------------------- PRE --------------------------
24639 #### 1. Leading whitespace in SOL context should be escaped
24640 #### ------------------------------------------------------
24641 !! test
24642 1. Leading whitespace in SOL context should be escaped
24643 !! options
24644 parsoid=html2wt
24645 !! html/parsoid
24646 <p> a</p>
24647
24648 <p> a</p>
24649
24650 <p> a(tab)</p>
24651
24652 <p> a
24653 <!--cmt-->
24654 a</p>
24655
24656 <p>a
24657 b</p>
24658
24659 <p>a
24660 b</p>
24661
24662 <p>a
24663 b</p>
24664 !! wikitext
24665 <nowiki> </nowiki>a
24666
24667 <nowiki> </nowiki> a
24668
24669 a(tab)
24670
24671 <nowiki> </nowiki> a
24672 <!--cmt-->
24673 <nowiki> </nowiki>a
24674
24675 a
24676 <nowiki> </nowiki>b
24677
24678 a
24679 b
24680
24681 a
24682 b
24683 !! html/php
24684 <p> a
24685 </p><p> a
24686 </p><p> a(tab)
24687 </p><p> a
24688 a
24689 </p><p>a
24690 b
24691 </p><p>a
24692 b
24693 </p><p>a
24694 b
24695 </p>
24696 !! end
24697
24698 !! test
24699 2. Leading whitespace in non-indent-pre contexts should not be escaped
24700 !! options
24701 parsoid=html2wt
24702 !! html/parsoid
24703 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
24704 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24705 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
24706 b</span></li>
24707 </ol>
24708 !! wikitext
24709 foo <ref>''a''
24710 b</ref>
24711 <references />
24712 !! end
24713
24714 !! test
24715 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24716 !! options
24717 parsoid=html2wt
24718 !! html/parsoid
24719 <blockquote>
24720 <p>
24721 a
24722 <span>b</span>
24723 c</p>
24724 </blockquote>
24725 !! wikitext
24726 <blockquote>
24727 a
24728 <span>b</span>
24729 c
24730 </blockquote>
24731 !! end
24732
24733 !! test
24734 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24735 !! options
24736 options=html2wt
24737 !! html/parsoid
24738 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
24739 !! wikitext
24740 [[File:Foobar.jpg|thumb|caption]]
24741 !! end
24742
24743 !! test
24744 5. Nowiki escaping should account for indent-pres
24745 !! options
24746 parsoid=html2wt
24747 !! html/parsoid
24748 <pre>==foo==</pre>
24749 !! wikitext
24750 ==foo==
24751 !! end
24752
24753 !!test
24754 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24755 !! options
24756 parsoid=html2wt
24757 !! html/parsoid
24758 <pre>
24759 * foo
24760 * bar
24761 </pre>
24762 !! wikitext
24763 * foo
24764 * bar
24765 !! end
24766
24767 #### --------------- Behavior Switches --------------------
24768
24769 !! test
24770 1. Valid behavior switches should be escaped
24771 !! options
24772 parsoid=html2wt
24773 !! html/parsoid
24774 __TOC__
24775 <i>__TOC__</i>
24776 !! wikitext
24777 <nowiki>__TOC__</nowiki>
24778 ''<nowiki>__TOC__</nowiki>''
24779 !! end
24780
24781 !! test
24782 2. Invalid behavior switches should not be escaped
24783 !! options
24784 parsoid=html2wt
24785 !! html/parsoid
24786 __TOO__
24787 __|__
24788 !! wikitext
24789 __TOO__
24790 __|__
24791 !! end
24792
24793 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24794 !! test
24795 Behavior switches should be SOL-transparent
24796 !! options
24797 parsoid=html2wt
24798 !! html/parsoid
24799 <meta property="mw:PageProp/toc" />
24800
24801 <!-- this one's bogus -->
24802 <pre>__TOO__</pre>
24803
24804 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24805
24806 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24807 !! wikitext
24808 __TOC__
24809
24810 <!-- this one's bogus -->
24811 __TOO__
24812
24813 __TOC__ foo
24814
24815 __TOC__
24816 bar
24817 !! end
24818
24819 #### --------------- HTML tags ---------------
24820 #### 1. a tags
24821 #### 2. other tags
24822 #### 3. multi-line html tag
24823 #### 4. extension tags
24824 #### -----------------------------------------
24825 !! test
24826 1. a tags
24827 !! options
24828 parsoid=html2wt
24829 !! html/parsoid
24830 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24831 !! wikitext
24832 <a href="http://google.com">google</a>
24833 !! end
24834
24835 !! test
24836 2. other tags
24837 !! options
24838 parsoid=html2wt
24839 !! html/parsoid
24840 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24841 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24842 <li> &lt;td&gt;</li></ul>
24843
24844 !! wikitext
24845 * <nowiki><div>foo</div></nowiki>
24846 * <nowiki><div style="color:red">foo</div></nowiki>
24847 * <nowiki><td></nowiki>
24848 !! end
24849
24850 !! test
24851 3. multi-line html tag
24852 !! options
24853 parsoid=html2wt
24854 !! html/parsoid
24855 <p>&lt;div
24856 &gt;foo&lt;/div
24857 &gt;
24858 </p>
24859 !! wikitext
24860 <nowiki><div
24861 >foo</div
24862 ></nowiki>
24863 !! end
24864
24865 !! test
24866 4. extension tags
24867 !! options
24868 parsoid=html2wt
24869 !! html/parsoid
24870 <p>&lt;ref&gt;foo&lt;/ref&gt;
24871 </p><p>&lt;ref&gt;bar
24872 </p><p>baz&lt;/ref&gt;
24873 </p>
24874 !! wikitext
24875 <nowiki><ref>foo</ref></nowiki>
24876
24877 <nowiki><ref>bar</nowiki>
24878
24879 baz<nowiki></ref></nowiki>
24880 !! end
24881
24882 #### --------------- Others ---------------
24883 !! test
24884 Escaping nowikis
24885 !! options
24886 parsoid=html2wt
24887 !! html/parsoid
24888 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24889 </p>
24890 !! wikitext
24891 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24892 !! end
24893
24894 ## The quote-char in the input is necessary for triggering the bug
24895 !! test
24896 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24897 !! options
24898 parsoid=html2wt
24899 !! html/parsoid
24900 <p>foo's bar :</p>
24901 !! wikitext
24902 foo's bar :
24903 !! end
24904
24905 #----------- End of wikitext escaping tests --------------
24906
24907 !! test
24908
24909 Tag-like HTML structures are passed through as text
24910 !! wikitext
24911 <x y>
24912
24913 <x.y>
24914
24915 <x-y>
24916
24917 1>2
24918
24919 x<y
24920
24921 a>b
24922
24923 1<d e>f
24924 !! html
24925 <p>&lt;x y&gt;
24926 </p><p>&lt;x.y&gt;
24927 </p><p>&lt;x-y&gt;
24928 </p><p>1&gt;2
24929 </p><p>x&lt;y
24930 </p><p>a&gt;b
24931 </p><p>1&lt;d e&gt;f
24932 </p>
24933 !! end
24934
24935 !! test
24936 HTML tag with necessary entities in attributes
24937 !! wikitext
24938 <span title="&amp;amp;">foo</span>
24939 !! html
24940 <p><span title="&amp;amp;">foo</span>
24941 </p>
24942 !! end
24943
24944 !! test
24945 HTML tag with 'unnecessary' entity encoding in attributes
24946 !! wikitext
24947 <span title="&amp;">foo</span>
24948 !! html
24949 <p><span title="&amp;">foo</span>
24950 </p>
24951 !! end
24952
24953 !! test
24954 HTML tag with broken attribute value quoting
24955 !! options
24956 parsoid=wt2html,html2html
24957 !! wikitext
24958 <span title="Hello world>Foo</span>
24959 !! html/php
24960 <p><span title="Hello world">Foo</span>
24961 </p>
24962 !! html/parsoid
24963 <p><span title="Hello world">Foo</span></p>
24964 !! end
24965
24966 !! test
24967 Self-closed tag with broken attribute value quoting
24968 !! options
24969 parsoid=wt2html,html2html
24970 !! wikitext
24971 <div title="Hello world />Foo
24972 !! html/php+tidy
24973 <div title="Hello world"></div>
24974 <p>Foo</p>
24975 !! html/parsoid
24976 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24977 !! end
24978
24979 !! test
24980 Table with broken attribute value quoting
24981 !! options
24982 parsoid=wt2html,html2html
24983 !! wikitext
24984 {|
24985 | title="Hello world|Foo
24986 |}
24987 !! html/php
24988 <table>
24989 <tr>
24990 <td title="Hello world">Foo
24991 </td></tr></table>
24992
24993 !! html/parsoid
24994 <table>
24995 <tr>
24996 <td title="Hello world">Foo
24997 </td></tr></table>
24998
24999 !! end
25000
25001 !! test
25002 Table with broken attribute value quoting on consecutive lines
25003 !! options
25004 parsoid=wt2html,html2html
25005 !! wikitext
25006 {|
25007 | title="Hello world|Foo
25008 | style="color:red|Bar
25009 |}
25010 !! html/php
25011 <table>
25012 <tr>
25013 <td title="Hello world">Foo
25014 </td>
25015 <td style="color:red">Bar
25016 </td></tr></table>
25017
25018 !! html/parsoid
25019 <table><tbody>
25020 <tr>
25021 <td title="Hello world">Foo
25022 </td><td style="color: red">Bar
25023 </td></tr></tbody></table>
25024
25025 !! end
25026
25027 !!test
25028 Accept empty td cell attribute
25029 !! wikitext
25030 {|
25031 | align="center" | foo || |
25032 |}
25033 !! html
25034 <table>
25035 <tr>
25036 <td align="center"> foo </td>
25037 <td>
25038 </td></tr></table>
25039
25040 !!end
25041
25042 !!test
25043 Non-empty attributes in th-cells
25044 !! wikitext
25045 {|
25046 ! Foo !! style="color: red" | Bar
25047 |}
25048 !! html
25049 <table>
25050 <tr>
25051 <th> Foo </th>
25052 <th style="color: red"> Bar
25053 </th></tr></table>
25054
25055 !!end
25056
25057 !!test
25058 Accept empty attributes in th-cells
25059 !! wikitext
25060 {|
25061 !| foo !!| bar
25062 |}
25063 !! html
25064 <table>
25065 <tr>
25066 <th> foo </th>
25067 <th> bar
25068 </th></tr></table>
25069
25070 !!end
25071
25072 !!test
25073 Empty table rows go away
25074 !! wikitext
25075 {|
25076 | Hello
25077 | there
25078 |- class="foo"
25079 |-
25080 |}
25081 !! html
25082 <table>
25083 <tr>
25084 <td> Hello
25085 </td>
25086 <td> there
25087 </td></tr>
25088
25089 </table>
25090
25091 !! end
25092
25093 ###
25094 ### Parsoid-centric tests for testing RTing of inter-element separators
25095 ### Edge cases not tested by existing parser tests and specific to
25096 ### Parsoid-specific serialization strategies.
25097 ###
25098
25099 !!test
25100 RT-ed inter-element separators should be valid separators
25101 !! wikitext
25102 {|
25103 |- [[foo]]
25104 |}
25105 !! html/php
25106 <table>
25107
25108 </table>
25109
25110 !! html/parsoid
25111 <table>
25112 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25113 </tbody></table>
25114 !!end
25115
25116 # Parsoid-only since PHP parser relies on Tidy for correct output
25117 !!test
25118 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25119 !!options
25120 parsoid
25121 !! wikitext
25122 {|
25123 |<small>foo
25124 bar
25125 |}
25126
25127 {|
25128 |<small>foo<small>
25129 |}
25130 !! html
25131 <table>
25132 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25133 <p>bar</p></small></td></tr>
25134 </tbody></table>
25135
25136 <table>
25137 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
25138 </tbody></table>
25139 !!end
25140
25141 # Note that the "style" attribute is really a template parameter here.
25142 # The = would have to be {{=}} if you wanted the literal.
25143 !!test
25144 Empty TD followed by TD with tpl-generated attribute
25145 !! wikitext
25146 {|
25147 |-
25148 |
25149 |{{echo|style='color:red'}}|foo
25150 |}
25151 !! html
25152 <table>
25153
25154 <tr>
25155 <td>
25156 </td>
25157 <td>foo
25158 </td></tr></table>
25159
25160 !!end
25161
25162 !!test
25163 Indented table with an empty td
25164 !! wikitext
25165 {|
25166 |-
25167 |
25168 |foo
25169 |}
25170 !! html
25171 <table>
25172
25173 <tr>
25174 <td>
25175 </td>
25176 <td>foo
25177 </td></tr></table>
25178
25179 !!end
25180
25181 ## We have some newline diffs RT-ing this edge case
25182 ## and it is not important enough -- we seem to be emitting
25183 ## at most 2 newlines after a </tr> and this is unrelated to
25184 ## the issue from T85627 that this is testing.
25185 !!test
25186 Indented table with blank lines in between (T85627)
25187 !! options
25188 parsoid=wt2html
25189 !! wikitext
25190 {|
25191 |foo
25192
25193
25194 |}
25195 !! html
25196 <table>
25197
25198 <tr>
25199 <td>foo
25200 </td></tr></table>
25201
25202 !!end
25203
25204 !!test
25205 Indented block & table
25206 !! wikitext
25207 <div>foo</div>
25208 {|
25209 |foo
25210 |}
25211 !! html/php
25212 <div>foo</div>
25213 <table>
25214 <tr>
25215 <td>foo
25216 </td></tr></table>
25217
25218 !! html/parsoid
25219 <div data-parsoid='{"stx":"html"}'>foo</div>
25220 <table><tbody>
25221 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25222 </tbody></table>
25223 !!end
25224
25225 !! test
25226 Indent and comment before table row
25227 !! wikitext
25228 {|
25229 <!--hi-->|-
25230 | there
25231 |}
25232 !! html/php
25233 <table>
25234
25235 <tr>
25236 <td> there
25237 </td></tr></table>
25238
25239 !! html/parsoid
25240 <table>
25241 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25242 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25243 </tbody></table>
25244 !! end
25245
25246 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25247 !!test
25248 Empty TR followed by a template-generated TR
25249 !!options
25250 parsoid
25251 !! wikitext
25252 {|
25253 |-
25254 {{echo|<tr><td>foo</td></tr>}}
25255 |}
25256 !! html
25257 <table>
25258 <tbody>
25259 <tr></tr>
25260 <tr about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<tr><td>foo</td></tr>"}},"i":0}}]}'>
25261 <td>foo</td></tr>
25262 </tbody></table>
25263 !!end
25264
25265 ## PHP and parsoid output differ for this, and since this is primarily
25266 ## for testing Parsoid's serializer, marking this Parsoid only
25267 !!test
25268 Empty TR followed by mixed-ws-comment line should RT correctly
25269 !!options
25270 parsoid
25271 !! wikitext
25272 {|
25273 |-
25274 <!--c-->
25275 |-
25276 <!--c--> <!--d-->
25277 |}
25278 !! html
25279 <table>
25280 <tbody>
25281 <tr></tr>
25282 <!--c-->
25283 <tr>
25284 <!--c--> </tr><!--d-->
25285 </tbody></table>
25286
25287 !!end
25288
25289 !!test
25290 Multi-line image caption generated by templates with/without trailing newlines
25291 !! wikitext
25292 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25293 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25294 !! html/parsoid
25295 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
25296 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
25297 !!end
25298
25299 !! test
25300 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25301 !! options
25302 parsoid=html2wt
25303 !! html/parsoid
25304 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
25305
25306 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25307 !! wikitext
25308 <includeonly>foo</includeonly>
25309 new para
25310
25311 [[Category:Foo]]
25312
25313 = new heading =
25314 !! end
25315
25316 ## PHP emits broken html for this, and since this is primarily
25317 ## a Parsoid serializer test, marking this Parsoid only
25318 !!test
25319 Improperly nested inline or quotes tags with whitespace in between
25320 !! wikitext
25321 <span> <s>x</span> </s>
25322 ''' ''x''' ''
25323 !! html/parsoid
25324 <p><span> <s>x</s></span><s> </s>
25325 <b> <i>x</i></b><i> </i>
25326 </p>
25327 !!end
25328
25329 !!test
25330 Encapsulate protected attributes from wt
25331 !! wikitext
25332 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25333
25334 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25335 | ok
25336 |}
25337 !! html/parsoid
25338 <div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
25339
25340 <table data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">
25341 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25342 </tbody></table>
25343 !!end
25344
25345 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25346 ## Having nested or stray pre tags results in the attempt to add duplicates,
25347 ## causing an assertion fail. This test tries to prevent that situation.
25348 !!test
25349 Ensure ParagraphWrapper can deal with stray closing pre tags
25350 !!options
25351 parsoid=wt2html
25352 !! wikitext
25353 plain text</pre>
25354 !! html/parsoid
25355 plain text
25356 !!end
25357
25358 !!test
25359 1. Ensure fostered text content is wrapped in element nodes
25360 !!options
25361 parsoid=wt2html
25362 !! wikitext
25363 <table>hi</table><table>ho</table>
25364 !! html/parsoid
25365 <p>hi</p>
25366 <table></table>
25367 <p>ho</p>
25368 <table></table>
25369 !!end
25370
25371 !!test
25372 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25373 !!options
25374 parsoid=wt2html,wt2wt
25375 !! wikitext
25376 <table>
25377 <tr> || ||
25378 <td> a
25379 </table>
25380 !! html/parsoid
25381 <p> || ||
25382 </p><table>
25383 <tbody><tr><td> a</td></tr>
25384 </tbody></table>
25385 !!end
25386
25387 !!test
25388 Encapsulation properly handles null DSR information from foster box
25389 !!options
25390 parsoid=wt2html,wt2wt
25391 !! wikitext
25392 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25393 !! html/parsoid
25394 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
25395 !!end
25396
25397 !!test
25398 1. Encapsulate foster-parented transclusion content
25399 !!options
25400 parsoid=wt2wt,wt2html
25401 !! wikitext
25402 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25403 !! html/parsoid
25404 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
25405 <tbody>
25406 <tr>
25407 <td>bar</td>
25408 </tr>
25409 </tbody>
25410 </table>
25411 !!end
25412
25413 !!test
25414 2. Encapsulate foster-parented transclusion content
25415 !!options
25416 parsoid=wt2wt,wt2html
25417 !! wikitext
25418 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25419 !! html/parsoid
25420 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo&quot;}},&quot;i&quot;:0}},&quot;</div><tr><td>bar</td></tr></table>&quot;]}">foo</div>
25421 <table>
25422 <tbody>
25423 <tr>
25424 <td>bar</td>
25425 </tr>
25426 </tbody>
25427 </table>
25428 !!end
25429
25430 !!test
25431 3. Encapsulate foster-parented transclusion content
25432 !!options
25433 parsoid=wt2wt,wt2html
25434 !! wikitext
25435 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25436 !! html/parsoid
25437 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
25438 <p>foo</p>
25439 </div>
25440 <table>
25441 <tbody>
25442 <tr>
25443 <td>bar</td>
25444 </tr>
25445 </tbody>
25446 </table>
25447 !!end
25448
25449 !!test
25450 4. Encapsulate foster-parented transclusion content
25451 !!options
25452 parsoid=wt2wt,wt2html
25453 !! wikitext
25454 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25455 !! html/parsoid
25456 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
25457 <p>foo</p>
25458 </div>
25459 <table>
25460 <tbody>
25461 <tr>
25462 <td>bar</td>
25463 </tr>
25464 </tbody>
25465 </table>
25466 !!end
25467
25468 !!test
25469 5. Encapsulate foster-parented transclusion content
25470 !!options
25471 parsoid=wt2wt,wt2html
25472 !! wikitext
25473 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25474 !! html/parsoid
25475 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
25476 <table>
25477 <tbody>
25478 <tr>
25479 <td>
25480 <div>
25481 <p>foo</p>
25482 </div>
25483 </td>
25484 </tr>
25485 </tbody>
25486 </table>
25487 !!end
25488
25489 !!test
25490 6. Encapsulate foster-parented transclusion content
25491 !!options
25492 parsoid=wt2wt,wt2html
25493 !! wikitext
25494 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25495 !! html/parsoid
25496 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</p>
25497 <table>
25498 <tbody>
25499 <tr>
25500 <td>
25501 <div>
25502 <p>foo</p>
25503 </div>
25504 </td>
25505 </tr>
25506 </tbody>
25507 </table>
25508 <p>ok</p>
25509 !!end
25510
25511 !!test
25512 7. Encapsulate foster-parented transclusion content
25513 !!options
25514 parsoid=wt2wt,wt2html
25515 !! wikitext
25516 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25517 !! html/parsoid
25518 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;<td>bar</td></table>&quot;]}">foo</p>
25519 <table>
25520 <tbody>
25521 <tr>
25522 <td>bar</td>
25523 </tr>
25524 </tbody>
25525 </table>
25526 !!end
25527
25528 # Note that the wt is broken on purpose: the = should be {{=}} if you
25529 # don't want it to be a template parameter key.
25530 !!test
25531 8. Encapsulate foster-parented transclusion content
25532 !!options
25533 parsoid=wt2wt,wt2html
25534 !! wikitext
25535 {{echo|a
25536 }}{|{{echo|style='color:red'}}
25537 |-
25538 |b
25539 |}
25540 !! html/parsoid
25541 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25542 <span> </span>
25543 <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&#39;color:red&#39;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
25544 <table>
25545 <tbody>
25546 <tr>
25547 <td>b</td>
25548 </tr>
25549 </tbody>
25550 </table>
25551 !!end
25552
25553 !!test
25554 9. Encapsulate foster-parented transclusion content
25555 !!options
25556 parsoid=wt2wt,wt2html
25557 !! wikitext
25558 <table>{{echo|hi</table>hello}}
25559 !! html/parsoid
25560 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
25561 !!end
25562
25563 !!test
25564 Table in fosterable position
25565 !!options
25566 parsoid=wt2html
25567 !! wikitext
25568 {{OpenTable}}
25569 <div>
25570 {|
25571 |}
25572 </div>
25573 |}
25574 !! html/parsoid
25575 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
25576 </span>
25577 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25578
25579 <table>
25580 </table>
25581 !!end
25582
25583 # Parsoid only for bug 64747
25584 !! test
25585 Properly encapsulate empty-content transclusions in fosterable positions
25586 !! wikitext
25587 <table>
25588 {{#if:|
25589 <td>foo</td>
25590 }}
25591 </table>
25592 !! html/parsoid
25593 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}'>
25594
25595 </table>
25596 !! end
25597
25598 !! test
25599 Always encapsulate foster box when template range is expanded to table
25600 !! options
25601 parsoid=wt2wt
25602 !! wikitext
25603 {|
25604 hello
25605 {{OpenTable}}
25606 |}
25607 !! html/parsoid
25608
25609 !! end
25610
25611 !! test
25612 T115289: Unclosed table
25613 !! wikitext
25614 {{echo|<table>}}<!--c-->[[Category:Two]]
25615 !! html/parsoid
25616 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
25617 !! end
25618
25619 !! test
25620 T115289: Don't migrate newlines out of tables with fostered content
25621 !! wikitext
25622 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25623 !! html/parsoid
25624 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
25625 !! end
25626
25627 !! test
25628 T73074: More fostering fun
25629 !! wikitext
25630 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25631 !! html/parsoid
25632 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
25633 !! end
25634
25635 !!test
25636 Support <object> element with .data attribute
25637 !!options
25638 parsoid=html2wt
25639 !! html/parsoid
25640 <object data="test.swf"></object>
25641 !! wikitext
25642 <object data="test.swf"></object>
25643 !!end
25644
25645 !! test
25646 Don't block XML namespace declaration
25647 !! wikitext
25648 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25649 !! html/php
25650 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25651 </p>
25652 !! html/parsoid
25653 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25654 !! end
25655
25656 # -----------------------------------------------------------------
25657 # The following section of tests are primarily to spec requirements
25658 # around Parsoid's serialization (old, new, edited content)
25659 #
25660 # All these tests are marked Parsoid html2wt and html2html only
25661 # ----------------------------------------------------------------
25662
25663 !! test
25664 Ignore rel attribute in a-tags during serialization to url-links
25665 !! options
25666 parsoid=html2wt
25667 !! html/parsoid
25668 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25669 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25670 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25671 !! wikitext
25672 http://en.wikipedia.org/wiki/Foobar
25673 http://en.wikipedia.org/wiki/Foobar
25674 http://en.wikipedia.org/wiki/Foobar
25675 !! end
25676
25677 # 'mi' is a localinterwiki prefix as well as a language
25678 !! test
25679 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25680 !! options
25681 parsoid=html2wt
25682 !! html/parsoid
25683 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25684 !! wikitext
25685 [[Foo]]
25686 !! end
25687
25688 # See T93839
25689 !! test
25690 New wikilinks should be serialized properly
25691 !! options
25692 parsoid=html2wt
25693 !! html/parsoid
25694 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25695 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25696 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25697 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25698 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25699 !! wikitext
25700 [[Foo]]
25701 [[Foo]]
25702 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25703 http://en.wikipedia.org/wiki/Foo
25704 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25705 !! end
25706
25707 !! test
25708 New wiki links (href variations)
25709 !! options
25710 parsoid=html2wt
25711 !! html/parsoid
25712 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25713 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25714 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25715 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25716 !! wikitext
25717 [[Foo_bar]]
25718 [[Foo_bar]]
25719 [[Foo_bar]]
25720 [[Toxine bactérienne]]
25721 !! end
25722
25723 !! test
25724 New wiki links (content string variations)
25725 !! options
25726 parsoid=html2wt
25727 !! html/parsoid
25728 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25729 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25730 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25731 !! wikitext
25732 [[Foo_bar]]
25733 [[Foo bar]]
25734 [[Foo_bar|./Foo_bar]]
25735 !! end
25736
25737 !! test
25738 New category links (href variations)
25739 !! options
25740 parsoid=html2wt
25741 !! html/parsoid
25742 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25743 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25744 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25745 !! wikitext
25746 [[Category:Toxine bactérienne]]
25747 [[Category:Toxine bactérienne]]
25748 [[Category:Toxine bactérienne]]
25749 !! end
25750
25751 !! test
25752 New sol transparent links don't need indent-pre nowiki protection
25753 !! options
25754 parsoid=html2wt
25755 language=de
25756 !! html/parsoid
25757 <link rel="mw:PageProp/redirect" href="./Main_Page">
25758 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25759 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25760 !! wikitext
25761 #WEITERLEITUNG [[Main Page]]
25762 <!-- this is good --> [[Category:Good]]
25763 <!-- this is great --> [[Kategorie:Great]]
25764 !! end
25765
25766 !! test
25767 New interlanguage links (href variations)
25768 !! options
25769 parsoid=html2wt
25770 !! html/parsoid
25771 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25772 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25773 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25774 !! wikitext
25775 [[es:Toxine bactérienne]]
25776 [[es:Toxine_bactérienne]]
25777 [[es:Toxine_bactérienne]]
25778 !! end
25779
25780 !! test
25781 Image: Modifying size of an image (1)
25782 !! options
25783 parsoid={
25784 "modes": ["wt2wt"],
25785 "changes": [
25786 ["img[height]", "attr", "height", "22"],
25787 ["img[width]", "attr", "width", "200"]
25788 ]
25789 }
25790 !! wikitext
25791 [[Image:Foobar.jpg|230x230px]]
25792 !! wikitext/edited
25793 [[Image:Foobar.jpg|200x200px]]
25794 !!end
25795
25796 !! test
25797 Image: Modifying size of an image (2)
25798 !! options
25799 parsoid={
25800 "modes": ["wt2wt"],
25801 "changes": [
25802 ["img[height]", "attr", "height", "100"],
25803 ["img[width]", "attr", "width", "500"]
25804 ]
25805 }
25806 !! wikitext
25807 [[Image:Foobar.jpg|230x230px]]
25808 !! wikitext/edited
25809 [[Image:Foobar.jpg|500x500px]]
25810 !!end
25811
25812 # Change in size is ignored so long as class='mw-default-size'
25813 !! test
25814 Image: Modifying size of an image (3)
25815 !! options
25816 parsoid={
25817 "modes": ["wt2wt"],
25818 "changes": [
25819 ["figure[class]", "removeClass", "mw-default-size"],
25820 ["figure img", "attr", "height", "19"],
25821 ["figure img", "attr", "width", "170"]
25822 ]
25823 }
25824 !! wikitext
25825 [[Image:Foobar.jpg|thumb]]
25826 !! wikitext/edited
25827 [[Image:Foobar.jpg|thumb|170x170px]]
25828 !!end
25829
25830 !! test
25831 Image: Modifying alignment of an image (bug 48665)
25832 !! options
25833 parsoid={
25834 "modes": ["wt2wt"],
25835 "changes": [
25836 ["figure[class]", "removeClass", "mw-halign-right"],
25837 ["figure[class]", "addClass", "mw-halign-left"]
25838 ]
25839 }
25840 !! wikitext
25841 [[Image:Foobar.jpg|thumb|caption|right]]
25842 !! wikitext/edited
25843 [[Image:Foobar.jpg|thumb|caption|left]]
25844 !! end
25845
25846 !! test
25847 Image: Modifying mw-default-size of an frameless image (bug 62805)
25848 !! options
25849 parsoid={
25850 "modes": ["wt2wt"],
25851 "changes": [
25852 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25853 ]
25854 }
25855 !! wikitext
25856 [[Image:Foobar.jpg|frameless|right]]
25857 !! wikitext/edited
25858 [[Image:Foobar.jpg|frameless|right|220x220px]]
25859 !! end
25860
25861 !! test
25862 Image: Modifying valign of an image (bug 49221)
25863 !! options
25864 parsoid={
25865 "modes": ["wt2wt"],
25866 "changes": [
25867 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25868 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25869 ]
25870 }
25871 !! wikitext
25872 [[File:Foobar.jpg|20px|middle]]
25873 !! wikitext/edited
25874 [[File:Foobar.jpg|20px|text-top]]
25875 !! end
25876
25877 !! test
25878 Image: Modifying alt attribute of an image (bug 56400)
25879 !! options
25880 parsoid={
25881 "modes": ["wt2wt"],
25882 "changes": [
25883 ["img[alt]", "attr", "alt", "some alternate edited text"]
25884 ]
25885 }
25886 !! wikitext
25887 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25888 !! wikitext/edited
25889 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25890 !!end
25891
25892 !! test
25893 Image: Modifying caption of an image
25894 !! options
25895 parsoid={
25896 "modes": ["wt2wt"],
25897 "changes": [
25898 ["figcaption", "text", "new caption"]
25899 ]
25900 }
25901 !! wikitext
25902 [[Image:Foobar.jpg|thumb|original caption]]
25903 !! wikitext/edited
25904 [[Image:Foobar.jpg|thumb|new caption]]
25905 !!end
25906
25907 !! test
25908 Image: empty alt attribute (bug 48924)
25909 !! options
25910 parsoid
25911 !! wikitext
25912 [[File:Foobar.jpg|thumb|alt=|bar]]
25913 !! html
25914 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"alt","ak":"alt="},{"ck":"caption","ak":"bar"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=","resource":"File:Foobar.jpg"}}'/></a><figcaption>bar</figcaption></figure>
25915 !! end
25916
25917 !! test
25918 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25919 !! options
25920 parsoid=html2wt
25921 language=ar
25922 disabled
25923 !! html/parsoid
25924 <figure class="mw-default-size mw-halign-right" typeof="mw:Image/Thumb"><a href="./Imagen:Foobar.jpg"><img resource="./Imagen:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180"/></a></figure>
25925 !! wikitext
25926 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25927 !! end
25928
25929 !! test
25930 Image: Block level image should have \n before and after
25931 !! wikitext
25932 123
25933 [[File:Foobar.jpg|right|thumb|150x150px]]
25934 456
25935 !! html/parsoid
25936 <p>123</p>
25937 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
25938 <p>456</p>
25939 !!end
25940
25941 !! test
25942 Image: New block level image should have \n before and after (existing content)
25943 !! wikitext
25944 123
25945 [[File:Foobar.jpg|right|thumb|150x150px]]
25946 456
25947 !! html/parsoid
25948 <p>123</p>
25949 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
25950 <p>456</p>
25951 !!end
25952
25953 !! test
25954 Image: upright option (parsoid)
25955 !! wikitext
25956 [[File:Foobar.jpg|thumb|upright|caption]]
25957 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25958 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25959 !! html/parsoid
25960 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/170px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
25961 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
25962 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
25963 !!end
25964
25965 !! test
25966 Image: upright option is ignored on inline and frame images (parsoid)
25967 !! wikitext
25968 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25969 !! html/parsoid
25970 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></span></p>
25971 !!end
25972
25973 !! test
25974 Image: from basic HTML (1)
25975 !! options
25976 parsoid=html2wt
25977 !! html/parsoid
25978 <span typeof="mw:Image">
25979 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25980 </span>
25981 !! wikitext
25982 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25983 !! end
25984
25985 !! test
25986 Image: from basic HTML (2)
25987 !! options
25988 parsoid=html2wt
25989 !! html/parsoid
25990 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25991 !! wikitext
25992 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25993 !! end
25994
25995 !! test
25996 Image: from basic HTML (3)
25997 !! options
25998 parsoid=html2wt
25999 !! html/parsoid
26000 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26001 !! wikitext
26002 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26003 !! end
26004
26005 !! test
26006 Image: from basic HTML (4)
26007 !! options
26008 parsoid=html2wt
26009 !! html/parsoid
26010 <img src="./File:Foobar.jpg">
26011 !! wikitext
26012 [[File:Foobar.jpg|link=]]
26013 !! end
26014
26015 !! test
26016 Image: Invalid title as link
26017 !! wikitext
26018 [[File:Foobar.jpg|link=<]]
26019 !! html/php
26020 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
26021 </p>
26022 !! html/parsoid
26023 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&amp;lt;"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
26024 !! end
26025
26026 !! test
26027 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26028 !! options
26029 parsoid=html2wt
26030 !! html/parsoid
26031 <ul>
26032 <li><p>foo</p></li>
26033 </ul>
26034 !! wikitext
26035 * foo
26036 !! end
26037
26038 !! test
26039 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26040 !! options
26041 parsoid=html2wt
26042 !! html/parsoid
26043 <ul> <li>foo</li></ul>
26044 !! wikitext
26045 * foo
26046 !! end
26047
26048 !! test
26049 Don't strip leading whitespace when handling indent-pre suppressing tags
26050 !! options
26051 parsoid=html2wt
26052 !! html/parsoid
26053 <table>
26054 <tr><td> indented row</td></tr>
26055 </table>
26056 <blockquote><p>
26057 <b>This is very bold of you!</b>
26058 </p>
26059 <table><tr><td>
26060 indented cell (no pre-wrapping!)
26061 </td></tr></table>
26062 </blockquote>
26063 <p>foo</p>
26064 <div>bar</div>
26065 !! wikitext
26066 {|
26067 | indented row
26068 |}
26069 <blockquote>
26070 '''This is very bold of you!'''
26071
26072 {|
26073 |
26074 indented cell (no pre-wrapping!)
26075 |}
26076 </blockquote>
26077 foo
26078 <div>bar</div>
26079 !! end
26080
26081 !! test
26082 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26083 !! options
26084 parsoid=html2wt
26085 !! html/parsoid
26086 <p>foo</p>
26087 <span>bar</span>
26088
26089 <span>foo2
26090 </span>bar2
26091
26092 <div>foo</div>
26093 <span>bar</span>
26094
26095 <div>
26096 <span>foo</span>
26097 </div>
26098 !! wikitext
26099 foo
26100
26101 <span>bar</span>
26102
26103 <span>foo2
26104 <nowiki> </nowiki></span>bar2
26105
26106 <div>foo</div>
26107 <nowiki> </nowiki><span>bar</span>
26108
26109 <div>
26110 <nowiki> </nowiki><span>foo</span>
26111 </div>
26112 !! end
26113
26114 !! test
26115 Lists: Dont insert newlines in a serialized list item.
26116 !! options
26117 parsoid=html2wt
26118 !! html/parsoid
26119 <ul><li>a<br>b</li><li>c</li></ul>
26120 !! wikitext
26121 * a<br>b
26122 * c
26123 !! end
26124
26125 !! test
26126 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26127 !! options
26128 parsoid={
26129 "modes": ["html2wt"],
26130 "scrubWikitext": false
26131 }
26132 !! html/parsoid
26133 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26134 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26135
26136 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26137 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26138
26139 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26140
26141 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26142 !! wikitext
26143 == hello there [[Category:A1]] ==
26144
26145 == [[Category:A2]] hi pal ==
26146
26147 == <!--foo--> [[Category:A3]] how goes it ==
26148
26149 == it goes well [[Category:A4]] <!--bar--> ==
26150
26151 ==howdy [[Category:A5]]==
26152
26153 == __TOC__ ok ==
26154 !! end
26155
26156 !! test
26157 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26158 !! options
26159 parsoid={
26160 "modes": ["html2wt"],
26161 "scrubWikitext": true
26162 }
26163 !! html/parsoid
26164 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26165 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26166
26167 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26168 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26169
26170 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26171 !! wikitext
26172 == hello there ==
26173 [[Category:A1]]
26174 [[Category:A2]]
26175
26176 == hi pal ==
26177
26178 <!--foo--> [[Category:A3]]
26179
26180 == how goes it ==
26181
26182 == it goes well ==
26183 [[Category:A4]] <!--bar-->
26184
26185 __TOC__
26186
26187 == ok ==
26188 !! end
26189
26190 !! test
26191 Headings: Don't hoist metas that come from templates
26192 !! options
26193 parsoid={
26194 "modes": ["html2wt"],
26195 "scrubWikitext": true
26196 }
26197 !! html/parsoid
26198 <h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
26199 !! wikitext
26200 == {{echo|foo [[Category:Foo]]}} ==
26201 !! end
26202
26203 !! test
26204 Headings: Category in ref isn't hoisted
26205 !! options
26206 parsoid={
26207 "modes": ["html2wt"],
26208 "scrubWikitext": true
26209 }
26210 !! html/parsoid
26211 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26212
26213 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
26214 !! wikitext
26215 == foo <ref>bar
26216 [[Category:Baz]] </ref> ==
26217
26218 <references />
26219 !! end
26220
26221 !! test
26222 Parsoid: Serialize positional parameters with = in them as named parameter
26223 !! options
26224 parsoid=html2wt
26225 !! html/parsoid
26226 <p about="#mwt1" typeof="mw:Transclusion"
26227 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26228
26229 <p about="#mwt1" typeof="mw:Transclusion"
26230 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26231
26232 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26233 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26234 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26235 !! wikitext
26236 {{echo|1=f=oo}}
26237
26238 {{echo|1=f=oo|2=bar}}
26239
26240 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26241 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26242 {{echo|<nowiki>f=oo</nowiki>|bar}}
26243 !! end
26244
26245 !! test
26246 Parsoid: Serialize positional parameters with = in extlink as named parameter
26247 !! options
26248 parsoid=html2wt
26249 !! html/parsoid
26250 <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
26251 !! wikitext
26252 {{echo|1=http://stuff?is=ok}}
26253 !! end
26254
26255 !! test
26256 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26257 !! options
26258 parsoid=html2wt
26259 !! html/parsoid
26260 <div>a<p>b</p></div>
26261 <div>a
26262 <p>b</p></div>
26263 <div>
26264 a
26265 <p>b</p></div>
26266 !! wikitext
26267 <div>a
26268 b
26269 </div>
26270 <div>a
26271 b
26272 </div>
26273 <div>
26274 a
26275
26276 b
26277 </div>
26278 !! end
26279
26280 !! test
26281 Substrings resembling wikitext in hrefs should not get nowiki escapes
26282 !! options
26283 parsoid=html2wt
26284 !! html/parsoid
26285 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26286 !! wikitext
26287 [[Foo''bar''baz]]
26288 !! end
26289
26290 !! test
26291 Enforce single-line context in the serializer
26292 !! options
26293 parsoid=html2wt
26294 !! html/parsoid
26295 <h2>testing
26296 123</h2>
26297
26298 <h2> hi <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bogus","href":"./Template:Bogus"},"params":{"1":{"wt":"there\nyou"}},"i":0}}]}'>there</span><span about="#mwt1">
26299 </span><span about="#mwt1">you</span> </h2>
26300
26301 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26302
26303 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
26304 there</span></li></ol>
26305
26306 <ul><li>asd
26307 sdf</li></ul>
26308
26309 <ul><li>foo
26310 bar
26311 baz</li>
26312 <li>foo <b>bar</b>
26313 baz</li></ul>
26314
26315 <dl><dt>hi
26316 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26317 ho</dd></dl>
26318
26319 <dl><dd> <table>
26320 <tbody><tr><td> ha
26321 ha
26322 ha</td></tr>
26323 </tbody></table></dd></dl>
26324 !! wikitext
26325 == testing 123 ==
26326
26327 == hi {{bogus|there
26328 you}} ==
26329
26330 == foo <ref>hello
26331 there</ref> ==
26332
26333 <references />
26334
26335 * asd sdf
26336
26337 * foo bar baz
26338 * foo '''bar''' baz
26339
26340 ; hi ho : hi ho
26341
26342 : {|
26343 | ha
26344 ha
26345 ha
26346 |}
26347 !! end
26348
26349 !! test
26350 Serialize new placeholder space without spans
26351 !! options
26352 parsoid=html2wt
26353 !! html/parsoid
26354 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26355
26356 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26357
26358 <span typeof="mw:Extension/ref" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo<span typeof=\&quot;mw:Placeholder\&quot;>&amp;nbsp;</span>: bar&quot;}}"><sup>[1]</sup></span>ok</p>
26359 !! wikitext
26360 foo : bar
26361
26362 foo : bar
26363
26364 <ref>foo : bar</ref>ok
26365 !! end
26366
26367
26368 #-----------------------
26369 # Tag minimization tests
26370 #-----------------------
26371
26372 !! test
26373 1. I/B quote minimization: wikitext-only tags should be combined
26374 !! options
26375 parsoid=html2wt
26376 !! html/parsoid
26377 <p><i>A</i><i>B</i></p>
26378 <p><b>A</b><b>B</b></p>
26379 <p><i>A</i><b><i>B</i></b></p>
26380 <p><b>A</b><i><b>B</b></i></p>
26381 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26382 <p><i><b>A</b></i><i><b>B</b></i></p>
26383 <p><i><b>A</b></i><b><i>B</i></b></p>
26384 <p><b><i>A</i></b><i><b>B</b></i></p>
26385 !! wikitext
26386 ''AB''
26387
26388 '''AB'''
26389
26390 ''A'''B'''''
26391
26392 '''A''B'''''
26393
26394 '''A''BC''D'''
26395
26396 '''''AB'''''
26397
26398 '''''AB'''''
26399
26400 '''''AB'''''
26401 !! end
26402
26403 !! test
26404 2. I/B quote minimization: wikitext and html tags should not be combined
26405 !! options
26406 parsoid=html2wt
26407 !! html/parsoid
26408 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26409 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26410 !! wikitext
26411 ''A''<i>B</i>
26412
26413 ''A''<nowiki/>'''<i>B</i>'''
26414 !! end
26415
26416 !! test
26417 3. I/B quote minimization: templated content stops minimization
26418 !! options
26419 parsoid=html2wt
26420 !! html/parsoid
26421 <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;B&#39;&#39;"}},"i":0}}]}'>B</i>
26422 <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;&#39;&#39;&#39;B&#39;&#39;&#39;&#39;&#39;"}},"i":0}}]}'><i>B</i></b>
26423 !! wikitext
26424 ''A''{{echo|''B''}}
26425
26426 ''A''{{echo|'''''B'''''}}
26427 !! end
26428
26429 !! test
26430 4. I/B quote minimization: new content should be mimimized with adjacent old content
26431 !! options
26432 parsoid=html2wt
26433 !! html/parsoid
26434 <p><i>A</i><i>B</i></p>
26435 <p><b>A</b><b>B</b></p>
26436 <p><i>A</i><b><i>B</i></b></p>
26437 !! wikitext
26438 ''AB''
26439
26440 '''AB'''
26441
26442 ''A'''B'''''
26443 !! end
26444
26445 !! test
26446 5a. Merge adjacent quote nodes if they've been edited
26447 !! options
26448 parsoid={
26449 "modes": ["wt2wt", "selser"],
26450 "changes": [
26451 ["p", "contents", "remove", ":contains('b')"]
26452 ]
26453 }
26454 !! wikitext
26455 ''a''b''c''
26456 !! wikitext/edited
26457 ''ac''
26458 !! end
26459
26460 !! test
26461 5b. Merge adjacent quote nodes if they've been edited
26462 !! options
26463 parsoid={
26464 "modes": ["wt2wt", "selser"],
26465 "changes": [
26466 ["#x", "remove"]
26467 ]
26468 }
26469 !! wikitext
26470 ''a''<span id="x">b</span>''c''
26471 !! wikitext/edited
26472 ''ac''
26473 !! end
26474
26475 !! test
26476 1. Merge adjacent link nodes as long as at least one element is new
26477 !! options
26478 parsoid={
26479 "modes": ["html2wt"],
26480 "scrubWikitext": true
26481 }
26482 !! html/parsoid
26483 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26484 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26485 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26486 !! wikitext
26487 [[Football]]
26488 [[Football]]
26489 [[Football|Foot]][[Football|ball]]
26490 !! end
26491
26492 !! test
26493 2. Merge adjacent link nodes and enable additional normalizations
26494 !! options
26495 parsoid={
26496 "modes": ["html2wt"],
26497 "scrubWikitext": true
26498 }
26499 !! html/parsoid
26500 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26501 !! wikitext
26502 [[Football|''Football'']]
26503 !! end
26504
26505 !! test
26506 3. Don't merge adjacent link nodes if scrubWikitext is false
26507 !! options
26508 parsoid={
26509 "modes": ["html2wt"],
26510 "scrubWikitext": false
26511 }
26512 !! html/parsoid
26513 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26514 !! wikitext
26515 [[Football|Foot]][[Football|ball]]
26516 !! end
26517
26518 #------------------------------
26519 # End of tag minimization tests
26520 #------------------------------
26521
26522 !!test
26523 Bug 54262: New entities
26524 !! options
26525 parsoid=html2wt
26526 !! html/parsoid
26527 <span typeof="mw:Entity">&nbsp;</span>
26528 !! wikitext
26529 &nbsp;
26530 !! end
26531
26532 ## Note that there is no wikitext output for 'unknownproperty' ##
26533 ## Unknown magic words are silently dropped ##
26534
26535 !! test
26536 Magic words
26537 !! options
26538 parsoid=html2wt
26539 !! html/parsoid
26540 <meta property='mw:PageProp/toc' />
26541 <meta property='mw:PageProp/notoc' />
26542 <meta property='mw:PageProp/forcetoc' />
26543 <meta property='mw:PageProp/index' />
26544 <meta property='mw:PageProp/noindex' />
26545 <meta property='mw:PageProp/nogallery' />
26546 <meta property='mw:PageProp/noeditsection' />
26547 <meta property='mw:PageProp/notitleconvert' />
26548 <meta property='mw:PageProp/nocontentconvert' />
26549 <meta property='mw:PageProp/unknownproperty' />
26550 !! wikitext
26551 __TOC__
26552 __NOTOC__
26553 __FORCETOC__
26554 __INDEX__
26555 __NOINDEX__
26556 __NOGALLERY__
26557 __NOEDITSECTION__
26558 __NOTITLECONVERT__
26559 __NOCONTENTCONVERT__
26560 !! end
26561
26562 !! test
26563 Consecutive <pre>s should not get merged
26564 !! options
26565 parsoid=html2wt,html2html
26566 !! html/parsoid
26567 <pre>a</pre><pre>b</pre>
26568
26569 <pre>c
26570 </pre><pre>
26571 d</pre>
26572
26573 <pre>e
26574
26575 </pre><pre>
26576
26577 f</pre>
26578 !! wikitext
26579 a
26580
26581 b
26582
26583 c
26584
26585 d
26586
26587 e
26588
26589
26590
26591 f
26592 !! end
26593
26594 !! test
26595 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26596 !! options
26597 parsoid=html2wt
26598 !! html/parsoid
26599 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26600 !! wikitext
26601 [[Special:BookSources/1234567890|ISBN 1234567895]]
26602 !! end
26603
26604 !! test
26605 Edited RFC links not serializable as RFC links should serialize as extlinks
26606 !! options
26607 parsoid=html2wt
26608 !! html/parsoid
26609 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26610 !! wikitext
26611 [//tools.ietf.org/html/rfc123 New RFC]
26612 !! end
26613
26614 !! test
26615 Edited PMID links not serializable as PMID links should serialize as extlinks
26616 !! options
26617 parsoid=html2wt
26618 !! html/parsoid
26619 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26620 !! wikitext
26621 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26622 !! end
26623
26624 !! test
26625 WTS of autolinks with trailing/surrounding context
26626 !! options
26627 parsoid=html2wt
26628 !! html/parsoid
26629 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26630 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26631 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26632 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26633 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26634 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26635 !! wikitext
26636 http://cscott.net'''foo'''
26637
26638 http://cscott.net<b>foo</b>
26639
26640 '''http://cscott.net'''
26641
26642 '''http://cscott.net '''
26643
26644 '''http://cscott.net<nowiki/>x'''
26645
26646 http://cscott.net<nowiki/>x
26647 !! end
26648
26649 !! test
26650 WTS of autolinks with nowikis (round-trip)
26651 !! wikitext
26652 x<nowiki/>http://cscott.net<nowiki/>x
26653 !! html/parsoid
26654 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26655 !! end
26656
26657 # this is the "easy" test because it leaves in place all the
26658 # data-parsoid information indicating this is an autolink
26659 !! test
26660 WTS of autolinks with escapes (editing)
26661 !! options
26662 parsoid={
26663 "modes": ["wt2wt"],
26664 "changes": [
26665 [ "meta", "remove" ]
26666 ]
26667 }
26668 !! wikitext
26669 x<nowiki/>http://cscott.net<nowiki/>x
26670 !! wikitext/edited
26671 x<nowiki/>http://cscott.net<nowiki/>x
26672 !! end
26673
26674 !! test
26675 WTS of edited autolink-like text (T103364)
26676 !! options
26677 parsoid={
26678 "modes": ["wt2wt"],
26679 "changes": [
26680 [ "span[typeof]", "removeAttr", "typeof" ]
26681 ]
26682 }
26683 !! wikitext
26684 Not a link: <nowiki>http://example.com</nowiki>.
26685 !! wikitext/edited
26686 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26687 !! end
26688
26689 !! test
26690 WTS of newly-authored autolink-like text (T103364)
26691 !! options
26692 parsoid=html2wt
26693 !! html/parsoid
26694 <p>http://example.com is not a link.</p>
26695 !! wikitext
26696 <nowiki>http://example.com</nowiki> is not a link.
26697 !! end
26698
26699 !! test
26700 WTS of autolink-like text after an autolink (T108563)
26701 !! options
26702 parsoid=html2wt
26703 !! html/parsoid
26704 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26705 !! wikitext
26706 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26707 !! end
26708
26709 !! test
26710 Magic links inside links (not autolinked)
26711 !! wikitext
26712 [[Foo|http://example.com]]
26713 [[Foo|RFC 1234]]
26714 [[Foo|PMID 1234]]
26715 [[Foo|ISBN 123456789x]]
26716
26717 [http://foo.com http://example.com]
26718 [http://foo.com RFC 1234]
26719 [http://foo.com PMID 1234]
26720 [http://foo.com ISBN 123456789x]
26721 !! html+tidy
26722 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
26723 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
26724 !! html/parsoid
26725 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26726 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26727 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26728 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26729
26730 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26731 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26732 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26733 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26734 !! end
26735
26736 !! test
26737 Magic links inside image captions (autolinked)
26738 !! wikitext
26739 [[File:Foobar.jpg|thumb|http://example.com]]
26740 [[File:Foobar.jpg|thumb|RFC 1234]]
26741 [[File:Foobar.jpg|thumb|PMID 1234]]
26742 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26743 !! html+tidy
26744 <div class="thumb tright">
26745 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
26746 <div class="thumbcaption">
26747 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26748 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26749 </div>
26750 </div>
26751 <div class="thumb tright">
26752 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
26753 <div class="thumbcaption">
26754 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26755 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26756 </div>
26757 </div>
26758 <div class="thumb tright">
26759 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
26760 <div class="thumbcaption">
26761 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26762 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26763 </div>
26764 </div>
26765 <div class="thumb tright">
26766 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
26767 <div class="thumbcaption">
26768 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26769 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26770 </div>
26771 </div>
26772 !! html/parsoid
26773 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
26774 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
26775 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
26776 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
26777 !! end
26778
26779 !! test
26780 WTS of magic word text (T109371)
26781 !! options
26782 parsoid=html2wt
26783 !! html/parsoid
26784 <p>RFC 1234</p>
26785 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26786 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26787 !! wikitext
26788 <nowiki>RFC 1234</nowiki>
26789
26790 [http://foo.com RFC 1234]
26791
26792 [[Foo|RFC 1234]]
26793 !! end
26794
26795 !! test
26796 Edited Redirect link should emit a non-piped wikitext link
26797 !! options
26798 parsoid=html2wt
26799 !! html/parsoid
26800 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26801 !! wikitext
26802 #REDIRECT [[Bar]]
26803 !! end
26804
26805 !! test
26806 T75121: Infer extension name from typeOf if data-mw is not present
26807 !! options
26808 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26809 !! html/parsoid
26810 <div typeOf="mw:Extension/foo"></div>
26811 !! wikitext
26812 <foo />
26813 !! end
26814
26815 # Note that the <p> wrapping isn't present in PHP parser output
26816 # The important thing for this test is that P-wrapping doesn't
26817 # interfere with the <nowiki> protection for leading - in <td>
26818 # (which isn't necessary for <th>).
26819 !! test
26820 T88318: p-wrapped dash in table.
26821 !! options
26822 parsoid=html2wt,wt2wt
26823 !! html/parsoid
26824 <table><tbody>
26825 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26826 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26827 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26828 </tbody></table>
26829 !! wikitext
26830 {|
26831 !-
26832 !-
26833 |-
26834 |<nowiki>-</nowiki>
26835 |<nowiki>- </nowiki>
26836 |-
26837 |<small>-</small>
26838 |<br>
26839 -
26840 |<br>
26841 -
26842 |}
26843 !! html/php+tidy
26844 <table>
26845 <tr>
26846 <th>-</th>
26847 <th>-</th>
26848 </tr>
26849 <tr>
26850 <td>-</td>
26851 <td>-</td>
26852 </tr>
26853 <tr>
26854 <td><small>-</small></td>
26855 <td><br />
26856 <p>-</p>
26857 </td>
26858 <td><br />
26859 <p>-</p>
26860 </td>
26861 </tr>
26862 </table>
26863 !! end
26864
26865 !! test
26866 T149209: WTS: Handle newlines in table cells properly
26867 !! options
26868 parsoid=html2wt
26869 !! html/parsoid
26870 <table>
26871 <tbody>
26872 <tr><td>a
26873 b
26874 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26875 <tr><td><p>x</p>
26876 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26877 </tbody></table>
26878 <table>
26879 <tbody>
26880 <tr><th>a
26881 b
26882 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26883 <tr><th><p>x</h>
26884 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26885 </tbody></table>
26886 !! wikitext
26887 {|
26888 |a
26889 b
26890 |c
26891 |-
26892 |x
26893 {{!}}y
26894 |}
26895 {|
26896 !a
26897 b
26898 !c
26899 |-
26900 !x
26901 !y
26902 |}
26903 !! end
26904
26905 !! test
26906 T149209: Selser: Handle newlines in table cells properly
26907 !! options
26908 parsoid={
26909 "modes": ["selser"],
26910 "changes": [
26911 [ "#h1", "html", "a\nb\n" ],
26912 [ "#h2", "html", "a\nb\n" ],
26913 [ "#c1", "html", "a\nb\n" ],
26914 [ "#c2", "html", "<p>a</p>" ],
26915 [ "#c3", "html", "<p>a</p>" ],
26916 [ "#c4", "html", "edit-me<p>a</p>" ]
26917 ]
26918 }
26919 !! wikitext
26920 {|
26921 ! id="h1" |edit-me!!1
26922 |-
26923 ! id="h2" |edit-me||2
26924 |-
26925 | id="c1" |edit-me||3
26926 |-
26927 | id="c2" |edit-me||4
26928 |-
26929 | id="c3" |edit-me||p||q||r
26930 |-
26931 | id="c4" |edit-me||p||q||r
26932 |}
26933 !! wikitext/edited
26934 {|
26935 ! id="h1" |a
26936 b
26937 !1
26938 |-
26939 ! id="h2" |a
26940 b
26941 !2
26942 |-
26943 | id="c1" |a
26944 b
26945 |3
26946 |-
26947 | id="c2" |a
26948 |4
26949 |-
26950 | id="c3" |a
26951 |p||q||r
26952 |-
26953 | id="c4" |edit-me
26954 a
26955 |p||q||r
26956 |}
26957 !! end
26958
26959 !! test
26960 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26961 !! options
26962 parsoid=html2wt
26963 !! html/parsoid
26964 <table id='mwAb'>
26965 <td id='mwAc'>foo</td>
26966 <td id='serialize-this'>bar</td>
26967 </table>
26968 !! wikitext
26969 {|
26970 |foo
26971 | id="serialize-this" |bar
26972 |}
26973 !! end
26974
26975 !! test
26976 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26977 !! options
26978 parsoid=html2wt
26979 !! html/parsoid
26980 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26981 !! wikitext
26982 <div id="hello">ok</div>
26983 !! end
26984
26985 !! test
26986 WTS change modes
26987 !! options
26988 parsoid={
26989 "modes": ["wt2wt"],
26990 "changes": [
26991 [ "#xyz", "before", "<b>before</b> stuff " ],
26992 [ "#xyz", "after", " stuff <i>after</i>" ],
26993 [ "#xyz", "html", "x <b>y</b> z" ]
26994 ]
26995 }
26996 !! wikitext
26997 <span id="xyz">hello</span>
26998 !! wikitext/edited
26999 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27000 !! end
27001
27002 !! test
27003 Never serialize a-tag as html, regardless of what data-parsoid has to say
27004 !! options
27005 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27006 !! html/parsoid
27007 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27008 !! wikitext
27009 [[Foo]]
27010 !! end
27011
27012 ## SSS FIXME: This is broken output nevertheless.
27013 ## What might be a reasonable non-broken output for this?
27014 ## This is an edge case unlikely to be seen in production
27015 ## that I am not wasting more time on this right now.
27016 !! test
27017 Never serialize a-tag as html, no matter what attributes it has
27018 !! options
27019 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27020 !! html/parsoid
27021 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27022 !! wikitext
27023 [http://boo.org http://boohoo.org]
27024 !! end
27025
27026 # Misnested is an indication that selser can reuse the source but these have
27027 # shown to sneak through on occasion. See T101768.
27028 # The original wikitext here is: [http://test.com [[one]] two three]
27029 !! test
27030 Strip span tags added to mark misnested links
27031 !! options
27032 parsoid=html2wt
27033 !! html/parsoid
27034 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com" data-parsoid='{"targetOff":17,"contentOffsets":[17,34]}'></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
27035 !! wikitext
27036 [http://test.com][[one]] two three
27037 !! end
27038
27039 !! test
27040 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27041 !! options
27042 parsoid=html2wt
27043 !! html/parsoid
27044 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
27045 <tbody><tr><td>d
27046 </td></tr>
27047 </tbody></table>
27048 !! wikitext
27049 {{echo|a}}
27050 {|{{echo|c
27051 {{!}}d
27052 }}
27053 |}
27054 !! end
27055
27056 ## This test verifies the presence and computation of this attribute indirectly
27057 ## by making an edit and ensuring that the serialization is correct (which it would be
27058 ## only if firstWikitextNode is properly set).
27059 !! test
27060 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27061 !! options
27062 parsoid= {
27063 "modes": ["wt2wt"],
27064 "changes": [
27065 [ "div#x", "remove" ],
27066 [ "div", "before", "<div>new</div>" ]
27067 ]
27068 }
27069 !! wikitext
27070 <div id="x">foo</div>
27071 {|
27072 {{echo|<div>boo</div>
27073 {{!}}b}}
27074 |c
27075 |}
27076 !! wikitext/edited
27077
27078 <div>new</div>
27079 {|
27080 {{echo|<div>boo</div>
27081 {{!}}b}}
27082 |c
27083 |}
27084 !! end
27085
27086 # --------------------------------------------
27087 # Tests spec'ing wikitext serialization norms |
27088 # --------------------------------------------
27089
27090 !! test
27091 1. Categories should always be serialized on their own line
27092 !! options
27093 parsoid=html2wt
27094 !! html/parsoid
27095 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27096 !! wikitext
27097 foo
27098 [[Category:Foo]]
27099 bar
27100 !! end
27101
27102 !! test
27103 2. Categories that are part of templates should not introduce a line break
27104 !! wikitext
27105 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27106 !! html/parsoid
27107 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
27108 !! end
27109
27110 # Careful while editing these next 2 tests. There are \u200f characters
27111 # before and after the <link> tags in the HTML and following some
27112 # of the categories in wikitext
27113 # Do not remove these characters in edits.
27114 #
27115 # As part of the serialization, these bidi characters will get stripped.
27116 !! test
27117 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27118 !! options
27119 parsoid={
27120 "modes": ["html2wt"],
27121 "scrubWikitext": true
27122 }
27123 !! html/parsoid
27124 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27125 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27126 !! wikitext
27127 [[קטגוריה:טקסים]]
27128 [[קטגוריה: שיטות משפט]]
27129 !! end
27130
27131 !! test
27132 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27133 !! options
27134 parsoid={
27135 "modes": ["html2wt"],
27136 "scrubWikitext": true
27137 }
27138 !! html/parsoid
27139 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27140 !! wikitext
27141 [[קטגוריה:טקסים]]
27142 ‏y
27143 !! end
27144
27145 !! test
27146 Lists: Add space after bullets
27147 !! options
27148 parsoid=html2wt
27149 !! html/parsoid
27150 <ul>
27151 <li>foo</li>
27152 <li> bar</li>
27153 <li><span> baz</span></li>
27154 </ul>
27155 !! wikitext
27156 * foo
27157 * bar
27158 * <span> baz</span>
27159 !! end
27160
27161 !! test
27162 1. Headings: Add space before/after == (T53744)
27163 !! options
27164 parsoid=html2wt
27165 !! html/parsoid
27166 <h2>foo</h2>
27167 <h2> bar</h2>
27168 <h2>baz </h2>
27169 <h2><span> baz</span></h2>
27170 !! wikitext
27171 == foo ==
27172
27173 == bar ==
27174
27175 == baz ==
27176
27177 == <span> baz</span> ==
27178 !! end
27179
27180 !! test
27181 2. Headings: Add space before/after == even after hoisted content
27182 !! options
27183 parsoid={
27184 "modes": ["html2wt"],
27185 "scrubWikitext": true
27186 }
27187 !! html/parsoid
27188 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27189 !! wikitext
27190 [[Category:A2]]
27191
27192 == ok ==
27193 !! end
27194
27195 !! test
27196 1. Headings: suppress newly created empty headings
27197 !! options
27198 parsoid={
27199 "modes": ["html2wt"],
27200 "scrubWikitext": true
27201 }
27202 !! html/parsoid
27203 <h2></h2>
27204 !! wikitext
27205 !! end
27206
27207 !! test
27208 2. Headings: don't suppress empty headings if scrubWikitext is false
27209 !! options
27210 parsoid=html2wt
27211 !! html/parsoid
27212 <h2></h2>
27213 !! wikitext
27214 ==<nowiki/>==
27215 !! end
27216
27217 !! test
27218 3. Headings: suppress empty headings on edits
27219 !! options
27220 parsoid={
27221 "modes": ["selser"],
27222 "scrubWikitext": true,
27223 "changes": [
27224 [ "#x", "remove"]
27225 ]
27226 }
27227 !! wikitext
27228 ==<span id="x">foo</span>==
27229 !! wikitext/edited
27230 !! end
27231
27232 !! test
27233 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27234 !! options
27235 parsoid={
27236 "modes": ["html2wt"],
27237 "scrubWikitext": true
27238 }
27239 !! html/parsoid
27240 <h2>foo<br/>bar</h2>
27241 <h2>foo <span><br/>bar</span> baz</h2>
27242 !! wikitext
27243 == foo bar ==
27244
27245 == foo <span> bar</span> baz ==
27246 !! end
27247
27248 !! test
27249 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27250 !! options
27251 parsoid={
27252 "modes": ["html2wt"],
27253 "scrubWikitext": false
27254 }
27255 !! html/parsoid
27256 <h2>foo<br/>bar</h2>
27257 !! wikitext
27258 == foo<br> bar ==
27259 !! end
27260
27261 !! test
27262 1. WT Quote Tags: suppress newly created empty style tags
27263 !! options
27264 parsoid={
27265 "modes": ["html2wt"],
27266 "scrubWikitext": true
27267 }
27268 !! html/parsoid
27269 <i></i><b></b>
27270 !! wikitext
27271 !! end
27272
27273 !! test
27274 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27275 !! options
27276 parsoid=html2wt
27277 !! html/parsoid
27278 <i></i><b></b>
27279 !! wikitext
27280 ''<nowiki/>'''''<nowiki/>'''
27281 !! end
27282
27283 !! test
27284 3. WT Quote Tags: suppress empty style tags on edits
27285 !! options
27286 parsoid={
27287 "modes": ["selser"],
27288 "scrubWikitext": true,
27289 "changes": [
27290 [ "#x", "remove"]
27291 ]
27292 }
27293 !! wikitext
27294 '''<span id="x">foo</span>'''
27295 !! wikitext/edited
27296 !! end
27297
27298 !! test
27299 1. Anchors: suppress newly created empty anchors
27300 !! options
27301 parsoid={
27302 "modes": ["html2wt"],
27303 "scrubWikitext": true
27304 }
27305 !! html/parsoid
27306 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27307 !! wikitext
27308 !! end
27309
27310 !! test
27311 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27312 !! options
27313 parsoid={
27314 "modes": ["html2wt"],
27315 "scrubWikitext": false
27316 }
27317 !! html/parsoid
27318 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27319 !! wikitext
27320 [[Test|<nowiki/>]]
27321 !! end
27322
27323 !! test
27324 3. Anchors: suppress empty anchors on edits
27325 !! options
27326 parsoid={
27327 "modes": ["selser"],
27328 "scrubWikitext": true,
27329 "changes": [
27330 [ "#x", "remove"]
27331 ]
27332 }
27333 !! wikitext
27334 [[Test|<span id="x">foo</span>]]
27335 !! wikitext/edited
27336 !! end
27337
27338 !! test
27339 3a. Anchors: do not suppress numbered extlinks
27340 !! options
27341 parsoid={
27342 "modes": ["wt2wt"],
27343 "scrubWikitext": true
27344 }
27345 !! wikitext
27346 [http://foo.com]
27347 !! html/parsoid
27348 <a rel="mw:ExtLink" href="http://foo.com"></a>
27349 !! end
27350
27351 !! test
27352 3b. Anchors: do not suppress numbered extlinks
27353 !! options
27354 parsoid={
27355 "modes": ["wt2wt"],
27356 "scrubWikitext": true,
27357 "changes": [
27358 [ "#x", "remove"]
27359 ]
27360 }
27361 !! wikitext
27362 [http://foo.com <span id="x">foo</span>]
27363 !! wikitext/edited
27364 [http://foo.com]
27365 !! end
27366
27367 !!test
27368 Normalizations should be restricted to edited content
27369 !!options
27370 parsoid={
27371 "modes": ["selser"],
27372 "scrubWikitext": true,
27373 "changes": [
27374 [ "h1", "before", "<i></i>"]
27375 ]
27376 }
27377 !!wikitext
27378 a
27379 = =
27380 b
27381 !!wikitext/edited
27382 a
27383 = =
27384 b
27385 !!end
27386
27387 !! test
27388 1. Multiple normalizations (html2wt)
27389 !! options
27390 parsoid={
27391 "modes": ["html2wt"],
27392 "scrubWikitext": true
27393 }
27394 !! html
27395 <h2><i></i></h2>
27396 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27397 </a><b><i></i></b>x</p>
27398 !! wikitext
27399
27400 [[foo]]
27401 x
27402
27403 !! end
27404
27405 !! test
27406 2. Multiple normalizations (selser)
27407 !! options
27408 parsoid={
27409 "modes": ["selser"],
27410 "scrubWikitext": true,
27411 "changes": [
27412 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27413 ]
27414 }
27415 !! wikitext
27416 <span id="x">foo</span>
27417 !! wikitext/edited
27418 <span id="x">foo</span>
27419
27420 x
27421 !! end
27422
27423 !! test
27424 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27425 !! options
27426 parsoid={
27427 "modes": ["html2wt"],
27428 "scrubWikitext": true
27429 }
27430 !! html/parsoid
27431 <p> hi</p>
27432 <p> hello</p>
27433 !! wikitext
27434 hi
27435
27436 hello
27437 !! end
27438
27439 !! test
27440 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27441 !! options
27442 parsoid=html2wt
27443 !! html/parsoid
27444 <p> hi</p>
27445 <p> hello</p>
27446 !! wikitext
27447 <nowiki> </nowiki>hi
27448
27449 <nowiki> </nowiki> hello
27450 !! end
27451
27452 !! test
27453 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27454 !! options
27455 parsoid={
27456 "modes": ["html2wt"],
27457 "scrubWikitext": true
27458 }
27459 !! html/parsoid
27460 <p>Foo
27461 bar
27462 baz</p>
27463
27464 <table><tr><td>Foo
27465 bar
27466 baz bang</td></tr></table>
27467
27468 <p><!--boo--> foo
27469 bar</p>
27470
27471 <p> foo
27472 bar<span>boo</span></p>
27473 !! wikitext
27474 Foo
27475 bar
27476 baz
27477
27478 {|
27479 |Foo
27480 bar
27481 baz bang
27482 |}
27483
27484 <!--boo-->foo
27485 bar
27486
27487 foo
27488 bar<span>boo</span>
27489 !! end
27490
27491 !! test
27492 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27493 !! options
27494 parsoid={
27495 "modes": ["selser"],
27496 "scrubWikitext": true,
27497 "changes": [
27498 [ "p", "html", " a\n b" ]
27499 ]
27500 }
27501 !! wikitext
27502 xyz
27503 !! wikitext/edited
27504 a
27505 b
27506 !! end
27507
27508 !! test
27509 1. New links that end in spaces
27510 !! options
27511 parsoid={
27512 "modes": ["html2wt"],
27513 "scrubWikitext": false
27514 }
27515 !! html/parsoid
27516 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27517 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27518 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27519 !! wikitext
27520 [[Berlin ]]<nowiki/>is the capital of Germany.
27521
27522 [[Foo ]]'''bar'''
27523
27524 [[Boston ]] is a city.
27525 !! end
27526
27527 !! test
27528 2. New links that end in spaces
27529 !! options
27530 parsoid={
27531 "modes": ["html2wt"],
27532 "scrubWikitext": true
27533 }
27534 !! html/parsoid
27535 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27536 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27537 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27538 !! wikitext
27539 [[Berlin]] is the capital of Germany.
27540
27541 [[Foo]] '''bar'''
27542
27543 [[Boston]] is a city.
27544 !! end
27545
27546 !! test
27547 1. Table cells with escapable prefixes
27548 !! options
27549 parsoid={
27550 "modes": ["html2wt"],
27551 "scrubWikitext": false
27552 }
27553 !! html
27554 <table>
27555 <tr><td>a</td></tr>
27556 <tr><td>-</td></tr>
27557 <tr><td>+</td></tr>
27558 </table>
27559 !! wikitext
27560 {|
27561 |a
27562 |-
27563 |<nowiki>-</nowiki>
27564 |-
27565 |<nowiki>+</nowiki>
27566 |}
27567 !! end
27568
27569 !! test
27570 2. Table cells with escapable prefixes
27571 !! options
27572 parsoid={
27573 "modes": ["html2wt"],
27574 "scrubWikitext": true
27575 }
27576 !! html
27577 <table>
27578 <tr><td>a</td></tr>
27579 <tr><td>-</td></tr>
27580 <tr><td>+</td></tr>
27581 </table>
27582 !! wikitext
27583 {|
27584 |a
27585 |-
27586 | -
27587 |-
27588 | +
27589 |}
27590 !! end
27591
27592 !! test
27593 3a. Table cells with escapable prefixes after edits
27594 !! options
27595 parsoid={
27596 "modes": ["selser"],
27597 "scrubWikitext": true,
27598 "changes": [
27599 [ "table tbody tr:first-child td:first-child", "remove"]
27600 ]
27601 }
27602 !! wikitext
27603 {|
27604 |a||-
27605 |}
27606 !! wikitext/edited
27607 {|
27608 | -
27609 |}
27610 !! end
27611
27612 !! test
27613 3b. Table cells with escapable prefixes after edits
27614 !! options
27615 parsoid={
27616 "modes": ["selser"],
27617 "scrubWikitext": true,
27618 "changes": [
27619 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27620 [ "#x", "remove" ]
27621 ]
27622 }
27623 !! wikitext
27624 {|
27625 |pqr
27626 |<span id="x">foo</span>+
27627 |}
27628 !! wikitext/edited
27629 {|
27630 | -
27631 | +
27632 |}
27633 !! end
27634
27635 # FIXME: This test will fail because
27636 # normalization doesn't realize that the id attribute
27637 # will eliminate the escapable scenario
27638 !! test
27639 4a. Table cells without escapable prefixes after edits
27640 !! options
27641 parsoid={
27642 "modes": ["selser"],
27643 "scrubWikitext": true,
27644 "changes": [
27645 [ "#x", "html", "-" ]
27646 ]
27647 }
27648 !! wikitext
27649 {|
27650 | id="x" |abcd
27651 |}
27652 !! wikitext/edited
27653 {|
27654 | id="x" |-
27655 |}
27656 !! end
27657
27658 ## This tests normalizer's ability to discriminate between
27659 ## cells having identical content.
27660 !! test
27661 4b. Table cells without escapable prefixes after edits
27662 !! options
27663 parsoid={
27664 "modes": ["selser"],
27665 "scrubWikitext": true,
27666 "changes": [
27667 [ "td", "html", "-" ]
27668 ]
27669 }
27670 !! wikitext
27671 {|
27672 |a||b
27673 |}
27674 !! wikitext/edited
27675 {|
27676 | -||-
27677 |}
27678 !! end
27679
27680 ## This tests normalizer's ability to not be tripped by
27681 ## comments (and whitespace)
27682 !! test
27683 4c. Table cells without escapable prefixes after edits
27684 !! options
27685 parsoid={
27686 "modes": ["selser"],
27687 "scrubWikitext": true,
27688 "changes": [
27689 [ "table tbody tr td:first-child", "remove" ]
27690 ]
27691 }
27692 !! wikitext
27693 {|
27694 |-
27695 <!--foo--> |a||-
27696 |}
27697 !! wikitext/edited
27698 {|
27699 |-
27700 <!--foo--> | -
27701 |}
27702 !! end
27703
27704 ## This tests normalizer's ability to handle HTML cells
27705 !! test
27706 4d. Table cells without escapable prefixes after edits
27707 !! options
27708 parsoid={
27709 "modes": ["selser"],
27710 "scrubWikitext": true,
27711 "changes": [
27712 [ "td", "html", "-" ]
27713 ]
27714 }
27715 !! wikitext
27716 <table>
27717 <tr><td>a</td></tr>
27718 </table>
27719 !! wikitext/edited
27720 <table>
27721 <tr><td>-</td></tr>
27722 </table>
27723 !! end
27724
27725 ## T111151 Remove font elements without attributes
27726 !! test
27727 5a. font tags without attributes should be dropped in scrubWikitext mode
27728 !! options
27729 parsoid={
27730 "modes": ["html2wt"],
27731 "scrubWikitext": true
27732 }
27733 !! html
27734 <font>foo</font>
27735 <font><font>bar</font></font>
27736 <font class="x">boo</font>
27737 !! wikitext
27738 foo
27739 bar
27740 <font class="x">boo</font>
27741 !! end
27742
27743 !! test
27744 5b. font tags should not be dropped without scrubWikitext being enabled
27745 !! options
27746 parsoid={
27747 "modes": ["html2wt"],
27748 "scrubWikitext": false
27749 }
27750 !! html
27751 <font>foo</font>
27752 !! wikitext
27753 <font>foo</font>
27754 !! end
27755
27756 !! test
27757 Escape nowiki DOM elements
27758 !! options
27759 parsoid=html2wt
27760 !! html/parsoid
27761 <nowiki><i>foo</i></nowiki>
27762 !! wikitext
27763 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27764 !! end
27765
27766 # This is meant to be an interim fix while we go about figuring out
27767 # how to not introduce these trailing <nowiki/>s in the first place.
27768 !! test
27769 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27770 !! options
27771 parsoid=html2wt
27772 !! html/parsoid
27773 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27774 y</p>
27775 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
27776 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
27777 !! wikitext
27778 x
27779 y
27780
27781 {{echo|
27782 1 = <nowiki/>}}
27783
27784 {{echo|
27785 1 = <nowiki/>
27786 }}
27787 !! end
27788
27789 # ---------------------------------------------------
27790 # End of tests spec'ing wikitext serialization norms |
27791 # ---------------------------------------------------
27792
27793 # T104032
27794 !! test
27795 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27796 !! options
27797 parsoid=html2wt
27798 !! html/parsoid
27799 a<p>b</p>
27800 <b>c</b><p>d</p>
27801 <table><tr>
27802 <td>a<p>b</p></td>
27803 <td><b>c</b><p>d</p></td>
27804 </tr></table>
27805 !! wikitext
27806 a
27807
27808 b
27809
27810 '''c'''
27811
27812 d
27813 {|
27814 |a
27815 b
27816 |'''c'''
27817 d
27818 |}
27819 !! end
27820
27821 # -----------------------------------------------------------------
27822 # End of section for Parsoid-only html2wt tests for serialization
27823 # of new content
27824 # -----------------------------------------------------------------
27825
27826 # -----------------------------------------------------------------
27827 # The following section of tests are primarily to spec behavior of
27828 # the selective serializer. All these tests have manual selser
27829 # changes. The automated selser changes for all tests handle the
27830 # wide variation of changes, but these tests here capture specs
27831 # deterministically.
27832 # ----------------------------------------------------------------
27833
27834 ## T90517
27835 !! test
27836 Selser: New comments should not be lost
27837 !! options
27838 parsoid={
27839 "modes": ["selser"],
27840 "changes": [
27841 [ "#a", "after", "<!--c1-->" ],
27842 [ "#b", "before", "<!--c2-->" ]
27843 ]
27844 }
27845 !! wikitext
27846 <span id="a">a</span>
27847
27848 <span id="b">b</span>
27849 !! wikitext/edited
27850 <span id="a">a</span><!--c1-->
27851
27852 <!--c2--><span id="b">b</span>
27853 !! end
27854
27855 ## T89383
27856 !! test
27857 Selser: Check for validity of DSR before using it
27858 !! options
27859 parsoid={
27860 "modes": ["selser"],
27861 "changes": [
27862 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27863 ]
27864 }
27865 !! wikitext
27866 <span id="a">a</span>
27867 !! wikitext/edited
27868 {{DISPLAYTITLE:foo}}
27869 <span id="a">a</span>
27870 !! end
27871
27872 !! test
27873 1. DOMDiff: Changes to <ref> content should be looked up using id
27874 !! options
27875 parsoid={
27876 "modes": ["selser"],
27877 "changes": [
27878 ["#X", "after", "bar"],
27879 ["#Y", "after", "baz"]
27880 ]
27881 }
27882 !! wikitext
27883 X <ref><span id="X">foo</span></ref>
27884 Y <ref name="a" />
27885 <references>
27886 <ref name="a"><span id="Y">foo</span></ref>
27887 </references>
27888 !! wikitext/edited
27889 X <ref><span id="X">foo</span>bar</ref>
27890 Y <ref name="a" />
27891 <references>
27892 <ref name="a"><span id="Y">foo</span>baz</ref>
27893 </references>
27894 !! end
27895
27896 !! test
27897 2. DOMDiff: Changes to <ref> content should be looked up using id
27898 !! options
27899 parsoid={
27900 "modes": ["selser"],
27901 "changes": [
27902 ["#Z", "after", "bar"]
27903 ]
27904 }
27905 !! wikitext
27906 A <ref>foo bar for a</ref>
27907 B <ref group="X" name="b" />
27908
27909 <references />
27910
27911 <references group="X">
27912 <ref name="b"><span id="Z">foo</span></ref>
27913 </references>
27914 !! wikitext/edited
27915 A <ref>foo bar for a</ref>
27916 B <ref group="X" name="b" />
27917
27918 <references />
27919
27920 <references group="X">
27921 <ref name="b"><span id="Z">foo</span>bar</ref>
27922 </references>
27923 !! end
27924
27925 !! test
27926 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27927 !! options
27928 parsoid={
27929 "modes": ["selser"],
27930 "changes": [
27931 [ "div:first-child", "text", "bar" ]
27932 ]
27933 }
27934 !! wikitext
27935 <div style="{{1x|color:red;}}%">foo</div>
27936 !! wikitext/edited
27937 <div style="{{1x|color:red;}}%">bar</div>
27938 !! end
27939
27940 !! test
27941 Empty LI (T49673)
27942 !! wikitext
27943 * a
27944 *
27945 *
27946 * b
27947 !! html/php+tidy
27948 <ul>
27949 <li>a</li>
27950 <li class="mw-empty-elt"></li>
27951 <li class="mw-empty-elt"></li>
27952 <li>b</li>
27953 </ul>
27954 !! end
27955
27956 !! test
27957 Thumbnail output
27958 !! wikitext
27959 [[File:Thumb.png|thumb]]
27960 !! html/php+tidy
27961 <div class="thumb tright">
27962 <div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>
27963 <div class="thumbcaption">
27964 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27965 </div>
27966 </div>
27967 </div>
27968 !! end
27969
27970 !! test
27971 unclosed internal link XSS (T137264)
27972 !! wikitext
27973 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27974 !! html/php
27975 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27976 </p>
27977 !! html/parsoid
27978 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27979 !! end