b891676159975f4462db652bf7fccfc0dfb3ae20
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://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 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
77
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
83
84 !! article
85 Template:tbl-start
86 !! text
87 {|
88 !! endarticle
89
90 !! article
91 Template:tbl-end
92 !! text
93 |}
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:table_attribs
116 !! text
117 <noinclude>
118 |</noinclude>style="color:red;"|Foo
119 !! endarticle
120
121 !! article
122 Template:table_attribs_2
123 !! text
124 <noinclude>
125 |</noinclude>style="color:red;"|Foo
126 |Bar||Baz
127 !! endarticle
128
129 !! article
130 Template:table_header_cells
131 !! text
132 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
133 !! endarticle
134
135 !! article
136 Template:table_cells
137 !! text
138 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
139 !! endarticle
140
141 !! article
142 Template:image_attribs
143 !! text
144 <noinclude>
145 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
146 !! endarticle
147
148 ## See T48811 for details
149 !! article
150 Template:mixed_attr_content_template
151 !! text
152 style="color:red;" title="T48811"
153 |-
154 |foo
155 !! endarticle
156
157 !! article
158 A?b
159 !! text
160 Weirdo titles!
161 !! endarticle
162
163 !!article
164 Template:Bullet
165 !!text
166 * Bar
167 !!endarticle
168
169 !!article
170 Template:OpenTable
171 !!text
172 {|
173 !!endarticle
174
175 !!article
176 Template:EmptyLITest
177 !!text
178 *a
179 *
180 *
181 *b
182 !!endarticle
183
184 !!article
185 Template:EmptyTRTest
186 !!text
187 {|
188 |-
189 |-
190 |foo
191 |-
192 |-
193 |bar
194 |}
195 !!endarticle
196
197 !!article
198 Template:EmptyTRWithHTMLAttrTest
199 !!text
200 <table>
201 <tr align="center"></tr>
202 <tr><td>foo</td></tr>
203 <tr align="center"></tr>
204 <tr><td>bar</td></tr>
205 </table>
206 !!endarticle
207
208 ###
209 ### Basic tests
210 ###
211 !! test
212 Blank input
213 !! wikitext
214 !! html
215 !! end
216
217
218 !! test
219 Simple paragraph
220 !! wikitext
221 This is a simple paragraph.
222 !! html
223 <p>This is a simple paragraph.
224 </p>
225 !! end
226
227 !! test
228 Paragraphs with extra newline spacing
229 !! wikitext
230 foo
231
232 bar
233
234
235 baz
236
237
238
239 booz
240 !! html
241 <p>foo
242 </p><p>bar
243 </p><p><br />
244 baz
245 </p><p><br />
246 </p><p>booz
247 </p>
248 !! end
249
250 !! test
251 Paragraphs with newline spacing with comment lines in between
252 !! wikitext
253 ----
254 a
255 <!--foo-->
256 b
257 ----
258 a
259 <!--foo--><!--More than 1 comment, still stripped-->
260 b
261 ----
262 a
263 <!--foo--> <!----> <!-- bar -->
264 b
265 ----
266 a
267 <!--foo-->
268
269 b
270 ----
271 a
272
273 <!--foo-->
274 b
275 ----
276 a
277 <!--foo-->
278
279
280 b
281 ----
282 a
283
284
285 <!--foo-->
286 b
287 ----
288 !! html
289 <hr />
290 <p>a
291 b
292 </p>
293 <hr />
294 <p>a
295 b
296 </p>
297 <hr />
298 <p>a
299 b
300 </p>
301 <hr />
302 <p>a
303 </p><p>b
304 </p>
305 <hr />
306 <p>a
307 </p><p>b
308 </p>
309 <hr />
310 <p>a
311 </p><p><br />
312 b
313 </p>
314 <hr />
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 <hr />
320
321 !! end
322
323 !! test
324 Paragraphs with newline spacing with non-empty white-space lines in between
325 !! wikitext
326 ----
327 a
328
329 b
330 ----
331 a
332
333
334 b
335 ----
336 !! html
337 <hr />
338 <p>a
339 </p><p>b
340 </p>
341 <hr />
342 <p>a
343 </p><p><br />
344 b
345 </p>
346 <hr />
347
348 !! end
349
350 !! test
351 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
352 !! wikitext
353 ----
354 a
355 <!--foo-->
356 b
357 ----
358 a
359 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
360 b
361 ----
362 a
363
364 <!--foo-->
365 <!--bar-->
366 b
367 ----
368 a
369
370 <!--foo-->
371 <!--bar-->
372
373 b
374 ----
375 !! html
376 <hr />
377 <p>a
378 b
379 </p>
380 <hr />
381 <p>a
382 b
383 </p>
384 <hr />
385 <p>a
386 </p><p>b
387 </p>
388 <hr />
389 <p>a
390 </p><p><br />
391 b
392 </p>
393 <hr />
394
395 !! end
396
397 !! test
398 Extra newlines: More paragraphs with indented comment
399 !! wikitext
400 a
401
402 <!--boo-->
403
404 b
405 !! html
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 !!end
411
412 !! test
413 Extra newlines followed by heading
414 !! wikitext
415 a
416
417
418
419 =b=
420 [[a]]
421
422
423 =b=
424 !! html
425 <p>a
426 </p><p><br />
427 </p>
428 <h1><a href="#b" class="mw-headline-anchor" title="Link to this section">§</a><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>
429 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
430 </p><p><br />
431 </p>
432 <h1><a href="#b_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
433
434 !! end
435
436 !! test
437 Extra newlines between heading and content are swallowed
438 !! wikitext
439 =b=
440
441
442
443 [[a]]
444 !! html
445 <h1><a href="#b" class="mw-headline-anchor" title="Link to this section">§</a><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>
446 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
447 </p>
448 !! end
449
450 !! test
451 Parsing an URL
452 !! wikitext
453 http://fr.wikipedia.org/wiki/🍺
454 <!-- EasterEgg we love beer, better be able be able to link to it -->
455 !! html
456 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
457 </p>
458 !! end
459
460 # Note that the html+tidy output removes the spaces after the <li>,
461 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
462 # This is an issue for all tests with lists. We intentionally do
463 # *not* add html+tidy clauses for these, as we don't want to
464 # document/test the broken behavior. (Parsoid matches the non-tidy
465 # output in these cases.)
466
467 !! test
468 Simple list
469 !! wikitext
470 * Item 1
471 * Item 2
472 !! html
473 <ul><li> Item 1</li>
474 <li> Item 2</li></ul>
475
476 !! end
477
478 !! test
479 Italics and bold
480 !! wikitext
481 * plain
482 * plain''italic''plain
483 * plain''italic''plain''italic''plain
484 * plain'''bold'''plain
485 * plain'''bold'''plain'''bold'''plain
486 * plain''italic''plain'''bold'''plain
487 * plain'''bold'''plain''italic''plain
488 * plain''italic'''bold-italic'''italic''plain
489 * plain'''bold''bold-italic''bold'''plain
490 * plain'''''bold-italic'''italic''plain
491 * plain'''''bold-italic''bold'''plain
492 * plain''italic'''bold-italic'''''plain
493 * plain'''bold''bold-italic'''''plain
494 * plain l'''italic''plain
495 * plain l''''bold''' plain
496 !! html
497 <ul><li> plain</li>
498 <li> plain<i>italic</i>plain</li>
499 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
500 <li> plain<b>bold</b>plain</li>
501 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
502 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
503 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
504 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
505 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
506 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
507 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
508 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
509 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
510 <li> plain l'<i>italic</i>plain</li>
511 <li> plain l'<b>bold</b> plain</li></ul>
512
513 !! end
514
515 # this example taken from the [[simple:Moon]] article (bug 47326)
516 !! test
517 Italics and possessives (1)
518 !! wikitext
519 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
520 !! html
521 <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
522 </p>
523 !! end
524
525 # this example taken from [[en:Flaming Pie]] (bug 49926)
526 !! test
527 Italics and possessives (2)
528 !! wikitext
529 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
530 !! html
531 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
532 </p>
533 !! end
534
535 # this example taken from [[en:Dictionary]] (bug 49926)
536 !! test
537 Italics and possessives (3)
538 !! wikitext
539 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''.
540 !! html
541 <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>.
542 </p>
543 !! end
544
545
546 ###
547 ### 2-quote opening sequence tests
548 ###
549 !! test
550 Italics and bold: 2-quote opening sequence: (2,2)
551 !! wikitext
552 ''foo''
553 !! html
554 <p><i>foo</i>
555 </p>
556 !!end
557
558 !! test
559 Italics and bold: 2-quote opening sequence: (2,3)
560 !! wikitext
561 ''foo'''
562 !! html/*
563 <p><i>foo'</i>
564 </p>
565 !!end
566
567 !! test
568 Italics and bold: 2-quote opening sequence: (2,4)
569 !! options
570 parsoid=wt2html
571 !! wikitext
572 ''foo''''
573 !! html/*
574 <p><i>foo''</i>
575 </p>
576 !!end
577
578 # same html as previous, but wikitext adjusted to match parsoid html2wt
579 !! test
580 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
581 !! wikitext
582 ''foo<nowiki>''</nowiki>''
583 !! html
584 <p><i>foo''</i>
585 </p>
586 !! end
587
588 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
589 !! test
590 Italics and bold: 2-quote opening sequence: (2,5)
591 !! options
592 parsoid=wt2html
593 !! wikitext
594 ''foo'''''
595 !! html/php
596 <p><i>foo</i>
597 </p>
598 !! html/parsoid
599 <p><i>foo</i><b></b>
600 </p>
601 !!end
602
603 # same html as previous, but wikitext adjusted to match parsoid html2wt
604 !! test
605 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
606 !! wikitext
607 ''foo'''''<nowiki/>'''
608 !! html/php
609 <p><i>foo</i>
610 </p>
611 !! html/parsoid
612 <p><i>foo</i><b></b>
613 </p>
614 !! end
615
616
617 ###
618 ### 3-quote opening sequence tests
619 ###
620
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,2)
623 !! wikitext
624 '''foo''
625 !! html/*
626 <p>'<i>foo</i>
627 </p>
628 !!end
629
630 !! test
631 Italics and bold: 3-quote opening sequence: (3,3)
632 !! wikitext
633 '''foo'''
634 !! html
635 <p><b>foo</b>
636 </p>
637 !!end
638
639 !! test
640 Italics and bold: 3-quote opening sequence: (3,4)
641 !! wikitext
642 '''foo''''
643 !! html/*
644 <p><b>foo'</b>
645 </p>
646 !!end
647
648 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
649 !! test
650 Italics and bold: 3-quote opening sequence: (3,5)
651 !! options
652 parsoid=wt2html
653 !! wikitext
654 '''foo'''''
655 !! html/php
656 <p><b>foo</b>
657 </p>
658 !! html/parsoid
659 <p><b>foo</b><i></i>
660 </p>
661 !!end
662
663 # same html as previous, but wikitext adjusted to match parsoid html2wt
664 !! test
665 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
666 !! wikitext
667 '''foo'''''<nowiki/>''
668 !! html/php
669 <p><b>foo</b>
670 </p>
671 !! html/parsoid
672 <p><b>foo</b><i></i>
673 </p>
674 !! end
675
676
677 ###
678 ### 4-quote opening sequence tests
679 ###
680
681 !! test
682 Italics and bold: 4-quote opening sequence: (4,2)
683 !! options
684 parsoid=wt2html
685 !! wikitext
686 ''''foo''
687 !! html/*
688 <p>''<i>foo</i>
689 </p>
690 !!end
691
692 # same html as previous, but wikitext adjusted to match parsoid html2wt
693 !! test
694 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
695 !! wikitext
696 <nowiki>''</nowiki>''foo''
697 !! html
698 <p>''<i>foo</i>
699 </p>
700 !! end
701
702 !! test
703 Italics and bold: 4-quote opening sequence: (4,3)
704 !! wikitext
705 ''''foo'''
706 !! html/*
707 <p>'<b>foo</b>
708 </p>
709 !!end
710
711 !! test
712 Italics and bold: 4-quote opening sequence: (4,4)
713 !! options
714 parsoid=wt2html
715 !! wikitext
716 ''''foo''''
717 !! html/*
718 <p>'<b>foo'</b>
719 </p>
720 !!end
721
722 # same html as previous, but wikitext adjusted to match parsoid html2wt
723 !! test
724 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
725 !! wikitext
726 '<nowiki/>'''foo''''
727 !! html
728 <p>'<b>foo'</b>
729 </p>
730 !! end
731
732 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
733 !! test
734 Italics and bold: 4-quote opening sequence: (4,5)
735 !! options
736 parsoid=wt2html
737 !! wikitext
738 ''''foo'''''
739 !! html/php
740 <p>'<b>foo</b>
741 </p>
742 !! html/parsoid
743 <p>'<b>foo</b><i></i>
744 </p>
745 !!end
746
747 # same html as previous, but wikitext adjusted to match parsoid html2wt
748 !! test
749 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
750 !! wikitext
751 '<nowiki/>'''foo'''''<nowiki/>''
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
761 ###
762 ### 5-quote opening sequence tests
763 ###
764
765 !! test
766 Italics and bold: 5-quote opening sequence: (5,2)
767 !! options
768 parsoid=wt2html
769 !! wikitext
770 '''''foo''
771 !! html/*
772 <p><b><i>foo</i></b>
773 </p>
774 !!end
775
776 # same html as previous, but wikitext adjusted to match parsoid html2wt
777 # skipping wt2html and html2html because it wants to put <i> before <b>
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,2+3)
780 !! options
781 parsoid=wt2wt,html2wt
782 !! wikitext
783 '''''foo'''''
784 !! html
785 <p><b><i>foo</i></b>
786 </p>
787 !! end
788
789 !! test
790 Italics and bold: 5-quote opening sequence: (5,3)
791 !! options
792 parsoid=wt2html
793 !! wikitext
794 '''''foo'''
795 !! html/*
796 <p><i><b>foo</b></i>
797 </p>
798 !!end
799
800 # same html as previous, but wikitext adjusted to match parsoid html2wt
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,3+2)
803 !! wikitext
804 '''''foo'''''
805 !! html
806 <p><i><b>foo</b></i>
807 </p>
808 !! end
809
810 !! test
811 Italics and bold: 5-quote opening sequence: (5,4)
812 !! options
813 parsoid=wt2html
814 !! wikitext
815 '''''foo''''
816 !! html/*
817 <p><i><b>foo'</b></i>
818 </p>
819 !!end
820
821 !! test
822 Italics and bold: 5-quote opening sequence: (5,5)
823 !! wikitext
824 '''''foo'''''
825 !! html
826 <p><i><b>foo</b></i>
827 </p>
828 !!end
829
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,6)
832 !! wikitext
833 '''''foo''''''
834 !! html/*
835 <p><i><b>foo'</b></i>
836 </p>
837 !! end
838
839 ###
840 ### multiple quote sequences in a line
841 ###
842 !! test
843 Italics and bold: multiple quote sequences: (2,4,2)
844 !! options
845 parsoid=wt2html
846 !! wikitext
847 ''foo''''bar''
848 !! html/*
849 <p><i>foo'<b>bar</b></i>
850 </p>
851 !!end
852
853
854 # same html as previous, but wikitext adjusted to match parsoid html2wt
855 !! test
856 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
857 !! wikitext
858 ''foo'<nowiki/>'''bar'''''
859 !! html
860 <p><i>foo'<b>bar</b></i>
861 </p>
862 !! end
863
864
865 !! test
866 Italics and bold: multiple quote sequences: (2,4,3)
867 !! options
868 parsoid=wt2html
869 !! wikitext
870 ''foo''''bar'''
871 !! html/*
872 <p><i>foo'<b>bar</b></i>
873 </p>
874 !!end
875
876
877 # same html as previous, but wikitext adjusted to match parsoid html2wt
878 !! test
879 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
880 !! wikitext
881 ''foo'<nowiki/>'''bar'''''
882 !! html
883 <p><i>foo'<b>bar</b></i>
884 </p>
885 !! end
886
887
888 !! test
889 Italics and bold: multiple quote sequences: (2,4,4)
890 !! options
891 parsoid=wt2html
892 !! wikitext
893 ''foo''''bar''''
894 !! html/*
895 <p><i>foo'<b>bar'</b></i>
896 </p>
897 !!end
898
899
900 # same html as previous, but wikitext adjusted to match parsoid html2wt
901 !! test
902 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
903 !! wikitext
904 ''foo'<nowiki/>'''bar'<nowiki/>'''''
905 !! html
906 <p><i>foo'<b>bar'</b></i>
907 </p>
908 !! end
909
910
911 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
912 !! test
913 Italics and bold: multiple quote sequences: (3,4,2)
914 !! options
915 parsoid=wt2html
916 !! wikitext
917 '''foo''''bar''
918 !! html/php
919 <p><b>foo'</b>bar
920 </p>
921 !! html/parsoid
922 <p><b>foo'</b>bar<i></i>
923 </p>
924 !!end
925
926 # same html as previous, but wikitext adjusted to match parsoid html2wt
927 !! test
928 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
929 !! options
930 parsoid
931 !! wikitext
932 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
933 !! html/php
934 <p><b>foo'</b>bar
935 </p>
936 !! html/parsoid
937 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
938 </p>
939 !! end
940
941
942 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
943 !! test
944 Italics and bold: multiple quote sequences: (3,4,3)
945 !! options
946 parsoid=wt2html
947 !! wikitext
948 '''foo''''bar'''
949 !! html/php
950 <p><b>foo'</b>bar
951 </p>
952 !! html/parsoid
953 <p><b>foo'</b>bar<b></b>
954 </p>
955 !!end
956
957 # same html as previous, but wikitext adjusted to match parsoid html2wt
958 !! test
959 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
960 !! wikitext
961 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
962 !! html/php
963 <p><b>foo'</b>bar
964 </p>
965 !! html/parsoid
966 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
967 </p>
968 !! end
969
970 ###
971 ### other quote tests
972 ###
973 !! test
974 Italics and bold: other quote tests: (2,3,5)
975 !! wikitext
976 ''this is about '''foo's family'''''
977 !! html
978 <p><i>this is about <b>foo's family</b></i>
979 </p>
980 !!end
981
982
983 !! test
984 Italics and bold: other quote tests: (2,(3,3),2)
985 !! wikitext
986 ''this is about '''foo's''' family''
987 !! html
988 <p><i>this is about <b>foo's</b> family</i>
989 </p>
990 !!end
991
992
993 !! test
994 Italics and bold: other quote tests: (3,2,3,2)
995 !! options
996 parsoid=wt2html
997 !! wikitext
998 '''this is about ''foo'''s family''
999 !! html/*
1000 <p><b>this is about <i>foo</i></b><i>s family</i>
1001 </p>
1002 !!end
1003
1004
1005 # same html as previous, but wikitext adjusted to match parsoid html2wt
1006 !! test
1007 Italics and bold: other quote tests: (3,2,3+2+2,2)
1008 !! wikitext
1009 '''this is about ''foo'''''<nowiki/>''s family''
1010 !! html
1011 <p><b>this is about <i>foo</i></b><i>s family</i>
1012 </p>
1013 !! end
1014
1015
1016 !! test
1017 Italics and bold: other quote tests: (3,2,3,3)
1018 !! wikitext
1019 '''this is about ''foo'''s family'''
1020 !! html/*
1021 <p>'<i>this is about </i>foo<b>s family</b>
1022 </p>
1023 !!end
1024
1025
1026 !! test
1027 Italics and bold: other quote tests: (3,(2,2),3)
1028 !! wikitext
1029 '''this is about ''foo's'' family'''
1030 !! html
1031 <p><b>this is about <i>foo's</i> family</b>
1032 </p>
1033 !!end
1034
1035
1036 !! test
1037 Italicized possessive
1038 !! wikitext
1039 The ''[[Main Page]]'''s talk page.
1040 !! html/php
1041 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1042 </p>
1043 !! html/parsoid
1044 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1045 !! end
1046
1047 !! test
1048 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1049 (Requires tidy for PHP parser output to be fixed up)
1050 !! options
1051 parsoid=wt2html,wt2wt
1052 !! wikitext
1053 {|
1054 !''a!!''b
1055 |''a||''b
1056 |}
1057 !! html/php+tidy
1058 <table>
1059 <tr>
1060 <th><i>a</i></th>
1061 <th><i>b</i></th>
1062 <td><i>a</i></td>
1063 <td><i>b</i></td>
1064 </tr>
1065 </table>
1066 !! html/parsoid
1067 <table>
1068 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1069 <td><i>a</i></td><td><i>b</i></td></tr>
1070 </tbody></table>
1071 !! end
1072
1073 ###
1074 ### Non-html5 tags
1075 ###
1076
1077 !! test
1078 Non-html5 tags should be accepted
1079 !! wikitext
1080 <center>''foo''</center>
1081 <big>''foo''</big>
1082 <font>''foo''</font>
1083 <strike>''foo''</strike>
1084 <tt>''foo''</tt>
1085 !! html
1086 <center><i>foo</i></center>
1087 <p><big><i>foo</i></big>
1088 <font><i>foo</i></font>
1089 <strike><i>foo</i></strike>
1090 <tt><i>foo</i></tt>
1091 </p>
1092 !! end
1093
1094 !! test
1095 <wbr> is valid wikitext (bug 52468)
1096 !! wikitext
1097 <wbr>
1098 !! html
1099 <p><wbr />
1100 </p>
1101 !! end
1102
1103 # <strike> is HTML4, <s> is HTML4/5.
1104 !! test
1105 <s> or <strike> for strikethrough
1106 !! wikitext
1107 <strike>strike</strike>
1108
1109 <s>s</s>
1110 !! html
1111 <p><strike>strike</strike>
1112 </p><p><s>s</s>
1113 </p>
1114 !! end
1115
1116 ## a not permitted
1117 ## i,b,br omitted
1118 !! test
1119 Text-level semantic html elements in wikitext
1120 !! wikitext
1121 <em>text</em>
1122 <strong>text</strong>
1123 <small>text</small>
1124 <s>text</s>
1125 <cite>text</cite>
1126 <q>text</q>
1127 <dfn>text</dfn>
1128 <abbr>text</abbr>
1129 <data>text</data>
1130 <time>text</time>
1131 <code>text</code>
1132 <var>text</var>
1133 <samp>text</samp>
1134 <kbd>text</kbd>
1135 <sub>text</sub>
1136 <u>text</u>
1137 <mark>text</mark>
1138 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1139 <bdi>text</bdi>
1140 <bdo>text</bdo>
1141 <span>text</span>
1142 <wbr />
1143 !! html
1144 <p><em>text</em>
1145 <strong>text</strong>
1146 <small>text</small>
1147 <s>text</s>
1148 <cite>text</cite>
1149 <q>text</q>
1150 <dfn>text</dfn>
1151 <abbr>text</abbr>
1152 <data>text</data>
1153 <time>text</time>
1154 <code>text</code>
1155 <var>text</var>
1156 <samp>text</samp>
1157 <kbd>text</kbd>
1158 <sub>text</sub>
1159 <u>text</u>
1160 <mark>text</mark>
1161 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1162 <bdi>text</bdi>
1163 <bdo>text</bdo>
1164 <span>text</span>
1165 <wbr />
1166 </p>
1167 !! end
1168
1169 # test cases taken from
1170 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1171 !! test
1172 Ruby markup (W3C-style)
1173 !! wikitext
1174 ; Mono-ruby for individual base characters
1175 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1176 ; Group ruby
1177 : <ruby>今日<rt>きょう</rt></ruby>
1178 ; Jukugo ruby
1179 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1180 ; Inline ruby
1181 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1182 ; Double-sided ruby
1183 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1184 <ruby>
1185 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1186 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1187 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1188 </ruby>
1189 !! html
1190 <dl><dt> Mono-ruby for individual base characters</dt>
1191 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1192 <dt> Group ruby</dt>
1193 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1194 <dt> Jukugo ruby</dt>
1195 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1196 <dt> Inline ruby</dt>
1197 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1198 <dt> Double-sided ruby</dt>
1199 <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>
1200 <p><ruby>
1201 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1202 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1203 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1204 </ruby>
1205 </p>
1206 !! end
1207
1208 # The next two test different paths in the sanitizer.
1209 !! test
1210 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1211 !! wikitext
1212 <b→> doesn't terminate </b→>
1213
1214 <bä> doesn't terminate </bä>
1215
1216 <boo> doesn't terminate </boo>
1217
1218 <s.foo> doesn't terminate </s.foo>
1219
1220 <sub-ID#1>
1221 !! html
1222 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1223 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1224 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1225 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1226 </p><p>&lt;sub-ID#1&gt;
1227 </p>
1228 !! end
1229
1230 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1231 !! test
1232 Non-word characters don't terminate tag names + tidy
1233 !! wikitext
1234 <b→> doesn't terminate </b→>
1235
1236 <bä> doesn't terminate </bä>
1237
1238 <boo> doesn't terminate </boo>
1239
1240 <s.foo> doesn't terminate </s.foo>
1241
1242 <sub-ID#1>
1243 !! html+tidy
1244 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1245 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1246 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1247 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1248 <p>&lt;sub-ID#1&gt;</p>
1249 !! end
1250
1251 !! test
1252 Isolated close tags should be treated as literal text (bug 52760)
1253 !! wikitext
1254 </b>
1255
1256 <s.foo>s</s>
1257 !! html
1258 <p>&lt;/b&gt;
1259 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1260 </p>
1261 !! end
1262
1263 ###
1264 ### Special characters
1265 ###
1266
1267 !! test
1268 Bare pipe character (bug 52363)
1269 !! wikitext
1270 |
1271 !! html
1272 <p>|
1273 </p>
1274 !! end
1275
1276 !! test
1277 Bare pipe character from a template (bug 52363)
1278 !! wikitext
1279 {{pipe}}
1280 !! html
1281 <p>|
1282 </p>
1283 !! end
1284
1285 ###
1286 ### <nowiki> test cases
1287 ###
1288
1289 !! test
1290 <nowiki> unordered list
1291 !! wikitext
1292 <nowiki>* This is not an unordered list item.</nowiki>
1293 !! html
1294 <p>* This is not an unordered list item.
1295 </p>
1296 !! end
1297
1298 !! test
1299 <nowiki> spacing
1300 !! wikitext
1301 <nowiki>Lorem ipsum dolor
1302
1303 sed abit.
1304 sed nullum.
1305
1306 :and a colon
1307 </nowiki>
1308 !! html
1309 <p>Lorem ipsum dolor
1310
1311 sed abit.
1312 sed nullum.
1313
1314 :and a colon
1315
1316 </p>
1317 !! end
1318
1319 !! test
1320 nowiki 3
1321 !! wikitext
1322 :There is not nowiki.
1323 :There is <nowiki>nowiki</nowiki>.
1324
1325 #There is not nowiki.
1326 #There is <nowiki>nowiki</nowiki>.
1327
1328 *There is not nowiki.
1329 *There is <nowiki>nowiki</nowiki>.
1330 !! html
1331 <dl><dd>There is not nowiki.</dd>
1332 <dd>There is nowiki.</dd></dl>
1333 <ol><li>There is not nowiki.</li>
1334 <li>There is nowiki.</li></ol>
1335 <ul><li>There is not nowiki.</li>
1336 <li>There is nowiki.</li></ul>
1337
1338 !! end
1339
1340 !! test
1341 Entities inside <nowiki>
1342 !! wikitext
1343 <nowiki>&lt;</nowiki>
1344 !! html
1345 <p>&lt;
1346 </p>
1347 !! end
1348
1349 !! test
1350 Entities inside template parameters
1351 !! options
1352 parsoid
1353 !! wikitext
1354 {{echo|&ndash;}}
1355 !! html
1356 <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>
1357 !! end
1358
1359 !! test
1360 Properly escape nowiki when combined with other wiki markup
1361 !! options
1362 parsoid=html2wt
1363 !! html
1364 <p>* &lt;/nowiki&gt; tag</p>
1365 !! wikitext
1366 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1367 !! end
1368
1369 ###
1370 ### Comments
1371 ###
1372 !! test
1373 Comments and Indent-Pre
1374 !! wikitext
1375 <!-- comment 1 --> asdf
1376
1377 <!-- comment 1 --> asdf
1378 <!-- comment 2 -->
1379
1380 <!-- comment 1 --> asdf
1381 <!-- comment 2 -->xyz
1382
1383 <!-- comment 1 --> asdf
1384 <!-- comment 2 --> xyz
1385 !! html
1386 <pre>asdf
1387 </pre>
1388 <pre>asdf
1389 </pre>
1390 <pre>asdf
1391 </pre>
1392 <p>xyz
1393 </p>
1394 <pre>asdf
1395 xyz
1396 </pre>
1397 !! end
1398
1399 !! test
1400 Comment test 2a
1401 !! wikitext
1402 asdf
1403 <!-- comment 1 -->
1404 jkl
1405 !! html
1406 <p>asdf
1407 jkl
1408 </p>
1409 !! end
1410
1411 !! test
1412 Comment test 2b
1413 !! wikitext
1414 asdf
1415 <!-- comment 1 -->
1416
1417 jkl
1418 !! html
1419 <p>asdf
1420 </p><p>jkl
1421 </p>
1422 !! end
1423
1424 !! test
1425 Comment test 3
1426 !! wikitext
1427 asdf
1428 <!-- comment 1 -->
1429 <!-- comment 2 -->
1430 jkl
1431 !! html
1432 <p>asdf
1433 jkl
1434 </p>
1435 !! end
1436
1437 !! test
1438 Comment test 4
1439 !! wikitext
1440 asdf<!-- comment 1 -->jkl
1441 !! html
1442 <p>asdfjkl
1443 </p>
1444 !! end
1445
1446 !! test
1447 Comment spacing
1448 !! wikitext
1449 a
1450 <!-- foo --> b <!-- bar -->
1451 c
1452 !! html
1453 <p>a
1454 </p>
1455 <pre> b
1456 </pre>
1457 <p>c
1458 </p>
1459 !! end
1460
1461 !! test
1462 Comment whitespace
1463 !! wikitext
1464 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1465 !! html
1466
1467 !! end
1468
1469 !! test
1470 Comment semantics and delimiters
1471 !! wikitext
1472 <!-- --><!----><!-----><!------>
1473 !! html
1474
1475 !! end
1476
1477 !! test
1478 Comment semantics and delimiters, redux
1479 !! wikitext
1480 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1481 -- foo -- funky huh? ... -->
1482 !! html
1483
1484 !! end
1485
1486 !! test
1487 Comment semantics and delimiters: directors cut
1488 !! wikitext
1489 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1490 everything starting with < followed by !-- until the first -- and > we see,
1491 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1492 -->-->
1493 !! html
1494 <p>--&gt;
1495 </p>
1496 !! end
1497
1498 !! test
1499 Comment semantics: nesting
1500 !! wikitext
1501 <!--<!-- no, we're not going to do anything fancy here -->-->
1502 !! html
1503 <p>--&gt;
1504 </p>
1505 !! end
1506
1507 !! test
1508 Comment semantics: unclosed comment at end
1509 !! wikitext
1510 <!--This comment will run out to the end of the document
1511 !! html
1512
1513 !! end
1514
1515 # Bug 58184: document parsoid's behaviour
1516 !! test
1517 Suppress comment closing tag in lenient browsers
1518 !! options
1519 parsoid=wt2html,html2html
1520 !! wikitext
1521 <!-- Browsers--!> think this is closed -->
1522 !! html/php
1523
1524 !! html/parsoid
1525 <!-- Browsers--¡> think this is closed -->
1526 !! end
1527
1528 !! test
1529 Comment in template title
1530 !! wikitext
1531 {{f<!---->oo}}
1532 !! html
1533 <p>FOO
1534 </p>
1535 !! end
1536
1537 !! test
1538 Comment on its own line post-expand
1539 !! wikitext
1540 a
1541 {{blank}}<!---->
1542 b
1543 !! html
1544 <p>a
1545 </p><p>b
1546 </p>
1547 !! end
1548
1549 !! test
1550 Comment on its own line post-expand with non-significant whitespace
1551 !! wikitext
1552 a
1553 {{blank}} <!---->
1554 b
1555 !! html
1556 <p>a
1557 </p><p>b
1558 </p>
1559 !! end
1560
1561 !! test
1562 Multiple comments should still parse as SOL-transparent
1563 !! options
1564 parsoid=wt2html,wt2wt
1565 !! wikitext
1566 <!--c1-->*a
1567 <!--c2--><!--c3--><!--c4-->*b
1568 !! html
1569 <ul>
1570 <li>a
1571 </li>
1572 <li>b
1573 </li>
1574 </ul>
1575 !! end
1576
1577 ###
1578 ### paragraph wrapping tests
1579 ###
1580 !! test
1581 No block tags
1582 !! wikitext
1583 a
1584
1585 b
1586 !! html
1587 <p>a
1588 </p><p>b
1589 </p>
1590 !! end
1591
1592 !! test
1593 Block tag on one line (<div>)
1594 !! wikitext
1595 a <div>foo</div>
1596
1597 b
1598 !! html
1599 a <div>foo</div>
1600 <p>b
1601 </p>
1602 !! html+tidy
1603 <p>a</p>
1604 <div>foo</div>
1605 <p>b</p>
1606 !! end
1607
1608 !! test
1609 Block tag on one line (<blockquote>)
1610 !! wikitext
1611 a <blockquote>foo</blockquote>
1612
1613 b
1614 !! html
1615 a <blockquote>foo</blockquote>
1616 <p>b
1617 </p>
1618 !! html+tidy
1619 <p>a</p>
1620 <blockquote>
1621 <p>foo</p>
1622 </blockquote>
1623 <p>b</p>
1624 !! end
1625
1626 !! test
1627 Block tag on both lines (<div>)
1628 !! wikitext
1629 a <div>foo</div>
1630
1631 b <div>foo</div>
1632 !! html
1633 a <div>foo</div>
1634 b <div>foo</div>
1635
1636 !! html+tidy
1637 <p>a</p>
1638 <div>foo</div>
1639 <p>b</p>
1640 <div>foo</div>
1641 !! end
1642
1643 !! test
1644 Block tag on both lines (<blockquote>)
1645 !! wikitext
1646 a <blockquote>foo</blockquote>
1647
1648 b <blockquote>foo</blockquote>
1649 !! html
1650 a <blockquote>foo</blockquote>
1651 b <blockquote>foo</blockquote>
1652
1653 !! html+tidy
1654 <p>a</p>
1655 <blockquote>
1656 <p>foo</p>
1657 </blockquote>
1658 <p>b</p>
1659 <blockquote>
1660 <p>foo</p>
1661 </blockquote>
1662 !! end
1663
1664 !! test
1665 Multiple lines without block tags
1666 !! wikitext
1667 <div>foo</div> a
1668 b
1669 c
1670 d<!--foo--> e
1671 x <div>foo</div> z
1672 !! html
1673 <div>foo</div> a
1674 <p>b
1675 c
1676 d e
1677 </p>
1678 x <div>foo</div> z
1679
1680 !! html+tidy
1681 <div>foo</div>
1682 <p>a</p>
1683 <p>b c d e</p>
1684 <p>x</p>
1685 <div>foo</div>
1686 <p>z</p>
1687 !! end
1688
1689 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1690 # So, we have a separate section for Parsoid. We don't want
1691 # to mimic this stripping behavior in Parsoid. It affects
1692 # editing experience and also requires us to maintain additional
1693 # info for RT-ing.
1694 !! test
1695 Empty lines between lines with block tags
1696 !! wikitext
1697 <div></div>
1698
1699
1700 <div></div>a
1701
1702 b
1703 <div>a</div>b
1704
1705 <div>b</div>d
1706
1707
1708 <div>e</div>
1709 !! html
1710 <div></div>
1711 <p><br />
1712 </p>
1713 <div></div>a
1714 <p>b
1715 </p>
1716 <div>a</div>b
1717 <div>b</div>d
1718 <p><br />
1719 </p>
1720 <div>e</div>
1721
1722 !! html+tidy
1723 <p><br /></p>
1724 <p>a</p>
1725 <p>b</p>
1726 <div>a</div>
1727 <p>b</p>
1728 <div>b</div>
1729 <p>d</p>
1730 <p><br /></p>
1731 <div>e</div>
1732 !! html/parsoid
1733 <div data-parsoid='{"stx":"html"}'></div>
1734
1735 <p><br /></p>
1736 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1737
1738 <p>b</p>
1739 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1740
1741 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1742
1743 <p><br /></p>
1744 <div data-parsoid='{"stx":"html"}'>e</div>
1745 !! end
1746
1747 ## PHP parser emits output which is broken
1748 ## XXX The parsoid output doesn't match the tidy output.
1749 !! test
1750 Unclosed HTML p-tags should be handled properly
1751 !! wikitext
1752 <div><p>foo</div>
1753 a
1754
1755 b
1756 !! html/php+tidy
1757 <div>
1758 <p>foo&lt;/div&gt;</p>
1759 <p>a</p>
1760 b</div>
1761 !! html/parsoid
1762 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1763 <p>a</p>
1764 <p>b</p>
1765 !! end
1766
1767 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1768 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1769 ## them for now.
1770 !! test
1771 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1772 !! options
1773 parsoid=wt2html
1774 !! wikitext
1775 a [[Category:A1]] [[Category:A2]]
1776 [[Category:A3]]
1777 [[Category:A4]]
1778 !! html/parsoid
1779 <p>a</p>
1780 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1781 !! end
1782
1783 !! test
1784 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1785 !! options
1786 parsoid=wt2html
1787 !! wikitext
1788 [[Category:A1]]a
1789 !! html/parsoid
1790 <link href="Category:A1"/><p>a</p>
1791 !! end
1792
1793 ###
1794 ### Preformatted text
1795 ###
1796 !! test
1797 Preformatted text
1798 !! wikitext
1799 This is some
1800 Preformatted text
1801 With ''italic''
1802 And '''bold'''
1803 And a [[Main Page|link]]
1804 !! html
1805 <pre>This is some
1806 Preformatted text
1807 With <i>italic</i>
1808 And <b>bold</b>
1809 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1810 </pre>
1811 !! end
1812
1813 !! test
1814 Tabs don't trigger preformatted text
1815 !! wikitext
1816 This is not
1817 preformatted text.
1818 This is preformatted text.
1819 So is this.
1820 !! html
1821 <p> This is not
1822 preformatted text.
1823 </p>
1824 <pre>This is preformatted text.
1825 So is this.
1826 </pre>
1827 !! end
1828
1829 !! test
1830 Ident preformatting with inline content
1831 !! wikitext
1832 a
1833 ''b''
1834 !! html
1835 <pre>a
1836 <i>b</i>
1837 </pre>
1838 !! end
1839
1840 !! test
1841 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1842 !! wikitext
1843 <pre><nowiki>
1844 <b>
1845 <cite>
1846 <em>
1847 </nowiki></pre>
1848 !! html
1849 <pre>
1850 &lt;b&gt;
1851 &lt;cite&gt;
1852 &lt;em&gt;
1853 </pre>
1854
1855 !! end
1856
1857 !! test
1858 Regression with preformatted in <center>
1859 !! wikitext
1860 <center>
1861 Blah
1862 </center>
1863 !! html
1864 <center>
1865 <pre>Blah
1866 </pre>
1867 </center>
1868
1869 !! end
1870
1871 !! test
1872 Bug 52763: Preformatted in <blockquote>
1873 !! wikitext
1874 <blockquote>
1875 Blah
1876 {|
1877 |
1878 indented cell (no pre-wrapping!)
1879 |}
1880 </blockquote>
1881 !! html
1882 <blockquote>
1883 <p> Blah
1884 </p>
1885 <table>
1886 <tr>
1887 <td>
1888 <p> indented cell (no pre-wrapping!)
1889 </p>
1890 </td></tr></table>
1891 </blockquote>
1892
1893 !! end
1894
1895 !! test
1896 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1897 !! wikitext
1898 <blockquote>
1899 Foo
1900
1901 Bar
1902 </blockquote>
1903 !! html
1904 <blockquote>
1905 <p>Foo
1906 </p><p>Bar
1907 </p>
1908 </blockquote>
1909
1910 !! end
1911
1912 !! test
1913 Bug 15491: <ins>/<del> in blockquote
1914 !! wikitext
1915 <blockquote>
1916 Foo <del>bar</del> <ins>baz</ins> quux
1917 </blockquote>
1918 !! html
1919 <blockquote>
1920 <p>Foo <del>bar</del> <ins>baz</ins> quux
1921 </p>
1922 </blockquote>
1923
1924 !! end
1925
1926 # Note that the p-wrapping is newline sensitive, which could be
1927 # considered a bug: tidy will wrap only the 'Foo' in the example
1928 # below in a <p> tag. (see comment 23-25 of bug #6200)
1929 !! test
1930 Bug 15491: <ins>/<del> in blockquote (2)
1931 !! wikitext
1932 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1933 </blockquote>
1934 !! html
1935 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1936 </blockquote>
1937
1938 !! html+tidy
1939 <blockquote>
1940 <p>Foo</p>
1941 <del>bar</del> <ins>baz</ins> quux</blockquote>
1942 !! end
1943
1944 !! test
1945 <pre> with attributes (bug 3202)
1946 !! wikitext
1947 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1948 !! html
1949 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1950
1951 !! end
1952
1953 !! test
1954 <pre> with width attribute (bug 3202)
1955 !! wikitext
1956 <pre width="8">Narrow screen goodies</pre>
1957 !! html
1958 <pre width="8">Narrow screen goodies</pre>
1959
1960 !! end
1961
1962 !! test
1963 <pre> with forbidden attribute (bug 3202)
1964 !! wikitext
1965 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1966 !! html
1967 <pre width="8">Narrow screen goodies</pre>
1968
1969 !! end
1970
1971 !! test
1972 Entities inside <pre>
1973 !! wikitext
1974 <pre>&lt;</pre>
1975 !! html
1976 <pre>&lt;</pre>
1977
1978 !! end
1979
1980 !! test
1981 <pre> with forbidden attribute values (bug 3202)
1982 !! wikitext
1983 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1984 !! html
1985 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1986
1987 !! end
1988
1989 !! test
1990 <nowiki> inside <pre> (bug 13238)
1991 !! wikitext
1992 <pre>
1993 <nowiki>
1994 </pre>
1995 <pre>
1996 <nowiki></nowiki>
1997 </pre>
1998 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1999 !! html
2000 <pre>
2001 &lt;nowiki&gt;
2002 </pre>
2003 <pre>
2004
2005 </pre>
2006 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2007
2008 !! end
2009
2010 !! test
2011 <nowiki> and <pre> preference (first one wins)
2012 !! wikitext
2013 <pre>
2014 <nowiki>
2015 </pre>
2016 </nowiki>
2017 </pre>
2018
2019 <nowiki>
2020 <pre>
2021 <nowiki>
2022 </pre>
2023 </nowiki>
2024 </pre>
2025
2026 !! html
2027 <pre>
2028 &lt;nowiki&gt;
2029 </pre>
2030 <p>&lt;/nowiki&gt;
2031 &lt;/pre&gt;
2032 </p><p>
2033 &lt;pre&gt;
2034 &lt;nowiki&gt;
2035 &lt;/pre&gt;
2036
2037 &lt;/pre&gt;
2038 </p>
2039 !! end
2040
2041 !! test
2042 </pre> inside nowiki
2043 !! wikitext
2044 <nowiki></pre></nowiki>
2045 !! html
2046 <p>&lt;/pre&gt;
2047 </p>
2048 !! end
2049
2050 # Parsoid doesn't strip empty tags, like Tidy does.
2051 !! test
2052 Empty pre; pre inside other HTML tags (bug 54946)
2053 !! options
2054 parsoid=wt2html,wt2wt
2055 !! wikitext
2056 a
2057
2058 <div><pre>
2059 foo
2060 </pre></div>
2061 <pre></pre>
2062 !! html/php
2063 <p>a
2064 </p>
2065 <div><pre>
2066 foo
2067 </pre></div>
2068 <pre></pre>
2069
2070 !! html/php+tidy
2071 <p>a</p>
2072 <div>
2073 <pre>
2074 foo
2075 </pre></div>
2076 !! html/parsoid
2077 <p>a</p>
2078
2079 <div><pre>foo
2080 </pre></div>
2081 <pre></pre>
2082 !! end
2083
2084 !! test
2085 HTML pre followed by indent-pre
2086 !! wikitext
2087 <pre>foo</pre>
2088 bar
2089 !! html
2090 <pre>foo</pre>
2091 <pre>bar
2092 </pre>
2093 !! end
2094
2095 !!test
2096 Block tag pre
2097 !!options
2098 parsoid
2099 !! wikitext
2100 <p><pre>foo</pre></p>
2101 !! html
2102 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2103 !!end
2104
2105 !!test
2106 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2107 !! wikitext
2108 {{echo|}}
2109 !! html
2110
2111 !!end
2112
2113 !!test
2114 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2115 !! wikitext
2116 {{echo|
2117 foo}}
2118 !! html
2119 <p>foo
2120 </p>
2121 !!end
2122
2123 !! test
2124 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2125 !! wikitext
2126 {{echo|a
2127 b}}
2128 !! html
2129 <pre>a
2130 </pre>
2131 <p>b
2132 </p>
2133 !!end
2134
2135 !! test
2136 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2137 !! wikitext
2138 {{echo|a
2139 b
2140 c
2141 d
2142 e
2143 }}
2144 !! html
2145 <pre>a
2146 </pre>
2147 <p>b
2148 c
2149 </p>
2150 <pre>d
2151 </pre>
2152 <p>e
2153 </p>
2154 !!end
2155
2156 !!test
2157 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2158 !! wikitext
2159 {{echo| foo}}
2160
2161 {{echo| foo}}{{echo| bar}}
2162
2163 {{echo| foo}}
2164 {{echo| bar}}
2165
2166 {{echo|<!--cmt--> foo}}
2167
2168 <!--cmt-->{{echo| foo}}
2169
2170 {{echo|{{echo| }}bar}}
2171 !! html
2172 <pre>foo
2173 </pre>
2174 <pre>foo bar
2175 </pre>
2176 <pre>foo
2177 bar
2178 </pre>
2179 <pre>foo
2180 </pre>
2181 <pre>foo
2182 </pre>
2183 <pre>bar
2184 </pre>
2185 !!end
2186
2187 !! test
2188 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2189 !! wikitext
2190 {{echo| }}a
2191
2192 {{echo|
2193 }}a
2194
2195 {{echo|
2196 b}}
2197
2198 {{echo|a
2199 }}b
2200
2201 {{echo|a
2202 }} b
2203 !! html
2204 <pre>a
2205 </pre>
2206 <p><br />
2207 </p>
2208 <pre>a
2209 </pre>
2210 <p><br />
2211 </p>
2212 <pre>b
2213 </pre>
2214 <p>a
2215 </p>
2216 <pre>b
2217 </pre>
2218 <p>a
2219 </p>
2220 <pre>b
2221 </pre>
2222 !!end
2223
2224 !! test
2225 Things that look like <pre> tags aren't treated as such
2226 !! wikitext
2227 Barack Obama <President> of the United States
2228 <President></President>
2229 !! html
2230 <p>Barack Obama &lt;President&gt; of the United States
2231 &lt;President&gt;&lt;/President&gt;
2232 </p>
2233 !! end
2234
2235 ## PHP parser discards the "<pre " string
2236 !! test
2237 Handle broken pre-like tags (bug 64025)
2238 !! options
2239 parsoid=wt2html
2240 !! wikitext
2241 {{echo|<pre <pre>x</pre>}}
2242
2243 <table><pre </table>
2244 !! html/php
2245 <pre>x</pre>
2246 <table><pre></pre></table>
2247
2248 !! html/parsoid
2249 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2250
2251
2252 <p>&lt;pre </p>
2253
2254 <table></table>
2255 !! end
2256
2257 !! test
2258 Parsoid: handle pre with space after attribute
2259 !! options
2260 parsoid=wt2html
2261 !! wikitext
2262 <pre style="width:50%;" >{{echo|foo}}</pre>
2263 !! html
2264 <pre style="width:50%;">{{echo|foo}}</pre>
2265 !! end
2266
2267 # TODO / maybe: fix wt2wt for this
2268 !! test
2269 Parsoid: Don't paragraph-wrap fosterable content
2270 !! options
2271 parsoid=wt2html
2272 !! wikitext
2273 {|
2274 <td></td>
2275 <td></td>
2276
2277
2278
2279 |}
2280 !! html
2281 <table>
2282
2283 <tbody>
2284 <tr>
2285 <td></td>
2286
2287 <td></td></tr>
2288
2289
2290
2291 </tbody></table>
2292 !! end
2293
2294 !! test
2295 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2296 !! options
2297 parsoid=wt2html
2298 !! wikitext
2299 {|
2300 <td>
2301 <td>
2302 </td>
2303
2304
2305
2306 |}
2307 !! html
2308 <table>
2309
2310 <tbody>
2311 <tr>
2312 <td></td>
2313
2314 <td>
2315 </td></tr>
2316
2317
2318
2319 </tbody></table>
2320 !! end
2321
2322
2323 #--------------------------------------------------------------------
2324 # Transclusion parameter whitespace stripping tests
2325 # Behavior is different for positional and named parameters
2326 #--------------------------------------------------------------------
2327 !! test
2328 Templates: Strip leading and trailing whitespace from named-param values
2329 !! wikitext
2330 {{echo|1= a }}
2331
2332 {{echo|1= {{echo|b}} }}
2333
2334 {{echo| 1 =
2335 c }}
2336
2337 {{echo| 1 =
2338 * d
2339 }}
2340 !! html
2341 <p>a
2342 </p><p>b
2343 </p><p>c
2344 </p>
2345 <ul><li> d</li></ul>
2346
2347 !! end
2348
2349 !! test
2350 Templates: Don't strip whitespace from positional-param values
2351 !! wikitext
2352 {{echo|a }}
2353
2354 {{echo|{{echo|b}} }}
2355
2356 {{echo| c
2357 }}
2358
2359 {{echo| {{echo|d}}
2360 }}
2361
2362 {{echo|
2363 e}}
2364
2365 {{echo|
2366 * f}}
2367
2368 {{echo|
2369 }}g
2370 !! html
2371 <p>a
2372 </p><p>b
2373 </p>
2374 <pre>c
2375 </pre>
2376 <p><br />
2377 </p>
2378 <pre>d
2379 </pre>
2380 <p><br />
2381 </p>
2382 <pre>e
2383 </pre>
2384 <p><br />
2385 </p>
2386 <ul><li> f</li></ul>
2387 <p><br />
2388 </p>
2389 <pre>g
2390 </pre>
2391 !! end
2392
2393 !! test
2394 Templates: Handle empty comment-and-ws-only lines correctly
2395 !! wikitext
2396 {{echo|foo
2397 <!--should be ignored-->
2398 <!--should be ignored as well-->
2399 bar}}
2400 !! html
2401 <p>foo
2402 bar
2403 </p>
2404 !! end
2405
2406 !! test
2407 Templates: Handle comments in the target
2408 !! wikitext
2409 {{echo
2410 <!-- should be ignored -->
2411 |foo}}
2412
2413 {{echo<!-- should be ignored -->
2414 |foo}}
2415
2416 {{echo<!-- should be ignored -->|foo}}
2417
2418 {{<!-- should be ignored -->echo|foo}}
2419 !!html/parsoid
2420 <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>
2421
2422 <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>
2423
2424 <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>
2425
2426 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2427 !!end
2428
2429 !! test
2430 Templates: Handle comments in parameter names (bug 67657)
2431 !! wikitext
2432 {{echo|1
2433 <!-- should be ignored -->
2434 =foo}}
2435
2436 {{echo|
2437 <!-- should be ignored -->
2438 1 = foo}}
2439
2440 {{echo|1<!-- should be ignored --> = foo}}
2441
2442 {{echo|<!-- should be ignored -->1 = foo}}
2443 !!html/parsoid
2444 <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>
2445
2446 <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>
2447
2448 <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>
2449
2450 <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>
2451 !!end
2452
2453 !! test
2454 Templates: Other wikitext in parameter names (bug 67657)
2455 !! wikitext
2456 {{echo|''1''=foo}}
2457 !!html/parsoid
2458 <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>
2459 !!html/php
2460 <p>{{{1}}}
2461 </p>
2462 !!end
2463
2464 #--------------------------------------------------------------------
2465 # Transclusion parameter escaping tests
2466 #--------------------------------------------------------------------
2467 !! test
2468 Templates: Parsoid parameter escaping test 1
2469 !! options
2470 parsoid
2471 !! wikitext
2472 {{echo|[foo]|{{echo|[bar]}}}}
2473 !! html
2474 <p about="#mwt1" typeof="mw:Transclusion"
2475 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2476 !! end
2477
2478 !! test
2479 Parsoid: Pipes in external links in template parameter
2480 !! options
2481 parsoid
2482 !! wikitext
2483 {{echo|[{{echo|http://example.com}} link]}}
2484 !! html
2485 <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>
2486 !! end
2487
2488 !! test
2489 Parsoid: pipe in transclusion parameter
2490 !! options
2491 parsoid
2492 !! wikitext
2493 {{echo|http://foo.com/a&#124;b}}
2494 !! html
2495 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2496 typeof="mw:Transclusion"
2497 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>
2498 !! end
2499
2500 !! test
2501 Parsoid: Pipe in external link target and content in template parameter
2502 !! options
2503 parsoid=html2wt,wt2wt
2504 !! wikitext
2505 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2506 !! html
2507 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2508 typeof="mw:Transclusion"
2509 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2510 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2511 !! end
2512
2513 !! test
2514 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2515 !! options
2516 parsoid
2517 !! wikitext
2518 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2519 !! html
2520 <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>
2521 !! end
2522
2523 !! test
2524 Templates: Don't escape already nowiki-escaped text in template parameters
2525 !! options
2526 parsoid=html2wt,wt2wt
2527 !! wikitext
2528 {{echo|foo<nowiki>|</nowiki>bar}}
2529 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2530 {{echo|<nowiki></nowiki>}}
2531 !! html
2532 <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>
2533 <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>
2534 <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>
2535 </p>
2536 !! end
2537
2538 ## Bug 52824
2539 !! test
2540 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2541 !! options
2542 parsoid=html2wt,wt2wt
2543 !! wikitext
2544 {{echo|{{echo|1=bar}}}}
2545 !! html
2546 <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>
2547 !! end
2548
2549 ## Bug 56733
2550 !! test
2551 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2552 !! options
2553 parsoid
2554 !! wikitext
2555 {{echo|a : b}}
2556 !! html
2557 <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:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2558 !! end
2559
2560 ## Bug T73412
2561 !! test
2562 Templates: Preserve blank parameter names
2563 !! wikitext
2564 {{echo|=foo}}
2565 !! html/php
2566 <p>{{{1}}}
2567 </p>
2568 !! html/parsoid
2569 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2570 !! end
2571
2572 ###
2573 ### Parsoid-centric tests for testing RT edge cases for pre
2574 ###
2575
2576 !!test
2577 1a. Indent-Pre and Comments
2578 !! wikitext
2579 a
2580 <!--a-->
2581 c
2582 !! html
2583 <pre>a
2584 </pre>
2585 <p>c
2586 </p>
2587 !!end
2588
2589 !!test
2590 1b. Indent-Pre and Comments
2591 !! wikitext
2592 a
2593 <!--a-->
2594 c
2595 !! html
2596 <pre>a
2597 </pre>
2598 <p>c
2599 </p>
2600 !!end
2601
2602 !!test
2603 1c. Indent-Pre and Comments
2604 !! wikitext
2605 <!--a--> a
2606
2607 <!--a--> a
2608 !! html
2609 <pre> a
2610 </pre>
2611 <pre> a
2612 </pre>
2613 !!end
2614
2615 !!test
2616 1d. Indent-Pre and Comments
2617 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2618 !! wikitext
2619 <!--a--> a
2620
2621 <!--b-->b
2622 !! html
2623 <pre>a
2624 </pre>
2625 <pre>b
2626 </pre>
2627 !!end
2628
2629 !!test
2630 2a. Indent-Pre and tables
2631 !! wikitext
2632 {|
2633 |-
2634 !h1!!h2
2635 |foo||bar
2636 |}
2637 !! html
2638 <table>
2639
2640 <tr>
2641 <th>h1</th>
2642 <th>h2
2643 </th>
2644 <td>foo</td>
2645 <td>bar
2646 </td></tr></table>
2647
2648 !!end
2649
2650 !!test
2651 2b. Indent-Pre and tables
2652 !! wikitext
2653 {|
2654 |-
2655 |foo
2656 |}
2657 !! html
2658 <table>
2659
2660 <tr>
2661 <td>foo
2662 </td></tr></table>
2663
2664 !!end
2665
2666 !!test
2667 2c. Indent-Pre and tables (bug 42252)
2668 !! wikitext
2669 {|
2670 |+ foo
2671 ! | bar
2672 |}
2673 !! html
2674 <table>
2675 <caption> foo
2676 </caption>
2677 <tr>
2678 <th> bar
2679 </th></tr></table>
2680
2681 !!end
2682
2683 !!test
2684 2d. Indent-Pre and tables
2685 !! wikitext
2686 a
2687 {|
2688 | b
2689 |}
2690 !! html/php
2691 <pre>a
2692 </pre>
2693 <table>
2694 <tr>
2695 <td> b
2696 </td></tr></table>
2697
2698 !! html/parsoid
2699 <pre>a</pre>
2700 <table>
2701 <tbody><tr><td> b</td></tr>
2702 </tbody></table>
2703 !!end
2704
2705 !!test
2706 2e. Indent-Pre and table-line syntax
2707 !! wikitext
2708 a
2709 | b
2710 | c
2711 !! html/php
2712 <pre>a
2713 | b
2714 | c
2715 </pre>
2716 !!end
2717
2718 !!test
2719 2f. Indent-pre started by table-line syntax
2720 !! wikitext
2721 a
2722 | b
2723 | c
2724 !! html/php
2725 <p>a
2726 </p>
2727 <pre>| b
2728 | c
2729 </pre>
2730 !! html/parsoid
2731 <p>a</p>
2732 <pre>
2733 | b
2734 | c</pre>
2735 !!end
2736
2737 !!test
2738 3a. Indent-Pre and block tags (single-line html)
2739 !! wikitext
2740 a <p> foo </p>
2741 b <div> foo </div>
2742 c <blockquote> foo </blockquote>
2743 <span> foo </span>
2744 !! html
2745 a <p> foo </p>
2746 b <div> foo </div>
2747 c <blockquote> foo </blockquote>
2748 <pre><span> foo </span>
2749 </pre>
2750 !! html/parsoid
2751 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2752 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2753 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2754 <pre><span> foo </span>
2755 </pre>
2756 !! html+tidy
2757 <p>a</p>
2758 <p>foo</p>
2759 <p>b</p>
2760 <div>foo</div>
2761 <p>c</p>
2762 <blockquote>
2763 <p>foo</p>
2764 </blockquote>
2765 <pre>
2766 <span> foo </span>
2767 </pre>
2768 !! end
2769
2770 !!test
2771 3b. Indent-Pre and block tags (multi-line html)
2772 !! wikitext
2773 a <span>foo</span>
2774 b <div> foo </div>
2775 !! html
2776 <pre>a <span>foo</span>
2777 </pre>
2778 b <div> foo </div>
2779
2780 !! html/parsoid
2781 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2782 b <div data-parsoid='{"stx":"html"}'> foo </div>
2783 !! html+tidy
2784 <pre>
2785 a <span>foo</span>
2786 </pre>
2787 <p>b</p>
2788 <div>foo</div>
2789 !!end
2790
2791 !!test
2792 3c. Indent-Pre and block tags (pre-content on separate line)
2793 !! wikitext
2794 <p>
2795 foo
2796 </p>
2797
2798 <div>
2799 foo
2800 </div>
2801
2802 <center>
2803 foo
2804 </center>
2805
2806 <blockquote>
2807 foo
2808 </blockquote>
2809
2810 <blockquote>
2811 <pre>
2812 foo
2813 </pre>
2814 </blockquote>
2815
2816 <table><tr><td>
2817 foo
2818 </td></tr></table>
2819
2820 <ul><li>
2821 foo
2822 </li></ul>
2823
2824 !! html
2825 <p>
2826 foo
2827 </p>
2828 <div>
2829 <pre>foo
2830 </pre>
2831 </div>
2832 <center>
2833 <pre>foo
2834 </pre>
2835 </center>
2836 <blockquote>
2837 <p> foo
2838 </p>
2839 </blockquote>
2840 <blockquote>
2841 <pre>
2842 foo
2843 </pre>
2844 </blockquote>
2845 <table><tr><td>
2846 <pre>foo
2847 </pre>
2848 </td></tr></table>
2849 <ul><li>
2850 foo
2851 </li></ul>
2852
2853 !!end
2854
2855 !!test
2856 4. Indent-Pre and extension tags
2857 !! wikitext
2858 a <gallery>
2859 File:foobar.jpg
2860 </gallery>
2861 !! html
2862 a <ul class="gallery mw-gallery-traditional">
2863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2864 <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>
2865 <div class="gallerytext">
2866 </div>
2867 </div></li>
2868 </ul>
2869
2870 !! html+tidy
2871 <p>a</p>
2872 <ul class="gallery mw-gallery-traditional">
2873 <li class="gallerybox" style="width: 155px">
2874 <div style="width: 155px">
2875 <div class="thumb" style="width: 150px;">
2876 <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>
2877 </div>
2878 <div class="gallerytext"></div>
2879 </div>
2880 </li>
2881 </ul>
2882 !!end
2883
2884 !! test
2885 Table wikitext syntax outside wiki-tables
2886 !! wikitext
2887 a
2888 ! not a table heading
2889 |- not a table row
2890 | not a table cell
2891 | class="foo bar" | baz
2892 b
2893 |}
2894 |-
2895 c
2896 !! html
2897 <p>a
2898 ! not a table heading
2899 |- not a table row
2900 | not a table cell
2901 | class="foo bar" | baz
2902 b
2903 |}
2904 |-
2905 c
2906 </p>
2907 !! end
2908
2909 !!test
2910 Render paragraphs when indent-pre is suppressed in blocklevels
2911 !! wikitext
2912 <blockquote>
2913 foo
2914
2915 bar
2916 </blockquote>
2917 !! html
2918 <blockquote>
2919 <p> foo
2920 </p><p> bar
2921 </p>
2922 </blockquote>
2923
2924 !!end
2925
2926 !!test
2927 4. Multiple spaces at start-of-line
2928 !! wikitext
2929 <p> foo </p>
2930 foo
2931 {|
2932 |foo
2933 |}
2934 !! html
2935 <p> foo </p>
2936 <pre> foo
2937 </pre>
2938 <table>
2939 <tr>
2940 <td>foo
2941 </td></tr></table>
2942
2943 !!end
2944
2945 ## NOTE: the leading white-space chars on empty line are significant
2946 !! test
2947 5a. White-space in indent-pre
2948 !! wikitext
2949 a<br />
2950
2951 b
2952 !! html
2953 <pre>a<br />
2954
2955 b
2956 </pre>
2957 !! end
2958
2959 ## NOTE: the leading white-space chars on empty line are significant
2960 !! test
2961 5b. White-space in indent-pre
2962 !! wikitext
2963 a
2964
2965 b
2966
2967
2968 c
2969 !! html
2970 <pre>a
2971
2972 b
2973
2974
2975 c
2976 </pre>
2977 !! end
2978
2979 !! test
2980 5c. White-space in indent-pre
2981 !! wikitext
2982 ''a''
2983 ''b''
2984 ''c''
2985 !! html
2986 <pre><i>a</i>
2987 <i>b</i>
2988 <i>c</i>
2989 </pre>
2990 !! end
2991
2992 !! test
2993 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2994 !! wikitext
2995 a
2996
2997 <!-- continue -->
2998 b
2999
3000 c
3001
3002 d
3003 !! html
3004 <pre>a
3005
3006 b
3007 </pre>
3008 <pre>c
3009
3010 </pre>
3011 <p>d
3012 </p>
3013 !! end
3014
3015 !! test
3016 7a. Indent-pre and category links
3017 !! options
3018 parsoid=wt2html,wt2wt
3019 !! wikitext
3020 [[Category:foo]] <!-- No pre-wrapping -->
3021 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3022 !! html
3023 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3024 <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-wrapping -->
3025 !! end
3026
3027 !! test
3028 7b. Indent-pre and category links
3029 !! options
3030 parsoid=wt2html,wt2wt
3031 !! wikitext
3032 [[Category:foo]] a
3033 [[Category:foo]] {{echo|b}}
3034 !! html
3035 <pre>
3036 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3037 <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>
3038 !! end
3039
3040 ###
3041 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3042 ###
3043
3044 !!test
3045 HTML-pre: 1. embedded newlines
3046 !! wikitext
3047 <pre>foo</pre>
3048
3049 <pre>
3050 foo
3051 </pre>
3052
3053 <pre>
3054
3055 foo
3056 </pre>
3057
3058 <pre>
3059
3060
3061 foo
3062 </pre>
3063 !! html
3064 <pre>foo</pre>
3065 <pre>
3066 foo
3067 </pre>
3068 <pre>
3069
3070 foo
3071 </pre>
3072 <pre>
3073
3074
3075 foo
3076 </pre>
3077
3078 !! html/parsoid
3079 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3080
3081 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3082 foo
3083 </pre>
3084
3085 <pre data-parsoid='{"stx":"html"}'>
3086
3087 foo
3088 </pre>
3089
3090 <pre data-parsoid='{"stx":"html"}'>
3091
3092
3093 foo
3094 </pre>
3095 !!end
3096
3097 !! test
3098 HTML-pre: big spaces
3099 !! wikitext
3100 <pre>
3101
3102
3103
3104
3105 haha
3106
3107
3108
3109
3110 haha
3111
3112
3113
3114
3115 </pre>
3116 !! html
3117 <pre>
3118
3119
3120
3121
3122 haha
3123
3124
3125
3126
3127 haha
3128
3129
3130
3131
3132 </pre>
3133
3134 !! html/parsoid
3135 <pre data-parsoid='{"stx":"html"}'>
3136
3137
3138
3139
3140 haha
3141
3142
3143
3144
3145 haha
3146
3147
3148
3149
3150 </pre>
3151 !! end
3152
3153 !!test
3154 HTML-pre: 2: indented text
3155 !! wikitext
3156 <pre>
3157 foo
3158 </pre>
3159 !! html
3160 <pre>
3161 foo
3162 </pre>
3163
3164 !!end
3165
3166 !!test
3167 HTML-pre: 3: other wikitext
3168 !! wikitext
3169 <pre>
3170 * foo
3171 # bar
3172 = no-h =
3173 '' no-italic ''
3174 [[ NoLink ]]
3175 </pre>
3176 !! html
3177 <pre>
3178 * foo
3179 # bar
3180 = no-h =
3181 '' no-italic ''
3182 [[ NoLink ]]
3183 </pre>
3184
3185 !!end
3186
3187 ###
3188 ### Definition lists
3189 ###
3190 !! test
3191 Simple definition
3192 !! wikitext
3193 ; name : Definition
3194 !! html
3195 <dl><dt> name&#160;</dt>
3196 <dd> Definition</dd></dl>
3197
3198 !! end
3199
3200 !! test
3201 Definition list for indentation only
3202 !! wikitext
3203 : Indented text
3204 !! html
3205 <dl><dd> Indented text</dd></dl>
3206
3207 !! end
3208
3209 !! test
3210 Definition list with no space
3211 !! wikitext
3212 ;name:Definition
3213 !! html
3214 <dl><dt>name</dt>
3215 <dd>Definition</dd></dl>
3216
3217 !!end
3218
3219 !! test
3220 Definition list with URL link
3221 !! wikitext
3222 ; http://example.com/ : definition
3223 !! html
3224 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3225 <dd> definition</dd></dl>
3226
3227 !! end
3228
3229 !! test
3230 Definition list with bracketed URL link
3231 !! wikitext
3232 ;[http://www.example.com/ Example]:Something about it
3233 !! html
3234 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3235 <dd>Something about it</dd></dl>
3236
3237 !! end
3238
3239 !! test
3240 Definition list with wikilink containing colon
3241 !! wikitext
3242 ; [[Help:FAQ]]: The least-read page on Wikipedia
3243 !! html
3244 <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>
3245 <dd> The least-read page on Wikipedia</dd></dl>
3246
3247 !! end
3248
3249 # At Brion's and JeLuF's insistence... :)
3250 !! test
3251 Definition list with news link containing colon
3252 !! wikitext
3253 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3254 !! html/php
3255 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3256 <dd> This isn't even a real newsgroup!</dd></dl>
3257
3258 !! html/parsoid
3259 <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>
3260 !! end
3261
3262 !! test
3263 Malformed definition list with colon
3264 !! wikitext
3265 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3266 !! html
3267 <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>
3268
3269 !! end
3270
3271 !! test
3272 Definition lists: colon in external link text
3273 !! wikitext
3274 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3275 !! html
3276 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3277 <dd> OK, I made that up</dd></dl>
3278
3279 !! end
3280
3281 !! test
3282 Definition lists: colon in HTML attribute
3283 !! wikitext
3284 ;<b style="display: inline">bold</b>
3285 !! html
3286 <dl><dt><b style="display: inline">bold</b></dt></dl>
3287
3288 !! end
3289
3290 !! test
3291 Definition lists: self-closed tag
3292 !! wikitext
3293 ;one<br/>two : two-line fun
3294 !! html
3295 <dl><dt>one<br />two&#160;</dt>
3296 <dd> two-line fun</dd></dl>
3297
3298 !! end
3299
3300 !! test
3301 Bug 11748: Literal closing tags
3302 !! wikitext
3303 <dl>
3304 <dt>test 1</dt>
3305 <dd>test test test test test</dd>
3306 <dt>test 2</dt>
3307 <dd>test test test test test</dd>
3308 </dl>
3309 !! html
3310 <dl>
3311 <dt>test 1</dt>
3312 <dd>test test test test test</dd>
3313 <dt>test 2</dt>
3314 <dd>test test test test test</dd>
3315 </dl>
3316
3317 !! end
3318
3319 !! test
3320 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3321 !! wikitext
3322 <ul><li>
3323 ; term : description
3324 * unordered
3325 </li></ul>
3326 !! html
3327 <ul><li>
3328 <dl><dt> term&#160;</dt>
3329 <dd> description</dd></dl>
3330 <ul><li> unordered</li></ul>
3331 </li></ul>
3332
3333 !! end
3334
3335 !! test
3336
3337 Definition list with empty definition and following paragraph
3338 !! wikitext
3339 ; term:
3340 Paragraph text
3341 !! html
3342 <dl><dt> term</dt>
3343 <dd></dd></dl>
3344 <p>Paragraph text
3345 </p>
3346 !! end
3347
3348 !! test
3349 Nested definition lists using html syntax
3350 !! wikitext
3351 <dl><dt>x</dt>
3352 <dd>a</dd>
3353 <dd>b</dd></dl>
3354
3355 !! end
3356
3357 !! test
3358 Definition Lists: No nesting: Multiple dd's
3359 !! wikitext
3360 ;x
3361 :a
3362 :b
3363 !! html
3364 <dl><dt>x</dt>
3365 <dd>a</dd>
3366 <dd>b</dd></dl>
3367
3368 !! end
3369
3370 !! test
3371 Definition Lists: Indentation: Regular
3372 !! wikitext
3373 :i1
3374 ::i2
3375 :::i3
3376 !! html
3377 <dl><dd>i1
3378 <dl><dd>i2
3379 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3380
3381 !! end
3382
3383 !! test
3384 Definition Lists: Indentation: Missing 1st level
3385 !! wikitext
3386 ::i2
3387 :::i3
3388 !! html
3389 <dl><dd><dl><dd>i2
3390 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3391
3392 !! end
3393
3394 !! test
3395 Definition Lists: Indentation: Multi-level indent
3396 !! wikitext
3397 :::i3
3398 !! html
3399 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3400
3401 !! end
3402
3403 !! test
3404 Definition Lists: Hacky use to indent tables
3405 !! wikitext
3406 ::{|
3407 |foo
3408 |bar
3409 |}
3410 this text
3411 should be left alone
3412 !! html
3413 <dl><dd><dl><dd><table>
3414 <tr>
3415 <td>foo
3416 </td>
3417 <td>bar
3418 </td></tr></table></dd></dl></dd></dl>
3419 <p>this text
3420 should be left alone
3421 </p>
3422 !! end
3423
3424 !! test
3425 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3426 !! wikitext
3427 <!-- foo -->
3428 ::{|
3429 |foo
3430 |bar
3431 |}<!-- bar -->
3432 this text
3433 should be left alone
3434 !! html/parsoid
3435 <!-- foo -->
3436 <dl><dd><dl><dd><table><tr>
3437 <td>foo</td>
3438 <td>bar</td>
3439 </tr></table><!-- bar --></dd></dl></dd></dl>
3440 <p>this text
3441 should be left alone</p>
3442 !! end
3443
3444 !! test
3445 Definition Lists: Hacky use to indent tables, with comment before table
3446 !! wikitext
3447 ::<!-- foo -->{|
3448 |foo
3449 |}
3450 !! html/parsoid
3451 <dl><dd><dl><dd><!-- foo --><table><tr>
3452 <td>foo</td>
3453 </tr></table></dd></dl></dd></dl>
3454 !! end
3455
3456 # Bug 52473
3457 !! test
3458 Definition Lists: Hacky use to indent tables (WS-insensitive)
3459 !! options
3460 parsoid
3461 !! wikitext
3462 : {|
3463 |a
3464 |}
3465 !! html
3466 <dl>
3467 <dd> <table><tr><td>a</td></tr></table> </dd>
3468 </dl>
3469 !! end
3470 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3471 ## as an empty dt item. It also ignores all but the last ";" when followed
3472 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3473 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3474 ## ";"s.
3475 ##
3476 ## Ex: ";;t2 ::d2" is transformed into:
3477 ##
3478 ## <dl>
3479 ## <dt>t2 </dt>
3480 ## <dd>
3481 ## <dl>
3482 ## <dt></dt>
3483 ## <dd>d2</dd>
3484 ## </dl>
3485 ## </dd>
3486 ## </dl>
3487 ##
3488 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3489 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3490 ##
3491 ## <dl>
3492 ## <dt>
3493 ## <dl>
3494 ## <dt>t2 </dt>
3495 ## <dd>:d2</dd>
3496 ## </dl>
3497 ## </dt>
3498 ## </dl>
3499 ##
3500 ## All Parsoid only definition list tests have this difference.
3501 ##
3502 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3503 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3504
3505 !! test
3506 Table / list interaction: indented table with lists in table contents
3507 !! wikitext
3508 :{|
3509 |-
3510 | a
3511 * b
3512 |-
3513 | c
3514 * d
3515 |}
3516 !! html
3517 <dl><dd><table>
3518
3519 <tr>
3520 <td> a
3521 <ul><li> b</li></ul>
3522 </td></tr>
3523 <tr>
3524 <td> c
3525 <ul><li> d</li></ul>
3526 </td></tr></table></dd></dl>
3527
3528 !! end
3529
3530 !!test
3531 Table / list interaction: lists nested in tables nested in indented lists
3532 !! wikitext
3533 :{|
3534 |
3535 :a
3536 :b
3537 |
3538 *c
3539 *d
3540 |}
3541
3542 *e
3543 *f
3544 !! html
3545 <dl><dd><table>
3546 <tr>
3547 <td>
3548 <dl><dd>a</dd>
3549 <dd>b</dd></dl>
3550 </td>
3551 <td>
3552 <ul><li>c</li>
3553 <li>d</li></ul>
3554 </td></tr></table></dd></dl>
3555 <ul><li>e</li>
3556 <li>f</li></ul>
3557
3558 !!end
3559
3560 !! test
3561 Definition Lists: Nesting: Multi-level (Parsoid only)
3562 !! options
3563 parsoid
3564 !! wikitext
3565 ;t1 :d1
3566 ;;t2 ::d2
3567 ;;;t3 :::d3
3568 !! html
3569 <dl>
3570 <dt>t1 </dt>
3571 <dd>d1</dd>
3572 <dt>
3573 <dl>
3574 <dt>t2 </dt>
3575 <dd>:d2</dd>
3576 <dt>
3577 <dl>
3578 <dt>t3 </dt>
3579 <dd>::d3</dd>
3580 </dl>
3581 </dt>
3582 </dl>
3583 </dt>
3584 </dl>
3585
3586
3587 !! end
3588
3589
3590 !! test
3591 Definition Lists: Nesting: Test 2 (Parsoid only)
3592 !! options
3593 parsoid
3594 !! wikitext
3595 ;t1
3596 ::d2
3597 !! html
3598 <dl>
3599 <dt>t1</dt>
3600 <dd>
3601 <dl>
3602 <dd>d2</dd>
3603 </dl>
3604 </dd>
3605 </dl>
3606
3607 !! end
3608
3609
3610 !! test
3611 Definition Lists: Nesting: Test 3 (Parsoid only)
3612 !! options
3613 parsoid
3614 !! wikitext
3615 :;t1
3616 ::::d2
3617 !! html
3618 <dl>
3619 <dd>
3620 <dl>
3621 <dt>t1</dt>
3622 <dd>
3623 <dl>
3624 <dd>
3625 <dl>
3626 <dd>d2</dd>
3627 </dl>
3628 </dd>
3629 </dl>
3630 </dd>
3631 </dl>
3632 </dd>
3633 </dl>
3634
3635 !! end
3636
3637
3638 !! test
3639 Definition Lists: Nesting: Test 4
3640 !! wikitext
3641 ::;t3
3642 :::d3
3643 !! html
3644 <dl><dd><dl><dd><dl><dt>t3</dt>
3645 <dd>d3</dd></dl></dd></dl></dd></dl>
3646
3647 !! end
3648
3649
3650 ## The Parsoid team believes the following three test exposes a
3651 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3652 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3653 ## It also exposes a "misfeature" in tidy, which doesn't like
3654 ## <dl> tags with a single <dt> child; it converts the <dt> into
3655 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3656 !! test
3657 Definition Lists: Mixed Lists: Test 1
3658 !! wikitext
3659 :;* foo
3660 ::* bar
3661 :; baz
3662 !! html/php
3663 <dl><dd><dl><dt><ul><li> foo</li>
3664 <li> bar</li></ul></dt></dl>
3665 <dl><dt> baz</dt></dl></dd></dl>
3666
3667 !! html/php+tidy
3668 <dl>
3669 <dd>
3670 <dl>
3671 <dd>
3672 <ul>
3673 <li>foo</li>
3674 <li>bar</li>
3675 </ul>
3676 </dd>
3677 </dl>
3678 <dl>
3679 <dt>baz</dt>
3680 </dl>
3681 </dd>
3682 </dl>
3683 !! html/parsoid
3684 <dl>
3685 <dd><dl>
3686 <dt><ul>
3687 <li> foo
3688 </li>
3689 </ul></dt>
3690 <dd><ul>
3691 <li> bar
3692 </li>
3693 </ul></dd>
3694 <dt> baz</dt>
3695 </dl></dd>
3696 </dl>
3697 !! end
3698
3699 !! test
3700 Definition Lists: Mixed Lists: Test 2
3701 !! wikitext
3702 *: d1
3703 *: d2
3704 !! html
3705 <ul><li><dl><dd> d1</dd>
3706 <dd> d2</dd></dl></li></ul>
3707
3708 !! end
3709
3710
3711 !! test
3712 Definition Lists: Mixed Lists: Test 3
3713 !! wikitext
3714 *::: d1
3715 *::: d2
3716 !! html
3717 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3718 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3719
3720 !! end
3721
3722
3723 !! test
3724 Definition Lists: Mixed Lists: Test 4
3725 !! wikitext
3726 *;d1 :d2
3727 *;d3 :d4
3728 !! html
3729 <ul><li><dl><dt>d1&#160;</dt>
3730 <dd>d2</dd>
3731 <dt>d3&#160;</dt>
3732 <dd>d4</dd></dl></li></ul>
3733
3734 !! end
3735
3736
3737 !! test
3738 Definition Lists: Mixed Lists: Test 5
3739 !! wikitext
3740 *:d1
3741 *:: d2
3742 !! html
3743 <ul><li><dl><dd>d1
3744 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3745
3746 !! end
3747
3748
3749 !! test
3750 Definition Lists: Mixed Lists: Test 6
3751 !! wikitext
3752 #*:d1
3753 #*::: d3
3754 !! html
3755 <ol><li><ul><li><dl><dd>d1
3756 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3757
3758 !! end
3759
3760
3761 !! test
3762 Definition Lists: Mixed Lists: Test 7
3763 !! wikitext
3764 :* d1
3765 :* d2
3766 !! html
3767 <dl><dd><ul><li> d1</li>
3768 <li> d2</li></ul></dd></dl>
3769
3770 !! end
3771
3772
3773 !! test
3774 Definition Lists: Mixed Lists: Test 8
3775 !! wikitext
3776 :* d1
3777 ::* d2
3778 !! html
3779 <dl><dd><ul><li> d1</li></ul>
3780 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3781
3782 !! end
3783
3784
3785 !! test
3786 Definition Lists: Mixed Lists: Test 9
3787 !! wikitext
3788 *;foo :bar
3789 !! html
3790 <ul><li><dl><dt>foo&#160;</dt>
3791 <dd>bar</dd></dl></li></ul>
3792
3793 !! end
3794
3795
3796 !! test
3797 Definition Lists: Mixed Lists: Test 10
3798 !! wikitext
3799 *#;foo :bar
3800 !! html
3801 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3802 <dd>bar</dd></dl></li></ol></li></ul>
3803
3804 !! end
3805
3806 # The Parsoid team disagrees with the PHP parser's seemingly-random
3807 # rules regarding dd/dt on the next two tests. Parsoid is more
3808 # consistent, and recognizes the shared nesting and keeps the
3809 # still-open tags around until the nesting is complete.
3810 # (And tidy again converts <dt> to <dd> before 'bar'.)
3811
3812 !! test
3813 Definition Lists: Mixed Lists: Test 11
3814 !! wikitext
3815 *#*#;*;;foo :bar
3816 *#*#;boo :baz
3817 !! html/php
3818 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3819 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3820 <dl><dt>boo&#160;</dt>
3821 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3822
3823 !! html/php+tidy
3824 <ul>
3825 <li>
3826 <ol>
3827 <li>
3828 <ul>
3829 <li>
3830 <ol>
3831 <li>
3832 <dl>
3833 <dt>foo&#160;</dt>
3834 <dd>
3835 <ul>
3836 <li>
3837 <dl>
3838 <dd>
3839 <dl>
3840 <dt>bar</dt>
3841 </dl>
3842 </dd>
3843 </dl>
3844 </li>
3845 </ul>
3846 </dd>
3847 </dl>
3848 <dl>
3849 <dt>boo&#160;</dt>
3850 <dd>baz</dd>
3851 </dl>
3852 </li>
3853 </ol>
3854 </li>
3855 </ul>
3856 </li>
3857 </ol>
3858 </li>
3859 </ul>
3860 !! html/parsoid
3861 <ul>
3862 <li>
3863 <ol>
3864 <li>
3865 <ul>
3866 <li>
3867 <ol>
3868 <li>
3869 <dl>
3870 <dt>
3871 <ul>
3872 <li>
3873 <dl>
3874 <dt>
3875 <dl>
3876 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3877 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3878 </dl></dt>
3879 </dl></li>
3880 </ul></dt>
3881 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3882 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3883 </dl></li>
3884 </ol></li>
3885 </ul></li>
3886 </ol></li>
3887 </ul>
3888 !! end
3889
3890
3891 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3892 !! test
3893 Definition Lists: Weird Ones: Test 1
3894 !! wikitext
3895 *#;*::;; foo : bar (who uses this?)
3896 !! html/php
3897 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3898 <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>
3899
3900 !! html/php+tidy
3901 <ul>
3902 <li>
3903 <ol>
3904 <li>
3905 <dl>
3906 <dt>foo&#160;</dt>
3907 <dd>
3908 <ul>
3909 <li>
3910 <dl>
3911 <dd>
3912 <dl>
3913 <dd>
3914 <dl>
3915 <dd>
3916 <dl>
3917 <dt>bar (who uses this?)</dt>
3918 </dl>
3919 </dd>
3920 </dl>
3921 </dd>
3922 </dl>
3923 </dd>
3924 </dl>
3925 </li>
3926 </ul>
3927 </dd>
3928 </dl>
3929 </li>
3930 </ol>
3931 </li>
3932 </ul>
3933 !! html/parsoid
3934 <ul>
3935 <li>
3936 <ol>
3937 <li>
3938 <dl>
3939 <dt>
3940 <ul>
3941 <li>
3942 <dl>
3943 <dd>
3944 <dl>
3945 <dd>
3946 <dl>
3947 <dt>
3948 <dl>
3949 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
3950 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3951 </dl></dt>
3952 </dl></dd>
3953 </dl></dd>
3954 </dl></li>
3955 </ul></dt>
3956 </dl></li>
3957 </ol></li>
3958 </ul>
3959 !! end
3960
3961 !! test
3962 Definition Lists: colons occurring in tags
3963 !! wikitext
3964 ;a:b
3965 ;'''a:b'''
3966 ;<i>a:b</i>
3967 ;<span>a:b</span>
3968 ;<div>a:b</div>
3969 ;<div>a
3970 :b</div>
3971 ;{{echo|a:b}}
3972 ;{{echo|''a:b''}}
3973 !! html+tidy
3974 <dl>
3975 <dt>a</dt>
3976 <dd>b</dd>
3977 <dt><b>a:b</b></dt>
3978 <dt><i>a:b</i></dt>
3979 <dt><span>a:b</span></dt>
3980 <dd>
3981 <div>a:b</div>
3982 </dd>
3983 <dd>
3984 <div>a
3985 <dl>
3986 <dd>b</dd>
3987 </dl>
3988 </div>
3989 </dd>
3990 <dt>a</dt>
3991 <dd>b</dd>
3992 <dt><i>a:b</i></dt>
3993 </dl>
3994 !! end
3995
3996 !! test
3997 Definition Lists: colons and tables 1
3998 !! wikitext
3999 :{|
4000 | x
4001 |}
4002 :{|
4003 | y
4004 |}
4005 !! html
4006 <dl><dd><table>
4007 <tr>
4008 <td> x
4009 </td></tr></table></dd></dl>
4010 <dl><dd><table>
4011 <tr>
4012 <td> y
4013 </td></tr></table></dd></dl>
4014
4015 !! end
4016
4017 # Parsoid's output (as documented below) differs from php's in this case.
4018 # This is probably a bug. If we fixup parsoid to match php's output, the
4019 # above test should pass and the below test case can be removed. It is
4020 # unclear which output is more desirable.
4021
4022 !! test
4023 Definition Lists: colons and tables 2
4024 !! wikitext
4025 :{|
4026 | x
4027 |}
4028 :{|
4029 | y
4030 |}
4031 !! html/parsoid
4032 <dl><dd><table>
4033 <tr>
4034 <td> x
4035 </td></tr></table></dd>
4036 <dd><table>
4037 <tr>
4038 <td> y
4039 </td></tr></table></dd></dl>
4040 !! end
4041
4042
4043 ###
4044 ### External links
4045 ###
4046 !! test
4047 External links: non-bracketed
4048 !! wikitext
4049 Non-bracketed: http://example.com
4050 !! html
4051 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4052 </p>
4053 !! end
4054
4055 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4056 !! test
4057 External links: numbered
4058 !! wikitext
4059 Numbered: [http://example.com]
4060 Numbered: [http://example.net]
4061 Numbered: [http://example.com]
4062 !! html/php
4063 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4064 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4065 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4066 </p>
4067 !! html/parsoid
4068 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4069 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4070 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4071 !!end
4072
4073 !! test
4074 External links: specified text
4075 !! wikitext
4076 Specified text: [http://example.com link]
4077 !! html
4078 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4079 </p>
4080 !!end
4081
4082 !! test
4083 External links: trail
4084 !! wikitext
4085 Linktrails should not work for external links: [http://example.com link]s
4086 !! html
4087 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4088 </p>
4089 !! end
4090
4091 !! test
4092 External links: dollar sign in URL
4093 !! wikitext
4094 http://example.com/1$2345
4095 !! html
4096 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4097 </p>
4098 !! end
4099
4100 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4101 !! test
4102 External links: dollar sign in URL (autonumber)
4103 !! wikitext
4104 [http://example.com/1$2345]
4105 !! html/php
4106 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4107 </p>
4108 !! html/parsoid
4109 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4110 !!end
4111
4112 !! test
4113 External links: open square bracket forbidden in URL (bug 4377)
4114 !! options
4115 parsoid=wt2html,wt2wt,html2html
4116 !! wikitext
4117 http://example.com/1[2345
4118 !! html/php
4119 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4120 </p>
4121 !! html/parsoid
4122 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4123 !! end
4124
4125 !! test
4126 External links: open square bracket forbidden in URL (named) (bug 4377)
4127 !! options
4128 parsoid=wt2html,html2html
4129 !! wikitext
4130 [http://example.com/1[2345]
4131 !! html/php
4132 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4133 </p>
4134 !! html/parsoid
4135 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4136 !!end
4137
4138 # parsoid adds a space before the link name
4139 !! test
4140 External links: open square bracket forbidden in URL (named) (bug 4377)
4141 Parsoid variant.
4142 !! wikitext
4143 [http://example.com/1 [2345]
4144 !! html
4145 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4146 </p>
4147 !!end
4148
4149 !! test
4150 External links: nowiki in URL link text (bug 6230)
4151 !! wikitext
4152 [http://example.com/ <nowiki>''example site''</nowiki>]
4153 !! html
4154 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4155 </p>
4156 !! end
4157
4158 !! test
4159 External links: newline forbidden in text (bug 6230 regression check)
4160 !! wikitext
4161 [http://example.com/ first
4162 second]
4163 !! html
4164 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4165 second]
4166 </p>
4167 !!end
4168
4169 !! test
4170 External links: Pipe char between url and text
4171 !! wikitext
4172 [http://example.com | link]
4173 !! html
4174 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4175 </p>
4176 !!end
4177
4178 !! test
4179 External links: protocol-relative URL in brackets
4180 !! wikitext
4181 [//example.com/ Test]
4182 !! html
4183 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4184 </p>
4185 !! end
4186
4187 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4188 !! test
4189 External links: protocol-relative URL in brackets without text
4190 !! wikitext
4191 [//example.com]
4192 !! html/php
4193 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4194 </p>
4195 !! html/parsoid
4196 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4197 !! end
4198
4199 !! test
4200 External links: protocol-relative URL in free text is left alone
4201 !! wikitext
4202 //example.com/Foo
4203 !! html
4204 <p>//example.com/Foo
4205 </p>
4206 !!end
4207
4208 !! test
4209 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4210 !! wikitext
4211 foo//example.com/Foo
4212 !! html
4213 <p>foo//example.com/Foo
4214 </p>
4215 !! end
4216
4217 !! test
4218 External links: with no contents
4219 !! wikitext
4220 [http://en.wikipedia.org/wiki/Foo]
4221
4222 [[wikipedia:Foo|Bar]]
4223
4224 [[wikipedia:Foo|<span>Bar</span>]]
4225 !! html/php
4226 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4227 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4228 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4229 </p>
4230 !! html/parsoid
4231 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4232 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4233 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4234 !! end
4235
4236 !! test
4237 External links: Free with trailing punctuation
4238 !! wikitext
4239 http://example.com,
4240 http://example.com;
4241 http://example.com\
4242 http://example.com.
4243 http://example.com:
4244 http://example.com!
4245 http://example.com?
4246 http://example.com)
4247 http://example.com/url_with_(brackets)
4248 (http://example.com/url_without_brackets)
4249 http://example.com/url_with_entity&nbsp;
4250 http://example.com/url_with_entity&#xA0;
4251 http://example.com/url_with_entity&#160;
4252 http://example.com/url_with_entity&lt;
4253 http://example.com/url_with_entity&#x3C;
4254 http://example.com/url_with_entity&#60;
4255 !! html/php
4256 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4257 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4258 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4259 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4260 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4261 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4262 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4263 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4264 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4265 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4266 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4267 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4268 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4269 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4270 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4271 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4272 </p>
4273 !! html/parsoid
4274 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4275 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4276 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4277 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4278 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4279 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4280 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4281 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4282 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4283 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4284 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4285 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4286 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4287 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4288 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4289 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4290 !! end
4291
4292 !! test
4293 External links: No preceding word characters allowed (bug 65278)
4294 !! wikitext
4295 NOPEhttp://example.com
4296 N0http://example.com
4297 ok:http://example.com
4298 ok-http://example.com
4299 !! html
4300 <p>NOPEhttp://example.com
4301 N0http://example.com
4302 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4303 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4304 </p>
4305 !! end
4306
4307 !! test
4308 External image
4309 !! wikitext
4310 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4311 !! html
4312 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4313 </p>
4314 !! end
4315
4316 !! test
4317 External image from https
4318 !! wikitext
4319 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4320 !! html
4321 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4322 </p>
4323 !! end
4324
4325 !! test
4326 External image (when not allowed)
4327 !! options
4328 wgAllowExternalImages=0
4329 !! wikitext
4330 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4331 !! html
4332 <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>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Link to non-http image, no img tag
4338 !! wikitext
4339 Link to non-http image, no img tag: ftp://example.com/test.jpg
4340 !! html
4341 <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>
4342 </p>
4343 !! end
4344
4345 !! test
4346 External links: terminating separator
4347 !! wikitext
4348 Terminating separator: http://example.com/thing,
4349 !! html
4350 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4351 </p>
4352 !! end
4353
4354 !! test
4355 External links: intervening separator
4356 !! wikitext
4357 Intervening separator: http://example.com/1,2,3
4358 !! html
4359 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4360 </p>
4361 !! end
4362
4363 !! test
4364 External links: old bug with URL in query
4365 !! wikitext
4366 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4367 !! html
4368 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4369 </p>
4370 !! end
4371
4372 !! test
4373 External links: old URL-in-URL bug, mixed protocols
4374 !! wikitext
4375 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4376 !! html
4377 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4378 </p>
4379 !!end
4380
4381 !! test
4382 External links: URL in text
4383 !! wikitext
4384 URL in text: [http://example.com http://example.com]
4385 !! html
4386 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4387 </p>
4388 !! end
4389
4390 !! test
4391 External links: Clickable images
4392 !! wikitext
4393 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4394 !! html/php
4395 <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>
4396 </p>
4397 !! html/parsoid
4398 <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>
4399 !! end
4400
4401 !! test
4402 External links: raw ampersand
4403 !! wikitext
4404 Old &amp; use: http://x&y
4405 !! html
4406 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4407 </p>
4408 !! end
4409
4410 !! test
4411 External links: encoded ampersand
4412 !! wikitext
4413 Old &amp; use: http://x&amp;y
4414 !! html/php
4415 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4416 </p>
4417 !! html/parsoid
4418 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4419 !! end
4420
4421 !! test
4422 External links: encoded equals (bug 6102)
4423 !! wikitext
4424 http://example.com/?foo&#61;bar
4425 !! html/php
4426 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4427 </p>
4428 !! html/parsoid
4429 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4430 !! end
4431
4432 ##
4433 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4434 ## does it number them. As discussed in bug 53505, we can identify
4435 ## autonumbered links via CSS.
4436 ##
4437
4438 !! test
4439 External links: [raw ampersand]
4440 !! wikitext
4441 Old &amp; use: [http://x&y]
4442 !! html/php
4443 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4447 !! end
4448
4449 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4450 # mode will return the [raw ampersand] wikitext
4451 !! test
4452 External links: [encoded ampersand]
4453 !! options
4454 parsoid=wt2html,wt2wt,html2html
4455 !! wikitext
4456 Old &amp; use: [http://x&amp;y]
4457 !! html/php
4458 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4459 </p>
4460 !! html/parsoid
4461 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4462 !! end
4463
4464 !! test
4465 External links: [raw equals]
4466 !! wikitext
4467 [http://example.com/?foo=bar]
4468 !! html/php
4469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4470 </p>
4471 !! html/parsoid
4472 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4473 !! end
4474
4475 # note that parsoid html is identical to [raw equals] case; so html2wt
4476 # mode will return the [raw equals] wikitext
4477 !! test
4478 External links: [encoded equals] (bug 6102)
4479 !! options
4480 parsoid=wt2html,wt2wt,html2html
4481 !! wikitext
4482 [http://example.com/?foo&#61;bar]
4483 !! html/php
4484 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4485 </p>
4486 !! html/parsoid
4487 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4488 !! end
4489
4490 # xxx parsoid strips the IDN character, so the round-trip tests will
4491 # obviously fail and are disabled. --cscott
4492 !! test
4493 External links: [IDN ignored character reference in hostname; strip it right off]
4494 !! options
4495 parsoid=wt2html,wt2wt,html2html
4496 !! wikitext
4497 [http://e&zwnj;xample.com/]
4498 !! html/php
4499 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4500 </p>
4501 !! html/parsoid
4502 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4503 !! end
4504
4505 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4506 # Where an external link could easily circumvent the sanitization of the text of
4507 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4508 # test demands a higher standard. That's a bit strange.
4509 #
4510 # Example:
4511 #
4512 # http://e‌xample.com -> [http://example.com|http://example.com]
4513 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4514 #
4515 # The first example is sanitized, but the second is not. Any security benefits
4516 # from this production are trivial to circumvent. Either remove this test and
4517 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4518 # the test accordingly.
4519 #
4520 # All our love,
4521 # The Parsoid team.
4522 # xxx parsoid strips the IDN character, so the round-trip tests will
4523 # obviously fail and are disabled. --cscott
4524 !! test
4525 External links: IDN ignored character reference in hostname; strip it right off
4526 !! options
4527 parsoid=wt2html,html2html
4528 !! wikitext
4529 http://e&zwnj;xample.com/
4530 !! html/php
4531 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4532 </p>
4533 !! html/parsoid
4534 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4535 !! end
4536
4537 !! test
4538 External links: www.jpeg.org (bug 554)
4539 !! wikitext
4540 http://www.jpeg.org
4541 !! html
4542 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4543 </p>
4544 !! end
4545
4546 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4547 !! test
4548 External links: URL within URL (original bug 2)
4549 !! wikitext
4550 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4551 !! html/php
4552 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4553 </p>
4554 !! html/parsoid
4555 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4556 !! end
4557
4558 !! test
4559 BUG 361: URL inside bracketed URL
4560 !! wikitext
4561 [http://www.example.com/foo http://www.example.com/bar]
4562 !! html
4563 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4564 </p>
4565 !! end
4566
4567 !! test
4568 BUG 361: URL within URL, not bracketed
4569 !! wikitext
4570 http://www.example.com/foo?=http://www.example.com/bar
4571 !! html
4572 <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>
4573 </p>
4574 !! end
4575
4576 !! test
4577 BUG 289: ">"-token in URL-tail
4578 !! wikitext
4579 http://www.example.com/<hello>
4580 !! html
4581 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4582 </p>
4583 !!end
4584
4585 !! test
4586 BUG 289: literal ">"-token in URL-tail
4587 !! wikitext
4588 http://www.example.com/<b>html</b>
4589 !! html/php
4590 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4591 </p>
4592 !! html/parsoid
4593 <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>
4594 !! end
4595
4596 !! test
4597 BUG 289: ">"-token in bracketed URL
4598 !! wikitext
4599 [http://www.example.com/<hello> stuff]
4600 !! html
4601 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4602 </p>
4603 !!end
4604
4605 !! test
4606 BUG 289: literal ">"-token in bracketed URL
4607 !! wikitext
4608 [http://www.example.com/<b>html</b> stuff]
4609 !! html
4610 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4611 </p>
4612 !!end
4613
4614 !! test
4615 BUG 289: literal double quote at end of URL
4616 !! wikitext
4617 http://www.example.com/"hello"
4618 !! html
4619 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4620 </p>
4621 !!end
4622
4623 !! test
4624 BUG 289: literal double quote in bracketed URL
4625 !! wikitext
4626 [http://www.example.com/"hello" stuff]
4627 !! html
4628 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4629 </p>
4630 !!end
4631
4632 !! test
4633 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4634 !! wikitext
4635 [http://www.example.com test]
4636 !! html
4637 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4638 </p>
4639 !! end
4640
4641 !! test
4642 External links: link text with spaces
4643 !! wikitext
4644 [http://www.example.com a b c]
4645 [http://www.example.com ''a'' ''b'']
4646 !! html
4647 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4648 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4649 </p>
4650 !! end
4651
4652 !! test
4653 External links: wiki links within external link (Bug 3695)
4654 !! wikitext
4655 [http://example.com [[wikilink]] embedded in ext link]
4656 !! html/php
4657 <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>
4658 </p>
4659 !! html/parsoid
4660 <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>
4661 !! end
4662
4663 !! test
4664 BUG 787: Links with one slash after the url protocol are invalid
4665 !! wikitext
4666 http:/example.com
4667
4668 [http:/example.com title]
4669 !! html
4670 <p>http:/example.com
4671 </p><p>[http:/example.com title]
4672 </p>
4673 !! end
4674
4675 !! test
4676 Bracketed external links with template-generated invalid target
4677 !! wikitext
4678 [{{echo|http:/example.com}} title]
4679 !! html
4680 <p>[http:/example.com title]
4681 </p>
4682 !! end
4683
4684 !! test
4685 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4686 !! wikitext
4687 ''[http://example.com text'']
4688 [http://example.com '''text]'''
4689 ''Something [http://example.com in italic'']
4690 ''Something [http://example.com mixed''''', even bold]'''
4691 '''''Now [http://example.com both''''']
4692 !! html
4693 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4694 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4695 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4696 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4697 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4698 </p>
4699 !! end
4700
4701
4702 !! test
4703 Bug 4781: %26 in URL
4704 !! wikitext
4705 http://www.example.com/?title=AT%26T
4706 !! html/php
4707 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4708 </p>
4709 !! html/parsoid
4710 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4711 !! end
4712
4713 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4714 # % is actually legal in HTML5. Any change in output would need testing though.
4715 !! test
4716 Bug 4781, 5267: %25 in URL
4717 !! wikitext
4718 http://www.example.com/?title=100%25_Bran
4719 !! html/php
4720 <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>
4721 </p>
4722 !! html/parsoid
4723 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4724 !! end
4725
4726 !! test
4727 Bug 4781, 5267: %28, %29 in URL
4728 !! wikitext
4729 http://www.example.com/?title=Ben-Hur_%281959_film%29
4730 !! html/php
4731 <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>
4732 </p>
4733 !! html/parsoid
4734 <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>
4735 !! end
4736
4737
4738 !! test
4739 Bug 4781: %26 in autonumber URL
4740 !! wikitext
4741 [http://www.example.com/?title=AT%26T]
4742 !! html/php
4743 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4744 </p>
4745 !! html/parsoid
4746 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4747 !! end
4748
4749 !! test
4750 Bug 4781, 5267: %26 in autonumber URL
4751 !! wikitext
4752 [http://www.example.com/?title=100%25_Bran]
4753 !! html/php
4754 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4755 </p>
4756 !! html/parsoid
4757 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4758 !! end
4759
4760 !! test
4761 Bug 4781, 5267: %28, %29 in autonumber URL
4762 !! wikitext
4763 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4764 !! html/php
4765 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4766 </p>
4767 !! html/parsoid
4768 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4769 !! end
4770
4771
4772 !! test
4773 Bug 4781: %26 in bracketed URL
4774 !! wikitext
4775 [http://www.example.com/?title=AT%26T link]
4776 !! html/php
4777 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4778 </p>
4779 !! html/parsoid
4780 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4781 !! end
4782
4783 !! test
4784 Bug 4781, 5267: %25 in bracketed URL
4785 !! wikitext
4786 [http://www.example.com/?title=100%25_Bran link]
4787 !! html
4788 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4789 </p>
4790 !! end
4791
4792 !! test
4793 Bug 4781, 5267: %28, %29 in bracketed URL
4794 !! wikitext
4795 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4796 !! html/php
4797 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4798 </p>
4799 !! html/parsoid
4800 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4801 !! end
4802
4803 !! test
4804 External link containing a period in the anchor. (bug 63947)
4805 !! wikitext
4806 [//foo.org/bar#baz. bang]
4807
4808 [//foo.org/bar. bang]
4809 !! html/php
4810 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4811 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4812 </p>
4813 !! html/parsoid
4814 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4815 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4816 !! end
4817
4818 !! test
4819 External link containing a single quote. (bug 63947)
4820 !! wikitext
4821 [//foo.org/bar'baz]
4822
4823 [//foo.org/bar'baz bang]
4824 !! html/php
4825 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4826 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4827 </p>
4828 !! html/parsoid
4829 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4830 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4831 !! end
4832
4833
4834 !! test
4835 External link containing a period in the anchor. (bug 63947)
4836 !! wikitext
4837 [//foo.org/bar#baz. bang]
4838
4839 [//foo.org/bar. bang]
4840 !! html/php
4841 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4842 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4843 </p>
4844 !! html/parsoid
4845 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4846 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4847 !! end
4848
4849 !! test
4850 External link containing a single quote. (bug 63947)
4851 !! wikitext
4852 [//foo.org/bar'baz]
4853
4854 [//foo.org/bar'baz bang]
4855 !! html/php
4856 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4857 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4858 </p>
4859 !! html/parsoid
4860 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4861 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4862 !! end
4863
4864
4865 !! test
4866 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4867 !! wikitext
4868 Some [http://example.com/ pretty ''italics'' and stuff]!
4869 !! html
4870 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4871 </p>
4872 !! end
4873
4874 !! test
4875 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4876 !! wikitext
4877 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4878 !! html
4879 <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>
4880 </p>
4881 !! end
4882
4883 !! test
4884 External link containing double-single-quotes with no space separating the url from text in italics
4885 !! wikitext
4886 [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]].]
4887 !! html/php
4888 <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>
4889 </p>
4890 !! html/php+tidy
4891 <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>
4892 !! html/parsoid
4893 <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>
4894 !! end
4895
4896 !! test
4897 External link with comments in link text
4898 !! wikitext
4899 [http://www.google.com Google <!-- comment -->]
4900 !! html
4901 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4902 </p>
4903 !! end
4904
4905 !! test
4906 URL-encoding in URL functions (single parameter)
4907 !! wikitext
4908 {{localurl:Some page|amp=&}}
4909 !! html
4910 <p>/index.php?title=Some_page&amp;amp=&amp;
4911 </p>
4912 !! end
4913
4914 !! test
4915 URL-encoding in URL functions (multiple parameters)
4916 !! wikitext
4917 {{localurl:Some page|q=?&amp=&}}
4918 !! html
4919 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4920 </p>
4921 !! end
4922
4923 !! test
4924 Brackets in urls
4925 !! wikitext
4926 http://example.com/index.php?foozoid%5B%5D=bar
4927
4928 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4929 !! html/php
4930 <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>
4931 </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>
4932 </p>
4933 !! html/parsoid
4934 <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>
4935
4936 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4937 !! end
4938
4939 !! test
4940 IPv6 urls (bug 21261)
4941 !! options
4942 disabled
4943 !! wikitext
4944 http://[2404:130:0:1000::187:2]/index.php
4945 !! html
4946 <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>
4947 </p>
4948 !! end
4949
4950 !! test
4951 Non-extlinks in brackets
4952 !! wikitext
4953 [foo]
4954 [foo bar]
4955 [foo ''bar'']
4956 [fool's] errand
4957 [fool's errand]
4958 [{{echo|foo}}]
4959 [{{echo|foo}} bar]
4960 [{{echo|foo}} ''bar'']
4961 [{{echo|foo}}l's] errand
4962 [{{echo|foo}}l's errand]
4963 [url={{echo|foo}}]
4964 [url=http://example.com]
4965 !! html
4966 <p>[foo]
4967 [foo bar]
4968 [foo <i>bar</i>]
4969 [fool's] errand
4970 [fool's errand]
4971 [foo]
4972 [foo bar]
4973 [foo <i>bar</i>]
4974 [fool's] errand
4975 [fool's errand]
4976 [url=foo]
4977 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4978 </p>
4979 !! end
4980
4981 !! test
4982 Percent encoding in external links
4983 !! wikitext
4984 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4985 !! html/php
4986 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink"
4990 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4991 !! end
4992
4993 !! test
4994 Use url link syntax for links where the content is equal the link target
4995 !! wikitext
4996 http://example.com
4997 !! html/php
4998 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4999 </p>
5000 !! html/parsoid
5001 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5002 !! end
5003
5004 !! test
5005 Parenthesis in external links, especially URL links
5006 !! wikitext
5007 http://example.com)
5008
5009 http://example.com/test)
5010
5011 http://example.com/(test)
5012
5013 http://example.com/((test)
5014
5015 (http://example.com/(test))
5016
5017 (http://example.com/(test)))))
5018
5019 http://example.com/a)b
5020
5021 [http://example.com) foo]
5022 !! html/php
5023 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5024 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5025 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5026 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5027 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5028 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5029 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5030 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5031 </p>
5032 !! html/parsoid
5033 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5034 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5035 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5036 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5037 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5038 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5039 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5040 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5041 !! end
5042
5043 !! test
5044 Parenthesis in external links, w/ transclusion or comment
5045 !! wikitext
5046 (http://example.com/{{echo|hi}})
5047
5048 (http://example.com<!-- hi -->)
5049 !! html/php
5050 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5051 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5052 </p>
5053 !! html/parsoid
5054 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5055
5056 <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>
5057 !! end
5058
5059 !! test
5060 Replace invalid link targets when serializing
5061 !! options
5062 parsoid=html2wt
5063 !! html
5064 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5065 !! wikitext
5066 [[MediaWiki:Badtitletext|Manual]]
5067 !! end
5068
5069 ###
5070 ### Quotes
5071 ###
5072
5073 !! test
5074 Quotes
5075 !! wikitext
5076 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5077
5078 Normal text. '''''Bold italic text.''''' Normal text.
5079 !! html
5080 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5081 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5082 </p>
5083 !! end
5084
5085
5086 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5087 # parser strips. The wikitext contains just the first half of the bold
5088 # quote pair.
5089 !! test
5090 Unclosed and unmatched quotes
5091 !! wikitext
5092 '''''Bold italic text '''with bold deactivated''' in between.'''''
5093
5094 '''''Bold italic text ''with italic deactivated'' in between.'''''
5095
5096 '''Bold text..
5097
5098 ..spanning two paragraphs (should not work).'''
5099
5100 '''Bold tag left open
5101
5102 ''Italic tag left open
5103
5104 Normal text.
5105
5106 <!-- Unmatching number of opening, closing tags: -->
5107 '''This year''''s election ''should'' beat '''last year''''s.
5108
5109 ''Tom'''s car is bigger than ''Susan'''s.
5110
5111 Plain ''italic'''s plain
5112 !! html/php
5113 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5114 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5115 </p><p><b>Bold text..</b>
5116 </p><p>..spanning two paragraphs (should not work).
5117 </p><p><b>Bold tag left open</b>
5118 </p><p><i>Italic tag left open</i>
5119 </p><p>Normal text.
5120 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5121 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5122 </p><p>Plain <i>italic'</i>s plain
5123 </p>
5124 !! html/parsoid
5125 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5126 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5127 </p><p><b>Bold text..</b>
5128 </p><p>..spanning two paragraphs (should not work).<b></b>
5129 </p><p><b>Bold tag left open</b>
5130 </p><p><i>Italic tag left open</i>
5131 </p><p>Normal text.
5132 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5133 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5134 </p><p>Plain <i>italic'</i>s plain
5135 </p>
5136 !! end
5137
5138 ###
5139 ### Tables
5140 ###
5141 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5142 ###
5143
5144 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5145 # is the bare minimum required by the spec, see:
5146 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5147 # Parsoid team replies: empty table tags are legal in HTML5
5148 !! test
5149 A table with no data.
5150 !! options
5151 parsoid=wt2html
5152 !! wikitext
5153 {||}
5154 !! html/php
5155
5156 !! html/parsoid
5157 <table></table>
5158
5159 !! end
5160
5161 !! test
5162 A table with stray table end tags on start tag line (wt2html)
5163 !! options
5164 parsoid=wt2html
5165 !! wikitext
5166 {|style="color: red;"|}
5167
5168 {|style="color: red;" |}
5169 |foo
5170 |}
5171
5172 {|style="color: red;"|} id="foo"
5173 |foo
5174 |}
5175
5176 {|style="color: red;" |} id="foo"
5177 |foo
5178 |}
5179 !! html
5180 <table style="color: red;"></table>
5181
5182 <table style="color: red;">
5183 <tbody><tr>
5184 <td>foo</td>
5185 </tr></tbody>
5186 </table>
5187
5188 <table style="color: red;" id="foo">
5189 <tbody><tr>
5190 <td>foo</td>
5191 </tr></tbody>
5192 </table>
5193
5194 <table style="color: red;" id="foo">
5195 <tbody><tr>
5196 <td>foo</td>
5197 </tr></tbody>
5198 </table>
5199
5200 !! end
5201
5202 !! test
5203 A table with no data (take 2)
5204 !! wikitext
5205 {|
5206 |}
5207 !! html/parsoid
5208 <table></table>
5209 !! end
5210
5211 # A table with nothing but a caption is invalid XHTML, we might want to render
5212 # this as <p>caption</p>
5213 # Parsoid team replies: table with only a caption is legal in HTML5
5214 !! test
5215 A table with nothing but a caption
5216 !! wikitext
5217 {|
5218 |+ caption
5219 |}
5220 !! html/php
5221 <table>
5222 <caption> caption
5223 </caption><tr><td></td></tr></table>
5224
5225 !! html/parsoid
5226 <table><caption> caption</caption></table>
5227 !! end
5228
5229 !! test
5230 A table with caption with default-spaced attributes and a table row
5231 !! wikitext
5232 {|
5233 |+ style="color: red;" | caption1
5234 |-
5235 | foo
5236 |}
5237 !! html
5238 <table>
5239 <caption style="color: red;"> caption1
5240 </caption>
5241 <tr>
5242 <td> foo
5243 </td></tr></table>
5244
5245 !! end
5246
5247 !! test
5248 A table with captions with non-default spaced attributes and a table row
5249 !! wikitext
5250 {|
5251 |+style="color: red;"|caption2
5252 |+ style="color: red;"| caption3
5253 |-
5254 | foo
5255 |}
5256 !! html
5257 <table>
5258 <caption style="color: red;">caption2
5259 </caption>
5260 <caption style="color: red;"> caption3
5261 </caption>
5262 <tr>
5263 <td> foo
5264 </td></tr></table>
5265
5266 !! end
5267
5268 !! test
5269 Table td-cell syntax variations
5270 !! wikitext
5271 {|
5272 | foo bar foo | baz
5273 | foo bar foo || baz
5274 | style='color:red;' | baz
5275 | style='color:red;' || baz
5276 |}
5277 !! html
5278 <table>
5279 <tr>
5280 <td> baz
5281 </td>
5282 <td> foo bar foo </td>
5283 <td> baz
5284 </td>
5285 <td style="color:red;"> baz
5286 </td>
5287 <td> style='color:red;' </td>
5288 <td> baz
5289 </td></tr></table>
5290
5291 !! end
5292
5293 !! test
5294 Simple table
5295 !! wikitext
5296 {|
5297 | 1 || 2
5298 |-
5299 | 3 || 4
5300 |}
5301 !! html
5302 <table>
5303 <tr>
5304 <td> 1 </td>
5305 <td> 2
5306 </td></tr>
5307 <tr>
5308 <td> 3 </td>
5309 <td> 4
5310 </td></tr></table>
5311
5312 !! end
5313
5314 !! test
5315 Simple table but with multiple dashes for row wikitext
5316 !! wikitext
5317 {|
5318 | foo
5319 |-----
5320 | bar
5321 |}
5322 !! html
5323 <table>
5324 <tr>
5325 <td> foo
5326 </td></tr>
5327 <tr>
5328 <td> bar
5329 </td></tr></table>
5330
5331 !! end
5332 !! test
5333 Multiplication table
5334 !! wikitext
5335 {| border="1" cellpadding="2"
5336 |+Multiplication table
5337 |-
5338 ! &times; !! 1 !! 2 !! 3
5339 |-
5340 ! 1
5341 | 1 || 2 || 3
5342 |-
5343 ! 2
5344 | 2 || 4 || 6
5345 |-
5346 ! 3
5347 | 3 || 6 || 9
5348 |-
5349 ! 4
5350 | 4 || 8 || 12
5351 |-
5352 ! 5
5353 | 5 || 10 || 15
5354 |}
5355 !! html
5356 <table border="1" cellpadding="2">
5357 <caption>Multiplication table
5358 </caption>
5359 <tr>
5360 <th> &#215; </th>
5361 <th> 1 </th>
5362 <th> 2 </th>
5363 <th> 3
5364 </th></tr>
5365 <tr>
5366 <th> 1
5367 </th>
5368 <td> 1 </td>
5369 <td> 2 </td>
5370 <td> 3
5371 </td></tr>
5372 <tr>
5373 <th> 2
5374 </th>
5375 <td> 2 </td>
5376 <td> 4 </td>
5377 <td> 6
5378 </td></tr>
5379 <tr>
5380 <th> 3
5381 </th>
5382 <td> 3 </td>
5383 <td> 6 </td>
5384 <td> 9
5385 </td></tr>
5386 <tr>
5387 <th> 4
5388 </th>
5389 <td> 4 </td>
5390 <td> 8 </td>
5391 <td> 12
5392 </td></tr>
5393 <tr>
5394 <th> 5
5395 </th>
5396 <td> 5 </td>
5397 <td> 10 </td>
5398 <td> 15
5399 </td></tr></table>
5400
5401 !! end
5402
5403 !! test
5404 Accept "||" in table headings
5405 !! wikitext
5406 {|
5407 !h1 || h2
5408 |}
5409 !! html
5410 <table>
5411 <tr>
5412 <th>h1 </th>
5413 <th> h2
5414 </th></tr></table>
5415
5416 !! end
5417
5418 !! test
5419 Accept "!!" in table data
5420 !! wikitext
5421 {|
5422 | Foo!! ||
5423 |}
5424 !! html
5425 <table>
5426 <tr>
5427 <td> Foo!! </td>
5428 <td>
5429 </td></tr></table>
5430
5431 !! html/parsoid
5432 <table>
5433 <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>
5434 </tbody></table>
5435 !! end
5436
5437 !! test
5438 Accept "||" in indented table headings
5439 !! wikitext
5440 :{|
5441 !h1 || h2
5442 |}
5443 !! html
5444 <dl><dd><table>
5445 <tr>
5446 <th>h1 </th>
5447 <th> h2
5448 </th></tr></table></dd></dl>
5449
5450 !! end
5451
5452 !! test
5453 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5454 !! wikitext
5455 {|
5456 !| h1
5457 || a
5458 |}
5459 !! html
5460 <table>
5461 <tr>
5462 <th> h1
5463 </th>
5464 <td> a
5465 </td></tr></table>
5466
5467 !! end
5468
5469 !!test
5470 Accept "| !" at start of line in tables (ignore !-attribute)
5471 !! wikitext
5472 {|
5473 |-
5474 | !style="color:red" | bar
5475 |}
5476 !! html
5477 <table>
5478
5479 <tr>
5480 <td> bar
5481 </td></tr></table>
5482
5483 !!end
5484
5485 !!test
5486 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 +/-
5487 !! wikitext
5488 {|
5489 |-
5490 |style='color:red;'|+1
5491 |style='color:blue;'|-1
5492 |-
5493 | 1 || 2 || 3
5494 | 1 ||+2 ||-3
5495 |-
5496 | +1
5497 | -1
5498 |}
5499 !! html
5500 <table>
5501
5502 <tr>
5503 <td style="color:red;">+1
5504 </td>
5505 <td style="color:blue;">-1
5506 </td></tr>
5507 <tr>
5508 <td> 1 </td>
5509 <td> 2 </td>
5510 <td> 3
5511 </td>
5512 <td> 1 </td>
5513 <td>+2 </td>
5514 <td>-3
5515 </td></tr>
5516 <tr>
5517 <td> +1
5518 </td>
5519 <td> -1
5520 </td></tr></table>
5521
5522 !!end
5523
5524 !! test
5525 Table rowspan
5526 !! wikitext
5527 {| border=1
5528 | Cell 1, row 1
5529 |rowspan=2| Cell 2, row 1 (and 2)
5530 | Cell 3, row 1
5531 |-
5532 | Cell 1, row 2
5533 | Cell 3, row 2
5534 |}
5535 !! html
5536 <table border="1">
5537 <tr>
5538 <td> Cell 1, row 1
5539 </td>
5540 <td rowspan="2"> Cell 2, row 1 (and 2)
5541 </td>
5542 <td> Cell 3, row 1
5543 </td></tr>
5544 <tr>
5545 <td> Cell 1, row 2
5546 </td>
5547 <td> Cell 3, row 2
5548 </td></tr></table>
5549
5550 !! end
5551
5552 !! test
5553 Nested table
5554 !! wikitext
5555 {| border=1
5556 | &alpha;
5557 |
5558 {| bgcolor=#ABCDEF border=2
5559 |nested
5560 |-
5561 |table
5562 |}
5563 |the original table again
5564 |}
5565 !! html
5566 <table border="1">
5567 <tr>
5568 <td> &#945;
5569 </td>
5570 <td>
5571 <table bgcolor="#ABCDEF" border="2">
5572 <tr>
5573 <td>nested
5574 </td></tr>
5575 <tr>
5576 <td>table
5577 </td></tr></table>
5578 </td>
5579 <td>the original table again
5580 </td></tr></table>
5581
5582 !! end
5583
5584 !! test
5585 Invalid attributes in table cell (bug 1830)
5586 !! wikitext
5587 {|
5588 |Cell:|broken
5589 |}
5590 !! html
5591 <table>
5592 <tr>
5593 <td>broken
5594 </td></tr></table>
5595
5596 !! end
5597
5598 # The "|}" to close the table is missing from the input, so parsoid's
5599 # *2wt modes will fail.
5600 !! test
5601 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5602 !! options
5603 parsoid=wt2html,html2html
5604 !! wikitext
5605 {|
5606 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5607 !! html/php
5608 <table>
5609 <tr>
5610 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5611 <td>]" onmouseover="alert(document.cookie)"&gt;test
5612 </td>
5613 </tr>
5614 </table>
5615
5616 !! html/parsoid
5617 <table><tbody>
5618 <tr>
5619 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5620 !! end
5621
5622 # FIXME: The php output is broken.
5623 !! test
5624 ! and || in td attributes should not be parsed as <th>/<td>
5625 !! wikitext
5626 {|
5627 | style="color: red !important;" data-contrived="put this here ||" | foo
5628 |}
5629 !! html/php
5630 <table>
5631 <tr>
5632 <td> style="color: red !important;" data-contrived="put this here </td>
5633 <td> foo
5634 </td></tr></table>
5635
5636 !! html/parsoid
5637 <table>
5638 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5639 </tbody></table>
5640 !! end
5641
5642 !! test
5643 Indented table markup mixed with indented pre content (proposed in bug 6200)
5644 !! wikitext
5645 <table>
5646 <tr>
5647 <td>
5648 Text that should be rendered preformatted
5649 </td>
5650 </tr>
5651 </table>
5652 !! html
5653 <table>
5654 <tr>
5655 <td>
5656 <pre>Text that should be rendered preformatted
5657 </pre>
5658 </td>
5659 </tr>
5660 </table>
5661
5662 !! end
5663
5664 !! test
5665 1. Template-generated table cell attributes and cell content
5666 !! wikitext
5667 {|
5668 |{{table_attribs}}
5669 | {{table_attribs}}
5670 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5671 |align=center {{table_attribs}}
5672 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5673 |}
5674 !! html
5675 <table>
5676 <tr>
5677 <td style="color:red;">Foo
5678 </td>
5679 <td style="color:red;">Foo
5680 </td>
5681 <td style="color:red;">Foo
5682 </td>
5683 <td align="center" style="color:red;">Foo
5684 </td>
5685 <td align="center" style="color:red;">Foo
5686 </td></tr></table>
5687
5688 !! end
5689
5690 !! test
5691 2. Template-generated table cell attributes and cell content
5692 !! wikitext
5693 {|
5694 |{{table_attribs_2}}
5695 |}
5696 !! html/php
5697 <table>
5698 <tr>
5699 <td style="color:red;">Foo
5700 </td>
5701 <td>Bar</td>
5702 <td>Baz
5703 </td></tr></table>
5704
5705 !! html/parsoid
5706 <table>
5707 <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>
5708 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5709 </tbody></table>
5710 !! end
5711
5712 !! test
5713 3. Template-generated table cell attributes and cell content
5714 !! wikitext
5715 {|
5716 !align=center {{table_header_cells}}
5717 |-
5718 |align=center {{table_cells}}
5719 |}
5720 !! html/php
5721 <table>
5722 <tr>
5723 <th align="center" style="color:red;">Foo</th>
5724 <th style="color:red;"><i>Bar</i></th>
5725 <th style="color:brown;"><i>Foo</i> and Baz
5726 </th></tr>
5727 <tr>
5728 <td align="center" style="color:red;">Foo</td>
5729 <td style="color:red;"><i>Bar</i></td>
5730 <td style="color:brown;"><i>Foo</i> and Baz
5731 </td></tr></table>
5732
5733 !! html/parsoid
5734 <table>
5735 <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>
5736 <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>
5737 </tbody></table>
5738 !! end
5739
5740 !! test
5741 Table with row followed by newlines and table heading
5742 !! wikitext
5743 {|
5744 |-
5745
5746 ! foo
5747 |}
5748 !! html
5749 <table>
5750
5751
5752 <tr>
5753 <th> foo
5754 </th></tr></table>
5755
5756 !! end
5757
5758 !! test
5759 Table with empty line following the start tag
5760 !! wikitext
5761 {|
5762
5763 |-
5764 | foo
5765 |}
5766 !! html
5767 <table>
5768
5769
5770 <tr>
5771 <td> foo
5772 </td></tr></table>
5773
5774 !! end
5775
5776 # FIXME: Preserve the attribute properly (with an empty string as value) in
5777 # the PHP parser. Parsoid implements the behavior below.
5778 !! test
5779 Table attributes with empty value
5780 !! wikitext
5781 {|
5782 | style=| hello
5783 |}
5784 !! html/parsoid
5785 <table>
5786 <tbody>
5787 <tr>
5788 <td style=""> hello
5789 </td></tr></tbody></table>
5790
5791 !! end
5792
5793 !! test
5794 Wikitext table with a lot of comments
5795 !! wikitext
5796 {|
5797 <!-- c0 -->
5798 | foo
5799 <!-- c1 -->
5800 |- <!-- c2 -->
5801 <!-- c3 -->
5802 |<!-- c4 -->
5803 <!-- c5 -->
5804 |}
5805 !! html
5806 <table>
5807 <tr>
5808 <td> foo
5809 </td></tr>
5810 <tr>
5811 <td>
5812 </td></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Wikitext table with double-line table cell
5818 !! wikitext
5819 {|
5820 |a
5821 b
5822 |}
5823 !! html
5824 <table>
5825 <tr>
5826 <td>a
5827 <p>b
5828 </p>
5829 </td></tr></table>
5830
5831 !! end
5832
5833 !! test
5834 Table cell with a single comment
5835 !! wikitext
5836 {|
5837 | <!-- c1 -->
5838 | a
5839 |}
5840 !! html
5841 <table>
5842 <tr>
5843 <td>
5844 </td>
5845 <td> a
5846 </td></tr></table>
5847
5848 !! end
5849
5850 !! test
5851 Table-cell after a comment-only-empty-line
5852 !! wikitext
5853 {|
5854 |a
5855 <!--c1-->
5856 <!--c2-->| b
5857 |}
5858 !! html
5859 <table>
5860 <tr>
5861 <td>a
5862 </td>
5863 <td> b
5864 </td></tr></table>
5865
5866 !! html/parsoid
5867 <table>
5868 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5869 <!--c1-->
5870 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5871 </tbody></table>
5872
5873 !! end
5874
5875 !! test
5876 Build table with {{!}}
5877 !! wikitext
5878 {{{!}} class="wikitable"
5879 ! header
5880 ! second header
5881 {{!}}- style="color:red;"
5882 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5883 {{!}}}
5884 !! html
5885 <table class="wikitable">
5886 <tr>
5887 <th> header
5888 </th>
5889 <th> second header
5890 </th></tr>
5891 <tr style="color:red;">
5892 <td> data </td>
5893 <td style="color:red;"> second data
5894 </td></tr></table>
5895
5896 !! end
5897
5898 !! test
5899 Build table with pipe as data
5900 !! wikitext
5901 {| class="wikitable"
5902 ! header
5903 ! second header
5904 |- style="color:red;"
5905 | data || style="color:red;" | second data
5906 |-
5907 | style="color:red;" | data with | || style="color:red;" | second data with |
5908 |-
5909 || data with | ||| second data with |
5910 |}
5911 !! html
5912 <table class="wikitable">
5913 <tr>
5914 <th> header
5915 </th>
5916 <th> second header
5917 </th></tr>
5918 <tr style="color:red;">
5919 <td> data </td>
5920 <td style="color:red;"> second data
5921 </td></tr>
5922 <tr>
5923 <td style="color:red;"> data with | </td>
5924 <td style="color:red;"> second data with |
5925 </td></tr>
5926 <tr>
5927 <td> data with | </td>
5928 <td> second data with |
5929 </td></tr></table>
5930
5931 !! end
5932
5933 !! test
5934 Build table with wikilink
5935 !! wikitext
5936 {| class="wikitable"
5937 ! header || second header
5938 |- style="color:red;"
5939 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5940 |-
5941 | data || second data [[Main Page|link|text with pipe]]
5942 |}
5943 !! html
5944 <table class="wikitable">
5945 <tr>
5946 <th> header </th>
5947 <th> second header
5948 </th></tr>
5949 <tr style="color:red;">
5950 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5951 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5952 </td></tr>
5953 <tr>
5954 <td> data </td>
5955 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5956 </td></tr></table>
5957
5958 !! end
5959
5960 # The expected HTML structure in this test is debatable. The PHP parser does
5961 # not parse this kind of table at all. The main focus for Parsoid is on
5962 # round-tripping, so this output is ok for now. TODO: revisit!
5963 !! test
5964 Wikitext table with html-syntax row
5965 !! wikitext
5966 {|
5967 |-
5968 <td>foo</td>
5969 |}
5970 !! html/parsoid
5971 <table>
5972 <tbody>
5973 <tr>
5974 <td>foo</td></tr></tbody></table>
5975 !! end
5976
5977 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5978 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5979 ## PHP parser, which tidy then compounds by fostering the content
5980 ## entirely out of the table. Parsoid recognizes the table context
5981 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5982 ## depends on PHP's treatment of broken table markup!
5983 !! test
5984 Implicit <td> after a |-
5985 !! options
5986 parsoid=wt2html,html2html
5987 !! wikitext
5988 {|
5989 |-
5990 a
5991 |}
5992 !! html/php
5993 <table>
5994
5995 a
5996 </table>
5997
5998 !! html/php+tidy
5999 <p>a</p>
6000 !! html/parsoid
6001 <table>
6002 <tr><td>a</td></tr>
6003 </table>
6004 !! end
6005
6006 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6007 !! test
6008 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6009 !! options
6010 parsoid=wt2html,html2html
6011 !! wikitext
6012 {|
6013 |-
6014 |
6015 a
6016 |-
6017 b
6018 |}
6019 !! html/php
6020 <table>
6021
6022 <tr>
6023 <td>
6024 <pre>a
6025 </pre>
6026 </td></tr>
6027 b
6028 </table>
6029
6030 !! html/php+tidy
6031 <p>b</p>
6032 <table>
6033 <tr>
6034 <td>
6035 <pre>
6036 a
6037 </pre></td>
6038 </tr>
6039 </table>
6040 !! html/parsoid
6041 <table>
6042 <tbody>
6043 <tr><td><pre>a</pre></td></tr>
6044 <tr><td> b</td></tr>
6045 </tbody>
6046 </table>
6047 !! end
6048
6049 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6050 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6051 !! test
6052 Lists should be recognized in an implicit <td> context
6053 !! options
6054 parsoid=wt2html,html2html
6055 !! wikitext
6056 {|
6057 |-
6058 *a
6059 |}
6060 !! html/php
6061 <table>
6062
6063 <ul><li>a</li></ul>
6064 </table>
6065
6066 !! html/php+tidy
6067 <ul>
6068 <li>a</li>
6069 </ul>
6070 !! html/parsoid
6071 <table>
6072 <tr>
6073 <td><ul>
6074 <li>a</li>
6075 </ul></td>
6076 </tr>
6077 </table>
6078 !! end
6079
6080 !! test
6081 Parsoid: Round-trip tables directly followed by content (bug 51219)
6082 !! options
6083 parsoid=wt2html,wt2wt
6084 !! wikitext
6085 {|
6086 |foo
6087 |} bar
6088
6089 {|
6090 |baz
6091 |}<b>quux</b>
6092 !! html+tidy
6093 <table>
6094 <tr>
6095 <td>foo</td>
6096 </tr>
6097 </table>
6098 <p>bar</p>
6099 <table>
6100 <tr>
6101 <td>baz</td>
6102 </tr>
6103 </table>
6104 <p><b>quux</b></p>
6105 !! end
6106
6107 !! test
6108 Parsoid: Default to a newline after tables in new content (bug 51219)
6109 !! options
6110 parsoid=html2wt
6111 !! html
6112 <table><tbody>
6113 <tr><td>foo</td></tr></tbody></table> bar
6114 <table><tbody>
6115 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6116 !! wikitext
6117 {|
6118 |foo
6119 |}
6120 <nowiki> </nowiki>bar
6121 {|
6122 |baz
6123 |}
6124 '''quux'''
6125 !! end
6126
6127 !! test
6128 Parsoid: newline inducing block nodes don't suppress <nowiki>
6129 !! options
6130 parsoid=html2wt
6131 !! html
6132 a<h1>foo</h1>
6133 !! wikitext
6134 <nowiki> </nowiki>a
6135
6136 = foo =
6137 !! end
6138
6139 !! test
6140 Parsoid: Row-syntax table headings followed by comment & table cells
6141 !! options
6142 parsoid=wt2html,wt2wt
6143 !! wikitext
6144 {|
6145 ! foo || bar
6146 <!-- foo --> || baz || quux
6147 |}
6148 !! html/php
6149 <table>
6150 <tr>
6151 <th> foo </th>
6152 <th> bar
6153 </th>
6154 <td> baz </td>
6155 <td> quux
6156 </td></tr></table>
6157
6158 !! html/parsoid
6159 <table>
6160 <tbody><tr><th> foo </th><th> bar
6161 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6162 </tbody></table>
6163 !! end
6164
6165
6166 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6167 # preserves it.
6168 !!test
6169 Parsoid: Recover better from broken table attributes
6170 !!options
6171 parsoid=wt2html
6172 !!wikitext
6173 {| class="foo
6174 | class="bar" |
6175 foo
6176 |}
6177 !!html/php+tidy
6178 <table>
6179 <tr>
6180 <td class="bar">
6181 <p>foo</p>
6182 </td>
6183 </tr>
6184 </table>
6185 !!html/parsoid
6186 <table class="foo">
6187 <tr>
6188 <td class="bar">
6189 <p>foo</p></td></tr>
6190 </tbody></table>
6191 !!end
6192
6193 !! test
6194 Strip unsupported table tags
6195 !! options
6196 parsoid=html2wt
6197 !! html
6198 <table>
6199 <thead>
6200 <tr>
6201 <th>Month</th>
6202 <th>Savings</th>
6203 </tr>
6204 </thead>
6205 <tbody>
6206 <tr>
6207 <td>January</td>
6208 <td>$100</td>
6209 </tr>
6210 <tr>
6211 <td>February</td>
6212 <td>$80</td>
6213 </tr>
6214 </tbody>
6215 <tfoot>
6216 <tr>
6217 <td>Sum</td>
6218 <td>$180</td>
6219 </tr>
6220 </tfoot>
6221 </table>
6222 !! wikitext
6223 {|
6224
6225 !Month
6226 !Savings
6227
6228 |January
6229 |$100
6230
6231 |-
6232 |February
6233 |$80
6234
6235 |Sum
6236 |$180
6237
6238 |}
6239 !! end
6240
6241 ###
6242 ### Internal links
6243 ###
6244 !! test
6245 Plain link, capitalized
6246 !! wikitext
6247 [[Main Page]]
6248 !! html
6249 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6250 </p>
6251 !! end
6252
6253 !! test
6254 Plain link, uncapitalized
6255 !! wikitext
6256 [[main Page]]
6257 !! html
6258 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6259 </p>
6260 !! end
6261
6262 !! test
6263 Piped link
6264 !! wikitext
6265 [[Main Page|The Main Page]]
6266 !! html
6267 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6268 </p>
6269 !! end
6270
6271 !! test
6272 Piped link with comment in link text
6273 !! wikitext
6274 [[Main Page|The Main<!--front--> Page]]
6275 !! html
6276 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6277 </p>
6278 !! end
6279
6280 !! test
6281 Piped link with multiple pipe characters in link text
6282 !! wikitext
6283 [[Main Page||The|Main|Page|]]
6284 !! html/php
6285 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6286 </p>
6287 !! html/parsoid
6288 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6289 !! end
6290
6291 !! test
6292 Broken link
6293 !! wikitext
6294 [[Zigzagzogzagzig]]
6295 !! html
6296 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6297 </p>
6298 !! end
6299
6300 !! test
6301 Broken link with fragment
6302 !! wikitext
6303 [[Zigzagzogzagzig#zug]]
6304 !! html
6305 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6306 </p>
6307 !! end
6308
6309 !! test
6310 Special page link with fragment
6311 !! wikitext
6312 [[Special:Version#anchor]]
6313 !! html
6314 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6315 </p>
6316 !! end
6317
6318 !! test
6319 Nonexistent special page link with fragment
6320 !! wikitext
6321 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6322 !! html
6323 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6324 </p>
6325 !! end
6326
6327 !! test
6328 Link with prefix
6329 !! wikitext
6330 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6331 !! html
6332 <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>
6333 </p>
6334 !! end
6335
6336 !! test
6337 Link with suffix
6338 !! wikitext
6339 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6340 !! html
6341 <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>!!!
6342 </p>
6343 !! end
6344
6345 !! article
6346 prefixed article
6347 !! text
6348 Some text
6349 !! endarticle
6350
6351 !! test
6352 Bug 43661: Piped links with identical prefixes
6353 !! wikitext
6354 [[prefixed article|prefixed articles with spaces]]
6355
6356 [[prefixed article|prefixed articlesaoeu]]
6357
6358 [[Main Page|Main Page test]]
6359 !! html
6360 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6361 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6362 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6363 </p>
6364 !! end
6365
6366
6367 !! test
6368 Link with HTML entity in suffix / tail
6369 !! wikitext
6370 [[Main Page]]&quot;, [[Main Page]]&#97;
6371 !! html/php
6372 <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;
6373 </p>
6374 !! html/parsoid
6375 <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>
6376 !! end
6377
6378 !! test
6379 Link with 3 brackets
6380 !! wikitext
6381 [[[Main Page]]]
6382 !! html
6383 <p>[[[Main Page]]]
6384 </p>
6385 !! end
6386
6387 !! test
6388 Link with 4 brackets
6389 !! wikitext
6390 [[[[Main Page]]]]
6391 !! html
6392 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6393 </p>
6394 !! end
6395
6396 !! test
6397 Piped link with 3 brackets
6398 !! wikitext
6399 [[[main page|the main page]]]
6400 !! html
6401 <p>[[[main page|the main page]]]
6402 </p>
6403 !! end
6404
6405 !! test
6406 Piped link with extlink-like text
6407 !! wikitext
6408 [[Main Page|[bar]]]
6409 [[Main Page|This is a [bar]]]
6410 !! html/php
6411 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6412 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6413 </p>
6414 !! html/parsoid
6415 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6416 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6417 !! end
6418
6419 !! test
6420 Link with multiple pipes
6421 !! wikitext
6422 [[Main Page|The|Main|Page]]
6423 !! html
6424 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6425 </p>
6426 !! end
6427
6428 # Note that parsoid does not munge anchor text; all non-space
6429 # characters are valid in HTML5 ids.
6430 !! test
6431 Anchor containing a #. (bug 63430)
6432 !! wikitext
6433 [[Main Page#And#Link]]
6434 !! html/php
6435 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6436 </p>
6437 !! html/parsoid
6438 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6439 !! end
6440
6441 !! test
6442 Link to namespaces
6443 !! wikitext
6444 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6445 !! html
6446 <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>
6447 </p>
6448 !! end
6449
6450 !! test
6451 Link with space in namespace
6452 !! wikitext
6453 [[User talk:Foo bar]]
6454 !! html
6455 <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>
6456 </p>
6457 !! end
6458
6459 !! article
6460 MemoryAlpha:AlphaTest
6461 !! text
6462 This is an article in the MemoryAlpha namespace
6463 (which shadows the memoryalpha interwiki link).
6464 !! endarticle
6465
6466 !! test
6467 Namespace takes precedence over interwiki link (bug 51680)
6468 !! wikitext
6469 [[MemoryAlpha:AlphaTest]]
6470 !! html
6471 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6472 </p>
6473 !! end
6474
6475 # The previous test doesn't work correctly in html2*, due to not recognizing the
6476 # link as an internal one. This one checks for the correct behavior.
6477 !! test
6478 Link to namespace preferred over interwiki with correct rel attribute
6479 !! options
6480 parsoid=html2wt,html2html
6481 !! html
6482 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6483 !! wikitext
6484 [[MemoryAlpha:AlphaTest]]
6485 !! end
6486
6487 !! test
6488 Piped link to namespace
6489 !! wikitext
6490 [[Meta:Disclaimers|The disclaimers]]
6491 !! html
6492 <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>
6493 </p>
6494 !! end
6495
6496 !! test
6497 Link containing }
6498 !! wikitext
6499 [[Usually caused by a typo (oops}]]
6500 !! html
6501 <p>[[Usually caused by a typo (oops}]]
6502 </p>
6503 !! end
6504
6505 !! article
6506 7% Solution
6507 !! text
6508 Just a test of an article title containing a percent.
6509 !! endarticle
6510
6511 !! test
6512 Link containing % (not as a hex sequence)
6513 !! wikitext
6514 [[7% Solution]]
6515 !! html/php
6516 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6517 </p>
6518 !! html/parsoid
6519 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6520 !! end
6521
6522 # note that the parsoid HTML is identical to the previous test output,
6523 # so the previous test ensures that the html2wt mode will generate the
6524 # "not as a hex sequence" wikitext.
6525 !! test
6526 Link containing % as a single hex sequence interpreted to char
6527 !! options
6528 parsoid=wt2wt,wt2html,html2html
6529 !! wikitext
6530 [[7%25 Solution]]
6531 !! html/php
6532 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6533 </p>
6534 !! html/parsoid
6535 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6536 !!end
6537
6538 !! test
6539 Link containing % as a double hex sequence interpreted to hex sequence
6540 !! wikitext
6541 [[7%2525 Solution]]
6542 !! html
6543 <p>[[7%2525 Solution]]
6544 </p>
6545 !!end
6546
6547 # note that parsoid does not munge anchor text; all non-space
6548 # characters are valid in HTML5 anchors.
6549 !! test
6550 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6551 Example for such a section: == < ==
6552 !! wikitext
6553 [[%23%3c]][[%23%3e]]
6554 !! html/php
6555 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6556 </p>
6557 !! html/parsoid
6558 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
6559 !! end
6560
6561 !! test
6562 Link containing "<#" and ">#" as a hex sequences
6563 !! wikitext
6564 [[%3c%23]][[%3e%23]]
6565 !! html
6566 <p>[[%3c%23]][[%3e%23]]
6567 </p>
6568 !! end
6569
6570 !! test
6571 Link containing an equals sign
6572 !! wikitext
6573 [[Special:BookSources/isbn=4-00-026157-6]]
6574 !! html/php
6575 <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>
6576 </p>
6577 !! html/parsoid
6578 <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>
6579 !! end
6580
6581 !! article
6582 Foo~bar
6583 !! text
6584 Just a test of an article title containing a tilde.
6585 !! endarticle
6586
6587 # note that links containing signatures, like [[Foo~~~~]], are
6588 # massaged by the pre-save transform (PST) and so the tildes are never
6589 # seen by the parser.
6590 !! test
6591 Link containing a tilde
6592 !! wikitext
6593 [[Foo~bar]]
6594 !! html/php
6595 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6596 </p>
6597 !! html/parsoid
6598 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6599 !! end
6600
6601 !! test
6602 Link containing double-single-quotes '' (bug 4598)
6603 !! wikitext
6604 [[Lista d''e paise d''o munno]]
6605 !! html/php
6606 <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>
6607 </p>
6608 !! html/parsoid
6609 <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>
6610 !! end
6611
6612 !! test
6613 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6614 !! wikitext
6615 Some [[Link|pretty ''italics'' and stuff]]!
6616 !! html/php
6617 <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>!
6618 </p>
6619 !! html/parsoid
6620 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6621 !! end
6622
6623 !! test
6624 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6625 !! wikitext
6626 ''Some [[Link|pretty ''italics'' and stuff]]!''
6627 !! html
6628 <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>
6629 </p>
6630 !! end
6631
6632 !! test
6633 Link with double quotes in title part (literal) and alternate part (interpreted)
6634 !! wikitext
6635 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6636
6637 [[''Pentecoste'']]
6638
6639 [[''Pentecoste''|Pentecoste]]
6640
6641 [[''Pentecoste''|''Pentecoste'']]
6642 !! html/php
6643 <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>
6644 </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>
6645 </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>
6646 </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>
6647 </p>
6648 !! html/parsoid
6649 <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>
6650 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6651 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6652 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6653 !! end
6654
6655 !! test
6656 Broken image links with HTML captions (bug 39700)
6657 !! wikitext
6658 [[File:Nonexistent|<script></script>]]
6659 [[File:Nonexistent|100x100px|<script></script>]]
6660 [[File:Nonexistent|&lt;]]
6661 [[File:Nonexistent|a<i>b</i>c]]
6662 !! html/php
6663 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6664 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6665 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6666 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6667 </p>
6668 !! html/parsoid
6669 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6670 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&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"/></a></span>
6671 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6672 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
6673 !! end
6674
6675 !! test
6676 Plain link to URL
6677 !! wikitext
6678 [[http://www.example.com]]
6679 !! html/php
6680 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6681 </p>
6682 !! html/parsoid
6683 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6684 !! end
6685
6686 !! test
6687 Plain link to URL with link text
6688 !! wikitext
6689 [[http://www.example.com Link text]]
6690 !! html
6691 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6692 </p>
6693 !! end
6694
6695 !! test
6696 Plain link to protocol-relative URL
6697 !! wikitext
6698 [[//www.example.com]]
6699 !! html/php
6700 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6701 </p>
6702 !! html/parsoid
6703 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6704 !! end
6705
6706 !! test
6707 Plain link to protocol-relative URL with link text
6708 !! wikitext
6709 [[//www.example.com Link text]]
6710 !! html
6711 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6712 </p>
6713 !! end
6714
6715 !! test
6716 Plain link to page with question mark in title
6717 !! wikitext
6718 [[A?b]]
6719
6720 [[A?b|Baz]]
6721 !! html
6722 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6723 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6724 </p>
6725 !! end
6726
6727
6728 # I'm fairly sure the expected result here is wrong.
6729 # We want these to be URL links, not pseudo-pages with URLs for titles....
6730 # However the current output is also pretty screwy.
6731 #
6732 # ----
6733 # I'm changing it to match the current output--it arguably makes more
6734 # sense in the light of the test above. Old expected result was:
6735 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6736 #</p>
6737 # But I think this test is bordering on "garbage in, garbage out" anyway.
6738 # -- wtm
6739 !! test
6740 Piped link to URL
6741 !! wikitext
6742 Piped link to URL: [[http://www.example.com|an example URL]]
6743 !! html/php
6744 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6745 </p>
6746 !! html/parsoid
6747 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6748 !! end
6749
6750 !! test
6751 BUG 2: [[page|http://url/]] should link to page, not http://url/
6752 !! wikitext
6753 [[Main Page|http://url/]]
6754 !! html/php
6755 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6756 </p>
6757 !! html/parsoid
6758 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6759 !! end
6760
6761 # Parsoid does not mark self-links, by design.
6762 !! test
6763 BUG 337: Escaped self-links should be bold
6764 !! options
6765 title=[[Bug462]]
6766 !! wikitext
6767 [[Bu&#103;462]] [[Bug462]]
6768 !! html/php
6769 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6770 </p>
6771 !! html/php+tidy
6772 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6773 !! html/parsoid
6774 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6775 !! end
6776
6777 !! test
6778 Self-link to section should not be bold
6779 !! options
6780 title=[[Main Page]]
6781 !! wikitext
6782 [[Main Page#section]]
6783 !! html
6784 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6785 </p>
6786 !! end
6787
6788 !! article
6789 00
6790 !! text
6791 This is 00.
6792 !! endarticle
6793
6794 !!test
6795 Self-link to numeric title
6796 !!options
6797 title=[[0]]
6798 !! wikitext
6799 [[0]]
6800 !! html
6801 <p><strong class="selflink">0</strong>
6802 </p>
6803 !!end
6804
6805 !!test
6806 Link to numeric-equivalent title
6807 !!options
6808 title=[[0]]
6809 !! wikitext
6810 [[00]]
6811 !! html
6812 <p><a href="/wiki/00" title="00">00</a>
6813 </p>
6814 !!end
6815
6816 !! test
6817 <nowiki> inside a link
6818 !! wikitext
6819 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6820 !! html
6821 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6822 </p>
6823 !! end
6824
6825 !! test
6826 Non-breaking spaces in title
6827 !! wikitext
6828 [[&nbsp; Main &nbsp; Page &nbsp;]]
6829 !! html
6830 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6831 </p>
6832 !!end
6833
6834 !! test
6835 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6836 !! options
6837 language=ca
6838 !! wikitext
6839 '''[[Main Page]]'''
6840 !! html
6841 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6842 </p>
6843 !! end
6844
6845 !! test
6846 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6847 !! options
6848 language=ca
6849 !! wikitext
6850 ''[[Main Page]]''
6851 !! html
6852 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6853 </p>
6854 !! end
6855
6856 !! test
6857 Internal link with en linktrail: no apostrophes (bug 27473)
6858 !! options
6859 language=en
6860 !! wikitext
6861 [[Something]]'nice
6862 !! html
6863 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6864 </p>
6865 !! end
6866
6867 !! test
6868 Internal link with ca linktrail with apostrophes (bug 27473)
6869 !! options
6870 language=ca
6871 !! wikitext
6872 [[Something]]'nice
6873 !! html
6874 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6875 </p>
6876 !! end
6877
6878 !! test
6879 Internal link with kaa linktrail with apostrophes (bug 27473)
6880 !! options
6881 language=kaa
6882 !! wikitext
6883 [[Something]]'nice
6884 !! html
6885 <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>
6886 </p>
6887 !! end
6888
6889 !! test
6890 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6891 !! wikitext
6892 [[User:Foo/Test/63636:Bar|Test]]
6893 !! html/php
6894 <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>
6895 </p>
6896 !! html/parsoid
6897 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6898 !! end
6899
6900 !! test
6901 Purely hash wikilink
6902 !! options
6903 title=[[User:test/123]]
6904 !! wikitext
6905 [[#a|b]]
6906 !! html/php
6907 <p><a href="#a">b</a>
6908 </p>
6909 !! html/parsoid
6910 <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>
6911 !! end
6912
6913 !! test
6914 1. Interaction of linktrail and template encapsulation
6915 !! options
6916 parsoid
6917 !! wikitext
6918 {{echo|[[Foo]]}}l
6919 !! html
6920 <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>
6921 !! end
6922
6923 !! test
6924 2. Interaction of linktrail and template encapsulation
6925 !! options
6926 parsoid
6927 !! wikitext
6928 {{echo|Some [[Fool]]}}s
6929 !! html
6930 <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","spc":["","","",""]}]]}'>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>
6931 !! end
6932
6933 !! test
6934 3. Interaction of linktrail and template encapsulation
6935 !! options
6936 parsoid
6937 !! wikitext
6938 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6939 !! html
6940 <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","spc":["","","",""]}]]}'>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>
6941 !! end
6942
6943 !! article
6944 Söfnuður
6945 !! text
6946 Test.
6947 !! endarticle
6948
6949 !! test
6950 Internal link with is link prefix
6951 !! options
6952 language=is
6953 !! wikitext
6954 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6955 !! html
6956 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6957 </p>
6958 !! end
6959
6960 !! article
6961 Mótmælendatrú
6962 !! text
6963 Test.
6964 !! endarticle
6965
6966 !! test
6967 Internal link with is link trail and link prefix
6968 !! options
6969 language=is
6970 !! wikitext
6971 [[mótmælendatrú|xxx]]ar
6972 [[mótmælendatrú]]ar
6973 mótmælenda[[söfnuður]]
6974 mótmælenda[[söfnuður|söfnuðir]]
6975 mótmælenda[[söfnuður|söfnuðir]]xxx
6976 !! html
6977 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6978 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6979 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6980 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6981 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6982 </p>
6983 !! end
6984
6985 !! test
6986 Parsoid link trail escaping
6987 !! options
6988 parsoid=html2wt,html2html
6989 !! html
6990 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6991 !! wikitext
6992 [[apple]]<nowiki/>s
6993 !! end
6994
6995 !! test
6996 Parsoid link prefix escaping
6997 !! options
6998 language=is
6999 parsoid=html2wt,html2html
7000 !! html
7001 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7002 !! wikitext
7003 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7004 !! end
7005
7006 !! test
7007 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7008 !! wikitext
7009 [[Foo| bar]]
7010
7011 [[Foo| ''bar'']]
7012
7013 [http://wp.org foo]
7014
7015 [http://wp.org ''foo'']
7016 !! html
7017 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7018 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7019 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7020 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7021 </p>
7022 !! end
7023
7024 !! test
7025 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7026 !! options
7027 parsoid
7028 !! wikitext
7029 [[Foo|{{echo|a}} b {{echo|c}}]]
7030 !! html
7031 <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>
7032 !! end
7033
7034 !! test
7035 Link with angle bracket after anchor
7036 !! wikitext
7037 [[Foo#<bar>]]
7038 !! html/php
7039 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7040 </p>
7041 !! html/parsoid
7042 <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>
7043 !! end
7044
7045 ###
7046 ### Interwiki links (see maintenance/interwiki.sql)
7047 ###
7048
7049 !! test
7050 Inline interwiki link
7051 !! options
7052 parsoid=wt2html,wt2wt,html2html
7053 !! wikitext
7054 [[MeatBall:SoftSecurity]]
7055 !! html/php
7056 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7057 </p>
7058 !! html/parsoid
7059 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7060 !! end
7061
7062 !! test
7063 Inline interwiki link with empty title (bug 2372)
7064 !! options
7065 parsoid=wt2html,wt2wt,html2html
7066 !! wikitext
7067 [[MeatBall:]]
7068 !! html/php
7069 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7070 </p>
7071 !! html/parsoid
7072 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7073 !! end
7074
7075 !! test
7076 Interwiki link encoding conversion (bug 1636)
7077 !! wikitext
7078 *[[Wikipedia:ro:Olteni&#0355;a]]
7079 *[[Wikipedia:ro:Olteni&#355;a]]
7080 !! html
7081 <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>
7082 <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>
7083
7084 !! html+tidy
7085 <ul>
7086 <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>
7087 <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>
7088 </ul>
7089 !! end
7090
7091 !! test
7092 Interwiki link with fragment (bug 2130)
7093 !! wikitext
7094 [[MeatBall:SoftSecurity#foo]]
7095 !! html
7096 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7097 </p>
7098 !! end
7099
7100 # Ideally the wikipedia: prefix here should be proto-relative too
7101 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7102 # define the 'en' prefix, and originally the test used 'wikipedia',
7103 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7104 # article.
7105 !! test
7106 Different interwiki prefixes mapping to the same URL
7107 !! wikitext
7108 [[:en:Foo]]
7109
7110 [[:en:Foo|Foo]]
7111
7112 [[wikipedia:Foo]]
7113
7114 [[:wikipedia:Foo|Foo]]
7115
7116 [[wikipedia:en:Foo]]
7117
7118 [[:wikipedia:en:Foo]]
7119
7120 [[ wikiPEdia :Foo]]
7121 !! html/parsoid
7122 <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>
7123
7124 <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>
7125
7126 <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>
7127
7128 <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>
7129
7130 <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>
7131
7132 <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>
7133
7134 <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>
7135 !! end
7136
7137 !! test
7138 Interwiki links that cannot be represented in wiki syntax
7139 !! wikitext
7140 [[meatball:ok]]
7141 [[meatball:ok#foo|ok with fragment]]
7142 [[meatball:ok_as_well?|ok ending with ? mark]]
7143 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7144 [http://de.wikipedia.org/wiki/#foo is just fragment]
7145
7146 !! html/php
7147 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7148 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7149 <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>
7150 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7151 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7152 </p>
7153 !! html/parsoid
7154 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7155 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7156 <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>
7157 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7158 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7159 !! end
7160
7161 !! test
7162 Interwiki links: trail
7163 !! wikitext
7164 [[wikipedia:Foo|Ba]]r
7165 !! html/php
7166 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7167 </p>
7168 !! html/parsoid
7169 <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>
7170 !! end
7171
7172 !! test
7173 Local interwiki link
7174 !! options
7175 parsoid=wt2html,wt2wt,html2html
7176 !! wikitext
7177 [[local:Template:Foo]]
7178 !! html/php
7179 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7180 </p>
7181 !! html/parsoid
7182 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7183 !! end
7184
7185 # Parsoid does not mark self-links, by design.
7186 !! test
7187 Local interwiki link: self-link to current page
7188 !! options
7189 title=[[Main Page]]
7190 parsoid=wt2html,wt2wt,html2html
7191 !! wikitext
7192 [[local:Main Page]]
7193 !! html/php
7194 <p><strong class="selflink">local:Main Page</strong>
7195 </p>
7196 !! html/parsoid
7197 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7198 !! end
7199
7200 !! test
7201 Local interwiki link: prefix only (bug 64167)
7202 !! options
7203 parsoid=wt2html,wt2wt,html2html
7204 !! wikitext
7205 [[local:]]
7206 !! html/php
7207 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7208 </p>
7209 !! html/parsoid
7210 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7211 !! end
7212
7213 !! test
7214 Local interwiki link: with additional interwiki prefix (bug 61357)
7215 !! options
7216 parsoid=wt2html,wt2wt,html2html
7217 !! wikitext
7218 [[local:meatball:Hello]]
7219 !! html/php
7220 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7221 </p>
7222 !! html/parsoid
7223 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7224 !! end
7225
7226 !! test
7227 Multiple local interwiki link prefixes
7228 !! wikitext
7229 [[local:local:local:local:mi:local:Foo]]
7230 !! options
7231 parsoid=wt2html,wt2wt,html2html
7232 !! html/php
7233 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7234 </p>
7235 !! html/parsoid
7236 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7237 !! end
7238
7239 ###
7240 ### Interlanguage links
7241 ### Language links (so that searching for '### language' matches..)
7242 ###
7243
7244 !! test
7245 Interlanguage link
7246 !! options
7247 parsoid=wt2html,wt2wt,html2html
7248 !! wikitext
7249 Blah blah blah
7250 [[zh:Chinese]]
7251 !! html/php
7252 <p>Blah blah blah
7253 </p>
7254 !! html/parsoid
7255 <p>Blah blah blah</p>
7256 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7257 !! end
7258
7259 !! test
7260 Interlanguage link with spacing
7261 !! options
7262 parsoid=wt2html,wt2wt,html2html
7263 !! wikitext
7264 Blah blah blah
7265 [[ zh : Chinese ]]
7266 !! html/php
7267 <p>Blah blah blah
7268 </p>
7269 !! html/parsoid
7270 <p>Blah blah blah</p>
7271 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7272 !! end
7273
7274 !! test
7275 Double interlanguage link
7276 !! options
7277 parsoid=wt2html,wt2wt,html2html
7278 !! wikitext
7279 Blah blah blah
7280 [[es:Spanish]]
7281 [[zh:Chinese]]
7282 !! html/php
7283 <p>Blah blah blah
7284 </p>
7285 !! html/parsoid
7286 <p>Blah blah blah</p>
7287 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7288 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7289 !! end
7290
7291 !! test
7292 Interlanguage link variations
7293 !! options
7294 parsoid=wt2html,wt2wt,html2html
7295 !! wikitext
7296 Blah blah blah
7297 [[ es :Spanish]]
7298 [[ ZH :Chinese]]
7299 [[es:Foo_bar]]
7300 [[es:Foo bar]]
7301 !! html/php
7302 <p>Blah blah blah
7303 </p>
7304 !! html/parsoid
7305 <p>Blah blah blah</p>
7306 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7307 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7308 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7309 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7310 !! end
7311
7312 !! test
7313 Interlanguage link, with prefix links
7314 !! options
7315 language=ln
7316 !! wikitext
7317 Blah blah blah
7318 [[zh:Chinese]]
7319 !! html/php
7320 <p>Blah blah blah
7321 </p>
7322 !! html/parsoid
7323 <p>Blah blah blah</p>
7324 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7325 !! end
7326
7327 !! test
7328 Double interlanguage link, with prefix links (bug 8897)
7329 !! options
7330 language=ln
7331 !! wikitext
7332 Blah blah blah
7333 [[es:Spanish]]
7334 [[zh:Chinese]]
7335 !! html/php
7336 <p>Blah blah blah
7337 </p>
7338 !! html/parsoid
7339 <p>Blah blah blah</p>
7340 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7341 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7342 !! end
7343
7344 !! test
7345 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7346 !! wikitext
7347 Blah blah blah
7348 [[mul:Article]]
7349 !! html/php
7350 <p>Blah blah blah
7351 </p>
7352 !! html/parsoid
7353 <p>Blah blah blah</p>
7354 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7355 !! end
7356
7357 !! test
7358 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7359 !! options
7360 language=ln
7361 !! wikitext
7362 [[WW&nbsp;II]]
7363 !! html
7364 <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>
7365 </p>
7366 !! end
7367
7368 !! test
7369 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7370 !! options
7371 parsoid=html2wt
7372 !! html
7373 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7374 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7375 !! wikitext
7376 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7377
7378 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7379 !! end
7380
7381 !! test
7382 Parsoid: handle constructor well
7383 !! wikitext
7384 [[constructor]]
7385
7386 [[constructor:foo]]
7387 !! html/php
7388 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7389 </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>
7390 </p>
7391 !! html/parsoid
7392 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
7393
7394 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
7395 !! end
7396
7397 !! article
7398 ko:
7399 !! text
7400 Test.
7401 !! endarticle
7402
7403 # Note that `ko` isn't a known interlanguage prefix
7404 !! test
7405 Parsoid: recognize interlanguage links without a target page
7406 !! options
7407 ill
7408 !! wikitext
7409 [[es:]]
7410
7411 [[ko:]]
7412 !! html/php
7413 es:
7414 !! html/parsoid
7415 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7416
7417 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7418 !! end
7419
7420 # Note that `ko` isn't a known interwiki prefix
7421 !! test
7422 Parsoid: recognize interwiki links without a target page
7423 !! options
7424 parsoid=wt2html,wt2wt,html2html
7425 !! wikitext
7426 [[:es:]]
7427
7428 [[:ko:]]
7429 !! html/php
7430 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7431 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7432 </p>
7433 !! html/parsoid
7434 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7435 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7436 !! end
7437
7438 !! test
7439 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7440 !! wikitext
7441 [[mi:Foo]]
7442 !! html/php
7443 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7444 </p>
7445 !! html/parsoid
7446 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7447 !! end
7448
7449 !! test
7450 Interlanguage link with preceding local interwiki link (bug 68085)
7451 !! options
7452 parsoid=wt2html,wt2wt,html2html
7453 !! wikitext
7454 Blah blah blah
7455 [[local:es:Spanish]]
7456 !! html/php
7457 <p>Blah blah blah
7458 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7459 </p>
7460 !! html/parsoid
7461 <p>Blah blah blah
7462 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7463 !! end
7464
7465 !! test
7466 Looks like an interlanguage link, but is actually a local interwiki
7467 !! options
7468 parsoid=wt2html,wt2wt,html2html
7469 !! wikitext
7470 Blah blah blah
7471 [[mi:Template:Foo]]
7472 !! html/php
7473 <p>Blah blah blah
7474 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7475 </p>
7476 !! html/parsoid
7477 <p>Blah blah blah
7478 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7479 !! end
7480
7481 ###
7482 ### Redirects, Parsoid-only
7483 ###
7484 !! test
7485 1. Simple redirect to page
7486 !! options
7487 parsoid
7488 !! wikitext
7489 #REDIRECT [[Main Page]]
7490 !! html
7491 <link rel="mw:PageProp/redirect" href="./Main_Page">
7492 !! end
7493
7494 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7495 !! test
7496 2. Other redirect variants
7497 !! options
7498 parsoid=wt2html,wt2wt
7499 !! wikitext
7500 #REDIRECT [[Main_Page]]
7501 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7502 !! html/parsoid
7503 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7504 !! end
7505
7506 !! test
7507 Empty redirect
7508 !! options
7509 parsoid=wt2html,wt2wt
7510 !! wikitext
7511 #REDIRECT [[]]
7512 !! html
7513 <ol>
7514 <li>REDIRECT [[]]</li></ol>
7515 !! end
7516
7517 !! test
7518 Optional colon in #REDIRECT
7519 !! options
7520 # the colon is archaic syntax. we support it for wt2html, but we
7521 # don't care that it roundtrips back to the modern syntax.
7522 parsoid=wt2html,html2html
7523 !! wikitext
7524 #REDIRECT:[[Main Page]]
7525 !! html
7526 <link rel="mw:PageProp/redirect" href="./Main_Page">
7527 !! end
7528
7529 !! test
7530 Whitespace in #REDIRECT with optional colon
7531 !! options
7532 # the colon and gratuitous whitespace is archaic syntax. we support
7533 # it for wt2html, but we don't care that it roundtrips back to the
7534 # modern syntax (without extra whitespace)
7535 parsoid=wt2html,html2html
7536 !! wikitext
7537
7538 #REDIRECT
7539 :
7540 [[Main Page]]
7541 !! html
7542 <link rel="mw:PageProp/redirect" href="./Main_Page">
7543 !! end
7544
7545 !! test
7546 Piped link in #REDIRECT
7547 !! options
7548 # content after piped link is ignored. we support this syntax,
7549 # but don't care that the piped link is lost when we roundtrip this.
7550 parsoid=wt2html
7551 !! wikitext
7552 #REDIRECT [[Main Page|bar]]
7553 !! html
7554 <link rel="mw:PageProp/redirect" href="./Main_Page">
7555 !! end
7556
7557 !! test
7558 Redirect to category
7559 !! options
7560 parsoid=wt2html
7561 !! wikitext
7562 #REDIRECT [[Category:Foo]]
7563 !! html
7564 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7565 !! end
7566
7567 !! test
7568 Redirect to category with URL encoding
7569 !! options
7570 parsoid=wt2html
7571 !! wikitext
7572 #REDIRECT [[Category%3AFoo]]
7573 !! html
7574 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7575 !! end
7576
7577 !! test
7578 Redirect to category page
7579 !! options
7580 parsoid=wt2html,html2html
7581 !! wikitext
7582 #REDIRECT [[:Category:Foo]]
7583 !! html
7584 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7585 !! end
7586
7587 !! test
7588 Redirect to image page (1)
7589 !! options
7590 parsoid
7591 !! wikitext
7592 #REDIRECT [[File:Wiki.png]]
7593 !! html
7594 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7595 !! end
7596
7597 !! test
7598 Redirect to image page (2)
7599 !! options
7600 parsoid
7601 !! wikitext
7602 #REDIRECT [[Image:Wiki.png]]
7603 !! html
7604 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7605 !! end
7606
7607 !! test
7608 Redirect to language
7609 !! options
7610 parsoid
7611 !! wikitext
7612 #REDIRECT [[en:File:Wiki.png]]
7613 !! html
7614 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7615 !! end
7616
7617 !! test
7618 Redirect to interwiki
7619 !! options
7620 parsoid
7621 !! wikitext
7622 #REDIRECT [[meatball:File:Wiki.png]]
7623 !! html
7624 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7625 !! end
7626
7627 !! test
7628 Non-English #REDIRECT
7629 !! options
7630 parsoid
7631 language=is
7632 !! wikitext
7633 #TILVÍSUN [[Main Page]]
7634 !! html
7635 <link rel="mw:PageProp/redirect" href="./Main_Page">
7636 !! end
7637
7638 !! test
7639 New redirect
7640 !! options
7641 parsoid=html2wt
7642 !! html
7643 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7644 !! wikitext
7645 Foo
7646 #REDIRECT [[Foo]]
7647 !! end
7648
7649 ##
7650 ## XHTML tidiness
7651 ###
7652
7653 !! test
7654 <br> to <br />
7655 !! wikitext
7656 1<br>2<br />3
7657 !! html
7658 <p>1<br />2<br />3
7659 </p>
7660 !! end
7661
7662 !! test
7663 Broken br tag sanitization
7664 !! wikitext
7665 </br>
7666 !! html/php
7667 <p>&lt;/br&gt;
7668 </p>
7669 !! end
7670
7671 # TODO: Fix html2html mode (bug 51055)!
7672 # This </br> handling was added as part of bug 50831; but it
7673 # differs from how PHP+tidy handles this. We should investigate
7674 # this.
7675 !! test
7676 Parsoid: Broken br tag recognition
7677 !! options
7678 parsoid=wt2html
7679 !! wikitext
7680 </br>
7681
7682 <br/ >
7683 !! html/php+tidy
7684 <p>&lt;/br&gt;</p>
7685 <p><br /></p>
7686 !! html/parsoid
7687 <p><br></p>
7688 <p><br/></p>
7689 !! end
7690
7691 !! test
7692 Incorrecly removing closing slashes from correctly formed XHTML
7693 !! wikitext
7694 <br style="clear:both;" />
7695 !! html
7696 <p><br style="clear:both;" />
7697 </p>
7698 !! end
7699
7700 !! test
7701 Failing to transform badly formed HTML into correct XHTML
7702 !! wikitext
7703 <br style="clear: left;">
7704 <br style="clear: right;">
7705 <br style="clear: both;">
7706 !! html
7707 <p><br style="clear: left;" />
7708 <br style="clear: right;" />
7709 <br style="clear: both;" />
7710 </p>
7711 !!end
7712
7713 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7714 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7715 !! test
7716 Handling html with a div self-closing tag
7717 !! wikitext
7718 <div title />
7719 <div title/>
7720 <div title/ >
7721 <div title=bar />
7722 <div title=bar/>
7723 <div title=bar/ >
7724 !! html/php
7725 <p>&lt;div title /&gt;
7726 &lt;div title/&gt;
7727 </p>
7728 <div>
7729 <p>&lt;div title=bar /&gt;
7730 &lt;div title=bar/&gt;
7731 </p>
7732 <div title="bar/"></div>
7733 </div>
7734
7735 !! html/parsoid
7736 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7737 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7738 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7739 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7740 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7741 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7742 !! end
7743
7744 !! test
7745 Handling html with a br self-closing tag
7746 !! wikitext
7747 <br title />
7748 <br title/>
7749 <br title/ >
7750 <br title=bar />
7751 <br title=bar/>
7752 <br title=bar/ >
7753 !! html/php
7754 <p><br title="title" />
7755 <br title="title" />
7756 <br />
7757 <br title="bar" />
7758 <br title="bar" />
7759 <br title="bar/" />
7760 </p>
7761 !! html/parsoid
7762 <p><br title="" />
7763 <br title="" />
7764 <br title="" />
7765 <br title="bar" />
7766 <br title="bar" />
7767 <br title="bar/" />
7768 </p>
7769 !! end
7770
7771 !! test
7772 Horizontal ruler (should it add that extra space?)
7773 !! wikitext
7774 <hr>
7775 <hr >
7776 foo <hr
7777 > bar
7778 !! html+tidy
7779 <hr />
7780 <hr />
7781 <p>foo</p>
7782 <hr />
7783 <p>bar</p>
7784 !! end
7785
7786 !! test
7787 Horizontal ruler -- 4+ dashes render hr
7788 !! wikitext
7789 ----
7790 !! html
7791 <hr />
7792
7793 !! end
7794
7795 !! test
7796 Horizontal ruler -- eats additional dashes on the same line
7797 !! wikitext
7798 ---------
7799 !! html
7800 <hr />
7801
7802 !! end
7803
7804 !! test
7805 Horizontal ruler -- does not collapse dashes on consecutive lines
7806 !! wikitext
7807 ----
7808 ----
7809 !! html
7810 <hr />
7811 <hr />
7812
7813 !! end
7814
7815 !! test
7816 Horizontal ruler -- <4 dashes render as plain text
7817 !! wikitext
7818 ---
7819 !! html
7820 <p>---
7821 </p>
7822 !! end
7823
7824 !! test
7825 Horizontal ruler -- Supports content following dashes on same line
7826 !! wikitext
7827 ---- Foo
7828 !! html
7829 <hr /> Foo
7830
7831 !! html+tidy
7832 <hr />
7833 <p>Foo</p>
7834 !! end
7835
7836 ###
7837 ### Block-level elements
7838 ###
7839 !! test
7840 Common list
7841 !! wikitext
7842 *Common list
7843 * item 2
7844 *item 3
7845 !! html
7846 <ul><li>Common list</li>
7847 <li> item 2</li>
7848 <li>item 3</li></ul>
7849
7850 !! end
7851
7852 !! test
7853 Numbered list
7854 !! wikitext
7855 #Numbered list
7856 #item 2
7857 # item 3
7858 !! html
7859 <ol><li>Numbered list</li>
7860 <li>item 2</li>
7861 <li> item 3</li></ol>
7862
7863 !! end
7864
7865 !! test
7866 Mixed list
7867 !! wikitext
7868 *Mixed list
7869 *# with numbers
7870 ** and bullets
7871 *# and numbers
7872 *bullets again
7873 **bullet level 2
7874 ***bullet level 3
7875 ***#Number on level 4
7876 **bullet level 2
7877 **#Number on level 3
7878 **#Number on level 3
7879 *#number level 2
7880 *Level 1
7881 *** Level 3
7882 #** Level 3, but ordered
7883 !! html
7884 <ul><li>Mixed list
7885 <ol><li> with numbers</li></ol>
7886 <ul><li> and bullets</li></ul>
7887 <ol><li> and numbers</li></ol></li>
7888 <li>bullets again
7889 <ul><li>bullet level 2
7890 <ul><li>bullet level 3
7891 <ol><li>Number on level 4</li></ol></li></ul></li>
7892 <li>bullet level 2
7893 <ol><li>Number on level 3</li>
7894 <li>Number on level 3</li></ol></li></ul>
7895 <ol><li>number level 2</li></ol></li>
7896 <li>Level 1
7897 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7898 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7899
7900 !! end
7901
7902 !! test
7903 Nested lists 1
7904 !! wikitext
7905 *foo
7906 **bar
7907 !! html
7908 <ul><li>foo
7909 <ul><li>bar</li></ul></li></ul>
7910
7911 !! end
7912
7913 !! test
7914 Nested lists 2
7915 !! wikitext
7916 **foo
7917 *bar
7918 !! html
7919 <ul><li><ul><li>foo</li></ul></li>
7920 <li>bar</li></ul>
7921
7922 !! end
7923
7924 !! test
7925 Nested lists 3 (first element empty)
7926 !! wikitext
7927 *
7928 **bar
7929 !! html
7930 <ul><li>
7931 <ul><li>bar</li></ul></li></ul>
7932
7933 !! end
7934
7935 !! test
7936 Nested lists 4 (first element empty)
7937 !! wikitext
7938 **
7939 *bar
7940 !! html
7941 <ul><li><ul><li></li></ul></li>
7942 <li>bar</li></ul>
7943
7944 !! end
7945
7946 !! test
7947 Nested lists 5 (both elements empty)
7948 !! wikitext
7949 **
7950 *
7951 !! html
7952 <ul><li><ul><li></li></ul></li>
7953 <li></li></ul>
7954
7955 !! end
7956
7957 !! test
7958 Nested lists 6 (both elements empty)
7959 !! wikitext
7960 *
7961 **
7962 !! html
7963 <ul><li>
7964 <ul><li></li></ul></li></ul>
7965
7966 !! end
7967
7968 !! test
7969 Nested lists 7 (skip initial nesting levels)
7970 !! wikitext
7971 *** foo
7972 !! html
7973 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7974
7975 !! end
7976
7977 !! test
7978 Nested lists 8 (multiple nesting transitions)
7979 !! wikitext
7980 * foo
7981 *** bar
7982 ** baz
7983 * boo
7984 !! html
7985 <ul><li> foo
7986 <ul><li><ul><li> bar</li></ul></li>
7987 <li> baz</li></ul></li>
7988 <li> boo</li></ul>
7989
7990 !! end
7991
7992 !! test
7993 1. Lists with start-of-line-transparent tokens before bullets: Comments
7994 !! wikitext
7995 *foo
7996 *<!--cmt-->bar
7997 <!--cmt-->*baz
7998 !! html
7999 <ul><li>foo</li>
8000 <li>bar</li>
8001 <li>baz</li></ul>
8002
8003 !! end
8004
8005 !! test
8006 2. Lists with start-of-line-transparent tokens before bullets: Template close
8007 !! wikitext
8008 *foo {{echo|bar
8009 }}*baz
8010 !! html
8011 <ul><li>foo bar</li>
8012 <li>baz</li></ul>
8013
8014 !! end
8015
8016 !! test
8017 List items are not parsed correctly following a <pre> block (bug 785)
8018 !! wikitext
8019 * <pre>foo</pre>
8020 * <pre>bar</pre>
8021 * zar
8022 !! html
8023 <ul><li> <pre>foo</pre></li>
8024 <li> <pre>bar</pre></li>
8025 <li> zar</li></ul>
8026
8027 !! end
8028
8029 !! test
8030 List items from template
8031 !! wikitext
8032
8033 {{inner list}}
8034 * item 2
8035
8036 * item 0
8037 {{inner list}}
8038 * item 2
8039
8040 * item 0
8041 * notSOL{{inner list}}
8042 * item 2
8043 !! html
8044 <ul><li> item 1</li>
8045 <li> item 2</li></ul>
8046 <ul><li> item 0</li>
8047 <li> item 1</li>
8048 <li> item 2</li></ul>
8049 <ul><li> item 0</li>
8050 <li> notSOL</li>
8051 <li> item 1</li>
8052 <li> item 2</li></ul>
8053
8054 !! end
8055
8056 !! test
8057 List interrupted by empty line or heading
8058 !! wikitext
8059 * foo
8060
8061 ** bar
8062 == A heading ==
8063 * Another list item
8064 !! html
8065 <ul><li> foo</li></ul>
8066 <ul><li><ul><li> bar</li></ul></li></ul>
8067 <h2><a href="#A_heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
8068 <ul><li> Another list item</li></ul>
8069
8070 !!end
8071
8072 !!test
8073 Multiple list tags generated by templates
8074 !! wikitext
8075 {{echo|<li>}}a
8076 {{echo|<li>}}b
8077 {{echo|<li>}}c
8078 !! html
8079 <li>a
8080 <li>b
8081 <li>c</li>
8082 </li>
8083 </li>
8084
8085 !! html+tidy
8086 <ul>
8087 <li>a</li>
8088 <li>b</li>
8089 <li>c</li>
8090 </ul>
8091 !!end
8092
8093 !!test
8094 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8095 !! wikitext
8096 *a
8097 <!--This line will NOT split the list-->
8098 *b
8099 <!--This line will NOT split the list either-->
8100 *c
8101 <!--foo--> <!----> <!--This line NOT split the list either-->
8102 *d
8103 !! html
8104 <ul><li>a</li>
8105 <li>b</li>
8106 <li>c</li>
8107 <li>d</li></ul>
8108
8109 !!end
8110
8111 !!test
8112 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8113 !! wikitext
8114 *a
8115 <!--This line will NOT split the list-->
8116 *b
8117 <!--This line will NOT split the list either-->
8118 *c
8119 <!--foo--> <!----> <!--This line NOT split the list
8120 either-->
8121 *d
8122 !! html
8123 <ul><li>a</li>
8124 <li>b</li>
8125 <li>c</li>
8126 <li>d</li></ul>
8127
8128 !!end
8129
8130 !!test
8131 Test the li-hack
8132 (The PHP parser relies on Tidy for the hack)
8133 !!options
8134 parsoid=wt2html,wt2wt
8135 !! wikitext
8136 * foo
8137 * <li>li-hack
8138 * {{echo|<li>templated li-hack}}
8139 * <!--foo--> <li> unsupported li-hack with preceding comments
8140
8141 <ul>
8142 <li><li>not a li-hack
8143 </li>
8144 </ul>
8145 !! html+tidy
8146 <ul>
8147 <li>foo</li>
8148 <li>li-hack</li>
8149 <li>templated li-hack</li>
8150 <li>unsupported li-hack with preceding comments</li>
8151 </ul>
8152 <ul>
8153 <li>not a li-hack</li>
8154 </ul>
8155 !!end
8156
8157 !! test
8158 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8159 !! options
8160 parsoid
8161 !! wikitext
8162 # foo
8163 ## bar
8164 * foo
8165 ** bar
8166 : foo
8167 :: bar
8168 !! html
8169 <ol>
8170 <li> foo<ol>
8171 <li> bar</li>
8172 </ol></li>
8173 </ol><ul>
8174 <li> foo<ul>
8175 <li> bar</li>
8176 </ul></li>
8177 </ul><dl>
8178 <dd> foo<dl>
8179 <dd> bar</dd>
8180 </dl></dd>
8181 </dl>
8182 !! end
8183
8184 !! test
8185 Parsoid: Test of whitespace serialization with Templated bullets
8186 !! options
8187 parsoid
8188 !! wikitext
8189 * {{bullet}}
8190 !! html
8191 <ul>
8192 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8193 </ul>
8194 !! end
8195
8196 # ------------------------------------------------------------------------
8197 # The next set of tests are about Parsoid's ability to handle badly nested
8198 # tags (parse, minimize scope of fixup, and roundtrip back)
8199 # ------------------------------------------------------------------------
8200
8201 !! test
8202 Unbalanced closing block tags break a list
8203 (php parser relies on Tidy to fix up)
8204 !! wikitext
8205 <div>
8206 *a</div><div>
8207 *b</div>
8208 !! html+tidy
8209 <div>
8210 <ul>
8211 <li>a</li>
8212 </ul>
8213 </div>
8214 <div>
8215 <ul>
8216 <li>b</li>
8217 </ul>
8218 </div>
8219 !! end
8220
8221 # Parsoid fails this test, but it might be tricky to support properly.
8222 # See bug 68395.
8223 !! test
8224 Unbalanced closing non-block tags don't break a list
8225 (php parser relies on Tidy to fix up)
8226 !! wikitext
8227 <span>
8228 *a</span><span>
8229 *b</span>
8230 !! html/php+tidy
8231 <ul>
8232 <li><span>a</span></li>
8233 <li><span>b</span></li>
8234 </ul>
8235 !! html/parsoid
8236 <span>
8237 <ul>
8238 <li>a<span></span>
8239 </li>
8240 <li>b
8241 </li>
8242 </ul>
8243 </span>
8244 !! end
8245
8246 !! test
8247 Unclosed formatting tags that straddle lists are closed and reopened
8248 (php parser relies on Tidy to fix up)
8249 !! options
8250 parsoid=wt2html,wt2wt,html2html
8251 !! wikitext
8252 # <s> a
8253 # b </s>
8254 !! html/php+tidy
8255 <ol>
8256 <li><s>a</s></li>
8257 <li><s>b</s></li>
8258 </ol>
8259 !! html/parsoid
8260 <ol><li> <s> a</s></li>
8261 <li><s> b </s></li></ol>
8262 !! end
8263
8264 # Parsoid fails this test, but it might be tricky to support properly.
8265 # See bug 68395.
8266 !!test
8267 List embedded in a non-block tag
8268 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8269 !! wikitext
8270 <small>
8271 * foo
8272 </small>
8273 !! html/php+tidy
8274 <ul>
8275 <li><small>foo</small></li>
8276 </ul>
8277 !! html/parsoid
8278 <small>
8279 <ul>
8280 <li> foo</li>
8281 </ul>
8282 </small>
8283 !!end
8284
8285 # This is a bug in the PHP parser + tidy combination.
8286 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8287 # and then fostered out of the table by tidy.)
8288 # We believe the Parsoid output to be correct.
8289 !! test
8290 Table with missing opening <tr> tag
8291 !! options
8292 parsoid=wt2html,wt2wt
8293 !! wikitext
8294 <table>
8295 <td>foo</td>
8296 </tr>
8297 </table>
8298 !! html/php+tidy
8299 <p>&lt;/tr&gt;</p>
8300 <table>
8301 <tr>
8302 <td>foo</td>
8303 </tr>
8304 </table>
8305 !! html/parsoid
8306 <table>
8307 <tr>
8308 <td>foo</td>
8309 </tr>
8310 </table>
8311 !! end
8312
8313 ###
8314 ### Magic Words
8315 ###
8316
8317 # Note that the current date is hard-coded as
8318 # 1970-01-01T00:02:03Z (a Thursday)
8319 # when running parser tests. The timezone is also fixed to GMT, so
8320 # local date will be identical to current date.
8321
8322 !! test
8323 Magic Word: {{CURRENTDAY}}
8324 !! wikitext
8325 {{CURRENTDAY}}
8326 !! html
8327 <p>1
8328 </p>
8329 !! end
8330
8331 !! test
8332 Magic Word: {{CURRENTDAY2}}
8333 !! wikitext
8334 {{CURRENTDAY2}}
8335 !! html
8336 <p>01
8337 </p>
8338 !! end
8339
8340 !! test
8341 Magic Word: {{CURRENTDAYNAME}}
8342 !! wikitext
8343 {{CURRENTDAYNAME}}
8344 !! html
8345 <p>Thursday
8346 </p>
8347 !! end
8348
8349 !! test
8350 Magic Word: {{CURRENTDOW}}
8351 !! wikitext
8352 {{CURRENTDOW}}
8353 !! html
8354 <p>4
8355 </p>
8356 !! end
8357
8358 !! test
8359 Magic Word: {{CURRENTMONTH}}
8360 !! wikitext
8361 {{CURRENTMONTH}}
8362 !! html
8363 <p>01
8364 </p>
8365 !! end
8366
8367 !! test
8368 Magic Word: {{CURRENTMONTH1}}
8369 !! wikitext
8370 {{CURRENTMONTH1}}
8371 !! html
8372 <p>1
8373 </p>
8374 !! end
8375
8376 !! test
8377 Magic Word: {{CURRENTMONTHABBREV}}
8378 !! wikitext
8379 {{CURRENTMONTHABBREV}}
8380 !! html
8381 <p>Jan
8382 </p>
8383 !! end
8384
8385 !! test
8386 Magic Word: {{CURRENTMONTHNAME}}
8387 !! wikitext
8388 {{CURRENTMONTHNAME}}
8389 !! html
8390 <p>January
8391 </p>
8392 !! end
8393
8394 !! test
8395 Magic Word: {{CURRENTMONTHNAMEGEN}}
8396 !! wikitext
8397 {{CURRENTMONTHNAMEGEN}}
8398 !! html
8399 <p>January
8400 </p>
8401 !! end
8402
8403 !! test
8404 Magic Word: {{CURRENTTIME}}
8405 !! wikitext
8406 {{CURRENTTIME}}
8407 !! html
8408 <p>00:02
8409 </p>
8410 !! end
8411
8412 !! test
8413 Magic Word: {{CURRENTHOUR}}
8414 !! wikitext
8415 {{CURRENTHOUR}}
8416 !! html
8417 <p>00
8418 </p>
8419 !! end
8420
8421 !! test
8422 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8423 !! wikitext
8424 {{CURRENTWEEK}}
8425 !! html
8426 <p>1
8427 </p>
8428 !! end
8429
8430 !! test
8431 Magic Word: {{CURRENTYEAR}}
8432 !! wikitext
8433 {{CURRENTYEAR}}
8434 !! html
8435 <p>1970
8436 </p>
8437 !! end
8438
8439 !! test
8440 Magic Word: {{CURRENTTIMESTAMP}}
8441 !! wikitext
8442 {{CURRENTTIMESTAMP}}
8443 !! html
8444 <p>19700101000203
8445 </p>
8446 !! end
8447
8448 !! test
8449 Magic Words LOCAL (UTC)
8450 !! wikitext
8451 * {{LOCALMONTH}}
8452 * {{LOCALMONTH1}}
8453 * {{LOCALMONTHNAME}}
8454 * {{LOCALMONTHNAMEGEN}}
8455 * {{LOCALMONTHABBREV}}
8456 * {{LOCALDAY}}
8457 * {{LOCALDAY2}}
8458 * {{LOCALDAYNAME}}
8459 * {{LOCALYEAR}}
8460 * {{LOCALTIME}}
8461 * {{LOCALHOUR}}
8462 * {{LOCALWEEK}}
8463 * {{LOCALDOW}}
8464 * {{LOCALTIMESTAMP}}
8465 !! html
8466 <ul><li> 01</li>
8467 <li> 1</li>
8468 <li> January</li>
8469 <li> January</li>
8470 <li> Jan</li>
8471 <li> 1</li>
8472 <li> 01</li>
8473 <li> Thursday</li>
8474 <li> 1970</li>
8475 <li> 00:02</li>
8476 <li> 00</li>
8477 <li> 1</li>
8478 <li> 4</li>
8479 <li> 19700101000203</li></ul>
8480
8481 !! end
8482
8483 !! test
8484 Magic Word: {{FULLPAGENAME}}
8485 !! options
8486 title=[[User:Ævar Arnfjörð Bjarmason]]
8487 !! wikitext
8488 {{FULLPAGENAME}}
8489 !! html
8490 <p>User:Ævar Arnfjörð Bjarmason
8491 </p>
8492 !! end
8493
8494 !! test
8495 Magic Word: {{FULLPAGENAMEE}}
8496 !! options
8497 title=[[User:Ævar Arnfjörð Bjarmason]]
8498 !! wikitext
8499 {{FULLPAGENAMEE}}
8500 !! html
8501 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8502 </p>
8503 !! end
8504
8505 !! test
8506 Magic Word: {{TALKSPACE}}
8507 !! options
8508 title=[[User:Ævar Arnfjörð Bjarmason]]
8509 !! wikitext
8510 {{TALKSPACE}}
8511 !! html
8512 <p>User talk
8513 </p>
8514 !! end
8515
8516 !! test
8517 Magic Word: {{TALKSPACE}}, same namespace
8518 !! options
8519 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8520 !! wikitext
8521 {{TALKSPACE}}
8522 !! html
8523 <p>User talk
8524 </p>
8525 !! end
8526
8527 !! test
8528 Magic Word: {{TALKSPACE}}, main namespace
8529 !! options
8530 title=[[Parser Test]]
8531 !! wikitext
8532 {{TALKSPACE}}
8533 !! html
8534 <p>Talk
8535 </p>
8536 !! end
8537
8538 !! test
8539 Magic Word: {{TALKSPACEE}}
8540 !! options
8541 title=[[User:Ævar Arnfjörð Bjarmason]]
8542 !! wikitext
8543 {{TALKSPACEE}}
8544 !! html
8545 <p>User_talk
8546 </p>
8547 !! end
8548
8549 !! test
8550 Magic Word: {{SUBJECTSPACE}}
8551 !! options
8552 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8553 !! wikitext
8554 {{SUBJECTSPACE}}
8555 !! html
8556 <p>User
8557 </p>
8558 !! end
8559
8560 !! test
8561 Magic Word: {{SUBJECTSPACE}}, same namespace
8562 !! options
8563 title=[[User:Ævar Arnfjörð Bjarmason]]
8564 !! wikitext
8565 {{SUBJECTSPACE}}
8566 !! html
8567 <p>User
8568 </p>
8569 !! end
8570
8571 !! test
8572 Magic Word: {{SUBJECTSPACE}}, main namespace
8573 !! options
8574 title=[[Parser Test]]
8575 !! wikitext
8576 {{SUBJECTSPACE}}
8577 !! html
8578
8579 !! end
8580
8581 !! test
8582 Magic Word: {{SUBJECTSPACEE}}
8583 !! options
8584 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8585 !! wikitext
8586 {{SUBJECTSPACEE}}
8587 !! html
8588 <p>User
8589 </p>
8590 !! end
8591
8592 !! test
8593 Magic Word: {{NAMESPACE}}
8594 !! options
8595 title=[[User:Ævar Arnfjörð Bjarmason]]
8596 !! wikitext
8597 {{NAMESPACE}}
8598 !! html
8599 <p>User
8600 </p>
8601 !! end
8602
8603 !! test
8604 Magic Word: {{NAMESPACEE}}
8605 !! options
8606 title=[[User:Ævar Arnfjörð Bjarmason]]
8607 !! wikitext
8608 {{NAMESPACEE}}
8609 !! html
8610 <p>User
8611 </p>
8612 !! end
8613
8614 !! test
8615 Magic Word: {{NAMESPACENUMBER}}
8616 !! options
8617 title=[[User:Ævar Arnfjörð Bjarmason]]
8618 !! wikitext
8619 {{NAMESPACENUMBER}}
8620 !! html
8621 <p>2
8622 </p>
8623 !! end
8624
8625 !! test
8626 Magic Word: {{SUBPAGENAME}}
8627 !! options
8628 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8629 !! wikitext
8630 {{SUBPAGENAME}}
8631 !! html
8632 <p>sub ö
8633 </p>
8634 !! end
8635
8636 !! test
8637 Magic Word: {{SUBPAGENAMEE}}
8638 !! options
8639 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8640 !! wikitext
8641 {{SUBPAGENAMEE}}
8642 !! html
8643 <p>sub_%C3%B6
8644 </p>
8645 !! end
8646
8647 !! test
8648 Magic Word: {{ROOTPAGENAME}}
8649 !! options
8650 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8651 !! wikitext
8652 {{ROOTPAGENAME}}
8653 !! html
8654 <p>Ævar Arnfjörð Bjarmason
8655 </p>
8656 !! end
8657
8658 !! test
8659 Magic Word: {{ROOTPAGENAMEE}}
8660 !! options
8661 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8662 !! wikitext
8663 {{ROOTPAGENAMEE}}
8664 !! html
8665 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8666 </p>
8667 !! end
8668
8669 !! test
8670 Magic Word: {{BASEPAGENAME}}
8671 !! options
8672 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8673 !! wikitext
8674 {{BASEPAGENAME}}
8675 !! html
8676 <p>Ævar Arnfjörð Bjarmason
8677 </p>
8678 !! end
8679
8680 !! test
8681 Magic Word: {{BASEPAGENAMEE}}
8682 !! options
8683 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8684 !! wikitext
8685 {{BASEPAGENAMEE}}
8686 !! html
8687 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8688 </p>
8689 !! end
8690
8691 !! test
8692 Magic Word: {{TALKPAGENAME}}
8693 !! options
8694 title=[[User:Ævar Arnfjörð Bjarmason]]
8695 !! wikitext
8696 {{TALKPAGENAME}}
8697 !! html
8698 <p>User talk:Ævar Arnfjörð Bjarmason
8699 </p>
8700 !! end
8701
8702 !! test
8703 Magic Word: {{TALKPAGENAMEE}}
8704 !! options
8705 title=[[User:Ævar Arnfjörð Bjarmason]]
8706 !! wikitext
8707 {{TALKPAGENAMEE}}
8708 !! html
8709 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8710 </p>
8711 !! end
8712
8713 !! test
8714 Magic Word: {{SUBJECTPAGENAME}}
8715 !! options
8716 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8717 !! wikitext
8718 {{SUBJECTPAGENAME}}
8719 !! html
8720 <p>User:Ævar Arnfjörð Bjarmason
8721 </p>
8722 !! end
8723
8724 !! test
8725 Magic Word: {{SUBJECTPAGENAMEE}}
8726 !! options
8727 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8728 !! wikitext
8729 {{SUBJECTPAGENAMEE}}
8730 !! html
8731 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8732 </p>
8733 !! end
8734
8735 !! test
8736 Magic Word: {{NUMBEROFFILES}}
8737 !! wikitext
8738 {{NUMBEROFFILES}}
8739 !! html
8740 <p>5
8741 </p>
8742 !! end
8743
8744 !! test
8745 Magic Word: {{PAGENAME}}
8746 !! options
8747 title=[[User:Ævar Arnfjörð Bjarmason]]
8748 !! wikitext
8749 {{PAGENAME}}
8750 !! html
8751 <p>Ævar Arnfjörð Bjarmason
8752 </p>
8753 !! end
8754
8755 !! test
8756 Magic Word: {{PAGENAME}} with metacharacters
8757 !! options
8758 title=[['foo & bar = baz']]
8759 !! wikitext
8760 ''{{PAGENAME}}''
8761 !! html/php
8762 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8763 </p>
8764 !! html+tidy
8765 <p><i>'foo &amp; bar = baz'</i></p>
8766 !! end
8767
8768 !! test
8769 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8770 !! options
8771 title=[[*RFC 1234 http://example.com/]]
8772 !! wikitext
8773 {{PAGENAME}}
8774 !! html/php
8775 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8776 </p>
8777 !! html+tidy
8778 <p>*RFC 1234 http://example.com/</p>
8779 !! end
8780
8781 !! test
8782 Magic Word: {{PAGENAMEE}}
8783 !! options
8784 title=[[User:Ævar Arnfjörð Bjarmason]]
8785 !! wikitext
8786 {{PAGENAMEE}}
8787 !! html
8788 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8789 </p>
8790 !! end
8791
8792 !! test
8793 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8794 !! options
8795 title=[[*RFC 1234 http://example.com/]]
8796 !! wikitext
8797 {{PAGENAMEE}}
8798 !! html/php
8799 <p>&#42;RFC_1234_http&#58;//example.com/
8800 </p>
8801 !! html+tidy
8802 <p>*RFC_1234_http://example.com/</p>
8803 !! end
8804
8805 !! test
8806 Magic Word: {{REVISIONID}}
8807 !! wikitext
8808 {{REVISIONID}}
8809 !! html
8810 <p>1337
8811 </p>
8812 !! end
8813
8814 !! test
8815 Magic Word: {{SCRIPTPATH}}
8816 !! wikitext
8817 {{SCRIPTPATH}}
8818 !! html
8819 <p>/
8820 </p>
8821 !! end
8822
8823 !! test
8824 Magic Word: {{STYLEPATH}}
8825 !! wikitext
8826 {{STYLEPATH}}
8827 !! html
8828 <p>/skins
8829 </p>
8830 !! end
8831
8832 !! test
8833 Magic Word: {{SERVER}}
8834 !! wikitext
8835 {{SERVER}}
8836 !! html
8837 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8838 </p>
8839 !! end
8840
8841 !! test
8842 Magic Word: {{SERVERNAME}}
8843 !! wikitext
8844 {{SERVERNAME}}
8845 !! html
8846 <p>example.org
8847 </p>
8848 !! end
8849
8850 !! test
8851 Magic Word: {{SITENAME}}
8852 !! wikitext
8853 {{SITENAME}}
8854 !! html
8855 <p>MediaWiki
8856 </p>
8857 !! end
8858
8859 !! test
8860 Case-sensitive magic words, when cased differently, should just be template transclusions
8861 !! wikitext
8862 {{CurrentMonth}}
8863 {{currentday}}
8864 {{cURreNTweEK}}
8865 {{currentHour}}
8866 !! html
8867 <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>
8868 <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>
8869 <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>
8870 <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>
8871 </p>
8872 !! end
8873
8874 !! test
8875 Case-insensitive magic words should still work with weird casing.
8876 !! wikitext
8877 {{sErVeRNaMe}}
8878 {{LCFirst:AOEU}}
8879 {{ucFIRST:aoeu}}
8880 {{SERver}}
8881 !! html
8882 <p>example.org
8883 aOEU
8884 Aoeu
8885 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8886 </p>
8887 !! end
8888
8889 # From plwiki:PLOS_ONE
8890 !! test
8891 Parsoid: Page property magic word with magic word contents
8892 !! wikitext
8893 {{DISPLAYTITLE:''{{PAGENAME}}''}}
8894 !! html/parsoid
8895 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
8896 !! end
8897
8898 !! test
8899 Parsoid: Template-generated DISPLAYTITLE
8900 !! wikitext
8901 {{{{echo|DISPLAYTITLE}}:Foo}}
8902 !! html/parsoid
8903 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
8904 !! end
8905
8906 !! test
8907 Namespace 1 {{ns:1}}
8908 !! wikitext
8909 {{ns:1}}
8910 !! html
8911 <p>Talk
8912 </p>
8913 !! end
8914
8915 !! test
8916 Namespace 1 {{ns:01}}
8917 !! wikitext
8918 {{ns:01}}
8919 !! html
8920 <p>Talk
8921 </p>
8922 !! end
8923
8924 !! test
8925 Namespace 0 {{ns:0}} (bug 4783)
8926 !! wikitext
8927 {{ns:0}}
8928 !! html
8929
8930 !! end
8931
8932 !! test
8933 Namespace 0 {{ns:00}} (bug 4783)
8934 !! wikitext
8935 {{ns:00}}
8936 !! html
8937
8938 !! end
8939
8940 !! test
8941 Namespace -1 {{ns:-1}}
8942 !! wikitext
8943 {{ns:-1}}
8944 !! html
8945 <p>Special
8946 </p>
8947 !! end
8948
8949 !! test
8950 Namespace User {{ns:User}}
8951 !! wikitext
8952 {{ns:User}}
8953 !! html
8954 <p>User
8955 </p>
8956 !! end
8957
8958 !! test
8959 Namespace User talk {{ns:User_talk}}
8960 !! wikitext
8961 {{ns:User_talk}}
8962 !! html
8963 <p>User talk
8964 </p>
8965 !! end
8966
8967 !! test
8968 Namespace User talk {{ns:uSeR tAlK}}
8969 !! wikitext
8970 {{ns:uSeR tAlK}}
8971 !! html
8972 <p>User talk
8973 </p>
8974 !! end
8975
8976 !! test
8977 Namespace File {{ns:File}}
8978 !! wikitext
8979 {{ns:File}}
8980 !! html
8981 <p>File
8982 </p>
8983 !! end
8984
8985 !! test
8986 Namespace File {{ns:Image}}
8987 !! wikitext
8988 {{ns:Image}}
8989 !! html
8990 <p>File
8991 </p>
8992 !! end
8993
8994 !! test
8995 Namespace (lang=de) Benutzer {{ns:User}}
8996 !! options
8997 language=de
8998 !! wikitext
8999 {{ns:User}}
9000 !! html
9001 <p>Benutzer
9002 </p>
9003 !! end
9004
9005 !! test
9006 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9007 !! options
9008 language=de
9009 !! wikitext
9010 {{ns:3}}
9011 !! html
9012 <p>Benutzer Diskussion
9013 </p>
9014 !! end
9015
9016
9017 !! test
9018 Urlencode
9019 !! wikitext
9020 {{urlencode:hi world?!}}
9021 {{urlencode:hi world?!|WIKI}}
9022 {{urlencode:hi world?!|PATH}}
9023 {{urlencode:hi world?!|QUERY}}
9024 !! html
9025 <p>hi+world%3F%21
9026 hi_world%3F!
9027 hi%20world%3F%21
9028 hi+world%3F%21
9029 </p>
9030 !! end
9031
9032 !! test
9033 Magic Word: prioritize type info over data-parsoid
9034 !! options
9035 parsoid=html2wt
9036 !! html
9037 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9038 !! wikitext
9039 __FORCETOC__
9040 !! end
9041
9042 !! test
9043 Magic Word: serialize on separate line (parsoid)
9044 !! options
9045 parsoid=wt2wt,html2wt
9046 !! wikitext
9047 foo
9048 __NOTOC__
9049 bar
9050 !! html
9051 foo<meta property="mw:PageProp/notoc"/>bar
9052 !! end
9053
9054 !! test
9055 Magic Word: rt non-english wikis
9056 !! options
9057 parsoid=wt2wt
9058 language=de
9059 !! wikitext
9060 __NOEDITSECTION__
9061 !! html
9062 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9063 !! end
9064
9065 ###
9066 ### Magic links
9067 ###
9068 !! test
9069 Magic links: internal link to RFC (bug 479)
9070 !! wikitext
9071 [[RFC 123]]
9072 !! html
9073 <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>
9074 </p>
9075 !! end
9076
9077 !! test
9078 Magic links: RFC (bug 479)
9079 !! wikitext
9080 RFC 822
9081 !! html
9082 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9083 </p>
9084 !! end
9085
9086 !! test
9087 Magic links: RFC (bug 65278)
9088 !! wikitext
9089 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9090 !! html
9091 <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.
9092 </p>
9093 !! end
9094
9095 !! test
9096 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9097 !! wikitext
9098 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9099 RFC
9100 822
9101 !! html
9102 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9103 RFC
9104 822
9105 </p>
9106 !! end
9107
9108 !! test
9109 Magic links: ISBN (bug 1937)
9110 !! wikitext
9111 ISBN 0-306-40615-2
9112 !! html
9113 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9114 </p>
9115 !! end
9116
9117 !! test
9118 Magic links: ISBN (bug 65278)
9119 !! wikitext
9120 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9121 !! html/php
9122 <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.
9123 </p>
9124 !! html/parsoid
9125 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9126 !! end
9127
9128 !! test
9129 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9130 !! wikitext
9131 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9132 ISBN
9133 9780316098113
9134 ISBN 978
9135 0316098113
9136 !! html
9137 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9138 ISBN
9139 9780316098113
9140 ISBN 978
9141 0316098113
9142 </p>
9143 !! end
9144
9145 !! test
9146 Magic links: PMID incorrectly converts space to underscore
9147 !! wikitext
9148 PMID 1234
9149 !! html
9150 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9151 </p>
9152 !! end
9153
9154 !! test
9155 Magic links: PMID (bug 65278)
9156 !! wikitext
9157 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9158 !! html
9159 <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.
9160 </p>
9161 !! end
9162
9163 !! test
9164 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9165 !! wikitext
9166 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9167 PMID
9168 1234
9169 !! html
9170 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9171 PMID
9172 1234
9173 </p>
9174 !! end
9175
9176 ###
9177 ### Templates
9178 ####
9179
9180 !! test
9181 Nonexistent template
9182 !! wikitext
9183 {{thistemplatedoesnotexist}}
9184 !! html
9185 <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>
9186 </p>
9187 !! end
9188
9189 !! test
9190 Template with invalid target containing tags
9191 !! wikitext
9192 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9193 !! html
9194 <p>{{a<b>b</b>|foo|a=b|a = b}}
9195 </p>
9196 !! end
9197
9198 !! test
9199 Template with invalid target containing unclosed tag
9200 !! wikitext
9201 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9202 !! html
9203 <p>{{a<b>|foo|a=b|a = b}}</b>
9204 </p>
9205 !! end
9206
9207 !! test
9208 Template with invalid target containing wikilink
9209 !! wikitext
9210 {{[[Main Page]]}}
9211 !! html/php
9212 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9213 </p>
9214 !! html/parsoid
9215 <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>
9216 !! end
9217
9218 !! test
9219 Template with just whitespace in it, bug #68421
9220 !! wikitext
9221 {{echo|{{ }}}}
9222 !! html/parsoid
9223 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9224 !! end
9225
9226 !! article
9227 Template:test
9228 !! text
9229 This is a test template
9230 !! endarticle
9231
9232 !! test
9233 Simple template
9234 !! wikitext
9235 {{test}}
9236 !! html
9237 <p>This is a test template
9238 </p>
9239 !! end
9240
9241 !! test
9242 Template with explicit namespace
9243 !! wikitext
9244 {{Template:test}}
9245 !! html
9246 <p>This is a test template
9247 </p>
9248 !! end
9249
9250
9251 !! article
9252 Template:paramtest
9253 !! text
9254 This is a test template with parameter {{{param}}}
9255 !! endarticle
9256
9257 !! test
9258 Template parameter
9259 !! wikitext
9260 {{paramtest|param=foo}}
9261 !! html
9262 <p>This is a test template with parameter foo
9263 </p>
9264 !! end
9265
9266 !! article
9267 Template:paramtestnum
9268 !! text
9269 [[{{{1}}}|{{{2}}}]]
9270 !! endarticle
9271
9272 !! test
9273 Template unnamed parameter
9274 !! wikitext
9275 {{paramtestnum|Main Page|the main page}}
9276 !! html
9277 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9278 </p>
9279 !! end
9280
9281 !! article
9282 Template:templatesimple
9283 !! text
9284 (test)
9285 !! endarticle
9286
9287 !! article
9288 Template:templateredirect
9289 !! text
9290 #redirect [[Template:templatesimple]]
9291 !! endarticle
9292
9293 !! article
9294 Template:templateasargtestnum
9295 !! text
9296 {{{{{1}}}}}
9297 !! endarticle
9298
9299 !! article
9300 Template:templateasargtest
9301 !! text
9302 {{template{{{templ}}}}}
9303 !! endarticle
9304
9305 !! article
9306 Template:templateasargtest2
9307 !! text
9308 {{{{{templ}}}}}
9309 !! endarticle
9310
9311 !! test
9312 Template with template name as unnamed argument
9313 !! wikitext
9314 {{templateasargtestnum|templatesimple}}
9315 !! html
9316 <p>(test)
9317 </p>
9318 !! end
9319
9320 !! test
9321 Template with template name as argument
9322 !! wikitext
9323 {{templateasargtest|templ=simple}}
9324 !! html
9325 <p>(test)
9326 </p>
9327 !! end
9328
9329 !! test
9330 Template with template name as argument (2)
9331 !! wikitext
9332 {{templateasargtest2|templ=templatesimple}}
9333 !! html
9334 <p>(test)
9335 </p>
9336 !! end
9337
9338 !! article
9339 Template:templateasargtestdefault
9340 !! text
9341 {{{{{templ|templatesimple}}}}}
9342 !! endarticle
9343
9344 !! article
9345 Template:templa
9346 !! text
9347 '''templ'''
9348 !! endarticle
9349
9350 !! test
9351 Template with default value
9352 !! wikitext
9353 {{templateasargtestdefault}}
9354 !! html
9355 <p>(test)
9356 </p>
9357 !! end
9358
9359 !! test
9360 Template with default value (value set)
9361 !! wikitext
9362 {{templateasargtestdefault|templ=templa}}
9363 !! html
9364 <p><b>templ</b>
9365 </p>
9366 !! end
9367
9368 !! test
9369 Template redirect
9370 !! wikitext
9371 {{templateredirect}}
9372 !! html
9373 <p>(test)
9374 </p>
9375 !! end
9376
9377 !! test
9378 Template with argument in separate line
9379 !! wikitext
9380 {{ templateasargtest |
9381 templ = simple }}
9382 !! html
9383 <p>(test)
9384 </p>
9385 !! end
9386
9387 !! test
9388 Template with complex template as argument
9389 !! wikitext
9390 {{paramtest|
9391 param ={{ templateasargtest |
9392 templ = simple }}}}
9393 !! html
9394 <p>This is a test template with parameter (test)
9395 </p>
9396 !! end
9397
9398 !! test
9399 Template with thumb image (with link in description)
9400 !! wikitext
9401 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9402 !! html/php
9403 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>
9404
9405 !! html+tidy
9406 <p>This is a test template with parameter</p>
9407 <div class="thumb tright">
9408 <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>
9409 <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>
9410 </div>
9411 </div>
9412 !! html/parsoid
9413 <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>
9414 !! end
9415
9416 !! article
9417 Template:complextemplate
9418 !! text
9419 {{{1}}} {{paramtest|
9420 param ={{{param}}}}}
9421 !! endarticle
9422
9423 !! test
9424 Template with complex arguments
9425 !! wikitext
9426 {{complextemplate|
9427 param ={{ templateasargtest |
9428 templ = simple }}|[[Template:complextemplate|link]]}}
9429 !! html
9430 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9431 </p>
9432 !! end
9433
9434 !! test
9435 BUG 553: link with two variables in a piped link
9436 !! wikitext
9437 {|
9438 |[[{{{1}}}|{{{2}}}]]
9439 |}
9440 !! html
9441 <table>
9442 <tr>
9443 <td>[[{{{1}}}|{{{2}}}]]
9444 </td></tr></table>
9445
9446 !! end
9447
9448 !! test
9449 Magic variable as template parameter
9450 !! wikitext
9451 {{paramtest|param={{SITENAME}}}}
9452 !! html
9453 <p>This is a test template with parameter MediaWiki
9454 </p>
9455 !! end
9456
9457 !! article
9458 Template:linktest
9459 !! text
9460 [[{{{param}}}|link]]
9461 !! endarticle
9462
9463 !! test
9464 Template parameter as link source
9465 !! wikitext
9466 {{linktest|param=Main Page}}
9467 !! html
9468 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9469 </p>
9470 !! end
9471
9472 !!article
9473 Template:paramtest2
9474 !! text
9475 including another template, {{paramtest|param={{{arg}}}}}
9476 !! endarticle
9477
9478 !! test
9479 Template passing argument to another template
9480 !! wikitext
9481 {{paramtest2|arg='hmm'}}
9482 !! html
9483 <p>including another template, This is a test template with parameter 'hmm'
9484 </p>
9485 !! end
9486
9487 !! article
9488 Template:Linktest2
9489 !! text
9490 Main Page
9491 !! endarticle
9492
9493 !! test
9494 Template as link source
9495 !! wikitext
9496 [[{{linktest2}}]]
9497
9498 [[{{linktest2}}|Main Page]]
9499
9500 [[{{linktest2}}]]Page
9501 !! html
9502 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9503 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9504 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9505 </p>
9506 !! end
9507
9508
9509 !! article
9510 Template:loop1
9511 !! text
9512 {{loop2}}
9513 !! endarticle
9514
9515 !! article
9516 Template:loop2
9517 !! text
9518 {{loop1}}
9519 !! endarticle
9520
9521 !! test
9522 Template infinite loop
9523 !! wikitext
9524 {{loop1}}
9525 !! html
9526 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9527 </p>
9528 !! end
9529
9530 !! test
9531 Template from main namespace
9532 !! wikitext
9533 {{:Main Page}}
9534 !! html
9535 <p>blah blah
9536 </p>
9537 !! end
9538
9539 !! article
9540 Template:table
9541 !! text
9542 {|
9543 | 1 || 2
9544 |-
9545 | 3 || 4
9546 |}
9547 !! endarticle
9548
9549 !! test
9550 BUG 529: Template with table, not included at beginning of line
9551 !! wikitext
9552 foo {{table}}
9553 !! html
9554 <p>foo
9555 </p>
9556 <table>
9557 <tr>
9558 <td> 1 </td>
9559 <td> 2
9560 </td></tr>
9561 <tr>
9562 <td> 3 </td>
9563 <td> 4
9564 </td></tr></table>
9565
9566 !! end
9567
9568 !! test
9569 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9570 !! wikitext
9571 foo
9572 {{table}}
9573 !! html
9574 <p>foo
9575 </p>
9576 <table>
9577 <tr>
9578 <td> 1 </td>
9579 <td> 2
9580 </td></tr>
9581 <tr>
9582 <td> 3 </td>
9583 <td> 4
9584 </td></tr></table>
9585
9586 !! end
9587
9588 !! test
9589 BUG 41: Template parameters shown as broken links
9590 !! wikitext
9591 {{{parameter}}}
9592 !! html
9593 <p>{{{parameter}}}
9594 </p>
9595 !! end
9596
9597 !! test
9598 Template with targets containing wikilinks
9599 !! wikitext
9600 {{[[foo]]}}
9601
9602 {{[[{{echo|foo}}]]}}
9603
9604 {{{{echo|[[foo}}]]}}
9605 !! html
9606 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9607 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9608 </p><p>{{[[foo}}]]
9609 </p>
9610 !! end
9611
9612 !! article
9613 Template:MSGNW test
9614 !! text
9615 ''None'' of '''this''' should be
9616 * interpreted
9617 but rather passed unmodified
9618 {{test}}
9619 <gallery>
9620 File:Foobar.jpg
9621 </gallery>
9622 !! endarticle
9623
9624 # hmm, fix this or just deprecate msgnw and document its behavior?
9625 !! test
9626 msgnw keyword
9627 !! wikitext
9628 {{msgnw:MSGNW test}}
9629 !! html
9630 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9631 &#42; interpreted
9632 &#32;but rather passed unmodified
9633 &#123;&#123;test&#125;&#125;
9634 &#60;gallery&#62;
9635 File:Foobar.jpg
9636 &#60;/gallery&#62;
9637 </p>
9638 !! end
9639
9640 !! test
9641 int keyword
9642 !! wikitext
9643 {{int:youhavenewmessages|lots of money|not!}}
9644 !! html
9645 <p>You have lots of money (not!).
9646 </p>
9647 !! end
9648
9649 !! article
9650 Template:Includes
9651 !! text
9652 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9653 !! endarticle
9654
9655 !! test
9656 <includeonly> and <noinclude> being included
9657 !! wikitext
9658 {{Includes}}
9659 !! html
9660 <p>Foobar
9661 </p>
9662 !! end
9663
9664 !! article
9665 Template:Includes2
9666 !! text
9667 <onlyinclude>Foo</onlyinclude>bar
9668 !! endarticle
9669
9670 !! test
9671 <onlyinclude> being included
9672 !! wikitext
9673 {{Includes2}}
9674 !! html
9675 <p>Foo
9676 </p>
9677 !! end
9678
9679
9680 !! article
9681 Template:Includes3
9682 !! text
9683 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9684 !! endarticle
9685
9686 !! test
9687 <onlyinclude> and <includeonly> being included
9688 !! wikitext
9689 {{Includes3}}
9690 !! html
9691 <p>Foo
9692 </p>
9693 !! end
9694
9695 !! test
9696 <includeonly> and <noinclude> on a page
9697 !! wikitext
9698 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9699 !! html
9700 <p>Foozar
9701 </p>
9702 !! end
9703
9704 !! test
9705 Un-closed <noinclude>
9706 !! wikitext
9707 <noinclude>
9708 !! html
9709 !! end
9710
9711 !! test
9712 <onlyinclude> on a page
9713 !! wikitext
9714 <onlyinclude>Foo</onlyinclude>bar
9715 !! html
9716 <p>Foobar
9717 </p>
9718 !! end
9719
9720 !! test
9721 Un-closed <onlyinclude>
9722 !! wikitext
9723 <onlyinclude>
9724 !! html
9725 !! end
9726
9727 !!test
9728 Self-closed noinclude, includeonly, onlyinclude tags
9729 !! wikitext
9730 <noinclude />
9731 <includeonly />
9732 <onlyinclude />
9733 !! html
9734 <p><br />
9735 </p>
9736 !!end
9737
9738 !!test
9739 Unbalanced includeonly and noinclude tags
9740 !! wikitext
9741 {|
9742 |a</noinclude>
9743 |b</noinclude></noinclude>
9744 |c</noinclude></includeonly>
9745 |d</includeonly></includeonly>
9746 |}
9747 !! html
9748 <table>
9749 <tr>
9750 <td>a
9751 </td>
9752 <td>b
9753 </td>
9754 <td>c&lt;/includeonly&gt;
9755 </td>
9756 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9757 </td></tr></table>
9758
9759 !!end
9760
9761 !! article
9762 Template:Includeonly section
9763 !! text
9764 <includeonly>
9765 ==Includeonly section==
9766 </includeonly>
9767 ==Section T-1==
9768 !!endarticle
9769
9770 !! test
9771 Bug 6563: Edit link generation for section shown by <includeonly>
9772 !! wikitext
9773 {{includeonly section}}
9774 !! html
9775 <h2><a href="#Includeonly_section" class="mw-headline-anchor" title="Link to this section">§</a><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>
9776 <h2><a href="#Section_T-1" class="mw-headline-anchor" title="Link to this section">§</a><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>
9777
9778 !! end
9779
9780 # Uses same input as the contents of [[Template:Includeonly section]]
9781 !! test
9782 Bug 6563: Section extraction for section shown by <includeonly>
9783 !! options
9784 section=T-2
9785 !! wikitext
9786 <includeonly>
9787 ==Includeonly section==
9788 </includeonly>
9789 ==Section T-2==
9790 !! html
9791 ==Section T-2==
9792 !! end
9793
9794 !! test
9795 Bug 6563: Edit link generation for section suppressed by <includeonly>
9796 !! wikitext
9797 <includeonly>
9798 ==Includeonly section==
9799 </includeonly>
9800 ==Section 1==
9801 !! html
9802 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
9803
9804 !! end
9805
9806 !! test
9807 Bug 6563: Section extraction for section suppressed by <includeonly>
9808 !! options
9809 section=1
9810 !! wikitext
9811 <includeonly>
9812 ==Includeonly section==
9813 </includeonly>
9814 ==Section 1==
9815 !! html
9816 ==Section 1==
9817 !! end
9818
9819 !! test
9820 Un-closed <includeonly>
9821 !! wikitext
9822 <includeonly>
9823 !! html
9824 !! end
9825
9826 !! test
9827 Includes and comments at SOL
9828 !! wikitext
9829 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9830
9831 <noinclude>
9832 some
9833 </noinclude>* stuff
9834 * here
9835
9836 <includeonly>can have stuff</includeonly>=== here ===
9837
9838 !! html/php
9839 <h2><a href="#hu" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="hu">hu</span></h2>
9840 <p>some
9841 </p>
9842 <ul><li> stuff</li>
9843 <li> here</li></ul>
9844 <h3><a href="#here" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="here">here</span></h3>
9845
9846 !! html/parsoid
9847 <!-- 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>
9848
9849 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9850 <p>some</p>
9851 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9852 <li> here</li></ul>
9853
9854 <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>
9855
9856 !! end
9857
9858 # TODO: test with DOM fragment reuse!
9859 !! test
9860 Parsoid: DOM fragment reuse
9861 !! options
9862 parsoid=wt2wt,wt2html
9863 !! wikitext
9864 a{{echo|b<table></table>c}}d
9865
9866 a{{echo|b
9867 <table></table>
9868 c}}d
9869
9870 {{echo|a
9871
9872 <table></table>
9873
9874 b}}
9875 !! html
9876 <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","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
9877
9878 <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","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
9879 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9880 </span><p about="#mwt2">cd</p>
9881
9882 <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","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
9883
9884 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9885
9886 </span><p about="#mwt3">b</p>
9887 !! end
9888
9889 !! test
9890 Parsoid: Merge double tds (bug 50603)
9891 !! options
9892 parsoid
9893 !! wikitext
9894 {|
9895 |{{echo|{{!}} foo}}
9896 |}
9897 !! html
9898 <table><tbody>
9899 <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>
9900 </tbody></table>
9901 !! end
9902
9903 !! test
9904 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9905 !! options
9906 parsoid
9907 !! wikitext
9908 {{echo|<div>}}
9909 {|
9910 |{{echo|{{!}} foo}}
9911 |}
9912 {{echo|</div>}}
9913 !! html
9914 <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}}]}'>
9915 <table><tbody>
9916 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9917 </tbody></table>
9918 </div>
9919 !! end
9920
9921 ###
9922 ### <includeonly> and <noinclude> in attributes
9923 ###
9924 !!test
9925 0. includeonly around the entire attribute
9926 !! wikitext
9927 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9928 !! html
9929 <p><span id="v2">bar</span>
9930 </p>
9931 !!end
9932
9933 !!test
9934 1. includeonly in html attr key
9935 !! wikitext
9936 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9937 !! html
9938 <p><span id="foo">bar</span>
9939 </p>
9940 !!end
9941
9942 !!test
9943 2. includeonly in html attr value
9944 !! wikitext
9945 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9946 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9947 !! html
9948 <p><span id="v1">bar</span>
9949 <span id="v1">bar</span>
9950 </p>
9951 !!end
9952
9953 !!test
9954 3. includeonly in part of an attr value
9955 !! wikitext
9956 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9957 !! html
9958 <p><span style="color:red;">bar</span>
9959 </p>
9960 !!end
9961
9962 !!test
9963 4. includeonly in table attributes
9964 !! wikitext
9965 {|
9966 |- <noinclude>
9967 |-
9968 |a
9969 </noinclude>
9970 |- <includeonly>
9971 |-
9972 |b
9973 </includeonly>
9974 |}
9975 !! html
9976 <table>
9977
9978
9979 <tr>
9980 <td>a
9981 </td></tr>
9982 </table>
9983
9984 !!end
9985
9986 ###
9987 ### Token Stream Patcher tests
9988 ###
9989 ### These tests won't always pass wt2wt and other modes because
9990 ### on serialization, the table will be output on a new line.
9991 ### For now, we are blacklisting them, and using this to test selser.
9992 ###
9993
9994 !!test
9995 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9996 !!options
9997 parsoid=wt2html,wt2wt
9998 !!wikitext
9999 {{echo|}}{| width = '100%'
10000 |foo
10001 |}
10002 !!html/parsoid
10003 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10004 <tbody><tr><td>foo</td></tr>
10005 </tbody></table>
10006 !!end
10007
10008 !!test
10009 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10010 !!options
10011 parsoid=wt2html,wt2wt
10012 !!wikitext
10013 <includeonly>a</includeonly>{| {{{b}}}
10014 |c
10015 |}
10016 !!html/parsoid
10017 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
10018 <tbody><tr><td>c</td></tr>
10019 </tbody></table>
10020
10021 !!end
10022
10023 ###
10024 ### Testing parsing of templates where a template arg
10025 ### has the same name as the template itself.
10026 ###
10027
10028 !! article
10029 Template:quote
10030 !! text
10031 {{{quote|{{{1}}}}}}
10032 !! endarticle
10033
10034 !!test
10035 Templates: Template Name/Arg clash: 1. Use of positional param
10036 !! wikitext
10037 {{quote|foo}}
10038 !! html
10039 <p>foo
10040 </p>
10041 !!end
10042
10043 !!test
10044 Templates: Template Name/Arg clash: 2. Use of named param
10045 !! wikitext
10046 {{quote|quote=foo}}
10047 !! html
10048 <p>foo
10049 </p>
10050 !!end
10051
10052 !!test
10053 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10054 !! wikitext
10055 {{quote|quote}}
10056 !! html
10057 <p>quote
10058 </p>
10059 !!end
10060
10061 ###
10062 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10063 ###
10064
10065 !!test
10066 Templates: 1. Simple use
10067 !! wikitext
10068 {{echo|Foo}}
10069 !! html
10070 <p>Foo
10071 </p>
10072 !!end
10073
10074 !!test
10075 Templates: 2. Inside a block tag
10076 !! wikitext
10077 <div>{{echo|Foo}}</div>
10078 <blockquote>{{echo|Foo}}</blockquote>
10079 !! html
10080 <div>Foo</div>
10081 <blockquote>Foo</blockquote>
10082
10083 !! html+tidy
10084 <div>Foo</div>
10085 <blockquote>
10086 <p>Foo</p>
10087 </blockquote>
10088 !!end
10089
10090 !!test
10091 Templates: P-wrapping: 1a. Templates on consecutive lines
10092 !! wikitext
10093 {{echo|Foo}}
10094 {{echo|bar}}
10095 !! html
10096 <p>Foo
10097 bar
10098 </p>
10099 !!end
10100
10101 !!test
10102 Templates: P-wrapping: 1b. Templates on consecutive lines
10103 !! wikitext
10104 Foo
10105
10106 {{echo|bar}}
10107 {{echo|baz}}
10108 !! html
10109 <p>Foo
10110 </p><p>bar
10111 baz
10112 </p>
10113 !!end
10114
10115 !!test
10116 Templates: P-wrapping: 1c. Templates on consecutive lines
10117 !! wikitext
10118 {{echo|Foo}}
10119 {{echo|bar}} <div>baz</div>
10120 !! html
10121 <p>Foo
10122 </p>
10123 bar <div>baz</div>
10124
10125 !! html+tidy
10126 <p>Foo</p>
10127 <p>bar</p>
10128 <div>baz</div>
10129 !! end
10130
10131 !!test
10132 Templates: P-wrapping: 1d. Template preceded by comment-only line
10133 !!options
10134 parsoid
10135 !! wikitext
10136 <!-- foo -->
10137 {{echo|Bar}}
10138 !! html
10139 <!-- foo -->
10140
10141 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10142 !!end
10143
10144 !!test
10145 Templates: Inline Text: 1. Multiple template uses
10146 !! wikitext
10147 {{echo|Foo}}bar{{echo|baz}}
10148 !! html
10149 <p>Foobarbaz
10150 </p>
10151 !!end
10152
10153 !!test
10154 Templates: Inline Text: 2. Back-to-back template uses
10155 !! wikitext
10156 {{echo|Foo}}{{echo|bar}}
10157 !! html
10158 <p>Foobar
10159 </p>
10160 !!end
10161
10162 !!test
10163 Templates: Block Tags: 1. Multiple template uses
10164 !! wikitext
10165 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10166 !! html
10167 <div>Foo</div><div>bar</div><div>baz</div>
10168
10169 !!end
10170
10171 !!test
10172 Templates: Block Tags: 2. Back-to-back template uses
10173 !! wikitext
10174 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10175 !! html
10176 <div>Foo</div><div>bar</div>
10177
10178 !!end
10179
10180 # This is an edge case relating to paragraph wrapping.
10181 !!test
10182 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10183 !! wikitext
10184 {{echo|a
10185 b</p>}}
10186 !! html/parsoid
10187 <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
10188 b</p>
10189 !!end
10190
10191 !!test
10192 Templates: Links: 1. Simple example
10193 !! wikitext
10194 {{echo|[[Foo|bar]]}}
10195 !! html
10196 <p><a href="/wiki/Foo" title="Foo">bar</a>
10197 </p>
10198 !!end
10199
10200 !!test
10201 Templates: Links: 2. Generation of link href
10202 !! wikitext
10203 [[{{echo|Foo}}|bar]]
10204 !! html
10205 <p><a href="/wiki/Foo" title="Foo">bar</a>
10206 </p>
10207 !!end
10208
10209 !!test
10210 Templates: Links: 3. Generation of part of a link href
10211 !! wikitext
10212 [[Fo{{echo|o}}|bar]]
10213
10214 [[Foo{{echo|bar}}]]
10215
10216 [[Foo{{echo|bar}}baz]]
10217
10218 [[Foo{{echo|bar}}|bar]]
10219
10220 [[:Foo{{echo|bar}}]]
10221
10222 [[:Foo{{echo|bar}}|bar]]
10223 !! html
10224 <p><a href="/wiki/Foo" title="Foo">bar</a>
10225 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10226 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10227 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10228 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10229 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10230 </p>
10231 !!end
10232
10233 !!test
10234 Templates: Links: 4. Multiple templates generating link href
10235 !! wikitext
10236 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10237 !! html
10238 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10239 </p>
10240 !!end
10241
10242 !!test
10243 Templates: Links: 5. Generation of link text
10244 !! wikitext
10245 [[Foo|{{echo|bar}}]]
10246 !! html
10247 <p><a href="/wiki/Foo" title="Foo">bar</a>
10248 </p>
10249 !!end
10250
10251 !!test
10252 Templates: Links: 5. Nested templates (only outermost template should be marked)
10253 !! wikitext
10254 {{echo|[[{{echo|Foo}}|bar]]}}
10255 !! html
10256 <p><a href="/wiki/Foo" title="Foo">bar</a>
10257 </p>
10258 !!end
10259
10260 !!test
10261 Templates: HTML Tag: 1. Generation of HTML attr. key
10262 !! wikitext
10263 <div {{echo|style}}="color:red;">foo</div>
10264 !! html
10265 <div style="color:red;">foo</div>
10266
10267 !!end
10268
10269 !!test
10270 Templates: HTML Tag: 2. Generation of HTML attr. value
10271 !! wikitext
10272 <div style={{echo|'color:red;'}}>foo</div>
10273 !! html
10274 <div style="color:red;">foo</div>
10275
10276 !!end
10277
10278 !!test
10279 Templates: HTML Tag: 3. Generation of HTML attr key and value
10280 !! wikitext
10281 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10282 !! html
10283 <div style="color:red;">foo</div>
10284
10285 !!end
10286
10287 !!test
10288 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10289 !! wikitext
10290 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10291 !! html
10292 <div title="This is a long title with just one piece templated">foo</div>
10293
10294 !!end
10295
10296 !!test
10297 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10298 !! wikitext
10299 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10300 !! html
10301 <div title="This is a long title with just one piece templated">foo</div>
10302
10303 !!end
10304
10305 !!test
10306 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10307 !! wikitext
10308 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10309 !! html
10310 <div title="This is a long title with just one piece templated">foo</div>
10311
10312 !!end
10313
10314 # SSS FIXME: While it is great we added support for all this,
10315 # do we want to make this part of the spec? Maybe we want to
10316 # deprecate this kind of usage in the future?
10317 !!test
10318 Templates: HTML Tag: 7. Generation of partial attribute key string
10319 !! wikitext
10320 <div st{{echo|yle}}="color:red;">foo</div>
10321 !! html
10322 <div style="color:red;">foo</div>
10323
10324 !!end
10325
10326 !! test
10327 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10328 !! wikitext
10329 <div {{echo|1=id="v1"}}>bar</div>
10330 !! html
10331 <div id="v1">bar</div>
10332
10333 !!end
10334
10335 !! test
10336 Templates: HTML Tag: 9. Multiple template-generated attributes
10337 !! wikitext
10338 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10339 !! html
10340 <div id="v1" title="foo">bar</div>
10341
10342 !!end
10343
10344 !! test
10345 Templates: Support for templates generating attributes and content
10346 !! wikitext
10347 {| {{mixed_attr_content_template}}
10348 |-
10349 |bar
10350 |}
10351 !! html/php
10352 <table style="color:red;" title="T48811">
10353
10354 <tr>
10355 <td>foo
10356 </td></tr>
10357 <tr>
10358 <td>bar
10359 </td></tr></table>
10360
10361 !! html/parsoid
10362 <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|}"]}'>
10363 <tbody><tr>
10364 <td>foo</td></tr>
10365 <tr>
10366 <td>bar</td></tr>
10367 </tbody></table>
10368 !!end
10369
10370 !!test
10371 Templates: HTML Tables: 1. Generating start of a HTML table
10372 !! wikitext
10373 {{echo|<table><tr><td>foo</td>}}</tr></table>
10374 !! html
10375 <table><tr><td>foo</td></tr></table>
10376
10377 !!end
10378
10379 !!test
10380 Templates: HTML Tables: 2a. Generating middle of a HTML table
10381 !! wikitext
10382 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10383 !! html
10384 <table><tr><td>foo</td></tr></table>
10385
10386 !!end
10387
10388 !!test
10389 Templates: HTML Tables: 2b. Generating middle of a HTML table
10390 !! wikitext
10391 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10392 !! html
10393 <table><tr><td>foo</td></tr></table>
10394
10395 !!end
10396
10397 !!test
10398 Templates: HTML Tables: 3. Generating end of a HTML table
10399 !! wikitext
10400 <table><tr>{{echo|<td>foo</td></tr></table>}}
10401 !! html
10402 <table><tr><td>foo</td></tr></table>
10403
10404 !!end
10405
10406 !!test
10407 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10408 !! wikitext
10409 {{echo|<table>}}<tr><td>foo</td></tr></table>
10410 !! html
10411 <table><tr><td>foo</td></tr></table>
10412
10413 !!end
10414
10415 !!test
10416 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10417 !! wikitext
10418 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10419 !! html
10420 <table><tr><td>foo</td></tr></table>
10421
10422 !!end
10423
10424 !!test
10425 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10426 !! wikitext
10427 <table><tr>{{echo|<td>}}foo</td></tr></table>
10428 !! html
10429 <table><tr><td>foo</td></tr></table>
10430
10431 !!end
10432
10433 !!test
10434 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10435 !! wikitext
10436 <table><tr><td>foo{{echo|</td>}}</tr></table>
10437 !! html
10438 <table><tr><td>foo</td></tr></table>
10439
10440 !!end
10441
10442 !!test
10443 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10444 !! wikitext
10445 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10446 !! html
10447 <table><tr><td>foo</td></tr></table>
10448
10449 !!end
10450
10451 !!test
10452 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10453 !! wikitext
10454 <table><tr><td>foo</td></tr>{{echo|</table>}}
10455 !! html
10456 <table><tr><td>foo</td></tr></table>
10457
10458 !!end
10459
10460 !!test
10461 Templates: HTML Tables: 5. Proper fostering of categories from inside
10462 !!options
10463 parsoid=wt2html,wt2wt
10464 !! wikitext
10465 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10466 <!--Two categories (Bug 50330)-->
10467 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10468 !! html
10469 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10470 <!--Two categories (Bug 50330)-->
10471 <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>
10472 !!end
10473
10474 !!test
10475 Templates: Wiki Tables: 1a. Fostering of entire template content
10476 !! wikitext
10477 {|
10478 {{echo|a}}
10479 |}
10480 !! html
10481 <table>
10482 a
10483 <tr><td></td></tr></table>
10484
10485 !! html+tidy
10486 <p>a</p>
10487 <table>
10488 <tr>
10489 <td></td>
10490 </tr>
10491 </table>
10492 !! end
10493
10494 !!test
10495 Templates: Wiki Tables: 1b. Fostering of entire template content
10496 !! wikitext
10497 {|
10498 {{echo|<div>}}
10499 foo
10500 {{echo|</div>}}
10501 |}
10502 !! html
10503 <table>
10504 <div>
10505 <p>foo
10506 </p>
10507 </div>
10508 <tr><td></td></tr></table>
10509
10510 !! html+tidy
10511 <div>
10512 <p>foo</p>
10513 </div>
10514 <table>
10515 <tr>
10516 <td></td>
10517 </tr>
10518 </table>
10519 !! end
10520
10521 !!test
10522 Templates: Wiki Tables: 2. Fostering of partial template content
10523 !! wikitext
10524 {|
10525 {{echo|a
10526 <div>b</div>}}
10527 |}
10528 !! html
10529 <table>
10530 a
10531 <div>b</div>
10532 <tr><td></td></tr></table>
10533
10534 !! html+tidy
10535 <p>a</p>
10536 <div>b</div>
10537 <table>
10538 <tr>
10539 <td></td>
10540 </tr>
10541 </table>
10542 !! end
10543
10544 !!test
10545 Templates: Wiki Tables: 3. td-content via multiple templates
10546 !! wikitext
10547 {|
10548 {{echo|{{pipe}}a}}{{echo|b}}
10549 |}
10550 !! html
10551 <table>
10552 <tr>
10553 <td>ab
10554 </td></tr></table>
10555
10556 !!end
10557
10558 !!test
10559 Templates: Wiki Tables: 4. Templated tags, no content
10560 !! wikitext
10561 {{tbl-start}}
10562 {{tbl-end}}
10563 !! html
10564 <table>
10565 <tr><td></td></tr></table>
10566
10567 !!end
10568
10569 !!test
10570 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10571 !! wikitext
10572 {{tbl-start}}
10573 |foo
10574 {{tbl-end}}
10575 !! html
10576 <table>
10577 <tr>
10578 <td>foo
10579 </td></tr></table>
10580
10581 !!end
10582
10583 !!test
10584 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10585 !! wikitext
10586 {{tbl-start}}
10587 {{!}}foo
10588 {{tbl-end}}
10589 !! html
10590 <table>
10591 <tr>
10592 <td>foo
10593 </td></tr></table>
10594
10595 !!end
10596
10597 !!test
10598 Templates: Lists: Multi-line list-items via templates
10599 !! wikitext
10600 *{{echo|a {{nonexistent|
10601 unused}}}}
10602 *{{echo|b {{nonexistent|
10603 unused}}}}
10604 !! html
10605 <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>
10606 <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>
10607
10608 !!end
10609
10610 !!test
10611 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10612 !! wikitext
10613 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10614 !! html
10615 <p><i>ab</i>c<i>d</i>e
10616 </p>
10617 !!end
10618
10619 !!test
10620 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10621 (PHP parser generates misnested html)
10622 !! wikitext
10623 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10624 !! html/parsoid
10625 <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>
10626 !!end
10627
10628 !!test
10629 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10630 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10631 !! options
10632 parsoid=wt2html,wt2wt
10633 !! wikitext
10634 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10635 !! html
10636 <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>
10637 <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>
10638 <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>
10639 !!end
10640
10641 !!test
10642 Templates: Ugly nesting: 4. Divs opened/closed across templates
10643 !! wikitext
10644 a<div>b{{echo|c</div>d}}e
10645 !! html
10646 a<div>bc</div>de
10647
10648 !! html+tidy
10649 <p>a</p>
10650 <div>bc</div>
10651 <p>de</p>
10652 !! end
10653
10654 !!test
10655 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10656 (Parsoid-centric)
10657 !! options
10658 parsoid
10659 !! wikitext
10660 {|
10661 |{{echo|foo</table>}}
10662 |bar
10663 |}
10664 !! html
10665 <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|}"]}'>
10666
10667 <tbody>
10668 <tr>
10669 <td>foo</td></tr></tbody></table><span about="#mwt1">
10670 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10671 |}</span>
10672 !!end
10673
10674 !!test
10675 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10676 (Parsoid-centric)
10677 !! options
10678 parsoid
10679 !! wikitext
10680 <table>
10681 <tr>
10682 <td>
10683 <table>
10684 <tr>
10685 <td>1. {{echo|foo </table>}}</td>
10686 <td> bar </td>
10687 <td>2. {{echo|baz </table>}}</td>
10688 </tr>
10689 <tr>
10690 <td>abc</td>
10691 </tr>
10692 </table>
10693 </td>
10694 </tr>
10695 <tr>
10696 <td>xyz</td>
10697 </tr>
10698 </table>
10699 !! html
10700 <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>"]}'>
10701 <tbody><tr>
10702 <td>
10703 <table>
10704 <tbody><tr>
10705 <td>1. foo </td></tr></tbody></table></td>
10706 <td> bar </td>
10707 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10708 </span><span about="#mwt2">
10709 </span><span about="#mwt2">
10710 </span><span about="#mwt2">abc</span><span about="#mwt2">
10711 </span><span about="#mwt2">
10712 </span><span about="#mwt2">
10713 </span><span about="#mwt2">
10714 </span><span about="#mwt2">
10715 </span><span about="#mwt2">
10716 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10717 </span><span about="#mwt2">
10718 </span>
10719 !!end
10720
10721 !! test
10722 Templates: Ugly templates: 3. newline-only template parameter
10723 !! wikitext
10724 foo {{echo|
10725 }}
10726 !! html
10727 <p>foo
10728 </p>
10729 !! end
10730
10731 # This looks like a bug: a single newline triggers p/br for some reason.
10732 !! test
10733 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10734 !! wikitext
10735 {{echo|
10736 }}
10737 !! html
10738 <p><br />
10739 </p>
10740 !! end
10741
10742 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10743 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10744 !! test
10745 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10746 !! wikitext
10747 {{echo|<table>}}
10748 {{echo|<div>foo}}
10749 {{echo|</table>}}
10750 !! html/parsoid
10751 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
10752 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10753 </table>
10754 !! end
10755
10756 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10757 # that are "identical" and generate nesting cycles in the algorithm
10758 !! test
10759 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10760 !! wikitext
10761 {{echo|<table><tr><td><table>}}
10762 {{echo|<div>}}
10763 {{echo|</div>}}
10764 !! html/parsoid
10765 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
10766 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10767 </table></td></tr></tbody></table>
10768 !! end
10769
10770 !!test
10771 Parser Functions: 1. Simple example
10772 !! wikitext
10773 {{uc:foo}}
10774 !! html
10775 <p>FOO
10776 </p>
10777 !!end
10778
10779 !!test
10780 Parser Functions: 2. Nested use (only outermost should be marked up)
10781 !! wikitext
10782 {{uc:{{lc:FOO}}}}
10783 !! html
10784 <p>FOO
10785 </p>
10786 !!end
10787
10788 ###
10789 ### Pre-save transform tests
10790 ###
10791 !! test
10792 pre-save transform: subst:
10793 !! options
10794 PST
10795 !! wikitext
10796 {{subst:test}}
10797 !! html
10798 This is a test template
10799 !! end
10800
10801 !! test
10802 pre-save transform: normal template
10803 !! options
10804 PST
10805 !! wikitext
10806 {{test}}
10807 !! html
10808 {{test}}
10809 !! end
10810
10811 !! test
10812 pre-save transform: nonexistent template
10813 !! options
10814 PST
10815 !! wikitext
10816 {{thistemplatedoesnotexist}}
10817 !! html
10818 {{thistemplatedoesnotexist}}
10819 !! end
10820
10821
10822 !! test
10823 pre-save transform: subst magic variables
10824 !! options
10825 PST
10826 !! wikitext
10827 {{subst:SITENAME}}
10828 !! html
10829 MediaWiki
10830 !! end
10831
10832 # This is bug 89, which I fixed. -- wtm
10833 !! test
10834 pre-save transform: subst: templates with parameters
10835 !! options
10836 pst
10837 !! wikitext
10838 {{subst:paramtest|param="something else"}}
10839 !! html
10840 This is a test template with parameter "something else"
10841 !! end
10842
10843 !! article
10844 Template:nowikitest
10845 !! text
10846 <nowiki>'''not wiki'''</nowiki>
10847 !! endarticle
10848
10849 !! test
10850 pre-save transform: nowiki in subst (bug 1188)
10851 !! options
10852 pst
10853 !! wikitext
10854 {{subst:nowikitest}}
10855 !! html
10856 <nowiki>'''not wiki'''</nowiki>
10857 !! end
10858
10859
10860 !! article
10861 Template:commenttest
10862 !! text
10863 This template has <!-- a comment --> in it.
10864 !! endarticle
10865
10866 !! test
10867 pre-save transform: comment in subst (bug 1936)
10868 !! options
10869 pst
10870 !! wikitext
10871 {{subst:commenttest}}
10872 !! html
10873 This template has <!-- a comment --> in it.
10874 !! end
10875
10876 !! test
10877 pre-save transform: unclosed tag
10878 !! options
10879 pst noxml
10880 !! wikitext
10881 <nowiki>'''not wiki'''
10882 !! html
10883 <nowiki>'''not wiki'''
10884 !! end
10885
10886 !! test
10887 pre-save transform: mixed tag case
10888 !! options
10889 pst noxml
10890 !! wikitext
10891 <NOwiki>'''not wiki'''</noWIKI>
10892 !! html
10893 <NOwiki>'''not wiki'''</noWIKI>
10894 !! end
10895
10896 !! test
10897 pre-save transform: unclosed comment in <nowiki>
10898 !! options
10899 pst noxml
10900 !! wikitext
10901 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10902 !! html
10903 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10904 !!end
10905
10906 # Leading @ in this template definition works around a limitation
10907 # in parsoid's parserTests which otherwise strips the <span> from the
10908 # result (confusing it for a template wrapper)
10909 !! article
10910 Template:dangerous
10911 !!text
10912 @<span onmouseover="alert('crap')">Oh no</span>
10913 !!endarticle
10914
10915 !!test
10916 (confirming safety of fix for subst bug 1936)
10917 !! wikitext
10918 {{Template:dangerous}}
10919 !! html
10920 <p>@<span>Oh no</span>
10921 </p>
10922 !! end
10923
10924 !! test
10925 pre-save transform: comment containing gallery (bug 5024)
10926 !! options
10927 pst
10928 !! wikitext
10929 <!-- <gallery>data</gallery> -->
10930 !! html
10931 <!-- <gallery>data</gallery> -->
10932 !!end
10933
10934 !! test
10935 pre-save transform: comment containing extension
10936 !! options
10937 pst
10938 !! wikitext
10939 <!-- <tag>data</tag> -->
10940 !! html
10941 <!-- <tag>data</tag> -->
10942 !!end
10943
10944 !! test
10945 pre-save transform: comment containing nowiki
10946 !! options
10947 pst
10948 !! wikitext
10949 <!-- <nowiki>data</nowiki> -->
10950 !! html
10951 <!-- <nowiki>data</nowiki> -->
10952 !!end
10953
10954 !! test
10955 pre-save transform: <noinclude> in subst (bug 3298)
10956 !! options
10957 pst
10958 !! wikitext
10959 {{subst:Includes}}
10960 !! html
10961 Foobar
10962 !! end
10963
10964 !! test
10965 pre-save transform: <onlyinclude> in subst (bug 3298)
10966 !! options
10967 pst
10968 !! wikitext
10969 {{subst:Includes2}}
10970 !! html
10971 Foo
10972 !! end
10973
10974 !! article
10975 Template:SubstTest
10976 !!text
10977 {{<includeonly>subst:</includeonly>Includes}}
10978 !! endarticle
10979
10980 !! article
10981 Template:SafeSubstTest
10982 !! text
10983 {{<includeonly>safesubst:</includeonly>Includes}}
10984 !! endarticle
10985
10986 !! test
10987 bug 22297: safesubst: works during PST
10988 !! options
10989 pst
10990 !! wikitext
10991 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10992 !! html
10993 FoobarFoobar
10994 !! end
10995
10996 !! test
10997 bug 22297: safesubst: works during normal parse
10998 !! wikitext
10999 {{SafeSubstTest}}
11000 !! html
11001 <p>Foobar
11002 </p>
11003 !! end
11004
11005 !! test
11006 subst: does not work during normal parse
11007 !! wikitext
11008 {{SubstTest}}
11009 !! html
11010 <p>{{subst:Includes}}
11011 </p>
11012 !! end
11013
11014 !! test
11015 pre-save transform: context links ("pipe trick")
11016 !! options
11017 pst
11018 !! wikitext
11019 [[Article (context)|]]
11020 [[Bar:Article|]]
11021 [[:Bar:Article|]]
11022 [[Bar:Article (context)|]]
11023 [[:Bar:Article (context)|]]
11024 [[|Article]]
11025 [[|Article (context)]]
11026 [[Bar:X (Y) Z|]]
11027 [[:Bar:X (Y) Z|]]
11028 !! html
11029 [[Article (context)|Article]]
11030 [[Bar:Article|Article]]
11031 [[:Bar:Article|Article]]
11032 [[Bar:Article (context)|Article]]
11033 [[:Bar:Article (context)|Article]]
11034 [[Article]]
11035 [[Article (context)]]
11036 [[Bar:X (Y) Z|X (Y) Z]]
11037 [[:Bar:X (Y) Z|X (Y) Z]]
11038 !! end
11039
11040 !! test
11041 pre-save transform: context links ("pipe trick") with interwiki prefix
11042 !! options
11043 pst
11044 !! wikitext
11045 [[interwiki:Article|]]
11046 [[:interwiki:Article|]]
11047 [[interwiki:Bar:Article|]]
11048 [[:interwiki:Bar:Article|]]
11049 !! html
11050 [[interwiki:Article|Article]]
11051 [[:interwiki:Article|Article]]
11052 [[interwiki:Bar:Article|Bar:Article]]
11053 [[:interwiki:Bar:Article|Bar:Article]]
11054 !! end
11055
11056 !! test
11057 pre-save transform: context links ("pipe trick") with parens in title
11058 !! options
11059 pst title=[[Somearticle (context)]]
11060 !! wikitext
11061 [[|Article]]
11062 !! html
11063 [[Article (context)|Article]]
11064 !! end
11065
11066 !! test
11067 pre-save transform: context links ("pipe trick") with comma in title
11068 !! options
11069 pst title=[[Someplace, Somewhere]]
11070 !! wikitext
11071 [[|Otherplace]]
11072 [[Otherplace, Elsewhere|]]
11073 [[Otherplace, Elsewhere, Anywhere|]]
11074 !! html
11075 [[Otherplace, Somewhere|Otherplace]]
11076 [[Otherplace, Elsewhere|Otherplace]]
11077 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11078 !! end
11079
11080 !! test
11081 pre-save transform: context links ("pipe trick") with parens and comma
11082 !! options
11083 pst title=[[Someplace (IGNORED), Somewhere]]
11084 !! wikitext
11085 [[|Otherplace]]
11086 [[Otherplace (place), Elsewhere|]]
11087 !! html
11088 [[Otherplace, Somewhere|Otherplace]]
11089 [[Otherplace (place), Elsewhere|Otherplace]]
11090 !! end
11091
11092 !! test
11093 pre-save transform: context links ("pipe trick") with comma and parens
11094 !! options
11095 pst title=[[Who, me? (context)]]
11096 !! wikitext
11097 [[|Yes, you.]]
11098 [[Me, Myself, and I (1937 song)|]]
11099 !! html
11100 [[Yes, you. (context)|Yes, you.]]
11101 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11102 !! end
11103
11104 !! test
11105 pre-save transform: context links ("pipe trick") with namespace
11106 !! options
11107 pst title=[[Ns:Somearticle]]
11108 !! wikitext
11109 [[|Article]]
11110 !! html
11111 [[Ns:Article|Article]]
11112 !! end
11113
11114 !! test
11115 pre-save transform: context links ("pipe trick") with namespace and parens
11116 !! options
11117 pst title=[[Ns:Somearticle (context)]]
11118 !! wikitext
11119 [[|Article]]
11120 !! html
11121 [[Ns:Article (context)|Article]]
11122 !! end
11123
11124 !! test
11125 pre-save transform: context links ("pipe trick") with namespace and comma
11126 !! options
11127 pst title=[[Ns:Somearticle, Context, Whatever]]
11128 !! wikitext
11129 [[|Article]]
11130 !! html
11131 [[Ns:Article, Context, Whatever|Article]]
11132 !! end
11133
11134 !! test
11135 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11136 !! options
11137 pst title=[[Ns:Somearticle, Context (context)]]
11138 !! wikitext
11139 [[|Article]]
11140 !! html
11141 [[Ns:Article (context)|Article]]
11142 !! end
11143
11144 !! test
11145 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11146 !! options
11147 pst title=[[Ns:Somearticle (IGNORED), Context]]
11148 !! wikitext
11149 [[|Article]]
11150 !! html
11151 [[Ns:Article, Context|Article]]
11152 !! end
11153
11154 !! test
11155 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11156 !! options
11157 pst
11158 !! wikitext
11159 [[Article(context)|]]
11160 [[Bar:Article(context)|]]
11161 [[:Bar:Article(context)|]]
11162 [[|Article(context)]]
11163 [[Bar:X(Y)Z|]]
11164 [[:Bar:X(Y)Z|]]
11165 !! html
11166 [[Article(context)|Article]]
11167 [[Bar:Article(context)|Article]]
11168 [[:Bar:Article(context)|Article]]
11169 [[Article(context)]]
11170 [[Bar:X(Y)Z|X(Y)Z]]
11171 [[:Bar:X(Y)Z|X(Y)Z]]
11172 !! end
11173
11174 !! test
11175 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11176 !! options
11177 pst
11178 !! wikitext
11179 [[Article (context)|]]
11180 [[Bar:Article (context)|]]
11181 [[:Bar:Article (context)|]]
11182 [[|Article (context)]]
11183 [[Bar:X (Y) Z|]]
11184 [[:Bar:X (Y) Z|]]
11185 !! html
11186 [[Article (context)|Article]]
11187 [[Bar:Article (context)|Article]]
11188 [[:Bar:Article (context)|Article]]
11189 [[Article (context)]]
11190 [[Bar:X (Y) Z|X (Y) Z]]
11191 [[:Bar:X (Y) Z|X (Y) Z]]
11192 !! end
11193
11194 !! test
11195 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11196 !! options
11197 pst
11198 !! wikitext
11199 [[Article(context)|]]
11200 [[Bar:Article(context)|]]
11201 [[:Bar:Article(context)|]]
11202 [[|Article(context)]]
11203 [[Bar:X(Y)Z|]]
11204 [[:Bar:X(Y)Z|]]
11205 !! html
11206 [[Article(context)|Article]]
11207 [[Bar:Article(context)|Article]]
11208 [[:Bar:Article(context)|Article]]
11209 [[Article(context)]]
11210 [[Bar:X(Y)Z|X(Y)Z]]
11211 [[:Bar:X(Y)Z|X(Y)Z]]
11212 !! end
11213
11214 !! test
11215 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11216 !! options
11217 pst
11218 !! wikitext
11219 [[Article (context), context|]]
11220 [[Article (context),context|]]
11221 [[Bar:Article (context), context|]]
11222 [[Bar:Article (context),context|]]
11223 [[:Bar:Article (context), context|]]
11224 [[:Bar:Article (context),context|]]
11225 !! html
11226 [[Article (context), context|Article]]
11227 [[Article (context),context|Article]]
11228 [[Bar:Article (context), context|Article]]
11229 [[Bar:Article (context),context|Article]]
11230 [[:Bar:Article (context), context|Article]]
11231 [[:Bar:Article (context),context|Article]]
11232 !! end
11233
11234 !! test
11235 pre-save transform: trim trailing empty lines
11236 !! options
11237 pst
11238 !! wikitext
11239 Empty lines are trimmed
11240
11241
11242
11243
11244 !! html
11245 Empty lines are trimmed
11246 !! end
11247
11248 !! test
11249 pre-save transform: Signature expansion
11250 !! options
11251 pst
11252 !! wikitext
11253 * ~~~
11254 * <noinclude>~~~</noinclude>
11255 * <includeonly>~~~</includeonly>
11256 * <onlyinclude>~~~</onlyinclude>
11257 !! html
11258 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11259 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11260 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11261 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11262 !! end
11263
11264
11265 !! test
11266 pre-save transform: Signature expansion in nowiki tags (bug 93)
11267 !! options
11268 pst disabled
11269 !! wikitext
11270 Shall not expand:
11271
11272 <nowiki>~~~~</nowiki>
11273
11274 <includeonly><nowiki>~~~~</nowiki></includeonly>
11275
11276 <noinclude><nowiki>~~~~</nowiki></noinclude>
11277
11278 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11279
11280 {{subst:Foo}} shall be converted to FOO
11281
11282 As well as inside noinclude/onlyinclude
11283 <noinclude>{{subst:Foo}}</noinclude>
11284 <onlyinclude>{{subst:Foo}}</onlyinclude>
11285
11286 But not inside includeonly
11287 <includeonly>{{subst:Foo}}</includeonly>
11288 !! html
11289 Shall not expand:
11290
11291 <nowiki>~~~~</nowiki>
11292
11293 <includeonly><nowiki>~~~~</nowiki></includeonly>
11294
11295 <noinclude><nowiki>~~~~</nowiki></noinclude>
11296
11297 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11298
11299 FOO shall be converted to FOO
11300
11301 As well as inside noinclude/onlyinclude
11302 <noinclude>FOO</noinclude>
11303 <onlyinclude>FOO</onlyinclude>
11304
11305 But not inside includeonly
11306 <includeonly>{{subst:Foo}}</includeonly>
11307 !! end
11308
11309 !! test
11310 Parsoid: Recognize nowiki with trailing space in tags
11311 !! options
11312 parsoid=wt2html
11313 !! wikitext
11314 <nowiki ><div>[[foo]]</nowiki >
11315
11316 a<nowiki / >b
11317
11318 c<nowiki />d
11319
11320 e<nowiki/ >f
11321 !! html
11322 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11323 <p>ab</p>
11324 <p>cd</p>
11325 <p>ef</p>
11326 !! end
11327
11328 !! test
11329 Parsoid: Recognize nowiki with odd capitalization
11330 !! options
11331 parsoid=wt2html
11332 !! wikitext
11333 <noWikI ><div>[[foo]]</Nowiki >
11334 !! html
11335 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11336 !! end
11337
11338
11339 !! test
11340 Parsoid: Escape nowiki with trailing space in tags
11341 !! options
11342 parsoid=html2wt
11343 !! html
11344 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11345 <p>a&lt;nowiki /&gt;b</p>
11346 <p>c&lt;nowiki/ &gt;d</p>
11347 !! wikitext
11348 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11349
11350 a&lt;nowiki /&gt;b
11351
11352 c&lt;nowiki/ &gt;d
11353 !! end
11354
11355 !! test
11356 Parsoid: Escape weird noWikI capitalizations
11357 !! options
11358 parsoid=html2wt
11359 !! html
11360 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11361 !! wikitext
11362 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11363 !! end
11364
11365 ###
11366 ### Message transform tests
11367 ###
11368 !! test
11369 message transform: magic variables
11370 !! options
11371 msg
11372 !! wikitext
11373 {{SITENAME}}
11374 !! html
11375 MediaWiki
11376 !! end
11377
11378 !! test
11379 message transform: should not transform wiki markup
11380 !! options
11381 msg
11382 !! wikitext
11383 ''test''
11384 !! html
11385 ''test''
11386 !! end
11387
11388 !! test
11389 message transform: <noinclude> in transcluded template (bug 4926)
11390 !! options
11391 msg
11392 !! wikitext
11393 {{Includes}}
11394 !! html
11395 Foobar
11396 !! end
11397
11398 !! test
11399 message transform: <onlyinclude> in transcluded template (bug 4926)
11400 !! options
11401 msg
11402 !! wikitext
11403 {{Includes2}}
11404 !! html
11405 Foo
11406 !! end
11407
11408 !! test
11409 {{#special:}} page name, known
11410 !! options
11411 msg
11412 !! wikitext
11413 {{#special:Recentchanges}}
11414 !! html
11415 Special:RecentChanges
11416 !! end
11417
11418 !! test
11419 {{#special:}} page name with subpage, known
11420 !! options
11421 msg
11422 !! wikitext
11423 {{#special:Recentchanges/param}}
11424 !! html
11425 Special:RecentChanges/param
11426 !! end
11427
11428 !! test
11429 {{#special:}} page name, unknown
11430 !! options
11431 msg
11432 !! wikitext
11433 {{#special:foobar nonexistent}}
11434 !! html
11435 Special:Foobar nonexistent
11436 !! end
11437
11438 !! test
11439 {{#speciale:}} page name, known
11440 !! options
11441 msg
11442 !! wikitext
11443 {{#speciale:Recentchanges}}
11444 !! html
11445 Special:RecentChanges
11446 !! end
11447
11448 !! test
11449 {{#speciale:}} page name with subpage, known
11450 !! options
11451 msg
11452 !! wikitext
11453 {{#speciale:Recentchanges/param}}
11454 !! html
11455 Special:RecentChanges/param
11456 !! end
11457
11458 !! test
11459 {{#speciale:}} page name, unknown
11460 !! options
11461 msg
11462 !! wikitext
11463 {{#speciale:foobar nonexistent}}
11464 !! html
11465 Special:Foobar_nonexistent
11466 !! end
11467
11468 ###
11469 ### Images
11470 ###
11471 ### For Parsoid-specific tests, see
11472 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11473
11474 !! test
11475 Simple image
11476 !! options
11477 parsoid=wt2html,wt2wt,html2html
11478 !! wikitext
11479 [[Image:foobar.jpg]]
11480 !! html/php
11481 <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>
11482 </p>
11483 !! html/parsoid
11484 <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" height="220" width="1941"></a></span></p>
11485 !! end
11486
11487 !! test
11488 Simple image (using File: namespace, now canonical)
11489 !! wikitext
11490 [[File:Foobar.jpg]]
11491 !! html/php
11492 <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>
11493 </p>
11494 !! html/parsoid
11495 <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" height="220" width="1941"></a></span></p>
11496 !! end
11497
11498 !! test
11499 Right-aligned image
11500 !! wikitext
11501 [[File:Foobar.jpg|right]]
11502 !! html/php
11503 <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>
11504
11505 !! html/parsoid
11506 <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" height="220" width="1941"></a></figure>
11507 !! end
11508
11509 !! test
11510 Image with caption
11511 !! wikitext
11512 [[File:Foobar.jpg|right|Caption text]]
11513 !! html/php
11514 <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>
11515
11516 !! html/parsoid
11517 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11518 !! end
11519
11520 !! test
11521 Image with caption, bug 53312 #1
11522 !! wikitext
11523 [[File:Foobar.jpg|right|Caption page stuff]]
11524 !! html/php
11525 <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>
11526
11527 !! html/parsoid
11528 <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" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
11529 !! end
11530
11531 !! test
11532 Image with caption, bug 53312 #2
11533 !! wikitext
11534 [[File:Foobar.jpg|right|Caption page=]]
11535 !! html/php
11536 <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>
11537
11538 !! html/parsoid
11539 <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" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
11540 !! end
11541
11542 !! test
11543 Image with caption, bug 53312 #3
11544 !! wikitext
11545 [[File:Foobar.jpg|right|Caption page=stuff]]
11546 !! html/php
11547 <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>
11548
11549 !! html/parsoid
11550 <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" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
11551 !! end
11552
11553 !! test
11554 Allow empty links in image captions (Bug 60753)
11555 !! options
11556 thumbsize=220
11557 !! wikitext
11558 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11559 [[]]
11560 [[Link2]]
11561 ]]
11562 !! html/php
11563 <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>
11564
11565 !! html/parsoid
11566 <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" 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>
11567 [[]]
11568 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11569 </figcaption></figure>
11570 !! end
11571
11572 !! test
11573 Titles in unlinked images (T23454)
11574 !! wikitext
11575 [[File:Foobar.jpg|link=|stuff]]
11576 !! html/php
11577 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11578 </p>
11579 !! end
11580
11581 !! test
11582 Link with empty target
11583 !! wikitext
11584 [[]]
11585 !! html
11586 <p>[[]]
11587 </p>
11588 !! end
11589
11590 !! test
11591 Image with link trail
11592 !! wikitext
11593 Linktrails should not work for images: [[File:Foobar.jpg]]s
11594 !! html/php
11595 <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
11596 </p>
11597 !! html/parsoid
11598 <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" height="220" width="1941"/></a></span>s</p>
11599 !! end
11600
11601 !! test
11602 Image with empty attribute
11603 !! options
11604 parsoid=wt2html,wt2wt,html2html
11605 !! wikitext
11606 [[File:Foobar.jpg|right||Caption text]]
11607 !! html/php
11608 <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>
11609
11610 !! html/parsoid
11611 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11612 !! end
11613
11614 !! test
11615 1. Block image with individual attributes from templates
11616 !! wikitext
11617 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11618 !! html/php
11619 <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>
11620
11621 !! html/parsoid
11622 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11623 !! end
11624
11625 !! test
11626 2. Block Image with individual attributes from templates
11627 !! wikitext
11628 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11629 !! html/php
11630 <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>
11631
11632 !! html/parsoid
11633 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11634 !! end
11635
11636 !! test
11637 3. Inline image with individual attributes from templates
11638 !! wikitext
11639 [[File:Foobar.jpg|{{echo|50px}}]]
11640 !! html/php
11641 <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>
11642 </p>
11643 !! html/parsoid
11644 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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" height="6" width="50"/></a></span></p>
11645 !! end
11646
11647 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11648 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11649 !! test
11650 Image with multiple attributes from the same template
11651 !! wikitext
11652 [[File:Foobar.jpg|{{image_attribs}}]]
11653 !! html/php
11654 <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>
11655
11656 !! html/parsoid
11657 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11658 !! end
11659
11660 !! test
11661 Image with link tails
11662 !! options
11663 thumbsize=220
11664 !! wikitext
11665 123[[File:Foobar.jpg]]456
11666 123[[File:Foobar.jpg|right]]456
11667 123[[File:Foobar.jpg|thumb]]456
11668 !! html/php
11669 <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
11670 </p>
11671 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
11672 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
11673
11674 !! html/php+tidy
11675 <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>
11676 <p>123</p>
11677 <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>
11678 <p>456 123</p>
11679 <div class="thumb tright">
11680 <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>
11681 <div class="thumbcaption">
11682 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11683 </div>
11684 </div>
11685 </div>
11686 <p>456</p>
11687 !! html/parsoid
11688 <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" height="220" width="1941"></a></span>456</p>
11689 <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" height="220" width="1941"></a></figure><p>456</p>
11690 <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/180px-Foobar.jpg" height="25" width="220"></a></figure><p>456</p>
11691 !! end
11692
11693 !! test
11694 Image with multiple captions -- only last one is accepted
11695 !! wikitext
11696 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11697 !! html/php
11698 <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>
11699
11700 !! html/parsoid
11701 <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" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
11702 !! end
11703
11704 !! test
11705 Image with multiple widths -- use last
11706 !! wikitext
11707 [[File:Foobar.jpg|200px|300px|caption]]
11708 !! html/php
11709 <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>
11710 </p>
11711 !! html/parsoid
11712 <p><span 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" height="34" width="300"/></a></span></p>
11713 !! end
11714
11715 !! test
11716 Image with multiple alignments -- use first (bug 48664)
11717 !! options
11718 thumbsize=220
11719 !! wikitext
11720 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11721
11722 [[File:Foobar.jpg|middle|text-top|caption]]
11723 !! html/php
11724 <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>
11725 <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>
11726 </p>
11727 !! html/parsoid
11728 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11729 <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" height="220" width="1941"/></a></span></p>
11730 !! end
11731
11732 !! test
11733 Image with width attribute at different positions
11734 !! wikitext
11735 [[File:Foobar.jpg|200px|right|Caption]]
11736 [[File:Foobar.jpg|right|200px|Caption]]
11737 [[File:Foobar.jpg|right|Caption|200px]]
11738 !! html/php
11739 <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>
11740 <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>
11741 <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>
11742
11743 !! html/parsoid
11744 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11745 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11746 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11747 !! end
11748
11749 # a sad bit of backward-compatibility
11750 !! test
11751 Image with size specified with pxpx (bug 13500, 51628)
11752 !! options
11753 parsoid=wt2html,wt2wt,html2html
11754 !! wikitext
11755 [[File:Foobar.jpg|20pxpx]]
11756 [[File:Foobar.jpg|200x20pxpx]]
11757 !! html/php
11758 <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>
11759 <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>
11760 </p>
11761 !! html/parsoid
11762 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="177"/></a></span></p>
11763 !! end
11764
11765 !! test
11766 Image with link parameter, wiki target
11767 !! wikitext
11768 [[File:Foobar.jpg|link=Main Page]]
11769 !! html/php
11770 <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>
11771 </p>
11772 !! html/parsoid
11773 <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" height="220" width="1941"></a></span></p>
11774 !! end
11775
11776 # parsoid bug 49293 (part 1)
11777 !! test
11778 Image with link parameter, URL target
11779 !! wikitext
11780 [[File:Foobar.jpg|link=http://example.com/]]
11781 !! html/php
11782 <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>
11783 </p>
11784 !! html/parsoid
11785 <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" height="220" width="1941"></a></span></p>
11786 !! end
11787
11788 # parsoid bug 49293 (part 2)
11789 !! test
11790 Image with link parameter, protocol-less URL target
11791 !! wikitext
11792 [[File:Foobar.jpg|link=//example.com/]]
11793 !! html/php
11794 <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>
11795 </p>
11796 !! html/parsoid
11797 <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" height="220" width="1941"></a></span></p>
11798 !! end
11799
11800 !! test
11801 Image with link parameter, wgExternalLinkTarget
11802 !! wikitext
11803 [[Image:foobar.jpg|link=http://example.com/]]
11804 !! config
11805 wgExternalLinkTarget='foobar'
11806 !! html
11807 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11808 </p>
11809 !! end
11810
11811 !! test
11812 Image with link parameter, wgNoFollowLinks set to false
11813 !! wikitext
11814 [[Image:foobar.jpg|link=http://example.com/]]
11815 !! config
11816 wgNoFollowLinks=false
11817 !! html
11818 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11819 </p>
11820 !! end
11821
11822 !! test
11823 Image with link parameter, wgNoFollowDomainExceptions
11824 !! wikitext
11825 [[Image:foobar.jpg|link=http://example.com/]]
11826 !! config
11827 wgNoFollowDomainExceptions='example.com'
11828 !! html
11829 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11830 </p>
11831 !! end
11832
11833 !! test
11834 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11835 !! wikitext
11836 [[Image:foobar.jpg|link=http://example.com/|Title]]
11837 !! config
11838 wgExternalLinkTarget='foobar'
11839 !! html
11840 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11841 </p>
11842 !! end
11843
11844 !! test
11845 Image with empty link parameter
11846 !! wikitext
11847 [[File:Foobar.jpg|link=]]
11848 !! html/php
11849 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11850 </p>
11851 !! html/parsoid
11852 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
11853 !! end
11854
11855 !! test
11856 Image with link parameter (wiki target) and unnamed parameter
11857 !! wikitext
11858 [[File:Foobar.jpg|link=Main_Page|Title]]
11859 !! html/php
11860 <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>
11861 </p>
11862 !! html/parsoid
11863 <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" height="220" width="1941"></a></span></p>
11864 !! end
11865
11866 !! test
11867 Image with link parameter (URL target) and unnamed parameter
11868 !! wikitext
11869 [[File:Foobar.jpg|link=http://example.com/|Title]]
11870 !! html/php
11871 <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>
11872 </p>
11873 !! html/parsoid
11874 <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" height="220" width="1941"></a></span></p>
11875 !! end
11876
11877 !! test
11878 Thumbnail image with link parameter
11879 !! options
11880 thumbsize=220
11881 parsoid=wt2html,wt2wt,html2html
11882 !! wikitext
11883 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11884 !! html/php
11885 <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>
11886
11887 !! html/parsoid
11888 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
11889 !! end
11890
11891 !! test
11892 Manually-specified thumbnail image
11893 !! options
11894 thumbsize=220
11895 !! wikitext
11896 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11897 !! html/php
11898 <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>
11899
11900 !! html/parsoid
11901 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11902 !! end
11903
11904 !! test
11905 Manually-specified thumbnail image with explicit link to wiki page
11906 !! options
11907 thumbsize=220
11908 parsoid=wt2html,wt2wt,html2html
11909 !! wikitext
11910 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11911 !! html/php
11912 <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>
11913
11914 !! html/parsoid
11915 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11916 !! end
11917
11918 !! test
11919 Manually-specified thumbnail image with explicit link to url
11920 !! options
11921 thumbsize=220
11922 parsoid=wt2html,wt2wt,html2html
11923 !! wikitext
11924 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11925 !! html/php
11926 <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>
11927
11928 !! html/parsoid
11929 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11930 !! end
11931
11932 !! test
11933 Manually-specified thumbnail image with explicit no link
11934 !! options
11935 thumbsize=220
11936 parsoid=wt2html,wt2wt,html2html
11937 !! wikitext
11938 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11939 !! html/php
11940 <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>
11941
11942 !! html/parsoid
11943 <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" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
11944 !! end
11945
11946 !! test
11947 Manually-specified thumbnail image with explicit link and alt text
11948 !! options
11949 thumbsize=220
11950 parsoid=wt2html,wt2wt,html2html
11951 !! wikitext
11952 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11953 !! html/php
11954 <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>
11955
11956 !! html/parsoid
11957 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11958 !! end
11959
11960 !! test
11961 Image with frame and link
11962 !! options
11963 parsoid=wt2html,wt2wt,html2html
11964 !! wikitext
11965 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11966 !! html/php
11967 <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>
11968
11969 !! html/parsoid
11970 <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" 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>
11971 !! end
11972
11973 !! test
11974 Image with frame and link and explicit alt
11975 !! options
11976 parsoid=wt2html,wt2wt,html2html
11977 !! wikitext
11978 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11979 !! html/php
11980 <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>
11981
11982 !! html/parsoid
11983 <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" 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>
11984 !! end
11985
11986 !! test
11987 Image with wiki markup in implicit alt
11988 !! options
11989 parsoid=wt2html,wt2wt,html2html
11990 !! wikitext
11991 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11992
11993 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11994 !! html/php
11995 <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>
11996 </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>
11997 </p>
11998 !! html/parsoid
11999 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12000 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12001 !! end
12002
12003 ###################
12004 # Conflicting image format options.
12005 # First option specified should 'win'.
12006 # All three cases in each test should be identical.
12007
12008 !! test
12009 Image with 'frameless' first.
12010 !! options
12011 parsoid=wt2html,wt2wt,html2html
12012 !! wikitext
12013 [[File:Foobar.jpg|frameless|caption]]
12014
12015 [[File:Foobar.jpg|frameless|frame|caption]]
12016
12017 [[File:Foobar.jpg|frameless|thumb|caption]]
12018 !! html/php
12019 <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>
12020 </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>
12021 </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>
12022 </p>
12023 !! html/parsoid
12024 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
12025 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
12026 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
12027 !! end
12028
12029 !! test
12030 Image with 'frame' first.
12031 !! options
12032 parsoid=wt2html,wt2wt,html2html
12033 !! wikitext
12034 [[File:Foobar.jpg|frame|caption]]
12035 [[File:Foobar.jpg|frame|frameless|caption]]
12036 [[File:Foobar.jpg|frame|thumb|caption]]
12037 !! html/php
12038 <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>
12039 <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>
12040 <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>
12041
12042 !! html/parsoid
12043 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12044 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12045 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12046 !! end
12047
12048 !! test
12049 Image with 'thumb' first.
12050 !! options
12051 parsoid=wt2html,wt2wt,html2html
12052 !! wikitext
12053 [[File:Foobar.jpg|thumb|caption]]
12054 [[File:Foobar.jpg|thumb|frameless|caption]]
12055 [[File:Foobar.jpg|thumb|frame|caption]]
12056 !! html/php
12057 <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>
12058 <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>
12059 <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>
12060
12061 !! html/parsoid
12062 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12063 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12064 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12065 !! end
12066
12067 ###################
12068 # Image sizing.
12069 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12070 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12071 # Foobar has actual size of 1941x220
12072 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12073 # a scalable format.
12074 # 2. Framed images always ignore size options; always render at default size.
12075 # 3. "Unspecified format" and border are the only types which can be
12076 # enlarged.
12077
12078 !! test
12079 Image: "unspecified format" and border enlarge
12080 !! options
12081 parsoid=wt2html,wt2wt,html2html
12082 !! wikitext
12083 [[File:Foobar.jpg|2000px]]
12084
12085 [[File:Foobar.jpg|border|2000px]]
12086 !! html/php
12087 <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>
12088 </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>
12089 </p>
12090 !! html/parsoid
12091 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p>
12092 <p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p>
12093 !! end
12094
12095 !! test
12096 Image: "unspecified format" and border reduce
12097 !! options
12098 parsoid=wt2html,wt2wt,html2html
12099 !! wikitext
12100 [[File:Foobar.jpg|1000px]]
12101
12102 [[File:Foobar.jpg|border|1000px]]
12103 !! html/php
12104 <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>
12105 </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>
12106 </p>
12107 !! html/parsoid
12108 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
12109 <p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
12110 !! end
12111
12112 !! test
12113 Image: thumbs reduce
12114 !! options
12115 parsoid=wt2html,wt2wt,html2html
12116 !! wikitext
12117 [[File:Foobar.jpg|thumb|50px]]
12118 !! html/php
12119 <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>
12120
12121 !! html/parsoid
12122 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></figure>
12123 !! end
12124
12125 !! test
12126 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12127 !! options
12128 parsoid=wt2html,wt2wt,html2html
12129 !! wikitext
12130 [[File:Foobar.jpg|thumb|2000px]]
12131
12132 [[File:Foobar.svg|thumb|2000px]]
12133 !! html/php
12134 <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>
12135 <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>
12136
12137 !! html/parsoid
12138 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12139 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></figure>
12140 !! end
12141
12142 !! test
12143 Image: frameless can reduce in size
12144 !! options
12145 parsoid=wt2html,wt2wt,html2html
12146 !! wikitext
12147 [[File:Foobar.jpg|frameless|50px]]
12148 !! html/php
12149 <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>
12150 </p>
12151 !! html/parsoid
12152 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></span></p>
12153 !! end
12154
12155 !! test
12156 Image: bitmap frameless can't be enlarged past original size, but vector can
12157 !! options
12158 parsoid=wt2html,wt2wt,html2html
12159 !! wikitext
12160 [[File:Foobar.jpg|frameless|2000px]]
12161
12162 [[File:Foobar.svg|frameless|2000px]]
12163 !! html/php
12164 <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>
12165 </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>
12166 </p>
12167 !! html/parsoid
12168 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12169 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></span></p>
12170 !! end
12171
12172 !! test
12173 Image: framed images are always unscaled.
12174 !! options
12175 parsoid=wt2html,wt2wt,html2html
12176 !! wikitext
12177 [[File:Foobar.jpg|frame]]
12178
12179 [[File:Foobar.jpg|frame|50px]]
12180
12181 [[File:Foobar.jpg|frame|50x50px]]
12182
12183 [[File:Foobar.jpg|frame|2000px]]
12184 !! html/php
12185 <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>
12186 <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>
12187 <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>
12188 <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>
12189
12190 !! html/parsoid
12191 <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" height="220" width="1941"/></a></figure>
12192 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12193 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12194 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12195 !! end
12196
12197 ###################
12198
12199 !! test
12200 Link to image page- image page normally doesn't exists, hence edit link
12201 Add test with existing image page
12202 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12203 !! wikitext
12204 [[:Image:test]]
12205 !! html
12206 <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>
12207 </p>
12208 !! end
12209
12210 !! test
12211 bug 18784 Link to non-existent image page with caption should use caption as link text
12212 !! wikitext
12213 [[:Image:test|caption]]
12214 !! html
12215 <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>
12216 </p>
12217 !! end
12218
12219 !! test
12220 Frameless image caption with a free URL
12221 !! wikitext
12222 [[File:Foobar.jpg|http://example.com]]
12223 !! html/php
12224 <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>
12225 </p>
12226 !! html/parsoid
12227 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12228 !! end
12229
12230 !! test
12231 Thumbnail image caption with a free URL
12232 !! options
12233 thumbsize=220
12234 !! wikitext
12235 [[File:Foobar.jpg|thumb|http://example.com]]
12236 !! html/php
12237 <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>
12238
12239 !! html/parsoid
12240 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12241 !! end
12242
12243 !! test
12244 Thumbnail image caption with a free URL and explicit alt
12245 !! options
12246 thumbsize=220
12247 parsoid=wt2html,wt2wt,html2html
12248 !! wikitext
12249 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12250 !! html/php
12251 <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>
12252
12253 !! html/parsoid
12254 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12255 !! end
12256
12257 !! test
12258 SVG thumbnails with no language set
12259 !! options
12260 !! wikitext
12261 [[File:Foobar.svg|thumb|caption]]
12262 !! html/php
12263 <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>
12264
12265 !! html/parsoid
12266 <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" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12267 !! end
12268
12269 !! test
12270 SVG thumbnails with language de
12271 !! options
12272 parsoid=wt2html,wt2wt,html2html
12273 !! wikitext
12274 [[File:Foobar.svg|thumb|caption|lang=de]]
12275 !! html/php
12276 <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>
12277
12278 !! html/parsoid
12279 <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" lang="de" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12280 !! end
12281
12282 !! test
12283 SVG thumbnails with invalid language code
12284 !! options
12285 parsoid=wt2html,wt2wt,html2html
12286 !! wikitext
12287 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12288 !! html/php
12289 <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>
12290
12291 !! html/parsoid
12292 <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" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
12293 !! end
12294
12295 !! test
12296 BUG 1887: A ISBN with a thumbnail
12297 !! wikitext
12298 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12299 !! html/php
12300 <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>
12301
12302 !! html/parsoid
12303 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
12304 !! end
12305
12306 !! test
12307 BUG 1887: A RFC with a thumbnail
12308 !! wikitext
12309 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12310 !! html/php
12311 <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>
12312
12313 !! html/parsoid
12314 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
12315 !! end
12316
12317 !! test
12318 BUG 1887: A mailto link with a thumbnail
12319 !! wikitext
12320 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12321 !! html/php
12322 <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>
12323
12324 !! html/parsoid
12325 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
12326 !! end
12327
12328 # Pending resolution to bug 368
12329 !! test
12330 BUG 648: Frameless image caption with a link
12331 !! wikitext
12332 [[File:Foobar.jpg|text with a [[link]] in it]]
12333 !! html/php
12334 <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>
12335 </p>
12336 !! html/parsoid
12337 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12338 !! end
12339
12340 !! test
12341 BUG 648: Frameless image caption with a link (suffix)
12342 !! wikitext
12343 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12344 !! html/php
12345 <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>
12346 </p>
12347 !! html/parsoid
12348 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12349 !! end
12350
12351 !! test
12352 BUG 648: Frameless image caption with an interwiki link
12353 !! wikitext
12354 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12355 !! html/php
12356 <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>
12357 </p>
12358 !! html/parsoid
12359 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12360 !! end
12361
12362 !! test
12363 BUG 648: Frameless image caption with a piped interwiki link
12364 !! wikitext
12365 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12366 !! html/php
12367 <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>
12368 </p>
12369 !! html/parsoid
12370 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12371 !! end
12372
12373 !! test
12374 Escape HTML special chars in image alt text
12375 !! wikitext
12376 [[File:Foobar.jpg|& < > "]]
12377 !! html/php
12378 <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>
12379 </p>
12380 !! html/parsoid
12381 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12382 !! end
12383
12384 !! test
12385 BUG 499: Alt text should have &#1234;, not &amp;1234;
12386 !! wikitext
12387 [[File:Foobar.jpg|&#9792;]]
12388 !! html/php
12389 <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>
12390 </p>
12391 !! html/parsoid
12392 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12393 !! end
12394
12395 !! test
12396 Broken image caption with link
12397 !! options
12398 parsoid=wt2html,wt2wt,html2html
12399 !! wikitext
12400 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12401 !! html/php
12402 <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.
12403 </p>
12404 !! html/parsoid
12405 <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>
12406 !! end
12407
12408 !! test
12409 Image caption containing another image
12410 !! wikitext
12411 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12412 !! html/php
12413 <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>
12414
12415 !! html/parsoid
12416 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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" height="135" width="135"/></a></span> inside it!</figcaption></figure>
12417 !! end
12418
12419 !! test
12420 Image: caption containing a newline
12421 !! wikitext
12422 [[File:Foobar.jpg|This
12423 *is some text]]
12424 !! html/php
12425 <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>
12426 </p>
12427 !! html/parsoid
12428 <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" height="220" width="1941"/></a></span></p>
12429 !!end
12430
12431 !!test
12432 Image: caption containing leading space
12433 (The leading space should not trigger nowiki escaping in wt2wt mode)
12434 !! wikitext
12435 [[File:Foobar.jpg|thumb| bar]]
12436 !! html/php
12437 <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>
12438
12439 !! html/parsoid
12440 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
12441 !!end
12442
12443 !! test
12444 Image: caption containing a table
12445 !! options
12446 parsoid=wt2html,wt2wt,html2html
12447 !! wikitext
12448 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12449 {|
12450 ! Foo !! Bar
12451 |-
12452 | Foo1 || Bar1
12453 |}
12454 and some more text.]]
12455 !! html/php
12456 <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>
12457
12458 !! html/parsoid
12459 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
12460 <table>
12461 <tbody>
12462 <tr><th>Foo </th><th>Bar</th></tr>
12463 <tr>
12464 <td>Foo1 </td>
12465 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12466 !! end
12467
12468 !! test
12469 Bug 3090: External links other than http: in image captions
12470 !! wikitext
12471 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12472 !! html/php
12473 <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>
12474
12475 !! html/parsoid
12476 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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>
12477 !! end
12478
12479 !! test
12480 Custom class
12481 !! options
12482 parsoid=wt2html,wt2wt,html2html
12483 !! wikitext
12484 [[Image:foobar.jpg|a|class=b]]
12485 !! html/php
12486 <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>
12487 </p>
12488 !! html/parsoid
12489 <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" height="220" width="1941"/></a></span></p>
12490 !! end
12491
12492 !! test
12493 Localized image handling (1).
12494 !! options
12495 parsoid=wt2html,wt2wt,html2html
12496 language=es
12497 !! wikitext
12498 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12499 !! html/php
12500 <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>
12501
12502 !! html/parsoid
12503 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12504 !! end
12505
12506 !! test
12507 Localized image handling (2).
12508 !! options
12509 thumbsize=220
12510 parsoid=wt2html,wt2wt,html2html
12511 language=es
12512 !! wikitext
12513 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12514 !! html/php
12515 <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>
12516
12517 !! html/parsoid
12518 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12519 !! end
12520
12521 !! test
12522 "border", "frameless" and "class" attributes on an image.
12523 !! options
12524 thumbsize=220
12525 parsoid=wt2html,wt2wt,html2html
12526 !! wikitext
12527 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12528 !! html/php
12529 <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>
12530 </p>
12531 !! html/parsoid
12532 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
12533 !! end
12534
12535 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12536 !! test
12537 Invalid image attributes (bug 62500)
12538 !! options
12539 thumbsize=220
12540 parsoid=wt2html,wt2wt,html2html
12541 !! wikitext
12542 [[File:Foobar.jpg|thumb|float|left|caption]]
12543
12544 [[File:Foobar.jpg|thumb|righ|caption]]
12545
12546 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12547 !! html/php
12548 <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>
12549 <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>
12550 <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>
12551
12552 !! html/parsoid
12553 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12554 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12555 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12556 !! end
12557
12558 !! article
12559 File:Barfoo.jpg
12560 !! text
12561 #REDIRECT [[File:Barfoo.jpg]]
12562 !! endarticle
12563
12564 # FIXME: Parsoid should run this test -- but we'd need to teach the
12565 # mockAPI about the redirected Barfoo.jpg image.
12566 !! test
12567 Redirected image
12568 !! wikitext
12569 [[Image:Barfoo.jpg]]
12570 !! html/php
12571 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12572 </p>
12573 !! end
12574
12575 !! test
12576 Missing image with uploads disabled
12577 !! options
12578 wgEnableUploads=0
12579 !! wikitext
12580 [[File:Foobaz.jpg]]
12581 !! html/php
12582 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12583 </p>
12584 !! html/parsoid
12585 <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>
12586 !! end
12587
12588 # Parsoid-specific testing for images
12589 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12590 # Currently imperfect due to a flaw in the Parsoid testrunner
12591 # Work in progress
12592 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12593 # image tests.
12594
12595 !! test
12596 Parsoid-specific image handling - simple image with size and middle alignment
12597 !! wikitext
12598 [[File:Foobar.jpg|middle|50px]]
12599 !! html/parsoid
12600 <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" height="6" width="50"></a></span></p>
12601 !! end
12602
12603 !! test
12604 Parsoid-specific image handling - simple image with size, middle alignment,
12605 non-standard namespace alias
12606 !! options
12607 parsoid=wt2wt,wt2html,html2html
12608 !! wikitext
12609 [[Image:Foobar.jpg|middle|50px]]
12610 !! html/parsoid
12611 <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" height="6" width="50"></a></span></p>
12612 !! end
12613
12614 !! test
12615 Parsoid-specific image handling - simple image with size and middle alignment
12616 (existing content)
12617 !! wikitext
12618 [[File:Foobar.jpg|50px|middle]]
12619 !! html/parsoid
12620 <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" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12621 !! end
12622
12623 !! test
12624 Parsoid-specific image handling - simple image with size and middle alignment
12625 and non-standard namespace name
12626 !! options
12627 parsoid=wt2html,wt2wt,html2html
12628 !! wikitext
12629 [[Image:Foobar.jpg|50px|middle]]
12630 !! html/parsoid
12631 <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" height="6" width="50"></a></span></p>
12632 !! end
12633
12634 !! test
12635 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12636 !! wikitext
12637 [[File:Foobar.jpg|500x10px|baseline|caption]]
12638 !! html/parsoid
12639 <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" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12640 !! end
12641
12642 !! test
12643 Parsoid-specific image handling - simple image with border and size spec
12644 !! wikitext
12645 [[File:Foobar.jpg|50px|border|caption]]
12646 !! html/parsoid
12647 <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" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12648 !! end
12649
12650 !! test
12651 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12652 !! wikitext
12653 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12654 !! html/parsoid
12655 <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/180px-Foobar.jpg" height="25" width="220" /></a><figcaption>caption content</figcaption></figure>
12656 !! end
12657
12658 !! test
12659 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12660 (existing content)
12661 !! wikitext
12662 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12663 !! html/parsoid
12664 <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/180px-Foobar.jpg" 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>
12665 !! end
12666
12667 !! test
12668 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12669 !! wikitext
12670 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12671 !! html/parsoid
12672 <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" height="6" width="50" /></a><figcaption>caption</figcaption></figure>
12673 !! end
12674
12675 !! test
12676 Parsoid-specific image handling - thumbnail with specific size, halign,
12677 valign, and caption (existing content)
12678 !! wikitext
12679 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12680 !! html/parsoid
12681 <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" 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>
12682 !! end
12683
12684 !! test
12685 Parsoid-specific image handling - framed image with specific size and caption
12686 (size is ignored)
12687 !! options
12688 parsoid=wt2html,wt2wt,html2html
12689 !! wikitext
12690 [[File:Foobar.jpg|frame|500x50px|caption]]
12691 !! html/parsoid
12692 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12693 !! end
12694
12695 !! test
12696 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12697 (size is ignored)
12698 !! options
12699 parsoid=wt2html,wt2wt,html2html
12700 !! wikitext
12701 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12702 !! html/parsoid
12703 <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" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12704 !! end
12705
12706 !! test
12707 Parsoid-specific image handling - frameless image with specific size, border, and caption
12708 !! wikitext
12709 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12710 !! html/parsoid
12711 <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" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12712 !! end
12713
12714 !! test
12715 Parsoid-specific image handling - simple image with a formatted caption
12716 !! wikitext
12717 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12718 !! html/parsoid
12719 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&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>"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
12720 !! end
12721
12722 !! test
12723 Parsoid-specific image handling - caption with a template in it
12724 !! wikitext
12725 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12726 !! html/parsoid
12727 <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" 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>
12728 !! end
12729
12730 !! test
12731 Parsoid-specific image handling - caption with unbalanced tags in it
12732 !! options
12733 parsoid=wt2html,wt2wt,html2html
12734 !! wikitext
12735 foo
12736 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12737 bar
12738 !! html/parsoid
12739 <p>foo</p>
12740 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
12741 <p>bar</p>
12742 !! end
12743
12744 !! test
12745 Parsoid-specific image handling - empty caption (1)
12746 !! options
12747 parsoid=wt2html,wt2wt
12748 !! wikitext
12749 [[File:Foobar.jpg|thumb|]]
12750 !! html/parsoid
12751 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption></figcaption></figure>
12752 !! end
12753
12754 # empty captions don't get serialized unless we're in the "round trip" case
12755 !! test
12756 Parsoid-specific image handling - empty caption (2)
12757 !! options
12758 parsoid=html2wt
12759 !! html/parsoid
12760 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12761 <a href="File:Foobar.jpg">
12762 <img resource="./File:Foobar.jpg"
12763 src="//example.com/images/3/3a/Foobar.jpg"
12764 height="25" width="220"/>
12765 </a>
12766 <figcaption></figcaption>
12767 </figure>
12768 !! wikitext
12769 [[File:Foobar.jpg|thumb]]
12770 !! end
12771
12772 !! test
12773 Parsoid-specific image handling - whitespace caption
12774 !! wikitext
12775 [[File:Foobar.jpg|thumb| ]]
12776 !! html/parsoid
12777 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> </figcaption></figure>
12778 !! end
12779
12780 !! test
12781 Parsoid-specific image handling - lang option
12782 !! wikitext
12783 foo
12784 [[File:Foobar.svg|lang=de|caption]]
12785 bar
12786 !! html/parsoid
12787 <p>foo
12788 <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" height="180" width="240"/></a></span>
12789 bar</p>
12790 !! end
12791
12792
12793 ###
12794 ### Subpages
12795 ###
12796 !! article
12797 Subpage test/subpage
12798 !! text
12799 foo
12800 !! endarticle
12801
12802 !! test
12803 Subpage link
12804 !! options
12805 subpage title=[[Subpage test]]
12806 !! wikitext
12807 [[/subpage]]
12808 !! html
12809 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12810 </p>
12811 !! end
12812
12813 !! test
12814 Subpage noslash link
12815 !! options
12816 subpage title=[[Subpage test]]
12817 !! wikitext
12818 [[/subpage/]]
12819 !! html
12820 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12821 </p>
12822 !! end
12823
12824 !! article
12825 Subpage test/1/2/subpage
12826 !! text
12827 blah
12828 !! endarticle
12829
12830 !! test
12831 Relative subpage noslash link
12832 !! options
12833 parsoid=wt2wt,wt2html,html2html
12834 subpage title=[[Subpage test/1/2/3/4]]
12835 !! wikitext
12836 [[../../subpage/]]
12837
12838 [[../../subpage]]
12839 !! html/php
12840 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12841 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12842 </p>
12843 !! html/parsoid
12844 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12845 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12846 !! end
12847
12848 !! test
12849 Parsoid: dot-slash prefixed wikilinks
12850 !! wikitext
12851 [[./foo]]
12852
12853 [[././bar]]
12854
12855 [[././baz/]]
12856 !! html/php
12857 <p>[[./foo]]
12858 </p><p>[[././bar]]
12859 </p><p>[[././baz/]]
12860 </p>
12861 !! html/parsoid
12862 <p>[[./foo]]
12863 </p><p>[[././bar]]
12864 </p><p>[[././baz/]]
12865 </p>
12866 !! end
12867
12868 !! test
12869 Render invalid page names as plain text (bug 51090)
12870 !! wikitext
12871 [[./../foo|bar]]
12872 [[foo�|bar]]
12873 [[foo/.|bar]]
12874 [[foo/..|bar]]
12875 [[foo~~~bar]]
12876 [[foo>bar]]
12877 [[foo[bar]]
12878 [[.]]
12879 [[..]]
12880 [[foo././bar]]
12881
12882 [[{{echo|./../foo}}|bar]]
12883 [[{{echo|foo/.}}|bar]]
12884 [[{{echo|foo/..}}|bar]]
12885 [[{{echo|foo~~~~bar}}]]
12886 [[{{echo|foo>bar}}]]
12887 [[{{echo|foo././bar}}]]
12888 [[{{echo|foo{bar}}]]
12889 [[{{echo|foo}bar}}]]
12890 [[{{echo|foo[bar}}]]
12891 [[{{echo|foo]bar}}]]
12892 [[{{echo|foo<bar}}]]
12893 !!html/php
12894 <p>[[./../foo|bar]]
12895 [[foo�|bar]]
12896 [[foo/.|bar]]
12897 [[foo/..|bar]]
12898 [[foo~~~bar]]
12899 [[foo&gt;bar]]
12900 [[foo[bar]]
12901 [[.]]
12902 [[..]]
12903 [[foo././bar]]
12904 </p><p>[[./../foo|bar]]
12905 [[foo/.|bar]]
12906 [[foo/..|bar]]
12907 [[foo~~~~bar]]
12908 [[foo&gt;bar]]
12909 [[foo././bar]]
12910 [[foo{bar]]
12911 [[foo}bar]]
12912 [[foo[bar]]
12913 [[foo]bar]]
12914 [[foo&lt;bar]]
12915 </p>
12916 !!html/parsoid
12917 <p>[[./../foo|bar]]
12918 [[foo�|bar]]
12919 [[foo/.|bar]]
12920 [[foo/..|bar]]
12921 [[foo~~~bar]]
12922 [[foo>bar]]
12923 [[foo[bar]]
12924 [[.]]
12925 [[..]]
12926 [[foo././bar]]</p>
12927
12928 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12929 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12930 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12931 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12932 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12933 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12934 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12935 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12936 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12937 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12938 [[<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>
12939 !!end
12940
12941 !! test
12942 Disabled subpages
12943 !! wikitext
12944 [[/subpage]]
12945 !! html
12946 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12947 </p>
12948 !! end
12949
12950 !! test
12951 BUG 561: {{/Subpage}}
12952 !! options
12953 subpage title=[[Page]]
12954 !! wikitext
12955 {{/Subpage}}
12956 !! html
12957 <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>
12958 </p>
12959 !! end
12960
12961 ###
12962 ### Categories
12963 ###
12964 !! article
12965 Category:MediaWiki User's Guide
12966 !! text
12967 blah
12968 !! endarticle
12969
12970 !! test
12971 Link to category
12972 !! wikitext
12973 [[:Category:MediaWiki User's Guide]]
12974 !! html
12975 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12976 </p>
12977 !! end
12978
12979 !! test
12980 Simple category
12981 !! options
12982 cat
12983 !! wikitext
12984 [[Category:MediaWiki User's Guide]]
12985 !! html
12986 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12987 !! end
12988
12989 !! test
12990 PAGESINCATEGORY invalid title fatal (r33546 fix)
12991 !! wikitext
12992 {{PAGESINCATEGORY:<bogus>}}
12993 !! html
12994 <p>0
12995 </p>
12996 !! end
12997
12998 !! test
12999 Category with different sort key
13000 !! options
13001 cat
13002 !! wikitext
13003 [[Category:MediaWiki User's Guide|Foo]]
13004 !! html
13005 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13006 !! end
13007
13008 !! test
13009 Category with identical sort key
13010 !! options
13011 cat
13012 !! wikitext
13013 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13014 !! html
13015 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13016 !! end
13017
13018 !! test
13019 Category with empty sort key
13020 !! options
13021 cat
13022 pst
13023 !! wikitext
13024 [[Category:MediaWiki User's Guide|]]
13025 !! html
13026 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13027 !! end
13028
13029 !! test
13030 Category with empty sort key and parentheses
13031 !! options
13032 cat
13033 pst
13034 !! wikitext
13035 [[Category:Foo (bar)|]]
13036 !! html
13037 [[Category:Foo (bar)|Foo]]
13038 !! end
13039
13040 !! test
13041 Category with link tail
13042 !! options
13043 cat
13044 pst
13045 !! wikitext
13046 123[[Category:Foo]]456
13047 !! html
13048 123[[Category:Foo]]456
13049 !! end
13050
13051 !! test
13052 Category with template
13053 !! options
13054 cat
13055 pst
13056 !! wikitext
13057 [[Category:{{echo|Foo}}]]
13058 !! html
13059 [[Category:{{echo|Foo}}]]
13060 !! end
13061
13062 !! test
13063 Category with template in sort key
13064 !! options
13065 cat
13066 pst
13067 !! wikitext
13068 [[Category:Foo|{{echo|Bar}}]]
13069 !! html
13070 [[Category:Foo|{{echo|Bar}}]]
13071 !! end
13072
13073 !! test
13074 Category with template in sort key and title
13075 !! options
13076 cat
13077 pst
13078 !! wikitext
13079 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13080 !! html
13081 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13082 !! end
13083
13084 !! test
13085 Category / paragraph interactions
13086 !! wikitext
13087 Foo [[Category:Baz]] Bar
13088
13089 Foo [[Category:Baz]]
13090 Bar
13091
13092 Foo
13093 [[Category:Baz]]
13094 Bar
13095
13096 Foo
13097 [[Category:Baz]] Bar
13098
13099 Foo
13100 [[Category:Baz]]
13101 [[Category:Baz]]
13102 [[Category:Baz]]
13103 Bar
13104
13105 [[Category:Baz]]
13106 [[Category:Baz]]
13107 [[Category:Baz]]
13108
13109 [[Category:Baz]]
13110 {{echo|[[Category:Baz]]}}
13111 [[Category:Baz]]
13112 !! html
13113 <p>Foo Bar
13114 </p><p>Foo
13115 Bar
13116 </p><p>Foo
13117 Bar
13118 </p><p>Foo Bar
13119 </p><p>Foo
13120 Bar
13121 </p>
13122 !! end
13123
13124 !! test
13125 Parsoid: Serialize link to category page with colon escape
13126 !! options
13127 parsoid
13128 !! wikitext
13129
13130 [[:Category:Foo]]
13131 [[:Category:Foo|Bar]]
13132 !! html
13133 <p>
13134 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13135 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13136 </p>
13137 !! end
13138
13139 !! test
13140 Parsoid: Link prefix/suffixes aren't applied to category links
13141 !! options
13142 parsoid=wt2html,wt2wt,html2html
13143 language=is
13144 !! wikitext
13145 x[[Category:Foo]]y
13146 !! html
13147 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13148 !! end
13149
13150 !! test
13151 Parsoid: Serialize link to file page with colon escape
13152 !! options
13153 parsoid
13154 !! wikitext
13155
13156 [[:File:Foo.png]]
13157 [[:File:Foo.png|Bar]]
13158 !! html
13159 <p>
13160 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13161 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13162 </p>
13163 !! end
13164
13165 !! test
13166 Parsoid: Serialize a genuine category link without colon escape
13167 !! options
13168 parsoid
13169 !! wikitext
13170 [[Category:Foo]]
13171 [[Category:Foo|Bar]]
13172 !! html
13173 <link rel="mw:PageProp/Category" href="Category:Foo">
13174 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13175 !! end
13176
13177 !! test
13178 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13179 !! options
13180 parsoid=html2wt
13181 !! html
13182 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13183 !! wikitext
13184 [[Category:Toxine bactérienne]]
13185 !! end
13186
13187 !! test
13188 Parsoid: Defaultsort
13189 !! wikitext
13190 {{DEFAULTSORT:Foo}}
13191 !! html/parsoid
13192 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13193 !! end
13194
13195 !! test
13196 Parsoid: Defaultsort (template-generated)
13197 !! wikitext
13198 {{{{echo|DEFAULTSORT}}:Foo}}
13199 !! html/parsoid
13200 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
13201 !! end
13202
13203 ###
13204 ### Inter-language links
13205 ###
13206 !! test
13207 Interlanguage links
13208 !! options
13209 ill
13210 !! wikitext
13211 [[es:Alimento]]
13212 [[fr:Nourriture]]
13213 [[zh:食品]]
13214 !! html/php
13215 es:Alimento fr:Nourriture zh:食品
13216 !! html/parsoid
13217 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13218 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13219 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13220 !! end
13221
13222 !! test
13223 Duplicate interlanguage links (bug 24502)
13224 !! options
13225 ill
13226 !! wikitext
13227 [[es:1]]
13228 [[es:2]]
13229 [[fr:1]]
13230 [[fr:2]]
13231 !! html/php
13232 es:1 fr:1
13233 !! html/parsoid
13234 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13235 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13236 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13237 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13238 !! end
13239
13240 ###
13241 ### Sections
13242 ###
13243 !! test
13244 Basic section headings
13245 !! wikitext
13246 == Headline 1 ==
13247 Some text
13248
13249 ==Headline 2==
13250 More
13251 ===Smaller headline===
13252 Blah blah
13253 !! html
13254 <h2><a href="#Headline_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13255 <p>Some text
13256 </p>
13257 <h2><a href="#Headline_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13258 <p>More
13259 </p>
13260 <h3><a href="#Smaller_headline" class="mw-headline-anchor" title="Link to this section">§</a><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>
13261 <p>Blah blah
13262 </p>
13263 !! end
13264
13265 !! test
13266 Section headings with TOC
13267 !! wikitext
13268 == Headline 1 ==
13269 === Subheadline 1 ===
13270 ===== Skipping a level =====
13271 ====== Skipping a level ======
13272
13273 == Headline 2 ==
13274 Some text
13275 ===Another headline===
13276 !! html
13277 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13278 <ul>
13279 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13280 <ul>
13281 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13282 <ul>
13283 <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>
13284 <ul>
13285 <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>
13286 </ul>
13287 </li>
13288 </ul>
13289 </li>
13290 </ul>
13291 </li>
13292 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13293 <ul>
13294 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13295 </ul>
13296 </li>
13297 </ul>
13298 </div>
13299
13300 <h2><a href="#Headline_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13301 <h3><a href="#Subheadline_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13302 <h5><a href="#Skipping_a_level" class="mw-headline-anchor" title="Link to this section">§</a><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>
13303 <h6><a href="#Skipping_a_level_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13304 <h2><a href="#Headline_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13305 <p>Some text
13306 </p>
13307 <h3><a href="#Another_headline" class="mw-headline-anchor" title="Link to this section">§</a><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>
13308
13309 !! end
13310
13311 !! test
13312 TOC anchors don't collide
13313 !! wikitext
13314 __FORCETOC__
13315 == Headline 2 ==
13316 == Headline ==
13317 == Headline 2 ==
13318 == Headline ==
13319 !! html
13320 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13321 <ul>
13322 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13323 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13324 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13325 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13326 </ul>
13327 </div>
13328
13329 <h2><a href="#Headline_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13330 <h2><a href="#Headline" class="mw-headline-anchor" title="Link to this section">§</a><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>
13331 <h2><a href="#Headline_2_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13332 <h2><a href="#Headline_3" class="mw-headline-anchor" title="Link to this section">§</a><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>
13333
13334 !! end
13335
13336 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13337 !! test
13338 Handling of sections up to level 6 and beyond
13339 !! wikitext
13340 = Level 1 Heading=
13341 == Level 2 Heading==
13342 === Level 3 Heading===
13343 ==== Level 4 Heading====
13344 ===== Level 5 Heading=====
13345 ====== Level 6 Heading======
13346 ======= Level 7 Heading=======
13347 ======== Level 8 Heading========
13348 ========= Level 9 Heading=========
13349 ========== Level 10 Heading==========
13350 !! html
13351 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13352 <ul>
13353 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13354 <ul>
13355 <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>
13356 <ul>
13357 <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>
13358 <ul>
13359 <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>
13360 <ul>
13361 <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>
13362 <ul>
13363 <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>
13364 <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>
13365 <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>
13366 <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>
13367 <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>
13368 </ul>
13369 </li>
13370 </ul>
13371 </li>
13372 </ul>
13373 </li>
13374 </ul>
13375 </li>
13376 </ul>
13377 </li>
13378 </ul>
13379 </div>
13380
13381 <h1><a href="#Level_1_Heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
13382 <h2><a href="#Level_2_Heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
13383 <h3><a href="#Level_3_Heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
13384 <h4><a href="#Level_4_Heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
13385 <h5><a href="#Level_5_Heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
13386 <h6><a href="#Level_6_Heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
13387 <h6><a href="#.3D_Level_7_Heading.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
13388 <h6><a href="#.3D.3D_Level_8_Heading.3D.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
13389 <h6><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
13390 <h6><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
13391
13392 !! end
13393
13394 !! test
13395 TOC regression (bug 9764)
13396 !! wikitext
13397 == title 1 ==
13398 === title 1.1 ===
13399 ==== title 1.1.1 ====
13400 === title 1.2 ===
13401 == title 2 ==
13402 === title 2.1 ===
13403 !! html
13404 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13405 <ul>
13406 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13407 <ul>
13408 <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>
13409 <ul>
13410 <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>
13411 </ul>
13412 </li>
13413 <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>
13414 </ul>
13415 </li>
13416 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13417 <ul>
13418 <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>
13419 </ul>
13420 </li>
13421 </ul>
13422 </div>
13423
13424 <h2><a href="#title_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13425 <h3><a href="#title_1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13426 <h4><a href="#title_1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13427 <h3><a href="#title_1.2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13428 <h2><a href="#title_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13429 <h3><a href="#title_2.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13430
13431 !! end
13432
13433 !! test
13434 TOC with wgMaxTocLevel=3 (bug 6204)
13435 !! options
13436 wgMaxTocLevel=3
13437 !! wikitext
13438 == title 1 ==
13439 === title 1.1 ===
13440 ==== title 1.1.1 ====
13441 === title 1.2 ===
13442 == title 2 ==
13443 === title 2.1 ===
13444 !! html
13445 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13446 <ul>
13447 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13448 <ul>
13449 <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>
13450 <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>
13451 </ul>
13452 </li>
13453 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13454 <ul>
13455 <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>
13456 </ul>
13457 </li>
13458 </ul>
13459 </div>
13460
13461 <h2><a href="#title_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13462 <h3><a href="#title_1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13463 <h4><a href="#title_1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13464 <h3><a href="#title_1.2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13465 <h2><a href="#title_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13466 <h3><a href="#title_2.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13467
13468 !! end
13469
13470 !! test
13471 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13472 !! options
13473 wgMaxTocLevel=3
13474 !! wikitext
13475 ==Section 1==
13476 ===Section 1.1===
13477 ====Section 1.1.1====
13478 ====Section 1.1.1.1====
13479 ==Section 2==
13480 !! html
13481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13482 <ul>
13483 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13484 <ul>
13485 <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>
13486 </ul>
13487 </li>
13488 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13489 </ul>
13490 </div>
13491
13492 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13493 <h3><a href="#Section_1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13494 <h4><a href="#Section_1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13495 <h4><a href="#Section_1.1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13496 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13497
13498 !! end
13499
13500
13501 !! test
13502 Resolving duplicate section names
13503 !! wikitext
13504 == Foo bar ==
13505 == Foo bar ==
13506 !! html
13507 <h2><a href="#Foo_bar" class="mw-headline-anchor" title="Link to this section">§</a><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>
13508 <h2><a href="#Foo_bar_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13509
13510 !! end
13511
13512 !! test
13513 Resolving duplicate section names with differing case (bug 10721)
13514 !! wikitext
13515 == Foo bar ==
13516 == Foo Bar ==
13517 !! html
13518 <h2><a href="#Foo_bar" class="mw-headline-anchor" title="Link to this section">§</a><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>
13519 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13520
13521 !! end
13522
13523 !! article
13524 Template:sections
13525 !! text
13526 ===Section 1===
13527 ==Section 2==
13528 !! endarticle
13529
13530 !! test
13531 Template with sections, __NOTOC__
13532 !! wikitext
13533 __NOTOC__
13534 ==Section 0==
13535 {{sections}}
13536 ==Section 4==
13537 !! html
13538 <h2><a href="#Section_0" class="mw-headline-anchor" title="Link to this section">§</a><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>
13539 <h3><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13540 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13541 <h2><a href="#Section_4" class="mw-headline-anchor" title="Link to this section">§</a><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>
13542
13543 !! end
13544
13545 !! test
13546 __NOEDITSECTION__ keyword
13547 !! wikitext
13548 __NOEDITSECTION__
13549 ==Section 1==
13550 ==Section 2==
13551 !! html
13552 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1">Section 1</span></h2>
13553 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_2">Section 2</span></h2>
13554
13555 !! end
13556
13557 !! test
13558 Link inside a section heading
13559 !! wikitext
13560 ==Section with a [[Main Page|link]] in it==
13561 !! html
13562 <h2><a href="#Section_with_a_link_in_it" class="mw-headline-anchor" title="Link to this section">§</a><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>
13563
13564 !! end
13565
13566 !! test
13567 TOC regression (bug 12077)
13568 !! wikitext
13569 __TOC__
13570 == title 1 ==
13571 === title 1.1 ===
13572 == title 2 ==
13573 !! html
13574 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13575 <ul>
13576 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13577 <ul>
13578 <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>
13579 </ul>
13580 </li>
13581 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13582 </ul>
13583 </div>
13584
13585 <h2><a href="#title_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13586 <h3><a href="#title_1.1" class="mw-headline-anchor" title="Link to this section">§</a><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>
13587 <h2><a href="#title_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13588
13589 !! end
13590
13591 !! test
13592 BUG 1219 URL next to image (good)
13593 !! wikitext
13594 http://example.com [[File:Foobar.jpg]]
13595 !! html/php
13596 <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>
13597 </p>
13598 !! html/parsoid
13599 <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" height="220" width="1941"/></a></span></p>
13600 !!end
13601
13602 !! test
13603 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13604 !! wikitext
13605 ===
13606 The line above must have a trailing space!
13607 === <!--
13608 --> <!-- -->
13609 But just in case it doesn't...
13610 !! html
13611 <h1><a href="#.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
13612 <p>The line above must have a trailing space!
13613 </p>
13614 <h1><a href="#.3D_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
13615 <p>But just in case it doesn't...
13616 </p>
13617 !! end
13618
13619 !! test
13620 Header with special characters (bug 25462)
13621 !! wikitext
13622 The tooltips shall not show entities to the user (ie. be double escaped)
13623
13624 == text > text ==
13625 section 1
13626
13627 == text < text ==
13628 section 2
13629
13630 == text & text ==
13631 section 3
13632
13633 == text ' text ==
13634 section 4
13635
13636 == text " text ==
13637 section 5
13638 !! html
13639 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13640 </p>
13641 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13642 <ul>
13643 <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>
13644 <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>
13645 <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>
13646 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13647 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13648 </ul>
13649 </div>
13650
13651 <h2><a href="#text_.3E_text" class="mw-headline-anchor" title="Link to this section">§</a><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 > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13652 <p>section 1
13653 </p>
13654 <h2><a href="#text_.3C_text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13655 <p>section 2
13656 </p>
13657 <h2><a href="#text_.26_text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13658 <p>section 3
13659 </p>
13660 <h2><a href="#text_.27_text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13661 <p>section 4
13662 </p>
13663 <h2><a href="#text_.22_text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13664 <p>section 5
13665 </p>
13666 !! end
13667
13668 !! test
13669 Header with space, plus and underscore as entity
13670 !! wikitext
13671 Id should not contain + for spaces
13672
13673 == Space between Text ==
13674 section 1
13675
13676 == Space-Entity&#32;between&#32;Text ==
13677 section 2
13678
13679 == Plus+between+Text ==
13680 section 3
13681
13682 == Plus-Entity&#43;between&#43;Text ==
13683 section 4
13684
13685 == Underscore_between_Text ==
13686 section 5
13687
13688 == Underscore-Entity&#95;between&#95;Text ==
13689 section 6
13690
13691 [[#Space between Text]]
13692 [[#Space-Entity&#32;between&#32;Text]]
13693 [[#Plus+between+Text]]
13694 [[#Plus-Entity&#43;between&#43;Text]]
13695 [[#Underscore_between_Text]]
13696 [[#Underscore-Entity&#95;between&#95;Text]]
13697 !! html
13698 <p>Id should not contain + for spaces
13699 </p>
13700 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13701 <ul>
13702 <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>
13703 <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>
13704 <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>
13705 <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>
13706 <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>
13707 <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>
13708 </ul>
13709 </div>
13710
13711 <h2><a href="#Space_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13712 <p>section 1
13713 </p>
13714 <h2><a href="#Space-Entity_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13715 <p>section 2
13716 </p>
13717 <h2><a href="#Plus.2Bbetween.2BText" class="mw-headline-anchor" title="Link to this section">§</a><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>
13718 <p>section 3
13719 </p>
13720 <h2><a href="#Plus-Entity.2Bbetween.2BText" class="mw-headline-anchor" title="Link to this section">§</a><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>
13721 <p>section 4
13722 </p>
13723 <h2><a href="#Underscore_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13724 <p>section 5
13725 </p>
13726 <h2><a href="#Underscore-Entity_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><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>
13727 <p>section 6
13728 </p><p><a href="#Space_between_Text">#Space between Text</a>
13729 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13730 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13731 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13732 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13733 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13734 </p>
13735 !! end
13736
13737 !! test
13738 Headers with excess '=' characters
13739 (Are similar tests necessary beyond the 1st level?)
13740 !! wikitext
13741 =foo==
13742 ==foo=
13743 =''italic'' heading==
13744 ==''italic'' heading=
13745 !! html
13746 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13747 <ul>
13748 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13749 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13750 <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>
13751 <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>
13752 </ul>
13753 </div>
13754
13755 <h1><a href="#foo.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
13756 <h1><a href="#.3Dfoo" class="mw-headline-anchor" title="Link to this section">§</a><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>
13757 <h1><a href="#italic_heading.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
13758 <h1><a href="#.3Ditalic_heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
13759
13760 !! end
13761
13762 !! test
13763 HTML headers vs TOC (bug 23393)
13764 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13765 !! wikitext
13766 <h1>Header 1</h1>
13767 == Header 1.1 ==
13768 == Header 1.2 ==
13769
13770 <h1>Header 2
13771 </h1>
13772 == Header 2.1 ==
13773 == Header 2.2 ==
13774 __NOEDITSECTION__
13775 !! html
13776 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13777 <ul>
13778 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13779 <ul>
13780 <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>
13781 <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>
13782 </ul>
13783 </li>
13784 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13785 <ul>
13786 <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>
13787 <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>
13788 </ul>
13789 </li>
13790 </ul>
13791 </div>
13792
13793 <h1><a href="#Header_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_1">Header 1</span></h1>
13794 <h2><a href="#Header_1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13795 <h2><a href="#Header_1.2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13796 <h1><a href="#Header_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_2">Header 2</span></h1>
13797 <h2><a href="#Header_2.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13798 <h2><a href="#Header_2.2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13799
13800 !! end
13801
13802 !! test
13803 Single-line or multiline-comments can follow headings
13804 !! options
13805 parsoid=wt2html,wt2wt
13806 !! wikitext
13807 ==foo==<!---->
13808 ==bar==<!--c1-->
13809 ==baz==<!--
13810 c2
13811 c3-->
13812 !! html
13813 <h2><a href="#foo" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="foo">foo</span></h2>
13814 <h2><a href="#bar" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="bar">bar</span></h2>
13815 <h2><a href="#baz" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="baz">baz</span></h2>
13816
13817 !! end
13818
13819 !! test
13820 BUG 1219 URL next to image (broken)
13821 !! wikitext
13822 http://example.com[[File:Foobar.jpg]]
13823 !! html/php
13824 <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>
13825 </p>
13826 !! html/parsoid
13827 <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" height="220" width="1941"/></a></span></p>
13828 !!end
13829
13830 !! test
13831 Bug 1186 news: in the middle of text
13832 !! wikitext
13833 http://en.wikinews.org/wiki/Wikinews:Workplace
13834 !! html
13835 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13836 </p>
13837 !!end
13838
13839
13840 !! test
13841 Namespaced link must have a title
13842 !! wikitext
13843 [[Project:]]
13844 !! html
13845 <p>[[Project:]]
13846 </p>
13847 !!end
13848
13849 !! test
13850 Namespaced link must have a title (bad fragment version)
13851 !! wikitext
13852 [[Project:#fragment]]
13853 !! html
13854 <p>[[Project:#fragment]]
13855 </p>
13856 !!end
13857
13858
13859 ###
13860 ### HTML tags and HTML attributes
13861 ###
13862
13863 !! test
13864 div with no attributes
13865 !! wikitext
13866 <div>HTML rocks</div>
13867 !! html
13868 <div>HTML rocks</div>
13869
13870 !! end
13871
13872 !! test
13873 div with double-quoted attribute
13874 !! wikitext
13875 <div id="rock">HTML rocks</div>
13876 !! html
13877 <div id="rock">HTML rocks</div>
13878
13879 !! end
13880
13881 !! test
13882 div with single-quoted attribute
13883 !! wikitext
13884 <div id='rock'>HTML rocks</div>
13885 !! html
13886 <div id="rock">HTML rocks</div>
13887
13888 !! end
13889
13890 !! test
13891 div with unquoted attribute
13892 !! wikitext
13893 <div id=rock>HTML rocks</div>
13894 !! html
13895 <div id="rock">HTML rocks</div>
13896
13897 !! end
13898
13899 !! test
13900 div with illegal double attributes
13901 !! wikitext
13902 <div id="a" id="b">HTML rocks</div>
13903 !! html
13904 <div id="b">HTML rocks</div>
13905
13906 !!end
13907
13908 # FIXME: produce empty string instead of "class" in the PHP parser, following
13909 # the HTML5 spec.
13910 !! test
13911 div with empty attribute value, space before equals
13912 !! options
13913 parsoid
13914 !! wikitext
13915 <div class =>HTML rocks</div>
13916 !! html
13917 <div class="">HTML rocks</div>
13918
13919 !! end
13920
13921 !! test
13922 div with multiple empty attribute values
13923 !! options
13924 parsoid
13925 !! wikitext
13926 <div id= title=>HTML rocks</div>
13927 !! html
13928 <div id="" title="">HTML rocks</div>
13929
13930 !! end
13931
13932 !! test
13933 table with multiple empty attribute values
13934 !! options
13935 parsoid
13936 !! wikitext
13937 {| title= id=
13938 | hi
13939 |}
13940 !! html
13941 <table title="" id="">
13942 <tbody><tr><td> hi</td></tr>
13943 </tbody></table>
13944 !! end
13945
13946 !! test
13947 div with braces in attribute value
13948 !! wikitext
13949 <div title="{}">Foo</div>
13950 !! html/php
13951 <div title="&#123;}">Foo</div>
13952
13953 !! html/parsoid
13954 <div title="{}">Foo</div>
13955 !! end
13956
13957 # This it very inconsistent in the PHP parser: it returns
13958 # class="class" if there is a space between the name and the equal sign (see
13959 # 'div with empty attribute value, space before equals'), but strips the
13960 # attribute completely if the space is missing. We hope that not much content
13961 # depends on this, so are implementing the behavior below in Parsoid for
13962 # consistencies' sake.
13963 # FIXME: fix this behavior in the PHP parser?
13964 !! test
13965 div with empty attribute value, no space before equals
13966 !! options
13967 parsoid=wt2html,html2html
13968 !! wikitext
13969 <div class=>HTML rocks</div>
13970 !! html/php
13971 <div>HTML rocks</div>
13972
13973 !! html/parsoid
13974 <div class="">HTML rocks</div>
13975 !! end
13976
13977 !! test
13978 HTML multiple attributes correction
13979 !! wikitext
13980 <p class="error" class="awesome">Awesome!</p>
13981 !! html
13982 <p class="awesome">Awesome!</p>
13983
13984 !!end
13985
13986 !! test
13987 Table multiple attributes correction
13988 !! wikitext
13989 {|
13990 !+ class="error" class="awesome"| status
13991 |}
13992 !! html
13993 <table>
13994 <tr>
13995 <th class="awesome"> status
13996 </th></tr></table>
13997
13998 !!end
13999
14000 !! test
14001 DIV IN UPPERCASE
14002 !! wikitext
14003 <DIV ID="x">HTML ROCKS</DIV>
14004 !! html
14005 <div id="x">HTML ROCKS</div>
14006
14007 !!end
14008
14009 !! test
14010 Non-ASCII pseudo-tags are rendered as text
14011 !! wikitext
14012 <khyô>
14013 !! html
14014 <p>&lt;khyô&gt;
14015 </p>
14016 !! end
14017
14018 !! test
14019 Pseudo-tag with URL 'name' renders as url link
14020 !! wikitext
14021 <http://example.com/>
14022 !! html
14023 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14024 </p>
14025 !! end
14026
14027 !! test
14028 text with amp in the middle of nowhere
14029 !! wikitext
14030 Remember AT&T?
14031 !! html
14032 <p>Remember AT&amp;T?
14033 </p>
14034 !! end
14035
14036 !! test
14037 text with character entity: eacute
14038 !! wikitext
14039 I always thought &eacute; was a cute letter.
14040 !! html
14041 <p>I always thought &#233; was a cute letter.
14042 </p>
14043 !! html+tidy
14044 <p>I always thought é was a cute letter.</p>
14045 !! end
14046
14047 !! test
14048 text with entity-escaped character entity-like string: eacute
14049 !! wikitext
14050 I always thought &amp;eacute; was a cute letter.
14051 !! html
14052 <p>I always thought &amp;eacute; was a cute letter.
14053 </p>
14054 !! end
14055
14056 !! test
14057 text with undefined character entity: xacute
14058 !! wikitext
14059 I always thought &xacute; was a cute letter.
14060 !! html
14061 <p>I always thought &amp;xacute; was a cute letter.
14062 </p>
14063 !! end
14064
14065 # TODO: generalize to PHP parser?
14066 !! test
14067 HTML5 tags
14068 !! options
14069 parsoid
14070 !! wikitext
14071 <data value="5">five</data>
14072 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14073 <mark>This highlighted text</mark>
14074 !! html
14075 <p><data value="5">five</data>
14076 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14077 <mark>This highlighted text</mark></p>
14078 !! end
14079
14080 !! test
14081 HTML tag with leading space is parsed as text
14082 !! wikitext
14083 < div>foo< /div>
14084 !! html
14085 <p>&lt; div&gt;foo&lt; /div&gt;
14086 </p>
14087 !! end
14088
14089 ###
14090 ### Nesting tests (see bug 41545, 50604, 51081)
14091 ###
14092
14093 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14094 # Note that html2wt is considerably more difficult if we use <b> in
14095 # the test case, instead of <big>
14096 !! test
14097 Ensure that HTML adoption agency algorithm is properly implemented.
14098 !! wikitext
14099 <big>X<big>Y</big>Z</big>
14100 !! html
14101 <p><big>X<big>Y</big>Z</big>
14102 </p>
14103 !! end
14104
14105 # This was bug 41545 in the PHP parser.
14106 # Note that tidy doesn't handle this correctly.
14107 !! test
14108 Nesting of <kbd>
14109 !! wikitext
14110 <kbd>X<kbd>Y</kbd>Z</kbd>
14111 !! html
14112 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14113 </p>
14114 !! end
14115
14116 # The following cases were bug 51081 in the PHP parser.
14117 # Note that there are some other nestable tags (b, i, etc) which are
14118 # not covered; see bug 51081 for discussion.
14119
14120 # Note that tidy doesn't handle this correctly.
14121 !! test
14122 Nesting of <em>
14123 !! wikitext
14124 <em>X<em>Y</em>Z</em>
14125 !! html
14126 <p><em>X<em>Y</em>Z</em>
14127 </p>
14128 !! end
14129
14130 # Note that tidy doesn't handle this correctly.
14131 !! test
14132 Nesting of <strong>
14133 !! wikitext
14134 <strong>X<strong>Y</strong>Z</strong>
14135 !! html
14136 <p><strong>X<strong>Y</strong>Z</strong>
14137 </p>
14138 !! end
14139
14140 !! test
14141 Nesting of <q>
14142 !! wikitext
14143 <q>X<q>Y</q>Z</q>
14144 !! html+tidy
14145 <p><q>X<q>Y</q>Z</q></p>
14146 !! end
14147
14148 # Note that tidy doesn't handle this correctly.
14149 !! test
14150 Nesting of <ruby>
14151 !! wikitext
14152 <ruby>X<ruby>Y</ruby>Z</ruby>
14153 !! html
14154 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14155 </p>
14156 !! end
14157
14158 # Note that tidy doesn't handle this correctly.
14159 !! test
14160 Nesting of <bdo>
14161 !! wikitext
14162 <bdo>X<bdo>Y</bdo>Z</bdo>
14163 !! html
14164 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14165 </p>
14166 !! end
14167
14168
14169 ###
14170 ### Media links
14171 ###
14172
14173 !! test
14174 Media link
14175 !! wikitext
14176 [[Media:Foobar.jpg]]
14177 !! html
14178 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14179 </p>
14180 !! end
14181
14182 !! test
14183 Media link with text
14184 !! wikitext
14185 [[Media:Foobar.jpg|A neat file to look at]]
14186 !! html
14187 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14188 </p>
14189 !! end
14190
14191 # FIXME: this is still bad HTML tag nesting
14192 !! test
14193 Media link with nasty text
14194 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
14195 !! wikitext
14196 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14197 !! html
14198 <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>
14199
14200 !! html+tidy
14201 <p><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></p>
14202 !! end
14203
14204 !! test
14205 Media link to nonexistent file (bug 1702)
14206 !! wikitext
14207 [[Media:No such.jpg]]
14208 !! html
14209 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14210 </p>
14211 !! end
14212
14213 !! test
14214 Image link to nonexistent file (bug 1850 - good)
14215 !! wikitext
14216 [[File:No_such.jpg]]
14217 !! html/php
14218 <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>
14219 </p>
14220 !! html/parsoid
14221 <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>
14222 !! end
14223
14224 !! test
14225 :Image link to nonexistent file (bug 1850 - bad)
14226 !! wikitext
14227 [[:Image:No such.jpg]]
14228 !! html/php
14229 <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>
14230 </p>
14231 !! html/parsoid
14232 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14233 !! end
14234
14235
14236
14237 !! test
14238 Character reference normalization in link text (bug 1938)
14239 !! wikitext
14240 [[Main Page|this&that]]
14241 !! html
14242 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14243 </p>
14244 !!end
14245
14246 !! article
14247 אַ
14248 !! text
14249 Test for unicode normalization
14250
14251 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14252 !! endarticle
14253
14254 !! test
14255 (bug 19451) Links should refer to the normalized form.
14256 !! wikitext
14257 [[&#xFB2E;]]
14258 [[&#x5d0;&#x5b7;]]
14259 [[&#x5d0;ַ]]
14260 [[א&#x5b7;]]
14261 [[אַ]]
14262 !! html
14263 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14264 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14265 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14266 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14267 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14268 </p>
14269 !! end
14270
14271 !! test
14272 Empty attribute crash test (bug 2067)
14273 !! wikitext
14274 <font color="">foo</font>
14275 !! html
14276 <p><font color="">foo</font>
14277 </p>
14278 !! end
14279
14280 !! test
14281 Empty attribute crash test single-quotes (bug 2067)
14282 !! wikitext
14283 <font color=''>foo</font>
14284 !! html
14285 <p><font color="">foo</font>
14286 </p>
14287 !! end
14288
14289 !! test
14290 Attribute test: equals, then nothing
14291 !! wikitext
14292 <font color=>foo</font>
14293 !! html
14294 <p><font>foo</font>
14295 </p>
14296 !! end
14297
14298 !! test
14299 Attribute test: unquoted value
14300 !! wikitext
14301 <font color=x>foo</font>
14302 !! html
14303 <p><font color="x">foo</font>
14304 </p>
14305 !! end
14306
14307 !! test
14308 Attribute test: unquoted but illegal value (hash)
14309 !! wikitext
14310 <font color=#x>foo</font>
14311 !! html
14312 <p><font color="#x">foo</font>
14313 </p>
14314 !! end
14315
14316 !! test
14317 Attribute test: no value
14318 !! wikitext
14319 <font color>foo</font>
14320 !! html
14321 <p><font color="color">foo</font>
14322 </p>
14323 !! end
14324
14325 !! test
14326 Bug 2095: link with three closing brackets
14327 !! wikitext
14328 [[Main Page]]]
14329 !! html/php
14330 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14331 </p>
14332 !! html/parsoid
14333 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14334 !! end
14335
14336 !! test
14337 Bug 2095: link with pipe and three closing brackets
14338 !! wikitext
14339 [[Main Page|link]]]
14340 !! html/php
14341 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14342 </p>
14343 !! html/parsoid
14344 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14345 !! end
14346
14347 !! test
14348 Bug 2095: link with pipe and three closing brackets, version 2
14349 !! wikitext
14350 [[Main Page|[http://example.com/]]]
14351 !! html/php
14352 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14353 </p>
14354 !! html/parsoid
14355 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14356 !! end
14357
14358
14359 ###
14360 ### Safety
14361 ###
14362
14363 !! article
14364 Template:Dangerous attribute
14365 !! text
14366 " onmouseover="alert(document.cookie)
14367 !! endarticle
14368
14369 !! article
14370 Template:Dangerous style attribute
14371 !! text
14372 border-size: expression(alert(document.cookie))
14373 !! endarticle
14374
14375 !! article
14376 Template:Div style
14377 !! text
14378 <div style="float: right; {{{1}}}">Magic div</div>
14379 !! endarticle
14380
14381 !! test
14382 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14383 !! wikitext
14384 <div title="{{test}}"></div>
14385 !! html
14386 <div title="This is a test template"></div>
14387
14388 !! end
14389
14390 # Parsoid has enough context to handle this case
14391 !! test
14392 Bug 2304: HTML attribute safety (dangerous template; 2309)
14393 !! wikitext
14394 <div title="{{dangerous attribute}}"></div>
14395 !! html/php
14396 <div title=""></div>
14397
14398 !! html/parsoid
14399 <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=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
14400 !! end
14401
14402 !! test
14403 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14404 !! wikitext
14405 <div style="{{dangerous style attribute}}"></div>
14406 !! html
14407 <div style="/* insecure input */"></div>
14408
14409 !! end
14410
14411 !! test
14412 Bug 2304: HTML attribute safety (safe parameter; 2309)
14413 !! wikitext
14414 {{div style|width: 200px}}
14415 !! html
14416 <div style="float: right; width: 200px">Magic div</div>
14417
14418 !! end
14419
14420 !! test
14421 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14422 !! wikitext
14423 {{div style|width: expression(alert(document.cookie))}}
14424 !! html
14425 <div style="/* insecure input */">Magic div</div>
14426
14427 !! end
14428
14429 !! test
14430 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14431 !! wikitext
14432 {{div style|"><script>alert(document.cookie)</script>}}
14433 !! html
14434 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14435
14436 !! end
14437
14438 !! test
14439 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14440 !! wikitext
14441 {{div style|" ><script>alert(document.cookie)</script>}}
14442 !! html
14443 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14444
14445 !! end
14446
14447 !! test
14448 Bug 2304: HTML attribute safety (link)
14449 !! wikitext
14450 <div title="[[Main Page]]"></div>
14451 !! html
14452 <div title="&#91;&#91;Main Page]]"></div>
14453
14454 !! end
14455
14456 !! test
14457 Bug 2304: HTML attribute safety (italics)
14458 !! wikitext
14459 <div title="''foobar''"></div>
14460 !! html
14461 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14462
14463 !! end
14464
14465 !! test
14466 Bug 2304: HTML attribute safety (bold)
14467 !! wikitext
14468 <div title="'''foobar'''"></div>
14469 !! html
14470 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14471
14472 !! end
14473
14474
14475 !! test
14476 Bug 2304: HTML attribute safety (ISBN)
14477 !! wikitext
14478 <div title="ISBN 1234567890"></div>
14479 !! html
14480 <div title="&#73;SBN 1234567890"></div>
14481
14482 !! end
14483
14484 !! test
14485 Bug 2304: HTML attribute safety (RFC)
14486 !! wikitext
14487 <div title="RFC 1234"></div>
14488 !! html
14489 <div title="&#82;FC 1234"></div>
14490
14491 !! end
14492
14493 !! test
14494 Bug 2304: HTML attribute safety (PMID)
14495 !! wikitext
14496 <div title="PMID 1234567890"></div>
14497 !! html
14498 <div title="&#80;MID 1234567890"></div>
14499
14500 !! end
14501
14502 !! test
14503 Bug 2304: HTML attribute safety (web link)
14504 !! wikitext
14505 <div title="http://example.com/"></div>
14506 !! html
14507 <div title="http&#58;//example.com/"></div>
14508
14509 !! end
14510
14511 !! test
14512 Bug 2304: HTML attribute safety (named web link)
14513 !! wikitext
14514 <div title="[http://example.com/ link]"></div>
14515 !! html
14516 <div title="&#91;http&#58;//example.com/ link]"></div>
14517
14518 !! end
14519
14520 !! test
14521 Bug 3244: HTML attribute safety (extension; safe)
14522 !! wikitext
14523 <div style="<nowiki>background:blue</nowiki>"></div>
14524 !! html
14525 <div style="background:blue"></div>
14526
14527 !! end
14528
14529 !! test
14530 Bug 3244: HTML attribute safety (extension; unsafe)
14531 !! wikitext
14532 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14533 !! html
14534 <div style="/* insecure input */"></div>
14535
14536 !! end
14537
14538 # More MSIE fun discovered by Tom Gilder
14539
14540 !! test
14541 MSIE CSS safety test: spurious slash
14542 !! wikitext
14543 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14544 !! html
14545 <div style="/* insecure input */">evil</div>
14546
14547 !! end
14548
14549 !! test
14550 MSIE CSS safety test: hex code
14551 !! wikitext
14552 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14553 !! html
14554 <div style="/* insecure input */">evil</div>
14555
14556 !! end
14557
14558 !! test
14559 MSIE CSS safety test: comment in url
14560 !! wikitext
14561 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14562 !! html
14563 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14564
14565 !! end
14566
14567 !! test
14568 MSIE CSS safety test: comment in expression
14569 !! wikitext
14570 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14571 !! html
14572 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14573
14574 !! end
14575
14576 !! test
14577 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14578 !! wikitext
14579 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14580 !! html
14581 <p style="/* invalid control char */">A</p>
14582
14583 !! end
14584
14585 !! test
14586 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14587 !! wikitext
14588 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14589 <div style="top:EXPRESSION(alert())">B</div>
14590 !! html
14591 <p style="/* insecure input */">A</p>
14592 <div style="/* insecure input */">B</div>
14593
14594 !! end
14595
14596 !! test
14597 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14598 !! wikitext
14599 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14600 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14601 !! html
14602 <div style="/* insecure input */">A</div>
14603 <p style="/* insecure input */">B</p>
14604
14605 !! end
14606
14607 !! test
14608 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14609 !! wikitext
14610 <div style="background-image:url⁽javascript:alert())">A</div>
14611 <div style="background-image:url₍javascript:alert())">B</div>
14612 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14613 !! html
14614 <div style="/* insecure input */">A</div>
14615 <div style="/* insecure input */">B</div>
14616 <p style="/* insecure input */">C</p>
14617
14618 !! end
14619
14620 !! test
14621 Opera -o-link CSS
14622 !! wikitext
14623 <div
14624 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;"
14625 style="-o-link:attr(title);-o-link-source:current">X</div>
14626 !! html
14627 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14628
14629 !! end
14630
14631 !! test
14632 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14633 !! wikitext
14634 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14635 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14636 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14637 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14638 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14639 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14640 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14641 !! html
14642 <p style="/* insecure input */">A</p>
14643 <p style="/* insecure input */">B</p>
14644 <p style="/* insecure input */">C</p>
14645 <p style="/* insecure input */">D</p>
14646 <p style="/* insecure input */">E</p>
14647 <p style="/* insecure input */">F</p>
14648 <p style="/* insecure input */">G</p>
14649
14650 !! end
14651
14652 !! test
14653 Table attribute legitimate extension
14654 !! wikitext
14655 {|
14656 !+ style="<nowiki>color:blue</nowiki>"| status
14657 |}
14658 !! html
14659 <table>
14660 <tr>
14661 <th style="color:blue"> status
14662 </th></tr></table>
14663
14664 !!end
14665
14666 !! test
14667 Table attribute safety
14668 !! wikitext
14669 {|
14670 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14671 |}
14672 !! html
14673 <table>
14674 <tr>
14675 <th style="/* insecure input */"> status
14676 </th></tr></table>
14677
14678 !! end
14679
14680 !! test
14681 CSS line continuation 1
14682 !! wikitext
14683 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14684 !! html
14685 <div style="/* insecure input */"></div>
14686
14687 !! end
14688
14689 !! test
14690 CSS line continuation 2
14691 !! wikitext
14692 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14693 !! html
14694 <div style="/* insecure input */"></div>
14695
14696 !! end
14697
14698 !! article
14699 Template:Identity
14700 !! text
14701 {{{1}}}
14702 !! endarticle
14703
14704 !! test
14705 Expansion of multi-line templates in attribute values (bug 6255)
14706 !! wikitext
14707 <div style="background: {{identity|#00FF00}}">-</div>
14708 !! html
14709 <div style="background: #00FF00">-</div>
14710
14711 !! end
14712
14713
14714 !! test
14715 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14716 !! wikitext
14717 <div style="background:
14718 #00FF00">-</div>
14719 !! html/php
14720 <div style="background: #00FF00">-</div>
14721
14722 !! html/parsoid
14723 <div style="background:
14724 #00FF00">-</div>
14725 !! end
14726
14727 !! test
14728 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14729 !! wikitext
14730 <div style="background: &#10;#00FF00">-</div>
14731 !! html
14732 <div style="background: &#10;#00FF00">-</div>
14733
14734 !! end
14735
14736 !! test
14737 evil <math>-wiki-tags without Extension:Math enabled
14738 !! wikitext
14739 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14740 !! html+tidy
14741 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
14742 !! end
14743
14744 ###
14745 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14746 ###
14747 !! test
14748 Parser hook: empty input
14749 !! wikitext
14750 <tag></tag>
14751 !! html
14752 <pre>
14753 ''
14754 array (
14755 )
14756 </pre>
14757
14758 !! end
14759
14760 !! test
14761 Parser hook: empty input using terminated empty elements
14762 !! wikitext
14763 <tag/>
14764 !! html
14765 <pre>
14766 NULL
14767 array (
14768 )
14769 </pre>
14770
14771 !! end
14772
14773 !! test
14774 Parser hook: empty input using terminated empty elements (space before)
14775 !! wikitext
14776 <tag />
14777 !! html
14778 <pre>
14779 NULL
14780 array (
14781 )
14782 </pre>
14783
14784 !! end
14785
14786 !! test
14787 Parser hook: basic input
14788 !! wikitext
14789 <tag>input</tag>
14790 !! html
14791 <pre>
14792 'input'
14793 array (
14794 )
14795 </pre>
14796
14797 !! end
14798
14799
14800 !! test
14801 Parser hook: case insensitive
14802 !! wikitext
14803 <TAG>input</TAG>
14804 !! html
14805 <pre>
14806 'input'
14807 array (
14808 )
14809 </pre>
14810
14811 !! end
14812
14813
14814 !! test
14815 Parser hook: case insensitive, redux
14816 !! wikitext
14817 <TaG>input</TAg>
14818 !! html
14819 <pre>
14820 'input'
14821 array (
14822 )
14823 </pre>
14824
14825 !! end
14826
14827 !! test
14828 Parser hook: nested tags
14829 !! options
14830 noxml
14831 !! wikitext
14832 <tag><tag></tag></tag>
14833 !! html
14834 <pre>
14835 '<tag>'
14836 array (
14837 )
14838 </pre>&lt;/tag&gt;
14839
14840 !! end
14841
14842 !! test
14843 Parser hook: basic arguments
14844 !! wikitext
14845 <tag width=200 height = "100" depth = '50' square></tag>
14846 !! html
14847 <pre>
14848 ''
14849 array (
14850 'width' => '200',
14851 'height' => '100',
14852 'depth' => '50',
14853 'square' => 'square',
14854 )
14855 </pre>
14856
14857 !! end
14858
14859 !! test
14860 Parser hook: argument containing a forward slash (bug 5344)
14861 !! wikitext
14862 <tag filename='/tmp/bla'></tag>
14863 !! html
14864 <pre>
14865 ''
14866 array (
14867 'filename' => '/tmp/bla',
14868 )
14869 </pre>
14870
14871 !! end
14872
14873 !! test
14874 Parser hook: empty input using terminated empty elements (bug 2374)
14875 !! wikitext
14876 <tag foo=bar/>text
14877 !! html
14878 <pre>
14879 NULL
14880 array (
14881 'foo' => 'bar',
14882 )
14883 </pre>text
14884
14885 !! end
14886
14887 # </tag> should be output literally since there is no matching tag that begins it
14888 !! test
14889 Parser hook: basic arguments using terminated empty elements (bug 2374)
14890 !! wikitext
14891 <tag width=200 height = "100" depth = '50' square/>
14892 other stuff
14893 </tag>
14894 !! html
14895 <pre>
14896 NULL
14897 array (
14898 'width' => '200',
14899 'height' => '100',
14900 'depth' => '50',
14901 'square' => 'square',
14902 )
14903 </pre>
14904 <p>other stuff
14905 &lt;/tag&gt;
14906 </p>
14907 !! end
14908
14909 ###
14910 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14911 ###
14912
14913 !! test
14914 Parser hook: static parser hook not inside a comment
14915 !! wikitext
14916 <statictag>hello, world</statictag>
14917 <statictag action=flush/>
14918 !! html
14919 <p>hello, world
14920 </p>
14921 !! end
14922
14923
14924 !! test
14925 Parser hook: static parser hook inside a comment
14926 !! wikitext
14927 <!-- <statictag>hello, world</statictag> -->
14928 <statictag action=flush/>
14929 !! html
14930 <p><br />
14931 </p>
14932 !! end
14933
14934 # Nested template calls; this case was broken by Parser.php rev 1.506,
14935 # since reverted.
14936
14937 !! article
14938 Template:One-parameter
14939 !! text
14940 (My parameter is: {{{1}}})
14941 !! endarticle
14942
14943 !! article
14944 Template:Map-one-parameter
14945 !! text
14946 {{{{{1}}}|{{{2}}}}}
14947 !! endarticle
14948
14949 !! test
14950 Nested template calls
14951 !! wikitext
14952 {{Map-one-parameter|One-parameter|param}}
14953 !! html
14954 <p>(My parameter is: param)
14955 </p>
14956 !! end
14957
14958
14959 ###
14960 ### Sanitizer
14961 ###
14962
14963 # HTML+Tidy effectively strips out the empty tags completely
14964 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14965 # which Tidy would have done for the PHP parser had there been content inside it.
14966 !! test
14967 Sanitizer: Closing of open tags
14968 !! wikitext
14969 <s></s><table></table>
14970 !! html
14971 <s></s><table></table>
14972
14973 !! html/parsoid
14974 <p><s></s></p><table></table>
14975 !! end
14976
14977 !! test
14978 Sanitizer: Closing of open but not closed tags
14979 !! wikitext
14980 <s>foo
14981 !! html
14982 <p><s>foo</s>
14983 </p>
14984 !! end
14985
14986 !! test
14987 Sanitizer: Closing of closed but not open tags
14988 !! wikitext
14989 </s>
14990 !! html
14991 <p>&lt;/s&gt;
14992 </p>
14993 !! end
14994
14995 !! test
14996 Sanitizer: Closing of closed but not open table tags
14997 !! wikitext
14998 Table not started</td></tr></table>
14999 !! html
15000 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15001 </p>
15002 !! end
15003
15004 !! test
15005 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15006 !! wikitext
15007 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15008 !! html
15009 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15010 </p>
15011 !! end
15012
15013 # In HTML5, the restrictions are that id must contain at least one character,
15014 # and must not contain any space characters.
15015 !! test
15016 Sanitizer: Validating the contents of the id attribute (bug 4515)
15017 !! options
15018 disabled
15019 !! wikitext
15020 <br id="" /><br id="a space" />
15021 !! html
15022 Something ...
15023 !! end
15024
15025 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15026 !! test
15027 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15028 !! options
15029 disabled
15030 !! wikitext
15031 <br id="foo" /><br id="foo" />
15032 !! html
15033 Something need to be done. foo-2 ?
15034 !! end
15035
15036 !! test
15037 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15038 !! wikitext
15039 <div itemscope>
15040 <meta itemprop="hello" content="world">
15041 <meta http-equiv="refresh" content="5">
15042 <meta itemprop="hello" http-equiv="refresh" content="5">
15043 <link itemprop="hello" href="{{SERVER}}">
15044 <link rel="stylesheet" href="{{SERVER}}">
15045 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15046 </div>
15047 !! html
15048 <div itemscope="itemscope">
15049 <p> <meta itemprop="hello" content="world" />
15050 &lt;meta http-equiv="refresh" content="5"&gt;
15051 <meta itemprop="hello" content="5" />
15052 </p>
15053 <link itemprop="hello" href="http&#58;//example.org" />
15054 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15055 <link itemprop="hello" href="http&#58;//example.org" />
15056 </div>
15057
15058 !! end
15059
15060 !! test
15061 Language converter: output gets cut off unexpectedly (bug 5757)
15062 !! options
15063 language=zh
15064 !! wikitext
15065 this bit is safe: }-
15066
15067 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15068
15069 then we get cut off here: }-
15070
15071 all additional text is vanished
15072 !! html
15073 <p>this bit is safe: }-
15074 </p><p>but if we add a conversion instance: xxx
15075 </p><p>then we get cut off here: }-
15076 </p><p>all additional text is vanished
15077 </p>
15078 !! end
15079
15080 !! test
15081 Self closed html pairs (bug 5487)
15082 !! options
15083 !! wikitext
15084 <center><font id="bug" />Centered text</center>
15085 <div><font id="bug2" />In div text</div>
15086 !! html
15087 <center>&lt;font id="bug" /&gt;Centered text</center>
15088 <div>&lt;font id="bug2" /&gt;In div text</div>
15089
15090 !! end
15091
15092 #
15093 #
15094 #
15095
15096 !! test
15097 Punctuation: nbsp before exclamation
15098 !! wikitext
15099 C'est grave !
15100 !! html
15101 <p>C'est grave&#160;!
15102 </p>
15103 !! end
15104
15105 !! test
15106 Punctuation: CSS !important (bug 11874)
15107 !! wikitext
15108 <div style="width:50% !important">important</div>
15109 !! html
15110 <div style="width:50% !important">important</div>
15111
15112 !!end
15113
15114 !! test
15115 Punctuation: CSS ! important (bug 11874; with space after)
15116 !! wikitext
15117 <div style="width:50% ! important">important</div>
15118 !! html
15119 <div style="width:50% ! important">important</div>
15120
15121 !!end
15122
15123 !! test
15124 HTML bullet list, closed tags (bug 5497)
15125 !! wikitext
15126 <ul>
15127 <li>One</li>
15128 <li>Two</li>
15129 </ul>
15130 !! html/php
15131 <ul>
15132 <li>One</li>
15133 <li>Two</li>
15134 </ul>
15135
15136 !! html/parsoid
15137 <ul data-parsoid='{"stx":"html"}'>
15138 <li data-parsoid='{"stx":"html"}'>One</li>
15139 <li data-parsoid='{"stx":"html"}'>Two</li>
15140 </ul>
15141
15142 !! end
15143
15144 !! test
15145 HTML bullet list, unclosed tags (bug 5497)
15146 !! wikitext
15147 <ul>
15148 <li>One
15149 <li>Two
15150 </ul>
15151 !! html/php+tidy
15152 <ul>
15153 <li>One</li>
15154 <li>Two</li>
15155 </ul>
15156 !! html/parsoid
15157 <ul data-parsoid='{"stx":"html"}'>
15158 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15159 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15160 </ul>
15161
15162 !! end
15163
15164 !! test
15165 HTML ordered list, closed tags (bug 5497)
15166 !! wikitext
15167 <ol>
15168 <li>One</li>
15169 <li>Two</li>
15170 </ol>
15171 !! html/php
15172 <ol>
15173 <li>One</li>
15174 <li>Two</li>
15175 </ol>
15176
15177 !! html/parsoid
15178 <ol data-parsoid='{"stx":"html"}'>
15179 <li data-parsoid='{"stx":"html"}'>One</li>
15180 <li data-parsoid='{"stx":"html"}'>Two</li>
15181 </ol>
15182
15183 !! end
15184
15185 !! test
15186 HTML ordered list, unclosed tags (bug 5497)
15187 !! options
15188 !! wikitext
15189 <ol>
15190 <li>One
15191 <li>Two
15192 </ol>
15193 !! html/php+tidy
15194 <ol>
15195 <li>One</li>
15196 <li>Two</li>
15197 </ol>
15198 !! html/parsoid
15199 <ol data-parsoid='{"stx":"html"}'>
15200 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15201 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15202 </ol>
15203
15204 !! end
15205
15206 !! test
15207 HTML nested bullet list, closed tags (bug 5497)
15208 !! wikitext
15209 <ul>
15210 <li>One</li>
15211 <li>Two:
15212 <ul>
15213 <li>Sub-one</li>
15214 <li>Sub-two</li>
15215 </ul>
15216 </li>
15217 </ul>
15218 !! html
15219 <ul>
15220 <li>One</li>
15221 <li>Two:
15222 <ul>
15223 <li>Sub-one</li>
15224 <li>Sub-two</li>
15225 </ul>
15226 </li>
15227 </ul>
15228
15229 !! end
15230
15231 !! test
15232 HTML nested bullet list, open tags (bug 5497)
15233 !! wikitext
15234 <ul>
15235 <li>One
15236 <li>Two:
15237 <ul>
15238 <li>Sub-one
15239 <li>Sub-two
15240 </ul>
15241 </ul>
15242 !! html/php+tidy
15243 <ul>
15244 <li>One</li>
15245 <li>Two:
15246 <ul>
15247 <li>Sub-one</li>
15248 <li>Sub-two</li>
15249 </ul>
15250 </li>
15251 </ul>
15252 !! html/parsoid
15253 <ul>
15254 <li>One
15255 </li>
15256 <li>Two:
15257 <ul>
15258 <li>Sub-one
15259 </li>
15260 <li>Sub-two
15261 </li>
15262 </ul>
15263 </li>
15264 </ul>
15265
15266 !! end
15267
15268 !! test
15269 HTML nested ordered list, closed tags (bug 5497)
15270 !! wikitext
15271 <ol>
15272 <li>One</li>
15273 <li>Two:
15274 <ol>
15275 <li>Sub-one</li>
15276 <li>Sub-two</li>
15277 </ol>
15278 </li>
15279 </ol>
15280 !! html
15281 <ol>
15282 <li>One</li>
15283 <li>Two:
15284 <ol>
15285 <li>Sub-one</li>
15286 <li>Sub-two</li>
15287 </ol>
15288 </li>
15289 </ol>
15290
15291 !! end
15292
15293 !! test
15294 HTML nested ordered list, open tags (bug 5497)
15295 !! wikitext
15296 <ol>
15297 <li>One
15298 <li>Two:
15299 <ol>
15300 <li>Sub-one
15301 <li>Sub-two
15302 </ol>
15303 </ol>
15304 !! html/php
15305 <ol>
15306 <li>One
15307 <li>Two:
15308 <ol>
15309 <li>Sub-one
15310 <li>Sub-two
15311 </ol>
15312 </ol>
15313
15314 !! html/parsoid
15315 <ol>
15316 <li>One
15317 </li>
15318 <li>Two:
15319 <ol>
15320 <li>Sub-one
15321 </li>
15322 <li>Sub-two
15323 </li>
15324 </ol>
15325 </li>
15326 </ol>
15327
15328 !! end
15329
15330 !! test
15331 HTML ordered list item with parameters oddity
15332 !! wikitext
15333 <ol><li id="fragment">One</li>
15334 </ol>
15335 !! html
15336 <ol><li id="fragment">One</li>
15337 </ol>
15338
15339 !! end
15340
15341 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15342 !!test
15343 bug 5918: autonumbering
15344 !! wikitext
15345 [http://first/] [http://second] [ftp://ftp]
15346
15347 ftp://inlineftp
15348
15349 [mailto:enclosed@mail.tld With target]
15350
15351 [mailto:enclosed@mail.tld]
15352
15353 mailto:inline@mail.tld
15354 !! html/php
15355 <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>
15356 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15357 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15358 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15359 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15360 </p>
15361 !! html/parsoid
15362 <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>
15363 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15364 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15365 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15366 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15367 !! end
15368
15369
15370 #
15371 # Security and HTML correctness
15372 # From Nick Jenkins' fuzz testing
15373 #
15374
15375 !! test
15376 Fuzz testing: Parser13
15377 !! wikitext
15378 {|
15379 | http://a|
15380 !! html
15381 <table>
15382 <tr>
15383 <td>
15384 </td>
15385 </tr>
15386 </table>
15387
15388 !! end
15389
15390 !! test
15391 Fuzz testing: Parser14
15392 !! wikitext
15393 == onmouseover= ==
15394 http://__TOC__
15395 !! html
15396 <h2><a href="#onmouseover.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
15397 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15398 <ul>
15399 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15400 </ul>
15401 </div>
15402
15403
15404 !! html+tidy
15405 <h2><a href="#onmouseover.3D" class="mw-headline-anchor" title="Link to this section">§</a><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>
15406 <p>http://</p>
15407 <div id="toc" class="toc">
15408 <div id="toctitle">
15409 <h2>Contents</h2>
15410 </div>
15411 <ul>
15412 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15413 </ul>
15414 </div>
15415 !! end
15416
15417 !! test
15418 Fuzz testing: Parser14-table
15419 !! wikitext
15420 ==a==
15421 {| STYLE=__TOC__
15422 !! html
15423 <h2><a href="#a" class="mw-headline-anchor" title="Link to this section">§</a><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>
15424 <table style="&#95;_TOC&#95;_">
15425 <tr><td></td></tr>
15426 </table>
15427
15428 !! html+tidy
15429 <h2><a href="#a" class="mw-headline-anchor" title="Link to this section">§</a><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>
15430 <table style="__TOC__">
15431 <tr>
15432 <td></td>
15433 </tr>
15434 </table>
15435 !! end
15436
15437 # Known to produce bogus xml (extra </td>)
15438 !! test
15439 Fuzz testing: Parser16
15440 !! options
15441 noxml
15442 !! wikitext
15443 {|
15444 !https://||||||
15445 !! html
15446 <table>
15447 <tr>
15448 <th>https://</th>
15449 <th></th>
15450 <th></th>
15451 <th>
15452 </td>
15453 </tr>
15454 </table>
15455
15456 !! html+tidy
15457 <table>
15458 <tr>
15459 <th>https://</th>
15460 <th></th>
15461 <th></th>
15462 <th></th>
15463 </tr>
15464 </table>
15465 !! end
15466
15467 !! test
15468 Fuzz testing: Parser21
15469 !! wikitext
15470 {|
15471 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15472 |
15473 !! html
15474 <table>
15475 <tr>
15476 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15477 </th>
15478 <td>
15479 </td>
15480 </tr>
15481 </table>
15482
15483 !! end
15484
15485 !! test
15486 Fuzz testing: Parser22
15487 !! wikitext
15488 http://===r:::https://b
15489
15490 {|
15491 !! html
15492 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15493 </p>
15494 <table>
15495 <tr><td></td></tr>
15496 </table>
15497
15498 !! end
15499
15500 # Known to produce bad XML for now
15501 !! test
15502 Fuzz testing: Parser24
15503 !! options
15504 noxml
15505 !! wikitext
15506 {|
15507 {{{|
15508 <u CLASS=
15509 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15510 <br style="onmouseover='alert(document.cookie);' " />
15511
15512 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15513 |
15514 !! html
15515 <table>
15516 {{{|
15517 <u class="&#124;">}}}} &gt;
15518 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15519
15520 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15521 <tr>
15522 <td></u>
15523 </td>
15524 </tr>
15525 </table>
15526
15527 !! end
15528
15529 # Note: the current result listed for this is not what the original one was,
15530 # but the original bug was JavaScript injection, which is fixed in any case.
15531 # It's not clear that the original result listed was any more correct than the
15532 # current one. Original result:
15533 # <p>{{{|
15534 # </p>
15535 # <li class="&#124;&#124;">
15536 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15537 !!test
15538 Fuzz testing: Parser25 (bug 6055)
15539 !! wikitext
15540 {{{
15541 |
15542 <LI CLASS=||
15543 >
15544 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15545 !! html
15546 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15547 </p>
15548 !! end
15549
15550 !!test
15551 Fuzz testing: URL adjacent extension (with space, clean)
15552 !! wikitext
15553 http://example.com <nowiki>junk</nowiki>
15554 !! html/php
15555 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15556 </p>
15557 !! html/parsoid
15558 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15559 !! end
15560
15561 !!test
15562 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15563 !! wikitext
15564 http://example.com<nowiki>junk</nowiki>
15565 !! html/php
15566 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15567 </p>
15568 !! html/parsoid
15569 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15570 !! end
15571
15572 !!test
15573 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15574 !! wikitext
15575 http://example.com<pre>junk</pre>
15576 !! html/php
15577 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15578
15579 !! html/php+tidy
15580 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15581 <pre>
15582 junk
15583 </pre>
15584 !! html/parsoid
15585 <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>
15586 !!end
15587
15588 !!test
15589 Fuzz testing: image with bogus manual thumbnail
15590 !! wikitext
15591 [[Image:foobar.jpg|thumbnail= ]]
15592 !! html/php
15593 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15594
15595 !! html/parsoid
15596 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' 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":{},"dsr":[2,30,null,null]}'><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>
15597 !!end
15598
15599 !! test
15600 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15601 !! wikitext
15602 <pre dir="&#10;"></pre>
15603 !! html
15604 <pre dir="&#10;"></pre>
15605
15606 !! end
15607
15608 !! test
15609 Parsing optional HTML elements (Bug 6171)
15610 !! options
15611 !! wikitext
15612 <table>
15613 <tr>
15614 <td> Some tabular data</td>
15615 <td> More tabular data ...
15616 <td> And yet som tabular data</td>
15617 </tr>
15618 </table>
15619 !! html
15620 <table>
15621 <tr>
15622 <td> Some tabular data</td>
15623 <td> More tabular data ...
15624 </td><td> And yet som tabular data</td>
15625 </tr>
15626 </table>
15627
15628 !! end
15629
15630 !! test
15631 Correct handling of <td>, <tr> (Bug 6171)
15632 !! options
15633 !! wikitext
15634 <table>
15635 <tr>
15636 <td> Some tabular data</td>
15637 <td> More tabular data ...</td>
15638 <td> And yet som tabular data</td>
15639 </tr>
15640 </table>
15641 !! html
15642 <table>
15643 <tr>
15644 <td> Some tabular data</td>
15645 <td> More tabular data ...</td>
15646 <td> And yet som tabular data</td>
15647 </tr>
15648 </table>
15649
15650 !! end
15651
15652
15653 !! test
15654 Parsing crashing regression (fr:JavaScript)
15655 !! wikitext
15656 </body></x>
15657 !! html
15658 <p>&lt;/body&gt;&lt;/x&gt;
15659 </p>
15660 !! end
15661
15662 !! test
15663 Inline wiki vs wiki block nesting
15664 !! wikitext
15665 '''Bold paragraph
15666
15667 New wiki paragraph
15668 !! html
15669 <p><b>Bold paragraph</b>
15670 </p><p>New wiki paragraph
15671 </p>
15672 !! end
15673
15674 # FIXME: The current php output is documented
15675 # and desired output is the parsoid target.
15676 !! test
15677 Inline HTML vs wiki block nesting
15678 !! wikitext
15679 <b>Bold paragraph
15680
15681 New wiki paragraph
15682 !! html/php
15683 <p><b>Bold paragraph
15684 </p><p>New wiki paragraph</b>
15685 </p>
15686 !! html/parsoid
15687 <p><b>Bold paragraph</b>
15688 </p><p>New wiki paragraph
15689 </p>
15690 !! end
15691
15692 # Original result was this:
15693 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15694 # </p>
15695 # While that might be marginally more intuitive, maybe, the six-apostrophe
15696 # construct is clearly pathological and the result stated here (which is what
15697 # the parser actually does) is about as reasonable as anything.
15698 !!test
15699 Mixing markup for italics and bold
15700 !! options
15701 !! wikitext
15702 '''bold''''''bold''bolditalics'''''
15703 !! html
15704 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15705 </p>
15706 !! end
15707
15708
15709 !! article
15710 Xyzzyx
15711 !! text
15712 Article for special page transclusion test
15713 !! endarticle
15714
15715 !! test
15716 Special page transclusion
15717 !! options
15718 !! wikitext
15719 {{Special:Prefixindex/Xyzzyx}}
15720 !! html
15721 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15722
15723 !! end
15724
15725 !! test
15726 Special page transclusion twice (bug 5021)
15727 !! options
15728 !! wikitext
15729 {{Special:Prefixindex/Xyzzyx}}
15730 {{Special:Prefixindex/Xyzzyx}}
15731 !! html
15732 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15733 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15734
15735 !! end
15736
15737 !! test
15738 Transclusion of default MediaWiki message
15739 !! wikitext
15740 {{MediaWiki:Mainpage}}
15741 !! html
15742 <p>Main Page
15743 </p>
15744 !! end
15745
15746 !! test
15747 Transclusion of nonexistent MediaWiki message
15748 !! wikitext
15749 {{MediaWiki:Mainpagexxx}}
15750 !! html
15751 <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>
15752 </p>
15753 !! end
15754
15755 !! test
15756 Transclusion of MediaWiki message with underscore
15757 !! wikitext
15758 {{MediaWiki:history_short}}
15759 !! html
15760 <p>History
15761 </p>
15762 !! end
15763
15764 !! test
15765 Transclusion of MediaWiki message with space
15766 !! wikitext
15767 {{MediaWiki:history short}}
15768 !! html
15769 <p>History
15770 </p>
15771 !! end
15772
15773 !! test
15774 Invalid header with following text
15775 !! wikitext
15776 = x = y
15777 !! html
15778 <p>= x = y
15779 </p>
15780 !! end
15781
15782
15783 !! test
15784 Section extraction test (section 0)
15785 !! options
15786 section=0
15787 !! wikitext
15788 start
15789 ==a==
15790 ===aa===
15791 ====aaa====
15792 ==b==
15793 ===ba===
15794 ===bb===
15795 ====bba====
15796 ===bc===
15797 ==c==
15798 ===ca===
15799 !! html
15800 start
15801 !! end
15802
15803 !! test
15804 Section extraction test (section 1)
15805 !! options
15806 section=1
15807 !! wikitext
15808 start
15809 ==a==
15810 ===aa===
15811 ====aaa====
15812 ==b==
15813 ===ba===
15814 ===bb===
15815 ====bba====
15816 ===bc===
15817 ==c==
15818 ===ca===
15819 !! html
15820 ==a==
15821 ===aa===
15822 ====aaa====
15823 !! end
15824
15825 !! test
15826 Section extraction test (section 2)
15827 !! options
15828 section=2
15829 !! wikitext
15830 start
15831 ==a==
15832 ===aa===
15833 ====aaa====
15834 ==b==
15835 ===ba===
15836 ===bb===
15837 ====bba====
15838 ===bc===
15839 ==c==
15840 ===ca===
15841 !! html
15842 ===aa===
15843 ====aaa====
15844 !! end
15845
15846 !! test
15847 Section extraction test (section 3)
15848 !! options
15849 section=3
15850 !! wikitext
15851 start
15852 ==a==
15853 ===aa===
15854 ====aaa====
15855 ==b==
15856 ===ba===
15857 ===bb===
15858 ====bba====
15859 ===bc===
15860 ==c==
15861 ===ca===
15862 !! html
15863 ====aaa====
15864 !! end
15865
15866 !! test
15867 Section extraction test (section 4)
15868 !! options
15869 section=4
15870 !! wikitext
15871 start
15872 ==a==
15873 ===aa===
15874 ====aaa====
15875 ==b==
15876 ===ba===
15877 ===bb===
15878 ====bba====
15879 ===bc===
15880 ==c==
15881 ===ca===
15882 !! html
15883 ==b==
15884 ===ba===
15885 ===bb===
15886 ====bba====
15887 ===bc===
15888 !! end
15889
15890 !! test
15891 Section extraction test (section 5)
15892 !! options
15893 section=5
15894 !! wikitext
15895 start
15896 ==a==
15897 ===aa===
15898 ====aaa====
15899 ==b==
15900 ===ba===
15901 ===bb===
15902 ====bba====
15903 ===bc===
15904 ==c==
15905 ===ca===
15906 !! html
15907 ===ba===
15908 !! end
15909
15910 !! test
15911 Section extraction test (section 6)
15912 !! options
15913 section=6
15914 !! wikitext
15915 start
15916 ==a==
15917 ===aa===
15918 ====aaa====
15919 ==b==
15920 ===ba===
15921 ===bb===
15922 ====bba====
15923 ===bc===
15924 ==c==
15925 ===ca===
15926 !! html
15927 ===bb===
15928 ====bba====
15929 !! end
15930
15931 !! test
15932 Section extraction test (section 7)
15933 !! options
15934 section=7
15935 !! wikitext
15936 start
15937 ==a==
15938 ===aa===
15939 ====aaa====
15940 ==b==
15941 ===ba===
15942 ===bb===
15943 ====bba====
15944 ===bc===
15945 ==c==
15946 ===ca===
15947 !! html
15948 ====bba====
15949 !! end
15950
15951 !! test
15952 Section extraction test (section 8)
15953 !! options
15954 section=8
15955 !! wikitext
15956 start
15957 ==a==
15958 ===aa===
15959 ====aaa====
15960 ==b==
15961 ===ba===
15962 ===bb===
15963 ====bba====
15964 ===bc===
15965 ==c==
15966 ===ca===
15967 !! html
15968 ===bc===
15969 !! end
15970
15971 !! test
15972 Section extraction test (section 9)
15973 !! options
15974 section=9
15975 !! wikitext
15976 start
15977 ==a==
15978 ===aa===
15979 ====aaa====
15980 ==b==
15981 ===ba===
15982 ===bb===
15983 ====bba====
15984 ===bc===
15985 ==c==
15986 ===ca===
15987 !! html
15988 ==c==
15989 ===ca===
15990 !! end
15991
15992 !! test
15993 Section extraction test (section 10)
15994 !! options
15995 section=10
15996 !! wikitext
15997 start
15998 ==a==
15999 ===aa===
16000 ====aaa====
16001 ==b==
16002 ===ba===
16003 ===bb===
16004 ====bba====
16005 ===bc===
16006 ==c==
16007 ===ca===
16008 !! html
16009 ===ca===
16010 !! end
16011
16012 !! test
16013 Section extraction test (nonexistent section 11)
16014 !! options
16015 section=11
16016 !! wikitext
16017 start
16018 ==a==
16019 ===aa===
16020 ====aaa====
16021 ==b==
16022 ===ba===
16023 ===bb===
16024 ====bba====
16025 ===bc===
16026 ==c==
16027 ===ca===
16028 !! html
16029 !! end
16030
16031 !! test
16032 Section extraction test with bogus heading (section 1)
16033 !! options
16034 section=1
16035 !! wikitext
16036 ==a==
16037 ==bogus== not a legal section
16038 ==b==
16039 !! html
16040 ==a==
16041 ==bogus== not a legal section
16042 !! end
16043
16044 !! test
16045 Section extraction test with bogus heading (section 2)
16046 !! options
16047 section=2
16048 !! wikitext
16049 ==a==
16050 ==bogus== not a legal section
16051 ==b==
16052 !! html
16053 ==b==
16054 !! end
16055
16056 !! test
16057 Section extraction test with comment after heading (section 1)
16058 !! options
16059 section=1
16060 !! wikitext
16061 ==a==
16062 ==b== <!-- -->
16063 ==c==
16064 !! html
16065 ==a==
16066 !! end
16067
16068 !! test
16069 Section extraction test with comment after heading (section 2)
16070 !! options
16071 section=2
16072 !! wikitext
16073 ==a==
16074 ==b== <!-- -->
16075 ==c==
16076 !! html
16077 ==b== <!-- -->
16078 !! end
16079
16080 !! test
16081 Section extraction test with bogus <nowiki> heading (section 1)
16082 !! options
16083 section=1
16084 !! wikitext
16085 ==a==
16086 ==bogus== <nowiki>not a legal section</nowiki>
16087 ==b==
16088 !! html
16089 ==a==
16090 ==bogus== <nowiki>not a legal section</nowiki>
16091 !! end
16092
16093 !! test
16094 Section extraction test with bogus <nowiki> heading (section 2)
16095 !! options
16096 section=2
16097 !! wikitext
16098 ==a==
16099 ==bogus== <nowiki>not a legal section</nowiki>
16100 ==b==
16101 !! html
16102 ==b==
16103 !! end
16104
16105
16106 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16107 # instead of respecting commented sections
16108 !! test
16109 Section extraction prefixed by comment (section 1)
16110 !! options
16111 section=1
16112 !! wikitext
16113 <!-- -->==sec1==
16114 ==sec2==
16115 !! html
16116 ==sec2==
16117 !!end
16118
16119 !! test
16120 Section extraction prefixed by comment (section 2)
16121 !! options
16122 section=2
16123 !! wikitext
16124 <!-- -->==sec1==
16125 ==sec2==
16126 !! html
16127
16128 !!end
16129
16130
16131 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16132 # instead of respecting HTML-style headings
16133 !! test
16134 Section extraction, mixed wiki and html (section 1)
16135 !! options
16136 section=1
16137 !! wikitext
16138 <h2>unmarked</h2>
16139 unmarked
16140 ==1==
16141 one
16142 ==2==
16143 two
16144 !! html
16145 ==1==
16146 one
16147 !! end
16148
16149 !! test
16150 Section extraction, mixed wiki and html (section 2)
16151 !! options
16152 section=2
16153 !! wikitext
16154 <h2>unmarked</h2>
16155 unmarked
16156 ==1==
16157 one
16158 ==2==
16159 two
16160 !! html
16161 ==2==
16162 two
16163 !! end
16164
16165
16166 # Formerly testing for bug 3342
16167 !! test
16168 Section extraction, heading surrounded by <noinclude>
16169 !! options
16170 section=1
16171 !! wikitext
16172 <noinclude>==unmarked==</noinclude>
16173 ==marked==
16174 !! html
16175 ==marked==
16176 !!end
16177
16178 # Test behavior of bug 19910
16179 !! test
16180 Sectiion with all-equals
16181 !! options
16182 section=2
16183 !! wikitext
16184 ===
16185 The line above must have a trailing space
16186 === <!--
16187 --> <!-- -->
16188 But just in case it doesn't...
16189 !! html
16190 === <!--
16191 --> <!-- -->
16192 But just in case it doesn't...
16193 !! end
16194
16195 !! test
16196 Section replacement test (section 0)
16197 !! options
16198 replace=0,"xxx"
16199 !! wikitext
16200 start
16201 ==a==
16202 ===aa===
16203 ====aaa====
16204 ==b==
16205 ===ba===
16206 ===bb===
16207 ====bba====
16208 ===bc===
16209 ==c==
16210 ===ca===
16211 !! html
16212 xxx
16213
16214 ==a==
16215 ===aa===
16216 ====aaa====
16217 ==b==
16218 ===ba===
16219 ===bb===
16220 ====bba====
16221 ===bc===
16222 ==c==
16223 ===ca===
16224 !! end
16225
16226 !! test
16227 Section replacement test (section 1)
16228 !! options
16229 replace=1,"xxx"
16230 !! wikitext
16231 start
16232 ==a==
16233 ===aa===
16234 ====aaa====
16235 ==b==
16236 ===ba===
16237 ===bb===
16238 ====bba====
16239 ===bc===
16240 ==c==
16241 ===ca===
16242 !! html
16243 start
16244 xxx
16245
16246 ==b==
16247 ===ba===
16248 ===bb===
16249 ====bba====
16250 ===bc===
16251 ==c==
16252 ===ca===
16253 !! end
16254
16255 !! test
16256 Section replacement test (section 2)
16257 !! options
16258 replace=2,"xxx"
16259 !! wikitext
16260 start
16261 ==a==
16262 ===aa===
16263 ====aaa====
16264 ==b==
16265 ===ba===
16266 ===bb===
16267 ====bba====
16268 ===bc===
16269 ==c==
16270 ===ca===
16271 !! html
16272 start
16273 ==a==
16274 xxx
16275
16276 ==b==
16277 ===ba===
16278 ===bb===
16279 ====bba====
16280 ===bc===
16281 ==c==
16282 ===ca===
16283 !! end
16284
16285 !! test
16286 Section replacement test (section 3)
16287 !! options
16288 replace=3,"xxx"
16289 !! wikitext
16290 start
16291 ==a==
16292 ===aa===
16293 ====aaa====
16294 ==b==
16295 ===ba===
16296 ===bb===
16297 ====bba====
16298 ===bc===
16299 ==c==
16300 ===ca===
16301 !! html
16302 start
16303 ==a==
16304 ===aa===
16305 xxx
16306
16307 ==b==
16308 ===ba===
16309 ===bb===
16310 ====bba====
16311 ===bc===
16312 ==c==
16313 ===ca===
16314 !! end
16315
16316 !! test
16317 Section replacement test (section 4)
16318 !! options
16319 replace=4,"xxx"
16320 !! wikitext
16321 start
16322 ==a==
16323 ===aa===
16324 ====aaa====
16325 ==b==
16326 ===ba===
16327 ===bb===
16328 ====bba====
16329 ===bc===
16330 ==c==
16331 ===ca===
16332 !! html
16333 start
16334 ==a==
16335 ===aa===
16336 ====aaa====
16337 xxx
16338
16339 ==c==
16340 ===ca===
16341 !! end
16342
16343 !! test
16344 Section replacement test (section 5)
16345 !! options
16346 replace=5,"xxx"
16347 !! wikitext
16348 start
16349 ==a==
16350 ===aa===
16351 ====aaa====
16352 ==b==
16353 ===ba===
16354 ===bb===
16355 ====bba====
16356 ===bc===
16357 ==c==
16358 ===ca===
16359 !! html
16360 start
16361 ==a==
16362 ===aa===
16363 ====aaa====
16364 ==b==
16365 xxx
16366
16367 ===bb===
16368 ====bba====
16369 ===bc===
16370 ==c==
16371 ===ca===
16372 !! end
16373
16374 !! test
16375 Section replacement test (section 6)
16376 !! options
16377 replace=6,"xxx"
16378 !! wikitext
16379 start
16380 ==a==
16381 ===aa===
16382 ====aaa====
16383 ==b==
16384 ===ba===
16385 ===bb===
16386 ====bba====
16387 ===bc===
16388 ==c==
16389 ===ca===
16390 !! html
16391 start
16392 ==a==
16393 ===aa===
16394 ====aaa====
16395 ==b==
16396 ===ba===
16397 xxx
16398
16399 ===bc===
16400 ==c==
16401 ===ca===
16402 !! end
16403
16404 !! test
16405 Section replacement test (section 7)
16406 !! options
16407 replace=7,"xxx"
16408 !! wikitext
16409 start
16410 ==a==
16411 ===aa===
16412 ====aaa====
16413 ==b==
16414 ===ba===
16415 ===bb===
16416 ====bba====
16417 ===bc===
16418 ==c==
16419 ===ca===
16420 !! html
16421 start
16422 ==a==
16423 ===aa===
16424 ====aaa====
16425 ==b==
16426 ===ba===
16427 ===bb===
16428 xxx
16429
16430 ===bc===
16431 ==c==
16432 ===ca===
16433 !! end
16434
16435 !! test
16436 Section replacement test (section 8)
16437 !! options
16438 replace=8,"xxx"
16439 !! wikitext
16440 start
16441 ==a==
16442 ===aa===
16443 ====aaa====
16444 ==b==
16445 ===ba===
16446 ===bb===
16447 ====bba====
16448 ===bc===
16449 ==c==
16450 ===ca===
16451 !! html
16452 start
16453 ==a==
16454 ===aa===
16455 ====aaa====
16456 ==b==
16457 ===ba===
16458 ===bb===
16459 ====bba====
16460 xxx
16461
16462 ==c==
16463 ===ca===
16464 !!end
16465
16466 !! test
16467 Section replacement test (section 9)
16468 !! options
16469 replace=9,"xxx"
16470 !! wikitext
16471 start
16472 ==a==
16473 ===aa===
16474 ====aaa====
16475 ==b==
16476 ===ba===
16477 ===bb===
16478 ====bba====
16479 ===bc===
16480 ==c==
16481 ===ca===
16482 !! html
16483 start
16484 ==a==
16485 ===aa===
16486 ====aaa====
16487 ==b==
16488 ===ba===
16489 ===bb===
16490 ====bba====
16491 ===bc===
16492 xxx
16493 !! end
16494
16495 !! test
16496 Section replacement test (section 10)
16497 !! options
16498 replace=10,"xxx"
16499 !! wikitext
16500 start
16501 ==a==
16502 ===aa===
16503 ====aaa====
16504 ==b==
16505 ===ba===
16506 ===bb===
16507 ====bba====
16508 ===bc===
16509 ==c==
16510 ===ca===
16511 !! html
16512 start
16513 ==a==
16514 ===aa===
16515 ====aaa====
16516 ==b==
16517 ===ba===
16518 ===bb===
16519 ====bba====
16520 ===bc===
16521 ==c==
16522 xxx
16523 !! end
16524
16525 !! test
16526 Section replacement test with initial whitespace (bug 13728)
16527 !! options
16528 replace=2,"xxx"
16529 !! wikitext
16530 Preformatted initial line
16531 ==a==
16532 ===a===
16533 !! html
16534 Preformatted initial line
16535 ==a==
16536 xxx
16537 !! end
16538
16539
16540 !! test
16541 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16542 !! options
16543 section=1
16544 !! wikitext
16545 ==a==
16546 a
16547 !! html
16548 ==a==
16549 a
16550 !! end
16551
16552 !! test
16553 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16554 !! options
16555 section=1
16556 !! wikitext
16557 ==a==
16558 a
16559 !! html
16560 ==a==
16561 a
16562 !! end
16563
16564
16565 !! test
16566 Section extraction, <pre> around bogus header (bug 10309)
16567 !! options
16568 noxml section=2
16569 !! wikitext
16570 == Section One ==
16571 <pre>
16572 =======
16573 </pre>
16574
16575 == Section Two ==
16576 stuff
16577 !! html
16578 == Section Two ==
16579 stuff
16580 !! end
16581
16582 !! test
16583 Section replacement, <pre> around bogus header (bug 10309)
16584 !! options
16585 noxml replace=2,"xxx"
16586 !! wikitext
16587 == Section One ==
16588 <pre>
16589 =======
16590 </pre>
16591
16592 == Section Two ==
16593 stuff
16594 !! html
16595 == Section One ==
16596 <pre>
16597 =======
16598 </pre>
16599
16600 xxx
16601 !! end
16602
16603
16604
16605 !! test
16606 Handling of &#x0A; in URLs
16607 !! wikitext
16608 ** irc://&#x0A;a
16609 !! html/php
16610 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16611
16612 !! html/parsoid
16613 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16614 a">irc://
16615 a</a></li></ul></li></ul>
16616 !! end
16617
16618 !! test
16619 Handling of %0A in URLs
16620 !! wikitext
16621 ** irc://%0Aa
16622 !! html/php
16623 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16624
16625 !! html/parsoid
16626 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16627 !! end
16628
16629
16630 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16631 !! test
16632 5 quotes, code coverage +1 line
16633 !! options
16634 parsoid=wt2html
16635 !! wikitext
16636 '''''
16637 !! html/php
16638 !! html/parsoid
16639 <p><b><i></i></b></p>
16640 !! end
16641
16642 # same html as previous, but wikitext adjusted to match parsoid html2wt
16643 # note that wt2html and html2html will put the <i> before the <b>
16644 !! test
16645 5 quotes, code coverage +1 line w/ nowiki (1)
16646 !! options
16647 parsoid=wt2wt,html2wt
16648 !! wikitext
16649 '''''<nowiki/>'''''
16650 !! html/php
16651 <p><i></i>
16652 </p>
16653 !! html/parsoid
16654 <p><b><i></i></b></p>
16655 !! end
16656
16657 # same as previous, just swapping the <i> and <b>
16658 !! test
16659 5 quotes, code coverage +1 line w/ nowiki (2)
16660 !! wikitext
16661 '''''<nowiki/>'''''
16662 !! html/php
16663 <p><i></i>
16664 </p>
16665 !! html/parsoid
16666 <p><i><b></b></i></p>
16667 !! end
16668
16669 !! test
16670 Special:Search page linking.
16671 !! wikitext
16672 {{Special:search}}
16673 !! html
16674 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16675 </p>
16676 !! end
16677
16678 !! test
16679 {{!}} is a magic word
16680 !! wikitext
16681 {{!}} is a magic word there and {{!}} is still a magic word here
16682 !! html/php
16683 <p>| is a magic word there and | is still a magic word here
16684 </p>
16685 !! html/parsoid
16686 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
16687 !! end
16688
16689 !! test
16690 Say the magic word
16691 !! options
16692 title=[[Parser test]]
16693 !! wikitext
16694 * {{PAGENAME}}
16695 * {{PAGENAMEE}}
16696 * {{FULLPAGENAME}}
16697 * {{FULLPAGENAMEE}}
16698 * {{BASEPAGENAME}}
16699 * {{BASEPAGENAMEE}}
16700 * {{SUBPAGENAME}}
16701 * {{SUBPAGENAMEE}}
16702 * {{ROOTPAGENAME}}
16703 * {{ROOTPAGENAMEE}}
16704 * {{TALKPAGENAME}}
16705 * {{TALKPAGENAMEE}}
16706 * {{SUBJECTPAGENAME}}
16707 * {{SUBJECTPAGENAMEE}}
16708 * {{NAMESPACEE}}
16709 * {{NAMESPACE}}
16710 * {{NAMESPACENUMBER}}
16711 * {{TALKSPACE}}
16712 * {{TALKSPACEE}}
16713 * {{SUBJECTSPACE}}
16714 * {{SUBJECTSPACEE}}
16715 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16716 !! html
16717 <ul><li> Parser test</li>
16718 <li> Parser_test</li>
16719 <li> Parser test</li>
16720 <li> Parser_test</li>
16721 <li> Parser test</li>
16722 <li> Parser_test</li>
16723 <li> Parser test</li>
16724 <li> Parser_test</li>
16725 <li> Parser test</li>
16726 <li> Parser_test</li>
16727 <li> Talk:Parser test</li>
16728 <li> Talk:Parser_test</li>
16729 <li> Parser test</li>
16730 <li> Parser_test</li>
16731 <li> </li>
16732 <li> </li>
16733 <li> 0</li>
16734 <li> Talk</li>
16735 <li> Talk</li>
16736 <li> </li>
16737 <li> </li>
16738 <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>
16739
16740 !! end
16741 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16742
16743 !! test
16744 Gallery
16745 !! wikitext
16746 <gallery>
16747 image1.png |
16748 image2.gif|||||
16749
16750 image3|
16751 image4 |300px| centre
16752 image5.svg| http://///////
16753 [[x|xx]]]]
16754 * image6
16755 </gallery>
16756 !! html
16757 <ul class="gallery mw-gallery-traditional">
16758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16759 <div class="thumb" style="height: 150px;">Image1.png</div>
16760 <div class="gallerytext">
16761 </div>
16762 </div></li>
16763 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16764 <div class="thumb" style="height: 150px;">Image2.gif</div>
16765 <div class="gallerytext">
16766 <p>||||
16767 </p>
16768 </div>
16769 </div></li>
16770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16771 <div class="thumb" style="height: 150px;">Image3</div>
16772 <div class="gallerytext">
16773 </div>
16774 </div></li>
16775 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16776 <div class="thumb" style="height: 150px;">Image4</div>
16777 <div class="gallerytext">
16778 <p>300px| centre
16779 </p>
16780 </div>
16781 </div></li>
16782 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16783 <div class="thumb" style="height: 150px;">Image5.svg</div>
16784 <div class="gallerytext">
16785 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16786 </p>
16787 </div>
16788 </div></li>
16789 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16790 <div class="thumb" style="height: 150px;">* image6</div>
16791 <div class="gallerytext">
16792 </div>
16793 </div></li>
16794 </ul>
16795
16796 !! end
16797
16798 !! test
16799 Gallery (with options)
16800 !! wikitext
16801 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16802 File:Nonexistent.jpg|caption
16803 File:Nonexistent.jpg
16804 image:foobar.jpg|some '''caption''' [[Main Page]]
16805 image:foobar.jpg
16806 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16807 </gallery>
16808 !! html
16809 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16810 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16811 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16812 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16813 <div class="gallerytext">
16814 <p>caption
16815 </p>
16816 </div>
16817 </div></li>
16818 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16819 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16820 <div class="gallerytext">
16821 </div>
16822 </div></li>
16823 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16824 <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>
16825 <div class="gallerytext">
16826 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16827 </p>
16828 </div>
16829 </div></li>
16830 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16831 <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>
16832 <div class="gallerytext">
16833 </div>
16834 </div></li>
16835 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16836 <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>
16837 <div class="gallerytext">
16838 <p>Blabla|blabla.
16839 </p>
16840 </div>
16841 </div></li>
16842 </ul>
16843
16844 !! end
16845
16846 !! test
16847 Gallery with link that has fragment
16848 !! wikitext
16849 <gallery>
16850 image:foobar.jpg|link=Main_Page
16851 image:foobar.jpg|link=Main_Page#section
16852 image:foobar.jpg|link=Main Page#section|caption
16853 </gallery>
16854 !! html
16855 <ul class="gallery mw-gallery-traditional">
16856 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16857 <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>
16858 <div class="gallerytext">
16859 </div>
16860 </div></li>
16861 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16862 <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>
16863 <div class="gallerytext">
16864 </div>
16865 </div></li>
16866 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16867 <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>
16868 <div class="gallerytext">
16869 <p>caption
16870 </p>
16871 </div>
16872 </div></li>
16873 </ul>
16874
16875 !! end
16876
16877 !! test
16878 Gallery with wikitext inside caption
16879 !! wikitext
16880 <gallery>
16881 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16882 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16883 </gallery>
16884 !! html
16885 <ul class="gallery mw-gallery-traditional">
16886 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16887 <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>
16888 <div class="gallerytext">
16889 <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>
16890 </p>
16891 </div>
16892 </div></li>
16893 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16894 <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>
16895 <div class="gallerytext">
16896 <p>This is a test template
16897 </p>
16898 </div>
16899 </div></li>
16900 </ul>
16901
16902 !! end
16903
16904 !! test
16905 gallery (with showfilename option)
16906 !! wikitext
16907 <gallery showfilename>
16908 File:Nonexistent.jpg|caption
16909 File:Nonexistent.jpg
16910 image:foobar.jpg|some '''caption''' [[Main Page]]
16911 File:Foobar.jpg
16912 </gallery>
16913 !! html
16914 <ul class="gallery mw-gallery-traditional">
16915 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16916 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16917 <div class="gallerytext">
16918 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16919 caption
16920 </p>
16921 </div>
16922 </div></li>
16923 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16924 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16925 <div class="gallerytext">
16926 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16927 </p>
16928 </div>
16929 </div></li>
16930 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16931 <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>
16932 <div class="gallerytext">
16933 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16934 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16935 </p>
16936 </div>
16937 </div></li>
16938 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16939 <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>
16940 <div class="gallerytext">
16941 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16942 </p>
16943 </div>
16944 </div></li>
16945 </ul>
16946
16947 !! end
16948
16949 !! test
16950 Gallery (with namespace-less filenames)
16951 !! wikitext
16952 <gallery>
16953 File:Nonexistent.jpg
16954 Nonexistent.jpg
16955 image:foobar.jpg
16956 foobar.jpg
16957 </gallery>
16958 !! html
16959 <ul class="gallery mw-gallery-traditional">
16960 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16961 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16962 <div class="gallerytext">
16963 </div>
16964 </div></li>
16965 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16966 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16967 <div class="gallerytext">
16968 </div>
16969 </div></li>
16970 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16971 <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>
16972 <div class="gallerytext">
16973 </div>
16974 </div></li>
16975 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16976 <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>
16977 <div class="gallerytext">
16978 </div>
16979 </div></li>
16980 </ul>
16981
16982 !! end
16983
16984 !! test
16985 HTML Hex character encoding (spells the word "JavaScript")
16986 !! options
16987 parsoid=wt2html,wt2wt,html2html
16988 !! wikitext
16989 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16990 !! html/php
16991 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16992 </p>
16993 !! html/php+tidy
16994 <p>JavaScript</p>
16995 !! html/parsoid
16996 <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>
16997 !! end
16998
16999 !! test
17000 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17001 !! wikitext
17002 &#xsee;&#XSEE;
17003 !! html/php
17004 <p>&amp;#xsee;&amp;#XSEE;
17005 </p>
17006 !! html/parsoid
17007 <p>&amp;#xsee;&amp;#XSEE;</p>
17008 !! end
17009
17010 !! test
17011 HTML Hex character encoding mixed case
17012 !! options
17013 parsoid=wt2html,wt2wt,html2html
17014 !! wikitext
17015 &#xEE;&#Xee;
17016 !! html/php
17017 <p>&#xee;&#xee;
17018 </p>
17019 !! html/php+tidy
17020 <p>îî</p>
17021 !! html/parsoid
17022 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17023 !! end
17024
17025 !! test
17026 __FORCETOC__ override
17027 !! wikitext
17028 __NEWSECTIONLINK__
17029 __FORCETOC__
17030 !! html
17031 <p><br />
17032 </p>
17033 !! end
17034
17035 !! test
17036 ISBN code coverage
17037 !! wikitext
17038 ISBN 978-0-1234-56&#x20;789
17039 !! html
17040 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17041 </p>
17042 !! html+tidy
17043 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17044 !! html/parsoid
17045 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
17046 !! end
17047
17048 !! test
17049 ISBN followed by 5 spaces
17050 !! wikitext
17051 ISBN
17052 !! html
17053 <p>ISBN
17054 </p>
17055 !! end
17056
17057 !! test
17058 Double ISBN
17059 !! wikitext
17060 ISBN ISBN 1234567890
17061 !! html/php
17062 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17063 </p>
17064 !! html/parsoid
17065 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17066 !! end
17067
17068 !! test
17069 ISBN with an X
17070 !! wikitext
17071 ISBN 3-462-04561-X
17072 ISBN 080442957X
17073 ISBN 978080442957X
17074 !! html/php
17075 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17076 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17077 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17078 </p>
17079 !! html/parsoid
17080 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17081 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17082 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17083 !! end
17084
17085 !! test
17086 ISBN with empty prefix (parsoid test)
17087 !! wikitext
17088 ISBN 1234567890
17089 !! html/php
17090 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17091 </p>
17092 !! html/parsoid
17093 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17094 !! end
17095
17096 !! test
17097 Bug 22905: <abbr> followed by ISBN followed by </a>
17098 !! wikitext
17099 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17100 !! html/php
17101 <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>
17102 </p>
17103 !! html/parsoid
17104 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
17105 !! end
17106
17107 !! test
17108 Double RFC
17109 !! wikitext
17110 RFC RFC 1234
17111 !! html
17112 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17113 </p>
17114 !! end
17115
17116 !! test
17117 Double RFC with a wiki link
17118 !! wikitext
17119 RFC [[RFC 1234]]
17120 !! html
17121 <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>
17122 </p>
17123 !! end
17124
17125 !! test
17126 RFC code coverage
17127 !! wikitext
17128 RFC 983&#x20;987
17129 !! html
17130 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17131 </p>
17132 !! html+tidy
17133 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17134 !! end
17135
17136 !! test
17137 Centre-aligned image
17138 !! wikitext
17139 [[Image:foobar.jpg|centre]]
17140 !! html
17141 <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>
17142
17143 !!end
17144
17145 !! test
17146 None-aligned image
17147 !! wikitext
17148 [[Image:foobar.jpg|none]]
17149 !! html
17150 <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>
17151
17152 !!end
17153
17154 !! test
17155 Width + Height sized image (using px) (height is ignored)
17156 !! wikitext
17157 [[Image:foobar.jpg|640x480px]]
17158 !! html
17159 <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>
17160 </p>
17161 !!end
17162
17163 !! test
17164 Width-sized image (using px, no following whitespace)
17165 !! wikitext
17166 [[Image:foobar.jpg|640px]]
17167 !! html
17168 <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>
17169 </p>
17170 !!end
17171
17172 !! test
17173 Width-sized image (using px, with following whitespace - test regression from r39467)
17174 !! wikitext
17175 [[Image:foobar.jpg|640px ]]
17176 !! html
17177 <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>
17178 </p>
17179 !!end
17180
17181 !! test
17182 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17183 !! wikitext
17184 [[Image:foobar.jpg| 640px]]
17185 !! html
17186 <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>
17187 </p>
17188 !!end
17189
17190 !! test
17191 Image with page parameter
17192 !! options
17193 djvu
17194 !! wikitext
17195 [[File:LoremIpsum.djvu|page=2]]
17196 !! html/php
17197 <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>
17198 </p>
17199 !! html/parsoid
17200 <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" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
17201 !! end
17202
17203 !! test
17204 Another italics / bold test
17205 !! wikitext
17206 ''' ''x'
17207 !! html
17208 <pre>'<i> </i>x'
17209 </pre>
17210 !!end
17211
17212 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17213 !! test
17214 dt/dd/dl test
17215 !! wikitext
17216 :;;;::
17217 !! html/php
17218 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17219
17220 !! html/parsoid
17221 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17222
17223 !!end
17224
17225
17226 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17227 !! test
17228 Images with the "|" character in the comment
17229 !! wikitext
17230 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17231 !! html/php
17232 <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>
17233
17234 !! html/parsoid
17235 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
17236 !! end
17237
17238 !! test
17239 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17240 !! wikitext
17241 <html><script>alert(1);</script></html>
17242 !! html
17243 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17244 </p>
17245 !! end
17246
17247 !! test
17248 HTML with raw HTML ($wgRawHtml==true)
17249 !! options
17250 wgRawHtml=1
17251 !! wikitext
17252 <html><script>alert(1);</script></html>
17253 !! html
17254 <p><script>alert(1);</script>
17255 </p>
17256 !! end
17257
17258 !! test
17259 Parents of subpages, one level up
17260 !! options
17261 subpage title=[[Subpage test/L1/L2/L3]]
17262 !! wikitext
17263 [[../|L2]]
17264 !! html
17265 <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>
17266 </p>
17267 !! end
17268
17269
17270 !! test
17271 Parents of subpages, one level up, not named
17272 !! options
17273 subpage title=[[Subpage test/L1/L2/L3]]
17274 !! wikitext
17275 [[../]]
17276 !! html
17277 <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>
17278 </p>
17279 !! end
17280
17281
17282
17283 !! test
17284 Parents of subpages, two levels up
17285 !! options
17286 subpage title=[[Subpage test/L1/L2/L3]]
17287 !! wikitext
17288 [[../../|L1]]2
17289
17290 [[../../|L1]]l
17291 !! html
17292 <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
17293 </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>
17294 </p>
17295 !! end
17296
17297 !! test
17298 Parents of subpages, two levels up, without trailing slash or name.
17299 !! options
17300 subpage title=[[Subpage test/L1/L2/L3]]
17301 !! wikitext
17302 [[../..]]
17303 !! html
17304 <p>[[../..]]
17305 </p>
17306 !! end
17307
17308 !! test
17309 Parents of subpages, two levels up, with lots of extra trailing slashes.
17310 !! options
17311 subpage title=[[Subpage test/L1/L2/L3]]
17312 !! wikitext
17313 [[../../////]]
17314 !! html
17315 <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>
17316 </p>
17317 !! end
17318
17319 !! article
17320 Subpage test/L1/L2/L3Sibling
17321 !! text
17322 Sibling article
17323 !! endarticle
17324
17325 !! test
17326 Transclusion of a sibling page (one level up)
17327 !! options
17328 subpage title=[[Subpage test/L1/L2/L3]]
17329 !! wikitext
17330 {{../L3Sibling}}
17331 !! html
17332 <p>Sibling article
17333 </p>
17334 !! end
17335
17336 !! test
17337 Transclusion of a child page
17338 !! options
17339 subpage title=[[Subpage test/L1/L2]]
17340 !! wikitext
17341 {{/L3Sibling}}
17342 !! html
17343 <p>Sibling article
17344 </p>
17345 !! end
17346
17347 !! test
17348 Non-transclusion because of too many up levels
17349 !! options
17350 subpage title=[[Subpage test/L1/L2/L3]]
17351 !! wikitext
17352 {{../../../../More than parent}}
17353 !! html
17354 <p>{{../../../../More than parent}}
17355 </p>
17356 !! end
17357
17358 !! test
17359 Definition list code coverage
17360 !! wikitext
17361 ; title : def
17362 ; title : def
17363 ;title: def
17364 !! html/php
17365 <dl><dt> title &#160;</dt>
17366 <dd> def</dd>
17367 <dt> title&#160;</dt>
17368 <dd> def</dd>
17369 <dt>title</dt>
17370 <dd> def</dd></dl>
17371
17372 !! html/parsoid
17373 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17374 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17375 <dt>title</dt><dd> def</dd></dl>
17376 !! end
17377
17378 !! test
17379 Don't fall for the self-closing div
17380 !! wikitext
17381 <div>hello world</div/>
17382 !! html
17383 <div>hello world</div>
17384
17385 !! end
17386
17387 !! test
17388 MSGNW magic word
17389 !! wikitext
17390 {{MSGNW:msg}}
17391 !! html
17392 <p>&#91;&#91;:Template:Msg&#93;&#93;
17393 </p>
17394 !! end
17395
17396 !! test
17397 RAW magic word
17398 !! wikitext
17399 {{RAW:QUERTY}}
17400 !! html
17401 <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>
17402 </p>
17403 !! end
17404
17405 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17406 !! test
17407 Always escape literal '>' in output, not just after '<'
17408 !! wikitext
17409 ><>
17410 !! html
17411 <p>&gt;&lt;&gt;
17412 </p>
17413 !! end
17414
17415 !! test
17416 Template caching
17417 !! wikitext
17418 {{Test}}
17419 {{Test}}
17420 !! html
17421 <p>This is a test template
17422 This is a test template
17423 </p>
17424 !! end
17425
17426
17427 !! article
17428 MediaWiki:Fake
17429 !! text
17430 ==header==
17431 !! endarticle
17432
17433 !! test
17434 Inclusion of !userCanEdit() content
17435 !! wikitext
17436 {{MediaWiki:Fake}}
17437 !! html
17438 <h2><a href="#header" class="mw-headline-anchor" title="Link to this section">§</a><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>
17439
17440 !! end
17441
17442
17443 !! test
17444 Out-of-order TOC heading levels
17445 !! wikitext
17446 ==2==
17447 ======6======
17448 ===3===
17449 =1=
17450 =====5=====
17451 ==2==
17452 !! html
17453 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17454 <ul>
17455 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17456 <ul>
17457 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17458 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17459 </ul>
17460 </li>
17461 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17462 <ul>
17463 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17464 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17465 </ul>
17466 </li>
17467 </ul>
17468 </div>
17469
17470 <h2><a href="#2" class="mw-headline-anchor" title="Link to this section">§</a><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>
17471 <h6><a href="#6" class="mw-headline-anchor" title="Link to this section">§</a><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>
17472 <h3><a href="#3" class="mw-headline-anchor" title="Link to this section">§</a><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>
17473 <h1><a href="#1" class="mw-headline-anchor" title="Link to this section">§</a><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>
17474 <h5><a href="#5" class="mw-headline-anchor" title="Link to this section">§</a><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>
17475 <h2><a href="#2_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
17476
17477 !! end
17478
17479
17480 !! test
17481 ISBN with a dummy number
17482 !! wikitext
17483 ISBN ---
17484 !! html
17485 <p>ISBN ---
17486 </p>
17487 !! end
17488
17489
17490 !! test
17491 ISBN with space-delimited number
17492 !! wikitext
17493 ISBN 92 9017 032 8
17494 !! html
17495 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17496 </p>
17497 !! end
17498
17499
17500 !! test
17501 ISBN with multiple spaces, no number
17502 !! wikitext
17503 ISBN foo
17504 !! html
17505 <p>ISBN foo
17506 </p>
17507 !! end
17508
17509
17510 !! test
17511 ISBN length
17512 !! wikitext
17513 ISBN 123456789
17514
17515 ISBN 1234567890
17516
17517 ISBN 12345678901
17518 !! html
17519 <p>ISBN 123456789
17520 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17521 </p><p>ISBN 12345678901
17522 </p>
17523 !! end
17524
17525
17526 !! test
17527 ISBN with trailing year (bug 8110)
17528 !! wikitext
17529 ISBN 1-234-56789-0 - 2006
17530
17531 ISBN 1 234 56789 0 - 2006
17532 !! html
17533 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17534 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17535 </p>
17536 !! end
17537
17538
17539 !! test
17540 anchorencode
17541 !! wikitext
17542 {{anchorencode:foo bar©#%n}}
17543 !! html
17544 <p>foo_bar.C2.A9.23.25n
17545 </p>
17546 !! end
17547
17548 !! test
17549 anchorencode trims spaces
17550 !! wikitext
17551 {{anchorencode: __pretty__please__}}
17552 !! html
17553 <p>pretty_please
17554 </p>
17555 !! end
17556
17557 !! test
17558 anchorencode deals with links
17559 !! wikitext
17560 {{anchorencode: [[hello|world]] [[hi]]}}
17561 !! html
17562 <p>world_hi
17563 </p>
17564 !! end
17565
17566 !! test
17567 anchorencode deals with templates
17568 !! wikitext
17569 {{anchorencode: {{Foo}} }}
17570 !! html
17571 <p>FOO
17572 </p>
17573 !! end
17574
17575 !! test
17576 anchorencode encodes like the TOC generator: (bug 18431)
17577 !! wikitext
17578 === _ +:.3A%3A&&amp;]] ===
17579 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17580 __NOEDITSECTION__
17581 !! html
17582 <h3><a href="#.2B:.3A.253A.26.26.5D.5D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17583 <p>.2B:.3A.253A.26.26.5D.5D
17584 </p>
17585 !! end
17586
17587 !! test
17588 Bug 6200: blockquotes and paragraph formatting
17589 !! wikitext
17590 <blockquote>
17591 foo
17592 </blockquote>
17593
17594 bar
17595
17596 baz
17597 !! html
17598 <blockquote>
17599 <p>foo
17600 </p>
17601 </blockquote>
17602 <p>bar
17603 </p>
17604 <pre>baz
17605 </pre>
17606 !! end
17607
17608 !! test
17609 Bug 8293: Use of center tag ruins paragraph formatting
17610 !! wikitext
17611 <center>
17612 foo
17613 </center>
17614
17615 bar
17616
17617 baz
17618 !! html
17619 <center>
17620 <p>foo
17621 </p>
17622 </center>
17623 <p>bar
17624 </p>
17625 <pre>baz
17626 </pre>
17627 !! end
17628
17629 !!test
17630 Parsing of overlapping (improperly nested) inline html tags
17631 !! wikitext
17632 <span><s>x</span></s>
17633 !! html/php
17634 <p><span><s>x&lt;/span&gt;</s></span>
17635 </p>
17636 !! html/parsoid
17637 <p><span><s>x</s></span>
17638 </p>
17639 !!end
17640
17641 ###
17642 ### Language variants related tests
17643 ###
17644 !! test
17645 Self-link in language variants
17646 !! options
17647 title=[[Dunav]] language=sr
17648 !! wikitext
17649 Both [[Dunav]] and [[Дунав]] are names for this river.
17650 !! html
17651 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17652 </p>
17653 !!end
17654
17655 !! article
17656 Дуна
17657 !! text
17658 content
17659 !! endarticle
17660
17661 !! test
17662 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17663 !! options
17664 title=[[Duna]] language=sr
17665 !! wikitext
17666 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17667 !! html
17668 <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.
17669 </p>
17670 !! end
17671
17672 !! test
17673 Link to a section of a variant of this title shouldn't be parsed as self-link
17674 !! options
17675 title=[[Duna]] language=sr
17676 !! wikitext
17677 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17678 !! html
17679 <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.
17680 </p>
17681 !! end
17682
17683 !! test
17684 Link to pages in language variants
17685 !! options
17686 language=sr
17687 !! wikitext
17688 Main Page can be written as [[Маин Паге]]
17689 !! html
17690 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17691 </p>
17692 !!end
17693
17694
17695 !! test
17696 Multiple links to pages in language variants
17697 !! options
17698 language=sr
17699 !! wikitext
17700 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17701 !! html
17702 <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>.
17703 </p>
17704 !!end
17705
17706
17707 !! test
17708 Simple template in language variants
17709 !! options
17710 language=sr
17711 !! wikitext
17712 {{тест}}
17713 !! html
17714 <p>This is a test template
17715 </p>
17716 !! end
17717
17718
17719 !! test
17720 Template with explicit namespace in language variants
17721 !! options
17722 language=sr
17723 !! wikitext
17724 {{Template:тест}}
17725 !! html
17726 <p>This is a test template
17727 </p>
17728 !! end
17729
17730
17731 !! test
17732 Basic test for template parameter in language variants
17733 !! options
17734 language=sr
17735 !! wikitext
17736 {{парамтест|param=foo}}
17737 !! html
17738 <p>This is a test template with parameter foo
17739 </p>
17740 !! end
17741
17742
17743 !! test
17744 Simple category in language variants
17745 !! options
17746 language=sr cat
17747 !! wikitext
17748 [[Category:МедиаWики Усер'с Гуиде]]
17749 !! html
17750 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
17751 !! end
17752
17753
17754 !! article
17755 Category:分类
17756 !! text
17757 blah
17758 !! endarticle
17759
17760 !! article
17761 Category:分類
17762 !! text
17763 blah
17764 !! endarticle
17765
17766 !! test
17767 Don't convert blue categorylinks to another variant (bug 33210)
17768 !! options
17769 language=zh cat
17770 !! wikitext
17771 [[A]][[Category:分类]]
17772 !! html
17773 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17774 !! end
17775
17776
17777 !! test
17778 Stripping -{}- tags (language variants)
17779 !! options
17780 language=sr
17781 !! wikitext
17782 Latin proverb: -{Ne nuntium necare}-
17783 !! html
17784 <p>Latin proverb: Ne nuntium necare
17785 </p>
17786 !! end
17787
17788
17789 !! test
17790 Prevent conversion with -{}- tags (language variants)
17791 !! options
17792 language=sr variant=sr-ec
17793 !! wikitext
17794 Latinski: -{Ne nuntium necare}-
17795 !! html
17796 <p>Латински: Ne nuntium necare
17797 </p>
17798 !! end
17799
17800
17801 !! test
17802 Prevent conversion of text with -{}- tags (language variants)
17803 !! options
17804 language=sr variant=sr-ec
17805 !! wikitext
17806 Latinski: -{Ne nuntium necare}-
17807 !! html
17808 <p>Латински: Ne nuntium necare
17809 </p>
17810 !! end
17811
17812
17813 !! test
17814 Prevent conversion of links with -{}- tags (language variants)
17815 !! options
17816 language=sr variant=sr-ec
17817 !! wikitext
17818 -{[[Main Page]]}-
17819 !! html
17820 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17821 </p>
17822 !! end
17823
17824
17825 !! test
17826 -{}- tags within headlines (within html for parserConvert())
17827 !! options
17828 language=sr variant=sr-ec
17829 !! wikitext
17830 == -{Naslov}- ==
17831 !! html
17832 <h2><a href="#-.7BNaslov.7D-" class="mw-headline-anchor" title="Линк то тхис сецтион">§</a><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>
17833
17834 !! end
17835
17836
17837 !! test
17838 Explicit definition of language variant alternatives
17839 !! options
17840 language=zh variant=zh-tw
17841 !! wikitext
17842 -{zh:China;zh-tw:Taiwan}-, not China
17843 !! html
17844 <p>Taiwan, not China
17845 </p>
17846 !! end
17847
17848
17849 !! test
17850 Conversion around HTML tags
17851 !! options
17852 language=sr variant=sr-ec
17853 !! wikitext
17854 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17855 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17856 !! html
17857 <p>
17858 <span title="ЛаCтин">ски</span>
17859 </p>
17860 !! end
17861
17862
17863 !! test
17864 Explicit session-wise language variant mapping (A flag and - flag)
17865 !! options
17866 language=zh variant=zh-tw
17867 !! wikitext
17868 Taiwan is not China.
17869 But -{A|zh:China;zh-tw:Taiwan}- is China,
17870 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17871 and -{China}- is China.
17872 !! html
17873 <p>Taiwan is not China.
17874 But Taiwan is Taiwan,
17875 (This should be stripped!)
17876 and China is China.
17877 </p>
17878 !! end
17879
17880 !! test
17881 Explicit session-wise language variant mapping (H flag for hide)
17882 !! options
17883 language=zh variant=zh-tw
17884 !! wikitext
17885 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17886 Taiwan is China.
17887 !! html
17888 <p>(This should be stripped!)
17889 Taiwan is Taiwan.
17890 </p>
17891 !! end
17892
17893 !! test
17894 Adding explicit conversion rule for title (T flag)
17895 !! options
17896 language=zh variant=zh-tw showtitle
17897 !! wikitext
17898 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17899 !! html
17900 Taiwan
17901 <p>Should be stripped!
17902 </p>
17903 !! end
17904
17905 !! test
17906 Testing that changing the language variant here in the tests actually works
17907 !! options
17908 language=zh variant=zh showtitle
17909 !! wikitext
17910 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17911 !! html
17912 China
17913 <p>Should be stripped!
17914 </p>
17915 !! end
17916
17917 !! test
17918 Recursive conversion of alt and title attrs shouldn't clear converter state
17919 !! options
17920 language=zh variant=zh-cn showtitle
17921 !! wikitext
17922 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17923 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17924 !! html
17925 China
17926 <p>
17927 Should be stripped<span title="Exclamation">!</span>
17928 </p>
17929 !! end
17930
17931 !! test
17932 Bug 24072: more test on conversion rule for title
17933 !! options
17934 language=zh variant=zh-tw showtitle
17935 !! wikitext
17936 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17937 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17938 !! html
17939 Taiwan
17940 <p>This should be stripped!
17941 This won't take interferes with the title rule.
17942 </p>
17943 !! end
17944
17945 !! test
17946 Partly disable title conversion if variant == main language code
17947 !! options
17948 language=zh variant=zh title=[[ZH]] showtitle
17949 !! wikitext
17950 -{T|zh-cn:CN;zh-tw:TW}-
17951 !! html
17952 ZH
17953 <p>
17954 </p>
17955 !! end
17956
17957 !! test
17958 Partly disable title conversion if variant == main language code, more
17959 !! options
17960 language=zh variant=zh title=[[ZH]] showtitle
17961 !! wikitext
17962 -{T|TW}-
17963 !! html
17964 ZH
17965 <p>
17966 </p>
17967 !! end
17968
17969 !! test
17970 Raw output of variant escape tags (R flag)
17971 !! options
17972 language=zh variant=zh-tw
17973 !! wikitext
17974 Raw: -{R|zh:China;zh-tw:Taiwan}-
17975 !! html
17976 <p>Raw: zh:China;zh-tw:Taiwan
17977 </p>
17978 !! end
17979
17980 !! test
17981 Nested using of manual convert syntax
17982 !! options
17983 language=zh variant=zh-hk
17984 !! wikitext
17985 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17986 !! html
17987 <p>Nested: Hello Hong Kong!
17988 </p>
17989 !! end
17990
17991 !! test
17992 Proper conversion of text in external links
17993 !! options
17994 language=sr variant=sr-ec
17995 !! wikitext
17996 http://www.google.com
17997 gopher://www.google.com
17998 [http://www.google.com http://www.google.com]
17999 [gopher://www.google.com gopher://www.google.com]
18000 [https://www.google.com irc://www.google.com]
18001 [ftp://www.google.com www.google.com/ftp://dir]
18002 [//www.google.com www.google.com]
18003 !! html
18004 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18005 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18006 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18007 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18008 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18009 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18010 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18011 </p>
18012 !! end
18013
18014 !! test
18015 Do not convert roman numbers to language variants
18016 !! options
18017 language=sr variant=sr-ec
18018 !! wikitext
18019 Fridrih IV je car.
18020 !! html
18021 <p>Фридрих IV је цар.
18022 </p>
18023 !! end
18024
18025 !! test
18026 Unclosed language converter markup "-{"
18027 !! options
18028 language=sr
18029 !! wikitext
18030 -{T|hello
18031 !! html
18032 <p>-{T|hello
18033 </p>
18034 !! end
18035
18036 !! test
18037 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18038 !! options
18039 language=sr
18040 !! wikitext
18041 -{R|=&gt;}-
18042 !! html
18043 <p>=&gt;
18044 </p>
18045 !!end
18046
18047 !! test
18048 Don't break link parsing if language converter markup is in the caption.
18049 !! options
18050 language=sr variant=sr-ec
18051 !! wikitext
18052 [[Main Page|-{R|main page}-]]
18053 !! html
18054 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18055 </p>
18056 !! end
18057
18058 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18059 !! test
18060 Don't break image parsing if language converter markup is in the caption.
18061 !! options
18062 language=sr
18063 !! wikitext
18064 [[File:Foobar.jpg|-{R|caption}-]]
18065 !! html/parsoid
18066 <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" /></a>
18067 </p>
18068 !! end
18069
18070 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18071 !! test
18072 Don't break list handling if language converter markup is in the item.
18073 !! options
18074 language=zh variant=zh-cn
18075 !! wikitext
18076 ;-{zh-cn:AAA;zh-tw:BBB}-
18077 !! html/php
18078 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18079
18080 !! html/parsoid
18081 <dl><dt>AAA
18082 </dt></dl>
18083 !! end
18084
18085 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18086 !! test
18087 Don't break table handling if language converter markup is in the cell.
18088 !! options
18089 language=sr variant=sr-ec
18090 !! wikitext
18091 {|
18092 |-
18093 | -{R|B}-
18094 |}
18095 !! html/php
18096 <table>
18097
18098 <tr>
18099 <td>Б}-
18100 </td></tr></table>
18101
18102 !! html/parsoid
18103 <table>
18104
18105 <tr>
18106 <td> B
18107 </td></tr></table>
18108
18109 !! end
18110
18111 !! test
18112 Bug 529: Uncovered bullet
18113 !! wikitext
18114 * Foo {{bullet}}
18115 !! html
18116 <ul><li> Foo </li>
18117 <li> Bar</li></ul>
18118
18119 !! end
18120
18121 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18122 # Templates in Wikipedia rely on this behavior, as tidy has always been
18123 # enabled there. These tests are normally run *without* tidy, so specify the
18124 # full output here.
18125 # To test realistic parsing behavior, apply a tidy-like transformation to both
18126 # the expected output and your parser's output.
18127 !! test
18128 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18129 !! wikitext
18130 ******* Foo {{bullet}}
18131 !! html
18132 <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>
18133 <li> Bar</li></ul>
18134
18135 !! end
18136
18137 !! test
18138 Bug 529: Uncovered table already at line-start
18139 !! wikitext
18140 x
18141
18142 {{table}}
18143 y
18144 !! html
18145 <p>x
18146 </p>
18147 <table>
18148 <tr>
18149 <td> 1 </td>
18150 <td> 2
18151 </td></tr>
18152 <tr>
18153 <td> 3 </td>
18154 <td> 4
18155 </td></tr></table>
18156 <p>y
18157 </p>
18158 !! end
18159
18160 !! test
18161 Bug 529: Uncovered bullet in parser function result
18162 !! wikitext
18163 * Foo {{lc:{{bullet}} }}
18164 !! html
18165 <ul><li> Foo </li>
18166 <li> bar</li></ul>
18167
18168 !! end
18169
18170 !! test
18171 Bug 5678: Double-parsed template argument
18172 !! wikitext
18173 {{lc:{{{1}}}|hello}}
18174 !! html
18175 <p>{{{1}}}
18176 </p>
18177 !! end
18178
18179 !! test
18180 Bug 5678: Double-parsed template invocation
18181 !! wikitext
18182 {{lc:{{paramtest {{!}} param = hello }} }}
18183 !! html
18184 <p>{{paramtest | param = hello }}
18185 </p>
18186 !! end
18187
18188 !! test
18189 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18190 !! options
18191 language=cs
18192 title=[[Main Page]]
18193 !! wikitext
18194 {{PRVNÍVELKÉ:ěščř}}
18195 {{prvnívelké:ěščř}}
18196 {{PRVNÍMALÉ:ěščř}}
18197 {{prvnímalé:ěščř}}
18198 {{MALÁ:ěščř}}
18199 {{malá:ěščř}}
18200 {{VELKÁ:ěščř}}
18201 {{velká:ěščř}}
18202 !! html
18203 <p>Ěščř
18204 Ěščř
18205 ěščř
18206 ěščř
18207 ěščř
18208 ěščř
18209 ĚŠČŘ
18210 ĚŠČŘ
18211 </p>
18212 !! end
18213
18214 !! test
18215 Morwen/13: Unclosed link followed by heading
18216 !! wikitext
18217 [[link
18218 ==heading==
18219 !! html
18220 <p>[[link
18221 </p>
18222 <h2><a href="#heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
18223
18224 !! end
18225
18226 !! test
18227 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18228 !! wikitext
18229 {{foo|
18230 =heading=
18231 !! html
18232 <p>{{foo|
18233 </p>
18234 <h1><a href="#heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="heading">heading</span></h1>
18235
18236 !! end
18237
18238 !! test
18239 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18240 !! wikitext
18241 {{foo|
18242 ==heading==
18243 !! html
18244 <p>{{foo|
18245 </p>
18246 <h2><a href="#heading" class="mw-headline-anchor" title="Link to this section">§</a><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>
18247
18248 !! end
18249
18250 !! test
18251 Tildes in comments
18252 !! options
18253 pst
18254 !! wikitext
18255 <!-- ~~~~ -->
18256 !! html
18257 <!-- ~~~~ -->
18258 !! end
18259
18260 !! test
18261 Paragraphs inside divs (no extra line breaks)
18262 !! wikitext
18263 <div>Line one
18264
18265 Line two</div>
18266 !! html
18267 <div>Line one
18268 Line two</div>
18269
18270 !! end
18271
18272 !! test
18273 Paragraphs inside divs (extra line break on open)
18274 !! wikitext
18275 <div>
18276 Line one
18277
18278 Line two</div>
18279 !! html
18280 <div>
18281 <p>Line one
18282 </p>
18283 Line two</div>
18284
18285 !! end
18286
18287 !! test
18288 Paragraphs inside divs (extra line break on close)
18289 !! wikitext
18290 <div>Line one
18291
18292 Line two
18293 </div>
18294 !! html
18295 <div>Line one
18296 <p>Line two
18297 </p>
18298 </div>
18299
18300 !! end
18301
18302 !! test
18303 Paragraphs inside divs (extra line break on open and close)
18304 !! wikitext
18305 <div>
18306 Line one
18307
18308 Line two
18309 </div>
18310 !! html
18311 <div>
18312 <p>Line one
18313 </p><p>Line two
18314 </p>
18315 </div>
18316
18317 !! end
18318
18319 !! test
18320 Nesting tags, paragraphs on lines which begin with <div>
18321 !! wikitext
18322 <div></div><strong>A
18323 B</strong>
18324 !! html/php+tidy
18325 <p><strong>A</strong></p>
18326 <p><strong>B</strong></p>
18327 !! html/parsoid
18328 <div></div>
18329 <p><strong>A
18330 B</strong>
18331 </p>
18332 !! end
18333
18334 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18335 !! test
18336 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18337 !! wikitext
18338 <blockquote>Line one
18339
18340 Line two</blockquote>
18341 !! html
18342 <blockquote>Line one
18343 Line two</blockquote>
18344
18345 !! html+tidy
18346 <blockquote>
18347 <p>Line one Line two</p>
18348 </blockquote>
18349 !! end
18350
18351 !! test
18352 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18353 !! wikitext
18354 <blockquote>
18355 Line one
18356
18357 Line two</blockquote>
18358 !! html
18359 <blockquote>
18360 <p>Line one
18361 </p>
18362 Line two</blockquote>
18363
18364 !! html+tidy
18365 <blockquote>
18366 <p>Line one</p>
18367 Line two</blockquote>
18368 !! end
18369
18370 !! test
18371 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18372 !! wikitext
18373 <blockquote>Line one
18374
18375 Line two
18376 </blockquote>
18377 !! html
18378 <blockquote>Line one
18379 <p>Line two
18380 </p>
18381 </blockquote>
18382
18383 !! html+tidy
18384 <blockquote>
18385 <p>Line one</p>
18386 <p>Line two</p>
18387 </blockquote>
18388 !! end
18389
18390 !! test
18391 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18392 !! wikitext
18393 <blockquote>
18394 Line one
18395
18396 Line two
18397 </blockquote>
18398 !! html
18399 <blockquote>
18400 <p>Line one
18401 </p><p>Line two
18402 </p>
18403 </blockquote>
18404
18405 !! html+tidy
18406 <blockquote>
18407 <p>Line one</p>
18408 <p>Line two</p>
18409 </blockquote>
18410 !! end
18411
18412 !! test
18413 Paragraphs inside blockquotes/divs (no extra line breaks)
18414 !! wikitext
18415 <blockquote><div>Line one
18416
18417 Line two</div></blockquote>
18418 !! html
18419 <blockquote><div>Line one
18420 Line two</div></blockquote>
18421
18422 !! end
18423
18424 !! test
18425 Paragraphs inside blockquotes/divs (extra line break on open)
18426 !! wikitext
18427 <blockquote><div>
18428 Line one
18429
18430 Line two</div></blockquote>
18431 !! html
18432 <blockquote><div>
18433 <p>Line one
18434 </p>
18435 Line two</div></blockquote>
18436
18437 !! end
18438
18439 !! test
18440 Paragraphs inside blockquotes/divs (extra line break on close)
18441 !! wikitext
18442 <blockquote><div>Line one
18443
18444 Line two
18445 </div></blockquote>
18446 !! html
18447 <blockquote><div>Line one
18448 <p>Line two
18449 </p>
18450 </div></blockquote>
18451
18452 !! end
18453
18454 !! test
18455 Paragraphs inside blockquotes/divs (extra line break on open and close)
18456 !! wikitext
18457 <blockquote><div>
18458 Line one
18459
18460 Line two
18461 </div></blockquote>
18462 !! html
18463 <blockquote><div>
18464 <p>Line one
18465 </p><p>Line two
18466 </p>
18467 </div></blockquote>
18468
18469 !! end
18470
18471 !! test
18472 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18473 !! options
18474 wgLinkHolderBatchSize=0
18475 !! wikitext
18476 [[meatball:1]]
18477 [[meatball:2]]
18478 [[meatball:3]]
18479 !! html
18480 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18481 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18482 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18483 </p>
18484 !! end
18485
18486 !! test
18487 Free external link invading image caption
18488 !! wikitext
18489 [[Image:Foobar.jpg|thumb|http://x|hello]]
18490 !! html
18491 <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>
18492
18493 !! end
18494
18495 !! test
18496 Bug 15196: localised external link numbers
18497 !! options
18498 language=fa
18499 !! wikitext
18500 [http://en.wikipedia.org/]
18501 !! html/php
18502 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18503 </p>
18504 !! html/parsoid
18505 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18506 !! end
18507
18508 !! test
18509 Multibyte character in padleft
18510 !! wikitext
18511 {{padleft:-Hello|7|Æ}}
18512 !! html
18513 <p>Æ-Hello
18514 </p>
18515 !! end
18516
18517 !! test
18518 Multibyte character in padright
18519 !! wikitext
18520 {{padright:Hello-|7|Æ}}
18521 !! html
18522 <p>Hello-Æ
18523 </p>
18524 !! end
18525
18526 !!test
18527 formatdate parser function
18528 !! wikitext
18529 {{#formatdate:2009-03-24}}
18530 !! html
18531 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18532 </p>
18533 !! end
18534
18535 !!test
18536 formatdate parser function, with default format
18537 !! wikitext
18538 {{#formatdate:2009-03-24|mdy}}
18539 !! html
18540 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18541 </p>
18542 !! end
18543
18544 !! test
18545 Spacing of numbers in formatted dates
18546 !! wikitext
18547 {{#formatdate:January 15}}
18548 !! html
18549 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18550 </p>
18551 !! end
18552
18553 !! test
18554 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
18555 !! options
18556 language=nl title=[[MediaWiki:Common.css]]
18557 !! wikitext
18558 {{#formatdate:2009-03-24|dmy}}
18559 !! html
18560 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18561 </p>
18562 !! end
18563
18564 #
18565 #
18566 #
18567
18568 #
18569 # Edit comments
18570 #
18571
18572 !! test
18573 Edit comment with link
18574 !! options
18575 comment
18576 !! wikitext
18577 I like the [[Main Page]] a lot
18578 !! html
18579 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18580 !!end
18581
18582 !! test
18583 Edit comment with link and link text
18584 !! options
18585 comment
18586 !! wikitext
18587 I like the [[Main Page|best pages]] a lot
18588 !! html
18589 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18590 !!end
18591
18592 !! test
18593 Edit comment with link and link text with suffix
18594 !! options
18595 comment
18596 !! wikitext
18597 I like the [[Main Page|best page]]s a lot
18598 !! html
18599 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18600 !!end
18601
18602 !! test
18603 Edit comment with section link (non-local, eg in history list)
18604 !! options
18605 comment title=[[Main Page]]
18606 !! wikitext
18607 /* External links */ removed bogus entries
18608 !! html
18609 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18610 !!end
18611
18612 !! test
18613 Edit comment with section link and text before it (non-local, eg in history list)
18614 !! options
18615 comment title=[[Main Page]]
18616 !! wikitext
18617 pre-comment text /* External links */ removed bogus entries
18618 !! html
18619 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>
18620 !!end
18621
18622 !! test
18623 Edit comment with section link (local, eg in diff view)
18624 !! options
18625 comment local title=[[Main Page]]
18626 !! wikitext
18627 /* External links */ removed bogus entries
18628 !! html
18629 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18630 !!end
18631
18632 !! test
18633 Edit comment with subpage link (bug 14080)
18634 !! options
18635 comment
18636 subpage
18637 title=[[Subpage test]]
18638 !! wikitext
18639 Poked at a [[/subpage]] here...
18640 !! html
18641 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18642 !!end
18643
18644 !! test
18645 Edit comment with subpage link and link text (bug 14080)
18646 !! options
18647 comment
18648 subpage
18649 title=[[Subpage test]]
18650 !! wikitext
18651 Poked at a [[/subpage|neat little page]] here...
18652 !! html
18653 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18654 !!end
18655
18656 !! test
18657 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18658 !! options
18659 comment
18660 title=[[Subpage test]]
18661 !! wikitext
18662 Poked at a [[/subpage]] here...
18663 !! html
18664 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...
18665 !!end
18666
18667 !! test
18668 Edit comment with bare anchor link (local, as on diff)
18669 !! options
18670 comment
18671 local
18672 title=[[Main Page]]
18673 !! wikitext
18674 [[#section]]
18675 !! html
18676 <a href="#section">#section</a>
18677 !! end
18678
18679 !! test
18680 Edit comment with bare anchor link (non-local, as on history)
18681 !! options
18682 comment
18683 title=[[Main Page]]
18684 !! wikitext
18685 [[#section]]
18686 !! html
18687 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18688 !! end
18689
18690 !! test
18691 Anchor starting with underscore
18692 !! wikitext
18693 [[#_ref|One]]
18694 !! html
18695 <p><a href="#_ref">One</a>
18696 </p>
18697 !! end
18698
18699 !! test
18700 Id starting with underscore
18701 !! wikitext
18702 <div id="_ref"></div>
18703 !! html
18704 <div id="_ref"></div>
18705
18706 !! end
18707
18708 !! test
18709 Space normalisation on autocomment (bug 22784)
18710 !! options
18711 comment
18712 title=[[Main Page]]
18713 !! wikitext
18714 /* __hello__world__ */
18715 !! html
18716 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18717 !! end
18718
18719 !! test
18720 percent-encoding and + signs in comments (Bug 26410)
18721 !! options
18722 comment
18723 !! wikitext
18724 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18725 !! html
18726 <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>
18727 !! end
18728
18729 # Parsoid doesn't support this yet: see bug 73581
18730 # but it *should* omit the 'src' attribute if the image is bad.
18731 # PHP side of tests was disabled in
18732 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18733 # because of issues in the PHP parserTests infrastructure
18734 # (but the output below is indeed what the PHP side emits)
18735 !! test
18736 Bad images - basic functionality
18737 !! wikitext
18738 [[File:Bad.jpg]]
18739 !! DISABLED/html/php
18740 !! html/parsoid
18741 <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>
18742 !! end
18743
18744 !! test
18745 Bad images - bug 16039: text after bad image disappears
18746 !! wikitext
18747 Foo bar
18748 [[File:Bad.jpg]]
18749 Bar foo
18750 !! DISABLED/html/php
18751 <p>Foo bar
18752 </p><p>Bar foo
18753 </p>
18754 !! html/parsoid
18755 <p>Foo bar
18756 <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>
18757 Bar foo</p>
18758 !! end
18759
18760 !! test
18761 Verify that displaytitle works (bug #22501) no displaytitle
18762 !! options
18763 showtitle
18764 !! config
18765 wgAllowDisplayTitle=true
18766 wgRestrictDisplayTitle=false
18767 !! wikitext
18768 this is not the the title
18769 !! html
18770 Parser test
18771 <p>this is not the the title
18772 </p>
18773 !! end
18774
18775 !! test
18776 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18777 !! options
18778 showtitle
18779 title=[[Screen]]
18780 !! config
18781 wgAllowDisplayTitle=true
18782 wgRestrictDisplayTitle=false
18783 !! wikitext
18784 this is not the the title
18785 {{DISPLAYTITLE:whatever}}
18786 !! html
18787 whatever
18788 <p>this is not the the title
18789 </p>
18790 !! end
18791
18792 !! test
18793 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18794 !! options
18795 showtitle
18796 title=[[Screen]]
18797 !! config
18798 wgAllowDisplayTitle=true
18799 wgRestrictDisplayTitle=true
18800 !! wikitext
18801 this is not the the title
18802 {{DISPLAYTITLE:whatever}}
18803 !! html
18804 Screen
18805 <p>this is not the the title
18806 </p>
18807 !! end
18808
18809 !! test
18810 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18811 !! options
18812 showtitle
18813 title=[[Screen]]
18814 !! config
18815 wgAllowDisplayTitle=true
18816 wgRestrictDisplayTitle=true
18817 !! wikitext
18818 this is not the the title
18819 {{DISPLAYTITLE:screen}}
18820 !! html
18821 screen
18822 <p>this is not the the title
18823 </p>
18824 !! end
18825
18826 !! test
18827 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18828 !! options
18829 showtitle
18830 title=[[Screen]]
18831 !! config
18832 wgAllowDisplayTitle=false
18833 !! wikitext
18834 this is not the the title
18835 {{DISPLAYTITLE:screen}}
18836 !! html
18837 Screen
18838 <p>this is not the the title
18839 <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>
18840 </p>
18841 !! end
18842
18843 !! test
18844 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18845 !! options
18846 showtitle
18847 title=[[Screen]]
18848 !! config
18849 wgAllowDisplayTitle=false
18850 !! wikitext
18851 this is not the the title
18852 !! html
18853 Screen
18854 <p>this is not the the title
18855 </p>
18856 !! end
18857
18858 !! test
18859 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18860 !! options
18861 showtitle
18862 title=[[Screen]]
18863 !! config
18864 wgAllowDisplayTitle=true
18865 wgRestrictDisplayTitle=true
18866 !! wikitext
18867 this is not the the title
18868 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18869 !! html
18870 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18871 <p>this is not the the title
18872 </p>
18873 !! end
18874
18875 !! test
18876 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18877 !! options
18878 showtitle
18879 title=[[Screen]]
18880 !! config
18881 wgAllowDisplayTitle=true
18882 wgRestrictDisplayTitle=true
18883 !! wikitext
18884 this is not the the title
18885 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18886 !! html
18887 <span style="color: red;">s</span>creen
18888 <p>this is not the the title
18889 </p>
18890 !! end
18891
18892 !! test
18893 preload: check <noinclude> and <includeonly>
18894 !! options
18895 preload
18896 !! wikitext
18897 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18898 !! html
18899 Hello kind world.
18900 !! end
18901
18902 !! test
18903 preload: check <onlyinclude>
18904 !! options
18905 preload
18906 !! wikitext
18907 Goodbye <onlyinclude>Hello world</onlyinclude>
18908 !! html
18909 Hello world
18910 !! end
18911
18912 !! test
18913 preload: can pass tags through if we want to
18914 !! options
18915 preload
18916 !! wikitext
18917 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18918 !! html
18919 <includeonly>Hello world</includeonly>
18920 !! end
18921
18922 !! test
18923 preload: check that it doesn't try to do tricks
18924 !! options
18925 preload
18926 !! wikitext
18927 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18928 !! html
18929 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18930 !! end
18931
18932 !! test
18933 Play a bit with r67090 and bug 3158
18934 !! wikitext
18935 <div style="width:50% !important">&nbsp;</div>
18936 <div style="width:50%&nbsp;!important">&nbsp;</div>
18937 <div style="width:50%&#160;!important">&nbsp;</div>
18938 <div style="border : solid;">&nbsp;</div>
18939 !! html/php
18940 <div style="width:50% !important">&#160;</div>
18941 <div style="width:50% !important">&#160;</div>
18942 <div style="width:50% !important">&#160;</div>
18943 <div style="border&#160;: solid;">&#160;</div>
18944
18945 !! html/parsoid
18946 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18947 <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>
18948 <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>
18949 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18950
18951 !! end
18952
18953 !! test
18954 HTML5 data attributes
18955 !! wikitext
18956 <span data-foo="bar">Baz</span>
18957 <p data-abc-def_hij="">Quuz</p>
18958 !! html
18959 <p><span data-foo="bar">Baz</span>
18960 </p>
18961 <p data-abc-def_hij="">Quuz</p>
18962
18963 !! end
18964
18965 !! test
18966 percent-encoding and + signs in internal links (Bug 26410)
18967 !! wikitext
18968 [[User:+%]] [[Page+title%]]
18969 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18970 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18971 [[%33%45]] [[%33%45+]]
18972 !! html/php
18973 <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>
18974 <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>
18975 <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>
18976 <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>
18977 </p>
18978 !! html/parsoid
18979 <p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p>
18980 !! end
18981
18982 !! test
18983 Special characters in embedded file links (bug 27679)
18984 !! wikitext
18985 [[File:Contains & ampersand.jpg]]
18986 [[File:Does not exist.jpg|Title with & ampersand]]
18987 !! html/php
18988 <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>
18989 <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>
18990 </p>
18991 !! html/parsoid
18992 <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>
18993 <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; 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>
18994 !! end
18995
18996 !! test
18997 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18998 !! wikitext
18999 Text&apos;s been normalized?
19000 !! html
19001 <p>Text&#39;s been normalized?
19002 </p>
19003 !! end
19004
19005 !! test
19006 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19007 !! wikitext
19008 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19009 !! html
19010 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19011 </p>
19012 !! end
19013
19014 !! test
19015 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19016 !! wikitext
19017 [http://www.example.org/ ideograms]
19018 !! html
19019 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19020 </p>
19021 !! end
19022
19023 !! test
19024 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19025 !! wikitext
19026 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19027 !! html
19028 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19029 </p>
19030 !! end
19031
19032 !! article
19033 Mediawiki:loop1
19034 !! text
19035 {{Identical|A}}
19036 !! endarticle
19037
19038 !! article
19039 Mediawiki:loop2
19040 !! text
19041 {{Identical|B}}
19042 !! endarticle
19043
19044 !! article
19045 Template:Identical
19046 !! text
19047 {{int:loop1}}
19048 {{int:loop2}}
19049 !! endarticle
19050
19051 !! test
19052 Bug 31098 Template which includes system messages which includes the template
19053 !! wikitext
19054 {{Identical}}
19055 !! html
19056 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19057 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19058 </p>
19059 !! end
19060
19061 !! test
19062 Bug31490 Turkish: ucfirst 'blah'
19063 !! options
19064 language=tr
19065 !! wikitext
19066 {{ucfirst:blah}}
19067 !! html
19068 <p>Blah
19069 </p>
19070 !! end
19071
19072 !! test
19073 Bug31490 Turkish: ucfirst 'ix'
19074 !! options
19075 language=tr
19076 !! wikitext
19077 {{ucfirst:ix}}
19078 !! html
19079 <p>İx
19080 </p>
19081 !! end
19082
19083 !! test
19084 Bug31490 Turkish: lcfirst 'BLAH'
19085 !! options
19086 language=tr
19087 !! wikitext
19088 {{lcfirst:BLAH}}
19089 !! html
19090 <p>bLAH
19091 </p>
19092 !! end
19093
19094 !! test
19095 Bug31490 Turkish: ucfırst (with a dotless i)
19096 !! options
19097 language=tr
19098 !! wikitext
19099 {{ucfırst:blah}}
19100 !! html
19101 <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>
19102 </p>
19103 !! end
19104
19105 !! test
19106 Bug31490 ucfırst (with a dotless i) with English language
19107 !! options
19108 language=en
19109 !! wikitext
19110 {{ucfırst:blah}}
19111 !! html
19112 <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>
19113 </p>
19114 !! end
19115
19116 !! test
19117 Bug 26375: TOC with italics
19118 !! options
19119 title=[[Main Page]]
19120 !! wikitext
19121 __TOC__
19122 == ''Lost'' episodes ==
19123 !! html
19124 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19125 <ul>
19126 <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>
19127 </ul>
19128 </div>
19129
19130 <h2><a href="#Lost_episodes" class="mw-headline-anchor" title="Link to this section">§</a><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>
19131
19132 !! end
19133
19134 !! test
19135 Bug 26375: TOC with bold
19136 !! options
19137 title=[[Main Page]]
19138 !! wikitext
19139 __TOC__
19140 == '''should be bold''' then normal text ==
19141 !! html
19142 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19143 <ul>
19144 <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>
19145 </ul>
19146 </div>
19147
19148 <h2><a href="#should_be_bold_then_normal_text" class="mw-headline-anchor" title="Link to this section">§</a><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>
19149
19150 !! end
19151
19152 !! test
19153 Bug 33845: Headings become cursive in TOC when they contain an image
19154 !! options
19155 title=[[Main Page]]
19156 !! wikitext
19157 __TOC__
19158 == Image [[Image:foobar.jpg]] ==
19159 !! html
19160 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19161 <ul>
19162 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19163 </ul>
19164 </div>
19165
19166 <h2><a href="#Image" class="mw-headline-anchor" title="Link to this section">§</a><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>
19167
19168 !! end
19169
19170 !! test
19171 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19172 !! options
19173 title=[[Main Page]]
19174 !! wikitext
19175 __TOC__
19176 == <blockquote>Quote</blockquote> ==
19177 !! html
19178 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19179 <ul>
19180 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19181 </ul>
19182 </div>
19183
19184 <h2><a href="#Quote" class="mw-headline-anchor" title="Link to this section">§</a><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>
19185
19186 !! html+tidy
19187 <div id="toc" class="toc">
19188 <div id="toctitle">
19189 <h2>Contents</h2>
19190 </div>
19191 <ul>
19192 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19193 </ul>
19194 </div>
19195 <h2><a href="#Quote" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Quote"></span></h2>
19196 <blockquote>
19197 <p><span class="mw-headline" id="Quote">Quote</span></p>
19198 </blockquote>
19199 <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>
19200 !! end
19201
19202 !! test
19203 Unclosed tags in TOC
19204 !! options
19205 title=[[Main Page]]
19206 !! wikitext
19207 __TOC__
19208 == Proof: 2 < 3 ==
19209 <small>Hanc marginis exiguitas non caperet.</small>
19210 QED
19211 !! html
19212 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19213 <ul>
19214 <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>
19215 </ul>
19216 </div>
19217
19218 <h2><a href="#Proof:_2_.3C_3" class="mw-headline-anchor" title="Link to this section">§</a><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>
19219 <p><small>Hanc marginis exiguitas non caperet.</small>
19220 QED
19221 </p>
19222 !! end
19223
19224 !! test
19225 Multiple tags in TOC
19226 !! wikitext
19227 __TOC__
19228 == <i>Foo</i> <b>Bar</b> ==
19229
19230 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19231 !! html
19232 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19233 <ul>
19234 <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>
19235 <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>
19236 </ul>
19237 </div>
19238
19239 <h2><a href="#Foo_Bar" class="mw-headline-anchor" title="Link to this section">§</a><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>
19240 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
19241
19242 !! html+tidy
19243 <div id="toc" class="toc">
19244 <div id="toctitle">
19245 <h2>Contents</h2>
19246 </div>
19247 <ul>
19248 <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>
19249 <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>
19250 </ul>
19251 </div>
19252 <h2><a href="#Foo_Bar" class="mw-headline-anchor" title="Link to this section">§</a><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>
19253 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19254 <blockquote>
19255 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19256 </blockquote>
19257 <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>
19258 !! end
19259
19260 !! test
19261 Tags with parameters in TOC
19262 !! wikitext
19263 __TOC__
19264 == <sup class="in-h2">Hello</sup> ==
19265
19266 == <sup class="a > b">Evilbye</sup> ==
19267 !! html
19268 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19269 <ul>
19270 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19271 <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>
19272 </ul>
19273 </div>
19274
19275 <h2><a href="#Hello" class="mw-headline-anchor" title="Link to this section">§</a><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>
19276 <h2><a href="#b.22.3EEvilbye" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="b.22.3EEvilbye"><sup> 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;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19277
19278 !! end
19279
19280 !! test
19281 span tags with directionality in TOC
19282 !! wikitext
19283 __TOC__
19284 == <span dir="ltr">C++</span> ==
19285
19286 == <span dir="rtl">זבנג!</span> ==
19287
19288 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19289
19290 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19291
19292 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19293 !! html
19294 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19295 <ul>
19296 <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>
19297 <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>
19298 <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>
19299 <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>
19300 <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>
19301 </ul>
19302 </div>
19303
19304 <h2><a href="#C.2B.2B" class="mw-headline-anchor" title="Link to this section">§</a><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>
19305 <h2><a href="#.D7.96.D7.91.D7.A0.D7.92.21" class="mw-headline-anchor" title="Link to this section">§</a><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>
19306 <h2><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" title="Link to this section">§</a><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>
19307 <h2><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" title="Link to this section">§</a><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>
19308 <h2><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" title="Link to this section">§</a><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>
19309
19310 !! end
19311
19312 !! test
19313 Bug 72884: bdi element in ToC
19314 !! wikitext
19315 __TOC__
19316 == <bdi>test</bdi> ==
19317 !! html
19318 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19319 <ul>
19320 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19321 </ul>
19322 </div>
19323
19324 <h2><a href="#test" class="mw-headline-anchor" title="Link to this section">§</a><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>
19325
19326 !! end
19327
19328 !! article
19329 MediaWiki:Bug32057
19330 !! text
19331 == {{int:headline_sample}} ==
19332 !! endarticle
19333
19334 !! test
19335 Bug 32057: Title needed when expanding <h> nodes.
19336 !! options
19337 title=[[Main Page]]
19338 !! wikitext
19339 {{int:Bug32057}}
19340 !! html
19341 <h2><a href="#Headline_text" class="mw-headline-anchor" title="Link to this section">§</a><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>
19342
19343 !! end
19344
19345 !! test
19346 Strip marker in urlencode
19347 !! wikitext
19348 {{urlencode:x<nowiki/>y}}
19349 {{urlencode:x<nowiki/>y|wiki}}
19350 {{urlencode:x<nowiki/>y|path}}
19351 !! html
19352 <p>xy
19353 xy
19354 xy
19355 </p>
19356 !! end
19357
19358 !! test
19359 Strip marker in lc
19360 !! wikitext
19361 {{lc:x<nowiki/>y}}
19362 !! html
19363 <p>xy
19364 </p>
19365 !! end
19366
19367 !! test
19368 Strip marker in uc
19369 !! wikitext
19370 {{uc:x<nowiki/>y}}
19371 !! html
19372 <p>XY
19373 </p>
19374 !! end
19375
19376 !! test
19377 Strip marker in formatNum
19378 !! wikitext
19379 {{formatnum:1<nowiki/>2}}
19380 {{formatnum:1<nowiki/>2|R}}
19381 !! html
19382 <p>12
19383 12
19384 </p>
19385 !! end
19386
19387 !! test
19388 Check noCommafy in formatNum
19389 !! options
19390 language=be-tarask
19391 !! wikitext
19392 {{formatnum:123456.78}}
19393 {{formatnum:123456.78|NOSEP}}
19394 !! html
19395 <p>123 456,78
19396 123456.78
19397 </p>
19398 !! end
19399
19400 !! test
19401 Wrong option for formatNum (bug 56199)
19402 !! wikitext
19403 {{formatnum:1,234.56|Random}}
19404 {{formatnum:1,234.56|EVERYTHING}}
19405 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19406 !! html
19407 <p>1,234.56
19408 1,234.56
19409 1,234.56
19410 </p>
19411 !! end
19412
19413 !! test
19414 Strip marker in grammar
19415 !! options
19416 language=fi
19417 !! wikitext
19418 {{grammar:elative|foo<nowiki/>bar}}
19419 !! html
19420 <p>foobarista
19421 </p>
19422 !! end
19423
19424 !! test
19425 Strip marker in padleft
19426 !! wikitext
19427 {{padleft:|2|x<nowiki/>y}}
19428 !! html
19429 <p>xy
19430 </p>
19431 !! end
19432
19433 !! test
19434 Strip marker in padright
19435 !! wikitext
19436 {{padright:|2|x<nowiki/>y}}
19437 !! html
19438 <p>xy
19439 </p>
19440 !! end
19441
19442 !! test
19443 Strip marker in anchorencode
19444 !! wikitext
19445 {{anchorencode:x<nowiki/>y}}
19446 !! html
19447 <p>xy
19448 </p>
19449 !! end
19450
19451 !! test
19452 nowiki inside link inside heading (bug 18295)
19453 !! wikitext
19454 ==[[foo|x<nowiki>y</nowiki>z]]==
19455 !! html
19456 <h2><a href="#xyz" class="mw-headline-anchor" title="Link to this section">§</a><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>
19457
19458 !! end
19459
19460 !! test
19461 new support for bdi element (bug 31817)
19462 !! wikitext
19463 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19464 !! html
19465 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19466
19467 !!end
19468
19469 !! test
19470 Ignore pipe between table row attributes
19471 !! wikitext
19472 {|
19473 | quux
19474 |- id=foo | style='color: red'
19475 | bar
19476 |}
19477 !! html
19478 <table>
19479 <tr>
19480 <td> quux
19481 </td></tr>
19482 <tr id="foo" style="color: red">
19483 <td> bar
19484 </td></tr></table>
19485
19486 !! end
19487
19488 !!test
19489 Gallery override link with WikiLink (bug 34852)
19490 !! wikitext
19491 <gallery>
19492 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19493 </gallery>
19494 !! html
19495 <ul class="gallery mw-gallery-traditional">
19496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19497 <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>
19498 <div class="gallerytext">
19499 <p>caption
19500 </p>
19501 </div>
19502 </div></li>
19503 </ul>
19504
19505 !! end
19506
19507 !!test
19508 Gallery override link with absolute external link (bug 34852)
19509 !! wikitext
19510 <gallery>
19511 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19512 </gallery>
19513 !! html
19514 <ul class="gallery mw-gallery-traditional">
19515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19516 <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>
19517 <div class="gallerytext">
19518 <p>caption
19519 </p>
19520 </div>
19521 </div></li>
19522 </ul>
19523
19524 !! end
19525
19526 !!test
19527 Gallery override link with malicious javascript (bug 34852)
19528 !! wikitext
19529 <gallery>
19530 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19531 </gallery>
19532 !! html
19533 <ul class="gallery mw-gallery-traditional">
19534 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19535 <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>
19536 <div class="gallerytext">
19537 <p>caption
19538 </p>
19539 </div>
19540 </div></li>
19541 </ul>
19542
19543 !! end
19544
19545 !!test
19546 Gallery with invalid title as link (bug 43964)
19547 !! wikitext
19548 <gallery>
19549 File:foobar.jpg|link=<
19550 </gallery>
19551 !! html
19552 <ul class="gallery mw-gallery-traditional">
19553 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19554 <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>
19555 <div class="gallerytext">
19556 </div>
19557 </div></li>
19558 </ul>
19559
19560 !! end
19561
19562 !!test
19563 Language parser function
19564 !! wikitext
19565 {{#language:ar}}
19566 !! html
19567 <p>العربية
19568 </p>
19569 !! end
19570
19571 !!test
19572 Padleft and padright as substr
19573 !! wikitext
19574 {{padleft:|3|abcde}}
19575 {{padright:|3|abcde}}
19576 !! html
19577 <p>abc
19578 abc
19579 </p>
19580 !! end
19581
19582 !!test
19583 Special parser function
19584 !! wikitext
19585 {{#special:RandomPage}}
19586 {{#special:BaDtItLe}}
19587 {{#special:Foobar}}
19588 !! html
19589 <p>Special:Random
19590 Special:Badtitle
19591 Special:Foobar
19592 </p>
19593 !! end
19594
19595 !!test
19596 Bug 34939 - Case insensitive link parsing ([HttP://])
19597 !! wikitext
19598 [HttP://MediaWiki.Org/]
19599 !! html/php
19600 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19601 </p>
19602 !! html/parsoid
19603 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19604 !! end
19605
19606 !!test
19607 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19608 !! wikitext
19609 [HttP://MediaWiki.Org/ MediaWiki]
19610 !! html
19611 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19612 </p>
19613 !! end
19614
19615 !!test
19616 Bug 34939 - Case insensitive link parsing (HttP://)
19617 !! wikitext
19618 HttP://MediaWiki.Org/
19619 !! html/php
19620 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19621 </p>
19622 !! html/parsoid
19623 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19624 !! end
19625
19626 !!test
19627 Disable TOC
19628 !! options
19629 notoc
19630 !! wikitext
19631 Lead
19632 == Section 1 ==
19633 == Section 2 ==
19634 == Section 3 ==
19635 == Section 4 ==
19636 == Section 5 ==
19637 !! html
19638 <p>Lead
19639 </p>
19640
19641 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><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>
19642 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><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>
19643 <h2><a href="#Section_3" class="mw-headline-anchor" title="Link to this section">§</a><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>
19644 <h2><a href="#Section_4" class="mw-headline-anchor" title="Link to this section">§</a><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>
19645 <h2><a href="#Section_5" class="mw-headline-anchor" title="Link to this section">§</a><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>
19646
19647 !! end
19648
19649
19650 ###
19651 ### Parsoid-specific tests
19652 ### Parsoid-PHP parser incompatibilities
19653 ###
19654 !!test
19655 1. SOL-sensitive wikitext tokens as template-args
19656 !!options
19657 parsoid=wt2html,wt2wt
19658 !! wikitext
19659 {{echo|*a}}
19660 {{echo|#a}}
19661 {{echo|:a}}
19662 !! html
19663 <span about="#mwt1" typeof="mw:Transclusion">
19664 </span><ul about="#mwt1"><li>a</li>
19665 </ul>
19666 <span about="#mwt2" typeof="mw:Transclusion">
19667 </span><ol about="#mwt2"><li>a</li>
19668 </ol>
19669 <span about="#mwt3" typeof="mw:Transclusion">
19670 </span><dl about="#mwt3"><dd>a</dd>
19671 </dl>
19672 !!end
19673
19674 #### -----------------------------------------------------------------
19675 #### Parsoid-specific functionality tests
19676 #### -----------------------------------------------------------------
19677
19678 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19679 # We know wt2wt will fail, but we expect selser to pass.
19680 # Due to the nature of our testing, wt2wt and selser tests will enter the
19681 # blacklist and we'll catch selser regressions based on changes to the
19682 # blacklist entries for selser tests.
19683 !! test
19684 1. Bad treebuilder fixup of formatting elt is cleaned up
19685 !! options
19686 parsoid=wt2html,wt2wt
19687 !! wikitext
19688 {|
19689 |
19690 <small>
19691 [[Image:Foobar.jpg|right|Test]]
19692 </small>
19693 |}
19694 !! html/parsoid
19695 <table>
19696 <tbody><tr><td>
19697 <small>
19698 <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" height="220" width="1941"></a><figcaption>Test</figcaption></figure>
19699 </small>
19700 </td></tr>
19701 </tbody></table>
19702 !! end
19703
19704 !! test
19705 2. Bad treebuilder fixup of formatting elt is cleaned up
19706 !! options
19707 parsoid=wt2html,wt2wt
19708 !! wikitext
19709 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19710
19711 <small>[[Image:Foobar.jpg|right|300px]]</small>
19712 !! html/parsoid
19713 <p><b>foo</b></p>
19714 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
19715 <p><b>bar</b></p>
19716 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></figure></small>
19717 !! end
19718
19719 #### ----------------------------------------------------------------
19720 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19721 #### tags. Parsoid's output for these tags differs from that of the
19722 #### PHP parser.
19723 #### ----------------------------------------------------------------
19724
19725 !!test
19726 Ref: 1. ref-location should be replaced with an index span
19727 !!options
19728 parsoid
19729 !! wikitext
19730 A <ref>foo</ref>
19731 B <ref name="x">foo</ref>
19732 C <ref name="y" />
19733 <references />
19734 !! html
19735 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19736 B <span about="#mwt4" class="reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
19737 C <span about="#mwt6" class="reference" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3">[3]</a></span></p>
19738 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19739 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19740 <li id="cite_note-x-2"><span rel="mw:referencedBy"><a href="#cite_ref-x_2-0">↑</a></span> foo</li>
19741 <li id="cite_note-y-3"><span rel="mw:referencedBy"><a href="#cite_ref-y_3-0">↑</a></span></li>
19742 </ol>
19743 !!end
19744
19745 !!test
19746 Ref: 2. ref-tags with identical names should all get the same index
19747 !!options
19748 parsoid
19749 !! wikitext
19750 A <ref name="x">foo</ref>
19751 B <ref name="x" />
19752 <references />
19753 !! html
19754 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19755 B <span about="#mwt4" class="reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19756 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19757 <li id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a></span> foo</li>
19758 </ol>
19759 !!end
19760
19761 !!test
19762 Ref: 3. spaces in ref-names should be ignored
19763 !!options
19764 parsoid
19765 !! wikitext
19766 A <ref name="x">foo</ref>
19767 B <ref name=" x " />
19768 C <ref name= x />
19769 <references />
19770 !! html
19771 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19772 B <span about="#mwt4" class="reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19773 C <span about="#mwt6" class="reference" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19774 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19775 <li id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a> <a href="#cite_ref-x_1-2">1.2</a></span> foo</li>
19776 </ol>
19777 !!end
19778
19779 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19780 !!test
19781 Ref: 4. 'constructor' should be accepted as a valid ref-name
19782 !!options
19783 parsoid
19784 !! wikitext
19785 A <ref name="constructor">foo</ref>
19786 <references />
19787 !! html
19788 <p>A <span about="#mwt2" class="reference" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
19789 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19790 <li id="cite_note-constructor-1"><span rel="mw:referencedBy"><a href="#cite_ref-constructor_1-0">↑</a></span> foo</li>
19791 </ol>
19792 !!end
19793
19794 !!test
19795 Ref: 5. body should accept generic wikitext
19796 !!options
19797 parsoid
19798 !! wikitext
19799 A <ref>
19800 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19801 </ref>
19802
19803 <references />
19804 !! html
19805 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19806
19807 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19808 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> 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>
19809 </li>
19810 </ol>
19811 !!end
19812
19813 !!test
19814 Ref: 6. indent-pres should not be output in ref-body
19815 !!options
19816 parsoid
19817 !! wikitext
19818 A <ref>
19819 foo
19820 bar
19821 baz
19822 </ref>
19823
19824 <references />
19825 !! html
19826 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19827
19828 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19829 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19830 bar
19831 baz
19832 </li>
19833 </ol>
19834 !!end
19835
19836 !!test
19837 Ref: 7. No p-wrapping in ref-body
19838 !!options
19839 parsoid
19840 !! wikitext
19841 A <ref>
19842 foo
19843
19844 bar
19845
19846
19847 baz
19848
19849
19850
19851 booz
19852 </ref>
19853
19854 <references />
19855 !! html
19856 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19857
19858 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19859 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19860
19861 bar
19862
19863
19864 baz
19865
19866
19867
19868 booz
19869 </li>
19870 </ol>
19871 !!end
19872
19873 !!test
19874 Ref: 8. transclusion wikitext has lower precedence
19875 !!options
19876 parsoid
19877 !! wikitext
19878 A <ref> foo {{echo|</ref> B C}}
19879
19880 <references />
19881 !! html
19882 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"src\":\"{{\",\"dsr\":[12,14,0,0]}&#39;>{{&lt;/span>echo|"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19883 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19884 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19885 </ol>
19886 !!end
19887
19888 !!test
19889 Ref: 9. unclosed comments should not leak out of ref-body
19890 !!options
19891 parsoid
19892 !! wikitext
19893 A <ref> foo <!--</ref> B C
19894 <references />
19895 !! html
19896 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19897 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19898 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <!----></li>
19899 </ol>
19900 !!end
19901
19902 !!test
19903 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19904 !!options
19905 parsoid
19906 !! wikitext
19907 A <ref> <b> foo </ref> B C
19908
19909 <references />
19910 !! html
19911 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;b data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}&#39;> foo &lt;/b>"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19912
19913
19914 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19915 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19916 </ol>
19917 !!end
19918
19919 !!test
19920 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19921 !!options
19922 parsoid
19923 !! wikitext
19924 A <ref>foo</ref> B
19925 C <ref>bar</ref> D
19926 <references />
19927 !! html
19928 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19929 C <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
19930 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19931 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19932 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
19933 </ol>
19934 !!end
19935
19936 !!test
19937 Ref: 12. ref-tags act as trailing newline migration barrier
19938 !!options
19939 parsoid
19940 !! wikitext
19941 <!--the newline at the end of this line moves out of the p-tag-->a
19942
19943 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19944 <ref />
19945
19946 c
19947 <references />
19948 !! html
19949 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19950
19951
19952 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19953 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p>
19954
19955 <p>c</p>
19956 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19957 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span></li>
19958 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span></li>
19959 </ol>
19960 !!end
19961
19962 !!test
19963 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19964 !!options
19965 parsoid
19966 !! wikitext
19967 <ref>foo</ref> A
19968 <ref>bar
19969 </ref> B
19970 <references />
19971 !! html
19972 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
19973 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
19974 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19975 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19976 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
19977 </ol>
19978 !!end
19979
19980 !!test
19981 Ref: 14. A nested ref-tag should be emitted as plain text
19982 !!options
19983 parsoid
19984 !! wikitext
19985 <ref>foo <ref>bar</ref> baz</ref>
19986
19987 <references />
19988 !! html
19989 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19990
19991 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19992 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19993 </ol>
19994 !!end
19995
19996 !!test
19997 Ref: 15. ref-tags with identical names should get identical indexes
19998 !!options
19999 parsoid
20000 !! wikitext
20001 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20002 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20003
20004 <references />
20005 !! html
20006 <p>A1 <span about="#mwt3" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
20007 B1 <span about="#mwt7" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20008
20009 <ol class="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="#cite_ref-a_1-0">1.0</a> <a href="#cite_ref-a_1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b_2-0">2.0</a> <a href="#cite_ref-b_2-1">2.1</a></span> bar</li>
20010 </ol>
20011 !!end
20012
20013 ## We don't bother wt2wt-ing non-standard whitespace
20014 !!test
20015 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20016 !!options
20017 parsoid=wt2html
20018 !! wikitext
20019 A <ref >foo</ref >
20020
20021 <references />
20022 !! html
20023 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20024
20025 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20026 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
20027 !!end
20028
20029 !!test
20030 Ref: 17. Generate valid HTML5 id/about attributes
20031 !!options
20032 parsoid
20033 !!wikitext
20034 <ref name="a b">foo</ref>
20035
20036 <references />
20037 !!html
20038 <p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
20039 </p>
20040
20041 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20042 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> foo</li>
20043 !!end
20044
20045 !!test
20046 Ref: 18. T58916: Extension attributes should be parsed as plain text
20047 !!options
20048 parsoid
20049 !!wikitext
20050 <ref name="{{echo|a}}">foo</ref>
20051
20052 <references />
20053 !!html
20054 <p><span class="reference" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span>
20055 </p>
20056
20057 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20058 <li id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><span rel="mw:referencedBy"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0">↑</a></span> foo</li>
20059 !!end
20060
20061 !!test
20062 Ref: 19. ref-tags with identical name encodings should get identical indexes
20063 !!options
20064 parsoid
20065 !! wikitext
20066 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20067
20068 <references />
20069 !! html
20070 <p>1 <span about="#mwt3" class="reference" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span> 2 <span about="#mwt4" class="reference" 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="#cite_note-a_.26_b-1">[1]</a></span>
20071
20072 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a_.26_b_1-0">1.0</a> <a href="#cite_ref-a_.26_b_1-1">1.1</a></span> foo</li>
20073 </ol>
20074 !!end
20075
20076 !!test
20077 References: 1. references tag without any refs should be handled properly
20078 !!options
20079 parsoid
20080 !! wikitext
20081 <references />
20082 !! html
20083 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
20084 !!end
20085
20086 !!test
20087 References: 2. references tag with group only outputs references from that group
20088 !!options
20089 parsoid
20090 !! wikitext
20091 A <ref group="a">foo</ref>
20092 B <ref group="b">bar</ref>
20093 C <ref>baz</ref>
20094
20095 <references group="a" />
20096 <references />
20097 <references group="b" />
20098 !! html
20099 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20100 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span>
20101 C <span class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"baz"},"attrs":{}}'><a href="#cite_note-3">[1]</a></span></p>
20102
20103 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
20104 </ol>
20105 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> baz</li>
20106 </ol>
20107 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20108 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
20109 </ol>
20110 !!end
20111
20112 !!test
20113 References: 3. ref list should be cleared after processing references
20114 !!options
20115 parsoid
20116 !! wikitext
20117 A <ref>foo</ref>
20118
20119 <references />
20120
20121 B <ref>bar</ref>
20122
20123 <references />
20124 !! html
20125 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20126
20127 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
20128 </ol>
20129
20130 <p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20131
20132 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
20133 </ol>
20134 !!end
20135
20136 !!test
20137 References: 4. only referenced group should be cleared after processing references
20138 !!options
20139 parsoid
20140 !! wikitext
20141 A <ref group="a">afoo</ref>
20142 B <ref>bfoo</ref>
20143
20144 <references group="a" />
20145
20146 C <ref>cfoo</ref>
20147
20148 <references />
20149 !! html
20150 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20151 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20152
20153 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> afoo</li>
20154 </ol>
20155
20156 <p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
20157
20158 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> cfoo</li>
20159 </ol>
20160 !!end
20161
20162 !!test
20163 References: 5. ref tags in references should be processed while ignoring all other content
20164 !!options
20165 parsoid
20166 !! wikitext
20167 A <ref name="a" />
20168 B <ref name="b">bar</ref>
20169
20170 <references>
20171 <ref name="a">foo</ref>
20172 This should just get lost.
20173 </references>
20174 !! html
20175 <p>A <span about="#mwt2" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
20176 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20177
20178
20179 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> bar</li>
20180 </ol>
20181 !!end
20182
20183 !!test
20184 References: 6. <references /> from a transclusion
20185 !!options
20186 parsoid
20187 !! wikitext
20188 <ref>Foo</ref> {{echo|<references />}}
20189 !! html
20190 <p><span about="#mwt3" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <ol class="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"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> Foo</li></ol>
20191 !!end
20192
20193 !! test
20194 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20195 !! options
20196 parsoid
20197 !! wikitext
20198 A <ref>foo bar for a</ref>
20199 B <ref group="X" name="b" />
20200
20201 <references />
20202
20203 <references group="X">
20204 <ref name="b">foo</ref>
20205 </references>
20206 !! html
20207 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20208 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2">[X 1]</a></span></p>
20209
20210 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo bar for a</li></ol>
20211
20212 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> foo</li></ol>
20213 !! end
20214
20215 !! test
20216 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20217 !! options
20218 parsoid
20219 !! wikitext
20220 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20221 <references />
20222 !! html
20223 <p>X<span about="#mwt2" class="reference" 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="#cite_note-1">[1]</a></span></p>
20224 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</li></ol>
20225 !!end
20226
20227 # This test only works in wt2html now as the <references /> are always generated
20228 # unless selser is active. Once T72722 is fixed, we should add a changes test
20229 # here to ensure that unrelated changes don't add the new <references /> in
20230 # wt2wt.
20231 !! test
20232 References: 9. Generate missing references list at the end
20233 !! options
20234 parsoid
20235 !! wikitext
20236 A <ref>foo</ref>
20237 B <ref group="inexistent">bar</ref>
20238 !! html
20239 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2">[inexistent 1]</a></span></</p>
20240 <ol about="#mwt5" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20241 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
20242 </ol>
20243 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20244 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
20245 </ol>
20246 !! end
20247
20248 !! test
20249 Entities in ref name
20250 !! options
20251 parsoid
20252 !! wikitext
20253 <ref name="test &amp; me">hi</ref>
20254 <references />
20255 !! html
20256 <p><span about="#mwt2" class="reference" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p>
20257 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20258 <li id="cite_note-test_.26_me-1"><span rel="mw:referencedBy"><a href="#cite_ref-test_.26_me_1-0">↑</a></span> hi</li>
20259 </ol>
20260 !! end
20261
20262 # This test is wt2html only because we're permitting the serializer to produce
20263 # dirty diffs, normalizing the unclosed references to the self-closed version.
20264 !! test
20265 Generate references for unclosed references tag
20266 !! options
20267 parsoid=wt2html
20268 !! wikitext
20269 a<ref>foo</ref>
20270
20271 <references>
20272 !! html
20273 <p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20274
20275
20276 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20277 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
20278 !! end
20279
20280 !! test
20281 New reference serializes on its own line
20282 !! options
20283 parsoid=wt2wt,html2wt
20284 !! wikitext
20285 foo
20286 <references />
20287 !! html
20288 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20289 !! end
20290
20291 #--------- Test stripping of empty nodes in template content ----------
20292 !!test
20293 Empty LI and TR nodes should be stripped from template content
20294 !!wikitext
20295 {{EmptyLITest}}
20296 {{EmptyTRTest}}
20297 !!html/parsoid
20298 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20299 <li>a</li>
20300 <li>b</li>
20301 </ul>
20302 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20303 <tbody>
20304 <tr>
20305 <td>foo</td>
20306 </tr>
20307 <tr>
20308 <td>bar</td>
20309 </tr>
20310 </tbody>
20311 </table>
20312 !!end
20313
20314 !!test
20315 Empty LI and TR nodes should not be stripped from top-level content
20316 !!wikitext
20317 * a
20318 *
20319 * b
20320 {|
20321 |-
20322 |-
20323 |foo
20324 |}
20325 !!html/parsoid
20326 <ul>
20327 <li> a</li>
20328 <li></li>
20329 <li> b</li>
20330 </ul>
20331 <table>
20332 <tbody>
20333 <tr></tr>
20334 <tr>
20335 <td>foo</td>
20336 </tr>
20337 </tbody>
20338 </table>
20339 !!end
20340
20341 !!test
20342 Empty TR nodes should not be stripped if they have any attributes set
20343 !!wikitext
20344 {{EmptyTRWithHTMLAttrTest}}
20345 !!html/parsoid
20346 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20347 <tr align="center"></tr>
20348 <tr><td>foo</td></tr>
20349 <tr align="center"></tr>
20350 <tr><td>bar</td></tr>
20351 </table>
20352 !!end
20353
20354 #### ----------------------------------------------------------------
20355 #### The following section of tests are primarily to test
20356 #### wikitext escaping capabilities of Parsoid. Given that
20357 #### escaping can be done any number of ways, the wikitext (input)
20358 #### is always adjusted to reflect how Parsoid adds nowiki
20359 #### escape tags.
20360 ####
20361 #### We are marking several tests as parsoid-only since the
20362 #### HTML in the result section is different from what the
20363 #### PHP parser generates for it.
20364 #### ----------------------------------------------------------------
20365
20366
20367 #### --------------- Headings ---------------
20368 #### 0. Unnested
20369 #### 1. Nested inside html <h1>=foo=</h1>
20370 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20371 #### 3. Nested inside html with wikitext split by html tags
20372 #### 4. No escape needed
20373 #### 5. Empty headings <h1></h1>
20374 #### 6. Heading chars in SOL context
20375 #### ----------------------------------------
20376 !! test
20377 Headings: 0. Unnested
20378 !! options
20379 parsoid
20380 !! wikitext
20381 <nowiki>=foo=</nowiki>
20382
20383 <nowiki> =foo= </nowiki>
20384 <!--cmt-->
20385 <nowiki>=foo=</nowiki>
20386
20387 =foo''a''<nowiki>=</nowiki>
20388 !! html
20389 <p><span typeof="mw:Nowiki">=foo=</span></p>
20390
20391 <p><span typeof="mw:Nowiki"> =foo= </span>
20392 <!--cmt-->
20393 <span typeof="mw:Nowiki">=foo=</span></p>
20394
20395 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20396 !!end
20397
20398 # New headings and existing headings are handled differently
20399 !! test
20400 Headings: 1. Nested inside html
20401 !! options
20402 parsoid=html2wt
20403 !! html
20404 <h1>=foo=</h1>
20405 <h2>=foo=</h2>
20406 <h3>=foo=</h3>
20407
20408 <h1 data-parsoid=''>=foo=</h1>
20409 <h2 data-parsoid=''>=foo=</h2>
20410 <h3 data-parsoid=''>=foo=</h3>
20411 <h4 data-parsoid=''>=foo=</h4>
20412 <h5 data-parsoid=''>=foo=</h5>
20413 <h6 data-parsoid=''>=foo=</h6>
20414 !! wikitext
20415 = =foo= =
20416
20417 == =foo= ==
20418
20419 === =foo= ===
20420
20421 =<nowiki>=foo=</nowiki>=
20422 ==<nowiki>=foo=</nowiki>==
20423 ===<nowiki>=foo=</nowiki>===
20424 ====<nowiki>=foo=</nowiki>====
20425 =====<nowiki>=foo=</nowiki>=====
20426 ======<nowiki>=foo=</nowiki>======
20427
20428 !!end
20429
20430 !! test
20431 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20432 !! options
20433 parsoid=html2wt
20434 !! html
20435 <h1>foo</h1>*bar
20436 <h1>foo</h1>=bar
20437 <h1>foo</h1>=bar=
20438 !! wikitext
20439 = foo =
20440 <nowiki>*</nowiki>bar
20441
20442 = foo =
20443 =bar
20444
20445 = foo =
20446 <nowiki>=bar=</nowiki>
20447 !!end
20448
20449 !! test
20450 Headings: 3. Nested inside html with wikitext split by html tags
20451 !! options
20452 parsoid=html2wt,wt2wt
20453 !! wikitext
20454 = ='''bold'''<nowiki>foo=</nowiki> =
20455 !! html/parsoid
20456 <h1>=<b>bold</b>foo=</h1>
20457 !!end
20458
20459 !! test
20460 Headings: 4a. No escaping needed (testing just h1 and h2)
20461 !! wikitext
20462 = =foo =
20463
20464 = foo= =
20465
20466 = =foo= =
20467
20468 = =foo= bar =
20469
20470 == =foo ==
20471
20472 == foo= ==
20473
20474 = = =
20475
20476 = ''=''foo= =
20477 !! html/parsoid
20478 <h1>=foo</h1>
20479 <h1>foo=</h1>
20480 <h1> =foo= </h1>
20481 <h1>=foo= bar</h1>
20482 <h2>=foo</h2>
20483 <h2>foo=</h2>
20484 <h1>=</h1>
20485 <h1><i>=</i>foo=</h1>
20486 !!end
20487
20488 !! test
20489 Headings: 4b. No escaping needed (inside p-tags)
20490 !! options
20491 parsoid=html2wt
20492 !! html
20493 <p>===
20494 =foo= x
20495 =foo= <s></s>
20496 </p>
20497 !! wikitext
20498 ===
20499 =foo= x
20500 =foo= <s></s>
20501 !!end
20502
20503 !! test
20504 Headings: 5. Empty headings
20505 !! options
20506 parsoid
20507 !! wikitext
20508 =<nowiki/>=
20509
20510 ==<nowiki/>==
20511
20512 ===<nowiki/>===
20513
20514 ====<nowiki/>====
20515
20516 =====<nowiki/>=====
20517
20518 ======<nowiki/>======
20519 !! html
20520 <h1></h1>
20521 <h2></h2>
20522 <h3></h3>
20523 <h4></h4>
20524 <h5></h5>
20525 <h6></h6>
20526 !!end
20527
20528 !! test
20529 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20530 !! options
20531 parsoid
20532 !! wikitext
20533 <nowiki>=a=</nowiki>
20534
20535 <nowiki>=a=</nowiki>
20536
20537 <nowiki>=a=</nowiki>
20538
20539 <nowiki>=a=</nowiki>
20540 !! html
20541 <p>=a=</p>
20542 <p>=a= </p>
20543 <p>=a= </p>
20544 <p>=a= </p>
20545 !!end
20546
20547 !! test
20548 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20549 !! options
20550 parsoid
20551 !! wikitext
20552 <nowiki>=a=
20553 b</nowiki>
20554
20555 <nowiki>=a=
20556 b</nowiki>
20557
20558 <nowiki>=a=
20559 b</nowiki>
20560
20561 <nowiki>=a=
20562 b</nowiki>
20563 !! html
20564 <p>=a=
20565 b</p>
20566 <p>=a=
20567 b</p>
20568 <p>=a=
20569 b</p>
20570 <p>=a=
20571 b</p>
20572 </p>
20573 !!end
20574
20575 !! test
20576 Headings: 6c. Heading chars in SOL context (leading newline break)
20577 !! options
20578 parsoid
20579 !! wikitext
20580 a
20581 <nowiki>=b=</nowiki>
20582 !! html
20583 <p>a
20584 =b=</p>
20585 !!end
20586
20587 !! test
20588 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20589 !! options
20590 parsoid
20591 !! wikitext
20592 <!--c0--><nowiki>=a=</nowiki>
20593
20594 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20595 !! html
20596 <p><!--c0-->=a=</p>
20597 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20598 !!end
20599
20600 !! test
20601 Headings: 6d. Heading chars in SOL context (No escaping needed)
20602 !! options
20603 parsoid=html2wt
20604 !! html
20605 =a=<div>b</div>
20606 !! wikitext
20607 =a=<div>b</div>
20608 !!end
20609
20610 !! test
20611 Headings: 7. Insert a newline between new content and headings
20612 !! options
20613 parsoid=html2wt
20614 !! html
20615 <h2>NEW</h2>
20616 <p>new</p>
20617 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20618 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20619 !! wikitext
20620 == NEW ==
20621 new
20622
20623 ==A==
20624 a
20625
20626 !! end
20627
20628 #### --------------- Lists ---------------
20629 #### 0. Outside nests (*foo, etc.)
20630 #### 1. Nested inside html <ul><li>*foo</li></ul>
20631 #### 2. Inside definition lists
20632 #### 3. Only bullets at start should be escaped
20633 #### 4. No escapes needed
20634 #### 5. No unnecessary escapes
20635 #### 6. Escape bullets in SOL position
20636 #### 7. Escape bullets in a multi-line context
20637 #### ----------------------------------------
20638
20639 !! test
20640 Lists: 0. Outside nests
20641 !! wikitext
20642 <nowiki>*</nowiki>foo
20643
20644 <nowiki>#</nowiki>foo
20645
20646 <nowiki>;Foo:</nowiki>bar
20647 !! html
20648 <p>*foo
20649 </p><p>#foo
20650 </p><p>;Foo:bar
20651 </p>
20652 !!end
20653
20654 !! test
20655 Lists: 1. Nested inside html
20656 !! wikitext
20657 *<nowiki>*foo</nowiki>
20658
20659 *<nowiki>#foo</nowiki>
20660
20661 *<nowiki>:foo</nowiki>
20662
20663 *<nowiki>;foo</nowiki>
20664
20665 #<nowiki>*foo</nowiki>
20666
20667 #<nowiki>#foo</nowiki>
20668
20669 #<nowiki>:foo</nowiki>
20670
20671 #<nowiki>;foo</nowiki>
20672 !! html
20673 <ul><li>*foo</li></ul>
20674 <ul><li>#foo</li></ul>
20675 <ul><li>:foo</li></ul>
20676 <ul><li>;foo</li></ul>
20677 <ol><li>*foo</li></ol>
20678 <ol><li>#foo</li></ol>
20679 <ol><li>:foo</li></ol>
20680 <ol><li>;foo</li></ol>
20681
20682 !!end
20683
20684 !! test
20685 Lists: 2. Inside definition lists
20686 !! wikitext
20687 ;<nowiki>;foo</nowiki>
20688
20689 ;<nowiki>:foo</nowiki>
20690
20691 ;<nowiki>:foo</nowiki>
20692 :bar
20693
20694 :<nowiki>:foo</nowiki>
20695 !! html
20696 <dl><dt>;foo</dt></dl>
20697 <dl><dt>:foo</dt></dl>
20698 <dl><dt>:foo</dt>
20699 <dd>bar</dd></dl>
20700 <dl><dd>:foo</dd></dl>
20701
20702 !!end
20703
20704 !! test
20705 Lists: 3. Only bullets at start of text should be escaped
20706 !! wikitext
20707 *<nowiki>*foo*bar</nowiki>
20708
20709 *<nowiki>*foo</nowiki>''it''*bar
20710 !! html
20711 <ul><li>*foo*bar</li></ul>
20712 <ul><li>*foo<i>it</i>*bar</li></ul>
20713
20714 !!end
20715
20716 !! test
20717 Lists: 4. No escapes needed
20718 !! options
20719 parsoid
20720 !! wikitext
20721 *foo*bar
20722
20723 *''foo''*bar
20724
20725 *[[Foo]]: bar
20726
20727 *[[Foo]]*bar
20728 !! html
20729 <ul>
20730 <li>foo*bar
20731 </li>
20732 </ul>
20733 <ul>
20734 <li><i>foo</i>*bar
20735 </li>
20736 </ul>
20737 <ul>
20738 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20739 </li>
20740 </ul>
20741 <ul>
20742 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20743 </li>
20744 </ul>
20745 !!end
20746
20747 !! test
20748 Lists: 5. No unnecessary escapes
20749 !! wikitext
20750 * bar <span><nowiki>[[foo]]</nowiki></span>
20751
20752 * =bar <span><nowiki>[[foo]]</nowiki></span>
20753
20754 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20755
20756 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20757
20758 * =bar <span>foo]]</span>=
20759
20760 * <s></s>: a
20761
20762 * ''* foo''
20763 !! html
20764 <ul><li> bar <span>[[foo]]</span></li></ul>
20765 <ul><li> =bar <span>[[foo]]</span></li></ul>
20766 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20767 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20768 <ul><li> =bar <span>foo]]</span>=</li></ul>
20769 <ul><li> <s></s>: a</li></ul>
20770 <ul><li> <i>* foo</i></li></ul>
20771
20772 !!end
20773
20774 !! test
20775 Lists: 6. Escape bullets in SOL position
20776 !! options
20777 parsoid=html2wt
20778 !! html
20779 <p><!--cmt-->*foo</p>
20780 !! wikitext
20781 <!--cmt--><nowiki>*</nowiki>foo
20782 !!end
20783
20784 !! test
20785 Lists: 7. Escape bullets in a multi-line context
20786 !! wikitext
20787 a
20788 <nowiki>*</nowiki>b
20789 !! html
20790 <p>a
20791 *b
20792 </p>
20793 !!end
20794
20795 !! test
20796 Lists: 8. Escape colons only if not present in tags
20797 !! options
20798 parsoid=html2wt
20799 !! html
20800 <dl><dt>a:b<i>c:d</i></dt></dl>
20801 !! wikitext
20802 ; <nowiki>a:b</nowiki>''c:d''
20803 !! end
20804
20805 #### --------------- HRs ---------------
20806 #### 1. Single line
20807 #### -----------------------------------
20808
20809 !! test
20810 HRs: 1. Single line
20811 !! wikitext
20812 ----<nowiki>----</nowiki>
20813 ----=foo=
20814 ----*foo
20815 !! html+tidy
20816 <hr />
20817 <p>----</p>
20818 <hr />
20819 <p>=foo=</p>
20820 <hr />
20821 <p>*foo</p>
20822 !! end
20823
20824 #### --------------- Tables ---------------
20825 #### 1a. Simple example
20826 #### 1b. No escaping needed (!foo)
20827 #### 1c. No escaping needed (|foo)
20828 #### 1d. No escaping needed (|}foo)
20829 ####
20830 #### 2a. Nested in td (<td>foo|bar</td>)
20831 #### 2b. Nested in td (<td>foo||bar</td>)
20832 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20833 ####
20834 #### 3a. Nested in th (<th>foo!bar</th>)
20835 #### 3b. Nested in th (<th>foo!!bar</th>)
20836 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20837 ####
20838 #### 4a. Escape -
20839 #### 4b. Escape +
20840 #### 4c. No escaping needed
20841 #### --------------------------------------
20842
20843 !! test
20844 Tables: 1a. Simple example
20845 !! wikitext
20846 <nowiki>{|
20847 |}</nowiki>
20848 !! html
20849 <p>{|
20850 |}
20851 </p>
20852 !! end
20853
20854 !! test
20855 Tables: 1b. No escaping needed
20856 !! wikitext
20857 !foo
20858 !! html
20859 <p>!foo
20860 </p>
20861 !! end
20862
20863 !! test
20864 Tables: 1c. No escaping needed
20865 !! wikitext
20866 |foo
20867 !! html
20868 <p>|foo
20869 </p>
20870 !! end
20871
20872 !! test
20873 Tables: 1d. No escaping needed
20874 !! wikitext
20875 |}foo
20876 !! html
20877 <p>|}foo
20878 </p>
20879 !! end
20880
20881 !! test
20882 Tables: 2a. Nested in td
20883 !! options
20884 parsoid=html2wt
20885 !! html/parsoid
20886 <table><tbody><tr>
20887 <td>foo|bar</td></tr>
20888 <tr><td>x<div>a|b</div></td>
20889 </tbody></table>
20890 !! wikitext
20891 {|
20892 |<nowiki>foo|bar</nowiki>
20893 |-
20894 |x<div><nowiki>a|b</nowiki></div>
20895 |}
20896 !! html/php+tidy
20897 <table>
20898 <tr>
20899 <td>foo|bar</td>
20900 </tr>
20901 <tr>
20902 <td>x
20903 <div>a|b</div>
20904 </td>
20905 </tr>
20906 </table>
20907 !! end
20908
20909 !! test
20910 Tables: 2b. Nested in td
20911 !! options
20912 parsoid=html2wt
20913 !! html/parsoid
20914 <table><tbody><tr>
20915 <td>foo||bar</td>
20916 <td>a<i>b||c</i></td>
20917 <td>a<i><div>b||c</div></i></td>
20918 </tr></tbody></table>
20919 !! wikitext
20920 {|
20921 |<nowiki>foo||bar</nowiki>
20922 |a''<nowiki>b||c</nowiki>''
20923 |a''<div><nowiki>b||c</nowiki></div>''
20924 |}
20925 !! html/php
20926 <table>
20927 <tr>
20928 <td>foo||bar
20929 </td>
20930 <td>a<i>b||c</i>
20931 </td>
20932 <td>a<i><div>b||c</div></i>
20933 </td></tr></table>
20934
20935 !! end
20936
20937 !! test
20938 Tables: 2c. Nested in td -- no escaping needed
20939 !! wikitext
20940 {|
20941
20942 |foo!!bar
20943 |}
20944 !! html/*
20945 <table>
20946
20947 <tr>
20948 <td>foo!!bar
20949 </td></tr></table>
20950
20951 !! end
20952
20953 !! test
20954 Tables: 3a. Nested in th
20955 !! wikitext
20956 {|
20957
20958 !foo!bar
20959 |}
20960 !! html/*
20961 <table>
20962
20963 <tr>
20964 <th>foo!bar
20965 </th></tr></table>
20966
20967 !! end
20968
20969 !! test
20970 Tables: 3b. Nested in th
20971 !! options
20972 parsoid=html2wt
20973 !! html/parsoid
20974 <table><tbody>
20975 <tr><th>foo!!bar</th>
20976 <th><i>foo|bar</i></th>
20977 <th><i>foo!!bar</i></th>
20978 <th><i><span>foo!!bar</span></i></th>
20979 </tr></tbody></table>
20980 !! wikitext
20981 {|
20982 !<nowiki>foo!!bar</nowiki>
20983 !''<nowiki>foo|bar</nowiki>''
20984 !''<nowiki>foo!!bar</nowiki>''
20985 !''<span><nowiki>foo!!bar</nowiki></span>''
20986 |}
20987 !! html/php
20988 <table>
20989 <tr>
20990 <th>foo!!bar
20991 </th>
20992 <th><i>foo|bar</i>
20993 </th>
20994 <th><i>foo!!bar</i>
20995 </th>
20996 <th><i><span>foo!!bar</span></i>
20997 </th></tr></table>
20998
20999 !! end
21000
21001 !! test
21002 Tables: 3c. Nested in th
21003 !! options
21004 parsoid=html2wt
21005 !! html/parsoid
21006 <table><tbody>
21007 <tr><th>foo||bar</th>
21008 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21009 </tr></tbody></table>
21010 !! wikitext
21011 {|
21012 !<nowiki>foo||bar</nowiki>
21013 !<nowiki>foo||bar</nowiki>
21014 |}
21015 !! html/php
21016 <table>
21017 <tr>
21018 <th>foo||bar
21019 </th>
21020 <th>foo||bar
21021 </th></tr></table>
21022
21023 !! end
21024
21025 !! test
21026 Tables: 4a. Escape -
21027 !! options
21028 parsoid=html2wt
21029 !! html/*
21030 <table>
21031
21032 <tr>
21033 <th>-bar
21034 </th></tr>
21035 <tr>
21036 <td>-bar
21037 </td></tr></table>
21038
21039 !! wikitext
21040 {|
21041
21042 !-bar
21043
21044 |-
21045 |<nowiki>-bar</nowiki>
21046 |}
21047 !! end
21048
21049 !! test
21050 Tables: 4b. Escape +
21051 !! options
21052 parsoid=html2wt
21053 !! html/*
21054 <table>
21055
21056 <tr>
21057 <th>+bar
21058 </th></tr>
21059 <tr>
21060 <td>+bar
21061 </td></tr></table>
21062
21063 !! wikitext
21064 {|
21065
21066 !+bar
21067
21068 |-
21069 |<nowiki>+bar</nowiki>
21070 |}
21071 !! end
21072
21073 !! test
21074 Tables: 4c. No escaping needed
21075 !! wikitext
21076 {|
21077 |foo-bar
21078 |foo+bar
21079 |-
21080 |''foo''-bar
21081 |''foo''+bar
21082 |-
21083 |foo
21084 bar|baz
21085 +bar
21086 -bar
21087 |-
21088 |x
21089 <div>a|b</div>
21090 |}
21091 !! html/php
21092 <table>
21093 <tr>
21094 <td>foo-bar
21095 </td>
21096 <td>foo+bar
21097 </td></tr>
21098 <tr>
21099 <td><i>foo</i>-bar
21100 </td>
21101 <td><i>foo</i>+bar
21102 </td></tr>
21103 <tr>
21104 <td>foo
21105 <p>bar|baz
21106 +bar
21107 -bar
21108 </p>
21109 </td></tr>
21110 <tr>
21111 <td>x
21112 <div>a|b</div>
21113 </td></tr></table>
21114
21115 !! html/parsoid
21116 <table><tbody>
21117 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21118 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21119 <tr><td>foo
21120 <p>bar|baz
21121 +bar
21122 -bar</p></td></tr>
21123 <tr><td>x
21124 <div>a|b</div></td>
21125 </tbody></table>
21126 !! end
21127
21128 !! test
21129 Tables: 4d. No escaping needed
21130 !! wikitext
21131 {|
21132 |[[Foo]]-bar
21133 ||+1
21134 ||-2
21135 |}
21136 !! html/php
21137 <table>
21138 <tr>
21139 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21140 </td>
21141 <td>+1
21142 </td>
21143 <td>-2
21144 </td></tr></table>
21145
21146 !! html/parsoid
21147 <table>
21148 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21149 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21150 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21151 </tbody></table>
21152 !! end
21153
21154 !! test
21155 Tables: Digest broken attributes on table and tr tag
21156 !! options
21157 parsoid=wt2html
21158 !! wikitext
21159 {| || |} ++
21160 |- || || ++ --
21161 |- > [
21162 |}
21163 !! html
21164 <table>
21165 <tbody>
21166 <tr></tr>
21167 <tr></tr>
21168 </tbody></table>
21169 !! end
21170
21171 #### --------------- Links ----------------
21172 #### 1. Quote marks in link text
21173 #### 2. Wikilinks: Escapes needed
21174 #### 3. Wikilinks: No escapes needed
21175 #### 4. Extlinks: Escapes needed
21176 #### 5. Extlinks: No escapes needed
21177 #### --------------------------------------
21178 !! test
21179 Links 1. WikiLinks: No escapes needed
21180 !! wikitext
21181 [[Foo|Foo''boo'']]
21182 [[Foo|[Foobar]]]
21183 [[Foo|x [Foobar] x]]
21184 !! html/php
21185 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21186 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21187 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21188 </p>
21189 !! html/parsoid
21190 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21191 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21192 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21193 !! end
21194
21195 !! test
21196 Links 2. WikiLinks: Escapes needed
21197 !! options
21198 parsoid=html2wt
21199 !! html/parsoid
21200 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21201 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21202 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21203 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21204 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21205 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21206 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21207 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21208 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21209 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21210 !! wikitext
21211 [[Foo|<nowiki>Foobar]</nowiki>]]
21212 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21213 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21214 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21215 [[Foo|<nowiki>|Bar</nowiki>]]
21216 [[Foo|<nowiki>]]bar</nowiki>]]
21217 [[Foo|<nowiki>[[bar</nowiki>]]
21218 [[Foo|<nowiki>x [[ y</nowiki>]]
21219 [[Foo|<nowiki>x ]] y</nowiki>]]
21220 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21221 !! html/php
21222 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21223 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21224 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21225 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21226 <a href="/wiki/Foo" title="Foo">|Bar</a>
21227 <a href="/wiki/Foo" title="Foo">]]bar</a>
21228 <a href="/wiki/Foo" title="Foo">[[bar</a>
21229 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21230 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21231 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21232 </p>
21233 !! end
21234
21235 !! test
21236 Links 3. WikiLinks: No escapes needed
21237 !! wikitext
21238 [[Foo|[Foobar]]
21239 [[Foo|foo|bar]]
21240 !! html/php
21241 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21242 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21243 </p>
21244 !! html/parsoid
21245 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21246 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21247 !! end
21248
21249 !! test
21250 Links 4. ExtLinks: Escapes needed
21251 !! options
21252 parsoid=html2wt
21253 !! html/parsoid
21254 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21255 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21256 <p>[http://google.com]</p>
21257 <p>[http://google.com google]</p>
21258 !! wikitext
21259 [http://google.com <nowiki>[google]</nowiki>]
21260 [http://google.com <nowiki>google]</nowiki>]
21261
21262 <nowiki>[http://google.com]</nowiki>
21263
21264 <nowiki>[http://google.com google]</nowiki>
21265
21266 !! html/php
21267 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21268 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21269 </p><p>[http://google.com]
21270 </p><p>[http://google.com google]
21271 </p>
21272 !! end
21273
21274 !! test
21275 Links 5. ExtLinks: No escapes needed
21276 !! wikitext
21277 [http://google.com [google]
21278 !! html/php
21279 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21280 </p>
21281 !! html/parsoid
21282 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21283 !! end
21284
21285 !! test
21286 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21287 !! html/parsoid
21288 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21289 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21290 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21291 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21292 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21293 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21294 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21295 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21296 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21297 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21298 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21299 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21300 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21301 </p>
21302 !! wikitext
21303 x<nowiki/>http://example.com<nowiki/>y
21304 http://example.com<nowiki/>?x
21305 http://example.com<nowiki/>&x
21306 http://example.com<nowiki/>'x
21307 http://example.com<nowiki/>,x
21308 http://example.com<nowiki/>.x
21309 http://example.com<nowiki/>;x
21310 http://example.com<nowiki/>:x
21311 http://example.com<nowiki/>;x
21312 http://example.com<nowiki/>!x
21313 http://example.com<nowiki/>=x
21314 http://example.com<nowiki/>(x)
21315 http://example.com(x<nowiki/>)
21316 !! end
21317
21318 !! test
21319 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21320 !! html/parsoid
21321 <p>x
21322 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21323 y
21324 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21325 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21326 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21327 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21328 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21329 </p>
21330 !! wikitext
21331 x
21332 http://example.com
21333 y
21334 "http://example.com"
21335 (http://example.com)
21336 (http://example.com) foo
21337 http://example.com,
21338 http://example.com, foo
21339 !! html/php
21340 <p>x
21341 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21342 y
21343 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21344 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21345 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21346 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21347 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21348 </p>
21349 !! end
21350
21351 !! test
21352 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21353 !! html/parsoid
21354 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21355 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21356 !! wikitext
21357 http://example.com.,;:!?\
21358 -http://example.com:
21359 !! html/php
21360 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21361 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21362 </p>
21363 !! end
21364
21365 !! test
21366 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21367 !! html/parsoid
21368 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21369 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21370 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21371 !! wikitext
21372 RFC 123<nowiki/>4
21373 RFC 123<nowiki/>y
21374 X<nowiki/>RFC 123<nowiki/>y
21375 !! end
21376
21377 !! test
21378 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21379 !! html/parsoid
21380 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21381 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21382 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21383 </p>
21384 !! wikitext
21385 RFC 123?foo
21386 RFC 123&foo
21387 -RFC 123-
21388 !! html/php
21389 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21390 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21391 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21392 </p>
21393 !! end
21394
21395 !! test
21396 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21397 !! html/parsoid
21398 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21399 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21400 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21401 !! wikitext
21402 PMID 123<nowiki/>4
21403 PMID 123<nowiki/>y
21404 X<nowiki/>PMID 123<nowiki/>y
21405 !! end
21406
21407 !! test
21408 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21409 !! html/parsoid
21410 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21411 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21412 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21413 </p>
21414 !! wikitext
21415 PMID 123?foo
21416 PMID 123&foo
21417 -PMID 123-
21418 !! html/php
21419 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21420 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21421 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21422 </p>
21423 !! end
21424
21425 !! test
21426 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21427 !! html/parsoid
21428 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21429 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21430 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21431 </p>
21432 !! wikitext
21433 ISBN 1234567890<nowiki/>1
21434 ISBN 1234567890<nowiki/>x
21435 a<nowiki/>ISBN 1234567890<nowiki/>b
21436 !! end
21437
21438 !! test
21439 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21440 !! html/parsoid
21441 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21442 !! wikitext
21443 -ISBN 1234567890's
21444 !! html/php
21445 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21446 </p>
21447 !! end
21448
21449 !! test
21450 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21451 !! options
21452 parsoid=html2wt
21453 !! html/*
21454 <p>this is not a link: http://example.com
21455 </p>
21456 !! wikitext
21457 this is not a link: <nowiki>http://example.com</nowiki>
21458 !! end
21459
21460 !! test
21461 Links 15. Link trails can't become link prefixes.
21462 !! options
21463 language=is
21464 !! wikitext
21465 [[Söfnuður]]-[[00]]
21466 !! html/php
21467 <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>
21468 </p>
21469 !! html/parsoid
21470 <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>
21471 !! end
21472
21473 #### --------------- Quotes ---------------
21474 #### 1. Quotes inside <b> and <i>
21475 #### 2. Link fragments separated by <i> and <b> tags
21476 #### 3. Link fragments inside <i> and <b>
21477 #### 4. No escaping needed
21478 #### --------------------------------------
21479 !! test
21480 1a. Quotes inside <b> and <i>
21481 !! options
21482 parsoid=html2wt,wt2wt
21483 !! wikitext
21484 ''<nowiki/>'foo'''
21485 ''<nowiki>''foo''</nowiki>''
21486 ''<nowiki>'''foo'''</nowiki>''
21487 ''foo''<nowiki/>'s
21488 '''<nowiki/>'foo''''
21489 '''<nowiki>''foo''</nowiki>'''
21490 '''<nowiki>'''foo'''</nowiki>'''
21491 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21492 '''foo'''<nowiki/>'s
21493 '''foo''
21494 ''foo''<nowiki/>'
21495 ''foo'''<nowiki/>'
21496 '''foo''<nowiki/>'
21497 ''''foo'''
21498 '''foo'''<nowiki/>'
21499 ''''foo'''<nowiki/>'
21500 ''fools'<span> errand</span>''
21501 ''<span>fool</span>'s errand''
21502 '<nowiki/>''foo'' bar '''baz''
21503 a|!*#-:;+-~[]{}b'''x''
21504 !! html/*
21505 <p><i>'foo'</i>
21506 <i>''foo''</i>
21507 <i>'''foo'''</i>
21508 <i>foo</i>'s
21509 <b>'foo'</b>
21510 <b>''foo''</b>
21511 <b>'''foo'''</b>
21512 <b>foo'<i>bar'</i>baz</b>
21513 <b>foo</b>'s
21514 '<i>foo</i>
21515 <i>foo</i>'
21516 <i>foo'</i>'
21517 '<i>foo</i>'
21518 '<b>foo</b>
21519 <b>foo</b>'
21520 '<b>foo</b>'
21521 <i>fools'<span> errand</span></i>
21522 <i><span>fool</span>'s errand</i>
21523 '<i>foo</i> bar '<i>baz</i>
21524 a|!*#-:;+-~[]{}b'<i>x</i>
21525 </p>
21526 !! end
21527
21528 !! test
21529 1b. Quotes inside <b> and <i> with other tags on same line
21530 !! options
21531 parsoid=html2wt,wt2wt
21532 !! wikitext
21533 '''a'' foo ''[[bar]]''
21534 ''a''' foo ''[[bar]]''
21535 ''a''' foo '''{{echo|[[bar]]}}'''
21536 [[foo]] x'''[[bar]]''
21537 '''foo'' <ref>test</ref>
21538 '''foo'' <div title="name">test</div>
21539 '''foo'' and <br> bar
21540 <references />
21541 !! html
21542 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21543 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21544 <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>
21545 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21546 '<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"test"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
21547 '<i>foo</i> <div title="name">test</div>
21548 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21549 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
21550 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> test</li>
21551 </ol>
21552 !! end
21553
21554 !! test
21555 2. Link fragments separated by <i> and <b> tags
21556 !! wikitext
21557 [[''foo''<nowiki>hello]]</nowiki>
21558
21559 [['''foo'''<nowiki>hello]]</nowiki>
21560 !! html
21561 <p>[[<i>foo</i>hello]]
21562 </p><p>[[<b>foo</b>hello]]
21563 </p>
21564 !! end
21565
21566 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21567 # this is one of the shortcomings of this format
21568 !! test
21569 3. Link fragments inside <i> and <b>
21570 !! wikitext
21571 ''[[foo''<nowiki>]]</nowiki>
21572
21573 '''[[foo'''<nowiki>]]</nowiki>
21574 !! html
21575 <p><i>[[foo</i>]]
21576 </p><p><b>[[foo</b>]]
21577 </p>
21578 !! end
21579
21580 !! test
21581 4. No escaping needed
21582 !! wikitext
21583 '<span>''bar''</span>'
21584 '<span>'''bar'''</span>'
21585 'a:b'foo
21586 !! html
21587 <p>'<span><i>bar</i></span>'
21588 '<span><b>bar</b></span>'
21589 'a:b'foo
21590 </p>
21591 !! end
21592
21593 #### ----------- Paragraphs ---------------
21594 #### 1. No unnecessary escapes
21595 #### --------------------------------------
21596
21597 !! test
21598 1. No unnecessary escapes
21599 !! wikitext
21600 bar <span><nowiki>[[foo]]</nowiki></span>
21601
21602 =bar <span><nowiki>[[foo]]</nowiki></span>
21603
21604 [[bar <span><nowiki>[[foo]]</nowiki></span>
21605
21606 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21607
21608 =bar <span>foo]]</span><nowiki>=</nowiki>
21609 !! html
21610 <p>bar <span>[[foo]]</span>
21611 </p><p>=bar <span>[[foo]]</span>
21612 </p><p>[[bar <span>[[foo]]</span>
21613 </p><p>]]bar <span>[[foo]]</span>
21614 </p><p>=bar <span>foo]]</span>=
21615 </p>
21616 !!end
21617
21618 #### ----------------------- PRE --------------------------
21619 #### 1. Leading whitespace in SOL context should be escaped
21620 #### ------------------------------------------------------
21621 !! test
21622 1. Leading whitespace in SOL context should be escaped
21623 !! options
21624 parsoid
21625 !! wikitext
21626 <nowiki> </nowiki>a
21627
21628 <nowiki> </nowiki> a
21629
21630 <nowiki> </nowiki>a(tab)
21631
21632 <nowiki> </nowiki> a
21633 <!--cmt-->
21634 <nowiki> </nowiki> a
21635
21636 a
21637 <nowiki> </nowiki>b
21638
21639 a
21640 <nowiki> </nowiki>b
21641
21642 a
21643 <nowiki> </nowiki> b
21644 !! html
21645 <p> a</p>
21646 <p> a</p>
21647 <p> a(tab)</p>
21648 <p> a</p>
21649 <p><!--cmt--> a</p>
21650 <p>a
21651 b</p>
21652 <p>a
21653 b</p>
21654 <p>a
21655 b</p>
21656 !! end
21657
21658 !! test
21659 2. Leading whitespace in non-indent-pre contexts should not be escaped
21660 !! options
21661 parsoid
21662 !! wikitext
21663 foo <ref>''a''
21664 b</ref>
21665 <references />
21666 !! html
21667 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
21668 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
21669 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <i>a</i> b</li>
21670 </ol>
21671 !! end
21672
21673 !! test
21674 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21675 !! options
21676 parsoid
21677 !! wikitext
21678 <blockquote>
21679 a
21680 <span>b</span>
21681 c
21682 </blockquote>
21683 !! html
21684 <blockquote>
21685 <p>
21686 a
21687 <span>b</span>
21688 c</p>
21689 </blockquote>
21690 !! end
21691
21692 !! test
21693 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21694 !! options
21695 parsoid
21696 !! wikitext
21697 [[File:Foobar.jpg|thumb|caption]]
21698 !! html
21699 !! html/parsoid
21700 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
21701 !! end
21702
21703 !! test
21704 5. Nowiki escaping should account for indent-pres
21705 !! options
21706 parsoid=html2wt
21707 !! html
21708 <pre>==foo==</pre>
21709 !! wikitext
21710 ==foo==
21711 !! end
21712
21713 #### --------------- Behavior Switches --------------------
21714 !! test
21715 1. Valid behavior switches should be escaped
21716 !! options
21717 parsoid=html2wt
21718 !! html
21719 __TOC__
21720 <i>__TOC__</i>
21721 !! wikitext
21722 <nowiki>__TOC__</nowiki>
21723 ''<nowiki>__TOC__</nowiki>''
21724 !! end
21725
21726 !! test
21727 2. Invalid behavior switches should not be escaped
21728 !! options
21729 parsoid=html2wt
21730 !! html
21731 __TOO__
21732 __|__
21733 !! wikitext
21734 __TOO__
21735 __|__
21736 !! end
21737
21738 #### --------------- HTML tags ---------------
21739 #### 1. a tags
21740 #### 2. other tags
21741 #### 3. multi-line html tag
21742 #### 4. extension tags
21743 #### -----------------------------------------
21744 !! test
21745 1. a tags
21746 !! options
21747 parsoid
21748 !! wikitext
21749 <a href="http://google.com">google</a>
21750 !! html
21751 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21752 !! end
21753
21754 !! test
21755 2. other tags
21756 !! wikitext
21757 * <nowiki><div>foo</div></nowiki>
21758 * <nowiki><div style="color:red">foo</div></nowiki>
21759 * <nowiki><td></nowiki>
21760 !! html
21761 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
21762 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
21763 <li> &lt;td&gt;</li></ul>
21764
21765 !! end
21766
21767 !! test
21768 3. multi-line html tag
21769 !! wikitext
21770 <nowiki><div
21771 >foo</div
21772 ></nowiki>
21773 !! html
21774 <p>&lt;div
21775 &gt;foo&lt;/div
21776 &gt;
21777 </p>
21778 !! end
21779
21780 !! test
21781 4. extension tags
21782 !! wikitext
21783 <nowiki><ref>foo</ref></nowiki>
21784
21785 <nowiki><ref>bar</nowiki>
21786
21787 baz<nowiki></ref></nowiki>
21788 !! html
21789 <p>&lt;ref&gt;foo&lt;/ref&gt;
21790 </p><p>&lt;ref&gt;bar
21791 </p><p>baz&lt;/ref&gt;
21792 </p>
21793 !! end
21794
21795 #### --------------- Others ---------------
21796 !! test
21797 Escaping nowikis
21798 !! wikitext
21799 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21800 !! html
21801 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21802 </p>
21803 !! end
21804
21805 ## The quote-char in the input is necessary for triggering the bug
21806 !! test
21807 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21808 !! options
21809 parsoid=wt2wt,html2wt
21810 !! wikitext
21811 foo's bar :
21812 !! html
21813 <p>foo's bar :</p>
21814 !! end
21815
21816 !! test
21817
21818 Tag-like HTML structures are passed through as text
21819 !! wikitext
21820 <x y>
21821
21822 <x.y>
21823
21824 <x-y>
21825
21826 1>2
21827
21828 x<y
21829
21830 a>b
21831
21832 1<d e>f
21833 !! html
21834 <p>&lt;x y&gt;
21835 </p><p>&lt;x.y&gt;
21836 </p><p>&lt;x-y&gt;
21837 </p><p>1&gt;2
21838 </p><p>x&lt;y
21839 </p><p>a&gt;b
21840 </p><p>1&lt;d e&gt;f
21841 </p>
21842 !! end
21843
21844
21845 # This was a bug in the PHP parser (see bug 17663 and its dups,
21846 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21847 !! test
21848 Tag names followed by punctuation should not be recognized as tags
21849 !! wikitext
21850 <s.ome> text
21851 !! html
21852 <p>&lt;s.ome&gt; text
21853 </p>
21854 !! end
21855
21856 !! test
21857 HTML tag with necessary entities in attributes
21858 !! wikitext
21859 <span title="&amp;amp;">foo</span>
21860 !! html
21861 <p><span title="&amp;amp;">foo</span>
21862 </p>
21863 !! end
21864
21865 !! test
21866 HTML tag with 'unnecessary' entity encoding in attributes
21867 !! wikitext
21868 <span title="&amp;">foo</span>
21869 !! html
21870 <p><span title="&amp;">foo</span>
21871 </p>
21872 !! end
21873
21874 !! test
21875 HTML tag with broken attribute value quoting
21876 !! wikitext
21877 <span title="Hello world>Foo</span>
21878 !! html/php
21879 <p><span>Foo</span>
21880 </p>
21881 !! html/parsoid
21882 <p><span title="Hello world">Foo</span>
21883 </p>
21884 !! end
21885
21886 !! test
21887 Parsoid-only: HTML tag with broken attribute value quoting
21888 !! options
21889 parsoid
21890 !! wikitext
21891 <span title="Hello world>Foo</span>
21892 !! html
21893 <p><span title="Hello world">Foo</span>
21894 </p>
21895 !! end
21896
21897 !! test
21898 Table with broken attribute value quoting
21899 !! wikitext
21900 {|
21901 | title="Hello world|Foo
21902 |}
21903 !! html/php
21904 <table>
21905 <tr>
21906 <td>Foo
21907 </td></tr></table>
21908
21909 !! html/parsoid
21910 <table>
21911 <tr>
21912 <td title="Hello world">Foo
21913 </td></tr></table>
21914
21915 !! end
21916
21917 !! test
21918 Table with broken attribute value quoting on consecutive lines
21919 !! wikitext
21920 {|
21921 | title="Hello world|Foo
21922 | style="color:red|Bar
21923 |}
21924 !! html/php
21925 <table>
21926 <tr>
21927 <td>Foo
21928 </td>
21929 <td>Bar
21930 </td></tr></table>
21931
21932 !! html/parsoid
21933 <table><tbody>
21934 <tr>
21935 <td title="Hello world">Foo
21936 </td><td style="color: red">Bar
21937 </td></tr></tbody></table>
21938
21939 !! end
21940
21941 !! test
21942 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21943 !! options
21944 parsoid
21945 !! wikitext
21946 {{}}
21947 !! html
21948 {{}}
21949 !! end
21950
21951 !! test
21952 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21953 !! options
21954 parsoid
21955 !! wikitext
21956 }}{{
21957 !! html
21958 }}{{
21959 !! end
21960
21961 !!test
21962 Accept empty td cell attribute
21963 !! wikitext
21964 {|
21965 | align="center" | foo || |
21966 |}
21967 !! html
21968 <table>
21969 <tr>
21970 <td align="center"> foo </td>
21971 <td>
21972 </td></tr></table>
21973
21974 !!end
21975
21976 !!test
21977 Non-empty attributes in th-cells
21978 !! wikitext
21979 {|
21980 ! Foo !! style="color: red" | Bar
21981 |}
21982 !! html
21983 <table>
21984 <tr>
21985 <th> Foo </th>
21986 <th style="color: red"> Bar
21987 </th></tr></table>
21988
21989 !!end
21990
21991 !!test
21992 Accept empty attributes in th-cells
21993 !! wikitext
21994 {|
21995 !| foo !!| bar
21996 |}
21997 !! html
21998 <table>
21999 <tr>
22000 <th> foo </th>
22001 <th> bar
22002 </th></tr></table>
22003
22004 !!end
22005
22006 !!test
22007 Empty table rows go away
22008 !! wikitext
22009 {|
22010 | Hello
22011 | there
22012 |- class="foo"
22013 |-
22014 |}
22015 !! html
22016 <table>
22017 <tr>
22018 <td> Hello
22019 </td>
22020 <td> there
22021 </td></tr>
22022
22023 </table>
22024
22025 !! end
22026
22027 ###
22028 ### Parsoid-centric tests for testing RTing of inter-element separators
22029 ### Edge cases not tested by existing parser tests and specific to
22030 ### Parsoid-specific serialization strategies.
22031 ###
22032
22033 !!test
22034 RT-ed inter-element separators should be valid separators
22035 !! wikitext
22036 {|
22037 |- [[foo]]
22038 |}
22039 !! html
22040 <table>
22041
22042 </table>
22043
22044 !!end
22045
22046 # Parsoid-only since PHP parser relies on Tidy for correct output
22047 !!test
22048 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22049 !!options
22050 parsoid
22051 !! wikitext
22052 {|
22053 |<small>foo
22054 bar
22055 |}
22056
22057 {|
22058 |<small>foo<small>
22059 |}
22060 !! html
22061 <table>
22062 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22063 <p>bar</p></small></td></tr>
22064 </tbody></table>
22065
22066 <table>
22067 <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>
22068 </tbody></table>
22069 !!end
22070
22071 !!test
22072 Empty TD followed by TD with tpl-generated attribute
22073 !! wikitext
22074 {|
22075 |-
22076 |
22077 |{{echo|style='color:red'}}|foo
22078 |}
22079 !! html
22080 <table>
22081
22082 <tr>
22083 <td>
22084 </td>
22085 <td>foo
22086 </td></tr></table>
22087
22088 !!end
22089
22090 !!test
22091 Indented table with an empty td
22092 !! wikitext
22093 {|
22094 |-
22095 |
22096 |foo
22097 |}
22098 !! html
22099 <table>
22100
22101 <tr>
22102 <td>
22103 </td>
22104 <td>foo
22105 </td></tr></table>
22106
22107 !!end
22108
22109 ## We have some newline diffs RT-ing this edge case
22110 ## and it is not important enough -- we seem to be emitting
22111 ## at most 2 newlines after a </tr> and this is unrelated to
22112 ## the issue from T85627 that this is testing.
22113 !!test
22114 Indented table with blank lines in between (T85627)
22115 !! options
22116 parsoid=wt2html
22117 !! wikitext
22118 {|
22119 |foo
22120
22121
22122 |}
22123 !! html
22124 <table>
22125
22126 <tr>
22127 <td>foo
22128 </td></tr></table>
22129
22130 !!end
22131
22132 !!test
22133 Indented block & table
22134 !! wikitext
22135 <div>foo</div>
22136 {|
22137 |foo
22138 |}
22139 !! html/php
22140 <div>foo</div>
22141 <table>
22142 <tr>
22143 <td>foo
22144 </td></tr></table>
22145
22146 !! html/parsoid
22147 <div data-parsoid='{"stx":"html"}'>foo</div>
22148 <table><tbody>
22149 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22150 </tbody></table>
22151 !!end
22152
22153 !! test
22154 Indent and comment before table row
22155 !! wikitext
22156 {|
22157 <!--hi-->|-
22158 | there
22159 |}
22160 !! html/php
22161 <table>
22162
22163 <tr>
22164 <td> there
22165 </td></tr></table>
22166
22167 !! html/parsoid
22168 <table>
22169 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22170 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22171 </tbody></table>
22172 !! end
22173
22174 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22175 !!test
22176 Empty TR followed by a template-generated TR
22177 !!options
22178 parsoid
22179 !! wikitext
22180 {|
22181 |-
22182 {{echo|<tr><td>foo</td></tr>}}
22183 |}
22184 !! html
22185 <table>
22186 <tbody>
22187 <tr></tr>
22188 <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}}]}'>
22189 <td>foo</td></tr>
22190 </tbody></table>
22191 !!end
22192
22193 ## PHP and parsoid output differ for this, and since this is primarily
22194 ## for testing Parsoid's serializer, marking this Parsoid only
22195 !!test
22196 Empty TR followed by mixed-ws-comment line should RT correctly
22197 !!options
22198 parsoid
22199 !! wikitext
22200 {|
22201 |-
22202 <!--c-->
22203 |-
22204 <!--c--> <!--d-->
22205 |}
22206 !! html
22207 <table>
22208 <tbody>
22209 <tr></tr>
22210 <!--c-->
22211 <tr>
22212 <!--c--> </tr><!--d-->
22213 </tbody></table>
22214
22215 !!end
22216
22217 !!test
22218 Multi-line image caption generated by templates with/without trailing newlines
22219 !! wikitext
22220 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22221 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22222 !! html/parsoid
22223 <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" 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>
22224 <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" 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>
22225 !!end
22226
22227 !! test
22228 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22229 !! options
22230 parsoid=html2wt
22231 !! html
22232 <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>
22233
22234 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22235 !! wikitext
22236 <includeonly>foo</includeonly>
22237 new para
22238
22239 [[./Category:Foo]]
22240
22241 = new heading =
22242 !! end
22243
22244 ## PHP emits broken html for this, and since this is primarily
22245 ## a Parsoid serializer test, marking this Parsoid only
22246 !!test
22247 Improperly nested inline or quotes tags with whitespace in between
22248 !!options
22249 parsoid
22250 !! wikitext
22251 <span> <s>x</span> </s>
22252 ''' ''x''' ''
22253 !! html
22254 <p><span> <s>x</s></span><s> </s>
22255 <b> <i>x</i></b><i> </i>
22256 </p>
22257 !!end
22258
22259 !!test
22260 Encapsulate protected attributes from wt
22261 !!options
22262 parsoid
22263 !! wikitext
22264 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22265 !! html
22266 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
22267 </body>
22268 !!end
22269
22270 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22271 ## Having nested or stray pre tags results in the attempt to add duplicates,
22272 ## causing an assertion fail. This test tries to prevent that situation.
22273 !!test
22274 Ensure ParagraphWrapper can deal with stray closing pre tags
22275 !!options
22276 parsoid=wt2html
22277 !! wikitext
22278 plain text</pre>
22279 !! html
22280 plain text
22281 !!end
22282
22283 !!test
22284 1. Ensure fostered text content is wrapped in element nodes
22285 !!options
22286 parsoid=wt2html
22287 !! wikitext
22288 <table>hi</table><table>ho</table>
22289 !! html
22290 <p>hi</p>
22291 <table></table>
22292 <p>ho</p>
22293 <table></table>
22294 !!end
22295
22296 !!test
22297 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22298 !!options
22299 parsoid=wt2html,wt2wt
22300 !! wikitext
22301 <table>
22302 <tr> || ||
22303 <td> a
22304 </table>
22305 !! html
22306 <p> || ||
22307 </p><table>
22308 <tbody><tr><td> a</td></tr>
22309 </tbody></table>
22310 !!end
22311
22312 !!test
22313 Encapsulation properly handles null DSR information from foster box
22314 !!options
22315 parsoid=wt2html,wt2wt
22316 !! wikitext
22317 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22318 !! html
22319 <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>
22320 !!end
22321
22322 !!test
22323 1. Encapsulate foster-parented transclusion content
22324 !!options
22325 parsoid=wt2wt,wt2html
22326 !! wikitext
22327 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22328 !! html
22329 <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>
22330 <tbody>
22331 <tr>
22332 <td>bar</td>
22333 </tr>
22334 </tbody>
22335 </table>
22336 !!end
22337
22338 !!test
22339 2. Encapsulate foster-parented transclusion content
22340 !!options
22341 parsoid=wt2wt,wt2html
22342 !! wikitext
22343 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22344 !! html
22345 <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>
22346 <table>
22347 <tbody>
22348 <tr>
22349 <td>bar</td>
22350 </tr>
22351 </tbody>
22352 </table>
22353 !!end
22354
22355 !!test
22356 3. Encapsulate foster-parented transclusion content
22357 !!options
22358 parsoid=wt2wt,wt2html
22359 !! wikitext
22360 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22361 !! html
22362 <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;]}">
22363 <p>foo</p>
22364 </div>
22365 <table>
22366 <tbody>
22367 <tr>
22368 <td>bar</td>
22369 </tr>
22370 </tbody>
22371 </table>
22372 !!end
22373
22374 !!test
22375 4. Encapsulate foster-parented transclusion content
22376 !!options
22377 parsoid=wt2wt,wt2html
22378 !! wikitext
22379 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22380 !! html
22381 <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;]}">
22382 <p>foo</p>
22383 </div>
22384 <table>
22385 <tbody>
22386 <tr>
22387 <td>bar</td>
22388 </tr>
22389 </tbody>
22390 </table>
22391 !!end
22392
22393 !!test
22394 5. Encapsulate foster-parented transclusion content
22395 !!options
22396 parsoid=wt2wt,wt2html
22397 !! wikitext
22398 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22399 !! html
22400 <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>
22401 <table>
22402 <tbody>
22403 <tr>
22404 <td>
22405 <div>
22406 <p>foo</p>
22407 </div>
22408 </td>
22409 </tr>
22410 </tbody>
22411 </table>
22412 !!end
22413
22414 !!test
22415 6. Encapsulate foster-parented transclusion content
22416 !!options
22417 parsoid=wt2wt,wt2html
22418 !! wikitext
22419 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22420 !! html
22421 <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>
22422 <table>
22423 <tbody>
22424 <tr>
22425 <td>
22426 <div>
22427 <p>foo</p>
22428 </div>
22429 </td>
22430 </tr>
22431 </tbody>
22432 </table>
22433 <p>ok</p>
22434 !!end
22435
22436 !!test
22437 7. Encapsulate foster-parented transclusion content
22438 !!options
22439 parsoid=wt2wt,wt2html
22440 !! wikitext
22441 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22442 !! html
22443 <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>
22444 <table>
22445 <tbody>
22446 <tr>
22447 <td>bar</td>
22448 </tr>
22449 </tbody>
22450 </table>
22451 !!end
22452
22453 !!test
22454 8. Encapsulate foster-parented transclusion content
22455 !!options
22456 parsoid=wt2wt,wt2html
22457 !! wikitext
22458 {{echo|a
22459 }}{|{{echo|style='color:red'}}
22460 |-
22461 |b
22462 |}
22463 !! html
22464 <p 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\n&quot;}},&quot;i&quot;:0}}]}">a</p><p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;{|&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;style&quot;:{&quot;wt&quot;:&quot;'color:red'&quot;}},&quot;i&quot;:0}},&quot;\n|-\n|b\n|}&quot;]}">{{{1}}}</p><table>
22465 <tbody>
22466 <tr>
22467 <td>b</td>
22468 </tr>
22469 </tbody>
22470 </table>
22471 !!end
22472
22473 !!test
22474 9. Encapsulate foster-parented transclusion content
22475 !!options
22476 parsoid=wt2wt,wt2html
22477 !! wikitext
22478 <table>{{echo|hi</table>hello}}
22479 !! html
22480 <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","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
22481 !!end
22482
22483 !!test
22484 Table in fosterable position
22485 !!options
22486 parsoid=wt2html,wt2wt
22487 !! wikitext
22488 {{OpenTable}}
22489 <div>
22490 {|
22491 |}
22492 </div>
22493 |}
22494 !! html
22495 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
22496 </span>
22497 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22498
22499 <table>
22500 </table>
22501 !!end
22502
22503 # Parsoid only for bug 64747
22504 !! test
22505 Properly encapsulate empty-content transclusions in fosterable positions
22506 !! wikitext
22507 <table>
22508 {{#if:|
22509 <td>foo</td>
22510 }}
22511 </table>
22512 !! html/parsoid
22513 <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","spc":["","","",""]}]]}'>
22514
22515 </table>
22516 !! end
22517
22518 !!test
22519 Support <object> element with .data attribute
22520 !!options
22521 parsoid=html2wt
22522 !! html
22523 <object data="test.swf"></object>
22524 !! wikitext
22525 <object data="test.swf"></object>
22526 !!end
22527
22528 !! test
22529 Don't block XML namespace declaration
22530 !! wikitext
22531 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22532 !! html/php
22533 <p><span>MediaWiki</span>
22534 </p>
22535 !! html/parsoid
22536 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22537 !! end
22538
22539 # -----------------------------------------------------------------
22540 # The following section of tests are primarily to spec requirements
22541 # around serialization of new/edited content.
22542 #
22543 # All these tests are marked Parsoid html2wt and html2html only
22544 # ----------------------------------------------------------------
22545
22546 # 'mi' is a localinterwiki prefix as well as a language
22547 !! test
22548 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22549 !! options
22550 parsoid=html2wt
22551 !! html
22552 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22553 !! wikitext
22554 [[Foo]]
22555 !! end
22556
22557 !! test
22558 New wiki links (href variations)
22559 !! options
22560 parsoid=html2wt
22561 !! html
22562 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22563 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22564 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22565 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22566 !! wikitext
22567 [[Foo_bar]]
22568 [[Foo_bar]]
22569 [[Foo_bar]]
22570 [[Toxine bactérienne]]
22571 !! end
22572
22573 !! test
22574 New wiki links (content string variations)
22575 !! options
22576 parsoid=html2wt
22577 !! html
22578 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22579 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22580 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22581 !! wikitext
22582 [[Foo_bar]]
22583 [[Foo bar]]
22584 [[Foo_bar|./Foo_bar]]
22585 !! end
22586
22587 !! test
22588 New category links (href variations)
22589 !! options
22590 parsoid=html2wt
22591 !! html
22592 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22593 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22594 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22595 !! wikitext
22596 [[Category:Toxine bactérienne]]
22597 [[Category:Toxine bactérienne]]
22598 [[Category:Toxine bactérienne]]
22599 !! end
22600
22601 !! test
22602 New sol transparent links don't need indent-pre nowiki protection
22603 !! options
22604 parsoid=html2wt
22605 language=de
22606 !! html
22607 <link rel="mw:PageProp/redirect" href="./Main_Page">
22608 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
22609 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
22610 !! wikitext
22611 #WEITERLEITUNG [[Main Page]]
22612 <!-- this is good --> [[Category:Good]]
22613 <!-- this is great --> [[Kategorie:Great]]
22614 !! end
22615
22616 !! test
22617 New interlanguage links (href variations)
22618 !! options
22619 parsoid=html2wt
22620 !! html
22621 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22622 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22623 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22624 !! wikitext
22625 [[es:Toxine bactérienne]]
22626 [[es:Toxine_bactérienne]]
22627 [[es:Toxine_bactérienne]]
22628 !! end
22629
22630 !! test
22631 Image: Modifying size of an image (1)
22632 !! options
22633 parsoid={
22634 "modes": ["wt2wt"],
22635 "changes": [
22636 ["img[height]", "attr", "height", "22"],
22637 ["img[width]", "attr", "width", "200"]
22638 ]
22639 }
22640 !! wikitext
22641 [[Image:Foobar.jpg|230x230px]]
22642 !! wikitext/edited
22643 [[Image:Foobar.jpg|200x200px]]
22644 !!end
22645
22646 !! test
22647 Image: Modifying size of an image (2)
22648 !! options
22649 parsoid={
22650 "modes": ["wt2wt"],
22651 "changes": [
22652 ["img[height]", "attr", "height", "100"],
22653 ["img[width]", "attr", "width", "500"]
22654 ]
22655 }
22656 !! wikitext
22657 [[Image:Foobar.jpg|230x230px]]
22658 !! wikitext/edited
22659 [[Image:Foobar.jpg|500x500px]]
22660 !!end
22661
22662 # Change in size is ignored so long as class='mw-default-size'
22663 !! test
22664 Image: Modifying size of an image (3)
22665 !! options
22666 parsoid={
22667 "modes": ["wt2wt"],
22668 "changes": [
22669 ["figure[class]", "removeClass", "mw-default-size"],
22670 ["figure img", "attr", "height", "19"],
22671 ["figure img", "attr", "width", "170"]
22672 ]
22673 }
22674 !! wikitext
22675 [[Image:Foobar.jpg|thumb]]
22676 !! wikitext/edited
22677 [[Image:Foobar.jpg|thumb|170x170px]]
22678 !!end
22679
22680 !! test
22681 Image: Modifying alignment of an image (bug 48665)
22682 !! options
22683 parsoid={
22684 "modes": ["wt2wt"],
22685 "changes": [
22686 ["figure[class]", "removeClass", "mw-halign-right"],
22687 ["figure[class]", "addClass", "mw-halign-left"]
22688 ]
22689 }
22690 !! wikitext
22691 [[Image:Foobar.jpg|thumb|caption|right]]
22692 !! wikitext/edited
22693 [[Image:Foobar.jpg|thumb|caption|left]]
22694 !! end
22695
22696 !! test
22697 Image: Modifying mw-default-size of an frameless image (bug 62805)
22698 !! options
22699 parsoid={
22700 "modes": ["wt2wt"],
22701 "changes": [
22702 ["figure.mw-default-size", "removeClass", "mw-default-size"]
22703 ]
22704 }
22705 !! wikitext
22706 [[Image:Foobar.jpg|frameless|right]]
22707 !! wikitext/edited
22708 [[Image:Foobar.jpg|frameless|right|220x220px]]
22709 !! end
22710
22711 !! test
22712 Image: Modifying valign of an image (bug 49221)
22713 !! options
22714 parsoid={
22715 "modes": ["wt2wt"],
22716 "changes": [
22717 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22718 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22719 ]
22720 }
22721 !! wikitext
22722 [[File:Foobar.jpg|20px|middle]]
22723 !! wikitext/edited
22724 [[File:Foobar.jpg|20px|text-top]]
22725 !! end
22726
22727 !! test
22728 Image: Modifying alt attribute of an image (bug 56400)
22729 !! options
22730 parsoid={
22731 "modes": ["wt2wt"],
22732 "changes": [
22733 ["img[alt]", "attr", "alt", "some alternate edited text"]
22734 ]
22735 }
22736 !! wikitext
22737 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22738 !! wikitext/edited
22739 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22740 !!end
22741
22742 !! test
22743 Image: Modifying caption of an image
22744 !! options
22745 parsoid={
22746 "modes": ["wt2wt"],
22747 "changes": [
22748 ["figcaption", "text", "new caption"]
22749 ]
22750 }
22751 !! wikitext
22752 [[Image:Foobar.jpg|thumb|original caption]]
22753 !! wikitext/edited
22754 [[Image:Foobar.jpg|thumb|new caption]]
22755 !!end
22756
22757 !! test
22758 Image: empty alt attribute (bug 48924)
22759 !! options
22760 parsoid
22761 !! wikitext
22762 [[File:Foobar.jpg|thumb|alt=|bar]]
22763 !! html
22764 <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" 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>
22765 !! end
22766
22767 #!! test
22768 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22769 #!! options
22770 #parsoid=html2wt
22771 #language=ar
22772 #!! html
22773 #<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" height="20" width="180"/></a></figure>
22774 #!! wikitext
22775 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22776 #!! end
22777
22778 !! test
22779 Image: Block level image should have \n before and after
22780 !! wikitext
22781 123
22782 [[File:Foobar.jpg|right|thumb|150x150px]]
22783 456
22784 !! html/parsoid
22785 <p>123</p>
22786 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="17" width="150"/></a></figure>
22787 <p>456</p>
22788 !!end
22789
22790 !! test
22791 Image: New block level image should have \n before and after (existing content)
22792 !! wikitext
22793 123
22794 [[File:Foobar.jpg|right|thumb|150x150px]]
22795 456
22796 !! html/parsoid
22797 <p>123</p>
22798 <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" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
22799 <p>456</p>
22800 !!end
22801
22802 !! test
22803 Image: upright option (parsoid)
22804 !! options
22805 parsoid
22806 !! wikitext
22807 [[File:Foobar.jpg|thumb|upright|caption]]
22808 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22809 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22810 !! html
22811 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
22812 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
22813 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
22814 !!end
22815
22816 !! test
22817 Image: upright option is ignored on inline and frame images (parsoid)
22818 !! options
22819 parsoid
22820 !! wikitext
22821 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22822 !! html
22823 <p><span 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" height="57" width="500"/></a></span></p>
22824 !!end
22825
22826 !! test
22827 Image: from basic HTML (1)
22828 !! options
22829 parsoid=html2wt
22830 !! html/parsoid
22831 <span typeof="mw:Image">
22832 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22833 </span>
22834 !! wikitext
22835 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22836 !! end
22837
22838 !! test
22839 Image: from basic HTML (2)
22840 !! options
22841 parsoid=html2wt
22842 !! html/parsoid
22843 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22844 !! wikitext
22845 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22846 !! end
22847
22848 !! test
22849 Image: from basic HTML (3)
22850 !! options
22851 parsoid=html2wt
22852 !! html/parsoid
22853 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22854 !! wikitext
22855 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22856 !! end
22857
22858 !! test
22859 Image: from basic HTML (4)
22860 !! options
22861 parsoid=html2wt
22862 !! html/parsoid
22863 <img src="File:Foobar.jpg">
22864 !! wikitext
22865 [[File:Foobar.jpg|link=]]
22866 !! end
22867
22868 !! test
22869 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22870 !! options
22871 parsoid=html2wt
22872 !! html
22873 <ul>
22874 <li><p>foo</p></li>
22875 </ul>
22876 !! wikitext
22877 * foo
22878 !! end
22879
22880 !! test
22881 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22882 !! options
22883 parsoid=html2wt
22884 !! html
22885 <ul> <li>foo</li></ul>
22886 !! wikitext
22887 * foo
22888 !! end
22889
22890 !! test
22891 Don't strip leading whitespace when handling indent-pre suppressing tags
22892 !! options
22893 parsoid=html2wt
22894 !! html
22895 <table>
22896 <tr><td> indented row</td></tr>
22897 </table>
22898 <blockquote><p>
22899 <b>This is very bold of you!</b>
22900 </p>
22901 <table><tr><td>
22902 indented cell (no pre-wrapping!)
22903 </td></tr></table>
22904 </blockquote>
22905 <p>foo</p>
22906 <div>bar</div>
22907 !! wikitext
22908 {|
22909 | indented row
22910 |}
22911 <blockquote>
22912 '''This is very bold of you!'''
22913
22914 {|
22915 |
22916 indented cell (no pre-wrapping!)
22917 |}
22918 </blockquote>
22919 foo
22920 <div>bar</div>
22921 !! end
22922
22923 !! test
22924 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22925 !! options
22926 parsoid=html2wt
22927 !! wikitext
22928 foo
22929 <nowiki> </nowiki><span>bar</span>
22930
22931 <span>foo2
22932 <nowiki> </nowiki></span>bar2
22933
22934 <div>foo</div>
22935 <nowiki> </nowiki><span>bar</span>
22936
22937 <div>
22938 <nowiki> </nowiki><span>foo</span>
22939 </div>
22940 !! html
22941 <p>foo</p>
22942 <span>bar</span>
22943
22944 <span>foo2
22945 </span>bar2
22946
22947 <div>foo</div>
22948 <span>bar</span>
22949
22950 <div>
22951 <span>foo</span>
22952 </div>
22953 !! end
22954
22955 !! test
22956 Lists: Add space after bullets
22957 !! options
22958 parsoid=html2wt
22959 !! html
22960 <ul>
22961 <li>foo</li>
22962 <li> bar</li>
22963 <li><span> baz</span></li>
22964 </ul>
22965 !! wikitext
22966 * foo
22967 * bar
22968 * <span> baz</span>
22969 !! end
22970
22971 !! test
22972 Lists: Dont insert newlines in a serialized list item.
22973 !! options
22974 parsoid=html2wt
22975 !! html
22976 <ul><li>a<br>b</li><li>c</li></ul>
22977 !! wikitext
22978 * a<br>b
22979 * c
22980 !! end
22981
22982 !! test
22983 Headings: Add space before/after == (Bug 51744)
22984 !! options
22985 parsoid=html2wt
22986 !! html
22987 <h2>foo</h2>
22988 <h2> bar</h2>
22989 <h2>baz </h2>
22990 <h2><span> baz</span></h2>
22991 !! wikitext
22992 == foo ==
22993
22994 == bar ==
22995
22996 == baz ==
22997
22998 == <span> baz</span> ==
22999 !! end
23000
23001 !! test
23002 Headings: Force metas to serialize before/after
23003 !! options
23004 parsoid=html2wt
23005 !! html
23006 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23007 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23008
23009 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23010 !! wikitext
23011 == hello there ==
23012 [[Category:A1]]
23013
23014 [[Category:A2]]
23015 == hi pal ==
23016
23017 <!--foo--> [[Category:A3]]
23018 == how goes it ==
23019 !! end
23020
23021 !! test
23022 Parsoid: Serialize positional parameters with = in them as named parameter
23023 !! options
23024 parsoid=html2wt
23025 !! html
23026 <p about="#mwt1" typeof="mw:Transclusion"
23027 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23028
23029 <p about="#mwt1" typeof="mw:Transclusion"
23030 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23031
23032 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23033 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23034 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' 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>
23035 !! wikitext
23036 {{echo|1 = f=oo}}
23037
23038 {{echo|1 = f=oo|2 = bar}}
23039
23040 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23041 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23042 {{echo|<nowiki>f=oo</nowiki>|bar}}
23043 !! end
23044
23045 !! test
23046 Parsoid: Serialize positional parameters with = in extlink as named parameter
23047 !! options
23048 parsoid=html2wt
23049 !! html
23050 <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>
23051 !! wikitext
23052 {{echo|1 = http://stuff?is=ok}}
23053 !! end
23054
23055 !! test
23056 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23057 !! options
23058 parsoid=html2wt
23059 !! html
23060 <div>a<p>b</p></div>
23061 <div>a
23062 <p>b</p></div>
23063 <div>
23064 a
23065 <p>b</p></div>
23066 !! wikitext
23067 <div>a
23068 b
23069 </div>
23070 <div>a
23071 b
23072 </div>
23073 <div>
23074 a
23075
23076 b
23077 </div>
23078 !! end
23079
23080 !! test
23081 Substrings resembling wikitext in hrefs should not get nowiki escapes
23082 !! options
23083 parsoid=html2wt
23084 !! html
23085 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23086 !! wikitext
23087 [[Foo''bar''baz]]
23088 !! end
23089
23090 #-----------------------------
23091 # I/B quote minimization tests
23092 #-----------------------------
23093
23094 !! test
23095 1. I/B quote minimization: wikitext-only tags should be combined
23096 !! options
23097 parsoid=html2wt
23098 !! html
23099 <p><i>A</i><i>B</i></p>
23100 <p><b>A</b><b>B</b></p>
23101 <p><i>A</i><b><i>B</i></b></p>
23102 <p><b>A</b><i><b>B</b></i></p>
23103 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23104 <p><i><b>A</b></i><i><b>B</b></i></p>
23105 <p><i><b>A</b></i><b><i>B</i></b></p>
23106 <p><b><i>A</i></b><i><b>B</b></i></p>
23107 !! wikitext
23108 ''AB''
23109
23110 '''AB'''
23111
23112 ''A'''B'''''
23113
23114 '''A''B'''''
23115
23116 '''A''BC''D'''
23117
23118 '''''AB'''''
23119
23120 '''''AB'''''
23121
23122 '''''AB'''''
23123 !! end
23124
23125 !! test
23126 2. I/B quote minimization: wikitext and html tags should not be combined
23127 !! options
23128 parsoid=html2wt
23129 !! html
23130 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23131 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23132 !! wikitext
23133 ''A''<i>B</i>
23134
23135 ''A''<nowiki/>'''<i>B</i>'''
23136 !! end
23137
23138 !! test
23139 3. I/B quote minimization: templated content stops minimization
23140 !! options
23141 parsoid=html2wt
23142 !! html
23143 <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>
23144 <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>
23145 !! wikitext
23146 ''A''{{echo|''B''}}
23147
23148 ''A''{{echo|'''''B'''''}}
23149 !! end
23150
23151 !! test
23152 4. I/B quote minimization: new content should be mimimized with adjacent old content
23153 !! options
23154 parsoid=html2wt
23155 !! html
23156 <p><i>A</i><i>B</i></p>
23157 <p><b>A</b><b>B</b></p>
23158 <p><i>A</i><b><i>B</i></b></p>
23159 !! wikitext
23160 ''AB''
23161
23162 '''AB'''
23163
23164 ''A'''B'''''
23165 !! end
23166
23167 !! test
23168 5a. Merge adjacent quote nodes if they've been edited
23169 !! options
23170 parsoid={
23171 "modes": ["wt2wt"],
23172 "changes": [
23173 ["p", "contents", "remove", ":contains('b')"]
23174 ]
23175 }
23176 !! wikitext
23177 ''a''b''c''
23178 !! wikitext/edited
23179 ''ac''
23180 !! end
23181
23182 !! test
23183 5b. Merge adjacent quote nodes if they've been edited
23184 !! options
23185 parsoid={
23186 "modes": ["wt2wt"],
23187 "changes": [
23188 ["#x", "remove"]
23189 ]
23190 }
23191 !! wikitext
23192 ''a''<span id="x">b</span>''c''
23193 !! wikitext/edited
23194 ''ac''
23195 !! end
23196
23197 #------------------------------------
23198 # End of I/B quote minimization tests
23199 #------------------------------------
23200
23201 !!test
23202 Bug 54262: New entities
23203 !! options
23204 parsoid=html2wt
23205 !! wikitext
23206 &nbsp;
23207 !! html
23208 <span typeof="mw:Entity">&nbsp;</span>
23209 !! end
23210
23211 ## Note that there is no wikitext output for 'unknownproperty' ##
23212 ## Unknown magic words are silently dropped ##
23213
23214 !! test
23215 Magic words
23216 !! options
23217 parsoid=html2wt
23218 !! html
23219 <meta property='mw:PageProp/toc' />
23220 <meta property='mw:PageProp/notoc' />
23221 <meta property='mw:PageProp/forcetoc' />
23222 <meta property='mw:PageProp/index' />
23223 <meta property='mw:PageProp/noindex' />
23224 <meta property='mw:PageProp/nogallery' />
23225 <meta property='mw:PageProp/noeditsection' />
23226 <meta property='mw:PageProp/notitleconvert' />
23227 <meta property='mw:PageProp/nocontentconvert' />
23228 <meta property='mw:PageProp/unknownproperty' />
23229 !! wikitext
23230 __TOC__
23231 __NOTOC__
23232 __FORCETOC__
23233 __INDEX__
23234 __NOINDEX__
23235 __NOGALLERY__
23236 __NOEDITSECTION__
23237 __NOTITLECONVERT__
23238 __NOCONTENTCONVERT__
23239 !! end
23240
23241 !! test
23242 Consecutive <pre>s should not get merged
23243 !! options
23244 parsoid=html2wt,html2html
23245 !! html
23246 <pre>a</pre><pre>b</pre>
23247
23248 <pre>c
23249 </pre><pre>
23250 d</pre>
23251
23252 <pre>e
23253
23254 </pre><pre>
23255
23256 f</pre>
23257 !! wikitext
23258 a
23259
23260 b
23261
23262 c
23263
23264 d
23265
23266 e
23267
23268
23269
23270 f
23271 !! end
23272
23273 !! test
23274 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23275 !! options
23276 parsoid=html2wt
23277 !! html
23278 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23279 !! wikitext
23280 [[Special:BookSources/1234567890|ISBN 1234567895]]
23281 !! end
23282
23283 !! test
23284 Edited RFC links not serializable as RFC links should serialize as extlinks
23285 !! options
23286 parsoid=html2wt
23287 !! html
23288 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23289 !! wikitext
23290 [//tools.ietf.org/html/rfc123 New RFC]
23291 !! end
23292
23293 !! test
23294 Edited PMID links not serializable as PMID links should serialize as extlinks
23295 !! options
23296 parsoid=html2wt
23297 !! html
23298 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23299 !! wikitext
23300 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23301 !! end
23302
23303 !! test
23304 WTS of autolinks with trailing/surrounding context
23305 !! options
23306 parsoid=html2wt
23307 !! html/parsoid
23308 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23309 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23310 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23311 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23312 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23313 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23314 !! wikitext
23315 http://cscott.net<nowiki/>'''foo'''
23316
23317 http://cscott.net<b>foo</b>
23318
23319 '''http://cscott.net<nowiki/>'''
23320
23321 '''http://cscott.net '''
23322
23323 '''http://cscott.net<nowiki/>x'''
23324
23325 http://cscott.net<nowiki/>x
23326 !! end
23327
23328 !! test
23329 WTS of autolinks with nowikis (round-trip)
23330 !! wikitext
23331 x<nowiki/>http://cscott.net<nowiki/>x
23332 !! html/parsoid
23333 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23334 !! end
23335
23336 # this is the "easy" test because it leaves in place all the
23337 # data-parsoid information indicating this is an autolink
23338 !! test
23339 WTS of autolinks with escapes (editing)
23340 !! options
23341 parsoid={
23342 "modes": ["wt2wt"],
23343 "changes": [
23344 [ "meta", "remove" ]
23345 ]
23346 }
23347 !! wikitext
23348 x<nowiki/>http://cscott.net<nowiki/>x
23349 !! wikitext/edited
23350 x<nowiki/>http://cscott.net<nowiki/>x
23351 !! end
23352
23353 !! test
23354 Edited Redirect link should emit a non-piped wikitext link
23355 !! options
23356 parsoid=html2wt
23357 !! html
23358 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23359 !! wikitext
23360 #REDIRECT [[Bar]]
23361 !! end
23362
23363 !! test
23364 T75121: Infer extension name from typeOf if data-mw is not present
23365 !! options
23366 parsoid=html2wt
23367 !! html
23368 <div typeOf="mw:Extension/foo"></div>
23369 !! wikitext
23370 <foo />
23371 !! end
23372
23373 # -----------------------------------------------------------------
23374 # End of section for Parsoid-only html2wt tests for serialization
23375 # of new content
23376 # -----------------------------------------------------------------
23377
23378 TODO:
23379 more images
23380 more tables
23381 character entities
23382 and much more
23383 Try for 100% code coverage