Tidy up tidy usage
[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" aria-hidden="true" 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" aria-hidden="true" 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" aria-hidden="true" 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 <blockquote|>a</blockquote>
1213
1214 <b→> doesn't terminate </b→>
1215
1216 <bä> doesn't terminate </bä>
1217
1218 <boo> doesn't terminate </boo>
1219
1220 <s.foo> doesn't terminate </s.foo>
1221
1222 <sub-ID#1>
1223 !! html
1224 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1225 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1226 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1227 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1228 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1229 </p><p>&lt;sub-ID#1&gt;
1230 </p>
1231 !! end
1232
1233 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1234 # If the non-word-character tag made it through the sanitizer, tidy
1235 # would munge it up.
1236 !! test
1237 Non-word characters don't terminate tag names + tidy
1238 !! wikitext
1239 <blockquote|>a</blockquote>
1240
1241 <b→> doesn't terminate </b→>
1242
1243 <bä> doesn't terminate </bä>
1244
1245 <boo> doesn't terminate </boo>
1246
1247 <s.foo> doesn't terminate </s.foo>
1248
1249 <sub-ID#1>
1250 !! html+tidy
1251 <p>&lt;blockquote|&gt;a</p>
1252 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1253 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1254 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1255 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1256 <p>&lt;sub-ID#1&gt;</p>
1257 !! end
1258
1259 ###
1260 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1261 ### This checks that HTML5 tags (with non-word characters in the tag
1262 ### name) make it safely through the parser -- the Sanitizer will
1263 ### munge them later, as it should.
1264 ###
1265 !! test
1266 Non-word characters are valid in extension tags (T19663)
1267 !! wikitext
1268 <tåg>tåg</tåg>
1269 !! html
1270 <pre>
1271 'tåg'
1272 array (
1273 )
1274 </pre>
1275
1276 !! end
1277
1278 !! test
1279 Isolated close tags should be treated as literal text (bug 52760)
1280 !! wikitext
1281 </b>
1282
1283 <s.foo>s</s>
1284 !! html+tidy
1285 <p>&lt;s.foo&gt;s</p>
1286 !! end
1287
1288 ###
1289 ### Special characters
1290 ###
1291
1292 !! test
1293 Bare pipe character (bug 52363)
1294 !! wikitext
1295 |
1296 !! html
1297 <p>|
1298 </p>
1299 !! end
1300
1301 !! test
1302 Bare pipe character from a template (bug 52363)
1303 !! wikitext
1304 {{pipe}}
1305 !! html
1306 <p>|
1307 </p>
1308 !! end
1309
1310 ###
1311 ### <nowiki> test cases
1312 ###
1313
1314 !! test
1315 <nowiki> unordered list
1316 !! wikitext
1317 <nowiki>* This is not an unordered list item.</nowiki>
1318 !! html
1319 <p>* This is not an unordered list item.
1320 </p>
1321 !! end
1322
1323 !! test
1324 <nowiki> spacing
1325 !! wikitext
1326 <nowiki>Lorem ipsum dolor
1327
1328 sed abit.
1329 sed nullum.
1330
1331 :and a colon
1332 </nowiki>
1333 !! html
1334 <p>Lorem ipsum dolor
1335
1336 sed abit.
1337 sed nullum.
1338
1339 :and a colon
1340
1341 </p>
1342 !! end
1343
1344 !! test
1345 nowiki 3
1346 !! wikitext
1347 :There is not nowiki.
1348 :There is <nowiki>nowiki</nowiki>.
1349
1350 #There is not nowiki.
1351 #There is <nowiki>nowiki</nowiki>.
1352
1353 *There is not nowiki.
1354 *There is <nowiki>nowiki</nowiki>.
1355 !! html
1356 <dl><dd>There is not nowiki.</dd>
1357 <dd>There is nowiki.</dd></dl>
1358 <ol><li>There is not nowiki.</li>
1359 <li>There is nowiki.</li></ol>
1360 <ul><li>There is not nowiki.</li>
1361 <li>There is nowiki.</li></ul>
1362
1363 !! end
1364
1365 !! test
1366 Entities inside <nowiki>
1367 !! wikitext
1368 <nowiki>&lt;</nowiki>
1369 !! html
1370 <p>&lt;
1371 </p>
1372 !! end
1373
1374 !! test
1375 Entities inside template parameters
1376 !! options
1377 parsoid
1378 !! wikitext
1379 {{echo|&ndash;}}
1380 !! html
1381 <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>
1382 !! end
1383
1384 !! test
1385 Properly escape nowiki when combined with other wiki markup
1386 !! options
1387 parsoid=html2wt
1388 !! html
1389 <p>* &lt;/nowiki&gt; tag</p>
1390 !! wikitext
1391 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1392 !! end
1393
1394 ###
1395 ### Comments
1396 ###
1397 !! test
1398 Comments and Indent-Pre
1399 !! wikitext
1400 <!-- comment 1 --> asdf
1401
1402 <!-- comment 1 --> asdf
1403 <!-- comment 2 -->
1404
1405 <!-- comment 1 --> asdf
1406 <!-- comment 2 -->xyz
1407
1408 <!-- comment 1 --> asdf
1409 <!-- comment 2 --> xyz
1410 !! html
1411 <pre>asdf
1412 </pre>
1413 <pre>asdf
1414 </pre>
1415 <pre>asdf
1416 </pre>
1417 <p>xyz
1418 </p>
1419 <pre>asdf
1420 xyz
1421 </pre>
1422 !! end
1423
1424 !! test
1425 Comment test 2a
1426 !! wikitext
1427 asdf
1428 <!-- comment 1 -->
1429 jkl
1430 !! html
1431 <p>asdf
1432 jkl
1433 </p>
1434 !! end
1435
1436 !! test
1437 Comment test 2b
1438 !! wikitext
1439 asdf
1440 <!-- comment 1 -->
1441
1442 jkl
1443 !! html
1444 <p>asdf
1445 </p><p>jkl
1446 </p>
1447 !! end
1448
1449 !! test
1450 Comment test 3
1451 !! wikitext
1452 asdf
1453 <!-- comment 1 -->
1454 <!-- comment 2 -->
1455 jkl
1456 !! html
1457 <p>asdf
1458 jkl
1459 </p>
1460 !! end
1461
1462 !! test
1463 Comment test 4
1464 !! wikitext
1465 asdf<!-- comment 1 -->jkl
1466 !! html
1467 <p>asdfjkl
1468 </p>
1469 !! end
1470
1471 !! test
1472 Comment spacing
1473 !! wikitext
1474 a
1475 <!-- foo --> b <!-- bar -->
1476 c
1477 !! html
1478 <p>a
1479 </p>
1480 <pre> b
1481 </pre>
1482 <p>c
1483 </p>
1484 !! end
1485
1486 !! test
1487 Comment whitespace
1488 !! wikitext
1489 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1490 !! html
1491
1492 !! end
1493
1494 !! test
1495 Comment semantics and delimiters
1496 !! wikitext
1497 <!-- --><!----><!-----><!------>
1498 !! html
1499
1500 !! end
1501
1502 !! test
1503 Comment semantics and delimiters, redux
1504 !! wikitext
1505 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1506 -- foo -- funky huh? ... -->
1507 !! html
1508
1509 !! end
1510
1511 !! test
1512 Comment semantics and delimiters: directors cut
1513 !! wikitext
1514 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1515 everything starting with < followed by !-- until the first -- and > we see,
1516 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1517 -->-->
1518 !! html
1519 <p>--&gt;
1520 </p>
1521 !! end
1522
1523 !! test
1524 Comment semantics: nesting
1525 !! wikitext
1526 <!--<!-- no, we're not going to do anything fancy here -->-->
1527 !! html
1528 <p>--&gt;
1529 </p>
1530 !! end
1531
1532 !! test
1533 Comment semantics: unclosed comment at end
1534 !! wikitext
1535 <!--This comment will run out to the end of the document
1536 !! html
1537
1538 !! end
1539
1540 # Bug 58184: document parsoid's behaviour
1541 !! test
1542 Suppress comment closing tag in lenient browsers
1543 !! options
1544 parsoid=wt2html,html2html
1545 !! wikitext
1546 <!-- Browsers--!> think this is closed -->
1547 !! html/php
1548
1549 !! html/parsoid
1550 <!-- Browsers--¡> think this is closed -->
1551 !! end
1552
1553 !! test
1554 Comment in template title
1555 !! wikitext
1556 {{f<!---->oo}}
1557 !! html
1558 <p>FOO
1559 </p>
1560 !! end
1561
1562 !! test
1563 Comment on its own line post-expand
1564 !! wikitext
1565 a
1566 {{blank}}<!---->
1567 b
1568 !! html
1569 <p>a
1570 </p><p>b
1571 </p>
1572 !! end
1573
1574 !! test
1575 Comment on its own line post-expand with non-significant whitespace
1576 !! wikitext
1577 a
1578 {{blank}} <!---->
1579 b
1580 !! html
1581 <p>a
1582 </p><p>b
1583 </p>
1584 !! end
1585
1586 !! test
1587 Multiple comments should still parse as SOL-transparent
1588 !! options
1589 parsoid=wt2html,wt2wt
1590 !! wikitext
1591 <!--c1-->*a
1592 <!--c2--><!--c3--><!--c4-->*b
1593 !! html
1594 <ul>
1595 <li>a
1596 </li>
1597 <li>b
1598 </li>
1599 </ul>
1600 !! end
1601
1602 ###
1603 ### paragraph wrapping tests
1604 ###
1605 !! test
1606 No block tags
1607 !! wikitext
1608 a
1609
1610 b
1611 !! html
1612 <p>a
1613 </p><p>b
1614 </p>
1615 !! end
1616
1617 !! test
1618 Block tag on one line (<div>)
1619 !! wikitext
1620 a <div>foo</div>
1621
1622 b
1623 !! html
1624 a <div>foo</div>
1625 <p>b
1626 </p>
1627 !! html+tidy
1628 <p>a</p>
1629 <div>foo</div>
1630 <p>b</p>
1631 !! end
1632
1633 !! test
1634 Block tag on one line (<blockquote>)
1635 !! wikitext
1636 a <blockquote>foo</blockquote>
1637
1638 b
1639 !! html
1640 a <blockquote>foo</blockquote>
1641 <p>b
1642 </p>
1643 !! html+tidy
1644 <p>a</p>
1645 <blockquote>
1646 <p>foo</p>
1647 </blockquote>
1648 <p>b</p>
1649 !! end
1650
1651 !! test
1652 Block tag on both lines (<div>)
1653 !! wikitext
1654 a <div>foo</div>
1655
1656 b <div>foo</div>
1657 !! html
1658 a <div>foo</div>
1659 b <div>foo</div>
1660
1661 !! html+tidy
1662 <p>a</p>
1663 <div>foo</div>
1664 <p>b</p>
1665 <div>foo</div>
1666 !! end
1667
1668 !! test
1669 Block tag on both lines (<blockquote>)
1670 !! wikitext
1671 a <blockquote>foo</blockquote>
1672
1673 b <blockquote>foo</blockquote>
1674 !! html
1675 a <blockquote>foo</blockquote>
1676 b <blockquote>foo</blockquote>
1677
1678 !! html+tidy
1679 <p>a</p>
1680 <blockquote>
1681 <p>foo</p>
1682 </blockquote>
1683 <p>b</p>
1684 <blockquote>
1685 <p>foo</p>
1686 </blockquote>
1687 !! end
1688
1689 !! test
1690 Multiple lines without block tags
1691 !! wikitext
1692 <div>foo</div> a
1693 b
1694 c
1695 d<!--foo--> e
1696 x <div>foo</div> z
1697 !! html
1698 <div>foo</div> a
1699 <p>b
1700 c
1701 d e
1702 </p>
1703 x <div>foo</div> z
1704
1705 !! html+tidy
1706 <div>foo</div>
1707 <p>a</p>
1708 <p>b c d e</p>
1709 <p>x</p>
1710 <div>foo</div>
1711 <p>z</p>
1712 !! end
1713
1714 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1715 # So, we have a separate section for Parsoid. We don't want
1716 # to mimic this stripping behavior in Parsoid. It affects
1717 # editing experience and also requires us to maintain additional
1718 # info for RT-ing.
1719 !! test
1720 Empty lines between lines with block tags
1721 !! wikitext
1722 <div></div>
1723
1724
1725 <div></div>a
1726
1727 b
1728 <div>a</div>b
1729
1730 <div>b</div>d
1731
1732
1733 <div>e</div>
1734 !! html
1735 <div></div>
1736 <p><br />
1737 </p>
1738 <div></div>a
1739 <p>b
1740 </p>
1741 <div>a</div>b
1742 <div>b</div>d
1743 <p><br />
1744 </p>
1745 <div>e</div>
1746
1747 !! html+tidy
1748 <p><br /></p>
1749 <p>a</p>
1750 <p>b</p>
1751 <div>a</div>
1752 <p>b</p>
1753 <div>b</div>
1754 <p>d</p>
1755 <p><br /></p>
1756 <div>e</div>
1757 !! html/parsoid
1758 <div data-parsoid='{"stx":"html"}'></div>
1759
1760 <p><br /></p>
1761 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1762
1763 <p>b</p>
1764 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1765
1766 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1767
1768 <p><br /></p>
1769 <div data-parsoid='{"stx":"html"}'>e</div>
1770 !! end
1771
1772 ## PHP parser emits output which is broken
1773 !! test
1774 Unclosed HTML p-tags should be handled properly
1775 !! wikitext
1776 <div><p>foo</div>
1777 a
1778
1779 b
1780 !! html/php+tidy
1781 <div>
1782 <p>foo</p>
1783 </div>
1784 <p>a</p>
1785 <p>b</p>
1786 !! html/parsoid
1787 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1788 <p>a</p>
1789 <p>b</p>
1790 !! end
1791
1792 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1793 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1794 ## them for now.
1795 !! test
1796 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1797 !! options
1798 parsoid=wt2html
1799 !! wikitext
1800 a [[Category:A1]] [[Category:A2]]
1801 [[Category:A3]]
1802 [[Category:A4]]
1803 !! html/parsoid
1804 <p>a</p>
1805 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1806 !! end
1807
1808 !! test
1809 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1810 !! options
1811 parsoid=wt2html
1812 !! wikitext
1813 [[Category:A1]]a
1814 !! html/parsoid
1815 <link href="Category:A1"/><p>a</p>
1816 !! end
1817
1818 ###
1819 ### Preformatted text
1820 ###
1821 !! test
1822 Preformatted text
1823 !! wikitext
1824 This is some
1825 Preformatted text
1826 With ''italic''
1827 And '''bold'''
1828 And a [[Main Page|link]]
1829 !! html
1830 <pre>This is some
1831 Preformatted text
1832 With <i>italic</i>
1833 And <b>bold</b>
1834 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1835 </pre>
1836 !! end
1837
1838 !! test
1839 Tabs don't trigger preformatted text
1840 !! wikitext
1841 This is not
1842 preformatted text.
1843 This is preformatted text.
1844 So is this.
1845 !! html
1846 <p> This is not
1847 preformatted text.
1848 </p>
1849 <pre>This is preformatted text.
1850 So is this.
1851 </pre>
1852 !! end
1853
1854 !! test
1855 Ident preformatting with inline content
1856 !! wikitext
1857 a
1858 ''b''
1859 !! html
1860 <pre>a
1861 <i>b</i>
1862 </pre>
1863 !! end
1864
1865 !! test
1866 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1867 !! wikitext
1868 <pre><nowiki>
1869 <b>
1870 <cite>
1871 <em>
1872 </nowiki></pre>
1873 !! html
1874 <pre>
1875 &lt;b&gt;
1876 &lt;cite&gt;
1877 &lt;em&gt;
1878 </pre>
1879
1880 !! end
1881
1882 !! test
1883 Regression with preformatted in <center>
1884 !! wikitext
1885 <center>
1886 Blah
1887 </center>
1888 !! html
1889 <center>
1890 <pre>Blah
1891 </pre>
1892 </center>
1893
1894 !! end
1895
1896 !! test
1897 Bug 52763: Preformatted in <blockquote>
1898 !! wikitext
1899 <blockquote>
1900 Blah
1901 {|
1902 |
1903 indented cell (no pre-wrapping!)
1904 |}
1905 </blockquote>
1906 !! html
1907 <blockquote>
1908 <p> Blah
1909 </p>
1910 <table>
1911 <tr>
1912 <td>
1913 <p> indented cell (no pre-wrapping!)
1914 </p>
1915 </td></tr></table>
1916 </blockquote>
1917
1918 !! end
1919
1920 !! test
1921 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1922 !! wikitext
1923 <blockquote>
1924 Foo
1925
1926 Bar
1927 </blockquote>
1928 !! html
1929 <blockquote>
1930 <p>Foo
1931 </p><p>Bar
1932 </p>
1933 </blockquote>
1934
1935 !! end
1936
1937 !! test
1938 Bug 15491: <ins>/<del> in blockquote
1939 !! wikitext
1940 <blockquote>
1941 Foo <del>bar</del> <ins>baz</ins> quux
1942 </blockquote>
1943 !! html
1944 <blockquote>
1945 <p>Foo <del>bar</del> <ins>baz</ins> quux
1946 </p>
1947 </blockquote>
1948
1949 !! end
1950
1951 # Note that the p-wrapping is newline sensitive, which could be
1952 # considered a bug: tidy will wrap only the 'Foo' in the example
1953 # below in a <p> tag. (see comment 23-25 of bug #6200)
1954 !! test
1955 Bug 15491: <ins>/<del> in blockquote (2)
1956 !! wikitext
1957 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1958 </blockquote>
1959 !! html
1960 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1961 </blockquote>
1962
1963 !! html+tidy
1964 <blockquote>
1965 <p>Foo</p>
1966 <del>bar</del> <ins>baz</ins> quux</blockquote>
1967 !! end
1968
1969 !! test
1970 <pre> with attributes (bug 3202)
1971 !! wikitext
1972 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1973 !! html
1974 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1975
1976 !! end
1977
1978 !! test
1979 <pre> with width attribute (bug 3202)
1980 !! wikitext
1981 <pre width="8">Narrow screen goodies</pre>
1982 !! html
1983 <pre width="8">Narrow screen goodies</pre>
1984
1985 !! end
1986
1987 !! test
1988 <pre> with forbidden attribute (bug 3202)
1989 !! wikitext
1990 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1991 !! html
1992 <pre width="8">Narrow screen goodies</pre>
1993
1994 !! end
1995
1996 !! test
1997 Entities inside <pre>
1998 !! wikitext
1999 <pre>&lt;</pre>
2000 !! html
2001 <pre>&lt;</pre>
2002
2003 !! end
2004
2005 !! test
2006 <pre> with forbidden attribute values (bug 3202)
2007 !! wikitext
2008 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2009 !! html
2010 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2011
2012 !! end
2013
2014 !! test
2015 <nowiki> inside <pre> (bug 13238)
2016 !! wikitext
2017 <pre>
2018 <nowiki>
2019 </pre>
2020 <pre>
2021 <nowiki></nowiki>
2022 </pre>
2023 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2024 !! html
2025 <pre>
2026 &lt;nowiki&gt;
2027 </pre>
2028 <pre>
2029
2030 </pre>
2031 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2032
2033 !! end
2034
2035 !! test
2036 <nowiki> and <pre> preference (first one wins)
2037 !! wikitext
2038 <pre>
2039 <nowiki>
2040 </pre>
2041 </nowiki>
2042 </pre>
2043
2044 <nowiki>
2045 <pre>
2046 <nowiki>
2047 </pre>
2048 </nowiki>
2049 </pre>
2050
2051 !! html
2052 <pre>
2053 &lt;nowiki&gt;
2054 </pre>
2055 <p>&lt;/nowiki&gt;
2056 &lt;/pre&gt;
2057 </p><p>
2058 &lt;pre&gt;
2059 &lt;nowiki&gt;
2060 &lt;/pre&gt;
2061
2062 &lt;/pre&gt;
2063 </p>
2064 !! end
2065
2066 !! test
2067 </pre> inside nowiki
2068 !! wikitext
2069 <nowiki></pre></nowiki>
2070 !! html
2071 <p>&lt;/pre&gt;
2072 </p>
2073 !! end
2074
2075 # Parsoid doesn't strip empty tags, like Tidy does.
2076 !! test
2077 Empty pre; pre inside other HTML tags (bug 54946)
2078 !! options
2079 parsoid=wt2html,wt2wt
2080 !! wikitext
2081 a
2082
2083 <div><pre>
2084 foo
2085 </pre></div>
2086 <pre></pre>
2087 !! html/php
2088 <p>a
2089 </p>
2090 <div><pre>
2091 foo
2092 </pre></div>
2093 <pre></pre>
2094
2095 !! html/php+tidy
2096 <p>a</p>
2097 <div>
2098 <pre>
2099 foo
2100 </pre></div>
2101 !! html/parsoid
2102 <p>a</p>
2103
2104 <div><pre>foo
2105 </pre></div>
2106 <pre></pre>
2107 !! end
2108
2109 !! test
2110 HTML pre followed by indent-pre
2111 !! wikitext
2112 <pre>foo</pre>
2113 bar
2114 !! html
2115 <pre>foo</pre>
2116 <pre>bar
2117 </pre>
2118 !! end
2119
2120 !!test
2121 Block tag pre
2122 !!options
2123 parsoid
2124 !! wikitext
2125 <p><pre>foo</pre></p>
2126 !! html
2127 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2128 !!end
2129
2130 !!test
2131 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2132 !! wikitext
2133 {{echo|}}
2134 !! html
2135
2136 !!end
2137
2138 !!test
2139 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2140 !! wikitext
2141 {{echo|
2142 foo}}
2143 !! html
2144 <p>foo
2145 </p>
2146 !!end
2147
2148 !! test
2149 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2150 !! wikitext
2151 {{echo|a
2152 b}}
2153 !! html
2154 <pre>a
2155 </pre>
2156 <p>b
2157 </p>
2158 !!end
2159
2160 !! test
2161 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2162 !! wikitext
2163 {{echo|a
2164 b
2165 c
2166 d
2167 e
2168 }}
2169 !! html
2170 <pre>a
2171 </pre>
2172 <p>b
2173 c
2174 </p>
2175 <pre>d
2176 </pre>
2177 <p>e
2178 </p>
2179 !!end
2180
2181 !!test
2182 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2183 !! wikitext
2184 {{echo| foo}}
2185
2186 {{echo| foo}}{{echo| bar}}
2187
2188 {{echo| foo}}
2189 {{echo| bar}}
2190
2191 {{echo|<!--cmt--> foo}}
2192
2193 <!--cmt-->{{echo| foo}}
2194
2195 {{echo|{{echo| }}bar}}
2196 !! html
2197 <pre>foo
2198 </pre>
2199 <pre>foo bar
2200 </pre>
2201 <pre>foo
2202 bar
2203 </pre>
2204 <pre>foo
2205 </pre>
2206 <pre>foo
2207 </pre>
2208 <pre>bar
2209 </pre>
2210 !!end
2211
2212 !! test
2213 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2214 !! wikitext
2215 {{echo| }}a
2216
2217 {{echo|
2218 }}a
2219
2220 {{echo|
2221 b}}
2222
2223 {{echo|a
2224 }}b
2225
2226 {{echo|a
2227 }} b
2228 !! html
2229 <pre>a
2230 </pre>
2231 <p><br />
2232 </p>
2233 <pre>a
2234 </pre>
2235 <p><br />
2236 </p>
2237 <pre>b
2238 </pre>
2239 <p>a
2240 </p>
2241 <pre>b
2242 </pre>
2243 <p>a
2244 </p>
2245 <pre>b
2246 </pre>
2247 !!end
2248
2249 !! test
2250 Things that look like <pre> tags aren't treated as such
2251 !! wikitext
2252 Barack Obama <President> of the United States
2253 <President></President>
2254 !! html
2255 <p>Barack Obama &lt;President&gt; of the United States
2256 &lt;President&gt;&lt;/President&gt;
2257 </p>
2258 !! end
2259
2260 ## PHP parser discards the "<pre " string
2261 !! test
2262 Handle broken pre-like tags (bug 64025)
2263 !! options
2264 parsoid=wt2html
2265 !! wikitext
2266 {{echo|<pre <pre>x</pre>}}
2267
2268 <table><pre </table>
2269 !! html/php
2270 <pre>x</pre>
2271 <table><pre></pre></table>
2272
2273 !! html/parsoid
2274 <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>
2275
2276
2277 <p>&lt;pre </p>
2278
2279 <table></table>
2280 !! end
2281
2282 !! test
2283 Parsoid: handle pre with space after attribute
2284 !! options
2285 parsoid=wt2html
2286 !! wikitext
2287 <pre style="width:50%;" >{{echo|foo}}</pre>
2288 !! html
2289 <pre style="width:50%;">{{echo|foo}}</pre>
2290 !! end
2291
2292 # TODO / maybe: fix wt2wt for this
2293 !! test
2294 Parsoid: Don't paragraph-wrap fosterable content
2295 !! options
2296 parsoid=wt2html
2297 !! wikitext
2298 {|
2299 <td></td>
2300 <td></td>
2301
2302
2303
2304 |}
2305 !! html
2306 <table>
2307
2308 <tbody>
2309 <tr>
2310 <td></td>
2311
2312 <td></td></tr>
2313
2314
2315
2316 </tbody></table>
2317 !! end
2318
2319 !! test
2320 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2321 !! options
2322 parsoid=wt2html
2323 !! wikitext
2324 {|
2325 <td>
2326 <td>
2327 </td>
2328
2329
2330
2331 |}
2332 !! html
2333 <table>
2334
2335 <tbody>
2336 <tr>
2337 <td></td>
2338
2339 <td>
2340 </td></tr>
2341
2342
2343
2344 </tbody></table>
2345 !! end
2346
2347
2348 #--------------------------------------------------------------------
2349 # Transclusion parameter whitespace stripping tests
2350 # Behavior is different for positional and named parameters
2351 #--------------------------------------------------------------------
2352 !! test
2353 Templates: Strip leading and trailing whitespace from named-param values
2354 !! wikitext
2355 {{echo|1= a }}
2356
2357 {{echo|1= {{echo|b}} }}
2358
2359 {{echo| 1 =
2360 c }}
2361
2362 {{echo| 1 =
2363 * d
2364 }}
2365 !! html
2366 <p>a
2367 </p><p>b
2368 </p><p>c
2369 </p>
2370 <ul><li> d</li></ul>
2371
2372 !! end
2373
2374 !! test
2375 Templates: Don't strip whitespace from positional-param values
2376 !! wikitext
2377 {{echo|a }}
2378
2379 {{echo|{{echo|b}} }}
2380
2381 {{echo| c
2382 }}
2383
2384 {{echo| {{echo|d}}
2385 }}
2386
2387 {{echo|
2388 e}}
2389
2390 {{echo|
2391 * f}}
2392
2393 {{echo|
2394 }}g
2395 !! html
2396 <p>a
2397 </p><p>b
2398 </p>
2399 <pre>c
2400 </pre>
2401 <p><br />
2402 </p>
2403 <pre>d
2404 </pre>
2405 <p><br />
2406 </p>
2407 <pre>e
2408 </pre>
2409 <p><br />
2410 </p>
2411 <ul><li> f</li></ul>
2412 <p><br />
2413 </p>
2414 <pre>g
2415 </pre>
2416 !! end
2417
2418 !! test
2419 Templates: Handle empty comment-and-ws-only lines correctly
2420 !! wikitext
2421 {{echo|foo
2422 <!--should be ignored-->
2423 <!--should be ignored as well-->
2424 bar}}
2425 !! html
2426 <p>foo
2427 bar
2428 </p>
2429 !! end
2430
2431 !! test
2432 Templates: Handle comments in the target
2433 !! wikitext
2434 {{echo
2435 <!-- should be ignored -->
2436 |foo}}
2437
2438 {{echo<!-- should be ignored -->
2439 |foo}}
2440
2441 {{echo<!-- should be ignored -->|foo}}
2442
2443 {{<!-- should be ignored -->echo|foo}}
2444 !!html/parsoid
2445 <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>
2446
2447 <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>
2448
2449 <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>
2450
2451 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2452 !!end
2453
2454 !! test
2455 Templates: Handle comments in parameter names (bug 67657)
2456 !! wikitext
2457 {{echo|1
2458 <!-- should be ignored -->
2459 =foo}}
2460
2461 {{echo|
2462 <!-- should be ignored -->
2463 1 = foo}}
2464
2465 {{echo|1<!-- should be ignored --> = foo}}
2466
2467 {{echo|<!-- should be ignored -->1 = foo}}
2468 !!html/parsoid
2469 <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>
2470
2471 <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>
2472
2473 <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>
2474
2475 <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>
2476 !!end
2477
2478 !! test
2479 Templates: Other wikitext in parameter names (bug 67657)
2480 !! wikitext
2481 {{echo|''1''=foo}}
2482 !!html/parsoid
2483 <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>
2484 !!html/php
2485 <p>{{{1}}}
2486 </p>
2487 !!end
2488
2489 #--------------------------------------------------------------------
2490 # Transclusion parameter escaping tests
2491 #--------------------------------------------------------------------
2492 !! test
2493 Templates: Parsoid parameter escaping test 1
2494 !! options
2495 parsoid
2496 !! wikitext
2497 {{echo|[foo]|{{echo|[bar]}}}}
2498 !! html
2499 <p about="#mwt1" typeof="mw:Transclusion"
2500 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2501 !! end
2502
2503 !! test
2504 Parsoid: Pipes in external links in template parameter
2505 !! options
2506 parsoid
2507 !! wikitext
2508 {{echo|[{{echo|http://example.com}} link]}}
2509 !! html
2510 <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>
2511 !! end
2512
2513 !! test
2514 Parsoid: pipe in transclusion parameter
2515 !! options
2516 parsoid
2517 !! wikitext
2518 {{echo|http://foo.com/a&#124;b}}
2519 !! html
2520 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2521 typeof="mw:Transclusion"
2522 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>
2523 !! end
2524
2525 !! test
2526 Parsoid: Pipe in external link target and content in template parameter
2527 !! options
2528 parsoid=html2wt,wt2wt
2529 !! wikitext
2530 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2531 !! html
2532 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2533 typeof="mw:Transclusion"
2534 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2535 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2536 !! end
2537
2538 !! test
2539 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2540 !! options
2541 parsoid
2542 !! wikitext
2543 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2544 !! html
2545 <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>
2546 !! end
2547
2548 !! test
2549 Templates: Don't escape already nowiki-escaped text in template parameters
2550 !! options
2551 parsoid=html2wt,wt2wt
2552 !! wikitext
2553 {{echo|foo<nowiki>|</nowiki>bar}}
2554 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2555 {{echo|<nowiki></nowiki>}}
2556 !! html
2557 <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>
2558 <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>
2559 <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>
2560 </p>
2561 !! end
2562
2563 ## Bug 52824
2564 !! test
2565 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2566 !! options
2567 parsoid=html2wt,wt2wt
2568 !! wikitext
2569 {{echo|{{echo|1=bar}}}}
2570 !! html
2571 <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>
2572 !! end
2573
2574 ## Bug 56733
2575 !! test
2576 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2577 !! options
2578 parsoid
2579 !! wikitext
2580 {{echo|a : b}}
2581 !! html
2582 <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>
2583 !! end
2584
2585 ## Bug T73412
2586 !! test
2587 Templates: Preserve blank parameter names
2588 !! wikitext
2589 {{echo|=foo}}
2590 !! html/php
2591 <p>{{{1}}}
2592 </p>
2593 !! html/parsoid
2594 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2595 !! end
2596
2597 ###
2598 ### Parsoid-centric tests for testing RT edge cases for pre
2599 ###
2600
2601 !!test
2602 1a. Indent-Pre and Comments
2603 !! wikitext
2604 a
2605 <!--a-->
2606 c
2607 !! html
2608 <pre>a
2609 </pre>
2610 <p>c
2611 </p>
2612 !!end
2613
2614 !!test
2615 1b. Indent-Pre and Comments
2616 !! wikitext
2617 a
2618 <!--a-->
2619 c
2620 !! html
2621 <pre>a
2622 </pre>
2623 <p>c
2624 </p>
2625 !!end
2626
2627 !!test
2628 1c. Indent-Pre and Comments
2629 !! wikitext
2630 <!--a--> a
2631
2632 <!--a--> a
2633 !! html
2634 <pre> a
2635 </pre>
2636 <pre> a
2637 </pre>
2638 !!end
2639
2640 !!test
2641 1d. Indent-Pre and Comments
2642 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2643 !! wikitext
2644 <!--a--> a
2645
2646 <!--b-->b
2647 !! html
2648 <pre>a
2649 </pre>
2650 <pre>b
2651 </pre>
2652 !!end
2653
2654 !!test
2655 2a. Indent-Pre and tables
2656 !! wikitext
2657 {|
2658 |-
2659 !h1!!h2
2660 |foo||bar
2661 |}
2662 !! html
2663 <table>
2664
2665 <tr>
2666 <th>h1</th>
2667 <th>h2
2668 </th>
2669 <td>foo</td>
2670 <td>bar
2671 </td></tr></table>
2672
2673 !!end
2674
2675 !!test
2676 2b. Indent-Pre and tables
2677 !! wikitext
2678 {|
2679 |-
2680 |foo
2681 |}
2682 !! html
2683 <table>
2684
2685 <tr>
2686 <td>foo
2687 </td></tr></table>
2688
2689 !!end
2690
2691 !!test
2692 2c. Indent-Pre and tables (bug 42252)
2693 !! wikitext
2694 {|
2695 |+ foo
2696 ! | bar
2697 |}
2698 !! html
2699 <table>
2700 <caption> foo
2701 </caption>
2702 <tr>
2703 <th> bar
2704 </th></tr></table>
2705
2706 !!end
2707
2708 !!test
2709 2d. Indent-Pre and tables
2710 !! wikitext
2711 a
2712 {|
2713 | b
2714 |}
2715 !! html/php
2716 <pre>a
2717 </pre>
2718 <table>
2719 <tr>
2720 <td> b
2721 </td></tr></table>
2722
2723 !! html/parsoid
2724 <pre>a</pre>
2725 <table>
2726 <tbody><tr><td> b</td></tr>
2727 </tbody></table>
2728 !!end
2729
2730 !!test
2731 2e. Indent-Pre and table-line syntax
2732 !! wikitext
2733 a
2734 | b
2735 | c
2736 !! html/php
2737 <pre>a
2738 | b
2739 | c
2740 </pre>
2741 !!end
2742
2743 !!test
2744 2f. Indent-pre started by table-line syntax
2745 !! wikitext
2746 a
2747 | b
2748 | c
2749 !! html/php
2750 <p>a
2751 </p>
2752 <pre>| b
2753 | c
2754 </pre>
2755 !! html/parsoid
2756 <p>a</p>
2757 <pre>
2758 | b
2759 | c</pre>
2760 !!end
2761
2762 !!test
2763 3a. Indent-Pre and block tags (single-line html)
2764 !! wikitext
2765 a <p> foo </p>
2766 b <div> foo </div>
2767 c <blockquote> foo </blockquote>
2768 <span> foo </span>
2769 !! html
2770 a <p> foo </p>
2771 b <div> foo </div>
2772 c <blockquote> foo </blockquote>
2773 <pre><span> foo </span>
2774 </pre>
2775 !! html/parsoid
2776 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2777 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2778 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2779 <pre><span> foo </span>
2780 </pre>
2781 !! html+tidy
2782 <p>a</p>
2783 <p>foo</p>
2784 <p>b</p>
2785 <div>foo</div>
2786 <p>c</p>
2787 <blockquote>
2788 <p>foo</p>
2789 </blockquote>
2790 <pre>
2791 <span> foo </span>
2792 </pre>
2793 !! end
2794
2795 !!test
2796 3b. Indent-Pre and block tags (multi-line html)
2797 !! wikitext
2798 a <span>foo</span>
2799 b <div> foo </div>
2800 !! html
2801 <pre>a <span>foo</span>
2802 </pre>
2803 b <div> foo </div>
2804
2805 !! html/parsoid
2806 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2807 b <div data-parsoid='{"stx":"html"}'> foo </div>
2808 !! html+tidy
2809 <pre>
2810 a <span>foo</span>
2811 </pre>
2812 <p>b</p>
2813 <div>foo</div>
2814 !!end
2815
2816 !!test
2817 3c. Indent-Pre and block tags (pre-content on separate line)
2818 !! wikitext
2819 <p>
2820 foo
2821 </p>
2822
2823 <div>
2824 foo
2825 </div>
2826
2827 <center>
2828 foo
2829 </center>
2830
2831 <blockquote>
2832 foo
2833 </blockquote>
2834
2835 <blockquote>
2836 <pre>
2837 foo
2838 </pre>
2839 </blockquote>
2840
2841 <table><tr><td>
2842 foo
2843 </td></tr></table>
2844
2845 <ul><li>
2846 foo
2847 </li></ul>
2848
2849 !! html
2850 <p>
2851 foo
2852 </p>
2853 <div>
2854 <pre>foo
2855 </pre>
2856 </div>
2857 <center>
2858 <pre>foo
2859 </pre>
2860 </center>
2861 <blockquote>
2862 <p> foo
2863 </p>
2864 </blockquote>
2865 <blockquote>
2866 <pre>
2867 foo
2868 </pre>
2869 </blockquote>
2870 <table><tr><td>
2871 <pre>foo
2872 </pre>
2873 </td></tr></table>
2874 <ul><li>
2875 foo
2876 </li></ul>
2877
2878 !!end
2879
2880 !!test
2881 4. Indent-Pre and extension tags
2882 !! wikitext
2883 a <gallery>
2884 File:foobar.jpg
2885 </gallery>
2886 !! html
2887 a <ul class="gallery mw-gallery-traditional">
2888 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2889 <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>
2890 <div class="gallerytext">
2891 </div>
2892 </div></li>
2893 </ul>
2894
2895 !! html+tidy
2896 <p>a</p>
2897 <ul class="gallery mw-gallery-traditional">
2898 <li class="gallerybox" style="width: 155px">
2899 <div style="width: 155px">
2900 <div class="thumb" style="width: 150px;">
2901 <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>
2902 </div>
2903 <div class="gallerytext"></div>
2904 </div>
2905 </li>
2906 </ul>
2907 !!end
2908
2909 !! test
2910 Table wikitext syntax outside wiki-tables
2911 !! wikitext
2912 a
2913 ! not a table heading
2914 |- not a table row
2915 | not a table cell
2916 | class="foo bar" | baz
2917 b
2918 |}
2919 |-
2920 c
2921 !! html
2922 <p>a
2923 ! not a table heading
2924 |- not a table row
2925 | not a table cell
2926 | class="foo bar" | baz
2927 b
2928 |}
2929 |-
2930 c
2931 </p>
2932 !! end
2933
2934 !!test
2935 Render paragraphs when indent-pre is suppressed in blocklevels
2936 !! wikitext
2937 <blockquote>
2938 foo
2939
2940 bar
2941 </blockquote>
2942 !! html
2943 <blockquote>
2944 <p> foo
2945 </p><p> bar
2946 </p>
2947 </blockquote>
2948
2949 !!end
2950
2951 !!test
2952 4. Multiple spaces at start-of-line
2953 !! wikitext
2954 <p> foo </p>
2955 foo
2956 {|
2957 |foo
2958 |}
2959 !! html
2960 <p> foo </p>
2961 <pre> foo
2962 </pre>
2963 <table>
2964 <tr>
2965 <td>foo
2966 </td></tr></table>
2967
2968 !!end
2969
2970 ## NOTE: the leading white-space chars on empty line are significant
2971 !! test
2972 5a. White-space in indent-pre
2973 !! wikitext
2974 a<br />
2975
2976 b
2977 !! html
2978 <pre>a<br />
2979
2980 b
2981 </pre>
2982 !! end
2983
2984 ## NOTE: the leading white-space chars on empty line are significant
2985 !! test
2986 5b. White-space in indent-pre
2987 !! wikitext
2988 a
2989
2990 b
2991
2992
2993 c
2994 !! html
2995 <pre>a
2996
2997 b
2998
2999
3000 c
3001 </pre>
3002 !! end
3003
3004 !! test
3005 5c. White-space in indent-pre
3006 !! wikitext
3007 ''a''
3008 ''b''
3009 ''c''
3010 !! html
3011 <pre><i>a</i>
3012 <i>b</i>
3013 <i>c</i>
3014 </pre>
3015 !! end
3016
3017 !! test
3018 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3019 !! wikitext
3020 a
3021
3022 <!-- continue -->
3023 b
3024
3025 c
3026
3027 d
3028 !! html
3029 <pre>a
3030
3031 b
3032 </pre>
3033 <pre>c
3034
3035 </pre>
3036 <p>d
3037 </p>
3038 !! end
3039
3040 !! test
3041 7a. Indent-pre and category links
3042 !! options
3043 parsoid=wt2html,wt2wt
3044 !! wikitext
3045 [[Category:foo]] <!-- No pre-wrapping -->
3046 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3047 !! html
3048 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3049 <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 -->
3050 !! end
3051
3052 !! test
3053 7b. Indent-pre and category links
3054 !! options
3055 parsoid=wt2html,wt2wt
3056 !! wikitext
3057 [[Category:foo]] a
3058 [[Category:foo]] {{echo|b}}
3059 !! html
3060 <pre>
3061 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3062 <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>
3063 !! end
3064
3065 ###
3066 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3067 ###
3068
3069 !!test
3070 HTML-pre: 1. embedded newlines
3071 !! wikitext
3072 <pre>foo</pre>
3073
3074 <pre>
3075 foo
3076 </pre>
3077
3078 <pre>
3079
3080 foo
3081 </pre>
3082
3083 <pre>
3084
3085
3086 foo
3087 </pre>
3088 !! html
3089 <pre>foo</pre>
3090 <pre>
3091 foo
3092 </pre>
3093 <pre>
3094
3095 foo
3096 </pre>
3097 <pre>
3098
3099
3100 foo
3101 </pre>
3102
3103 !! html/parsoid
3104 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3105
3106 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3107 foo
3108 </pre>
3109
3110 <pre data-parsoid='{"stx":"html"}'>
3111
3112 foo
3113 </pre>
3114
3115 <pre data-parsoid='{"stx":"html"}'>
3116
3117
3118 foo
3119 </pre>
3120 !!end
3121
3122 !! test
3123 HTML-pre: big spaces
3124 !! wikitext
3125 <pre>
3126
3127
3128
3129
3130 haha
3131
3132
3133
3134
3135 haha
3136
3137
3138
3139
3140 </pre>
3141 !! html
3142 <pre>
3143
3144
3145
3146
3147 haha
3148
3149
3150
3151
3152 haha
3153
3154
3155
3156
3157 </pre>
3158
3159 !! html/parsoid
3160 <pre data-parsoid='{"stx":"html"}'>
3161
3162
3163
3164
3165 haha
3166
3167
3168
3169
3170 haha
3171
3172
3173
3174
3175 </pre>
3176 !! end
3177
3178 !!test
3179 HTML-pre: 2: indented text
3180 !! wikitext
3181 <pre>
3182 foo
3183 </pre>
3184 !! html
3185 <pre>
3186 foo
3187 </pre>
3188
3189 !!end
3190
3191 !!test
3192 HTML-pre: 3: other wikitext
3193 !! wikitext
3194 <pre>
3195 * foo
3196 # bar
3197 = no-h =
3198 '' no-italic ''
3199 [[ NoLink ]]
3200 </pre>
3201 !! html
3202 <pre>
3203 * foo
3204 # bar
3205 = no-h =
3206 '' no-italic ''
3207 [[ NoLink ]]
3208 </pre>
3209
3210 !!end
3211
3212 ###
3213 ### Definition lists
3214 ###
3215 !! test
3216 Simple definition
3217 !! wikitext
3218 ; name : Definition
3219 !! html
3220 <dl><dt> name&#160;</dt>
3221 <dd> Definition</dd></dl>
3222
3223 !! end
3224
3225 !! test
3226 Definition list for indentation only
3227 !! wikitext
3228 : Indented text
3229 !! html
3230 <dl><dd> Indented text</dd></dl>
3231
3232 !! end
3233
3234 !! test
3235 Definition list with no space
3236 !! wikitext
3237 ;name:Definition
3238 !! html
3239 <dl><dt>name</dt>
3240 <dd>Definition</dd></dl>
3241
3242 !!end
3243
3244 !! test
3245 Definition list with URL link
3246 !! wikitext
3247 ; http://example.com/ : definition
3248 !! html
3249 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3250 <dd> definition</dd></dl>
3251
3252 !! end
3253
3254 !! test
3255 Definition list with bracketed URL link
3256 !! wikitext
3257 ;[http://www.example.com/ Example]:Something about it
3258 !! html
3259 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3260 <dd>Something about it</dd></dl>
3261
3262 !! end
3263
3264 !! test
3265 Definition list with wikilink containing colon
3266 !! wikitext
3267 ; [[Help:FAQ]]: The least-read page on Wikipedia
3268 !! html
3269 <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>
3270 <dd> The least-read page on Wikipedia</dd></dl>
3271
3272 !! end
3273
3274 # At Brion's and JeLuF's insistence... :)
3275 !! test
3276 Definition list with news link containing colon
3277 !! wikitext
3278 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3279 !! html/php
3280 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3281 <dd> This isn't even a real newsgroup!</dd></dl>
3282
3283 !! html/parsoid
3284 <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>
3285 !! end
3286
3287 !! test
3288 Malformed definition list with colon
3289 !! wikitext
3290 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3291 !! html
3292 <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>
3293
3294 !! end
3295
3296 !! test
3297 Definition lists: colon in external link text
3298 !! wikitext
3299 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3300 !! html
3301 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3302 <dd> OK, I made that up</dd></dl>
3303
3304 !! end
3305
3306 !! test
3307 Definition lists: colon in HTML attribute
3308 !! wikitext
3309 ;<b style="display: inline">bold</b>
3310 !! html
3311 <dl><dt><b style="display: inline">bold</b></dt></dl>
3312
3313 !! end
3314
3315 !! test
3316 Definition lists: self-closed tag
3317 !! wikitext
3318 ;one<br/>two : two-line fun
3319 !! html
3320 <dl><dt>one<br />two&#160;</dt>
3321 <dd> two-line fun</dd></dl>
3322
3323 !! end
3324
3325 !! test
3326 Bug 11748: Literal closing tags
3327 !! wikitext
3328 <dl>
3329 <dt>test 1</dt>
3330 <dd>test test test test test</dd>
3331 <dt>test 2</dt>
3332 <dd>test test test test test</dd>
3333 </dl>
3334 !! html
3335 <dl>
3336 <dt>test 1</dt>
3337 <dd>test test test test test</dd>
3338 <dt>test 2</dt>
3339 <dd>test test test test test</dd>
3340 </dl>
3341
3342 !! end
3343
3344 !! test
3345 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3346 !! wikitext
3347 <ul><li>
3348 ; term : description
3349 * unordered
3350 </li></ul>
3351 !! html
3352 <ul><li>
3353 <dl><dt> term&#160;</dt>
3354 <dd> description</dd></dl>
3355 <ul><li> unordered</li></ul>
3356 </li></ul>
3357
3358 !! end
3359
3360 !! test
3361
3362 Definition list with empty definition and following paragraph
3363 !! wikitext
3364 ; term:
3365 Paragraph text
3366 !! html
3367 <dl><dt> term</dt>
3368 <dd></dd></dl>
3369 <p>Paragraph text
3370 </p>
3371 !! end
3372
3373 !! test
3374 Nested definition lists using html syntax
3375 !! wikitext
3376 <dl><dt>x</dt>
3377 <dd>a</dd>
3378 <dd>b</dd></dl>
3379
3380 !! end
3381
3382 !! test
3383 Definition Lists: No nesting: Multiple dd's
3384 !! wikitext
3385 ;x
3386 :a
3387 :b
3388 !! html
3389 <dl><dt>x</dt>
3390 <dd>a</dd>
3391 <dd>b</dd></dl>
3392
3393 !! end
3394
3395 !! test
3396 Definition Lists: Indentation: Regular
3397 !! wikitext
3398 :i1
3399 ::i2
3400 :::i3
3401 !! html
3402 <dl><dd>i1
3403 <dl><dd>i2
3404 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3405
3406 !! end
3407
3408 !! test
3409 Definition Lists: Indentation: Missing 1st level
3410 !! wikitext
3411 ::i2
3412 :::i3
3413 !! html
3414 <dl><dd><dl><dd>i2
3415 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3416
3417 !! end
3418
3419 !! test
3420 Definition Lists: Indentation: Multi-level indent
3421 !! wikitext
3422 :::i3
3423 !! html
3424 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3425
3426 !! end
3427
3428 !! test
3429 Definition Lists: Hacky use to indent tables
3430 !! wikitext
3431 ::{|
3432 |foo
3433 |bar
3434 |}
3435 this text
3436 should be left alone
3437 !! html
3438 <dl><dd><dl><dd><table>
3439 <tr>
3440 <td>foo
3441 </td>
3442 <td>bar
3443 </td></tr></table></dd></dl></dd></dl>
3444 <p>this text
3445 should be left alone
3446 </p>
3447 !! end
3448
3449 !! test
3450 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3451 !! wikitext
3452 <!-- foo -->
3453 ::{|
3454 |foo
3455 |bar
3456 |}<!-- bar -->
3457 this text
3458 should be left alone
3459 !! html/parsoid
3460 <!-- foo -->
3461 <dl><dd><dl><dd><table><tr>
3462 <td>foo</td>
3463 <td>bar</td>
3464 </tr></table><!-- bar --></dd></dl></dd></dl>
3465 <p>this text
3466 should be left alone</p>
3467 !! end
3468
3469 !! test
3470 Definition Lists: Hacky use to indent tables, with comment before table
3471 !! wikitext
3472 ::<!-- foo -->{|
3473 |foo
3474 |}
3475 !! html/parsoid
3476 <dl><dd><dl><dd><!-- foo --><table><tr>
3477 <td>foo</td>
3478 </tr></table></dd></dl></dd></dl>
3479 !! end
3480
3481 # Bug 52473
3482 !! test
3483 Definition Lists: Hacky use to indent tables (WS-insensitive)
3484 !! options
3485 parsoid
3486 !! wikitext
3487 : {|
3488 |a
3489 |}
3490 !! html
3491 <dl>
3492 <dd> <table><tr><td>a</td></tr></table> </dd>
3493 </dl>
3494 !! end
3495 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3496 ## as an empty dt item. It also ignores all but the last ";" when followed
3497 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3498 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3499 ## ";"s.
3500 ##
3501 ## Ex: ";;t2 ::d2" is transformed into:
3502 ##
3503 ## <dl>
3504 ## <dt>t2 </dt>
3505 ## <dd>
3506 ## <dl>
3507 ## <dt></dt>
3508 ## <dd>d2</dd>
3509 ## </dl>
3510 ## </dd>
3511 ## </dl>
3512 ##
3513 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3514 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3515 ##
3516 ## <dl>
3517 ## <dt>
3518 ## <dl>
3519 ## <dt>t2 </dt>
3520 ## <dd>:d2</dd>
3521 ## </dl>
3522 ## </dt>
3523 ## </dl>
3524 ##
3525 ## All Parsoid only definition list tests have this difference.
3526 ##
3527 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3528 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3529
3530 !! test
3531 Table / list interaction: indented table with lists in table contents
3532 !! wikitext
3533 :{|
3534 |-
3535 | a
3536 * b
3537 |-
3538 | c
3539 * d
3540 |}
3541 !! html
3542 <dl><dd><table>
3543
3544 <tr>
3545 <td> a
3546 <ul><li> b</li></ul>
3547 </td></tr>
3548 <tr>
3549 <td> c
3550 <ul><li> d</li></ul>
3551 </td></tr></table></dd></dl>
3552
3553 !! end
3554
3555 !!test
3556 Table / list interaction: lists nested in tables nested in indented lists
3557 !! wikitext
3558 :{|
3559 |
3560 :a
3561 :b
3562 |
3563 *c
3564 *d
3565 |}
3566
3567 *e
3568 *f
3569 !! html
3570 <dl><dd><table>
3571 <tr>
3572 <td>
3573 <dl><dd>a</dd>
3574 <dd>b</dd></dl>
3575 </td>
3576 <td>
3577 <ul><li>c</li>
3578 <li>d</li></ul>
3579 </td></tr></table></dd></dl>
3580 <ul><li>e</li>
3581 <li>f</li></ul>
3582
3583 !!end
3584
3585 !! test
3586 Definition Lists: Nesting: Multi-level (Parsoid only)
3587 !! options
3588 parsoid
3589 !! wikitext
3590 ;t1 :d1
3591 ;;t2 ::d2
3592 ;;;t3 :::d3
3593 !! html
3594 <dl>
3595 <dt>t1 </dt>
3596 <dd>d1</dd>
3597 <dt>
3598 <dl>
3599 <dt>t2 </dt>
3600 <dd>:d2</dd>
3601 <dt>
3602 <dl>
3603 <dt>t3 </dt>
3604 <dd>::d3</dd>
3605 </dl>
3606 </dt>
3607 </dl>
3608 </dt>
3609 </dl>
3610
3611
3612 !! end
3613
3614
3615 !! test
3616 Definition Lists: Nesting: Test 2 (Parsoid only)
3617 !! options
3618 parsoid
3619 !! wikitext
3620 ;t1
3621 ::d2
3622 !! html
3623 <dl>
3624 <dt>t1</dt>
3625 <dd>
3626 <dl>
3627 <dd>d2</dd>
3628 </dl>
3629 </dd>
3630 </dl>
3631
3632 !! end
3633
3634
3635 !! test
3636 Definition Lists: Nesting: Test 3 (Parsoid only)
3637 !! options
3638 parsoid
3639 !! wikitext
3640 :;t1
3641 ::::d2
3642 !! html
3643 <dl>
3644 <dd>
3645 <dl>
3646 <dt>t1</dt>
3647 <dd>
3648 <dl>
3649 <dd>
3650 <dl>
3651 <dd>d2</dd>
3652 </dl>
3653 </dd>
3654 </dl>
3655 </dd>
3656 </dl>
3657 </dd>
3658 </dl>
3659
3660 !! end
3661
3662
3663 !! test
3664 Definition Lists: Nesting: Test 4
3665 !! wikitext
3666 ::;t3
3667 :::d3
3668 !! html
3669 <dl><dd><dl><dd><dl><dt>t3</dt>
3670 <dd>d3</dd></dl></dd></dl></dd></dl>
3671
3672 !! end
3673
3674
3675 ## The Parsoid team believes the following three test exposes a
3676 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3677 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3678 ## It also exposes a "misfeature" in tidy, which doesn't like
3679 ## <dl> tags with a single <dt> child; it converts the <dt> into
3680 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3681 !! test
3682 Definition Lists: Mixed Lists: Test 1
3683 !! wikitext
3684 :;* foo
3685 ::* bar
3686 :; baz
3687 !! html/php
3688 <dl><dd><dl><dt><ul><li> foo</li>
3689 <li> bar</li></ul></dt></dl>
3690 <dl><dt> baz</dt></dl></dd></dl>
3691
3692 !! html/php+tidy
3693 <dl>
3694 <dd>
3695 <dl>
3696 <dd>
3697 <ul>
3698 <li>foo</li>
3699 <li>bar</li>
3700 </ul>
3701 </dd>
3702 </dl>
3703 <dl>
3704 <dt>baz</dt>
3705 </dl>
3706 </dd>
3707 </dl>
3708 !! html/parsoid
3709 <dl>
3710 <dd><dl>
3711 <dt><ul>
3712 <li> foo
3713 </li>
3714 </ul></dt>
3715 <dd><ul>
3716 <li> bar
3717 </li>
3718 </ul></dd>
3719 <dt> baz</dt>
3720 </dl></dd>
3721 </dl>
3722 !! end
3723
3724 !! test
3725 Definition Lists: Mixed Lists: Test 2
3726 !! wikitext
3727 *: d1
3728 *: d2
3729 !! html
3730 <ul><li><dl><dd> d1</dd>
3731 <dd> d2</dd></dl></li></ul>
3732
3733 !! end
3734
3735
3736 !! test
3737 Definition Lists: Mixed Lists: Test 3
3738 !! wikitext
3739 *::: d1
3740 *::: d2
3741 !! html
3742 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3743 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3744
3745 !! end
3746
3747
3748 !! test
3749 Definition Lists: Mixed Lists: Test 4
3750 !! wikitext
3751 *;d1 :d2
3752 *;d3 :d4
3753 !! html
3754 <ul><li><dl><dt>d1&#160;</dt>
3755 <dd>d2</dd>
3756 <dt>d3&#160;</dt>
3757 <dd>d4</dd></dl></li></ul>
3758
3759 !! end
3760
3761
3762 !! test
3763 Definition Lists: Mixed Lists: Test 5
3764 !! wikitext
3765 *:d1
3766 *:: d2
3767 !! html
3768 <ul><li><dl><dd>d1
3769 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3770
3771 !! end
3772
3773
3774 !! test
3775 Definition Lists: Mixed Lists: Test 6
3776 !! wikitext
3777 #*:d1
3778 #*::: d3
3779 !! html
3780 <ol><li><ul><li><dl><dd>d1
3781 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3782
3783 !! end
3784
3785
3786 !! test
3787 Definition Lists: Mixed Lists: Test 7
3788 !! wikitext
3789 :* d1
3790 :* d2
3791 !! html
3792 <dl><dd><ul><li> d1</li>
3793 <li> d2</li></ul></dd></dl>
3794
3795 !! end
3796
3797
3798 !! test
3799 Definition Lists: Mixed Lists: Test 8
3800 !! wikitext
3801 :* d1
3802 ::* d2
3803 !! html
3804 <dl><dd><ul><li> d1</li></ul>
3805 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3806
3807 !! end
3808
3809
3810 !! test
3811 Definition Lists: Mixed Lists: Test 9
3812 !! wikitext
3813 *;foo :bar
3814 !! html
3815 <ul><li><dl><dt>foo&#160;</dt>
3816 <dd>bar</dd></dl></li></ul>
3817
3818 !! end
3819
3820
3821 !! test
3822 Definition Lists: Mixed Lists: Test 10
3823 !! wikitext
3824 *#;foo :bar
3825 !! html
3826 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3827 <dd>bar</dd></dl></li></ol></li></ul>
3828
3829 !! end
3830
3831 # The Parsoid team disagrees with the PHP parser's seemingly-random
3832 # rules regarding dd/dt on the next two tests. Parsoid is more
3833 # consistent, and recognizes the shared nesting and keeps the
3834 # still-open tags around until the nesting is complete.
3835 # (And tidy again converts <dt> to <dd> before 'bar'.)
3836
3837 !! test
3838 Definition Lists: Mixed Lists: Test 11
3839 !! wikitext
3840 *#*#;*;;foo :bar
3841 *#*#;boo :baz
3842 !! html/php
3843 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3844 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3845 <dl><dt>boo&#160;</dt>
3846 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3847
3848 !! html/php+tidy
3849 <ul>
3850 <li>
3851 <ol>
3852 <li>
3853 <ul>
3854 <li>
3855 <ol>
3856 <li>
3857 <dl>
3858 <dt>foo&#160;</dt>
3859 <dd>
3860 <ul>
3861 <li>
3862 <dl>
3863 <dd>
3864 <dl>
3865 <dt>bar</dt>
3866 </dl>
3867 </dd>
3868 </dl>
3869 </li>
3870 </ul>
3871 </dd>
3872 </dl>
3873 <dl>
3874 <dt>boo&#160;</dt>
3875 <dd>baz</dd>
3876 </dl>
3877 </li>
3878 </ol>
3879 </li>
3880 </ul>
3881 </li>
3882 </ol>
3883 </li>
3884 </ul>
3885 !! html/parsoid
3886 <ul>
3887 <li>
3888 <ol>
3889 <li>
3890 <ul>
3891 <li>
3892 <ol>
3893 <li>
3894 <dl>
3895 <dt>
3896 <ul>
3897 <li>
3898 <dl>
3899 <dt>
3900 <dl>
3901 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3902 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3903 </dl></dt>
3904 </dl></li>
3905 </ul></dt>
3906 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3907 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3908 </dl></li>
3909 </ol></li>
3910 </ul></li>
3911 </ol></li>
3912 </ul>
3913 !! end
3914
3915
3916 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3917 !! test
3918 Definition Lists: Weird Ones: Test 1
3919 !! wikitext
3920 *#;*::;; foo : bar (who uses this?)
3921 !! html/php
3922 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3923 <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>
3924
3925 !! html/php+tidy
3926 <ul>
3927 <li>
3928 <ol>
3929 <li>
3930 <dl>
3931 <dt>foo&#160;</dt>
3932 <dd>
3933 <ul>
3934 <li>
3935 <dl>
3936 <dd>
3937 <dl>
3938 <dd>
3939 <dl>
3940 <dd>
3941 <dl>
3942 <dt>bar (who uses this?)</dt>
3943 </dl>
3944 </dd>
3945 </dl>
3946 </dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950 </li>
3951 </ul>
3952 </dd>
3953 </dl>
3954 </li>
3955 </ol>
3956 </li>
3957 </ul>
3958 !! html/parsoid
3959 <ul>
3960 <li>
3961 <ol>
3962 <li>
3963 <dl>
3964 <dt>
3965 <ul>
3966 <li>
3967 <dl>
3968 <dd>
3969 <dl>
3970 <dd>
3971 <dl>
3972 <dt>
3973 <dl>
3974 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
3975 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3976 </dl></dt>
3977 </dl></dd>
3978 </dl></dd>
3979 </dl></li>
3980 </ul></dt>
3981 </dl></li>
3982 </ol></li>
3983 </ul>
3984 !! end
3985
3986 !! test
3987 Definition Lists: colons occurring in tags
3988 !! wikitext
3989 ;a:b
3990 ;'''a:b'''
3991 ;<i>a:b</i>
3992 ;<span>a:b</span>
3993 ;<div>a:b</div>
3994 ;<div>a
3995 :b</div>
3996 ;{{echo|a:b}}
3997 ;{{echo|''a:b''}}
3998 !! html+tidy
3999 <dl>
4000 <dt>a</dt>
4001 <dd>b</dd>
4002 <dt><b>a:b</b></dt>
4003 <dt><i>a:b</i></dt>
4004 <dt><span>a:b</span></dt>
4005 <dd>
4006 <div>a:b</div>
4007 </dd>
4008 <dd>
4009 <div>a
4010 <dl>
4011 <dd>b</dd>
4012 </dl>
4013 </div>
4014 </dd>
4015 <dt>a</dt>
4016 <dd>b</dd>
4017 <dt><i>a:b</i></dt>
4018 </dl>
4019 !! end
4020
4021 !! test
4022 Definition Lists: colons and tables 1
4023 !! wikitext
4024 :{|
4025 | x
4026 |}
4027 :{|
4028 | y
4029 |}
4030 !! html
4031 <dl><dd><table>
4032 <tr>
4033 <td> x
4034 </td></tr></table></dd></dl>
4035 <dl><dd><table>
4036 <tr>
4037 <td> y
4038 </td></tr></table></dd></dl>
4039
4040 !! end
4041
4042 # Parsoid's output (as documented below) differs from php's in this case.
4043 # This is probably a bug. If we fixup parsoid to match php's output, the
4044 # above test should pass and the below test case can be removed. It is
4045 # unclear which output is more desirable.
4046
4047 !! test
4048 Definition Lists: colons and tables 2
4049 !! wikitext
4050 :{|
4051 | x
4052 |}
4053 :{|
4054 | y
4055 |}
4056 !! html/parsoid
4057 <dl><dd><table>
4058 <tr>
4059 <td> x
4060 </td></tr></table></dd>
4061 <dd><table>
4062 <tr>
4063 <td> y
4064 </td></tr></table></dd></dl>
4065 !! end
4066
4067
4068 ###
4069 ### External links
4070 ###
4071 !! test
4072 External links: non-bracketed
4073 !! wikitext
4074 Non-bracketed: http://example.com
4075 !! html
4076 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4077 </p>
4078 !! end
4079
4080 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4081 !! test
4082 External links: numbered
4083 !! wikitext
4084 Numbered: [http://example.com]
4085 Numbered: [http://example.net]
4086 Numbered: [http://example.com]
4087 !! html/php
4088 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4089 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4090 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4091 </p>
4092 !! html/parsoid
4093 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4094 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4095 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4096 !!end
4097
4098 !! test
4099 External links: specified text
4100 !! wikitext
4101 Specified text: [http://example.com link]
4102 !! html
4103 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4104 </p>
4105 !!end
4106
4107 !! test
4108 External links: trail
4109 !! wikitext
4110 Linktrails should not work for external links: [http://example.com link]s
4111 !! html
4112 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4113 </p>
4114 !! end
4115
4116 !! test
4117 External links: dollar sign in URL
4118 !! wikitext
4119 http://example.com/1$2345
4120 !! html
4121 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4122 </p>
4123 !! end
4124
4125 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4126 !! test
4127 External links: dollar sign in URL (autonumber)
4128 !! wikitext
4129 [http://example.com/1$2345]
4130 !! html/php
4131 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4132 </p>
4133 !! html/parsoid
4134 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4135 !!end
4136
4137 !! test
4138 External links: open square bracket forbidden in URL (bug 4377)
4139 !! options
4140 parsoid=wt2html,wt2wt,html2html
4141 !! wikitext
4142 http://example.com/1[2345
4143 !! html/php
4144 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4145 </p>
4146 !! html/parsoid
4147 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4148 !! end
4149
4150 !! test
4151 External links: open square bracket forbidden in URL (named) (bug 4377)
4152 !! options
4153 parsoid=wt2html,html2html
4154 !! wikitext
4155 [http://example.com/1[2345]
4156 !! html/php
4157 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4158 </p>
4159 !! html/parsoid
4160 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4161 !!end
4162
4163 # parsoid adds a space before the link name
4164 !! test
4165 External links: open square bracket forbidden in URL (named) (bug 4377)
4166 Parsoid variant.
4167 !! wikitext
4168 [http://example.com/1 [2345]
4169 !! html
4170 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4171 </p>
4172 !!end
4173
4174 !! test
4175 External links: nowiki in URL link text (bug 6230)
4176 !! wikitext
4177 [http://example.com/ <nowiki>''example site''</nowiki>]
4178 !! html
4179 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4180 </p>
4181 !! end
4182
4183 !! test
4184 External links: newline forbidden in text (bug 6230 regression check)
4185 !! wikitext
4186 [http://example.com/ first
4187 second]
4188 !! html
4189 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4190 second]
4191 </p>
4192 !!end
4193
4194 !! test
4195 External links: Pipe char between url and text
4196 !! wikitext
4197 [http://example.com | link]
4198 !! html
4199 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4200 </p>
4201 !!end
4202
4203 !! test
4204 External links: protocol-relative URL in brackets
4205 !! wikitext
4206 [//example.com/ Test]
4207 !! html
4208 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4209 </p>
4210 !! end
4211
4212 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4213 !! test
4214 External links: protocol-relative URL in brackets without text
4215 !! wikitext
4216 [//example.com]
4217 !! html/php
4218 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4219 </p>
4220 !! html/parsoid
4221 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4222 !! end
4223
4224 !! test
4225 External links: protocol-relative URL in free text is left alone
4226 !! wikitext
4227 //example.com/Foo
4228 !! html
4229 <p>//example.com/Foo
4230 </p>
4231 !!end
4232
4233 !! test
4234 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4235 !! wikitext
4236 foo//example.com/Foo
4237 !! html
4238 <p>foo//example.com/Foo
4239 </p>
4240 !! end
4241
4242 !! test
4243 External links: with no contents
4244 !! wikitext
4245 [http://en.wikipedia.org/wiki/Foo]
4246
4247 [[wikipedia:Foo|Bar]]
4248
4249 [[wikipedia:Foo|<span>Bar</span>]]
4250 !! html/php
4251 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4252 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4253 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4254 </p>
4255 !! html/parsoid
4256 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4257 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4258 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4259 !! end
4260
4261 !! test
4262 External links: Free with trailing punctuation
4263 !! wikitext
4264 http://example.com,
4265 http://example.com;
4266 http://example.com\
4267 http://example.com.
4268 http://example.com:
4269 http://example.com!
4270 http://example.com?
4271 http://example.com)
4272 http://example.com/url_with_(brackets)
4273 (http://example.com/url_without_brackets)
4274 http://example.com/url_with_entity&nbsp;
4275 http://example.com/url_with_entity&#xA0;
4276 http://example.com/url_with_entity&#160;
4277 http://example.com/url_with_entity&lt;
4278 http://example.com/url_with_entity&#x3C;
4279 http://example.com/url_with_entity&#60;
4280 !! html/php
4281 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4282 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4283 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4284 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4285 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4286 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4287 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4288 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4289 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4290 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4291 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4292 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4293 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4294 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4295 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4296 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4297 </p>
4298 !! html/parsoid
4299 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4300 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4301 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4302 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4303 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4304 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4305 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4306 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4307 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4308 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4309 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4310 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4311 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4312 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4313 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4314 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4315 !! end
4316
4317 !! test
4318 External links: No preceding word characters allowed (bug 65278)
4319 !! wikitext
4320 NOPEhttp://example.com
4321 N0http://example.com
4322 ok:http://example.com
4323 ok-http://example.com
4324 !! html
4325 <p>NOPEhttp://example.com
4326 N0http://example.com
4327 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4328 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4329 </p>
4330 !! end
4331
4332 !! test
4333 External image
4334 !! wikitext
4335 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4336 !! html
4337 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4338 </p>
4339 !! end
4340
4341 !! test
4342 External image from https
4343 !! wikitext
4344 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4345 !! html
4346 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4347 </p>
4348 !! end
4349
4350 !! test
4351 External image (when not allowed)
4352 !! options
4353 wgAllowExternalImages=0
4354 !! wikitext
4355 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4356 !! html
4357 <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>
4358 </p>
4359 !! end
4360
4361 !! test
4362 Link to non-http image, no img tag
4363 !! wikitext
4364 Link to non-http image, no img tag: ftp://example.com/test.jpg
4365 !! html
4366 <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>
4367 </p>
4368 !! end
4369
4370 !! test
4371 External links: terminating separator
4372 !! wikitext
4373 Terminating separator: http://example.com/thing,
4374 !! html
4375 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4376 </p>
4377 !! end
4378
4379 !! test
4380 External links: intervening separator
4381 !! wikitext
4382 Intervening separator: http://example.com/1,2,3
4383 !! html
4384 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4385 </p>
4386 !! end
4387
4388 !! test
4389 External links: old bug with URL in query
4390 !! wikitext
4391 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4392 !! html
4393 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4394 </p>
4395 !! end
4396
4397 !! test
4398 External links: old URL-in-URL bug, mixed protocols
4399 !! wikitext
4400 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4401 !! html
4402 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4403 </p>
4404 !!end
4405
4406 !! test
4407 External links: URL in text
4408 !! wikitext
4409 URL in text: [http://example.com http://example.com]
4410 !! html
4411 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4412 </p>
4413 !! end
4414
4415 !! test
4416 External links: Clickable images
4417 !! wikitext
4418 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4419 !! html/php
4420 <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>
4421 </p>
4422 !! html/parsoid
4423 <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>
4424 !! end
4425
4426 !! test
4427 External links: raw ampersand
4428 !! wikitext
4429 Old &amp; use: http://x&y
4430 !! html
4431 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4432 </p>
4433 !! end
4434
4435 !! test
4436 External links: encoded ampersand
4437 !! wikitext
4438 Old &amp; use: http://x&amp;y
4439 !! html/php
4440 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4441 </p>
4442 !! html/parsoid
4443 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4444 !! end
4445
4446 !! test
4447 External links: encoded equals (bug 6102)
4448 !! wikitext
4449 http://example.com/?foo&#61;bar
4450 !! html/php
4451 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4452 </p>
4453 !! html/parsoid
4454 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4455 !! end
4456
4457 ##
4458 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4459 ## does it number them. As discussed in bug 53505, we can identify
4460 ## autonumbered links via CSS.
4461 ##
4462
4463 !! test
4464 External links: [raw ampersand]
4465 !! wikitext
4466 Old &amp; use: [http://x&y]
4467 !! html/php
4468 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4469 </p>
4470 !! html/parsoid
4471 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4472 !! end
4473
4474 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4475 # mode will return the [raw ampersand] wikitext
4476 !! test
4477 External links: [encoded ampersand]
4478 !! options
4479 parsoid=wt2html,wt2wt,html2html
4480 !! wikitext
4481 Old &amp; use: [http://x&amp;y]
4482 !! html/php
4483 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4484 </p>
4485 !! html/parsoid
4486 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4487 !! end
4488
4489 !! test
4490 External links: [raw equals]
4491 !! wikitext
4492 [http://example.com/?foo=bar]
4493 !! html/php
4494 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4495 </p>
4496 !! html/parsoid
4497 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4498 !! end
4499
4500 # note that parsoid html is identical to [raw equals] case; so html2wt
4501 # mode will return the [raw equals] wikitext
4502 !! test
4503 External links: [encoded equals] (bug 6102)
4504 !! options
4505 parsoid=wt2html,wt2wt,html2html
4506 !! wikitext
4507 [http://example.com/?foo&#61;bar]
4508 !! html/php
4509 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4510 </p>
4511 !! html/parsoid
4512 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4513 !! end
4514
4515 # xxx parsoid strips the IDN character, so the round-trip tests will
4516 # obviously fail and are disabled. --cscott
4517 !! test
4518 External links: [IDN ignored character reference in hostname; strip it right off]
4519 !! options
4520 parsoid=wt2html,wt2wt,html2html
4521 !! wikitext
4522 [http://e&zwnj;xample.com/]
4523 !! html/php
4524 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4525 </p>
4526 !! html/parsoid
4527 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4528 !! end
4529
4530 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4531 # Where an external link could easily circumvent the sanitization of the text of
4532 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4533 # test demands a higher standard. That's a bit strange.
4534 #
4535 # Example:
4536 #
4537 # http://e‌xample.com -> [http://example.com|http://example.com]
4538 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4539 #
4540 # The first example is sanitized, but the second is not. Any security benefits
4541 # from this production are trivial to circumvent. Either remove this test and
4542 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4543 # the test accordingly.
4544 #
4545 # All our love,
4546 # The Parsoid team.
4547 # xxx parsoid strips the IDN character, so the round-trip tests will
4548 # obviously fail and are disabled. --cscott
4549 !! test
4550 External links: IDN ignored character reference in hostname; strip it right off
4551 !! options
4552 parsoid=wt2html,html2html
4553 !! wikitext
4554 http://e&zwnj;xample.com/
4555 !! html/php
4556 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4557 </p>
4558 !! html/parsoid
4559 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4560 !! end
4561
4562 !! test
4563 External links: www.jpeg.org (bug 554)
4564 !! wikitext
4565 http://www.jpeg.org
4566 !! html
4567 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4568 </p>
4569 !! end
4570
4571 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4572 !! test
4573 External links: URL within URL (original bug 2)
4574 !! wikitext
4575 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4576 !! html/php
4577 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4578 </p>
4579 !! html/parsoid
4580 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4581 !! end
4582
4583 !! test
4584 BUG 361: URL inside bracketed URL
4585 !! wikitext
4586 [http://www.example.com/foo http://www.example.com/bar]
4587 !! html
4588 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4589 </p>
4590 !! end
4591
4592 !! test
4593 BUG 361: URL within URL, not bracketed
4594 !! wikitext
4595 http://www.example.com/foo?=http://www.example.com/bar
4596 !! html
4597 <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>
4598 </p>
4599 !! end
4600
4601 !! test
4602 BUG 289: ">"-token in URL-tail
4603 !! wikitext
4604 http://www.example.com/<hello>
4605 !! html
4606 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4607 </p>
4608 !!end
4609
4610 !! test
4611 BUG 289: literal ">"-token in URL-tail
4612 !! wikitext
4613 http://www.example.com/<b>html</b>
4614 !! html/php
4615 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4616 </p>
4617 !! html/parsoid
4618 <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>
4619 !! end
4620
4621 !! test
4622 BUG 289: ">"-token in bracketed URL
4623 !! wikitext
4624 [http://www.example.com/<hello> stuff]
4625 !! html
4626 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4627 </p>
4628 !!end
4629
4630 !! test
4631 BUG 289: literal ">"-token in bracketed URL
4632 !! wikitext
4633 [http://www.example.com/<b>html</b> stuff]
4634 !! html
4635 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4636 </p>
4637 !!end
4638
4639 !! test
4640 BUG 289: literal double quote at end of URL
4641 !! wikitext
4642 http://www.example.com/"hello"
4643 !! html
4644 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4645 </p>
4646 !!end
4647
4648 !! test
4649 BUG 289: literal double quote in bracketed URL
4650 !! wikitext
4651 [http://www.example.com/"hello" stuff]
4652 !! html
4653 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4654 </p>
4655 !!end
4656
4657 !! test
4658 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4659 !! wikitext
4660 [http://www.example.com test]
4661 !! html
4662 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4663 </p>
4664 !! end
4665
4666 !! test
4667 External links: link text with spaces
4668 !! wikitext
4669 [http://www.example.com a b c]
4670 [http://www.example.com ''a'' ''b'']
4671 !! html
4672 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4673 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4674 </p>
4675 !! end
4676
4677 !! test
4678 External links: wiki links within external link (Bug 3695)
4679 !! wikitext
4680 [http://example.com [[wikilink]] embedded in ext link]
4681 !! html/php
4682 <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>
4683 </p>
4684 !! html/parsoid
4685 <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>
4686 !! end
4687
4688 !! test
4689 BUG 787: Links with one slash after the url protocol are invalid
4690 !! wikitext
4691 http:/example.com
4692
4693 [http:/example.com title]
4694 !! html
4695 <p>http:/example.com
4696 </p><p>[http:/example.com title]
4697 </p>
4698 !! end
4699
4700 !! test
4701 Bracketed external links with template-generated invalid target
4702 !! wikitext
4703 [{{echo|http:/example.com}} title]
4704 !! html
4705 <p>[http:/example.com title]
4706 </p>
4707 !! end
4708
4709 !! test
4710 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4711 !! wikitext
4712 ''[http://example.com text'']
4713 [http://example.com '''text]'''
4714 ''Something [http://example.com in italic'']
4715 ''Something [http://example.com mixed''''', even bold]'''
4716 '''''Now [http://example.com both''''']
4717 !! html
4718 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4719 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4720 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4721 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4722 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4723 </p>
4724 !! end
4725
4726
4727 !! test
4728 Bug 4781: %26 in URL
4729 !! wikitext
4730 http://www.example.com/?title=AT%26T
4731 !! html/php
4732 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4733 </p>
4734 !! html/parsoid
4735 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4736 !! end
4737
4738 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4739 # % is actually legal in HTML5. Any change in output would need testing though.
4740 !! test
4741 Bug 4781, 5267: %25 in URL
4742 !! wikitext
4743 http://www.example.com/?title=100%25_Bran
4744 !! html/php
4745 <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>
4746 </p>
4747 !! html/parsoid
4748 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4749 !! end
4750
4751 !! test
4752 Bug 4781, 5267: %28, %29 in URL
4753 !! wikitext
4754 http://www.example.com/?title=Ben-Hur_%281959_film%29
4755 !! html/php
4756 <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>
4757 </p>
4758 !! html/parsoid
4759 <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>
4760 !! end
4761
4762
4763 !! test
4764 Bug 4781: %26 in autonumber URL
4765 !! wikitext
4766 [http://www.example.com/?title=AT%26T]
4767 !! html/php
4768 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4769 </p>
4770 !! html/parsoid
4771 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4772 !! end
4773
4774 !! test
4775 Bug 4781, 5267: %26 in autonumber URL
4776 !! wikitext
4777 [http://www.example.com/?title=100%25_Bran]
4778 !! html/php
4779 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4780 </p>
4781 !! html/parsoid
4782 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4783 !! end
4784
4785 !! test
4786 Bug 4781, 5267: %28, %29 in autonumber URL
4787 !! wikitext
4788 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4789 !! html/php
4790 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4791 </p>
4792 !! html/parsoid
4793 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4794 !! end
4795
4796
4797 !! test
4798 Bug 4781: %26 in bracketed URL
4799 !! wikitext
4800 [http://www.example.com/?title=AT%26T link]
4801 !! html/php
4802 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4803 </p>
4804 !! html/parsoid
4805 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4806 !! end
4807
4808 !! test
4809 Bug 4781, 5267: %25 in bracketed URL
4810 !! wikitext
4811 [http://www.example.com/?title=100%25_Bran link]
4812 !! html
4813 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4814 </p>
4815 !! end
4816
4817 !! test
4818 Bug 4781, 5267: %28, %29 in bracketed URL
4819 !! wikitext
4820 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4821 !! html/php
4822 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4823 </p>
4824 !! html/parsoid
4825 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4826 !! end
4827
4828 !! test
4829 External link containing a period in the anchor. (bug 63947)
4830 !! wikitext
4831 [//foo.org/bar#baz. bang]
4832
4833 [//foo.org/bar. bang]
4834 !! html/php
4835 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4836 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4837 </p>
4838 !! html/parsoid
4839 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4840 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4841 !! end
4842
4843 !! test
4844 External link containing a single quote. (bug 63947)
4845 !! wikitext
4846 [//foo.org/bar'baz]
4847
4848 [//foo.org/bar'baz bang]
4849 !! html/php
4850 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4851 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4852 </p>
4853 !! html/parsoid
4854 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4855 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4856 !! end
4857
4858
4859 !! test
4860 External link containing a period in the anchor. (bug 63947)
4861 !! wikitext
4862 [//foo.org/bar#baz. bang]
4863
4864 [//foo.org/bar. bang]
4865 !! html/php
4866 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4867 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4868 </p>
4869 !! html/parsoid
4870 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4871 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4872 !! end
4873
4874 !! test
4875 External link containing a single quote. (bug 63947)
4876 !! wikitext
4877 [//foo.org/bar'baz]
4878
4879 [//foo.org/bar'baz bang]
4880 !! html/php
4881 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4882 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4883 </p>
4884 !! html/parsoid
4885 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4886 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4887 !! end
4888
4889
4890 !! test
4891 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4892 !! wikitext
4893 Some [http://example.com/ pretty ''italics'' and stuff]!
4894 !! html
4895 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4896 </p>
4897 !! end
4898
4899 !! test
4900 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4901 !! wikitext
4902 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4903 !! html
4904 <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>
4905 </p>
4906 !! end
4907
4908 !! test
4909 External link containing double-single-quotes with no space separating the url from text in italics
4910 !! wikitext
4911 [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]].]
4912 !! html/php
4913 <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>
4914 </p>
4915 !! html/php+tidy
4916 <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>
4917 !! html/parsoid
4918 <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>
4919 !! end
4920
4921 !! test
4922 External link with comments in link text
4923 !! wikitext
4924 [http://www.google.com Google <!-- comment -->]
4925 !! html
4926 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4927 </p>
4928 !! end
4929
4930 !! test
4931 URL-encoding in URL functions (single parameter)
4932 !! wikitext
4933 {{localurl:Some page|amp=&}}
4934 !! html
4935 <p>/index.php?title=Some_page&amp;amp=&amp;
4936 </p>
4937 !! end
4938
4939 !! test
4940 URL-encoding in URL functions (multiple parameters)
4941 !! wikitext
4942 {{localurl:Some page|q=?&amp=&}}
4943 !! html
4944 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4945 </p>
4946 !! end
4947
4948 !! test
4949 Brackets in urls
4950 !! wikitext
4951 http://example.com/index.php?foozoid%5B%5D=bar
4952
4953 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4954 !! html/php
4955 <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>
4956 </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>
4957 </p>
4958 !! html/parsoid
4959 <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>
4960
4961 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4962 !! end
4963
4964 !! test
4965 IPv6 urls (bug 21261)
4966 !! options
4967 disabled
4968 !! wikitext
4969 http://[2404:130:0:1000::187:2]/index.php
4970 !! html
4971 <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>
4972 </p>
4973 !! end
4974
4975 !! test
4976 Non-extlinks in brackets
4977 !! wikitext
4978 [foo]
4979 [foo bar]
4980 [foo ''bar'']
4981 [fool's] errand
4982 [fool's errand]
4983 [{{echo|foo}}]
4984 [{{echo|foo}} bar]
4985 [{{echo|foo}} ''bar'']
4986 [{{echo|foo}}l's] errand
4987 [{{echo|foo}}l's errand]
4988 [url={{echo|foo}}]
4989 [url=http://example.com]
4990 !! html
4991 <p>[foo]
4992 [foo bar]
4993 [foo <i>bar</i>]
4994 [fool's] errand
4995 [fool's errand]
4996 [foo]
4997 [foo bar]
4998 [foo <i>bar</i>]
4999 [fool's] errand
5000 [fool's errand]
5001 [url=foo]
5002 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5003 </p>
5004 !! end
5005
5006 !! test
5007 Percent encoding in external links
5008 !! wikitext
5009 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5010 !! html/php
5011 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5012 </p>
5013 !! html/parsoid
5014 <p><a rel="mw:ExtLink"
5015 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5016 !! end
5017
5018 !! test
5019 Use url link syntax for links where the content is equal the link target
5020 !! wikitext
5021 http://example.com
5022 !! html/php
5023 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5024 </p>
5025 !! html/parsoid
5026 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5027 !! end
5028
5029 !! test
5030 Parenthesis in external links, especially URL links
5031 !! wikitext
5032 http://example.com)
5033
5034 http://example.com/test)
5035
5036 http://example.com/(test)
5037
5038 http://example.com/((test)
5039
5040 (http://example.com/(test))
5041
5042 (http://example.com/(test)))))
5043
5044 http://example.com/a)b
5045
5046 [http://example.com) foo]
5047 !! html/php
5048 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5049 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5050 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5051 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5052 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5053 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5054 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5055 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5056 </p>
5057 !! html/parsoid
5058 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5059 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5060 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5061 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5062 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5063 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5064 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5065 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5066 !! end
5067
5068 !! test
5069 Parenthesis in external links, w/ transclusion or comment
5070 !! wikitext
5071 (http://example.com/{{echo|hi}})
5072
5073 (http://example.com<!-- hi -->)
5074 !! html/php
5075 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5076 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5077 </p>
5078 !! html/parsoid
5079 <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>
5080
5081 <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>
5082 !! end
5083
5084 !! test
5085 Replace invalid link targets when serializing
5086 !! options
5087 parsoid=html2wt
5088 !! html
5089 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5090 !! wikitext
5091 [[MediaWiki:Badtitletext|Manual]]
5092 !! end
5093
5094 ###
5095 ### Quotes
5096 ###
5097
5098 !! test
5099 Quotes
5100 !! wikitext
5101 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5102
5103 Normal text. '''''Bold italic text.''''' Normal text.
5104 !! html
5105 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5106 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5107 </p>
5108 !! end
5109
5110
5111 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5112 # parser strips. The wikitext contains just the first half of the bold
5113 # quote pair.
5114 !! test
5115 Unclosed and unmatched quotes
5116 !! wikitext
5117 '''''Bold italic text '''with bold deactivated''' in between.'''''
5118
5119 '''''Bold italic text ''with italic deactivated'' in between.'''''
5120
5121 '''Bold text..
5122
5123 ..spanning two paragraphs (should not work).'''
5124
5125 '''Bold tag left open
5126
5127 ''Italic tag left open
5128
5129 Normal text.
5130
5131 <!-- Unmatching number of opening, closing tags: -->
5132 '''This year''''s election ''should'' beat '''last year''''s.
5133
5134 ''Tom'''s car is bigger than ''Susan'''s.
5135
5136 Plain ''italic'''s plain
5137 !! html/php
5138 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5139 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5140 </p><p><b>Bold text..</b>
5141 </p><p>..spanning two paragraphs (should not work).
5142 </p><p><b>Bold tag left open</b>
5143 </p><p><i>Italic tag left open</i>
5144 </p><p>Normal text.
5145 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5146 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5147 </p><p>Plain <i>italic'</i>s plain
5148 </p>
5149 !! html/parsoid
5150 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5151 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5152 </p><p><b>Bold text..</b>
5153 </p><p>..spanning two paragraphs (should not work).<b></b>
5154 </p><p><b>Bold tag left open</b>
5155 </p><p><i>Italic tag left open</i>
5156 </p><p>Normal text.
5157 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5158 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5159 </p><p>Plain <i>italic'</i>s plain
5160 </p>
5161 !! end
5162
5163 ###
5164 ### Tables
5165 ###
5166 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5167 ###
5168
5169 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5170 # is the bare minimum required by the spec, see:
5171 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5172 # Parsoid team replies: empty table tags are legal in HTML5
5173 !! test
5174 A table with no data.
5175 !! options
5176 parsoid=wt2html
5177 !! wikitext
5178 {||}
5179 !! html/php
5180
5181 !! html/parsoid
5182 <table></table>
5183
5184 !! end
5185
5186 !! test
5187 A table with stray table end tags on start tag line (wt2html)
5188 !! options
5189 parsoid=wt2html
5190 !! wikitext
5191 {|style="color: red;"|}
5192
5193 {|style="color: red;" |}
5194 |foo
5195 |}
5196
5197 {|style="color: red;"|} id="foo"
5198 |foo
5199 |}
5200
5201 {|style="color: red;" |} id="foo"
5202 |foo
5203 |}
5204 !! html
5205 <table style="color: red;"></table>
5206
5207 <table style="color: red;">
5208 <tbody><tr>
5209 <td>foo</td>
5210 </tr></tbody>
5211 </table>
5212
5213 <table style="color: red;" id="foo">
5214 <tbody><tr>
5215 <td>foo</td>
5216 </tr></tbody>
5217 </table>
5218
5219 <table style="color: red;" id="foo">
5220 <tbody><tr>
5221 <td>foo</td>
5222 </tr></tbody>
5223 </table>
5224
5225 !! end
5226
5227 !! test
5228 A table with no data (take 2)
5229 !! wikitext
5230 {|
5231 |}
5232 !! html/parsoid
5233 <table></table>
5234 !! end
5235
5236 # A table with nothing but a caption is invalid XHTML, we might want to render
5237 # this as <p>caption</p>
5238 # Parsoid team replies: table with only a caption is legal in HTML5
5239 !! test
5240 A table with nothing but a caption
5241 !! wikitext
5242 {|
5243 |+ caption
5244 |}
5245 !! html/php
5246 <table>
5247 <caption> caption
5248 </caption><tr><td></td></tr></table>
5249
5250 !! html/parsoid
5251 <table><caption> caption</caption></table>
5252 !! end
5253
5254 !! test
5255 A table with caption with default-spaced attributes and a table row
5256 !! wikitext
5257 {|
5258 |+ style="color: red;" | caption1
5259 |-
5260 | foo
5261 |}
5262 !! html
5263 <table>
5264 <caption style="color: red;"> caption1
5265 </caption>
5266 <tr>
5267 <td> foo
5268 </td></tr></table>
5269
5270 !! end
5271
5272 !! test
5273 A table with captions with non-default spaced attributes and a table row
5274 !! wikitext
5275 {|
5276 |+style="color: red;"|caption2
5277 |+ style="color: red;"| caption3
5278 |-
5279 | foo
5280 |}
5281 !! html
5282 <table>
5283 <caption style="color: red;">caption2
5284 </caption>
5285 <caption style="color: red;"> caption3
5286 </caption>
5287 <tr>
5288 <td> foo
5289 </td></tr></table>
5290
5291 !! end
5292
5293 !! test
5294 Table td-cell syntax variations
5295 !! wikitext
5296 {|
5297 | foo bar foo | baz
5298 | foo bar foo || baz
5299 | style='color:red;' | baz
5300 | style='color:red;' || baz
5301 |}
5302 !! html
5303 <table>
5304 <tr>
5305 <td> baz
5306 </td>
5307 <td> foo bar foo </td>
5308 <td> baz
5309 </td>
5310 <td style="color:red;"> baz
5311 </td>
5312 <td> style='color:red;' </td>
5313 <td> baz
5314 </td></tr></table>
5315
5316 !! end
5317
5318 !! test
5319 Simple table
5320 !! wikitext
5321 {|
5322 | 1 || 2
5323 |-
5324 | 3 || 4
5325 |}
5326 !! html
5327 <table>
5328 <tr>
5329 <td> 1 </td>
5330 <td> 2
5331 </td></tr>
5332 <tr>
5333 <td> 3 </td>
5334 <td> 4
5335 </td></tr></table>
5336
5337 !! end
5338
5339 !! test
5340 Simple table but with multiple dashes for row wikitext
5341 !! wikitext
5342 {|
5343 | foo
5344 |-----
5345 | bar
5346 |}
5347 !! html
5348 <table>
5349 <tr>
5350 <td> foo
5351 </td></tr>
5352 <tr>
5353 <td> bar
5354 </td></tr></table>
5355
5356 !! end
5357 !! test
5358 Multiplication table
5359 !! wikitext
5360 {| border="1" cellpadding="2"
5361 |+Multiplication table
5362 |-
5363 ! &times; !! 1 !! 2 !! 3
5364 |-
5365 ! 1
5366 | 1 || 2 || 3
5367 |-
5368 ! 2
5369 | 2 || 4 || 6
5370 |-
5371 ! 3
5372 | 3 || 6 || 9
5373 |-
5374 ! 4
5375 | 4 || 8 || 12
5376 |-
5377 ! 5
5378 | 5 || 10 || 15
5379 |}
5380 !! html
5381 <table border="1" cellpadding="2">
5382 <caption>Multiplication table
5383 </caption>
5384 <tr>
5385 <th> &#215; </th>
5386 <th> 1 </th>
5387 <th> 2 </th>
5388 <th> 3
5389 </th></tr>
5390 <tr>
5391 <th> 1
5392 </th>
5393 <td> 1 </td>
5394 <td> 2 </td>
5395 <td> 3
5396 </td></tr>
5397 <tr>
5398 <th> 2
5399 </th>
5400 <td> 2 </td>
5401 <td> 4 </td>
5402 <td> 6
5403 </td></tr>
5404 <tr>
5405 <th> 3
5406 </th>
5407 <td> 3 </td>
5408 <td> 6 </td>
5409 <td> 9
5410 </td></tr>
5411 <tr>
5412 <th> 4
5413 </th>
5414 <td> 4 </td>
5415 <td> 8 </td>
5416 <td> 12
5417 </td></tr>
5418 <tr>
5419 <th> 5
5420 </th>
5421 <td> 5 </td>
5422 <td> 10 </td>
5423 <td> 15
5424 </td></tr></table>
5425
5426 !! end
5427
5428 !! test
5429 Accept "||" in table headings
5430 !! wikitext
5431 {|
5432 !h1 || h2
5433 |}
5434 !! html
5435 <table>
5436 <tr>
5437 <th>h1 </th>
5438 <th> h2
5439 </th></tr></table>
5440
5441 !! end
5442
5443 !! test
5444 Accept "!!" in table data
5445 !! wikitext
5446 {|
5447 | Foo!! ||
5448 |}
5449 !! html
5450 <table>
5451 <tr>
5452 <td> Foo!! </td>
5453 <td>
5454 </td></tr></table>
5455
5456 !! html/parsoid
5457 <table>
5458 <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>
5459 </tbody></table>
5460 !! end
5461
5462 !! test
5463 Accept "||" in indented table headings
5464 !! wikitext
5465 :{|
5466 !h1 || h2
5467 |}
5468 !! html
5469 <dl><dd><table>
5470 <tr>
5471 <th>h1 </th>
5472 <th> h2
5473 </th></tr></table></dd></dl>
5474
5475 !! end
5476
5477 !! test
5478 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5479 !! wikitext
5480 {|
5481 !| h1
5482 || a
5483 |}
5484 !! html
5485 <table>
5486 <tr>
5487 <th> h1
5488 </th>
5489 <td> a
5490 </td></tr></table>
5491
5492 !! end
5493
5494 !!test
5495 Accept "| !" at start of line in tables (ignore !-attribute)
5496 !! wikitext
5497 {|
5498 |-
5499 | !style="color:red" | bar
5500 |}
5501 !! html
5502 <table>
5503
5504 <tr>
5505 <td> bar
5506 </td></tr></table>
5507
5508 !!end
5509
5510 !!test
5511 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 +/-
5512 !! wikitext
5513 {|
5514 |-
5515 |style='color:red;'|+1
5516 |style='color:blue;'|-1
5517 |-
5518 | 1 || 2 || 3
5519 | 1 ||+2 ||-3
5520 |-
5521 | +1
5522 | -1
5523 |}
5524 !! html
5525 <table>
5526
5527 <tr>
5528 <td style="color:red;">+1
5529 </td>
5530 <td style="color:blue;">-1
5531 </td></tr>
5532 <tr>
5533 <td> 1 </td>
5534 <td> 2 </td>
5535 <td> 3
5536 </td>
5537 <td> 1 </td>
5538 <td>+2 </td>
5539 <td>-3
5540 </td></tr>
5541 <tr>
5542 <td> +1
5543 </td>
5544 <td> -1
5545 </td></tr></table>
5546
5547 !!end
5548
5549 !! test
5550 Table rowspan
5551 !! wikitext
5552 {| border=1
5553 | Cell 1, row 1
5554 |rowspan=2| Cell 2, row 1 (and 2)
5555 | Cell 3, row 1
5556 |-
5557 | Cell 1, row 2
5558 | Cell 3, row 2
5559 |}
5560 !! html
5561 <table border="1">
5562 <tr>
5563 <td> Cell 1, row 1
5564 </td>
5565 <td rowspan="2"> Cell 2, row 1 (and 2)
5566 </td>
5567 <td> Cell 3, row 1
5568 </td></tr>
5569 <tr>
5570 <td> Cell 1, row 2
5571 </td>
5572 <td> Cell 3, row 2
5573 </td></tr></table>
5574
5575 !! end
5576
5577 !! test
5578 Nested table
5579 !! wikitext
5580 {| border=1
5581 | &alpha;
5582 |
5583 {| bgcolor=#ABCDEF border=2
5584 |nested
5585 |-
5586 |table
5587 |}
5588 |the original table again
5589 |}
5590 !! html
5591 <table border="1">
5592 <tr>
5593 <td> &#945;
5594 </td>
5595 <td>
5596 <table bgcolor="#ABCDEF" border="2">
5597 <tr>
5598 <td>nested
5599 </td></tr>
5600 <tr>
5601 <td>table
5602 </td></tr></table>
5603 </td>
5604 <td>the original table again
5605 </td></tr></table>
5606
5607 !! end
5608
5609 !! test
5610 Invalid attributes in table cell (bug 1830)
5611 !! wikitext
5612 {|
5613 |Cell:|broken
5614 |}
5615 !! html
5616 <table>
5617 <tr>
5618 <td>broken
5619 </td></tr></table>
5620
5621 !! end
5622
5623 # The "|}" to close the table is missing from the input, so parsoid's
5624 # *2wt modes will fail.
5625 !! test
5626 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5627 !! options
5628 parsoid=wt2html,html2html
5629 !! wikitext
5630 {|
5631 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5632 !! html/php
5633 <table>
5634 <tr>
5635 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5636 <td>]" onmouseover="alert(document.cookie)"&gt;test
5637 </td>
5638 </tr>
5639 </table>
5640
5641 !! html/parsoid
5642 <table><tbody>
5643 <tr>
5644 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5645 !! end
5646
5647 # FIXME: The php output is broken.
5648 !! test
5649 ! and || in td attributes should not be parsed as <th>/<td>
5650 !! wikitext
5651 {|
5652 | style="color: red !important;" data-contrived="put this here ||" | foo
5653 |}
5654 !! html/php
5655 <table>
5656 <tr>
5657 <td> style="color: red !important;" data-contrived="put this here </td>
5658 <td> foo
5659 </td></tr></table>
5660
5661 !! html/parsoid
5662 <table>
5663 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5664 </tbody></table>
5665 !! end
5666
5667 !! test
5668 Indented table markup mixed with indented pre content (proposed in bug 6200)
5669 !! wikitext
5670 <table>
5671 <tr>
5672 <td>
5673 Text that should be rendered preformatted
5674 </td>
5675 </tr>
5676 </table>
5677 !! html
5678 <table>
5679 <tr>
5680 <td>
5681 <pre>Text that should be rendered preformatted
5682 </pre>
5683 </td>
5684 </tr>
5685 </table>
5686
5687 !! end
5688
5689 !! test
5690 1. Template-generated table cell attributes and cell content
5691 !! wikitext
5692 {|
5693 |{{table_attribs}}
5694 | {{table_attribs}}
5695 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5696 |align=center {{table_attribs}}
5697 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5698 |}
5699 !! html
5700 <table>
5701 <tr>
5702 <td style="color:red;">Foo
5703 </td>
5704 <td style="color:red;">Foo
5705 </td>
5706 <td style="color:red;">Foo
5707 </td>
5708 <td align="center" style="color:red;">Foo
5709 </td>
5710 <td align="center" style="color:red;">Foo
5711 </td></tr></table>
5712
5713 !! end
5714
5715 !! test
5716 2. Template-generated table cell attributes and cell content
5717 !! wikitext
5718 {|
5719 |{{table_attribs_2}}
5720 |}
5721 !! html/php
5722 <table>
5723 <tr>
5724 <td style="color:red;">Foo
5725 </td>
5726 <td>Bar</td>
5727 <td>Baz
5728 </td></tr></table>
5729
5730 !! html/parsoid
5731 <table>
5732 <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>
5733 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5734 </tbody></table>
5735 !! end
5736
5737 !! test
5738 3. Template-generated table cell attributes and cell content
5739 !! wikitext
5740 {|
5741 !align=center {{table_header_cells}}
5742 |-
5743 |align=center {{table_cells}}
5744 |}
5745 !! html/php
5746 <table>
5747 <tr>
5748 <th align="center" style="color:red;">Foo</th>
5749 <th style="color:red;"><i>Bar</i></th>
5750 <th style="color:brown;"><i>Foo</i> and Baz
5751 </th></tr>
5752 <tr>
5753 <td align="center" style="color:red;">Foo</td>
5754 <td style="color:red;"><i>Bar</i></td>
5755 <td style="color:brown;"><i>Foo</i> and Baz
5756 </td></tr></table>
5757
5758 !! html/parsoid
5759 <table>
5760 <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>
5761 <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>
5762 </tbody></table>
5763 !! end
5764
5765 !! test
5766 Table with row followed by newlines and table heading
5767 !! wikitext
5768 {|
5769 |-
5770
5771 ! foo
5772 |}
5773 !! html
5774 <table>
5775
5776
5777 <tr>
5778 <th> foo
5779 </th></tr></table>
5780
5781 !! end
5782
5783 !! test
5784 Table with empty line following the start tag
5785 !! wikitext
5786 {|
5787
5788 |-
5789 | foo
5790 |}
5791 !! html
5792 <table>
5793
5794
5795 <tr>
5796 <td> foo
5797 </td></tr></table>
5798
5799 !! end
5800
5801 # FIXME: Preserve the attribute properly (with an empty string as value) in
5802 # the PHP parser. Parsoid implements the behavior below.
5803 !! test
5804 Table attributes with empty value
5805 !! wikitext
5806 {|
5807 | style=| hello
5808 |}
5809 !! html/parsoid
5810 <table>
5811 <tbody>
5812 <tr>
5813 <td style=""> hello
5814 </td></tr></tbody></table>
5815
5816 !! end
5817
5818 !! test
5819 Wikitext table with a lot of comments
5820 !! wikitext
5821 {|
5822 <!-- c0 -->
5823 | foo
5824 <!-- c1 -->
5825 |- <!-- c2 -->
5826 <!-- c3 -->
5827 |<!-- c4 -->
5828 <!-- c5 -->
5829 |}
5830 !! html
5831 <table>
5832 <tr>
5833 <td> foo
5834 </td></tr>
5835 <tr>
5836 <td>
5837 </td></tr></table>
5838
5839 !! end
5840
5841 !! test
5842 Wikitext table with double-line table cell
5843 !! wikitext
5844 {|
5845 |a
5846 b
5847 |}
5848 !! html
5849 <table>
5850 <tr>
5851 <td>a
5852 <p>b
5853 </p>
5854 </td></tr></table>
5855
5856 !! end
5857
5858 !! test
5859 Table cell with a single comment
5860 !! wikitext
5861 {|
5862 | <!-- c1 -->
5863 | a
5864 |}
5865 !! html
5866 <table>
5867 <tr>
5868 <td>
5869 </td>
5870 <td> a
5871 </td></tr></table>
5872
5873 !! end
5874
5875 !! test
5876 Table-cell after a comment-only-empty-line
5877 !! wikitext
5878 {|
5879 |a
5880 <!--c1-->
5881 <!--c2-->| b
5882 |}
5883 !! html
5884 <table>
5885 <tr>
5886 <td>a
5887 </td>
5888 <td> b
5889 </td></tr></table>
5890
5891 !! html/parsoid
5892 <table>
5893 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5894 <!--c1-->
5895 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5896 </tbody></table>
5897
5898 !! end
5899
5900 !! test
5901 Build table with {{!}}
5902 !! wikitext
5903 {{{!}} class="wikitable"
5904 ! header
5905 ! second header
5906 {{!}}- style="color:red;"
5907 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5908 {{!}}}
5909 !! html
5910 <table class="wikitable">
5911 <tr>
5912 <th> header
5913 </th>
5914 <th> second header
5915 </th></tr>
5916 <tr style="color:red;">
5917 <td> data </td>
5918 <td style="color:red;"> second data
5919 </td></tr></table>
5920
5921 !! end
5922
5923 !! test
5924 Build table with pipe as data
5925 !! wikitext
5926 {| class="wikitable"
5927 ! header
5928 ! second header
5929 |- style="color:red;"
5930 | data || style="color:red;" | second data
5931 |-
5932 | style="color:red;" | data with | || style="color:red;" | second data with |
5933 |-
5934 || data with | ||| second data with |
5935 |}
5936 !! html
5937 <table class="wikitable">
5938 <tr>
5939 <th> header
5940 </th>
5941 <th> second header
5942 </th></tr>
5943 <tr style="color:red;">
5944 <td> data </td>
5945 <td style="color:red;"> second data
5946 </td></tr>
5947 <tr>
5948 <td style="color:red;"> data with | </td>
5949 <td style="color:red;"> second data with |
5950 </td></tr>
5951 <tr>
5952 <td> data with | </td>
5953 <td> second data with |
5954 </td></tr></table>
5955
5956 !! end
5957
5958 !! test
5959 Build table with wikilink
5960 !! wikitext
5961 {| class="wikitable"
5962 ! header || second header
5963 |- style="color:red;"
5964 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5965 |-
5966 | data || second data [[Main Page|link|text with pipe]]
5967 |}
5968 !! html
5969 <table class="wikitable">
5970 <tr>
5971 <th> header </th>
5972 <th> second header
5973 </th></tr>
5974 <tr style="color:red;">
5975 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5976 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5977 </td></tr>
5978 <tr>
5979 <td> data </td>
5980 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5981 </td></tr></table>
5982
5983 !! end
5984
5985 # The expected HTML structure in this test is debatable. The PHP parser does
5986 # not parse this kind of table at all. The main focus for Parsoid is on
5987 # round-tripping, so this output is ok for now. TODO: revisit!
5988 !! test
5989 Wikitext table with html-syntax row
5990 !! wikitext
5991 {|
5992 |-
5993 <td>foo</td>
5994 |}
5995 !! html/parsoid
5996 <table>
5997 <tbody>
5998 <tr>
5999 <td>foo</td></tr></tbody></table>
6000 !! end
6001
6002 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6003 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6004 ## PHP parser, which tidy then compounds by fostering the content
6005 ## entirely out of the table. Parsoid recognizes the table context
6006 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6007 ## depends on PHP's treatment of broken table markup!
6008 !! test
6009 Implicit <td> after a |-
6010 !! options
6011 parsoid=wt2html,html2html
6012 !! wikitext
6013 {|
6014 |-
6015 a
6016 |}
6017 !! html/php
6018 <table>
6019
6020 a
6021 </table>
6022
6023 !! html/php+tidy
6024 <p>a</p>
6025 !! html/parsoid
6026 <table>
6027 <tr><td>a</td></tr>
6028 </table>
6029 !! end
6030
6031 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6032 !! test
6033 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6034 !! options
6035 parsoid=wt2html,html2html
6036 !! wikitext
6037 {|
6038 |-
6039 |
6040 a
6041 |-
6042 b
6043 |}
6044 !! html/php
6045 <table>
6046
6047 <tr>
6048 <td>
6049 <pre>a
6050 </pre>
6051 </td></tr>
6052 b
6053 </table>
6054
6055 !! html/php+tidy
6056 <p>b</p>
6057 <table>
6058 <tr>
6059 <td>
6060 <pre>
6061 a
6062 </pre></td>
6063 </tr>
6064 </table>
6065 !! html/parsoid
6066 <table>
6067 <tbody>
6068 <tr><td><pre>a</pre></td></tr>
6069 <tr><td> b</td></tr>
6070 </tbody>
6071 </table>
6072 !! end
6073
6074 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6075 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6076 !! test
6077 Lists should be recognized in an implicit <td> context
6078 !! options
6079 parsoid=wt2html,html2html
6080 !! wikitext
6081 {|
6082 |-
6083 *a
6084 |}
6085 !! html/php
6086 <table>
6087
6088 <ul><li>a</li></ul>
6089 </table>
6090
6091 !! html/php+tidy
6092 <ul>
6093 <li>a</li>
6094 </ul>
6095 !! html/parsoid
6096 <table>
6097 <tr>
6098 <td><ul>
6099 <li>a</li>
6100 </ul></td>
6101 </tr>
6102 </table>
6103 !! end
6104
6105 !! test
6106 Parsoid: Round-trip tables directly followed by content (bug 51219)
6107 !! options
6108 parsoid=wt2html,wt2wt
6109 !! wikitext
6110 {|
6111 |foo
6112 |} bar
6113
6114 {|
6115 |baz
6116 |}<b>quux</b>
6117 !! html+tidy
6118 <table>
6119 <tr>
6120 <td>foo</td>
6121 </tr>
6122 </table>
6123 <p>bar</p>
6124 <table>
6125 <tr>
6126 <td>baz</td>
6127 </tr>
6128 </table>
6129 <p><b>quux</b></p>
6130 !! end
6131
6132 !! test
6133 Parsoid: Default to a newline after tables in new content (bug 51219)
6134 !! options
6135 parsoid=html2wt
6136 !! html
6137 <table><tbody>
6138 <tr><td>foo</td></tr></tbody></table> bar
6139 <table><tbody>
6140 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6141 !! wikitext
6142 {|
6143 |foo
6144 |}
6145 <nowiki> </nowiki>bar
6146 {|
6147 |baz
6148 |}
6149 '''quux'''
6150 !! end
6151
6152 !! test
6153 Parsoid: newline inducing block nodes don't suppress <nowiki>
6154 !! options
6155 parsoid=html2wt
6156 !! html
6157 a<h1>foo</h1>
6158 !! wikitext
6159 <nowiki> </nowiki>a
6160
6161 = foo =
6162 !! end
6163
6164 !! test
6165 Parsoid: Row-syntax table headings followed by comment & table cells
6166 !! options
6167 parsoid=wt2html,wt2wt
6168 !! wikitext
6169 {|
6170 ! foo || bar
6171 <!-- foo --> || baz || quux
6172 |}
6173 !! html/php
6174 <table>
6175 <tr>
6176 <th> foo </th>
6177 <th> bar
6178 </th>
6179 <td> baz </td>
6180 <td> quux
6181 </td></tr></table>
6182
6183 !! html/parsoid
6184 <table>
6185 <tbody><tr><th> foo </th><th> bar
6186 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6187 </tbody></table>
6188 !! end
6189
6190
6191 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6192 # preserves it.
6193 !!test
6194 Parsoid: Recover better from broken table attributes
6195 !!options
6196 parsoid=wt2html
6197 !!wikitext
6198 {| class="foo
6199 | class="bar" |
6200 foo
6201 |}
6202 !!html/php+tidy
6203 <table>
6204 <tr>
6205 <td class="bar">
6206 <p>foo</p>
6207 </td>
6208 </tr>
6209 </table>
6210 !!html/parsoid
6211 <table class="foo">
6212 <tr>
6213 <td class="bar">
6214 <p>foo</p></td></tr>
6215 </tbody></table>
6216 !!end
6217
6218 !! test
6219 Strip unsupported table tags
6220 !! options
6221 parsoid=html2wt
6222 !! html
6223 <table>
6224 <thead>
6225 <tr>
6226 <th>Month</th>
6227 <th>Savings</th>
6228 </tr>
6229 </thead>
6230 <tbody>
6231 <tr>
6232 <td>January</td>
6233 <td>$100</td>
6234 </tr>
6235 <tr>
6236 <td>February</td>
6237 <td>$80</td>
6238 </tr>
6239 </tbody>
6240 <tfoot>
6241 <tr>
6242 <td>Sum</td>
6243 <td>$180</td>
6244 </tr>
6245 </tfoot>
6246 </table>
6247 !! wikitext
6248 {|
6249
6250 !Month
6251 !Savings
6252
6253 |January
6254 |$100
6255
6256 |-
6257 |February
6258 |$80
6259
6260 |Sum
6261 |$180
6262
6263 |}
6264 !! end
6265
6266 !!test
6267 Testing serialization after deletion of table cells
6268 !!options
6269 parsoid={
6270 "modes": ["wt2wt"],
6271 "changes": [
6272 ["#x", "remove"]
6273 ]
6274 }
6275 !!wikitext
6276 {|
6277 !h1 !!h2 !!h3
6278 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6279 |}
6280 !! wikitext/edited
6281 {|
6282 !h1 !!h2 !!h3
6283 |c2 |||c3
6284 |}
6285 !!end
6286
6287 ###
6288 ### Internal links
6289 ###
6290 !! test
6291 Plain link, capitalized
6292 !! wikitext
6293 [[Main Page]]
6294 !! html
6295 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6296 </p>
6297 !! end
6298
6299 !! test
6300 Plain link, uncapitalized
6301 !! wikitext
6302 [[main Page]]
6303 !! html
6304 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6305 </p>
6306 !! end
6307
6308 !! test
6309 Piped link
6310 !! wikitext
6311 [[Main Page|The Main Page]]
6312 !! html
6313 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6314 </p>
6315 !! end
6316
6317 !! test
6318 Piped link with comment in link text
6319 !! wikitext
6320 [[Main Page|The Main<!--front--> Page]]
6321 !! html
6322 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6323 </p>
6324 !! end
6325
6326 !! test
6327 Piped link with multiple pipe characters in link text
6328 !! wikitext
6329 [[Main Page||The|Main|Page|]]
6330 !! html/php
6331 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6332 </p>
6333 !! html/parsoid
6334 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6335 !! end
6336
6337 !! test
6338 Broken link
6339 !! wikitext
6340 [[Zigzagzogzagzig]]
6341 !! html
6342 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6343 </p>
6344 !! end
6345
6346 !! test
6347 Broken link with fragment
6348 !! wikitext
6349 [[Zigzagzogzagzig#zug]]
6350 !! html
6351 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6352 </p>
6353 !! end
6354
6355 !! test
6356 Special page link with fragment
6357 !! wikitext
6358 [[Special:Version#anchor]]
6359 !! html
6360 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6361 </p>
6362 !! end
6363
6364 !! test
6365 Nonexistent special page link with fragment
6366 !! wikitext
6367 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6368 !! html
6369 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6370 </p>
6371 !! end
6372
6373 !! test
6374 Link with prefix
6375 !! wikitext
6376 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6377 !! html
6378 <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>
6379 </p>
6380 !! end
6381
6382 !! test
6383 Link with suffix
6384 !! wikitext
6385 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6386 !! html
6387 <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>!!!
6388 </p>
6389 !! end
6390
6391 !! article
6392 prefixed article
6393 !! text
6394 Some text
6395 !! endarticle
6396
6397 !! test
6398 Bug 43661: Piped links with identical prefixes
6399 !! wikitext
6400 [[prefixed article|prefixed articles with spaces]]
6401
6402 [[prefixed article|prefixed articlesaoeu]]
6403
6404 [[Main Page|Main Page test]]
6405 !! html
6406 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6407 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6408 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6409 </p>
6410 !! end
6411
6412
6413 !! test
6414 Link with HTML entity in suffix / tail
6415 !! wikitext
6416 [[Main Page]]&quot;, [[Main Page]]&#97;
6417 !! html/php
6418 <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;
6419 </p>
6420 !! html/parsoid
6421 <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>
6422 !! end
6423
6424 !! test
6425 Link with 3 brackets
6426 !! wikitext
6427 [[[Main Page]]]
6428 !! html
6429 <p>[[[Main Page]]]
6430 </p>
6431 !! end
6432
6433 !! test
6434 Link with 4 brackets
6435 !! wikitext
6436 [[[[Main Page]]]]
6437 !! html
6438 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6439 </p>
6440 !! end
6441
6442 !! test
6443 Piped link with 3 brackets
6444 !! wikitext
6445 [[[main page|the main page]]]
6446 !! html
6447 <p>[[[main page|the main page]]]
6448 </p>
6449 !! end
6450
6451 !! test
6452 Piped link with extlink-like text
6453 !! wikitext
6454 [[Main Page|[bar]]]
6455 [[Main Page|This is a [bar]]]
6456 !! html/php
6457 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6458 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6459 </p>
6460 !! html/parsoid
6461 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6462 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6463 !! end
6464
6465 !! test
6466 Link with multiple pipes
6467 !! wikitext
6468 [[Main Page|The|Main|Page]]
6469 !! html
6470 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6471 </p>
6472 !! end
6473
6474 # Note that parsoid does not munge anchor text; all non-space
6475 # characters are valid in HTML5 ids.
6476 !! test
6477 Anchor containing a #. (bug 63430)
6478 !! wikitext
6479 [[Main Page#And#Link]]
6480 !! html/php
6481 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6482 </p>
6483 !! html/parsoid
6484 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6485 !! end
6486
6487 !! test
6488 Link to namespaces
6489 !! wikitext
6490 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6491 !! html
6492 <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>
6493 </p>
6494 !! end
6495
6496 !! test
6497 Link with space in namespace
6498 !! wikitext
6499 [[User talk:Foo bar]]
6500 !! html
6501 <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>
6502 </p>
6503 !! end
6504
6505 !! article
6506 MemoryAlpha:AlphaTest
6507 !! text
6508 This is an article in the MemoryAlpha namespace
6509 (which shadows the memoryalpha interwiki link).
6510 !! endarticle
6511
6512 !! test
6513 Namespace takes precedence over interwiki link (bug 51680)
6514 !! wikitext
6515 [[MemoryAlpha:AlphaTest]]
6516 !! html
6517 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6518 </p>
6519 !! end
6520
6521 # The previous test doesn't work correctly in html2*, due to not recognizing the
6522 # link as an internal one. This one checks for the correct behavior.
6523 !! test
6524 Link to namespace preferred over interwiki with correct rel attribute
6525 !! options
6526 parsoid=html2wt,html2html
6527 !! html
6528 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6529 !! wikitext
6530 [[MemoryAlpha:AlphaTest]]
6531 !! end
6532
6533 !! test
6534 Piped link to namespace
6535 !! wikitext
6536 [[Meta:Disclaimers|The disclaimers]]
6537 !! html
6538 <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>
6539 </p>
6540 !! end
6541
6542 !! test
6543 Link containing }
6544 !! wikitext
6545 [[Usually caused by a typo (oops}]]
6546 !! html
6547 <p>[[Usually caused by a typo (oops}]]
6548 </p>
6549 !! end
6550
6551 !! article
6552 7% Solution
6553 !! text
6554 Just a test of an article title containing a percent.
6555 !! endarticle
6556
6557 !! test
6558 Link containing % (not as a hex sequence)
6559 !! wikitext
6560 [[7% Solution]]
6561 !! html/php
6562 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6563 </p>
6564 !! html/parsoid
6565 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6566 !! end
6567
6568 # note that the parsoid HTML is identical to the previous test output,
6569 # so the previous test ensures that the html2wt mode will generate the
6570 # "not as a hex sequence" wikitext.
6571 !! test
6572 Link containing % as a single hex sequence interpreted to char
6573 !! options
6574 parsoid=wt2wt,wt2html,html2html
6575 !! wikitext
6576 [[7%25 Solution]]
6577 !! html/php
6578 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6579 </p>
6580 !! html/parsoid
6581 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6582 !!end
6583
6584 !! test
6585 Link containing % as a double hex sequence interpreted to hex sequence
6586 !! wikitext
6587 [[7%2525 Solution]]
6588 !! html
6589 <p>[[7%2525 Solution]]
6590 </p>
6591 !!end
6592
6593 # note that parsoid does not munge anchor text; all non-space
6594 # characters are valid in HTML5 anchors.
6595 !! test
6596 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6597 Example for such a section: == < ==
6598 !! wikitext
6599 [[%23%3c]][[%23%3e]]
6600 !! html/php
6601 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6602 </p>
6603 !! html/parsoid
6604 <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>
6605 !! end
6606
6607 !! test
6608 Link containing "<#" and ">#" as a hex sequences
6609 !! wikitext
6610 [[%3c%23]][[%3e%23]]
6611 !! html
6612 <p>[[%3c%23]][[%3e%23]]
6613 </p>
6614 !! end
6615
6616 !! test
6617 Link containing an equals sign
6618 !! wikitext
6619 [[Special:BookSources/isbn=4-00-026157-6]]
6620 !! html/php
6621 <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>
6622 </p>
6623 !! html/parsoid
6624 <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>
6625 !! end
6626
6627 !! article
6628 Foo~bar
6629 !! text
6630 Just a test of an article title containing a tilde.
6631 !! endarticle
6632
6633 # note that links containing signatures, like [[Foo~~~~]], are
6634 # massaged by the pre-save transform (PST) and so the tildes are never
6635 # seen by the parser.
6636 !! test
6637 Link containing a tilde
6638 !! wikitext
6639 [[Foo~bar]]
6640 !! html/php
6641 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6642 </p>
6643 !! html/parsoid
6644 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6645 !! end
6646
6647 !! test
6648 Link containing double-single-quotes '' (bug 4598)
6649 !! wikitext
6650 [[Lista d''e paise d''o munno]]
6651 !! html/php
6652 <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>
6653 </p>
6654 !! html/parsoid
6655 <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>
6656 !! end
6657
6658 !! test
6659 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6660 !! wikitext
6661 Some [[Link|pretty ''italics'' and stuff]]!
6662 !! html/php
6663 <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>!
6664 </p>
6665 !! html/parsoid
6666 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6667 !! end
6668
6669 !! test
6670 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6671 !! wikitext
6672 ''Some [[Link|pretty ''italics'' and stuff]]!''
6673 !! html
6674 <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>
6675 </p>
6676 !! end
6677
6678 !! test
6679 Link with double quotes in title part (literal) and alternate part (interpreted)
6680 !! wikitext
6681 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6682
6683 [[''Pentecoste'']]
6684
6685 [[''Pentecoste''|Pentecoste]]
6686
6687 [[''Pentecoste''|''Pentecoste'']]
6688 !! html/php
6689 <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>
6690 </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>
6691 </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>
6692 </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>
6693 </p>
6694 !! html/parsoid
6695 <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>
6696 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6697 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6698 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6699 !! end
6700
6701 !! test
6702 Broken image links with HTML captions (bug 39700)
6703 !! wikitext
6704 [[File:Nonexistent|<script></script>]]
6705 [[File:Nonexistent|100x100px|<script></script>]]
6706 [[File:Nonexistent|&lt;]]
6707 [[File:Nonexistent|a<i>b</i>c]]
6708 !! html/php
6709 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6710 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6711 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6712 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6713 </p>
6714 !! html/parsoid
6715 <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>
6716 <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>
6717 <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>
6718 <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>
6719 !! end
6720
6721 !! test
6722 Plain link to URL
6723 !! wikitext
6724 [[http://www.example.com]]
6725 !! html/php
6726 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6727 </p>
6728 !! html/parsoid
6729 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6730 !! end
6731
6732 !! test
6733 Plain link to URL with link text
6734 !! wikitext
6735 [[http://www.example.com Link text]]
6736 !! html
6737 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6738 </p>
6739 !! end
6740
6741 !! test
6742 Plain link to protocol-relative URL
6743 !! wikitext
6744 [[//www.example.com]]
6745 !! html/php
6746 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6747 </p>
6748 !! html/parsoid
6749 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6750 !! end
6751
6752 !! test
6753 Plain link to protocol-relative URL with link text
6754 !! wikitext
6755 [[//www.example.com Link text]]
6756 !! html
6757 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6758 </p>
6759 !! end
6760
6761 !! test
6762 Plain link to page with question mark in title
6763 !! wikitext
6764 [[A?b]]
6765
6766 [[A?b|Baz]]
6767 !! html
6768 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6769 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6770 </p>
6771 !! end
6772
6773
6774 # I'm fairly sure the expected result here is wrong.
6775 # We want these to be URL links, not pseudo-pages with URLs for titles....
6776 # However the current output is also pretty screwy.
6777 #
6778 # ----
6779 # I'm changing it to match the current output--it arguably makes more
6780 # sense in the light of the test above. Old expected result was:
6781 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6782 #</p>
6783 # But I think this test is bordering on "garbage in, garbage out" anyway.
6784 # -- wtm
6785 !! test
6786 Piped link to URL
6787 !! wikitext
6788 Piped link to URL: [[http://www.example.com|an example URL]]
6789 !! html/php
6790 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6791 </p>
6792 !! html/parsoid
6793 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6794 !! end
6795
6796 !! test
6797 BUG 2: [[page|http://url/]] should link to page, not http://url/
6798 !! wikitext
6799 [[Main Page|http://url/]]
6800 !! html/php
6801 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6802 </p>
6803 !! html/parsoid
6804 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6805 !! end
6806
6807 # Parsoid does not mark self-links, by design.
6808 !! test
6809 BUG 337: Escaped self-links should be bold
6810 !! options
6811 title=[[Bug462]]
6812 !! wikitext
6813 [[Bu&#103;462]] [[Bug462]]
6814 !! html/php
6815 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6816 </p>
6817 !! html/php+tidy
6818 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6819 !! html/parsoid
6820 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6821 !! end
6822
6823 !! test
6824 Self-link to section should not be bold
6825 !! options
6826 title=[[Main Page]]
6827 !! wikitext
6828 [[Main Page#section]]
6829 !! html
6830 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6831 </p>
6832 !! end
6833
6834 !! article
6835 00
6836 !! text
6837 This is 00.
6838 !! endarticle
6839
6840 !!test
6841 Self-link to numeric title
6842 !!options
6843 title=[[0]]
6844 !! wikitext
6845 [[0]]
6846 !! html
6847 <p><strong class="selflink">0</strong>
6848 </p>
6849 !!end
6850
6851 !!test
6852 Link to numeric-equivalent title
6853 !!options
6854 title=[[0]]
6855 !! wikitext
6856 [[00]]
6857 !! html
6858 <p><a href="/wiki/00" title="00">00</a>
6859 </p>
6860 !!end
6861
6862 !! test
6863 <nowiki> inside a link
6864 !! wikitext
6865 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6866 !! html
6867 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6868 </p>
6869 !! end
6870
6871 !! test
6872 Non-breaking spaces in title
6873 !! wikitext
6874 [[&nbsp; Main &nbsp; Page &nbsp;]]
6875 !! html
6876 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6877 </p>
6878 !!end
6879
6880 !! test
6881 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6882 !! options
6883 language=ca
6884 !! wikitext
6885 '''[[Main Page]]'''
6886 !! html
6887 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6888 </p>
6889 !! end
6890
6891 !! test
6892 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6893 !! options
6894 language=ca
6895 !! wikitext
6896 ''[[Main Page]]''
6897 !! html
6898 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6899 </p>
6900 !! end
6901
6902 !! test
6903 Internal link with en linktrail: no apostrophes (bug 27473)
6904 !! options
6905 language=en
6906 !! wikitext
6907 [[Something]]'nice
6908 !! html
6909 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6910 </p>
6911 !! end
6912
6913 !! test
6914 Internal link with ca linktrail with apostrophes (bug 27473)
6915 !! options
6916 language=ca
6917 !! wikitext
6918 [[Something]]'nice
6919 !! html
6920 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6921 </p>
6922 !! end
6923
6924 !! test
6925 Internal link with kaa linktrail with apostrophes (bug 27473)
6926 !! options
6927 language=kaa
6928 !! wikitext
6929 [[Something]]'nice
6930 !! html
6931 <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>
6932 </p>
6933 !! end
6934
6935 !! test
6936 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6937 !! wikitext
6938 [[User:Foo/Test/63636:Bar|Test]]
6939 !! html/php
6940 <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>
6941 </p>
6942 !! html/parsoid
6943 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6944 !! end
6945
6946 !! test
6947 Purely hash wikilink
6948 !! options
6949 title=[[User:test/123]]
6950 !! wikitext
6951 [[#a|b]]
6952 !! html/php
6953 <p><a href="#a">b</a>
6954 </p>
6955 !! html/parsoid
6956 <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>
6957 !! end
6958
6959 !! test
6960 1. Interaction of linktrail and template encapsulation
6961 !! options
6962 parsoid
6963 !! wikitext
6964 {{echo|[[Foo]]}}l
6965 !! html
6966 <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>
6967 !! end
6968
6969 !! test
6970 2. Interaction of linktrail and template encapsulation
6971 !! options
6972 parsoid
6973 !! wikitext
6974 {{echo|Some [[Fool]]}}s
6975 !! html
6976 <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>
6977 !! end
6978
6979 !! test
6980 3. Interaction of linktrail and template encapsulation
6981 !! options
6982 parsoid
6983 !! wikitext
6984 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6985 !! html
6986 <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>
6987 !! end
6988
6989 !! article
6990 Söfnuður
6991 !! text
6992 Test.
6993 !! endarticle
6994
6995 !! test
6996 Internal link with is link prefix
6997 !! options
6998 language=is
6999 !! wikitext
7000 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7001 !! html
7002 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7003 </p>
7004 !! end
7005
7006 !! article
7007 Mótmælendatrú
7008 !! text
7009 Test.
7010 !! endarticle
7011
7012 !! test
7013 Internal link with is link trail and link prefix
7014 !! options
7015 language=is
7016 !! wikitext
7017 [[mótmælendatrú|xxx]]ar
7018 [[mótmælendatrú]]ar
7019 mótmælenda[[söfnuður]]
7020 mótmælenda[[söfnuður|söfnuðir]]
7021 mótmælenda[[söfnuður|söfnuðir]]xxx
7022 !! html
7023 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7024 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7025 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7026 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7027 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7028 </p>
7029 !! end
7030
7031 !! test
7032 Parsoid link trail escaping
7033 !! options
7034 parsoid=html2wt,html2html
7035 !! html
7036 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7037 !! wikitext
7038 [[apple]]<nowiki/>s
7039 !! end
7040
7041 !! test
7042 Parsoid link prefix escaping
7043 !! options
7044 language=is
7045 parsoid=html2wt,html2html
7046 !! html
7047 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7048 !! wikitext
7049 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7050 !! end
7051
7052 !! test
7053 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7054 !! wikitext
7055 [[Foo| bar]]
7056
7057 [[Foo| ''bar'']]
7058
7059 [http://wp.org foo]
7060
7061 [http://wp.org ''foo'']
7062 !! html
7063 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7064 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7065 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7066 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7067 </p>
7068 !! end
7069
7070 !! test
7071 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7072 !! options
7073 parsoid
7074 !! wikitext
7075 [[Foo|{{echo|a}} b {{echo|c}}]]
7076 !! html
7077 <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>
7078 !! end
7079
7080 !! test
7081 Link with angle bracket after anchor
7082 !! wikitext
7083 [[Foo#<bar>]]
7084 !! html/php
7085 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7086 </p>
7087 !! html/parsoid
7088 <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>
7089 !! end
7090
7091 ###
7092 ### Interwiki links (see maintenance/interwiki.sql)
7093 ###
7094
7095 !! test
7096 Inline interwiki link
7097 !! options
7098 parsoid=wt2html,wt2wt,html2html
7099 !! wikitext
7100 [[MeatBall:SoftSecurity]]
7101 !! html/php
7102 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7103 </p>
7104 !! html/parsoid
7105 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7106 !! end
7107
7108 !! test
7109 Inline interwiki link with empty title (bug 2372)
7110 !! options
7111 parsoid=wt2html,wt2wt,html2html
7112 !! wikitext
7113 [[MeatBall:]]
7114 !! html/php
7115 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7116 </p>
7117 !! html/parsoid
7118 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7119 !! end
7120
7121 !! test
7122 Interwiki link encoding conversion (bug 1636)
7123 !! wikitext
7124 *[[Wikipedia:ro:Olteni&#0355;a]]
7125 *[[Wikipedia:ro:Olteni&#355;a]]
7126 !! html
7127 <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>
7128 <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>
7129
7130 !! html+tidy
7131 <ul>
7132 <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>
7133 <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>
7134 </ul>
7135 !! end
7136
7137 !! test
7138 Interwiki link with fragment (bug 2130)
7139 !! wikitext
7140 [[MeatBall:SoftSecurity#foo]]
7141 !! html
7142 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7143 </p>
7144 !! end
7145
7146 # Ideally the wikipedia: prefix here should be proto-relative too
7147 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7148 # define the 'en' prefix, and originally the test used 'wikipedia',
7149 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7150 # article.
7151 !! test
7152 Different interwiki prefixes mapping to the same URL
7153 !! wikitext
7154 [[:en:Foo]]
7155
7156 [[:en:Foo|Foo]]
7157
7158 [[wikipedia:Foo]]
7159
7160 [[:wikipedia:Foo|Foo]]
7161
7162 [[wikipedia:en:Foo]]
7163
7164 [[:wikipedia:en:Foo]]
7165
7166 [[ wikiPEdia :Foo]]
7167 !! html/parsoid
7168 <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>
7169
7170 <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>
7171
7172 <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>
7173
7174 <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>
7175
7176 <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>
7177
7178 <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>
7179
7180 <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>
7181 !! end
7182
7183 !! test
7184 Interwiki links that cannot be represented in wiki syntax
7185 !! wikitext
7186 [[meatball:ok]]
7187 [[meatball:ok#foo|ok with fragment]]
7188 [[meatball:ok_as_well?|ok ending with ? mark]]
7189 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7190 [http://de.wikipedia.org/wiki/#foo is just fragment]
7191
7192 !! html/php
7193 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7194 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7195 <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>
7196 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7197 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7198 </p>
7199 !! html/parsoid
7200 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7201 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7202 <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>
7203 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7204 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7205 !! end
7206
7207 !! test
7208 Interwiki links: trail
7209 !! wikitext
7210 [[wikipedia:Foo|Ba]]r
7211 !! html/php
7212 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7213 </p>
7214 !! html/parsoid
7215 <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>
7216 !! end
7217
7218 !! test
7219 Local interwiki link
7220 !! options
7221 parsoid=wt2html,wt2wt,html2html
7222 !! wikitext
7223 [[local:Template:Foo]]
7224 !! html/php
7225 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7226 </p>
7227 !! html/parsoid
7228 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7229 !! end
7230
7231 # Parsoid does not mark self-links, by design.
7232 !! test
7233 Local interwiki link: self-link to current page
7234 !! options
7235 title=[[Main Page]]
7236 parsoid=wt2html,wt2wt,html2html
7237 !! wikitext
7238 [[local:Main Page]]
7239 !! html/php
7240 <p><strong class="selflink">local:Main Page</strong>
7241 </p>
7242 !! html/parsoid
7243 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7244 !! end
7245
7246 !! test
7247 Local interwiki link: prefix only (bug 64167)
7248 !! options
7249 parsoid=wt2html,wt2wt,html2html
7250 !! wikitext
7251 [[local:]]
7252 !! html/php
7253 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7254 </p>
7255 !! html/parsoid
7256 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7257 !! end
7258
7259 !! test
7260 Local interwiki link: with additional interwiki prefix (bug 61357)
7261 !! options
7262 parsoid=wt2html,wt2wt,html2html
7263 !! wikitext
7264 [[local:meatball:Hello]]
7265 !! html/php
7266 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7267 </p>
7268 !! html/parsoid
7269 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7270 !! end
7271
7272 !! test
7273 Multiple local interwiki link prefixes
7274 !! wikitext
7275 [[local:local:local:local:mi:local:Foo]]
7276 !! options
7277 parsoid=wt2html,wt2wt,html2html
7278 !! html/php
7279 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7280 </p>
7281 !! html/parsoid
7282 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7283 !! end
7284
7285 ###
7286 ### Interlanguage links
7287 ### Language links (so that searching for '### language' matches..)
7288 ###
7289
7290 !! test
7291 Interlanguage link
7292 !! options
7293 parsoid=wt2html,wt2wt,html2html
7294 !! wikitext
7295 Blah blah blah
7296 [[zh:Chinese]]
7297 !! html/php
7298 <p>Blah blah blah
7299 </p>
7300 !! html/parsoid
7301 <p>Blah blah blah</p>
7302 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7303 !! end
7304
7305 !! test
7306 Interlanguage link with spacing
7307 !! options
7308 parsoid=wt2html,wt2wt,html2html
7309 !! wikitext
7310 Blah blah blah
7311 [[ zh : Chinese ]]
7312 !! html/php
7313 <p>Blah blah blah
7314 </p>
7315 !! html/parsoid
7316 <p>Blah blah blah</p>
7317 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7318 !! end
7319
7320 !! test
7321 Double interlanguage link
7322 !! options
7323 parsoid=wt2html,wt2wt,html2html
7324 !! wikitext
7325 Blah blah blah
7326 [[es:Spanish]]
7327 [[zh:Chinese]]
7328 !! html/php
7329 <p>Blah blah blah
7330 </p>
7331 !! html/parsoid
7332 <p>Blah blah blah</p>
7333 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7334 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7335 !! end
7336
7337 !! test
7338 Interlanguage link variations
7339 !! options
7340 parsoid=wt2html,wt2wt,html2html
7341 !! wikitext
7342 Blah blah blah
7343 [[ es :Spanish]]
7344 [[ ZH :Chinese]]
7345 [[es:Foo_bar]]
7346 [[es:Foo bar]]
7347 !! html/php
7348 <p>Blah blah blah
7349 </p>
7350 !! html/parsoid
7351 <p>Blah blah blah</p>
7352 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7353 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7354 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7355 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7356 !! end
7357
7358 !! test
7359 Interlanguage link, with prefix links
7360 !! options
7361 language=ln
7362 !! wikitext
7363 Blah blah blah
7364 [[zh:Chinese]]
7365 !! html/php
7366 <p>Blah blah blah
7367 </p>
7368 !! html/parsoid
7369 <p>Blah blah blah</p>
7370 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7371 !! end
7372
7373 !! test
7374 Double interlanguage link, with prefix links (bug 8897)
7375 !! options
7376 language=ln
7377 !! wikitext
7378 Blah blah blah
7379 [[es:Spanish]]
7380 [[zh:Chinese]]
7381 !! html/php
7382 <p>Blah blah blah
7383 </p>
7384 !! html/parsoid
7385 <p>Blah blah blah</p>
7386 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7387 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7388 !! end
7389
7390 !! test
7391 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7392 !! wikitext
7393 Blah blah blah
7394 [[mul:Article]]
7395 !! html/php
7396 <p>Blah blah blah
7397 </p>
7398 !! html/parsoid
7399 <p>Blah blah blah</p>
7400 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7401 !! end
7402
7403 !! test
7404 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7405 !! options
7406 language=ln
7407 !! wikitext
7408 [[WW&nbsp;II]]
7409 !! html
7410 <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>
7411 </p>
7412 !! end
7413
7414 !! test
7415 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7416 !! options
7417 parsoid=html2wt
7418 !! html
7419 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7420 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7421 !! wikitext
7422 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7423
7424 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7425 !! end
7426
7427 !! test
7428 Parsoid: handle constructor well
7429 !! wikitext
7430 [[constructor]]
7431
7432 [[constructor:foo]]
7433 !! html/php
7434 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7435 </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>
7436 </p>
7437 !! html/parsoid
7438 <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>
7439
7440 <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>
7441 !! end
7442
7443 !! article
7444 ko:
7445 !! text
7446 Test.
7447 !! endarticle
7448
7449 # Note that `ko` isn't a known interlanguage prefix
7450 !! test
7451 Parsoid: recognize interlanguage links without a target page
7452 !! options
7453 ill
7454 !! wikitext
7455 [[es:]]
7456
7457 [[ko:]]
7458 !! html/php
7459 es:
7460 !! html/parsoid
7461 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7462
7463 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7464 !! end
7465
7466 # Note that `ko` isn't a known interwiki prefix
7467 !! test
7468 Parsoid: recognize interwiki links without a target page
7469 !! options
7470 parsoid=wt2html,wt2wt,html2html
7471 !! wikitext
7472 [[:es:]]
7473
7474 [[:ko:]]
7475 !! html/php
7476 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7477 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7478 </p>
7479 !! html/parsoid
7480 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7481 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7482 !! end
7483
7484 !! test
7485 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7486 !! wikitext
7487 [[mi:Foo]]
7488 !! html/php
7489 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7490 </p>
7491 !! html/parsoid
7492 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7493 !! end
7494
7495 !! test
7496 Interlanguage link with preceding local interwiki link (bug 68085)
7497 !! options
7498 parsoid=wt2html,wt2wt,html2html
7499 !! wikitext
7500 Blah blah blah
7501 [[local:es:Spanish]]
7502 !! html/php
7503 <p>Blah blah blah
7504 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7505 </p>
7506 !! html/parsoid
7507 <p>Blah blah blah
7508 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7509 !! end
7510
7511 !! test
7512 Looks like an interlanguage link, but is actually a local interwiki
7513 !! options
7514 parsoid=wt2html,wt2wt,html2html
7515 !! wikitext
7516 Blah blah blah
7517 [[mi:Template:Foo]]
7518 !! html/php
7519 <p>Blah blah blah
7520 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7521 </p>
7522 !! html/parsoid
7523 <p>Blah blah blah
7524 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7525 !! end
7526
7527 ###
7528 ### Redirects, Parsoid-only
7529 ###
7530 !! test
7531 1. Simple redirect to page
7532 !! options
7533 parsoid
7534 !! wikitext
7535 #REDIRECT [[Main Page]]
7536 !! html
7537 <link rel="mw:PageProp/redirect" href="./Main_Page">
7538 !! end
7539
7540 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7541 !! test
7542 2. Other redirect variants
7543 !! options
7544 parsoid=wt2html,wt2wt
7545 !! wikitext
7546 #REDIRECT [[Main_Page]]
7547 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7548 !! html/parsoid
7549 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7550 !! end
7551
7552 !! test
7553 Empty redirect
7554 !! options
7555 parsoid=wt2html,wt2wt
7556 !! wikitext
7557 #REDIRECT [[]]
7558 !! html
7559 <ol>
7560 <li>REDIRECT [[]]</li></ol>
7561 !! end
7562
7563 !! test
7564 Optional colon in #REDIRECT
7565 !! options
7566 # the colon is archaic syntax. we support it for wt2html, but we
7567 # don't care that it roundtrips back to the modern syntax.
7568 parsoid=wt2html,html2html
7569 !! wikitext
7570 #REDIRECT:[[Main Page]]
7571 !! html
7572 <link rel="mw:PageProp/redirect" href="./Main_Page">
7573 !! end
7574
7575 !! test
7576 Whitespace in #REDIRECT with optional colon
7577 !! options
7578 # the colon and gratuitous whitespace is archaic syntax. we support
7579 # it for wt2html, but we don't care that it roundtrips back to the
7580 # modern syntax (without extra whitespace)
7581 parsoid=wt2html,html2html
7582 !! wikitext
7583
7584 #REDIRECT
7585 :
7586 [[Main Page]]
7587 !! html
7588 <link rel="mw:PageProp/redirect" href="./Main_Page">
7589 !! end
7590
7591 !! test
7592 Piped link in #REDIRECT
7593 !! options
7594 # content after piped link is ignored. we support this syntax,
7595 # but don't care that the piped link is lost when we roundtrip this.
7596 parsoid=wt2html
7597 !! wikitext
7598 #REDIRECT [[Main Page|bar]]
7599 !! html
7600 <link rel="mw:PageProp/redirect" href="./Main_Page">
7601 !! end
7602
7603 !! test
7604 Redirect to category
7605 !! options
7606 parsoid=wt2html
7607 !! wikitext
7608 #REDIRECT [[Category:Foo]]
7609 !! html
7610 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7611 !! end
7612
7613 !! test
7614 Redirect to category with URL encoding
7615 !! options
7616 parsoid=wt2html
7617 !! wikitext
7618 #REDIRECT [[Category%3AFoo]]
7619 !! html
7620 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7621 !! end
7622
7623 !! test
7624 Redirect to category page
7625 !! options
7626 parsoid=wt2html,html2html
7627 !! wikitext
7628 #REDIRECT [[:Category:Foo]]
7629 !! html
7630 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7631 !! end
7632
7633 !! test
7634 Redirect to image page (1)
7635 !! options
7636 parsoid
7637 !! wikitext
7638 #REDIRECT [[File:Wiki.png]]
7639 !! html
7640 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7641 !! end
7642
7643 !! test
7644 Redirect to image page (2)
7645 !! options
7646 parsoid
7647 !! wikitext
7648 #REDIRECT [[Image:Wiki.png]]
7649 !! html
7650 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7651 !! end
7652
7653 !! test
7654 Redirect to language
7655 !! options
7656 parsoid
7657 !! wikitext
7658 #REDIRECT [[en:File:Wiki.png]]
7659 !! html
7660 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7661 !! end
7662
7663 !! test
7664 Redirect to interwiki
7665 !! options
7666 parsoid
7667 !! wikitext
7668 #REDIRECT [[meatball:File:Wiki.png]]
7669 !! html
7670 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7671 !! end
7672
7673 !! test
7674 Non-English #REDIRECT
7675 !! options
7676 parsoid
7677 language=is
7678 !! wikitext
7679 #TILVÍSUN [[Main Page]]
7680 !! html
7681 <link rel="mw:PageProp/redirect" href="./Main_Page">
7682 !! end
7683
7684 !! test
7685 New redirect
7686 !! options
7687 parsoid=html2wt
7688 !! html
7689 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7690 !! wikitext
7691 Foo
7692 #REDIRECT [[Foo]]
7693 !! end
7694
7695 ##
7696 ## XHTML tidiness
7697 ###
7698
7699 !! test
7700 <br> to <br />
7701 !! wikitext
7702 1<br>2<br />3
7703 !! html
7704 <p>1<br />2<br />3
7705 </p>
7706 !! end
7707
7708 !! test
7709 Broken br tag sanitization
7710 !! wikitext
7711 </br>
7712 !! html/php
7713 <p>&lt;/br&gt;
7714 </p>
7715 !! end
7716
7717 # TODO: Fix html2html mode (bug 51055)!
7718 !! test
7719 Parsoid: Broken br tag recognition
7720 !! options
7721 parsoid=wt2html
7722 !! wikitext
7723 </br>
7724
7725 <br/ >
7726 !! html+tidy
7727 <p><br /></p>
7728 <p><br /></p>
7729 !! end
7730
7731 !! test
7732 Incorrecly removing closing slashes from correctly formed XHTML
7733 !! wikitext
7734 <br style="clear:both;" />
7735 !! html
7736 <p><br style="clear:both;" />
7737 </p>
7738 !! end
7739
7740 !! test
7741 Failing to transform badly formed HTML into correct XHTML
7742 !! wikitext
7743 <br style="clear: left;">
7744 <br style="clear: right;">
7745 <br style="clear: both;">
7746 !! html
7747 <p><br style="clear: left;" />
7748 <br style="clear: right;" />
7749 <br style="clear: both;" />
7750 </p>
7751 !!end
7752
7753 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7754 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7755 !! test
7756 Handling html with a div self-closing tag
7757 !! wikitext
7758 <div title />
7759 <div title/>
7760 <div title/ >
7761 <div title=bar />
7762 <div title=bar/>
7763 <div title=bar/ >
7764 !! html/php
7765 <p>&lt;div title /&gt;
7766 &lt;div title/&gt;
7767 </p>
7768 <div>
7769 <p>&lt;div title=bar /&gt;
7770 &lt;div title=bar/&gt;
7771 </p>
7772 <div title="bar/"></div>
7773 </div>
7774
7775 !! html/parsoid
7776 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7777 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7778 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7779 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7780 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7781 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7782 !! end
7783
7784 !! test
7785 Handling html with a br self-closing tag
7786 !! wikitext
7787 <br title />
7788 <br title/>
7789 <br title/ >
7790 <br title=bar />
7791 <br title=bar/>
7792 <br title=bar/ >
7793 !! html/php
7794 <p><br title="title" />
7795 <br title="title" />
7796 <br />
7797 <br title="bar" />
7798 <br title="bar" />
7799 <br title="bar/" />
7800 </p>
7801 !! html/parsoid
7802 <p><br title="" />
7803 <br title="" />
7804 <br title="" />
7805 <br title="bar" />
7806 <br title="bar" />
7807 <br title="bar/" />
7808 </p>
7809 !! end
7810
7811 !! test
7812 Horizontal ruler (should it add that extra space?)
7813 !! wikitext
7814 <hr>
7815 <hr >
7816 foo <hr
7817 > bar
7818 !! html+tidy
7819 <hr />
7820 <hr />
7821 <p>foo</p>
7822 <hr />
7823 <p>bar</p>
7824 !! end
7825
7826 !! test
7827 Horizontal ruler -- 4+ dashes render hr
7828 !! wikitext
7829 ----
7830 !! html
7831 <hr />
7832
7833 !! end
7834
7835 !! test
7836 Horizontal ruler -- eats additional dashes on the same line
7837 !! wikitext
7838 ---------
7839 !! html
7840 <hr />
7841
7842 !! end
7843
7844 !! test
7845 Horizontal ruler -- does not collapse dashes on consecutive lines
7846 !! wikitext
7847 ----
7848 ----
7849 !! html
7850 <hr />
7851 <hr />
7852
7853 !! end
7854
7855 !! test
7856 Horizontal ruler -- <4 dashes render as plain text
7857 !! wikitext
7858 ---
7859 !! html
7860 <p>---
7861 </p>
7862 !! end
7863
7864 !! test
7865 Horizontal ruler -- Supports content following dashes on same line
7866 !! wikitext
7867 ---- Foo
7868 !! html
7869 <hr /> Foo
7870
7871 !! html+tidy
7872 <hr />
7873 <p>Foo</p>
7874 !! end
7875
7876 ###
7877 ### Block-level elements
7878 ###
7879 !! test
7880 Common list
7881 !! wikitext
7882 *Common list
7883 * item 2
7884 *item 3
7885 !! html
7886 <ul><li>Common list</li>
7887 <li> item 2</li>
7888 <li>item 3</li></ul>
7889
7890 !! end
7891
7892 !! test
7893 Numbered list
7894 !! wikitext
7895 #Numbered list
7896 #item 2
7897 # item 3
7898 !! html
7899 <ol><li>Numbered list</li>
7900 <li>item 2</li>
7901 <li> item 3</li></ol>
7902
7903 !! end
7904
7905 !! test
7906 Mixed list
7907 !! wikitext
7908 *Mixed list
7909 *# with numbers
7910 ** and bullets
7911 *# and numbers
7912 *bullets again
7913 **bullet level 2
7914 ***bullet level 3
7915 ***#Number on level 4
7916 **bullet level 2
7917 **#Number on level 3
7918 **#Number on level 3
7919 *#number level 2
7920 *Level 1
7921 *** Level 3
7922 #** Level 3, but ordered
7923 !! html
7924 <ul><li>Mixed list
7925 <ol><li> with numbers</li></ol>
7926 <ul><li> and bullets</li></ul>
7927 <ol><li> and numbers</li></ol></li>
7928 <li>bullets again
7929 <ul><li>bullet level 2
7930 <ul><li>bullet level 3
7931 <ol><li>Number on level 4</li></ol></li></ul></li>
7932 <li>bullet level 2
7933 <ol><li>Number on level 3</li>
7934 <li>Number on level 3</li></ol></li></ul>
7935 <ol><li>number level 2</li></ol></li>
7936 <li>Level 1
7937 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7938 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7939
7940 !! end
7941
7942 !! test
7943 Nested lists 1
7944 !! wikitext
7945 *foo
7946 **bar
7947 !! html
7948 <ul><li>foo
7949 <ul><li>bar</li></ul></li></ul>
7950
7951 !! end
7952
7953 !! test
7954 Nested lists 2
7955 !! wikitext
7956 **foo
7957 *bar
7958 !! html
7959 <ul><li><ul><li>foo</li></ul></li>
7960 <li>bar</li></ul>
7961
7962 !! end
7963
7964 !! test
7965 Nested lists 3 (first element empty)
7966 !! wikitext
7967 *
7968 **bar
7969 !! html
7970 <ul><li>
7971 <ul><li>bar</li></ul></li></ul>
7972
7973 !! end
7974
7975 !! test
7976 Nested lists 4 (first element empty)
7977 !! wikitext
7978 **
7979 *bar
7980 !! html
7981 <ul><li><ul><li></li></ul></li>
7982 <li>bar</li></ul>
7983
7984 !! end
7985
7986 !! test
7987 Nested lists 5 (both elements empty)
7988 !! wikitext
7989 **
7990 *
7991 !! html
7992 <ul><li><ul><li></li></ul></li>
7993 <li></li></ul>
7994
7995 !! end
7996
7997 !! test
7998 Nested lists 6 (both elements empty)
7999 !! wikitext
8000 *
8001 **
8002 !! html
8003 <ul><li>
8004 <ul><li></li></ul></li></ul>
8005
8006 !! end
8007
8008 !! test
8009 Nested lists 7 (skip initial nesting levels)
8010 !! wikitext
8011 *** foo
8012 !! html
8013 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8014
8015 !! end
8016
8017 !! test
8018 Nested lists 8 (multiple nesting transitions)
8019 !! wikitext
8020 * foo
8021 *** bar
8022 ** baz
8023 * boo
8024 !! html
8025 <ul><li> foo
8026 <ul><li><ul><li> bar</li></ul></li>
8027 <li> baz</li></ul></li>
8028 <li> boo</li></ul>
8029
8030 !! end
8031
8032 !! test
8033 1. Lists with start-of-line-transparent tokens before bullets: Comments
8034 !! wikitext
8035 *foo
8036 *<!--cmt-->bar
8037 <!--cmt-->*baz
8038 !! html
8039 <ul><li>foo</li>
8040 <li>bar</li>
8041 <li>baz</li></ul>
8042
8043 !! end
8044
8045 !! test
8046 2. Lists with start-of-line-transparent tokens before bullets: Template close
8047 !! wikitext
8048 *foo {{echo|bar
8049 }}*baz
8050 !! html
8051 <ul><li>foo bar</li>
8052 <li>baz</li></ul>
8053
8054 !! end
8055
8056 !! test
8057 List items are not parsed correctly following a <pre> block (bug 785)
8058 !! wikitext
8059 * <pre>foo</pre>
8060 * <pre>bar</pre>
8061 * zar
8062 !! html
8063 <ul><li> <pre>foo</pre></li>
8064 <li> <pre>bar</pre></li>
8065 <li> zar</li></ul>
8066
8067 !! end
8068
8069 !! test
8070 List items from template
8071 !! wikitext
8072
8073 {{inner list}}
8074 * item 2
8075
8076 * item 0
8077 {{inner list}}
8078 * item 2
8079
8080 * item 0
8081 * notSOL{{inner list}}
8082 * item 2
8083 !! html
8084 <ul><li> item 1</li>
8085 <li> item 2</li></ul>
8086 <ul><li> item 0</li>
8087 <li> item 1</li>
8088 <li> item 2</li></ul>
8089 <ul><li> item 0</li>
8090 <li> notSOL</li>
8091 <li> item 1</li>
8092 <li> item 2</li></ul>
8093
8094 !! end
8095
8096 !! test
8097 List interrupted by empty line or heading
8098 !! wikitext
8099 * foo
8100
8101 ** bar
8102 == A heading ==
8103 * Another list item
8104 !! html
8105 <ul><li> foo</li></ul>
8106 <ul><li><ul><li> bar</li></ul></li></ul>
8107 <h2><a href="#A_heading" class="mw-headline-anchor" aria-hidden="true" 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>
8108 <ul><li> Another list item</li></ul>
8109
8110 !!end
8111
8112 !!test
8113 Multiple list tags generated by templates
8114 !! wikitext
8115 {{echo|<li>}}a
8116 {{echo|<li>}}b
8117 {{echo|<li>}}c
8118 !! html
8119 <li>a
8120 <li>b
8121 <li>c</li>
8122 </li>
8123 </li>
8124
8125 !! html+tidy
8126 <ul>
8127 <li>a</li>
8128 <li>b</li>
8129 <li>c</li>
8130 </ul>
8131 !!end
8132
8133 !!test
8134 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8135 !! wikitext
8136 *a
8137 <!--This line will NOT split the list-->
8138 *b
8139 <!--This line will NOT split the list either-->
8140 *c
8141 <!--foo--> <!----> <!--This line NOT split the list either-->
8142 *d
8143 !! html
8144 <ul><li>a</li>
8145 <li>b</li>
8146 <li>c</li>
8147 <li>d</li></ul>
8148
8149 !!end
8150
8151 !!test
8152 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8153 !! wikitext
8154 *a
8155 <!--This line will NOT split the list-->
8156 *b
8157 <!--This line will NOT split the list either-->
8158 *c
8159 <!--foo--> <!----> <!--This line NOT split the list
8160 either-->
8161 *d
8162 !! html
8163 <ul><li>a</li>
8164 <li>b</li>
8165 <li>c</li>
8166 <li>d</li></ul>
8167
8168 !!end
8169
8170 !!test
8171 Test the li-hack
8172 (The PHP parser relies on Tidy for the hack)
8173 !!options
8174 parsoid=wt2html,wt2wt
8175 !! wikitext
8176 * foo
8177 * <li>li-hack
8178 * {{echo|<li>templated li-hack}}
8179 * <!--foo--> <li> unsupported li-hack with preceding comments
8180
8181 <ul>
8182 <li><li>not a li-hack
8183 </li>
8184 </ul>
8185 !! html+tidy
8186 <ul>
8187 <li>foo</li>
8188 <li>li-hack</li>
8189 <li>templated li-hack</li>
8190 <li>unsupported li-hack with preceding comments</li>
8191 </ul>
8192 <ul>
8193 <li>not a li-hack</li>
8194 </ul>
8195 !!end
8196
8197 !! test
8198 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8199 !! options
8200 parsoid
8201 !! wikitext
8202 # foo
8203 ## bar
8204 * foo
8205 ** bar
8206 : foo
8207 :: bar
8208 !! html
8209 <ol>
8210 <li> foo<ol>
8211 <li> bar</li>
8212 </ol></li>
8213 </ol><ul>
8214 <li> foo<ul>
8215 <li> bar</li>
8216 </ul></li>
8217 </ul><dl>
8218 <dd> foo<dl>
8219 <dd> bar</dd>
8220 </dl></dd>
8221 </dl>
8222 !! end
8223
8224 !! test
8225 Parsoid: Test of whitespace serialization with Templated bullets
8226 !! options
8227 parsoid
8228 !! wikitext
8229 * {{bullet}}
8230 !! html
8231 <ul>
8232 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8233 </ul>
8234 !! end
8235
8236 # ------------------------------------------------------------------------
8237 # The next set of tests are about Parsoid's ability to handle badly nested
8238 # tags (parse, minimize scope of fixup, and roundtrip back)
8239 # ------------------------------------------------------------------------
8240
8241 !! test
8242 Unbalanced closing block tags break a list
8243 (php parser relies on Tidy to fix up)
8244 !! wikitext
8245 <div>
8246 *a</div><div>
8247 *b</div>
8248 !! html+tidy
8249 <div>
8250 <ul>
8251 <li>a</li>
8252 </ul>
8253 </div>
8254 <div>
8255 <ul>
8256 <li>b</li>
8257 </ul>
8258 </div>
8259 !! end
8260
8261 # Parsoid fails this test, but it might be tricky to support properly.
8262 # See bug 68395.
8263 !! test
8264 Unbalanced closing non-block tags don't break a list
8265 (php parser relies on Tidy to fix up)
8266 !! wikitext
8267 <span>
8268 *a</span><span>
8269 *b</span>
8270 !! html/php+tidy
8271 <ul>
8272 <li><span>a</span></li>
8273 <li><span>b</span></li>
8274 </ul>
8275 !! html/parsoid
8276 <span>
8277 <ul>
8278 <li>a<span></span>
8279 </li>
8280 <li>b
8281 </li>
8282 </ul>
8283 </span>
8284 !! end
8285
8286 !! test
8287 Unclosed formatting tags that straddle lists are closed and reopened
8288 (php parser relies on Tidy to fix up)
8289 !! options
8290 parsoid=wt2html,wt2wt,html2html
8291 !! wikitext
8292 # <s> a
8293 # b </s>
8294 !! html/php+tidy
8295 <ol>
8296 <li><s>a</s></li>
8297 <li><s>b</s></li>
8298 </ol>
8299 !! html/parsoid
8300 <ol><li> <s> a</s></li>
8301 <li><s> b </s></li></ol>
8302 !! end
8303
8304 # Parsoid fails this test, but it might be tricky to support properly.
8305 # See bug 68395.
8306 !!test
8307 List embedded in a non-block tag
8308 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8309 !! wikitext
8310 <small>
8311 * foo
8312 </small>
8313 !! html/php+tidy
8314 <ul>
8315 <li><small>foo</small></li>
8316 </ul>
8317 !! html/parsoid
8318 <small>
8319 <ul>
8320 <li> foo</li>
8321 </ul>
8322 </small>
8323 !!end
8324
8325 !! test
8326 Table with missing opening <tr> tag
8327 !! options
8328 parsoid=wt2html,wt2wt
8329 !! wikitext
8330 <table>
8331 <td>foo</td>
8332 </tr>
8333 </table>
8334 !! html+tidy
8335 <table>
8336 <tr>
8337 <td>foo</td>
8338 </tr>
8339 </table>
8340 !! end
8341
8342 ###
8343 ### Magic Words
8344 ###
8345
8346 # Note that the current date is hard-coded as
8347 # 1970-01-01T00:02:03Z (a Thursday)
8348 # when running parser tests. The timezone is also fixed to GMT, so
8349 # local date will be identical to current date.
8350
8351 !! test
8352 Magic Word: {{CURRENTDAY}}
8353 !! wikitext
8354 {{CURRENTDAY}}
8355 !! html
8356 <p>1
8357 </p>
8358 !! end
8359
8360 !! test
8361 Magic Word: {{CURRENTDAY2}}
8362 !! wikitext
8363 {{CURRENTDAY2}}
8364 !! html
8365 <p>01
8366 </p>
8367 !! end
8368
8369 !! test
8370 Magic Word: {{CURRENTDAYNAME}}
8371 !! wikitext
8372 {{CURRENTDAYNAME}}
8373 !! html
8374 <p>Thursday
8375 </p>
8376 !! end
8377
8378 !! test
8379 Magic Word: {{CURRENTDOW}}
8380 !! wikitext
8381 {{CURRENTDOW}}
8382 !! html
8383 <p>4
8384 </p>
8385 !! end
8386
8387 !! test
8388 Magic Word: {{CURRENTMONTH}}
8389 !! wikitext
8390 {{CURRENTMONTH}}
8391 !! html
8392 <p>01
8393 </p>
8394 !! end
8395
8396 !! test
8397 Magic Word: {{CURRENTMONTH1}}
8398 !! wikitext
8399 {{CURRENTMONTH1}}
8400 !! html
8401 <p>1
8402 </p>
8403 !! end
8404
8405 !! test
8406 Magic Word: {{CURRENTMONTHABBREV}}
8407 !! wikitext
8408 {{CURRENTMONTHABBREV}}
8409 !! html
8410 <p>Jan
8411 </p>
8412 !! end
8413
8414 !! test
8415 Magic Word: {{CURRENTMONTHNAME}}
8416 !! wikitext
8417 {{CURRENTMONTHNAME}}
8418 !! html
8419 <p>January
8420 </p>
8421 !! end
8422
8423 !! test
8424 Magic Word: {{CURRENTMONTHNAMEGEN}}
8425 !! wikitext
8426 {{CURRENTMONTHNAMEGEN}}
8427 !! html
8428 <p>January
8429 </p>
8430 !! end
8431
8432 !! test
8433 Magic Word: {{CURRENTTIME}}
8434 !! wikitext
8435 {{CURRENTTIME}}
8436 !! html
8437 <p>00:02
8438 </p>
8439 !! end
8440
8441 !! test
8442 Magic Word: {{CURRENTHOUR}}
8443 !! wikitext
8444 {{CURRENTHOUR}}
8445 !! html
8446 <p>00
8447 </p>
8448 !! end
8449
8450 !! test
8451 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8452 !! wikitext
8453 {{CURRENTWEEK}}
8454 !! html
8455 <p>1
8456 </p>
8457 !! end
8458
8459 !! test
8460 Magic Word: {{CURRENTYEAR}}
8461 !! wikitext
8462 {{CURRENTYEAR}}
8463 !! html
8464 <p>1970
8465 </p>
8466 !! end
8467
8468 !! test
8469 Magic Word: {{CURRENTTIMESTAMP}}
8470 !! wikitext
8471 {{CURRENTTIMESTAMP}}
8472 !! html
8473 <p>19700101000203
8474 </p>
8475 !! end
8476
8477 !! test
8478 Magic Words LOCAL (UTC)
8479 !! wikitext
8480 * {{LOCALMONTH}}
8481 * {{LOCALMONTH1}}
8482 * {{LOCALMONTHNAME}}
8483 * {{LOCALMONTHNAMEGEN}}
8484 * {{LOCALMONTHABBREV}}
8485 * {{LOCALDAY}}
8486 * {{LOCALDAY2}}
8487 * {{LOCALDAYNAME}}
8488 * {{LOCALYEAR}}
8489 * {{LOCALTIME}}
8490 * {{LOCALHOUR}}
8491 * {{LOCALWEEK}}
8492 * {{LOCALDOW}}
8493 * {{LOCALTIMESTAMP}}
8494 !! html
8495 <ul><li> 01</li>
8496 <li> 1</li>
8497 <li> January</li>
8498 <li> January</li>
8499 <li> Jan</li>
8500 <li> 1</li>
8501 <li> 01</li>
8502 <li> Thursday</li>
8503 <li> 1970</li>
8504 <li> 00:02</li>
8505 <li> 00</li>
8506 <li> 1</li>
8507 <li> 4</li>
8508 <li> 19700101000203</li></ul>
8509
8510 !! end
8511
8512 !! test
8513 Magic Word: {{FULLPAGENAME}}
8514 !! options
8515 title=[[User:Ævar Arnfjörð Bjarmason]]
8516 !! wikitext
8517 {{FULLPAGENAME}}
8518 !! html
8519 <p>User:Ævar Arnfjörð Bjarmason
8520 </p>
8521 !! end
8522
8523 !! test
8524 Magic Word: {{FULLPAGENAMEE}}
8525 !! options
8526 title=[[User:Ævar Arnfjörð Bjarmason]]
8527 !! wikitext
8528 {{FULLPAGENAMEE}}
8529 !! html
8530 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8531 </p>
8532 !! end
8533
8534 !! test
8535 Magic Word: {{TALKSPACE}}
8536 !! options
8537 title=[[User:Ævar Arnfjörð Bjarmason]]
8538 !! wikitext
8539 {{TALKSPACE}}
8540 !! html
8541 <p>User talk
8542 </p>
8543 !! end
8544
8545 !! test
8546 Magic Word: {{TALKSPACE}}, same namespace
8547 !! options
8548 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8549 !! wikitext
8550 {{TALKSPACE}}
8551 !! html
8552 <p>User talk
8553 </p>
8554 !! end
8555
8556 !! test
8557 Magic Word: {{TALKSPACE}}, main namespace
8558 !! options
8559 title=[[Parser Test]]
8560 !! wikitext
8561 {{TALKSPACE}}
8562 !! html
8563 <p>Talk
8564 </p>
8565 !! end
8566
8567 !! test
8568 Magic Word: {{TALKSPACEE}}
8569 !! options
8570 title=[[User:Ævar Arnfjörð Bjarmason]]
8571 !! wikitext
8572 {{TALKSPACEE}}
8573 !! html
8574 <p>User_talk
8575 </p>
8576 !! end
8577
8578 !! test
8579 Magic Word: {{SUBJECTSPACE}}
8580 !! options
8581 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8582 !! wikitext
8583 {{SUBJECTSPACE}}
8584 !! html
8585 <p>User
8586 </p>
8587 !! end
8588
8589 !! test
8590 Magic Word: {{SUBJECTSPACE}}, same namespace
8591 !! options
8592 title=[[User:Ævar Arnfjörð Bjarmason]]
8593 !! wikitext
8594 {{SUBJECTSPACE}}
8595 !! html
8596 <p>User
8597 </p>
8598 !! end
8599
8600 !! test
8601 Magic Word: {{SUBJECTSPACE}}, main namespace
8602 !! options
8603 title=[[Parser Test]]
8604 !! wikitext
8605 {{SUBJECTSPACE}}
8606 !! html
8607
8608 !! end
8609
8610 !! test
8611 Magic Word: {{SUBJECTSPACEE}}
8612 !! options
8613 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8614 !! wikitext
8615 {{SUBJECTSPACEE}}
8616 !! html
8617 <p>User
8618 </p>
8619 !! end
8620
8621 !! test
8622 Magic Word: {{NAMESPACE}}
8623 !! options
8624 title=[[User:Ævar Arnfjörð Bjarmason]]
8625 !! wikitext
8626 {{NAMESPACE}}
8627 !! html
8628 <p>User
8629 </p>
8630 !! end
8631
8632 !! test
8633 Magic Word: {{NAMESPACEE}}
8634 !! options
8635 title=[[User:Ævar Arnfjörð Bjarmason]]
8636 !! wikitext
8637 {{NAMESPACEE}}
8638 !! html
8639 <p>User
8640 </p>
8641 !! end
8642
8643 !! test
8644 Magic Word: {{NAMESPACENUMBER}}
8645 !! options
8646 title=[[User:Ævar Arnfjörð Bjarmason]]
8647 !! wikitext
8648 {{NAMESPACENUMBER}}
8649 !! html
8650 <p>2
8651 </p>
8652 !! end
8653
8654 !! test
8655 Magic Word: {{SUBPAGENAME}}
8656 !! options
8657 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8658 !! wikitext
8659 {{SUBPAGENAME}}
8660 !! html
8661 <p>sub ö
8662 </p>
8663 !! end
8664
8665 !! test
8666 Magic Word: {{SUBPAGENAMEE}}
8667 !! options
8668 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8669 !! wikitext
8670 {{SUBPAGENAMEE}}
8671 !! html
8672 <p>sub_%C3%B6
8673 </p>
8674 !! end
8675
8676 !! test
8677 Magic Word: {{ROOTPAGENAME}}
8678 !! options
8679 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8680 !! wikitext
8681 {{ROOTPAGENAME}}
8682 !! html
8683 <p>Ævar Arnfjörð Bjarmason
8684 </p>
8685 !! end
8686
8687 !! test
8688 Magic Word: {{ROOTPAGENAMEE}}
8689 !! options
8690 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8691 !! wikitext
8692 {{ROOTPAGENAMEE}}
8693 !! html
8694 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8695 </p>
8696 !! end
8697
8698 !! test
8699 Magic Word: {{BASEPAGENAME}}
8700 !! options
8701 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8702 !! wikitext
8703 {{BASEPAGENAME}}
8704 !! html
8705 <p>Ævar Arnfjörð Bjarmason
8706 </p>
8707 !! end
8708
8709 !! test
8710 Magic Word: {{BASEPAGENAMEE}}
8711 !! options
8712 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8713 !! wikitext
8714 {{BASEPAGENAMEE}}
8715 !! html
8716 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8717 </p>
8718 !! end
8719
8720 !! test
8721 Magic Word: {{TALKPAGENAME}}
8722 !! options
8723 title=[[User:Ævar Arnfjörð Bjarmason]]
8724 !! wikitext
8725 {{TALKPAGENAME}}
8726 !! html
8727 <p>User talk:Ævar Arnfjörð Bjarmason
8728 </p>
8729 !! end
8730
8731 !! test
8732 Magic Word: {{TALKPAGENAMEE}}
8733 !! options
8734 title=[[User:Ævar Arnfjörð Bjarmason]]
8735 !! wikitext
8736 {{TALKPAGENAMEE}}
8737 !! html
8738 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8739 </p>
8740 !! end
8741
8742 !! test
8743 Magic Word: {{SUBJECTPAGENAME}}
8744 !! options
8745 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8746 !! wikitext
8747 {{SUBJECTPAGENAME}}
8748 !! html
8749 <p>User:Ævar Arnfjörð Bjarmason
8750 </p>
8751 !! end
8752
8753 !! test
8754 Magic Word: {{SUBJECTPAGENAMEE}}
8755 !! options
8756 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8757 !! wikitext
8758 {{SUBJECTPAGENAMEE}}
8759 !! html
8760 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8761 </p>
8762 !! end
8763
8764 !! test
8765 Magic Word: {{NUMBEROFFILES}}
8766 !! wikitext
8767 {{NUMBEROFFILES}}
8768 !! html
8769 <p>5
8770 </p>
8771 !! end
8772
8773 !! test
8774 Magic Word: {{PAGENAME}}
8775 !! options
8776 title=[[User:Ævar Arnfjörð Bjarmason]]
8777 !! wikitext
8778 {{PAGENAME}}
8779 !! html
8780 <p>Ævar Arnfjörð Bjarmason
8781 </p>
8782 !! end
8783
8784 !! test
8785 Magic Word: {{PAGENAME}} with metacharacters
8786 !! options
8787 title=[['foo & bar = baz']]
8788 !! wikitext
8789 ''{{PAGENAME}}''
8790 !! html/php
8791 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8792 </p>
8793 !! html+tidy
8794 <p><i>'foo &amp; bar = baz'</i></p>
8795 !! end
8796
8797 !! test
8798 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8799 !! options
8800 title=[[*RFC 1234 http://example.com/]]
8801 !! wikitext
8802 {{PAGENAME}}
8803 !! html/php
8804 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8805 </p>
8806 !! html+tidy
8807 <p>*RFC 1234 http://example.com/</p>
8808 !! end
8809
8810 !! test
8811 Magic Word: {{PAGENAMEE}}
8812 !! options
8813 title=[[User:Ævar Arnfjörð Bjarmason]]
8814 !! wikitext
8815 {{PAGENAMEE}}
8816 !! html
8817 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8818 </p>
8819 !! end
8820
8821 !! test
8822 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8823 !! options
8824 title=[[*RFC 1234 http://example.com/]]
8825 !! wikitext
8826 {{PAGENAMEE}}
8827 !! html/php
8828 <p>&#42;RFC_1234_http&#58;//example.com/
8829 </p>
8830 !! html+tidy
8831 <p>*RFC_1234_http://example.com/</p>
8832 !! end
8833
8834 !! test
8835 Magic Word: {{REVISIONID}}
8836 !! wikitext
8837 {{REVISIONID}}
8838 !! html
8839 <p>1337
8840 </p>
8841 !! end
8842
8843 !! test
8844 Magic Word: {{SCRIPTPATH}}
8845 !! wikitext
8846 {{SCRIPTPATH}}
8847 !! html
8848 <p>/
8849 </p>
8850 !! end
8851
8852 !! test
8853 Magic Word: {{STYLEPATH}}
8854 !! wikitext
8855 {{STYLEPATH}}
8856 !! html
8857 <p>/skins
8858 </p>
8859 !! end
8860
8861 !! test
8862 Magic Word: {{SERVER}}
8863 !! wikitext
8864 {{SERVER}}
8865 !! html
8866 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8867 </p>
8868 !! end
8869
8870 !! test
8871 Magic Word: {{SERVERNAME}}
8872 !! wikitext
8873 {{SERVERNAME}}
8874 !! html
8875 <p>example.org
8876 </p>
8877 !! end
8878
8879 !! test
8880 Magic Word: {{SITENAME}}
8881 !! wikitext
8882 {{SITENAME}}
8883 !! html
8884 <p>MediaWiki
8885 </p>
8886 !! end
8887
8888 !! test
8889 Case-sensitive magic words, when cased differently, should just be template transclusions
8890 !! wikitext
8891 {{CurrentMonth}}
8892 {{currentday}}
8893 {{cURreNTweEK}}
8894 {{currentHour}}
8895 !! html
8896 <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>
8897 <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>
8898 <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>
8899 <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>
8900 </p>
8901 !! end
8902
8903 !! test
8904 Case-insensitive magic words should still work with weird casing.
8905 !! wikitext
8906 {{sErVeRNaMe}}
8907 {{LCFirst:AOEU}}
8908 {{ucFIRST:aoeu}}
8909 {{SERver}}
8910 !! html
8911 <p>example.org
8912 aOEU
8913 Aoeu
8914 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8915 </p>
8916 !! end
8917
8918 # From plwiki:PLOS_ONE
8919 !! test
8920 Parsoid: Page property magic word with magic word contents
8921 !! wikitext
8922 {{DISPLAYTITLE:''{{PAGENAME}}''}}
8923 !! html/parsoid
8924 <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>"}]]}'/>
8925 !! end
8926
8927 !! test
8928 Parsoid: Template-generated DISPLAYTITLE
8929 !! wikitext
8930 {{{{echo|DISPLAYTITLE}}:Foo}}
8931 !! html/parsoid
8932 <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}}]}'/>
8933 !! end
8934
8935 !! test
8936 Namespace 1 {{ns:1}}
8937 !! wikitext
8938 {{ns:1}}
8939 !! html
8940 <p>Talk
8941 </p>
8942 !! end
8943
8944 !! test
8945 Namespace 1 {{ns:01}}
8946 !! wikitext
8947 {{ns:01}}
8948 !! html
8949 <p>Talk
8950 </p>
8951 !! end
8952
8953 !! test
8954 Namespace 0 {{ns:0}} (bug 4783)
8955 !! wikitext
8956 {{ns:0}}
8957 !! html
8958
8959 !! end
8960
8961 !! test
8962 Namespace 0 {{ns:00}} (bug 4783)
8963 !! wikitext
8964 {{ns:00}}
8965 !! html
8966
8967 !! end
8968
8969 !! test
8970 Namespace -1 {{ns:-1}}
8971 !! wikitext
8972 {{ns:-1}}
8973 !! html
8974 <p>Special
8975 </p>
8976 !! end
8977
8978 !! test
8979 Namespace User {{ns:User}}
8980 !! wikitext
8981 {{ns:User}}
8982 !! html
8983 <p>User
8984 </p>
8985 !! end
8986
8987 !! test
8988 Namespace User talk {{ns:User_talk}}
8989 !! wikitext
8990 {{ns:User_talk}}
8991 !! html
8992 <p>User talk
8993 </p>
8994 !! end
8995
8996 !! test
8997 Namespace User talk {{ns:uSeR tAlK}}
8998 !! wikitext
8999 {{ns:uSeR tAlK}}
9000 !! html
9001 <p>User talk
9002 </p>
9003 !! end
9004
9005 !! test
9006 Namespace File {{ns:File}}
9007 !! wikitext
9008 {{ns:File}}
9009 !! html
9010 <p>File
9011 </p>
9012 !! end
9013
9014 !! test
9015 Namespace File {{ns:Image}}
9016 !! wikitext
9017 {{ns:Image}}
9018 !! html
9019 <p>File
9020 </p>
9021 !! end
9022
9023 !! test
9024 Namespace (lang=de) Benutzer {{ns:User}}
9025 !! options
9026 language=de
9027 !! wikitext
9028 {{ns:User}}
9029 !! html
9030 <p>Benutzer
9031 </p>
9032 !! end
9033
9034 !! test
9035 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9036 !! options
9037 language=de
9038 !! wikitext
9039 {{ns:3}}
9040 !! html
9041 <p>Benutzer Diskussion
9042 </p>
9043 !! end
9044
9045
9046 !! test
9047 Urlencode
9048 !! wikitext
9049 {{urlencode:hi world?!}}
9050 {{urlencode:hi world?!|WIKI}}
9051 {{urlencode:hi world?!|PATH}}
9052 {{urlencode:hi world?!|QUERY}}
9053 !! html
9054 <p>hi+world%3F%21
9055 hi_world%3F!
9056 hi%20world%3F%21
9057 hi+world%3F%21
9058 </p>
9059 !! end
9060
9061 !! test
9062 Magic Word: prioritize type info over data-parsoid
9063 !! options
9064 parsoid=html2wt
9065 !! html
9066 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9067 !! wikitext
9068 __FORCETOC__
9069 !! end
9070
9071 !! test
9072 Magic Word: serialize on separate line (parsoid)
9073 !! options
9074 parsoid=wt2wt,html2wt
9075 !! wikitext
9076 foo
9077 __NOTOC__
9078 bar
9079 !! html
9080 foo<meta property="mw:PageProp/notoc"/>bar
9081 !! end
9082
9083 !! test
9084 Magic Word: rt non-english wikis
9085 !! options
9086 parsoid=wt2wt
9087 language=de
9088 !! wikitext
9089 __NOEDITSECTION__
9090 !! html
9091 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9092 !! end
9093
9094 ###
9095 ### Magic links
9096 ###
9097 !! test
9098 Magic links: internal link to RFC (bug 479)
9099 !! wikitext
9100 [[RFC 123]]
9101 !! html
9102 <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>
9103 </p>
9104 !! end
9105
9106 !! test
9107 Magic links: RFC (bug 479)
9108 !! wikitext
9109 RFC 822
9110 !! html
9111 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9112 </p>
9113 !! end
9114
9115 !! test
9116 Magic links: RFC (bug 65278)
9117 !! wikitext
9118 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9119 !! html
9120 <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.
9121 </p>
9122 !! end
9123
9124 !! test
9125 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9126 !! wikitext
9127 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9128 RFC
9129 822
9130 !! html
9131 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9132 RFC
9133 822
9134 </p>
9135 !! end
9136
9137 !! test
9138 Magic links: ISBN (bug 1937)
9139 !! wikitext
9140 ISBN 0-306-40615-2
9141 !! html
9142 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9143 </p>
9144 !! end
9145
9146 !! test
9147 Magic links: ISBN (bug 65278)
9148 !! wikitext
9149 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9150 !! html/php
9151 <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.
9152 </p>
9153 !! html/parsoid
9154 <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>
9155 !! end
9156
9157 !! test
9158 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9159 !! wikitext
9160 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9161 ISBN
9162 9780316098113
9163 ISBN 978
9164 0316098113
9165 !! html
9166 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9167 ISBN
9168 9780316098113
9169 ISBN 978
9170 0316098113
9171 </p>
9172 !! end
9173
9174 !! test
9175 Magic links: PMID incorrectly converts space to underscore
9176 !! wikitext
9177 PMID 1234
9178 !! html
9179 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9180 </p>
9181 !! end
9182
9183 !! test
9184 Magic links: PMID (bug 65278)
9185 !! wikitext
9186 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9187 !! html
9188 <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.
9189 </p>
9190 !! end
9191
9192 !! test
9193 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9194 !! wikitext
9195 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9196 PMID
9197 1234
9198 !! html
9199 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9200 PMID
9201 1234
9202 </p>
9203 !! end
9204
9205 ###
9206 ### Templates
9207 ####
9208
9209 !! test
9210 Nonexistent template
9211 !! wikitext
9212 {{thistemplatedoesnotexist}}
9213 !! html
9214 <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>
9215 </p>
9216 !! end
9217
9218 !! test
9219 Template with invalid target containing tags
9220 !! wikitext
9221 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9222 !! html
9223 <p>{{a<b>b</b>|foo|a=b|a = b}}
9224 </p>
9225 !! end
9226
9227 !! test
9228 Template with invalid target containing unclosed tag
9229 !! wikitext
9230 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9231 !! html
9232 <p>{{a<b>|foo|a=b|a = b}}</b>
9233 </p>
9234 !! end
9235
9236 !! test
9237 Template with invalid target containing wikilink
9238 !! wikitext
9239 {{[[Main Page]]}}
9240 !! html/php
9241 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9242 </p>
9243 !! html/parsoid
9244 <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>
9245 !! end
9246
9247 !! test
9248 Template with just whitespace in it, bug #68421
9249 !! wikitext
9250 {{echo|{{ }}}}
9251 !! html/parsoid
9252 <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>
9253 !! end
9254
9255 !! article
9256 Template:test
9257 !! text
9258 This is a test template
9259 !! endarticle
9260
9261 !! test
9262 Simple template
9263 !! wikitext
9264 {{test}}
9265 !! html
9266 <p>This is a test template
9267 </p>
9268 !! end
9269
9270 !! test
9271 Template with explicit namespace
9272 !! wikitext
9273 {{Template:test}}
9274 !! html
9275 <p>This is a test template
9276 </p>
9277 !! end
9278
9279
9280 !! article
9281 Template:paramtest
9282 !! text
9283 This is a test template with parameter {{{param}}}
9284 !! endarticle
9285
9286 !! test
9287 Template parameter
9288 !! wikitext
9289 {{paramtest|param=foo}}
9290 !! html
9291 <p>This is a test template with parameter foo
9292 </p>
9293 !! end
9294
9295 !! article
9296 Template:paramtestnum
9297 !! text
9298 [[{{{1}}}|{{{2}}}]]
9299 !! endarticle
9300
9301 !! test
9302 Template unnamed parameter
9303 !! wikitext
9304 {{paramtestnum|Main Page|the main page}}
9305 !! html
9306 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9307 </p>
9308 !! end
9309
9310 !! article
9311 Template:templatesimple
9312 !! text
9313 (test)
9314 !! endarticle
9315
9316 !! article
9317 Template:templateredirect
9318 !! text
9319 #redirect [[Template:templatesimple]]
9320 !! endarticle
9321
9322 !! article
9323 Template:templateasargtestnum
9324 !! text
9325 {{{{{1}}}}}
9326 !! endarticle
9327
9328 !! article
9329 Template:templateasargtest
9330 !! text
9331 {{template{{{templ}}}}}
9332 !! endarticle
9333
9334 !! article
9335 Template:templateasargtest2
9336 !! text
9337 {{{{{templ}}}}}
9338 !! endarticle
9339
9340 !! test
9341 Template with template name as unnamed argument
9342 !! wikitext
9343 {{templateasargtestnum|templatesimple}}
9344 !! html
9345 <p>(test)
9346 </p>
9347 !! end
9348
9349 !! test
9350 Template with template name as argument
9351 !! wikitext
9352 {{templateasargtest|templ=simple}}
9353 !! html
9354 <p>(test)
9355 </p>
9356 !! end
9357
9358 !! test
9359 Template with template name as argument (2)
9360 !! wikitext
9361 {{templateasargtest2|templ=templatesimple}}
9362 !! html
9363 <p>(test)
9364 </p>
9365 !! end
9366
9367 !! article
9368 Template:templateasargtestdefault
9369 !! text
9370 {{{{{templ|templatesimple}}}}}
9371 !! endarticle
9372
9373 !! article
9374 Template:templa
9375 !! text
9376 '''templ'''
9377 !! endarticle
9378
9379 !! test
9380 Template with default value
9381 !! wikitext
9382 {{templateasargtestdefault}}
9383 !! html
9384 <p>(test)
9385 </p>
9386 !! end
9387
9388 !! test
9389 Template with default value (value set)
9390 !! wikitext
9391 {{templateasargtestdefault|templ=templa}}
9392 !! html
9393 <p><b>templ</b>
9394 </p>
9395 !! end
9396
9397 !! test
9398 Template redirect
9399 !! wikitext
9400 {{templateredirect}}
9401 !! html
9402 <p>(test)
9403 </p>
9404 !! end
9405
9406 !! test
9407 Template with argument in separate line
9408 !! wikitext
9409 {{ templateasargtest |
9410 templ = simple }}
9411 !! html
9412 <p>(test)
9413 </p>
9414 !! end
9415
9416 !! test
9417 Template with complex template as argument
9418 !! wikitext
9419 {{paramtest|
9420 param ={{ templateasargtest |
9421 templ = simple }}}}
9422 !! html
9423 <p>This is a test template with parameter (test)
9424 </p>
9425 !! end
9426
9427 !! test
9428 Template with thumb image (with link in description)
9429 !! wikitext
9430 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9431 !! html/php
9432 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>
9433
9434 !! html+tidy
9435 <p>This is a test template with parameter</p>
9436 <div class="thumb tright">
9437 <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>
9438 <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>
9439 </div>
9440 </div>
9441 !! html/parsoid
9442 <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>
9443 !! end
9444
9445 !! article
9446 Template:complextemplate
9447 !! text
9448 {{{1}}} {{paramtest|
9449 param ={{{param}}}}}
9450 !! endarticle
9451
9452 !! test
9453 Template with complex arguments
9454 !! wikitext
9455 {{complextemplate|
9456 param ={{ templateasargtest |
9457 templ = simple }}|[[Template:complextemplate|link]]}}
9458 !! html
9459 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9460 </p>
9461 !! end
9462
9463 !! test
9464 BUG 553: link with two variables in a piped link
9465 !! wikitext
9466 {|
9467 |[[{{{1}}}|{{{2}}}]]
9468 |}
9469 !! html
9470 <table>
9471 <tr>
9472 <td>[[{{{1}}}|{{{2}}}]]
9473 </td></tr></table>
9474
9475 !! end
9476
9477 !! test
9478 Magic variable as template parameter
9479 !! wikitext
9480 {{paramtest|param={{SITENAME}}}}
9481 !! html
9482 <p>This is a test template with parameter MediaWiki
9483 </p>
9484 !! end
9485
9486 !! article
9487 Template:linktest
9488 !! text
9489 [[{{{param}}}|link]]
9490 !! endarticle
9491
9492 !! test
9493 Template parameter as link source
9494 !! wikitext
9495 {{linktest|param=Main Page}}
9496 !! html
9497 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9498 </p>
9499 !! end
9500
9501 !!article
9502 Template:paramtest2
9503 !! text
9504 including another template, {{paramtest|param={{{arg}}}}}
9505 !! endarticle
9506
9507 !! test
9508 Template passing argument to another template
9509 !! wikitext
9510 {{paramtest2|arg='hmm'}}
9511 !! html
9512 <p>including another template, This is a test template with parameter 'hmm'
9513 </p>
9514 !! end
9515
9516 !! article
9517 Template:Linktest2
9518 !! text
9519 Main Page
9520 !! endarticle
9521
9522 !! test
9523 Template as link source
9524 !! wikitext
9525 [[{{linktest2}}]]
9526
9527 [[{{linktest2}}|Main Page]]
9528
9529 [[{{linktest2}}]]Page
9530 !! html
9531 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9532 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9533 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9534 </p>
9535 !! end
9536
9537
9538 !! article
9539 Template:loop1
9540 !! text
9541 {{loop2}}
9542 !! endarticle
9543
9544 !! article
9545 Template:loop2
9546 !! text
9547 {{loop1}}
9548 !! endarticle
9549
9550 !! test
9551 Template infinite loop
9552 !! wikitext
9553 {{loop1}}
9554 !! html
9555 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9556 </p>
9557 !! end
9558
9559 !! test
9560 Template from main namespace
9561 !! wikitext
9562 {{:Main Page}}
9563 !! html
9564 <p>blah blah
9565 </p>
9566 !! end
9567
9568 !! article
9569 Template:table
9570 !! text
9571 {|
9572 | 1 || 2
9573 |-
9574 | 3 || 4
9575 |}
9576 !! endarticle
9577
9578 !! test
9579 BUG 529: Template with table, not included at beginning of line
9580 !! wikitext
9581 foo {{table}}
9582 !! html
9583 <p>foo
9584 </p>
9585 <table>
9586 <tr>
9587 <td> 1 </td>
9588 <td> 2
9589 </td></tr>
9590 <tr>
9591 <td> 3 </td>
9592 <td> 4
9593 </td></tr></table>
9594
9595 !! end
9596
9597 !! test
9598 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9599 !! wikitext
9600 foo
9601 {{table}}
9602 !! html
9603 <p>foo
9604 </p>
9605 <table>
9606 <tr>
9607 <td> 1 </td>
9608 <td> 2
9609 </td></tr>
9610 <tr>
9611 <td> 3 </td>
9612 <td> 4
9613 </td></tr></table>
9614
9615 !! end
9616
9617 !! test
9618 BUG 41: Template parameters shown as broken links
9619 !! wikitext
9620 {{{parameter}}}
9621 !! html
9622 <p>{{{parameter}}}
9623 </p>
9624 !! end
9625
9626 !! test
9627 Template with targets containing wikilinks
9628 !! wikitext
9629 {{[[foo]]}}
9630
9631 {{[[{{echo|foo}}]]}}
9632
9633 {{{{echo|[[foo}}]]}}
9634 !! html
9635 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9636 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9637 </p><p>{{[[foo}}]]
9638 </p>
9639 !! end
9640
9641 !! article
9642 Template:MSGNW test
9643 !! text
9644 ''None'' of '''this''' should be
9645 * interpreted
9646 but rather passed unmodified
9647 {{test}}
9648 <gallery>
9649 File:Foobar.jpg
9650 </gallery>
9651 !! endarticle
9652
9653 # hmm, fix this or just deprecate msgnw and document its behavior?
9654 !! test
9655 msgnw keyword
9656 !! wikitext
9657 {{msgnw:MSGNW test}}
9658 !! html
9659 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9660 &#42; interpreted
9661 &#32;but rather passed unmodified
9662 &#123;&#123;test&#125;&#125;
9663 &#60;gallery&#62;
9664 File:Foobar.jpg
9665 &#60;/gallery&#62;
9666 </p>
9667 !! end
9668
9669 !! test
9670 int keyword
9671 !! wikitext
9672 {{int:youhavenewmessages|lots of money|not!}}
9673 !! html
9674 <p>You have lots of money (not!).
9675 </p>
9676 !! end
9677
9678 !! article
9679 Template:Includes
9680 !! text
9681 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9682 !! endarticle
9683
9684 !! test
9685 <includeonly> and <noinclude> being included
9686 !! wikitext
9687 {{Includes}}
9688 !! html
9689 <p>Foobar
9690 </p>
9691 !! end
9692
9693 !! article
9694 Template:Includes2
9695 !! text
9696 <onlyinclude>Foo</onlyinclude>bar
9697 !! endarticle
9698
9699 !! test
9700 <onlyinclude> being included
9701 !! wikitext
9702 {{Includes2}}
9703 !! html
9704 <p>Foo
9705 </p>
9706 !! end
9707
9708
9709 !! article
9710 Template:Includes3
9711 !! text
9712 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9713 !! endarticle
9714
9715 !! test
9716 <onlyinclude> and <includeonly> being included
9717 !! wikitext
9718 {{Includes3}}
9719 !! html
9720 <p>Foo
9721 </p>
9722 !! end
9723
9724 !! test
9725 <includeonly> and <noinclude> on a page
9726 !! wikitext
9727 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9728 !! html
9729 <p>Foozar
9730 </p>
9731 !! end
9732
9733 !! test
9734 Un-closed <noinclude>
9735 !! wikitext
9736 <noinclude>
9737 !! html
9738 !! end
9739
9740 !! test
9741 <onlyinclude> on a page
9742 !! wikitext
9743 <onlyinclude>Foo</onlyinclude>bar
9744 !! html
9745 <p>Foobar
9746 </p>
9747 !! end
9748
9749 !! test
9750 Un-closed <onlyinclude>
9751 !! wikitext
9752 <onlyinclude>
9753 !! html
9754 !! end
9755
9756 !!test
9757 Self-closed noinclude, includeonly, onlyinclude tags
9758 !! wikitext
9759 <noinclude />
9760 <includeonly />
9761 <onlyinclude />
9762 !! html
9763 <p><br />
9764 </p>
9765 !!end
9766
9767 !!test
9768 Unbalanced includeonly and noinclude tags
9769 !! wikitext
9770 {|
9771 |a</noinclude>
9772 |b</noinclude></noinclude>
9773 |c</noinclude></includeonly>
9774 |d</includeonly></includeonly>
9775 |}
9776 !! html
9777 <table>
9778 <tr>
9779 <td>a
9780 </td>
9781 <td>b
9782 </td>
9783 <td>c&lt;/includeonly&gt;
9784 </td>
9785 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9786 </td></tr></table>
9787
9788 !!end
9789
9790 !! article
9791 Template:Includeonly section
9792 !! text
9793 <includeonly>
9794 ==Includeonly section==
9795 </includeonly>
9796 ==Section T-1==
9797 !!endarticle
9798
9799 !! test
9800 Bug 6563: Edit link generation for section shown by <includeonly>
9801 !! wikitext
9802 {{includeonly section}}
9803 !! html
9804 <h2><a href="#Includeonly_section" class="mw-headline-anchor" aria-hidden="true" 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>
9805 <h2><a href="#Section_T-1" class="mw-headline-anchor" aria-hidden="true" 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>
9806
9807 !! end
9808
9809 # Uses same input as the contents of [[Template:Includeonly section]]
9810 !! test
9811 Bug 6563: Section extraction for section shown by <includeonly>
9812 !! options
9813 section=T-2
9814 !! wikitext
9815 <includeonly>
9816 ==Includeonly section==
9817 </includeonly>
9818 ==Section T-2==
9819 !! html
9820 ==Section T-2==
9821 !! end
9822
9823 !! test
9824 Bug 6563: Edit link generation for section suppressed by <includeonly>
9825 !! wikitext
9826 <includeonly>
9827 ==Includeonly section==
9828 </includeonly>
9829 ==Section 1==
9830 !! html
9831 <h2><a href="#Section_1" class="mw-headline-anchor" aria-hidden="true" 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>
9832
9833 !! end
9834
9835 !! test
9836 Bug 6563: Section extraction for section suppressed by <includeonly>
9837 !! options
9838 section=1
9839 !! wikitext
9840 <includeonly>
9841 ==Includeonly section==
9842 </includeonly>
9843 ==Section 1==
9844 !! html
9845 ==Section 1==
9846 !! end
9847
9848 !! test
9849 Un-closed <includeonly>
9850 !! wikitext
9851 <includeonly>
9852 !! html
9853 !! end
9854
9855 !! test
9856 Includes and comments at SOL
9857 !! wikitext
9858 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9859
9860 <noinclude>
9861 some
9862 </noinclude>* stuff
9863 * here
9864
9865 <includeonly>can have stuff</includeonly>=== here ===
9866
9867 !! html/php
9868 <h2><a href="#hu" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="hu">hu</span></h2>
9869 <p>some
9870 </p>
9871 <ul><li> stuff</li>
9872 <li> here</li></ul>
9873 <h3><a href="#here" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="here">here</span></h3>
9874
9875 !! html/parsoid
9876 <!-- 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>
9877
9878 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9879 <p>some</p>
9880 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9881 <li> here</li></ul>
9882
9883 <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>
9884
9885 !! end
9886
9887 # TODO: test with DOM fragment reuse!
9888 !! test
9889 Parsoid: DOM fragment reuse
9890 !! options
9891 parsoid=wt2wt,wt2html
9892 !! wikitext
9893 a{{echo|b<table></table>c}}d
9894
9895 a{{echo|b
9896 <table></table>
9897 c}}d
9898
9899 {{echo|a
9900
9901 <table></table>
9902
9903 b}}
9904 !! html
9905 <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>
9906
9907 <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">
9908 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9909 </span><p about="#mwt2">cd</p>
9910
9911 <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">
9912
9913 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9914
9915 </span><p about="#mwt3">b</p>
9916 !! end
9917
9918 !! test
9919 Parsoid: Merge double tds (bug 50603)
9920 !! options
9921 parsoid
9922 !! wikitext
9923 {|
9924 |{{echo|{{!}} foo}}
9925 |}
9926 !! html
9927 <table><tbody>
9928 <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>
9929 </tbody></table>
9930 !! end
9931
9932 !! test
9933 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9934 !! options
9935 parsoid
9936 !! wikitext
9937 {{echo|<div>}}
9938 {|
9939 |{{echo|{{!}} foo}}
9940 |}
9941 {{echo|</div>}}
9942 !! html
9943 <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}}]}'>
9944 <table><tbody>
9945 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9946 </tbody></table>
9947 </div>
9948 !! end
9949
9950 ###
9951 ### <includeonly> and <noinclude> in attributes
9952 ###
9953 !!test
9954 0. includeonly around the entire attribute
9955 !! wikitext
9956 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9957 !! html
9958 <p><span id="v2">bar</span>
9959 </p>
9960 !!end
9961
9962 !!test
9963 1. includeonly in html attr key
9964 !! wikitext
9965 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9966 !! html
9967 <p><span id="foo">bar</span>
9968 </p>
9969 !!end
9970
9971 !!test
9972 2. includeonly in html attr value
9973 !! wikitext
9974 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9975 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9976 !! html
9977 <p><span id="v1">bar</span>
9978 <span id="v1">bar</span>
9979 </p>
9980 !!end
9981
9982 !!test
9983 3. includeonly in part of an attr value
9984 !! wikitext
9985 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9986 !! html
9987 <p><span style="color:red;">bar</span>
9988 </p>
9989 !!end
9990
9991 !!test
9992 4. includeonly in table attributes
9993 !! wikitext
9994 {|
9995 |- <noinclude>
9996 |-
9997 |a
9998 </noinclude>
9999 |- <includeonly>
10000 |-
10001 |b
10002 </includeonly>
10003 |}
10004 !! html
10005 <table>
10006
10007
10008 <tr>
10009 <td>a
10010 </td></tr>
10011 </table>
10012
10013 !!end
10014
10015 ###
10016 ### Token Stream Patcher tests
10017 ###
10018 ### These tests won't always pass wt2wt and other modes because
10019 ### on serialization, the table will be output on a new line.
10020 ### For now, we are blacklisting them, and using this to test selser.
10021 ###
10022
10023 !!test
10024 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10025 !!options
10026 parsoid=wt2html,wt2wt
10027 !!wikitext
10028 {{echo|}}{| width = '100%'
10029 |foo
10030 |}
10031 !!html/parsoid
10032 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10033 <tbody><tr><td>foo</td></tr>
10034 </tbody></table>
10035 !!end
10036
10037 !!test
10038 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10039 !!options
10040 parsoid=wt2html,wt2wt
10041 !!wikitext
10042 <includeonly>a</includeonly>{| {{{b}}}
10043 |c
10044 |}
10045 !!html/parsoid
10046 <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}}}":""}}'>
10047 <tbody><tr><td>c</td></tr>
10048 </tbody></table>
10049
10050 !!end
10051
10052 ###
10053 ### Testing parsing of templates where a template arg
10054 ### has the same name as the template itself.
10055 ###
10056
10057 !! article
10058 Template:quote
10059 !! text
10060 {{{quote|{{{1}}}}}}
10061 !! endarticle
10062
10063 !!test
10064 Templates: Template Name/Arg clash: 1. Use of positional param
10065 !! wikitext
10066 {{quote|foo}}
10067 !! html
10068 <p>foo
10069 </p>
10070 !!end
10071
10072 !!test
10073 Templates: Template Name/Arg clash: 2. Use of named param
10074 !! wikitext
10075 {{quote|quote=foo}}
10076 !! html
10077 <p>foo
10078 </p>
10079 !!end
10080
10081 !!test
10082 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10083 !! wikitext
10084 {{quote|quote}}
10085 !! html
10086 <p>quote
10087 </p>
10088 !!end
10089
10090 ###
10091 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10092 ###
10093
10094 !!test
10095 Templates: 1. Simple use
10096 !! wikitext
10097 {{echo|Foo}}
10098 !! html
10099 <p>Foo
10100 </p>
10101 !!end
10102
10103 !!test
10104 Templates: 2. Inside a block tag
10105 !! wikitext
10106 <div>{{echo|Foo}}</div>
10107 <blockquote>{{echo|Foo}}</blockquote>
10108 !! html
10109 <div>Foo</div>
10110 <blockquote>Foo</blockquote>
10111
10112 !! html+tidy
10113 <div>Foo</div>
10114 <blockquote>
10115 <p>Foo</p>
10116 </blockquote>
10117 !!end
10118
10119 !!test
10120 Templates: P-wrapping: 1a. Templates on consecutive lines
10121 !! wikitext
10122 {{echo|Foo}}
10123 {{echo|bar}}
10124 !! html
10125 <p>Foo
10126 bar
10127 </p>
10128 !!end
10129
10130 !!test
10131 Templates: P-wrapping: 1b. Templates on consecutive lines
10132 !! wikitext
10133 Foo
10134
10135 {{echo|bar}}
10136 {{echo|baz}}
10137 !! html
10138 <p>Foo
10139 </p><p>bar
10140 baz
10141 </p>
10142 !!end
10143
10144 !!test
10145 Templates: P-wrapping: 1c. Templates on consecutive lines
10146 !! wikitext
10147 {{echo|Foo}}
10148 {{echo|bar}} <div>baz</div>
10149 !! html
10150 <p>Foo
10151 </p>
10152 bar <div>baz</div>
10153
10154 !! html+tidy
10155 <p>Foo</p>
10156 <p>bar</p>
10157 <div>baz</div>
10158 !! end
10159
10160 !!test
10161 Templates: P-wrapping: 1d. Template preceded by comment-only line
10162 !!options
10163 parsoid
10164 !! wikitext
10165 <!-- foo -->
10166 {{echo|Bar}}
10167 !! html
10168 <!-- foo -->
10169
10170 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10171 !!end
10172
10173 !!test
10174 Templates: Inline Text: 1. Multiple template uses
10175 !! wikitext
10176 {{echo|Foo}}bar{{echo|baz}}
10177 !! html
10178 <p>Foobarbaz
10179 </p>
10180 !!end
10181
10182 !!test
10183 Templates: Inline Text: 2. Back-to-back template uses
10184 !! wikitext
10185 {{echo|Foo}}{{echo|bar}}
10186 !! html
10187 <p>Foobar
10188 </p>
10189 !!end
10190
10191 !!test
10192 Templates: Block Tags: 1. Multiple template uses
10193 !! wikitext
10194 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10195 !! html
10196 <div>Foo</div><div>bar</div><div>baz</div>
10197
10198 !!end
10199
10200 !!test
10201 Templates: Block Tags: 2. Back-to-back template uses
10202 !! wikitext
10203 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10204 !! html
10205 <div>Foo</div><div>bar</div>
10206
10207 !!end
10208
10209 # This is an edge case relating to paragraph wrapping.
10210 !!test
10211 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10212 !! wikitext
10213 {{echo|a
10214 b</p>}}
10215 !! html/parsoid
10216 <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
10217 b</p>
10218 !!end
10219
10220 !!test
10221 Templates: Links: 1. Simple example
10222 !! wikitext
10223 {{echo|[[Foo|bar]]}}
10224 !! html
10225 <p><a href="/wiki/Foo" title="Foo">bar</a>
10226 </p>
10227 !!end
10228
10229 !!test
10230 Templates: Links: 2. Generation of link href
10231 !! wikitext
10232 [[{{echo|Foo}}|bar]]
10233 !! html
10234 <p><a href="/wiki/Foo" title="Foo">bar</a>
10235 </p>
10236 !!end
10237
10238 !!test
10239 Templates: Links: 3. Generation of part of a link href
10240 !! wikitext
10241 [[Fo{{echo|o}}|bar]]
10242
10243 [[Foo{{echo|bar}}]]
10244
10245 [[Foo{{echo|bar}}baz]]
10246
10247 [[Foo{{echo|bar}}|bar]]
10248
10249 [[:Foo{{echo|bar}}]]
10250
10251 [[:Foo{{echo|bar}}|bar]]
10252 !! html
10253 <p><a href="/wiki/Foo" title="Foo">bar</a>
10254 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10255 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10256 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10257 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10258 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10259 </p>
10260 !!end
10261
10262 !!test
10263 Templates: Links: 4. Multiple templates generating link href
10264 !! wikitext
10265 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10266 !! html
10267 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10268 </p>
10269 !!end
10270
10271 !!test
10272 Templates: Links: 5. Generation of link text
10273 !! wikitext
10274 [[Foo|{{echo|bar}}]]
10275 !! html
10276 <p><a href="/wiki/Foo" title="Foo">bar</a>
10277 </p>
10278 !!end
10279
10280 !!test
10281 Templates: Links: 5. Nested templates (only outermost template should be marked)
10282 !! wikitext
10283 {{echo|[[{{echo|Foo}}|bar]]}}
10284 !! html
10285 <p><a href="/wiki/Foo" title="Foo">bar</a>
10286 </p>
10287 !!end
10288
10289 !!test
10290 Templates: HTML Tag: 1. Generation of HTML attr. key
10291 !! wikitext
10292 <div {{echo|style}}="color:red;">foo</div>
10293 !! html
10294 <div style="color:red;">foo</div>
10295
10296 !!end
10297
10298 !!test
10299 Templates: HTML Tag: 2. Generation of HTML attr. value
10300 !! wikitext
10301 <div style={{echo|'color:red;'}}>foo</div>
10302 !! html
10303 <div style="color:red;">foo</div>
10304
10305 !!end
10306
10307 !!test
10308 Templates: HTML Tag: 3. Generation of HTML attr key and value
10309 !! wikitext
10310 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10311 !! html
10312 <div style="color:red;">foo</div>
10313
10314 !!end
10315
10316 !!test
10317 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10318 !! wikitext
10319 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10320 !! html
10321 <div title="This is a long title with just one piece templated">foo</div>
10322
10323 !!end
10324
10325 !!test
10326 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10327 !! wikitext
10328 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10329 !! html
10330 <div title="This is a long title with just one piece templated">foo</div>
10331
10332 !!end
10333
10334 !!test
10335 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10336 !! wikitext
10337 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10338 !! html
10339 <div title="This is a long title with just one piece templated">foo</div>
10340
10341 !!end
10342
10343 # SSS FIXME: While it is great we added support for all this,
10344 # do we want to make this part of the spec? Maybe we want to
10345 # deprecate this kind of usage in the future?
10346 !!test
10347 Templates: HTML Tag: 7. Generation of partial attribute key string
10348 !! wikitext
10349 <div st{{echo|yle}}="color:red;">foo</div>
10350 !! html
10351 <div style="color:red;">foo</div>
10352
10353 !!end
10354
10355 !! test
10356 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10357 !! wikitext
10358 <div {{echo|1=id="v1"}}>bar</div>
10359 !! html
10360 <div id="v1">bar</div>
10361
10362 !!end
10363
10364 !! test
10365 Templates: HTML Tag: 9. Multiple template-generated attributes
10366 !! wikitext
10367 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10368 !! html
10369 <div id="v1" title="foo">bar</div>
10370
10371 !!end
10372
10373 !! test
10374 Templates: Support for templates generating attributes and content
10375 !! wikitext
10376 {| {{mixed_attr_content_template}}
10377 |-
10378 |bar
10379 |}
10380 !! html/php
10381 <table style="color:red;" title="T48811">
10382
10383 <tr>
10384 <td>foo
10385 </td></tr>
10386 <tr>
10387 <td>bar
10388 </td></tr></table>
10389
10390 !! html/parsoid
10391 <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|}"]}'>
10392 <tbody><tr>
10393 <td>foo</td></tr>
10394 <tr>
10395 <td>bar</td></tr>
10396 </tbody></table>
10397 !!end
10398
10399 !!test
10400 Templates: HTML Tables: 1. Generating start of a HTML table
10401 !! wikitext
10402 {{echo|<table><tr><td>foo</td>}}</tr></table>
10403 !! html
10404 <table><tr><td>foo</td></tr></table>
10405
10406 !!end
10407
10408 !!test
10409 Templates: HTML Tables: 2a. Generating middle of a HTML table
10410 !! wikitext
10411 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10412 !! html
10413 <table><tr><td>foo</td></tr></table>
10414
10415 !!end
10416
10417 !!test
10418 Templates: HTML Tables: 2b. Generating middle of a HTML table
10419 !! wikitext
10420 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10421 !! html
10422 <table><tr><td>foo</td></tr></table>
10423
10424 !!end
10425
10426 !!test
10427 Templates: HTML Tables: 3. Generating end of a HTML table
10428 !! wikitext
10429 <table><tr>{{echo|<td>foo</td></tr></table>}}
10430 !! html
10431 <table><tr><td>foo</td></tr></table>
10432
10433 !!end
10434
10435 !!test
10436 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10437 !! wikitext
10438 {{echo|<table>}}<tr><td>foo</td></tr></table>
10439 !! html
10440 <table><tr><td>foo</td></tr></table>
10441
10442 !!end
10443
10444 !!test
10445 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10446 !! wikitext
10447 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10448 !! html
10449 <table><tr><td>foo</td></tr></table>
10450
10451 !!end
10452
10453 !!test
10454 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10455 !! wikitext
10456 <table><tr>{{echo|<td>}}foo</td></tr></table>
10457 !! html
10458 <table><tr><td>foo</td></tr></table>
10459
10460 !!end
10461
10462 !!test
10463 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10464 !! wikitext
10465 <table><tr><td>foo{{echo|</td>}}</tr></table>
10466 !! html
10467 <table><tr><td>foo</td></tr></table>
10468
10469 !!end
10470
10471 !!test
10472 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10473 !! wikitext
10474 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10475 !! html
10476 <table><tr><td>foo</td></tr></table>
10477
10478 !!end
10479
10480 !!test
10481 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10482 !! wikitext
10483 <table><tr><td>foo</td></tr>{{echo|</table>}}
10484 !! html
10485 <table><tr><td>foo</td></tr></table>
10486
10487 !!end
10488
10489 !!test
10490 Templates: HTML Tables: 5. Proper fostering of categories from inside
10491 !!options
10492 parsoid=wt2html,wt2wt
10493 !! wikitext
10494 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10495 <!--Two categories (Bug 50330)-->
10496 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10497 !! html
10498 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10499 <!--Two categories (Bug 50330)-->
10500 <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>
10501 !!end
10502
10503 !!test
10504 Templates: Wiki Tables: 1a. Fostering of entire template content
10505 !! wikitext
10506 {|
10507 {{echo|a}}
10508 |}
10509 !! html
10510 <table>
10511 a
10512 <tr><td></td></tr></table>
10513
10514 !! html+tidy
10515 <p>a</p>
10516 <table>
10517 <tr>
10518 <td></td>
10519 </tr>
10520 </table>
10521 !! end
10522
10523 !!test
10524 Templates: Wiki Tables: 1b. Fostering of entire template content
10525 !! wikitext
10526 {|
10527 {{echo|<div>}}
10528 foo
10529 {{echo|</div>}}
10530 |}
10531 !! html
10532 <table>
10533 <div>
10534 <p>foo
10535 </p>
10536 </div>
10537 <tr><td></td></tr></table>
10538
10539 !! html+tidy
10540 <div>
10541 <p>foo</p>
10542 </div>
10543 <table>
10544 <tr>
10545 <td></td>
10546 </tr>
10547 </table>
10548 !! end
10549
10550 !!test
10551 Templates: Wiki Tables: 2. Fostering of partial template content
10552 !! wikitext
10553 {|
10554 {{echo|a
10555 <div>b</div>}}
10556 |}
10557 !! html
10558 <table>
10559 a
10560 <div>b</div>
10561 <tr><td></td></tr></table>
10562
10563 !! html+tidy
10564 <p>a</p>
10565 <div>b</div>
10566 <table>
10567 <tr>
10568 <td></td>
10569 </tr>
10570 </table>
10571 !! end
10572
10573 !!test
10574 Templates: Wiki Tables: 3. td-content via multiple templates
10575 !! wikitext
10576 {|
10577 {{echo|{{pipe}}a}}{{echo|b}}
10578 |}
10579 !! html
10580 <table>
10581 <tr>
10582 <td>ab
10583 </td></tr></table>
10584
10585 !!end
10586
10587 !!test
10588 Templates: Wiki Tables: 4. Templated tags, no content
10589 !! wikitext
10590 {{tbl-start}}
10591 {{tbl-end}}
10592 !! html
10593 <table>
10594 <tr><td></td></tr></table>
10595
10596 !!end
10597
10598 !!test
10599 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10600 !! wikitext
10601 {{tbl-start}}
10602 |foo
10603 {{tbl-end}}
10604 !! html
10605 <table>
10606 <tr>
10607 <td>foo
10608 </td></tr></table>
10609
10610 !!end
10611
10612 !!test
10613 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10614 !! wikitext
10615 {{tbl-start}}
10616 {{!}}foo
10617 {{tbl-end}}
10618 !! html
10619 <table>
10620 <tr>
10621 <td>foo
10622 </td></tr></table>
10623
10624 !!end
10625
10626 !!test
10627 Templates: Lists: Multi-line list-items via templates
10628 !! wikitext
10629 *{{echo|a {{nonexistent|
10630 unused}}}}
10631 *{{echo|b {{nonexistent|
10632 unused}}}}
10633 !! html
10634 <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>
10635 <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>
10636
10637 !!end
10638
10639 !!test
10640 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10641 !! wikitext
10642 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10643 !! html
10644 <p><i>ab</i>c<i>d</i>e
10645 </p>
10646 !!end
10647
10648 !!test
10649 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10650 (PHP parser generates misnested html)
10651 !! wikitext
10652 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10653 !! html/parsoid
10654 <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>
10655 !!end
10656
10657 !!test
10658 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10659 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10660 !! options
10661 parsoid=wt2html,wt2wt
10662 !! wikitext
10663 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10664 !! html
10665 <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>
10666 <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>
10667 <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>
10668 !!end
10669
10670 !!test
10671 Templates: Ugly nesting: 4. Divs opened/closed across templates
10672 !! wikitext
10673 a<div>b{{echo|c</div>d}}e
10674 !! html
10675 a<div>bc</div>de
10676
10677 !! html+tidy
10678 <p>a</p>
10679 <div>bc</div>
10680 <p>de</p>
10681 !! end
10682
10683 !!test
10684 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10685 (Parsoid-centric)
10686 !! options
10687 parsoid
10688 !! wikitext
10689 {|
10690 |{{echo|foo</table>}}
10691 |bar
10692 |}
10693 !! html
10694 <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|}"]}'>
10695
10696 <tbody>
10697 <tr>
10698 <td>foo</td></tr></tbody></table><span about="#mwt1">
10699 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10700 |}</span>
10701 !!end
10702
10703 !!test
10704 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10705 (Parsoid-centric)
10706 !! options
10707 parsoid
10708 !! wikitext
10709 <table>
10710 <tr>
10711 <td>
10712 <table>
10713 <tr>
10714 <td>1. {{echo|foo </table>}}</td>
10715 <td> bar </td>
10716 <td>2. {{echo|baz </table>}}</td>
10717 </tr>
10718 <tr>
10719 <td>abc</td>
10720 </tr>
10721 </table>
10722 </td>
10723 </tr>
10724 <tr>
10725 <td>xyz</td>
10726 </tr>
10727 </table>
10728 !! html
10729 <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>"]}'>
10730 <tbody><tr>
10731 <td>
10732 <table>
10733 <tbody><tr>
10734 <td>1. foo </td></tr></tbody></table></td>
10735 <td> bar </td>
10736 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10737 </span><span about="#mwt2">
10738 </span><span about="#mwt2">
10739 </span><span about="#mwt2">abc</span><span about="#mwt2">
10740 </span><span about="#mwt2">
10741 </span><span about="#mwt2">
10742 </span><span about="#mwt2">
10743 </span><span about="#mwt2">
10744 </span><span about="#mwt2">
10745 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10746 </span><span about="#mwt2">
10747 </span>
10748 !!end
10749
10750 !! test
10751 Templates: Ugly templates: 3. newline-only template parameter
10752 !! wikitext
10753 foo {{echo|
10754 }}
10755 !! html
10756 <p>foo
10757 </p>
10758 !! end
10759
10760 # This looks like a bug: a single newline triggers p/br for some reason.
10761 !! test
10762 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10763 !! wikitext
10764 {{echo|
10765 }}
10766 !! html
10767 <p><br />
10768 </p>
10769 !! end
10770
10771 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10772 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10773 !! test
10774 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10775 !! wikitext
10776 {{echo|<table>}}
10777 {{echo|<div>foo}}
10778 {{echo|</table>}}
10779 !! html/parsoid
10780 <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
10781 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10782 </table>
10783 !! end
10784
10785 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10786 # that are "identical" and generate nesting cycles in the algorithm
10787 !! test
10788 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10789 !! wikitext
10790 {{echo|<table><tr><td><table>}}
10791 {{echo|<div>}}
10792 {{echo|</div>}}
10793 !! html/parsoid
10794 <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"}'>
10795 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10796 </table></td></tr></tbody></table>
10797 !! end
10798
10799 !!test
10800 Parser Functions: 1. Simple example
10801 !! wikitext
10802 {{uc:foo}}
10803 !! html
10804 <p>FOO
10805 </p>
10806 !!end
10807
10808 !!test
10809 Parser Functions: 2. Nested use (only outermost should be marked up)
10810 !! wikitext
10811 {{uc:{{lc:FOO}}}}
10812 !! html
10813 <p>FOO
10814 </p>
10815 !!end
10816
10817 ###
10818 ### Pre-save transform tests
10819 ###
10820 !! test
10821 pre-save transform: subst:
10822 !! options
10823 PST
10824 !! wikitext
10825 {{subst:test}}
10826 !! html
10827 This is a test template
10828 !! end
10829
10830 !! test
10831 pre-save transform: normal template
10832 !! options
10833 PST
10834 !! wikitext
10835 {{test}}
10836 !! html
10837 {{test}}
10838 !! end
10839
10840 !! test
10841 pre-save transform: nonexistent template
10842 !! options
10843 PST
10844 !! wikitext
10845 {{thistemplatedoesnotexist}}
10846 !! html
10847 {{thistemplatedoesnotexist}}
10848 !! end
10849
10850
10851 !! test
10852 pre-save transform: subst magic variables
10853 !! options
10854 PST
10855 !! wikitext
10856 {{subst:SITENAME}}
10857 !! html
10858 MediaWiki
10859 !! end
10860
10861 # This is bug 89, which I fixed. -- wtm
10862 !! test
10863 pre-save transform: subst: templates with parameters
10864 !! options
10865 pst
10866 !! wikitext
10867 {{subst:paramtest|param="something else"}}
10868 !! html
10869 This is a test template with parameter "something else"
10870 !! end
10871
10872 !! article
10873 Template:nowikitest
10874 !! text
10875 <nowiki>'''not wiki'''</nowiki>
10876 !! endarticle
10877
10878 !! test
10879 pre-save transform: nowiki in subst (bug 1188)
10880 !! options
10881 pst
10882 !! wikitext
10883 {{subst:nowikitest}}
10884 !! html
10885 <nowiki>'''not wiki'''</nowiki>
10886 !! end
10887
10888
10889 !! article
10890 Template:commenttest
10891 !! text
10892 This template has <!-- a comment --> in it.
10893 !! endarticle
10894
10895 !! test
10896 pre-save transform: comment in subst (bug 1936)
10897 !! options
10898 pst
10899 !! wikitext
10900 {{subst:commenttest}}
10901 !! html
10902 This template has <!-- a comment --> in it.
10903 !! end
10904
10905 !! test
10906 pre-save transform: unclosed tag
10907 !! options
10908 pst noxml
10909 !! wikitext
10910 <nowiki>'''not wiki'''
10911 !! html
10912 <nowiki>'''not wiki'''
10913 !! end
10914
10915 !! test
10916 pre-save transform: mixed tag case
10917 !! options
10918 pst noxml
10919 !! wikitext
10920 <NOwiki>'''not wiki'''</noWIKI>
10921 !! html
10922 <NOwiki>'''not wiki'''</noWIKI>
10923 !! end
10924
10925 !! test
10926 pre-save transform: unclosed comment in <nowiki>
10927 !! options
10928 pst noxml
10929 !! wikitext
10930 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10931 !! html
10932 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10933 !!end
10934
10935 # Leading @ in this template definition works around a limitation
10936 # in parsoid's parserTests which otherwise strips the <span> from the
10937 # result (confusing it for a template wrapper)
10938 !! article
10939 Template:dangerous
10940 !!text
10941 @<span onmouseover="alert('crap')">Oh no</span>
10942 !!endarticle
10943
10944 !!test
10945 (confirming safety of fix for subst bug 1936)
10946 !! wikitext
10947 {{Template:dangerous}}
10948 !! html
10949 <p>@<span>Oh no</span>
10950 </p>
10951 !! end
10952
10953 !! test
10954 pre-save transform: comment containing gallery (bug 5024)
10955 !! options
10956 pst
10957 !! wikitext
10958 <!-- <gallery>data</gallery> -->
10959 !! html
10960 <!-- <gallery>data</gallery> -->
10961 !!end
10962
10963 !! test
10964 pre-save transform: comment containing extension
10965 !! options
10966 pst
10967 !! wikitext
10968 <!-- <tag>data</tag> -->
10969 !! html
10970 <!-- <tag>data</tag> -->
10971 !!end
10972
10973 !! test
10974 pre-save transform: comment containing nowiki
10975 !! options
10976 pst
10977 !! wikitext
10978 <!-- <nowiki>data</nowiki> -->
10979 !! html
10980 <!-- <nowiki>data</nowiki> -->
10981 !!end
10982
10983 !! test
10984 pre-save transform: <noinclude> in subst (bug 3298)
10985 !! options
10986 pst
10987 !! wikitext
10988 {{subst:Includes}}
10989 !! html
10990 Foobar
10991 !! end
10992
10993 !! test
10994 pre-save transform: <onlyinclude> in subst (bug 3298)
10995 !! options
10996 pst
10997 !! wikitext
10998 {{subst:Includes2}}
10999 !! html
11000 Foo
11001 !! end
11002
11003 !! article
11004 Template:SubstTest
11005 !!text
11006 {{<includeonly>subst:</includeonly>Includes}}
11007 !! endarticle
11008
11009 !! article
11010 Template:SafeSubstTest
11011 !! text
11012 {{<includeonly>safesubst:</includeonly>Includes}}
11013 !! endarticle
11014
11015 !! test
11016 bug 22297: safesubst: works during PST
11017 !! options
11018 pst
11019 !! wikitext
11020 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11021 !! html
11022 FoobarFoobar
11023 !! end
11024
11025 !! test
11026 bug 22297: safesubst: works during normal parse
11027 !! wikitext
11028 {{SafeSubstTest}}
11029 !! html
11030 <p>Foobar
11031 </p>
11032 !! end
11033
11034 !! test
11035 subst: does not work during normal parse
11036 !! wikitext
11037 {{SubstTest}}
11038 !! html
11039 <p>{{subst:Includes}}
11040 </p>
11041 !! end
11042
11043 !! test
11044 pre-save transform: context links ("pipe trick")
11045 !! options
11046 pst
11047 !! wikitext
11048 [[Article (context)|]]
11049 [[Bar:Article|]]
11050 [[:Bar:Article|]]
11051 [[Bar:Article (context)|]]
11052 [[:Bar:Article (context)|]]
11053 [[|Article]]
11054 [[|Article (context)]]
11055 [[Bar:X (Y) Z|]]
11056 [[:Bar:X (Y) Z|]]
11057 !! html
11058 [[Article (context)|Article]]
11059 [[Bar:Article|Article]]
11060 [[:Bar:Article|Article]]
11061 [[Bar:Article (context)|Article]]
11062 [[:Bar:Article (context)|Article]]
11063 [[Article]]
11064 [[Article (context)]]
11065 [[Bar:X (Y) Z|X (Y) Z]]
11066 [[:Bar:X (Y) Z|X (Y) Z]]
11067 !! end
11068
11069 !! test
11070 pre-save transform: context links ("pipe trick") with interwiki prefix
11071 !! options
11072 pst
11073 !! wikitext
11074 [[interwiki:Article|]]
11075 [[:interwiki:Article|]]
11076 [[interwiki:Bar:Article|]]
11077 [[:interwiki:Bar:Article|]]
11078 !! html
11079 [[interwiki:Article|Article]]
11080 [[:interwiki:Article|Article]]
11081 [[interwiki:Bar:Article|Bar:Article]]
11082 [[:interwiki:Bar:Article|Bar:Article]]
11083 !! end
11084
11085 !! test
11086 pre-save transform: context links ("pipe trick") with parens in title
11087 !! options
11088 pst title=[[Somearticle (context)]]
11089 !! wikitext
11090 [[|Article]]
11091 !! html
11092 [[Article (context)|Article]]
11093 !! end
11094
11095 !! test
11096 pre-save transform: context links ("pipe trick") with comma in title
11097 !! options
11098 pst title=[[Someplace, Somewhere]]
11099 !! wikitext
11100 [[|Otherplace]]
11101 [[Otherplace, Elsewhere|]]
11102 [[Otherplace, Elsewhere, Anywhere|]]
11103 !! html
11104 [[Otherplace, Somewhere|Otherplace]]
11105 [[Otherplace, Elsewhere|Otherplace]]
11106 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11107 !! end
11108
11109 !! test
11110 pre-save transform: context links ("pipe trick") with parens and comma
11111 !! options
11112 pst title=[[Someplace (IGNORED), Somewhere]]
11113 !! wikitext
11114 [[|Otherplace]]
11115 [[Otherplace (place), Elsewhere|]]
11116 !! html
11117 [[Otherplace, Somewhere|Otherplace]]
11118 [[Otherplace (place), Elsewhere|Otherplace]]
11119 !! end
11120
11121 !! test
11122 pre-save transform: context links ("pipe trick") with comma and parens
11123 !! options
11124 pst title=[[Who, me? (context)]]
11125 !! wikitext
11126 [[|Yes, you.]]
11127 [[Me, Myself, and I (1937 song)|]]
11128 !! html
11129 [[Yes, you. (context)|Yes, you.]]
11130 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11131 !! end
11132
11133 !! test
11134 pre-save transform: context links ("pipe trick") with namespace
11135 !! options
11136 pst title=[[Ns:Somearticle]]
11137 !! wikitext
11138 [[|Article]]
11139 !! html
11140 [[Ns:Article|Article]]
11141 !! end
11142
11143 !! test
11144 pre-save transform: context links ("pipe trick") with namespace and parens
11145 !! options
11146 pst title=[[Ns:Somearticle (context)]]
11147 !! wikitext
11148 [[|Article]]
11149 !! html
11150 [[Ns:Article (context)|Article]]
11151 !! end
11152
11153 !! test
11154 pre-save transform: context links ("pipe trick") with namespace and comma
11155 !! options
11156 pst title=[[Ns:Somearticle, Context, Whatever]]
11157 !! wikitext
11158 [[|Article]]
11159 !! html
11160 [[Ns:Article, Context, Whatever|Article]]
11161 !! end
11162
11163 !! test
11164 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11165 !! options
11166 pst title=[[Ns:Somearticle, Context (context)]]
11167 !! wikitext
11168 [[|Article]]
11169 !! html
11170 [[Ns:Article (context)|Article]]
11171 !! end
11172
11173 !! test
11174 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11175 !! options
11176 pst title=[[Ns:Somearticle (IGNORED), Context]]
11177 !! wikitext
11178 [[|Article]]
11179 !! html
11180 [[Ns:Article, Context|Article]]
11181 !! end
11182
11183 !! test
11184 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11185 !! options
11186 pst
11187 !! wikitext
11188 [[Article(context)|]]
11189 [[Bar:Article(context)|]]
11190 [[:Bar:Article(context)|]]
11191 [[|Article(context)]]
11192 [[Bar:X(Y)Z|]]
11193 [[:Bar:X(Y)Z|]]
11194 !! html
11195 [[Article(context)|Article]]
11196 [[Bar:Article(context)|Article]]
11197 [[:Bar:Article(context)|Article]]
11198 [[Article(context)]]
11199 [[Bar:X(Y)Z|X(Y)Z]]
11200 [[:Bar:X(Y)Z|X(Y)Z]]
11201 !! end
11202
11203 !! test
11204 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11205 !! options
11206 pst
11207 !! wikitext
11208 [[Article (context)|]]
11209 [[Bar:Article (context)|]]
11210 [[:Bar:Article (context)|]]
11211 [[|Article (context)]]
11212 [[Bar:X (Y) Z|]]
11213 [[:Bar:X (Y) Z|]]
11214 !! html
11215 [[Article (context)|Article]]
11216 [[Bar:Article (context)|Article]]
11217 [[:Bar:Article (context)|Article]]
11218 [[Article (context)]]
11219 [[Bar:X (Y) Z|X (Y) Z]]
11220 [[:Bar:X (Y) Z|X (Y) Z]]
11221 !! end
11222
11223 !! test
11224 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11225 !! options
11226 pst
11227 !! wikitext
11228 [[Article(context)|]]
11229 [[Bar:Article(context)|]]
11230 [[:Bar:Article(context)|]]
11231 [[|Article(context)]]
11232 [[Bar:X(Y)Z|]]
11233 [[:Bar:X(Y)Z|]]
11234 !! html
11235 [[Article(context)|Article]]
11236 [[Bar:Article(context)|Article]]
11237 [[:Bar:Article(context)|Article]]
11238 [[Article(context)]]
11239 [[Bar:X(Y)Z|X(Y)Z]]
11240 [[:Bar:X(Y)Z|X(Y)Z]]
11241 !! end
11242
11243 !! test
11244 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11245 !! options
11246 pst
11247 !! wikitext
11248 [[Article (context), context|]]
11249 [[Article (context),context|]]
11250 [[Bar:Article (context), context|]]
11251 [[Bar:Article (context),context|]]
11252 [[:Bar:Article (context), context|]]
11253 [[:Bar:Article (context),context|]]
11254 !! html
11255 [[Article (context), context|Article]]
11256 [[Article (context),context|Article]]
11257 [[Bar:Article (context), context|Article]]
11258 [[Bar:Article (context),context|Article]]
11259 [[:Bar:Article (context), context|Article]]
11260 [[:Bar:Article (context),context|Article]]
11261 !! end
11262
11263 !! test
11264 pre-save transform: trim trailing empty lines
11265 !! options
11266 pst
11267 !! wikitext
11268 Empty lines are trimmed
11269
11270
11271
11272
11273 !! html
11274 Empty lines are trimmed
11275 !! end
11276
11277 !! test
11278 pre-save transform: Signature expansion
11279 !! options
11280 pst
11281 !! wikitext
11282 * ~~~
11283 * <noinclude>~~~</noinclude>
11284 * <includeonly>~~~</includeonly>
11285 * <onlyinclude>~~~</onlyinclude>
11286 !! html
11287 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11288 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11289 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11290 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11291 !! end
11292
11293
11294 !! test
11295 pre-save transform: Signature expansion in nowiki tags (bug 93)
11296 !! options
11297 pst disabled
11298 !! wikitext
11299 Shall not expand:
11300
11301 <nowiki>~~~~</nowiki>
11302
11303 <includeonly><nowiki>~~~~</nowiki></includeonly>
11304
11305 <noinclude><nowiki>~~~~</nowiki></noinclude>
11306
11307 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11308
11309 {{subst:Foo}} shall be converted to FOO
11310
11311 As well as inside noinclude/onlyinclude
11312 <noinclude>{{subst:Foo}}</noinclude>
11313 <onlyinclude>{{subst:Foo}}</onlyinclude>
11314
11315 But not inside includeonly
11316 <includeonly>{{subst:Foo}}</includeonly>
11317 !! html
11318 Shall not expand:
11319
11320 <nowiki>~~~~</nowiki>
11321
11322 <includeonly><nowiki>~~~~</nowiki></includeonly>
11323
11324 <noinclude><nowiki>~~~~</nowiki></noinclude>
11325
11326 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11327
11328 FOO shall be converted to FOO
11329
11330 As well as inside noinclude/onlyinclude
11331 <noinclude>FOO</noinclude>
11332 <onlyinclude>FOO</onlyinclude>
11333
11334 But not inside includeonly
11335 <includeonly>{{subst:Foo}}</includeonly>
11336 !! end
11337
11338 !! test
11339 Parsoid: Recognize nowiki with trailing space in tags
11340 !! options
11341 parsoid=wt2html
11342 !! wikitext
11343 <nowiki ><div>[[foo]]</nowiki >
11344
11345 a<nowiki / >b
11346
11347 c<nowiki />d
11348
11349 e<nowiki/ >f
11350 !! html
11351 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11352 <p>ab</p>
11353 <p>cd</p>
11354 <p>ef</p>
11355 !! end
11356
11357 !! test
11358 Parsoid: Recognize nowiki with odd capitalization
11359 !! options
11360 parsoid=wt2html
11361 !! wikitext
11362 <noWikI ><div>[[foo]]</Nowiki >
11363 !! html
11364 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11365 !! end
11366
11367
11368 !! test
11369 Parsoid: Escape nowiki with trailing space in tags
11370 !! options
11371 parsoid=html2wt
11372 !! html
11373 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11374 <p>a&lt;nowiki /&gt;b</p>
11375 <p>c&lt;nowiki/ &gt;d</p>
11376 !! wikitext
11377 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11378
11379 a&lt;nowiki /&gt;b
11380
11381 c&lt;nowiki/ &gt;d
11382 !! end
11383
11384 !! test
11385 Parsoid: Escape weird noWikI capitalizations
11386 !! options
11387 parsoid=html2wt
11388 !! html
11389 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11390 !! wikitext
11391 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11392 !! end
11393
11394 ###
11395 ### Message transform tests
11396 ###
11397 !! test
11398 message transform: magic variables
11399 !! options
11400 msg
11401 !! wikitext
11402 {{SITENAME}}
11403 !! html
11404 MediaWiki
11405 !! end
11406
11407 !! test
11408 message transform: should not transform wiki markup
11409 !! options
11410 msg
11411 !! wikitext
11412 ''test''
11413 !! html
11414 ''test''
11415 !! end
11416
11417 !! test
11418 message transform: <noinclude> in transcluded template (bug 4926)
11419 !! options
11420 msg
11421 !! wikitext
11422 {{Includes}}
11423 !! html
11424 Foobar
11425 !! end
11426
11427 !! test
11428 message transform: <onlyinclude> in transcluded template (bug 4926)
11429 !! options
11430 msg
11431 !! wikitext
11432 {{Includes2}}
11433 !! html
11434 Foo
11435 !! end
11436
11437 !! test
11438 {{#special:}} page name, known
11439 !! options
11440 msg
11441 !! wikitext
11442 {{#special:Recentchanges}}
11443 !! html
11444 Special:RecentChanges
11445 !! end
11446
11447 !! test
11448 {{#special:}} page name with subpage, known
11449 !! options
11450 msg
11451 !! wikitext
11452 {{#special:Recentchanges/param}}
11453 !! html
11454 Special:RecentChanges/param
11455 !! end
11456
11457 !! test
11458 {{#special:}} page name, unknown
11459 !! options
11460 msg
11461 !! wikitext
11462 {{#special:foobar nonexistent}}
11463 !! html
11464 Special:Foobar nonexistent
11465 !! end
11466
11467 !! test
11468 {{#speciale:}} page name, known
11469 !! options
11470 msg
11471 !! wikitext
11472 {{#speciale:Recentchanges}}
11473 !! html
11474 Special:RecentChanges
11475 !! end
11476
11477 !! test
11478 {{#speciale:}} page name with subpage, known
11479 !! options
11480 msg
11481 !! wikitext
11482 {{#speciale:Recentchanges/param}}
11483 !! html
11484 Special:RecentChanges/param
11485 !! end
11486
11487 !! test
11488 {{#speciale:}} page name, unknown
11489 !! options
11490 msg
11491 !! wikitext
11492 {{#speciale:foobar nonexistent}}
11493 !! html
11494 Special:Foobar_nonexistent
11495 !! end
11496
11497 ###
11498 ### Images
11499 ###
11500 ### For Parsoid-specific tests, see
11501 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11502
11503 !! test
11504 Simple image
11505 !! options
11506 parsoid=wt2html,wt2wt,html2html
11507 !! wikitext
11508 [[Image:foobar.jpg]]
11509 !! html/php
11510 <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>
11511 </p>
11512 !! html/parsoid
11513 <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>
11514 !! end
11515
11516 !! test
11517 Simple image (using File: namespace, now canonical)
11518 !! wikitext
11519 [[File:Foobar.jpg]]
11520 !! html/php
11521 <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>
11522 </p>
11523 !! html/parsoid
11524 <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>
11525 !! end
11526
11527 !! test
11528 Right-aligned image
11529 !! wikitext
11530 [[File:Foobar.jpg|right]]
11531 !! html/php
11532 <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>
11533
11534 !! html/parsoid
11535 <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>
11536 !! end
11537
11538 !! test
11539 Image with caption
11540 !! wikitext
11541 [[File:Foobar.jpg|right|Caption text]]
11542 !! html/php
11543 <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>
11544
11545 !! html/parsoid
11546 <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>
11547 !! end
11548
11549 !! test
11550 Image with caption, bug 53312 #1
11551 !! wikitext
11552 [[File:Foobar.jpg|right|Caption page stuff]]
11553 !! html/php
11554 <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>
11555
11556 !! html/parsoid
11557 <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>
11558 !! end
11559
11560 !! test
11561 Image with caption, bug 53312 #2
11562 !! wikitext
11563 [[File:Foobar.jpg|right|Caption page=]]
11564 !! html/php
11565 <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>
11566
11567 !! html/parsoid
11568 <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>
11569 !! end
11570
11571 !! test
11572 Image with caption, bug 53312 #3
11573 !! wikitext
11574 [[File:Foobar.jpg|right|Caption page=stuff]]
11575 !! html/php
11576 <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>
11577
11578 !! html/parsoid
11579 <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>
11580 !! end
11581
11582 !! test
11583 Allow empty links in image captions (Bug 60753)
11584 !! options
11585 thumbsize=220
11586 !! wikitext
11587 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11588 [[]]
11589 [[Link2]]
11590 ]]
11591 !! html/php
11592 <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>
11593
11594 !! html/parsoid
11595 <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>
11596 [[]]
11597 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11598 </figcaption></figure>
11599 !! end
11600
11601 !! test
11602 Titles in unlinked images (T23454)
11603 !! wikitext
11604 [[File:Foobar.jpg|link=|stuff]]
11605 !! html/php
11606 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11607 </p>
11608 !! end
11609
11610 !! test
11611 Link with empty target
11612 !! wikitext
11613 [[]]
11614 !! html
11615 <p>[[]]
11616 </p>
11617 !! end
11618
11619 !! test
11620 Image with link trail
11621 !! wikitext
11622 Linktrails should not work for images: [[File:Foobar.jpg]]s
11623 !! html/php
11624 <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
11625 </p>
11626 !! html/parsoid
11627 <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>
11628 !! end
11629
11630 !! test
11631 Image with empty attribute
11632 !! options
11633 parsoid=wt2html,wt2wt,html2html
11634 !! wikitext
11635 [[File:Foobar.jpg|right||Caption text]]
11636 !! html/php
11637 <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>
11638
11639 !! html/parsoid
11640 <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>
11641 !! end
11642
11643 !! test
11644 1. Block image with individual attributes from templates
11645 !! wikitext
11646 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11647 !! html/php
11648 <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>
11649
11650 !! html/parsoid
11651 <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>
11652 !! end
11653
11654 !! test
11655 2. Block Image with individual attributes from templates
11656 !! wikitext
11657 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11658 !! html/php
11659 <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>
11660
11661 !! html/parsoid
11662 <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>
11663 !! end
11664
11665 !! test
11666 3. Inline image with individual attributes from templates
11667 !! wikitext
11668 [[File:Foobar.jpg|{{echo|50px}}]]
11669 !! html/php
11670 <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>
11671 </p>
11672 !! html/parsoid
11673 <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>
11674 !! end
11675
11676 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11677 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11678 !! test
11679 Image with multiple attributes from the same template
11680 !! wikitext
11681 [[File:Foobar.jpg|{{image_attribs}}]]
11682 !! html/php
11683 <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>
11684
11685 !! html/parsoid
11686 <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>
11687 !! end
11688
11689 !! test
11690 Image with link tails
11691 !! options
11692 thumbsize=220
11693 !! wikitext
11694 123[[File:Foobar.jpg]]456
11695 123[[File:Foobar.jpg|right]]456
11696 123[[File:Foobar.jpg|thumb]]456
11697 !! html/php
11698 <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
11699 </p>
11700 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
11701 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
11702
11703 !! html/php+tidy
11704 <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>
11705 <p>123</p>
11706 <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>
11707 <p>456 123</p>
11708 <div class="thumb tright">
11709 <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>
11710 <div class="thumbcaption">
11711 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11712 </div>
11713 </div>
11714 </div>
11715 <p>456</p>
11716 !! html/parsoid
11717 <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>
11718 <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>
11719 <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>
11720 !! end
11721
11722 !! test
11723 Image with multiple captions -- only last one is accepted
11724 !! wikitext
11725 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11726 !! html/php
11727 <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>
11728
11729 !! html/parsoid
11730 <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>
11731 !! end
11732
11733 !! test
11734 Image with multiple widths -- use last
11735 !! wikitext
11736 [[File:Foobar.jpg|200px|300px|caption]]
11737 !! html/php
11738 <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>
11739 </p>
11740 !! html/parsoid
11741 <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>
11742 !! end
11743
11744 !! test
11745 Image with multiple alignments -- use first (bug 48664)
11746 !! options
11747 thumbsize=220
11748 !! wikitext
11749 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11750
11751 [[File:Foobar.jpg|middle|text-top|caption]]
11752 !! html/php
11753 <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>
11754 <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>
11755 </p>
11756 !! html/parsoid
11757 <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>
11758 <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>
11759 !! end
11760
11761 !! test
11762 Image with width attribute at different positions
11763 !! wikitext
11764 [[File:Foobar.jpg|200px|right|Caption]]
11765 [[File:Foobar.jpg|right|200px|Caption]]
11766 [[File:Foobar.jpg|right|Caption|200px]]
11767 !! html/php
11768 <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>
11769 <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>
11770 <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>
11771
11772 !! html/parsoid
11773 <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>
11774 <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>
11775 <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>
11776 !! end
11777
11778 # a sad bit of backward-compatibility
11779 !! test
11780 Image with size specified with pxpx (bug 13500, 51628)
11781 !! options
11782 parsoid=wt2html,wt2wt,html2html
11783 !! wikitext
11784 [[File:Foobar.jpg|20pxpx]]
11785 [[File:Foobar.jpg|200x20pxpx]]
11786 !! html/php
11787 <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>
11788 <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>
11789 </p>
11790 !! html/parsoid
11791 <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>
11792 !! end
11793
11794 !! test
11795 Image with link parameter, wiki target
11796 !! wikitext
11797 [[File:Foobar.jpg|link=Main Page]]
11798 !! html/php
11799 <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>
11800 </p>
11801 !! html/parsoid
11802 <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>
11803 !! end
11804
11805 # parsoid bug 49293 (part 1)
11806 !! test
11807 Image with link parameter, URL target
11808 !! wikitext
11809 [[File:Foobar.jpg|link=http://example.com/]]
11810 !! html/php
11811 <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>
11812 </p>
11813 !! html/parsoid
11814 <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>
11815 !! end
11816
11817 # parsoid bug 49293 (part 2)
11818 !! test
11819 Image with link parameter, protocol-less URL target
11820 !! wikitext
11821 [[File:Foobar.jpg|link=//example.com/]]
11822 !! html/php
11823 <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>
11824 </p>
11825 !! html/parsoid
11826 <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>
11827 !! end
11828
11829 !! test
11830 Image with link parameter, wgExternalLinkTarget
11831 !! wikitext
11832 [[Image:foobar.jpg|link=http://example.com/]]
11833 !! config
11834 wgExternalLinkTarget='foobar'
11835 !! html
11836 <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>
11837 </p>
11838 !! end
11839
11840 !! test
11841 Image with link parameter, wgNoFollowLinks set to false
11842 !! wikitext
11843 [[Image:foobar.jpg|link=http://example.com/]]
11844 !! config
11845 wgNoFollowLinks=false
11846 !! html
11847 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11848 </p>
11849 !! end
11850
11851 !! test
11852 Image with link parameter, wgNoFollowDomainExceptions
11853 !! wikitext
11854 [[Image:foobar.jpg|link=http://example.com/]]
11855 !! config
11856 wgNoFollowDomainExceptions='example.com'
11857 !! html
11858 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11859 </p>
11860 !! end
11861
11862 !! test
11863 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11864 !! wikitext
11865 [[Image:foobar.jpg|link=http://example.com/|Title]]
11866 !! config
11867 wgExternalLinkTarget='foobar'
11868 !! html
11869 <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>
11870 </p>
11871 !! end
11872
11873 !! test
11874 Image with empty link parameter
11875 !! wikitext
11876 [[File:Foobar.jpg|link=]]
11877 !! html/php
11878 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11879 </p>
11880 !! html/parsoid
11881 <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>
11882 !! end
11883
11884 !! test
11885 Image with link parameter (wiki target) and unnamed parameter
11886 !! wikitext
11887 [[File:Foobar.jpg|link=Main_Page|Title]]
11888 !! html/php
11889 <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>
11890 </p>
11891 !! html/parsoid
11892 <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>
11893 !! end
11894
11895 !! test
11896 Image with link parameter (URL target) and unnamed parameter
11897 !! wikitext
11898 [[File:Foobar.jpg|link=http://example.com/|Title]]
11899 !! html/php
11900 <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>
11901 </p>
11902 !! html/parsoid
11903 <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>
11904 !! end
11905
11906 !! test
11907 Thumbnail image with link parameter
11908 !! options
11909 thumbsize=220
11910 parsoid=wt2html,wt2wt,html2html
11911 !! wikitext
11912 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11913 !! html/php
11914 <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>
11915
11916 !! html/parsoid
11917 <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>
11918 !! end
11919
11920 !! test
11921 Manually-specified thumbnail image
11922 !! options
11923 thumbsize=220
11924 !! wikitext
11925 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11926 !! html/php
11927 <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>
11928
11929 !! html/parsoid
11930 <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>
11931 !! end
11932
11933 !! test
11934 Manually-specified thumbnail image with explicit link to wiki page
11935 !! options
11936 thumbsize=220
11937 parsoid=wt2html,wt2wt,html2html
11938 !! wikitext
11939 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11940 !! html/php
11941 <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>
11942
11943 !! html/parsoid
11944 <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>
11945 !! end
11946
11947 !! test
11948 Manually-specified thumbnail image with explicit link to url
11949 !! options
11950 thumbsize=220
11951 parsoid=wt2html,wt2wt,html2html
11952 !! wikitext
11953 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11954 !! html/php
11955 <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>
11956
11957 !! html/parsoid
11958 <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>
11959 !! end
11960
11961 !! test
11962 Manually-specified thumbnail image with explicit no link
11963 !! options
11964 thumbsize=220
11965 parsoid=wt2html,wt2wt,html2html
11966 !! wikitext
11967 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11968 !! html/php
11969 <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>
11970
11971 !! html/parsoid
11972 <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>
11973 !! end
11974
11975 !! test
11976 Manually-specified thumbnail image with explicit link and alt text
11977 !! options
11978 thumbsize=220
11979 parsoid=wt2html,wt2wt,html2html
11980 !! wikitext
11981 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11982 !! html/php
11983 <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>
11984
11985 !! html/parsoid
11986 <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>
11987 !! end
11988
11989 !! test
11990 Image with frame and link
11991 !! options
11992 parsoid=wt2html,wt2wt,html2html
11993 !! wikitext
11994 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11995 !! html/php
11996 <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>
11997
11998 !! html/parsoid
11999 <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>
12000 !! end
12001
12002 !! test
12003 Image with frame and link and explicit alt
12004 !! options
12005 parsoid=wt2html,wt2wt,html2html
12006 !! wikitext
12007 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12008 !! html/php
12009 <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>
12010
12011 !! html/parsoid
12012 <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>
12013 !! end
12014
12015 !! test
12016 Image with wiki markup in implicit alt
12017 !! options
12018 parsoid=wt2html,wt2wt,html2html
12019 !! wikitext
12020 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12021
12022 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12023 !! html/php
12024 <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>
12025 </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>
12026 </p>
12027 !! html/parsoid
12028 <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>
12029 <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>
12030 !! end
12031
12032 ###################
12033 # Conflicting image format options.
12034 # First option specified should 'win'.
12035 # All three cases in each test should be identical.
12036
12037 !! test
12038 Image with 'frameless' first.
12039 !! options
12040 parsoid=wt2html,wt2wt,html2html
12041 !! wikitext
12042 [[File:Foobar.jpg|frameless|caption]]
12043
12044 [[File:Foobar.jpg|frameless|frame|caption]]
12045
12046 [[File:Foobar.jpg|frameless|thumb|caption]]
12047 !! html/php
12048 <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>
12049 </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>
12050 </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>
12051 </p>
12052 !! html/parsoid
12053 <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>
12054 <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>
12055 <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>
12056 !! end
12057
12058 !! test
12059 Image with 'frame' first.
12060 !! options
12061 parsoid=wt2html,wt2wt,html2html
12062 !! wikitext
12063 [[File:Foobar.jpg|frame|caption]]
12064 [[File:Foobar.jpg|frame|frameless|caption]]
12065 [[File:Foobar.jpg|frame|thumb|caption]]
12066 !! html/php
12067 <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>
12068 <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>
12069 <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>
12070
12071 !! html/parsoid
12072 <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>
12073 <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>
12074 <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>
12075 !! end
12076
12077 !! test
12078 Image with 'thumb' first.
12079 !! options
12080 parsoid=wt2html,wt2wt,html2html
12081 !! wikitext
12082 [[File:Foobar.jpg|thumb|caption]]
12083 [[File:Foobar.jpg|thumb|frameless|caption]]
12084 [[File:Foobar.jpg|thumb|frame|caption]]
12085 !! html/php
12086 <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>
12087 <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>
12088 <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>
12089
12090 !! html/parsoid
12091 <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>
12092 <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>
12093 <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>
12094 !! end
12095
12096 ###################
12097 # Image sizing.
12098 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12099 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12100 # Foobar has actual size of 1941x220
12101 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12102 # a scalable format.
12103 # 2. Framed images always ignore size options; always render at default size.
12104 # 3. "Unspecified format" and border are the only types which can be
12105 # enlarged.
12106
12107 !! test
12108 Image: "unspecified format" and border enlarge
12109 !! options
12110 parsoid=wt2html,wt2wt,html2html
12111 !! wikitext
12112 [[File:Foobar.jpg|2000px]]
12113
12114 [[File:Foobar.jpg|border|2000px]]
12115 !! html/php
12116 <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>
12117 </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>
12118 </p>
12119 !! html/parsoid
12120 <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>
12121 <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>
12122 !! end
12123
12124 !! test
12125 Image: "unspecified format" and border reduce
12126 !! options
12127 parsoid=wt2html,wt2wt,html2html
12128 !! wikitext
12129 [[File:Foobar.jpg|1000px]]
12130
12131 [[File:Foobar.jpg|border|1000px]]
12132 !! html/php
12133 <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>
12134 </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>
12135 </p>
12136 !! html/parsoid
12137 <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>
12138 <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>
12139 !! end
12140
12141 !! test
12142 Image: thumbs reduce
12143 !! options
12144 parsoid=wt2html,wt2wt,html2html
12145 !! wikitext
12146 [[File:Foobar.jpg|thumb|50px]]
12147 !! html/php
12148 <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>
12149
12150 !! html/parsoid
12151 <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>
12152 !! end
12153
12154 !! test
12155 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12156 !! options
12157 parsoid=wt2html,wt2wt,html2html
12158 !! wikitext
12159 [[File:Foobar.jpg|thumb|2000px]]
12160
12161 [[File:Foobar.svg|thumb|2000px]]
12162 !! html/php
12163 <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>
12164 <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>
12165
12166 !! html/parsoid
12167 <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>
12168 <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>
12169 !! end
12170
12171 !! test
12172 Image: frameless can reduce in size
12173 !! options
12174 parsoid=wt2html,wt2wt,html2html
12175 !! wikitext
12176 [[File:Foobar.jpg|frameless|50px]]
12177 !! html/php
12178 <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>
12179 </p>
12180 !! html/parsoid
12181 <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>
12182 !! end
12183
12184 !! test
12185 Image: bitmap frameless can't be enlarged past original size, but vector can
12186 !! options
12187 parsoid=wt2html,wt2wt,html2html
12188 !! wikitext
12189 [[File:Foobar.jpg|frameless|2000px]]
12190
12191 [[File:Foobar.svg|frameless|2000px]]
12192 !! html/php
12193 <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>
12194 </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>
12195 </p>
12196 !! html/parsoid
12197 <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>
12198 <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>
12199 !! end
12200
12201 !! test
12202 Image: framed images are always unscaled.
12203 !! options
12204 parsoid=wt2html,wt2wt,html2html
12205 !! wikitext
12206 [[File:Foobar.jpg|frame]]
12207
12208 [[File:Foobar.jpg|frame|50px]]
12209
12210 [[File:Foobar.jpg|frame|50x50px]]
12211
12212 [[File:Foobar.jpg|frame|2000px]]
12213 !! html/php
12214 <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>
12215 <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>
12216 <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>
12217 <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>
12218
12219 !! html/parsoid
12220 <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>
12221 <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>
12222 <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>
12223 <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>
12224 !! end
12225
12226 ###################
12227
12228 !! test
12229 Link to image page- image page normally doesn't exists, hence edit link
12230 Add test with existing image page
12231 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12232 !! wikitext
12233 [[:Image:test]]
12234 !! html
12235 <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>
12236 </p>
12237 !! end
12238
12239 !! test
12240 bug 18784 Link to non-existent image page with caption should use caption as link text
12241 !! wikitext
12242 [[:Image:test|caption]]
12243 !! html
12244 <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>
12245 </p>
12246 !! end
12247
12248 !! test
12249 Frameless image caption with a free URL
12250 !! wikitext
12251 [[File:Foobar.jpg|http://example.com]]
12252 !! html/php
12253 <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>
12254 </p>
12255 !! html/parsoid
12256 <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>
12257 !! end
12258
12259 !! test
12260 Thumbnail image caption with a free URL
12261 !! options
12262 thumbsize=220
12263 !! wikitext
12264 [[File:Foobar.jpg|thumb|http://example.com]]
12265 !! html/php
12266 <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>
12267
12268 !! html/parsoid
12269 <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>
12270 !! end
12271
12272 !! test
12273 Thumbnail image caption with a free URL and explicit alt
12274 !! options
12275 thumbsize=220
12276 parsoid=wt2html,wt2wt,html2html
12277 !! wikitext
12278 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12279 !! html/php
12280 <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>
12281
12282 !! html/parsoid
12283 <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>
12284 !! end
12285
12286 !! test
12287 SVG thumbnails with no language set
12288 !! options
12289 !! wikitext
12290 [[File:Foobar.svg|thumb|caption]]
12291 !! html/php
12292 <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>
12293
12294 !! html/parsoid
12295 <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>
12296 !! end
12297
12298 !! test
12299 SVG thumbnails with language de
12300 !! options
12301 parsoid=wt2html,wt2wt,html2html
12302 !! wikitext
12303 [[File:Foobar.svg|thumb|caption|lang=de]]
12304 !! html/php
12305 <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>
12306
12307 !! html/parsoid
12308 <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>
12309 !! end
12310
12311 !! test
12312 SVG thumbnails with invalid language code
12313 !! options
12314 parsoid=wt2html,wt2wt,html2html
12315 !! wikitext
12316 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12317 !! html/php
12318 <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>
12319
12320 !! html/parsoid
12321 <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>
12322 !! end
12323
12324 !! test
12325 BUG 1887: A ISBN with a thumbnail
12326 !! wikitext
12327 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12328 !! html/php
12329 <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>
12330
12331 !! html/parsoid
12332 <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>
12333 !! end
12334
12335 !! test
12336 BUG 1887: A RFC with a thumbnail
12337 !! wikitext
12338 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12339 !! html/php
12340 <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>
12341
12342 !! html/parsoid
12343 <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>
12344 !! end
12345
12346 !! test
12347 BUG 1887: A mailto link with a thumbnail
12348 !! wikitext
12349 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12350 !! html/php
12351 <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>
12352
12353 !! html/parsoid
12354 <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>
12355 !! end
12356
12357 # Pending resolution to bug 368
12358 !! test
12359 BUG 648: Frameless image caption with a link
12360 !! wikitext
12361 [[File:Foobar.jpg|text with a [[link]] in it]]
12362 !! html/php
12363 <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>
12364 </p>
12365 !! html/parsoid
12366 <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>
12367 !! end
12368
12369 !! test
12370 BUG 648: Frameless image caption with a link (suffix)
12371 !! wikitext
12372 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12373 !! html/php
12374 <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>
12375 </p>
12376 !! html/parsoid
12377 <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>
12378 !! end
12379
12380 !! test
12381 BUG 648: Frameless image caption with an interwiki link
12382 !! wikitext
12383 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12384 !! html/php
12385 <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>
12386 </p>
12387 !! html/parsoid
12388 <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>
12389 !! end
12390
12391 !! test
12392 BUG 648: Frameless image caption with a piped interwiki link
12393 !! wikitext
12394 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12395 !! html/php
12396 <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>
12397 </p>
12398 !! html/parsoid
12399 <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>
12400 !! end
12401
12402 !! test
12403 Escape HTML special chars in image alt text
12404 !! wikitext
12405 [[File:Foobar.jpg|& < > "]]
12406 !! html/php
12407 <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>
12408 </p>
12409 !! html/parsoid
12410 <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>
12411 !! end
12412
12413 !! test
12414 BUG 499: Alt text should have &#1234;, not &amp;1234;
12415 !! wikitext
12416 [[File:Foobar.jpg|&#9792;]]
12417 !! html/php
12418 <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>
12419 </p>
12420 !! html/parsoid
12421 <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>
12422 !! end
12423
12424 !! test
12425 Broken image caption with link
12426 !! options
12427 parsoid=wt2html,wt2wt,html2html
12428 !! wikitext
12429 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12430 !! html/php
12431 <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.
12432 </p>
12433 !! html/parsoid
12434 <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>
12435 !! end
12436
12437 !! test
12438 Image caption containing another image
12439 !! wikitext
12440 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12441 !! html/php
12442 <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>
12443
12444 !! html/parsoid
12445 <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>
12446 !! end
12447
12448 !! test
12449 Image: caption containing a newline
12450 !! wikitext
12451 [[File:Foobar.jpg|This
12452 *is some text]]
12453 !! html/php
12454 <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>
12455 </p>
12456 !! html/parsoid
12457 <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>
12458 !!end
12459
12460 !!test
12461 Image: caption containing leading space
12462 (The leading space should not trigger nowiki escaping in wt2wt mode)
12463 !! wikitext
12464 [[File:Foobar.jpg|thumb| bar]]
12465 !! html/php
12466 <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>
12467
12468 !! html/parsoid
12469 <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>
12470 !!end
12471
12472 !! test
12473 Image: caption containing a table
12474 !! options
12475 parsoid=wt2html,wt2wt,html2html
12476 !! wikitext
12477 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12478 {|
12479 ! Foo !! Bar
12480 |-
12481 | Foo1 || Bar1
12482 |}
12483 and some more text.]]
12484 !! html/php
12485 <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>
12486
12487 !! html/parsoid
12488 <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
12489 <table>
12490 <tbody>
12491 <tr><th>Foo </th><th>Bar</th></tr>
12492 <tr>
12493 <td>Foo1 </td>
12494 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12495 !! end
12496
12497 !! test
12498 Bug 3090: External links other than http: in image captions
12499 !! wikitext
12500 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12501 !! html/php
12502 <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>
12503
12504 !! html/parsoid
12505 <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>
12506 !! end
12507
12508 !! test
12509 Custom class
12510 !! options
12511 parsoid=wt2html,wt2wt,html2html
12512 !! wikitext
12513 [[Image:foobar.jpg|a|class=b]]
12514 !! html/php
12515 <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>
12516 </p>
12517 !! html/parsoid
12518 <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>
12519 !! end
12520
12521 !! test
12522 Localized image handling (1).
12523 !! options
12524 parsoid=wt2html,wt2wt,html2html
12525 language=es
12526 !! wikitext
12527 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12528 !! html/php
12529 <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>
12530
12531 !! html/parsoid
12532 <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>
12533 !! end
12534
12535 !! test
12536 Localized image handling (2).
12537 !! options
12538 thumbsize=220
12539 parsoid=wt2html,wt2wt,html2html
12540 language=es
12541 !! wikitext
12542 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12543 !! html/php
12544 <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>
12545
12546 !! html/parsoid
12547 <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>
12548 !! end
12549
12550 !! test
12551 "border", "frameless" and "class" attributes on an image.
12552 !! options
12553 thumbsize=220
12554 parsoid=wt2html,wt2wt,html2html
12555 !! wikitext
12556 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12557 !! html/php
12558 <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>
12559 </p>
12560 !! html/parsoid
12561 <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>
12562 !! end
12563
12564 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12565 !! test
12566 Invalid image attributes (bug 62500)
12567 !! options
12568 thumbsize=220
12569 parsoid=wt2html,wt2wt,html2html
12570 !! wikitext
12571 [[File:Foobar.jpg|thumb|float|left|caption]]
12572
12573 [[File:Foobar.jpg|thumb|righ|caption]]
12574
12575 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12576 !! html/php
12577 <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>
12578 <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>
12579 <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>
12580
12581 !! html/parsoid
12582 <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>
12583 <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>
12584 <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>
12585 !! end
12586
12587 !! article
12588 File:Barfoo.jpg
12589 !! text
12590 #REDIRECT [[File:Barfoo.jpg]]
12591 !! endarticle
12592
12593 # FIXME: Parsoid should run this test -- but we'd need to teach the
12594 # mockAPI about the redirected Barfoo.jpg image.
12595 !! test
12596 Redirected image
12597 !! wikitext
12598 [[Image:Barfoo.jpg]]
12599 !! html/php
12600 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12601 </p>
12602 !! end
12603
12604 !! test
12605 Missing image with uploads disabled
12606 !! options
12607 wgEnableUploads=0
12608 !! wikitext
12609 [[File:Foobaz.jpg]]
12610 !! html/php
12611 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12612 </p>
12613 !! html/parsoid
12614 <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>
12615 !! end
12616
12617 # Parsoid-specific testing for images
12618 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12619 # Currently imperfect due to a flaw in the Parsoid testrunner
12620 # Work in progress
12621 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12622 # image tests.
12623
12624 !! test
12625 Parsoid-specific image handling - simple image with size and middle alignment
12626 !! wikitext
12627 [[File:Foobar.jpg|middle|50px]]
12628 !! html/parsoid
12629 <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>
12630 !! end
12631
12632 !! test
12633 Parsoid-specific image handling - simple image with size, middle alignment,
12634 non-standard namespace alias
12635 !! options
12636 parsoid=wt2wt,wt2html,html2html
12637 !! wikitext
12638 [[Image:Foobar.jpg|middle|50px]]
12639 !! html/parsoid
12640 <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>
12641 !! end
12642
12643 !! test
12644 Parsoid-specific image handling - simple image with size and middle alignment
12645 (existing content)
12646 !! wikitext
12647 [[File:Foobar.jpg|50px|middle]]
12648 !! html/parsoid
12649 <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>
12650 !! end
12651
12652 !! test
12653 Parsoid-specific image handling - simple image with size and middle alignment
12654 and non-standard namespace name
12655 !! options
12656 parsoid=wt2html,wt2wt,html2html
12657 !! wikitext
12658 [[Image:Foobar.jpg|50px|middle]]
12659 !! html/parsoid
12660 <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>
12661 !! end
12662
12663 !! test
12664 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12665 !! wikitext
12666 [[File:Foobar.jpg|500x10px|baseline|caption]]
12667 !! html/parsoid
12668 <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>
12669 !! end
12670
12671 !! test
12672 Parsoid-specific image handling - simple image with border and size spec
12673 !! wikitext
12674 [[File:Foobar.jpg|50px|border|caption]]
12675 !! html/parsoid
12676 <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>
12677 !! end
12678
12679 !! test
12680 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12681 !! wikitext
12682 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12683 !! html/parsoid
12684 <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>
12685 !! end
12686
12687 !! test
12688 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12689 (existing content)
12690 !! wikitext
12691 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12692 !! html/parsoid
12693 <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>
12694 !! end
12695
12696 !! test
12697 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12698 !! wikitext
12699 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12700 !! html/parsoid
12701 <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>
12702 !! end
12703
12704 !! test
12705 Parsoid-specific image handling - thumbnail with specific size, halign,
12706 valign, and caption (existing content)
12707 !! wikitext
12708 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12709 !! html/parsoid
12710 <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>
12711 !! end
12712
12713 !! test
12714 Parsoid-specific image handling - framed image with specific size and caption
12715 (size is ignored)
12716 !! options
12717 parsoid=wt2html,wt2wt,html2html
12718 !! wikitext
12719 [[File:Foobar.jpg|frame|500x50px|caption]]
12720 !! html/parsoid
12721 <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>
12722 !! end
12723
12724 !! test
12725 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12726 (size is ignored)
12727 !! options
12728 parsoid=wt2html,wt2wt,html2html
12729 !! wikitext
12730 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12731 !! html/parsoid
12732 <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>
12733 !! end
12734
12735 !! test
12736 Parsoid-specific image handling - frameless image with specific size, border, and caption
12737 !! wikitext
12738 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12739 !! html/parsoid
12740 <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>
12741 !! end
12742
12743 !! test
12744 Parsoid-specific image handling - simple image with a formatted caption
12745 !! wikitext
12746 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12747 !! html/parsoid
12748 <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>
12749 !! end
12750
12751 !! test
12752 Parsoid-specific image handling - caption with a template in it
12753 !! wikitext
12754 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12755 !! html/parsoid
12756 <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>
12757 !! end
12758
12759 !! test
12760 Parsoid-specific image handling - caption with unbalanced tags in it
12761 !! options
12762 parsoid=wt2html,wt2wt,html2html
12763 !! wikitext
12764 foo
12765 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12766 bar
12767 !! html/parsoid
12768 <p>foo</p>
12769 <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>
12770 <p>bar</p>
12771 !! end
12772
12773 !! test
12774 Parsoid-specific image handling - empty caption (1)
12775 !! options
12776 parsoid=wt2html,wt2wt
12777 !! wikitext
12778 [[File:Foobar.jpg|thumb|]]
12779 !! html/parsoid
12780 <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>
12781 !! end
12782
12783 # empty captions don't get serialized unless we're in the "round trip" case
12784 !! test
12785 Parsoid-specific image handling - empty caption (2)
12786 !! options
12787 parsoid=html2wt
12788 !! html/parsoid
12789 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12790 <a href="File:Foobar.jpg">
12791 <img resource="./File:Foobar.jpg"
12792 src="//example.com/images/3/3a/Foobar.jpg"
12793 height="25" width="220"/>
12794 </a>
12795 <figcaption></figcaption>
12796 </figure>
12797 !! wikitext
12798 [[File:Foobar.jpg|thumb]]
12799 !! end
12800
12801 !! test
12802 Parsoid-specific image handling - whitespace caption
12803 !! wikitext
12804 [[File:Foobar.jpg|thumb| ]]
12805 !! html/parsoid
12806 <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>
12807 !! end
12808
12809 !! test
12810 Parsoid-specific image handling - lang option
12811 !! wikitext
12812 foo
12813 [[File:Foobar.svg|lang=de|caption]]
12814 bar
12815 !! html/parsoid
12816 <p>foo
12817 <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>
12818 bar</p>
12819 !! end
12820
12821
12822 ###
12823 ### Subpages
12824 ###
12825 !! article
12826 Subpage test/subpage
12827 !! text
12828 foo
12829 !! endarticle
12830
12831 !! test
12832 Subpage link
12833 !! options
12834 subpage title=[[Subpage test]]
12835 !! wikitext
12836 [[/subpage]]
12837 !! html
12838 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12839 </p>
12840 !! end
12841
12842 !! test
12843 Subpage noslash link
12844 !! options
12845 subpage title=[[Subpage test]]
12846 !! wikitext
12847 [[/subpage/]]
12848 !! html
12849 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12850 </p>
12851 !! end
12852
12853 !! article
12854 Subpage test/1/2/subpage
12855 !! text
12856 blah
12857 !! endarticle
12858
12859 !! test
12860 Relative subpage noslash link
12861 !! options
12862 parsoid=wt2wt,wt2html,html2html
12863 subpage title=[[Subpage test/1/2/3/4]]
12864 !! wikitext
12865 [[../../subpage/]]
12866
12867 [[../../subpage]]
12868 !! html/php
12869 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12870 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12871 </p>
12872 !! html/parsoid
12873 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12874 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12875 !! end
12876
12877 !! test
12878 Parsoid: dot-slash prefixed wikilinks
12879 !! wikitext
12880 [[./foo]]
12881
12882 [[././bar]]
12883
12884 [[././baz/]]
12885 !! html/php
12886 <p>[[./foo]]
12887 </p><p>[[././bar]]
12888 </p><p>[[././baz/]]
12889 </p>
12890 !! html/parsoid
12891 <p>[[./foo]]
12892 </p><p>[[././bar]]
12893 </p><p>[[././baz/]]
12894 </p>
12895 !! end
12896
12897 !! test
12898 Render invalid page names as plain text (bug 51090)
12899 !! wikitext
12900 [[./../foo|bar]]
12901 [[foo�|bar]]
12902 [[foo/.|bar]]
12903 [[foo/..|bar]]
12904 [[foo~~~bar]]
12905 [[foo>bar]]
12906 [[foo[bar]]
12907 [[.]]
12908 [[..]]
12909 [[foo././bar]]
12910
12911 [[{{echo|./../foo}}|bar]]
12912 [[{{echo|foo/.}}|bar]]
12913 [[{{echo|foo/..}}|bar]]
12914 [[{{echo|foo~~~~bar}}]]
12915 [[{{echo|foo>bar}}]]
12916 [[{{echo|foo././bar}}]]
12917 [[{{echo|foo{bar}}]]
12918 [[{{echo|foo}bar}}]]
12919 [[{{echo|foo[bar}}]]
12920 [[{{echo|foo]bar}}]]
12921 [[{{echo|foo<bar}}]]
12922 !!html/php
12923 <p>[[./../foo|bar]]
12924 [[foo�|bar]]
12925 [[foo/.|bar]]
12926 [[foo/..|bar]]
12927 [[foo~~~bar]]
12928 [[foo&gt;bar]]
12929 [[foo[bar]]
12930 [[.]]
12931 [[..]]
12932 [[foo././bar]]
12933 </p><p>[[./../foo|bar]]
12934 [[foo/.|bar]]
12935 [[foo/..|bar]]
12936 [[foo~~~~bar]]
12937 [[foo&gt;bar]]
12938 [[foo././bar]]
12939 [[foo{bar]]
12940 [[foo}bar]]
12941 [[foo[bar]]
12942 [[foo]bar]]
12943 [[foo&lt;bar]]
12944 </p>
12945 !!html/parsoid
12946 <p>[[./../foo|bar]]
12947 [[foo�|bar]]
12948 [[foo/.|bar]]
12949 [[foo/..|bar]]
12950 [[foo~~~bar]]
12951 [[foo>bar]]
12952 [[foo[bar]]
12953 [[.]]
12954 [[..]]
12955 [[foo././bar]]</p>
12956
12957 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12958 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12959 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12960 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12961 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12962 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12963 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12964 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12965 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12966 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12967 [[<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>
12968 !!end
12969
12970 !! test
12971 Disabled subpages
12972 !! wikitext
12973 [[/subpage]]
12974 !! html
12975 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12976 </p>
12977 !! end
12978
12979 !! test
12980 BUG 561: {{/Subpage}}
12981 !! options
12982 subpage title=[[Page]]
12983 !! wikitext
12984 {{/Subpage}}
12985 !! html
12986 <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>
12987 </p>
12988 !! end
12989
12990 ###
12991 ### Categories
12992 ###
12993 !! article
12994 Category:MediaWiki User's Guide
12995 !! text
12996 blah
12997 !! endarticle
12998
12999 !! test
13000 Link to category
13001 !! wikitext
13002 [[:Category:MediaWiki User's Guide]]
13003 !! html
13004 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13005 </p>
13006 !! end
13007
13008 !! test
13009 Simple category
13010 !! options
13011 cat
13012 !! wikitext
13013 [[Category: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 PAGESINCATEGORY invalid title fatal (r33546 fix)
13020 !! wikitext
13021 {{PAGESINCATEGORY:<bogus>}}
13022 !! html
13023 <p>0
13024 </p>
13025 !! end
13026
13027 !! test
13028 Category with different sort key
13029 !! options
13030 cat
13031 !! wikitext
13032 [[Category:MediaWiki User's Guide|Foo]]
13033 !! html
13034 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13035 !! end
13036
13037 !! test
13038 Category with identical sort key
13039 !! options
13040 cat
13041 !! wikitext
13042 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13043 !! html
13044 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13045 !! end
13046
13047 !! test
13048 Category with empty sort key
13049 !! options
13050 cat
13051 pst
13052 !! wikitext
13053 [[Category:MediaWiki User's Guide|]]
13054 !! html
13055 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13056 !! end
13057
13058 !! test
13059 Category with empty sort key and parentheses
13060 !! options
13061 cat
13062 pst
13063 !! wikitext
13064 [[Category:Foo (bar)|]]
13065 !! html
13066 [[Category:Foo (bar)|Foo]]
13067 !! end
13068
13069 !! test
13070 Category with link tail
13071 !! options
13072 cat
13073 pst
13074 !! wikitext
13075 123[[Category:Foo]]456
13076 !! html
13077 123[[Category:Foo]]456
13078 !! end
13079
13080 !! test
13081 Category with template
13082 !! options
13083 cat
13084 pst
13085 !! wikitext
13086 [[Category:{{echo|Foo}}]]
13087 !! html
13088 [[Category:{{echo|Foo}}]]
13089 !! end
13090
13091 !! test
13092 Category with template in sort key
13093 !! options
13094 cat
13095 pst
13096 !! wikitext
13097 [[Category:Foo|{{echo|Bar}}]]
13098 !! html
13099 [[Category:Foo|{{echo|Bar}}]]
13100 !! end
13101
13102 !! test
13103 Category with template in sort key and title
13104 !! options
13105 cat
13106 pst
13107 !! wikitext
13108 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13109 !! html
13110 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13111 !! end
13112
13113 !! test
13114 Category / paragraph interactions
13115 !! wikitext
13116 Foo [[Category:Baz]] Bar
13117
13118 Foo [[Category:Baz]]
13119 Bar
13120
13121 Foo
13122 [[Category:Baz]]
13123 Bar
13124
13125 Foo
13126 [[Category:Baz]] Bar
13127
13128 Foo
13129 [[Category:Baz]]
13130 [[Category:Baz]]
13131 [[Category:Baz]]
13132 Bar
13133
13134 [[Category:Baz]]
13135 [[Category:Baz]]
13136 [[Category:Baz]]
13137
13138 [[Category:Baz]]
13139 {{echo|[[Category:Baz]]}}
13140 [[Category:Baz]]
13141 !! html
13142 <p>Foo Bar
13143 </p><p>Foo
13144 Bar
13145 </p><p>Foo
13146 Bar
13147 </p><p>Foo Bar
13148 </p><p>Foo
13149 Bar
13150 </p>
13151 !! end
13152
13153 !! test
13154 Parsoid: Serialize link to category page with colon escape
13155 !! options
13156 parsoid
13157 !! wikitext
13158
13159 [[:Category:Foo]]
13160 [[:Category:Foo|Bar]]
13161 !! html
13162 <p>
13163 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13164 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13165 </p>
13166 !! end
13167
13168 !! test
13169 Parsoid: Link prefix/suffixes aren't applied to category links
13170 !! options
13171 parsoid=wt2html,wt2wt,html2html
13172 language=is
13173 !! wikitext
13174 x[[Category:Foo]]y
13175 !! html
13176 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13177 !! end
13178
13179 !! test
13180 Parsoid: Serialize link to file page with colon escape
13181 !! options
13182 parsoid
13183 !! wikitext
13184
13185 [[:File:Foo.png]]
13186 [[:File:Foo.png|Bar]]
13187 !! html
13188 <p>
13189 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13190 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13191 </p>
13192 !! end
13193
13194 !! test
13195 Parsoid: Serialize a genuine category link without colon escape
13196 !! options
13197 parsoid
13198 !! wikitext
13199 [[Category:Foo]]
13200 [[Category:Foo|Bar]]
13201 !! html
13202 <link rel="mw:PageProp/Category" href="Category:Foo">
13203 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13204 !! end
13205
13206 !! test
13207 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13208 !! options
13209 parsoid=html2wt
13210 !! html
13211 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13212 !! wikitext
13213 [[Category:Toxine bactérienne]]
13214 !! end
13215
13216 !! test
13217 Parsoid: Defaultsort
13218 !! wikitext
13219 {{DEFAULTSORT:Foo}}
13220 !! html/parsoid
13221 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13222 !! end
13223
13224 !! test
13225 Parsoid: Defaultsort (template-generated)
13226 !! wikitext
13227 {{{{echo|DEFAULTSORT}}:Foo}}
13228 !! html/parsoid
13229 <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}}]}'/>
13230 !! end
13231
13232 ###
13233 ### Inter-language links
13234 ###
13235 !! test
13236 Interlanguage links
13237 !! options
13238 ill
13239 !! wikitext
13240 [[es:Alimento]]
13241 [[fr:Nourriture]]
13242 [[zh:食品]]
13243 !! html/php
13244 es:Alimento fr:Nourriture zh:食品
13245 !! html/parsoid
13246 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13247 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13248 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13249 !! end
13250
13251 !! test
13252 Duplicate interlanguage links (bug 24502)
13253 !! options
13254 ill
13255 !! wikitext
13256 [[es:1]]
13257 [[es:2]]
13258 [[fr:1]]
13259 [[fr:2]]
13260 !! html/php
13261 es:1 fr:1
13262 !! html/parsoid
13263 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13264 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13265 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13266 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13267 !! end
13268
13269 ###
13270 ### Sections
13271 ###
13272 !! test
13273 Basic section headings
13274 !! wikitext
13275 == Headline 1 ==
13276 Some text
13277
13278 ==Headline 2==
13279 More
13280 ===Smaller headline===
13281 Blah blah
13282 !! html
13283 <h2><a href="#Headline_1" class="mw-headline-anchor" aria-hidden="true" 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>
13284 <p>Some text
13285 </p>
13286 <h2><a href="#Headline_2" class="mw-headline-anchor" aria-hidden="true" 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>
13287 <p>More
13288 </p>
13289 <h3><a href="#Smaller_headline" class="mw-headline-anchor" aria-hidden="true" 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>
13290 <p>Blah blah
13291 </p>
13292 !! end
13293
13294 !! test
13295 Section headings with TOC
13296 !! wikitext
13297 == Headline 1 ==
13298 === Subheadline 1 ===
13299 ===== Skipping a level =====
13300 ====== Skipping a level ======
13301
13302 == Headline 2 ==
13303 Some text
13304 ===Another headline===
13305 !! html
13306 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13307 <ul>
13308 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13309 <ul>
13310 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13311 <ul>
13312 <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>
13313 <ul>
13314 <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>
13315 </ul>
13316 </li>
13317 </ul>
13318 </li>
13319 </ul>
13320 </li>
13321 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13322 <ul>
13323 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13324 </ul>
13325 </li>
13326 </ul>
13327 </div>
13328
13329 <h2><a href="#Headline_1" class="mw-headline-anchor" aria-hidden="true" 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>
13330 <h3><a href="#Subheadline_1" class="mw-headline-anchor" aria-hidden="true" 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>
13331 <h5><a href="#Skipping_a_level" class="mw-headline-anchor" aria-hidden="true" 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>
13332 <h6><a href="#Skipping_a_level_2" class="mw-headline-anchor" aria-hidden="true" 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>
13333 <h2><a href="#Headline_2" class="mw-headline-anchor" aria-hidden="true" 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>
13334 <p>Some text
13335 </p>
13336 <h3><a href="#Another_headline" class="mw-headline-anchor" aria-hidden="true" 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>
13337
13338 !! end
13339
13340 !! test
13341 TOC anchors don't collide
13342 !! wikitext
13343 __FORCETOC__
13344 == Headline 2 ==
13345 == Headline ==
13346 == Headline 2 ==
13347 == Headline ==
13348 !! html
13349 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13350 <ul>
13351 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13352 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13353 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13354 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13355 </ul>
13356 </div>
13357
13358 <h2><a href="#Headline_2" class="mw-headline-anchor" aria-hidden="true" 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>
13359 <h2><a href="#Headline" class="mw-headline-anchor" aria-hidden="true" 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>
13360 <h2><a href="#Headline_2_2" class="mw-headline-anchor" aria-hidden="true" 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>
13361 <h2><a href="#Headline_3" class="mw-headline-anchor" aria-hidden="true" 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>
13362
13363 !! end
13364
13365 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13366 !! test
13367 Handling of sections up to level 6 and beyond
13368 !! wikitext
13369 = Level 1 Heading=
13370 == Level 2 Heading==
13371 === Level 3 Heading===
13372 ==== Level 4 Heading====
13373 ===== Level 5 Heading=====
13374 ====== Level 6 Heading======
13375 ======= Level 7 Heading=======
13376 ======== Level 8 Heading========
13377 ========= Level 9 Heading=========
13378 ========== Level 10 Heading==========
13379 !! html
13380 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13381 <ul>
13382 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13383 <ul>
13384 <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>
13385 <ul>
13386 <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>
13387 <ul>
13388 <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>
13389 <ul>
13390 <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>
13391 <ul>
13392 <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>
13393 <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>
13394 <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>
13395 <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>
13396 <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>
13397 </ul>
13398 </li>
13399 </ul>
13400 </li>
13401 </ul>
13402 </li>
13403 </ul>
13404 </li>
13405 </ul>
13406 </li>
13407 </ul>
13408 </div>
13409
13410 <h1><a href="#Level_1_Heading" class="mw-headline-anchor" aria-hidden="true" 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>
13411 <h2><a href="#Level_2_Heading" class="mw-headline-anchor" aria-hidden="true" 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>
13412 <h3><a href="#Level_3_Heading" class="mw-headline-anchor" aria-hidden="true" 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>
13413 <h4><a href="#Level_4_Heading" class="mw-headline-anchor" aria-hidden="true" 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>
13414 <h5><a href="#Level_5_Heading" class="mw-headline-anchor" aria-hidden="true" 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>
13415 <h6><a href="#Level_6_Heading" class="mw-headline-anchor" aria-hidden="true" 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>
13416 <h6><a href="#.3D_Level_7_Heading.3D" class="mw-headline-anchor" aria-hidden="true" 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>
13417 <h6><a href="#.3D.3D_Level_8_Heading.3D.3D" class="mw-headline-anchor" aria-hidden="true" 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>
13418 <h6><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D" class="mw-headline-anchor" aria-hidden="true" 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>
13419 <h6><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" class="mw-headline-anchor" aria-hidden="true" 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>
13420
13421 !! end
13422
13423 !! test
13424 TOC regression (T11764)
13425 !! wikitext
13426 == title 1 ==
13427 === title 1.1 ===
13428 ==== title 1.1.1 ====
13429 === title 1.2 ===
13430 == title 2 ==
13431 === title 2.1 ===
13432 !! html
13433 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13434 <ul>
13435 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13436 <ul>
13437 <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>
13438 <ul>
13439 <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>
13440 </ul>
13441 </li>
13442 <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>
13443 </ul>
13444 </li>
13445 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13446 <ul>
13447 <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>
13448 </ul>
13449 </li>
13450 </ul>
13451 </div>
13452
13453 <h2><a href="#title_1" class="mw-headline-anchor" aria-hidden="true" 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>
13454 <h3><a href="#title_1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13455 <h4><a href="#title_1.1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13456 <h3><a href="#title_1.2" class="mw-headline-anchor" aria-hidden="true" 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>
13457 <h2><a href="#title_2" class="mw-headline-anchor" aria-hidden="true" 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>
13458 <h3><a href="#title_2.1" class="mw-headline-anchor" aria-hidden="true" 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>
13459
13460 !! end
13461
13462 !! test
13463 TOC with wgMaxTocLevel=3 (bug 6204)
13464 !! options
13465 wgMaxTocLevel=3
13466 !! wikitext
13467 == title 1 ==
13468 === title 1.1 ===
13469 ==== title 1.1.1 ====
13470 === title 1.2 ===
13471 == title 2 ==
13472 === title 2.1 ===
13473 !! html
13474 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13475 <ul>
13476 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13477 <ul>
13478 <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>
13479 <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>
13480 </ul>
13481 </li>
13482 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13483 <ul>
13484 <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>
13485 </ul>
13486 </li>
13487 </ul>
13488 </div>
13489
13490 <h2><a href="#title_1" class="mw-headline-anchor" aria-hidden="true" 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>
13491 <h3><a href="#title_1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13492 <h4><a href="#title_1.1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13493 <h3><a href="#title_1.2" class="mw-headline-anchor" aria-hidden="true" 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>
13494 <h2><a href="#title_2" class="mw-headline-anchor" aria-hidden="true" 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>
13495 <h3><a href="#title_2.1" class="mw-headline-anchor" aria-hidden="true" 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>
13496
13497 !! end
13498
13499 !! test
13500 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13501 !! options
13502 wgMaxTocLevel=3
13503 !! wikitext
13504 ==Section 1==
13505 ===Section 1.1===
13506 ====Section 1.1.1====
13507 ====Section 1.1.1.1====
13508 ==Section 2==
13509 !! html
13510 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13511 <ul>
13512 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13513 <ul>
13514 <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>
13515 </ul>
13516 </li>
13517 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13518 </ul>
13519 </div>
13520
13521 <h2><a href="#Section_1" class="mw-headline-anchor" aria-hidden="true" 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>
13522 <h3><a href="#Section_1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13523 <h4><a href="#Section_1.1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13524 <h4><a href="#Section_1.1.1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13525 <h2><a href="#Section_2" class="mw-headline-anchor" aria-hidden="true" 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>
13526
13527 !! end
13528
13529
13530 !! test
13531 Resolving duplicate section names
13532 !! wikitext
13533 == Foo bar ==
13534 == Foo bar ==
13535 !! html
13536 <h2><a href="#Foo_bar" class="mw-headline-anchor" aria-hidden="true" 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>
13537 <h2><a href="#Foo_bar_2" class="mw-headline-anchor" aria-hidden="true" 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>
13538
13539 !! end
13540
13541 !! test
13542 Resolving duplicate section names with differing case (bug 10721)
13543 !! wikitext
13544 == Foo bar ==
13545 == Foo Bar ==
13546 !! html
13547 <h2><a href="#Foo_bar" class="mw-headline-anchor" aria-hidden="true" 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>
13548 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" aria-hidden="true" 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>
13549
13550 !! end
13551
13552 !! article
13553 Template:sections
13554 !! text
13555 ===Section 1===
13556 ==Section 2==
13557 !! endarticle
13558
13559 !! test
13560 Template with sections, __NOTOC__
13561 !! wikitext
13562 __NOTOC__
13563 ==Section 0==
13564 {{sections}}
13565 ==Section 4==
13566 !! html
13567 <h2><a href="#Section_0" class="mw-headline-anchor" aria-hidden="true" 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>
13568 <h3><a href="#Section_1" class="mw-headline-anchor" aria-hidden="true" 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>
13569 <h2><a href="#Section_2" class="mw-headline-anchor" aria-hidden="true" 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>
13570 <h2><a href="#Section_4" class="mw-headline-anchor" aria-hidden="true" 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>
13571
13572 !! end
13573
13574 !! test
13575 __NOEDITSECTION__ keyword
13576 !! wikitext
13577 __NOEDITSECTION__
13578 ==Section 1==
13579 ==Section 2==
13580 !! html
13581 <h2><a href="#Section_1" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Section_1">Section 1</span></h2>
13582 <h2><a href="#Section_2" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Section_2">Section 2</span></h2>
13583
13584 !! end
13585
13586 !! test
13587 Link inside a section heading
13588 !! wikitext
13589 ==Section with a [[Main Page|link]] in it==
13590 !! html
13591 <h2><a href="#Section_with_a_link_in_it" class="mw-headline-anchor" aria-hidden="true" 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>
13592
13593 !! end
13594
13595 !! test
13596 TOC regression (T14077)
13597 !! wikitext
13598 __TOC__
13599 == title 1 ==
13600 === title 1.1 ===
13601 == title 2 ==
13602 !! html
13603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13604 <ul>
13605 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13606 <ul>
13607 <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>
13608 </ul>
13609 </li>
13610 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13611 </ul>
13612 </div>
13613
13614 <h2><a href="#title_1" class="mw-headline-anchor" aria-hidden="true" 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>
13615 <h3><a href="#title_1.1" class="mw-headline-anchor" aria-hidden="true" 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>
13616 <h2><a href="#title_2" class="mw-headline-anchor" aria-hidden="true" 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>
13617
13618 !! end
13619
13620 !! test
13621 BUG 1219 URL next to image (good)
13622 !! wikitext
13623 http://example.com [[File:Foobar.jpg]]
13624 !! html/php
13625 <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>
13626 </p>
13627 !! html/parsoid
13628 <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>
13629 !!end
13630
13631 !! test
13632 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13633 !! wikitext
13634 ===
13635 The line above must have a trailing space!
13636 === <!--
13637 --> <!-- -->
13638 But just in case it doesn't...
13639 !! html
13640 <h1><a href="#.3D" class="mw-headline-anchor" aria-hidden="true" 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>
13641 <p>The line above must have a trailing space!
13642 </p>
13643 <h1><a href="#.3D_2" class="mw-headline-anchor" aria-hidden="true" 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>
13644 <p>But just in case it doesn't...
13645 </p>
13646 !! end
13647
13648 !! test
13649 Header with special characters (bug 25462)
13650 !! wikitext
13651 The tooltips shall not show entities to the user (ie. be double escaped)
13652
13653 == text > text ==
13654 section 1
13655
13656 == text < text ==
13657 section 2
13658
13659 == text & text ==
13660 section 3
13661
13662 == text ' text ==
13663 section 4
13664
13665 == text " text ==
13666 section 5
13667 !! html
13668 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13669 </p>
13670 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13671 <ul>
13672 <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>
13673 <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>
13674 <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>
13675 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13676 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13677 </ul>
13678 </div>
13679
13680 <h2><a href="#text_.3E_text" class="mw-headline-anchor" aria-hidden="true" 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>
13681 <p>section 1
13682 </p>
13683 <h2><a href="#text_.3C_text" class="mw-headline-anchor" aria-hidden="true" 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>
13684 <p>section 2
13685 </p>
13686 <h2><a href="#text_.26_text" class="mw-headline-anchor" aria-hidden="true" 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>
13687 <p>section 3
13688 </p>
13689 <h2><a href="#text_.27_text" class="mw-headline-anchor" aria-hidden="true" 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>
13690 <p>section 4
13691 </p>
13692 <h2><a href="#text_.22_text" class="mw-headline-anchor" aria-hidden="true" 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>
13693 <p>section 5
13694 </p>
13695 !! end
13696
13697 !! test
13698 Header with space, plus and underscore as entity
13699 !! wikitext
13700 Id should not contain + for spaces
13701
13702 == Space between Text ==
13703 section 1
13704
13705 == Space-Entity&#32;between&#32;Text ==
13706 section 2
13707
13708 == Plus+between+Text ==
13709 section 3
13710
13711 == Plus-Entity&#43;between&#43;Text ==
13712 section 4
13713
13714 == Underscore_between_Text ==
13715 section 5
13716
13717 == Underscore-Entity&#95;between&#95;Text ==
13718 section 6
13719
13720 [[#Space between Text]]
13721 [[#Space-Entity&#32;between&#32;Text]]
13722 [[#Plus+between+Text]]
13723 [[#Plus-Entity&#43;between&#43;Text]]
13724 [[#Underscore_between_Text]]
13725 [[#Underscore-Entity&#95;between&#95;Text]]
13726 !! html
13727 <p>Id should not contain + for spaces
13728 </p>
13729 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13730 <ul>
13731 <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>
13732 <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>
13733 <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>
13734 <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>
13735 <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>
13736 <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>
13737 </ul>
13738 </div>
13739
13740 <h2><a href="#Space_between_Text" class="mw-headline-anchor" aria-hidden="true" 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>
13741 <p>section 1
13742 </p>
13743 <h2><a href="#Space-Entity_between_Text" class="mw-headline-anchor" aria-hidden="true" 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>
13744 <p>section 2
13745 </p>
13746 <h2><a href="#Plus.2Bbetween.2BText" class="mw-headline-anchor" aria-hidden="true" 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>
13747 <p>section 3
13748 </p>
13749 <h2><a href="#Plus-Entity.2Bbetween.2BText" class="mw-headline-anchor" aria-hidden="true" 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>
13750 <p>section 4
13751 </p>
13752 <h2><a href="#Underscore_between_Text" class="mw-headline-anchor" aria-hidden="true" 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>
13753 <p>section 5
13754 </p>
13755 <h2><a href="#Underscore-Entity_between_Text" class="mw-headline-anchor" aria-hidden="true" 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>
13756 <p>section 6
13757 </p><p><a href="#Space_between_Text">#Space between Text</a>
13758 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13759 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13760 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13761 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13762 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13763 </p>
13764 !! end
13765
13766 !! test
13767 Headers with excess '=' characters
13768 (Are similar tests necessary beyond the 1st level?)
13769 !! wikitext
13770 =foo==
13771 ==foo=
13772 =''italic'' heading==
13773 ==''italic'' heading=
13774 !! html
13775 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13776 <ul>
13777 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13778 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13779 <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>
13780 <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>
13781 </ul>
13782 </div>
13783
13784 <h1><a href="#foo.3D" class="mw-headline-anchor" aria-hidden="true" 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>
13785 <h1><a href="#.3Dfoo" class="mw-headline-anchor" aria-hidden="true" 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>
13786 <h1><a href="#italic_heading.3D" class="mw-headline-anchor" aria-hidden="true" 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>
13787 <h1><a href="#.3Ditalic_heading" class="mw-headline-anchor" aria-hidden="true" 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>
13788
13789 !! end
13790
13791 !! test
13792 HTML headers vs TOC (bug 23393)
13793 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13794 !! wikitext
13795 <h1>Header 1</h1>
13796 == Header 1.1 ==
13797 == Header 1.2 ==
13798
13799 <h1>Header 2
13800 </h1>
13801 == Header 2.1 ==
13802 == Header 2.2 ==
13803 __NOEDITSECTION__
13804 !! html
13805 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13806 <ul>
13807 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13808 <ul>
13809 <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>
13810 <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>
13811 </ul>
13812 </li>
13813 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13814 <ul>
13815 <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>
13816 <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>
13817 </ul>
13818 </li>
13819 </ul>
13820 </div>
13821
13822 <h1><a href="#Header_1" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Header_1">Header 1</span></h1>
13823 <h2><a href="#Header_1.1" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13824 <h2><a href="#Header_1.2" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13825 <h1><a href="#Header_2" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Header_2">Header 2</span></h1>
13826 <h2><a href="#Header_2.1" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13827 <h2><a href="#Header_2.2" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13828
13829 !! end
13830
13831 !! test
13832 Single-line or multiline-comments can follow headings
13833 !! options
13834 parsoid=wt2html,wt2wt
13835 !! wikitext
13836 ==foo==<!---->
13837 ==bar==<!--c1-->
13838 ==baz==<!--
13839 c2
13840 c3-->
13841 !! html
13842 <h2><a href="#foo" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="foo">foo</span></h2>
13843 <h2><a href="#bar" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="bar">bar</span></h2>
13844 <h2><a href="#baz" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="baz">baz</span></h2>
13845
13846 !! end
13847
13848 !! test
13849 BUG 1219 URL next to image (broken)
13850 !! wikitext
13851 http://example.com[[File:Foobar.jpg]]
13852 !! html/php
13853 <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>
13854 </p>
13855 !! html/parsoid
13856 <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>
13857 !!end
13858
13859 !! test
13860 Bug 1186 news: in the middle of text
13861 !! wikitext
13862 http://en.wikinews.org/wiki/Wikinews:Workplace
13863 !! html
13864 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13865 </p>
13866 !!end
13867
13868
13869 !! test
13870 Namespaced link must have a title
13871 !! wikitext
13872 [[Project:]]
13873 !! html
13874 <p>[[Project:]]
13875 </p>
13876 !!end
13877
13878 !! test
13879 Namespaced link must have a title (bad fragment version)
13880 !! wikitext
13881 [[Project:#fragment]]
13882 !! html
13883 <p>[[Project:#fragment]]
13884 </p>
13885 !!end
13886
13887
13888 ###
13889 ### HTML tags and HTML attributes
13890 ###
13891
13892 !! test
13893 div with no attributes
13894 !! wikitext
13895 <div>HTML rocks</div>
13896 !! html
13897 <div>HTML rocks</div>
13898
13899 !! end
13900
13901 !! test
13902 div with double-quoted attribute
13903 !! wikitext
13904 <div id="rock">HTML rocks</div>
13905 !! html
13906 <div id="rock">HTML rocks</div>
13907
13908 !! end
13909
13910 !! test
13911 div with single-quoted attribute
13912 !! wikitext
13913 <div id='rock'>HTML rocks</div>
13914 !! html
13915 <div id="rock">HTML rocks</div>
13916
13917 !! end
13918
13919 !! test
13920 div with unquoted attribute
13921 !! wikitext
13922 <div id=rock>HTML rocks</div>
13923 !! html
13924 <div id="rock">HTML rocks</div>
13925
13926 !! end
13927
13928 !! test
13929 div with illegal double attributes
13930 !! wikitext
13931 <div id="a" id="b">HTML rocks</div>
13932 !! html
13933 <div id="b">HTML rocks</div>
13934
13935 !!end
13936
13937 # FIXME: produce empty string instead of "class" in the PHP parser, following
13938 # the HTML5 spec.
13939 !! test
13940 div with empty attribute value, space before equals
13941 !! options
13942 parsoid
13943 !! wikitext
13944 <div class =>HTML rocks</div>
13945 !! html
13946 <div class="">HTML rocks</div>
13947
13948 !! end
13949
13950 !! test
13951 div with multiple empty attribute values
13952 !! options
13953 parsoid
13954 !! wikitext
13955 <div id= title=>HTML rocks</div>
13956 !! html
13957 <div id="" title="">HTML rocks</div>
13958
13959 !! end
13960
13961 !! test
13962 table with multiple empty attribute values
13963 !! options
13964 parsoid
13965 !! wikitext
13966 {| title= id=
13967 | hi
13968 |}
13969 !! html
13970 <table title="" id="">
13971 <tbody><tr><td> hi</td></tr>
13972 </tbody></table>
13973 !! end
13974
13975 !! test
13976 div with braces in attribute value
13977 !! wikitext
13978 <div title="{}">Foo</div>
13979 !! html/php
13980 <div title="&#123;}">Foo</div>
13981
13982 !! html/parsoid
13983 <div title="{}">Foo</div>
13984 !! end
13985
13986 # This it very inconsistent in the PHP parser: it returns
13987 # class="class" if there is a space between the name and the equal sign (see
13988 # 'div with empty attribute value, space before equals'), but strips the
13989 # attribute completely if the space is missing. We hope that not much content
13990 # depends on this, so are implementing the behavior below in Parsoid for
13991 # consistencies' sake.
13992 # FIXME: fix this behavior in the PHP parser?
13993 !! test
13994 div with empty attribute value, no space before equals
13995 !! options
13996 parsoid=wt2html,html2html
13997 !! wikitext
13998 <div class=>HTML rocks</div>
13999 !! html/php
14000 <div>HTML rocks</div>
14001
14002 !! html/parsoid
14003 <div class="">HTML rocks</div>
14004 !! end
14005
14006 !! test
14007 HTML multiple attributes correction
14008 !! wikitext
14009 <p class="error" class="awesome">Awesome!</p>
14010 !! html
14011 <p class="awesome">Awesome!</p>
14012
14013 !!end
14014
14015 !! test
14016 Table multiple attributes correction
14017 !! wikitext
14018 {|
14019 !+ class="error" class="awesome"| status
14020 |}
14021 !! html
14022 <table>
14023 <tr>
14024 <th class="awesome"> status
14025 </th></tr></table>
14026
14027 !!end
14028
14029 !! test
14030 DIV IN UPPERCASE
14031 !! wikitext
14032 <DIV ID="x">HTML ROCKS</DIV>
14033 !! html
14034 <div id="x">HTML ROCKS</div>
14035
14036 !!end
14037
14038 !! test
14039 Non-ASCII pseudo-tags are rendered as text
14040 !! wikitext
14041 <khyô>
14042 !! html
14043 <p>&lt;khyô&gt;
14044 </p>
14045 !! end
14046
14047 !! test
14048 Pseudo-tag with URL 'name' renders as url link
14049 !! wikitext
14050 <http://example.com/>
14051 !! html
14052 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14053 </p>
14054 !! end
14055
14056 !! test
14057 text with amp in the middle of nowhere
14058 !! wikitext
14059 Remember AT&T?
14060 !! html
14061 <p>Remember AT&amp;T?
14062 </p>
14063 !! end
14064
14065 !! test
14066 text with character entity: eacute
14067 !! wikitext
14068 I always thought &eacute; was a cute letter.
14069 !! html
14070 <p>I always thought &#233; was a cute letter.
14071 </p>
14072 !! html+tidy
14073 <p>I always thought é was a cute letter.</p>
14074 !! end
14075
14076 !! test
14077 text with entity-escaped character entity-like string: eacute
14078 !! wikitext
14079 I always thought &amp;eacute; was a cute letter.
14080 !! html
14081 <p>I always thought &amp;eacute; was a cute letter.
14082 </p>
14083 !! end
14084
14085 !! test
14086 text with undefined character entity: xacute
14087 !! wikitext
14088 I always thought &xacute; was a cute letter.
14089 !! html
14090 <p>I always thought &amp;xacute; was a cute letter.
14091 </p>
14092 !! end
14093
14094 # TODO: generalize to PHP parser?
14095 !! test
14096 HTML5 tags
14097 !! options
14098 parsoid
14099 !! wikitext
14100 <data value="5">five</data>
14101 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14102 <mark>This highlighted text</mark>
14103 !! html
14104 <p><data value="5">five</data>
14105 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14106 <mark>This highlighted text</mark></p>
14107 !! end
14108
14109 !! test
14110 HTML tag with leading space is parsed as text
14111 !! wikitext
14112 < div>foo< /div>
14113 !! html
14114 <p>&lt; div&gt;foo&lt; /div&gt;
14115 </p>
14116 !! end
14117
14118 ###
14119 ### Nesting tests (see bug 41545, 50604, 51081)
14120 ###
14121
14122 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14123 # Note that html2wt is considerably more difficult if we use <b> in
14124 # the test case, instead of <big>
14125 !! test
14126 Ensure that HTML adoption agency algorithm is properly implemented.
14127 !! wikitext
14128 <big>X<big>Y</big>Z</big>
14129 !! html
14130 <p><big>X<big>Y</big>Z</big>
14131 </p>
14132 !! end
14133
14134 # This was bug 41545 in the PHP parser.
14135 # Note that tidy doesn't handle this correctly.
14136 !! test
14137 Nesting of <kbd>
14138 !! wikitext
14139 <kbd>X<kbd>Y</kbd>Z</kbd>
14140 !! html
14141 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14142 </p>
14143 !! end
14144
14145 # The following cases were bug 51081 in the PHP parser.
14146 # Note that there are some other nestable tags (b, i, etc) which are
14147 # not covered; see bug 51081 for discussion.
14148
14149 # Note that tidy doesn't handle this correctly.
14150 !! test
14151 Nesting of <em>
14152 !! wikitext
14153 <em>X<em>Y</em>Z</em>
14154 !! html
14155 <p><em>X<em>Y</em>Z</em>
14156 </p>
14157 !! end
14158
14159 # Note that tidy doesn't handle this correctly.
14160 !! test
14161 Nesting of <strong>
14162 !! wikitext
14163 <strong>X<strong>Y</strong>Z</strong>
14164 !! html
14165 <p><strong>X<strong>Y</strong>Z</strong>
14166 </p>
14167 !! end
14168
14169 !! test
14170 Nesting of <q>
14171 !! wikitext
14172 <q>X<q>Y</q>Z</q>
14173 !! html+tidy
14174 <p><q>X<q>Y</q>Z</q></p>
14175 !! end
14176
14177 # Note that tidy doesn't handle this correctly.
14178 !! test
14179 Nesting of <ruby>
14180 !! wikitext
14181 <ruby>X<ruby>Y</ruby>Z</ruby>
14182 !! html
14183 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14184 </p>
14185 !! end
14186
14187 # Note that tidy doesn't handle this correctly.
14188 !! test
14189 Nesting of <bdo>
14190 !! wikitext
14191 <bdo>X<bdo>Y</bdo>Z</bdo>
14192 !! html
14193 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14194 </p>
14195 !! end
14196
14197
14198 ###
14199 ### Media links
14200 ###
14201
14202 !! test
14203 Media link
14204 !! wikitext
14205 [[Media:Foobar.jpg]]
14206 !! html
14207 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14208 </p>
14209 !! end
14210
14211 !! test
14212 Media link with text
14213 !! wikitext
14214 [[Media:Foobar.jpg|A neat file to look at]]
14215 !! html
14216 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14217 </p>
14218 !! end
14219
14220 # FIXME: this is still bad HTML tag nesting
14221 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
14222 !! test
14223 Media link with nasty text
14224 !! wikitext
14225 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14226 !! html
14227 <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>
14228
14229 !! html+tidy
14230 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
14231 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
14232 !! end
14233
14234 !! test
14235 Media link to nonexistent file (bug 1702)
14236 !! wikitext
14237 [[Media:No such.jpg]]
14238 !! html
14239 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14240 </p>
14241 !! end
14242
14243 !! test
14244 Image link to nonexistent file (bug 1850 - good)
14245 !! wikitext
14246 [[File:No_such.jpg]]
14247 !! html/php
14248 <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>
14249 </p>
14250 !! html/parsoid
14251 <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>
14252 !! end
14253
14254 !! test
14255 :Image link to nonexistent file (bug 1850 - bad)
14256 !! wikitext
14257 [[:Image:No such.jpg]]
14258 !! html/php
14259 <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>
14260 </p>
14261 !! html/parsoid
14262 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14263 !! end
14264
14265
14266
14267 !! test
14268 Character reference normalization in link text (bug 1938)
14269 !! wikitext
14270 [[Main Page|this&that]]
14271 !! html
14272 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14273 </p>
14274 !!end
14275
14276 !! article
14277 אַ
14278 !! text
14279 Test for unicode normalization
14280
14281 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14282 !! endarticle
14283
14284 !! test
14285 (bug 19451) Links should refer to the normalized form.
14286 !! wikitext
14287 [[&#xFB2E;]]
14288 [[&#x5d0;&#x5b7;]]
14289 [[&#x5d0;ַ]]
14290 [[א&#x5b7;]]
14291 [[אַ]]
14292 !! html
14293 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14294 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14295 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14296 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14297 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14298 </p>
14299 !! end
14300
14301 !! test
14302 Empty attribute crash test (bug 2067)
14303 !! wikitext
14304 <font color="">foo</font>
14305 !! html
14306 <p><font color="">foo</font>
14307 </p>
14308 !! end
14309
14310 !! test
14311 Empty attribute crash test single-quotes (bug 2067)
14312 !! wikitext
14313 <font color=''>foo</font>
14314 !! html
14315 <p><font color="">foo</font>
14316 </p>
14317 !! end
14318
14319 !! test
14320 Attribute test: equals, then nothing
14321 !! wikitext
14322 <font color=>foo</font>
14323 !! html
14324 <p><font>foo</font>
14325 </p>
14326 !! end
14327
14328 !! test
14329 Attribute test: unquoted value
14330 !! wikitext
14331 <font color=x>foo</font>
14332 !! html
14333 <p><font color="x">foo</font>
14334 </p>
14335 !! end
14336
14337 !! test
14338 Attribute test: unquoted but illegal value (hash)
14339 !! wikitext
14340 <font color=#x>foo</font>
14341 !! html
14342 <p><font color="#x">foo</font>
14343 </p>
14344 !! end
14345
14346 !! test
14347 Attribute test: no value
14348 !! wikitext
14349 <font color>foo</font>
14350 !! html
14351 <p><font color="color">foo</font>
14352 </p>
14353 !! end
14354
14355 !! test
14356 Bug 2095: link with three closing brackets
14357 !! wikitext
14358 [[Main Page]]]
14359 !! html/php
14360 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14361 </p>
14362 !! html/parsoid
14363 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14364 !! end
14365
14366 !! test
14367 Bug 2095: link with pipe and three closing brackets
14368 !! wikitext
14369 [[Main Page|link]]]
14370 !! html/php
14371 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14372 </p>
14373 !! html/parsoid
14374 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14375 !! end
14376
14377 !! test
14378 Bug 2095: link with pipe and three closing brackets, version 2
14379 !! wikitext
14380 [[Main Page|[http://example.com/]]]
14381 !! html/php
14382 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14383 </p>
14384 !! html/parsoid
14385 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14386 !! end
14387
14388
14389 ###
14390 ### Safety
14391 ###
14392
14393 !! article
14394 Template:Dangerous attribute
14395 !! text
14396 " onmouseover="alert(document.cookie)
14397 !! endarticle
14398
14399 !! article
14400 Template:Dangerous style attribute
14401 !! text
14402 border-size: expression(alert(document.cookie))
14403 !! endarticle
14404
14405 !! article
14406 Template:Div style
14407 !! text
14408 <div style="float: right; {{{1}}}">Magic div</div>
14409 !! endarticle
14410
14411 !! test
14412 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14413 !! wikitext
14414 <div title="{{test}}"></div>
14415 !! html
14416 <div title="This is a test template"></div>
14417
14418 !! end
14419
14420 # Parsoid has enough context to handle this case
14421 !! test
14422 Bug 2304: HTML attribute safety (dangerous template; 2309)
14423 !! wikitext
14424 <div title="{{dangerous attribute}}"></div>
14425 !! html/php
14426 <div title=""></div>
14427
14428 !! html/parsoid
14429 <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>
14430 !! end
14431
14432 !! test
14433 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14434 !! wikitext
14435 <div style="{{dangerous style attribute}}"></div>
14436 !! html
14437 <div style="/* insecure input */"></div>
14438
14439 !! end
14440
14441 !! test
14442 Bug 2304: HTML attribute safety (safe parameter; 2309)
14443 !! wikitext
14444 {{div style|width: 200px}}
14445 !! html
14446 <div style="float: right; width: 200px">Magic div</div>
14447
14448 !! end
14449
14450 !! test
14451 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14452 !! wikitext
14453 {{div style|width: expression(alert(document.cookie))}}
14454 !! html
14455 <div style="/* insecure input */">Magic div</div>
14456
14457 !! end
14458
14459 !! test
14460 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14461 !! wikitext
14462 {{div style|"><script>alert(document.cookie)</script>}}
14463 !! html
14464 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14465
14466 !! end
14467
14468 !! test
14469 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14470 !! wikitext
14471 {{div style|" ><script>alert(document.cookie)</script>}}
14472 !! html
14473 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14474
14475 !! end
14476
14477 !! test
14478 Bug 2304: HTML attribute safety (link)
14479 !! wikitext
14480 <div title="[[Main Page]]"></div>
14481 !! html
14482 <div title="&#91;&#91;Main Page]]"></div>
14483
14484 !! end
14485
14486 !! test
14487 Bug 2304: HTML attribute safety (italics)
14488 !! wikitext
14489 <div title="''foobar''"></div>
14490 !! html
14491 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14492
14493 !! end
14494
14495 !! test
14496 Bug 2304: HTML attribute safety (bold)
14497 !! wikitext
14498 <div title="'''foobar'''"></div>
14499 !! html
14500 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14501
14502 !! end
14503
14504
14505 !! test
14506 Bug 2304: HTML attribute safety (ISBN)
14507 !! wikitext
14508 <div title="ISBN 1234567890"></div>
14509 !! html
14510 <div title="&#73;SBN 1234567890"></div>
14511
14512 !! end
14513
14514 !! test
14515 Bug 2304: HTML attribute safety (RFC)
14516 !! wikitext
14517 <div title="RFC 1234"></div>
14518 !! html
14519 <div title="&#82;FC 1234"></div>
14520
14521 !! end
14522
14523 !! test
14524 Bug 2304: HTML attribute safety (PMID)
14525 !! wikitext
14526 <div title="PMID 1234567890"></div>
14527 !! html
14528 <div title="&#80;MID 1234567890"></div>
14529
14530 !! end
14531
14532 !! test
14533 Bug 2304: HTML attribute safety (web link)
14534 !! wikitext
14535 <div title="http://example.com/"></div>
14536 !! html
14537 <div title="http&#58;//example.com/"></div>
14538
14539 !! end
14540
14541 !! test
14542 Bug 2304: HTML attribute safety (named web link)
14543 !! wikitext
14544 <div title="[http://example.com/ link]"></div>
14545 !! html
14546 <div title="&#91;http&#58;//example.com/ link]"></div>
14547
14548 !! end
14549
14550 !! test
14551 Bug 3244: HTML attribute safety (extension; safe)
14552 !! wikitext
14553 <div style="<nowiki>background:blue</nowiki>"></div>
14554 !! html
14555 <div style="background:blue"></div>
14556
14557 !! end
14558
14559 !! test
14560 Bug 3244: HTML attribute safety (extension; unsafe)
14561 !! wikitext
14562 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14563 !! html
14564 <div style="/* insecure input */"></div>
14565
14566 !! end
14567
14568 # More MSIE fun discovered by Tom Gilder
14569
14570 !! test
14571 MSIE CSS safety test: spurious slash
14572 !! wikitext
14573 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14574 !! html
14575 <div style="/* insecure input */">evil</div>
14576
14577 !! end
14578
14579 !! test
14580 MSIE CSS safety test: hex code
14581 !! wikitext
14582 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14583 !! html
14584 <div style="/* insecure input */">evil</div>
14585
14586 !! end
14587
14588 !! test
14589 MSIE CSS safety test: comment in url
14590 !! wikitext
14591 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14592 !! html
14593 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14594
14595 !! end
14596
14597 !! test
14598 MSIE CSS safety test: comment in expression
14599 !! wikitext
14600 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14601 !! html
14602 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14603
14604 !! end
14605
14606 !! test
14607 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14608 !! wikitext
14609 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14610 !! html
14611 <p style="/* invalid control char */">A</p>
14612
14613 !! end
14614
14615 !! test
14616 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14617 !! wikitext
14618 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14619 <div style="top:EXPRESSION(alert())">B</div>
14620 !! html
14621 <p style="/* insecure input */">A</p>
14622 <div style="/* insecure input */">B</div>
14623
14624 !! end
14625
14626 !! test
14627 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14628 !! wikitext
14629 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14630 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14631 !! html
14632 <div style="/* insecure input */">A</div>
14633 <p style="/* insecure input */">B</p>
14634
14635 !! end
14636
14637 !! test
14638 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14639 !! wikitext
14640 <div style="background-image:url⁽javascript:alert())">A</div>
14641 <div style="background-image:url₍javascript:alert())">B</div>
14642 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14643 !! html
14644 <div style="/* insecure input */">A</div>
14645 <div style="/* insecure input */">B</div>
14646 <p style="/* insecure input */">C</p>
14647
14648 !! end
14649
14650 !! test
14651 Opera -o-link CSS
14652 !! wikitext
14653 <div
14654 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;"
14655 style="-o-link:attr(title);-o-link-source:current">X</div>
14656 !! html
14657 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14658
14659 !! end
14660
14661 !! test
14662 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14663 !! wikitext
14664 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14665 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14666 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14667 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14668 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14669 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14670 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14671 !! html
14672 <p style="/* insecure input */">A</p>
14673 <p style="/* insecure input */">B</p>
14674 <p style="/* insecure input */">C</p>
14675 <p style="/* insecure input */">D</p>
14676 <p style="/* insecure input */">E</p>
14677 <p style="/* insecure input */">F</p>
14678 <p style="/* insecure input */">G</p>
14679
14680 !! end
14681
14682 !! test
14683 Table attribute legitimate extension
14684 !! wikitext
14685 {|
14686 !+ style="<nowiki>color:blue</nowiki>"| status
14687 |}
14688 !! html
14689 <table>
14690 <tr>
14691 <th style="color:blue"> status
14692 </th></tr></table>
14693
14694 !!end
14695
14696 !! test
14697 Table attribute safety
14698 !! wikitext
14699 {|
14700 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14701 |}
14702 !! html
14703 <table>
14704 <tr>
14705 <th style="/* insecure input */"> status
14706 </th></tr></table>
14707
14708 !! end
14709
14710 !! test
14711 CSS line continuation 1
14712 !! wikitext
14713 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14714 !! html
14715 <div style="/* insecure input */"></div>
14716
14717 !! end
14718
14719 !! test
14720 CSS line continuation 2
14721 !! wikitext
14722 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14723 !! html
14724 <div style="/* insecure input */"></div>
14725
14726 !! end
14727
14728 !! article
14729 Template:Identity
14730 !! text
14731 {{{1}}}
14732 !! endarticle
14733
14734 !! test
14735 Expansion of multi-line templates in attribute values (bug 6255)
14736 !! wikitext
14737 <div style="background: {{identity|#00FF00}}">-</div>
14738 !! html
14739 <div style="background: #00FF00">-</div>
14740
14741 !! end
14742
14743
14744 !! test
14745 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14746 !! wikitext
14747 <div style="background:
14748 #00FF00">-</div>
14749 !! html/php
14750 <div style="background: #00FF00">-</div>
14751
14752 !! html/parsoid
14753 <div style="background:
14754 #00FF00">-</div>
14755 !! end
14756
14757 !! test
14758 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14759 !! wikitext
14760 <div style="background: &#10;#00FF00">-</div>
14761 !! html
14762 <div style="background: &#10;#00FF00">-</div>
14763
14764 !! end
14765
14766 !! test
14767 evil <math>-wiki-tags without Extension:Math enabled
14768 !! wikitext
14769 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14770 !! html+tidy
14771 <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>
14772 !! end
14773
14774 ###
14775 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14776 ###
14777 !! test
14778 Parser hook: empty input
14779 !! wikitext
14780 <tag></tag>
14781 !! html
14782 <pre>
14783 ''
14784 array (
14785 )
14786 </pre>
14787
14788 !! end
14789
14790 !! test
14791 Parser hook: empty input using terminated empty elements
14792 !! wikitext
14793 <tag/>
14794 !! html
14795 <pre>
14796 NULL
14797 array (
14798 )
14799 </pre>
14800
14801 !! end
14802
14803 !! test
14804 Parser hook: empty input using terminated empty elements (space before)
14805 !! wikitext
14806 <tag />
14807 !! html
14808 <pre>
14809 NULL
14810 array (
14811 )
14812 </pre>
14813
14814 !! end
14815
14816 !! test
14817 Parser hook: basic input
14818 !! wikitext
14819 <tag>input</tag>
14820 !! html
14821 <pre>
14822 'input'
14823 array (
14824 )
14825 </pre>
14826
14827 !! end
14828
14829
14830 !! test
14831 Parser hook: case insensitive
14832 !! wikitext
14833 <TAG>input</TAG>
14834 !! html
14835 <pre>
14836 'input'
14837 array (
14838 )
14839 </pre>
14840
14841 !! end
14842
14843
14844 !! test
14845 Parser hook: case insensitive, redux
14846 !! wikitext
14847 <TaG>input</TAg>
14848 !! html
14849 <pre>
14850 'input'
14851 array (
14852 )
14853 </pre>
14854
14855 !! end
14856
14857 !! test
14858 Parser hook: nested tags
14859 !! options
14860 noxml
14861 !! wikitext
14862 <tag><tag></tag></tag>
14863 !! html
14864 <pre>
14865 '<tag>'
14866 array (
14867 )
14868 </pre>&lt;/tag&gt;
14869
14870 !! end
14871
14872 !! test
14873 Parser hook: basic arguments
14874 !! wikitext
14875 <tag width=200 height = "100" depth = '50' square></tag>
14876 !! html
14877 <pre>
14878 ''
14879 array (
14880 'width' => '200',
14881 'height' => '100',
14882 'depth' => '50',
14883 'square' => 'square',
14884 )
14885 </pre>
14886
14887 !! end
14888
14889 !! test
14890 Parser hook: argument containing a forward slash (bug 5344)
14891 !! wikitext
14892 <tag filename='/tmp/bla'></tag>
14893 !! html
14894 <pre>
14895 ''
14896 array (
14897 'filename' => '/tmp/bla',
14898 )
14899 </pre>
14900
14901 !! end
14902
14903 !! test
14904 Parser hook: empty input using terminated empty elements (bug 2374)
14905 !! wikitext
14906 <tag foo=bar/>text
14907 !! html
14908 <pre>
14909 NULL
14910 array (
14911 'foo' => 'bar',
14912 )
14913 </pre>text
14914
14915 !! end
14916
14917 # </tag> should be output literally since there is no matching tag that begins it
14918 !! test
14919 Parser hook: basic arguments using terminated empty elements (bug 2374)
14920 !! wikitext
14921 <tag width=200 height = "100" depth = '50' square/>
14922 other stuff
14923 </tag>
14924 !! html
14925 <pre>
14926 NULL
14927 array (
14928 'width' => '200',
14929 'height' => '100',
14930 'depth' => '50',
14931 'square' => 'square',
14932 )
14933 </pre>
14934 <p>other stuff
14935 &lt;/tag&gt;
14936 </p>
14937 !! end
14938
14939 ###
14940 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14941 ###
14942
14943 !! test
14944 Parser hook: static parser hook not inside a comment
14945 !! wikitext
14946 <statictag>hello, world</statictag>
14947 <statictag action=flush/>
14948 !! html
14949 <p>hello, world
14950 </p>
14951 !! end
14952
14953
14954 !! test
14955 Parser hook: static parser hook inside a comment
14956 !! wikitext
14957 <!-- <statictag>hello, world</statictag> -->
14958 <statictag action=flush/>
14959 !! html
14960 <p><br />
14961 </p>
14962 !! end
14963
14964 # Nested template calls; this case was broken by Parser.php rev 1.506,
14965 # since reverted.
14966
14967 !! article
14968 Template:One-parameter
14969 !! text
14970 (My parameter is: {{{1}}})
14971 !! endarticle
14972
14973 !! article
14974 Template:Map-one-parameter
14975 !! text
14976 {{{{{1}}}|{{{2}}}}}
14977 !! endarticle
14978
14979 !! test
14980 Nested template calls
14981 !! wikitext
14982 {{Map-one-parameter|One-parameter|param}}
14983 !! html
14984 <p>(My parameter is: param)
14985 </p>
14986 !! end
14987
14988
14989 ###
14990 ### Sanitizer
14991 ###
14992
14993 # HTML+Tidy effectively strips out the empty tags completely
14994 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14995 # which Tidy would have done for the PHP parser had there been content inside it.
14996 !! test
14997 Sanitizer: Closing of open tags
14998 !! wikitext
14999 <s></s><table></table>
15000 !! html
15001 <s></s><table></table>
15002
15003 !! html/parsoid
15004 <p><s></s></p><table></table>
15005 !! end
15006
15007 !! test
15008 Sanitizer: Closing of open but not closed tags
15009 !! wikitext
15010 <s>foo
15011 !! html
15012 <p><s>foo</s>
15013 </p>
15014 !! end
15015
15016 !! test
15017 Sanitizer: Closing of closed but not open tags
15018 !! wikitext
15019 </s>
15020 !! html
15021 <p>&lt;/s&gt;
15022 </p>
15023 !! end
15024
15025 !! test
15026 Sanitizer: Closing of closed but not open table tags
15027 !! wikitext
15028 Table not started</td></tr></table>
15029 !! html
15030 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15031 </p>
15032 !! end
15033
15034 !! test
15035 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15036 !! wikitext
15037 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15038 !! html
15039 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15040 </p>
15041 !! end
15042
15043 # In HTML5, the restrictions are that id must contain at least one character,
15044 # and must not contain any space characters.
15045 !! test
15046 Sanitizer: Validating the contents of the id attribute (bug 4515)
15047 !! options
15048 disabled
15049 !! wikitext
15050 <br id="" /><br id="a space" />
15051 !! html
15052 Something ...
15053 !! end
15054
15055 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15056 !! test
15057 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15058 !! options
15059 disabled
15060 !! wikitext
15061 <br id="foo" /><br id="foo" />
15062 !! html
15063 Something need to be done. foo-2 ?
15064 !! end
15065
15066 !! test
15067 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15068 !! wikitext
15069 <div itemscope>
15070 <meta itemprop="hello" content="world">
15071 <meta http-equiv="refresh" content="5">
15072 <meta itemprop="hello" http-equiv="refresh" content="5">
15073 <link itemprop="hello" href="{{SERVER}}">
15074 <link rel="stylesheet" href="{{SERVER}}">
15075 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15076 </div>
15077 !! html
15078 <div itemscope="itemscope">
15079 <p> <meta itemprop="hello" content="world" />
15080 &lt;meta http-equiv="refresh" content="5"&gt;
15081 <meta itemprop="hello" content="5" />
15082 </p>
15083 <link itemprop="hello" href="http&#58;//example.org" />
15084 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15085 <link itemprop="hello" href="http&#58;//example.org" />
15086 </div>
15087
15088 !! end
15089
15090 !! test
15091 Language converter: output gets cut off unexpectedly (bug 5757)
15092 !! options
15093 language=zh
15094 !! wikitext
15095 this bit is safe: }-
15096
15097 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15098
15099 then we get cut off here: }-
15100
15101 all additional text is vanished
15102 !! html
15103 <p>this bit is safe: }-
15104 </p><p>but if we add a conversion instance: xxx
15105 </p><p>then we get cut off here: }-
15106 </p><p>all additional text is vanished
15107 </p>
15108 !! end
15109
15110 !! test
15111 Self closed html pairs (bug 5487)
15112 !! options
15113 !! wikitext
15114 <center><font id="bug" />Centered text</center>
15115 <div><font id="bug2" />In div text</div>
15116 !! html
15117 <center>&lt;font id="bug" /&gt;Centered text</center>
15118 <div>&lt;font id="bug2" /&gt;In div text</div>
15119
15120 !! end
15121
15122 #
15123 #
15124 #
15125
15126 !! test
15127 Punctuation: nbsp before exclamation
15128 !! wikitext
15129 C'est grave !
15130 !! html
15131 <p>C'est grave&#160;!
15132 </p>
15133 !! end
15134
15135 !! test
15136 Punctuation: CSS !important (bug 11874)
15137 !! wikitext
15138 <div style="width:50% !important">important</div>
15139 !! html
15140 <div style="width:50% !important">important</div>
15141
15142 !!end
15143
15144 !! test
15145 Punctuation: CSS ! important (bug 11874; with space after)
15146 !! wikitext
15147 <div style="width:50% ! important">important</div>
15148 !! html
15149 <div style="width:50% ! important">important</div>
15150
15151 !!end
15152
15153 !! test
15154 HTML bullet list, closed tags (bug 5497)
15155 !! wikitext
15156 <ul>
15157 <li>One</li>
15158 <li>Two</li>
15159 </ul>
15160 !! html/php
15161 <ul>
15162 <li>One</li>
15163 <li>Two</li>
15164 </ul>
15165
15166 !! html/parsoid
15167 <ul data-parsoid='{"stx":"html"}'>
15168 <li data-parsoid='{"stx":"html"}'>One</li>
15169 <li data-parsoid='{"stx":"html"}'>Two</li>
15170 </ul>
15171
15172 !! end
15173
15174 !! test
15175 HTML bullet list, unclosed tags (bug 5497)
15176 !! wikitext
15177 <ul>
15178 <li>One
15179 <li>Two
15180 </ul>
15181 !! html/php+tidy
15182 <ul>
15183 <li>One</li>
15184 <li>Two</li>
15185 </ul>
15186 !! html/parsoid
15187 <ul data-parsoid='{"stx":"html"}'>
15188 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15189 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15190 </ul>
15191
15192 !! end
15193
15194 !! test
15195 HTML ordered list, closed tags (bug 5497)
15196 !! wikitext
15197 <ol>
15198 <li>One</li>
15199 <li>Two</li>
15200 </ol>
15201 !! html/php
15202 <ol>
15203 <li>One</li>
15204 <li>Two</li>
15205 </ol>
15206
15207 !! html/parsoid
15208 <ol data-parsoid='{"stx":"html"}'>
15209 <li data-parsoid='{"stx":"html"}'>One</li>
15210 <li data-parsoid='{"stx":"html"}'>Two</li>
15211 </ol>
15212
15213 !! end
15214
15215 !! test
15216 HTML ordered list, unclosed tags (bug 5497)
15217 !! options
15218 !! wikitext
15219 <ol>
15220 <li>One
15221 <li>Two
15222 </ol>
15223 !! html/php+tidy
15224 <ol>
15225 <li>One</li>
15226 <li>Two</li>
15227 </ol>
15228 !! html/parsoid
15229 <ol data-parsoid='{"stx":"html"}'>
15230 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15231 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15232 </ol>
15233
15234 !! end
15235
15236 !! test
15237 HTML nested bullet list, closed tags (bug 5497)
15238 !! wikitext
15239 <ul>
15240 <li>One</li>
15241 <li>Two:
15242 <ul>
15243 <li>Sub-one</li>
15244 <li>Sub-two</li>
15245 </ul>
15246 </li>
15247 </ul>
15248 !! html
15249 <ul>
15250 <li>One</li>
15251 <li>Two:
15252 <ul>
15253 <li>Sub-one</li>
15254 <li>Sub-two</li>
15255 </ul>
15256 </li>
15257 </ul>
15258
15259 !! end
15260
15261 !! test
15262 HTML nested bullet list, open tags (bug 5497)
15263 !! wikitext
15264 <ul>
15265 <li>One
15266 <li>Two:
15267 <ul>
15268 <li>Sub-one
15269 <li>Sub-two
15270 </ul>
15271 </ul>
15272 !! html/php+tidy
15273 <ul>
15274 <li>One</li>
15275 <li>Two:
15276 <ul>
15277 <li>Sub-one</li>
15278 <li>Sub-two</li>
15279 </ul>
15280 </li>
15281 </ul>
15282 !! html/parsoid
15283 <ul>
15284 <li>One
15285 </li>
15286 <li>Two:
15287 <ul>
15288 <li>Sub-one
15289 </li>
15290 <li>Sub-two
15291 </li>
15292 </ul>
15293 </li>
15294 </ul>
15295
15296 !! end
15297
15298 !! test
15299 HTML nested ordered list, closed tags (bug 5497)
15300 !! wikitext
15301 <ol>
15302 <li>One</li>
15303 <li>Two:
15304 <ol>
15305 <li>Sub-one</li>
15306 <li>Sub-two</li>
15307 </ol>
15308 </li>
15309 </ol>
15310 !! html
15311 <ol>
15312 <li>One</li>
15313 <li>Two:
15314 <ol>
15315 <li>Sub-one</li>
15316 <li>Sub-two</li>
15317 </ol>
15318 </li>
15319 </ol>
15320
15321 !! end
15322
15323 !! test
15324 HTML nested ordered list, open tags (bug 5497)
15325 !! wikitext
15326 <ol>
15327 <li>One
15328 <li>Two:
15329 <ol>
15330 <li>Sub-one
15331 <li>Sub-two
15332 </ol>
15333 </ol>
15334 !! html/php
15335 <ol>
15336 <li>One
15337 <li>Two:
15338 <ol>
15339 <li>Sub-one
15340 <li>Sub-two
15341 </ol>
15342 </ol>
15343
15344 !! html/parsoid
15345 <ol>
15346 <li>One
15347 </li>
15348 <li>Two:
15349 <ol>
15350 <li>Sub-one
15351 </li>
15352 <li>Sub-two
15353 </li>
15354 </ol>
15355 </li>
15356 </ol>
15357
15358 !! end
15359
15360 !! test
15361 HTML ordered list item with parameters oddity
15362 !! wikitext
15363 <ol><li id="fragment">One</li>
15364 </ol>
15365 !! html
15366 <ol><li id="fragment">One</li>
15367 </ol>
15368
15369 !! end
15370
15371 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15372 !!test
15373 bug 5918: autonumbering
15374 !! wikitext
15375 [http://first/] [http://second] [ftp://ftp]
15376
15377 ftp://inlineftp
15378
15379 [mailto:enclosed@mail.tld With target]
15380
15381 [mailto:enclosed@mail.tld]
15382
15383 mailto:inline@mail.tld
15384 !! html/php
15385 <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>
15386 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15387 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15388 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15389 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15390 </p>
15391 !! html/parsoid
15392 <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>
15393 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15394 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15395 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15396 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15397 !! end
15398
15399
15400 #
15401 # Security and HTML correctness
15402 # From Nick Jenkins' fuzz testing
15403 #
15404
15405 !! test
15406 Fuzz testing: Parser13
15407 !! wikitext
15408 {|
15409 | http://a|
15410 !! html
15411 <table>
15412 <tr>
15413 <td>
15414 </td>
15415 </tr>
15416 </table>
15417
15418 !! end
15419
15420 !! test
15421 Fuzz testing: Parser14
15422 !! wikitext
15423 == onmouseover= ==
15424 http://__TOC__
15425 !! html
15426 <h2><a href="#onmouseover.3D" class="mw-headline-anchor" aria-hidden="true" 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>
15427 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15428 <ul>
15429 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15430 </ul>
15431 </div>
15432
15433
15434 !! html+tidy
15435 <h2><a href="#onmouseover.3D" class="mw-headline-anchor" aria-hidden="true" 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>
15436 <p>http://</p>
15437 <div id="toc" class="toc">
15438 <div id="toctitle">
15439 <h2>Contents</h2>
15440 </div>
15441 <ul>
15442 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15443 </ul>
15444 </div>
15445 <p></p>
15446 !! end
15447
15448 !! test
15449 Fuzz testing: Parser14-table
15450 !! wikitext
15451 ==a==
15452 {| STYLE=__TOC__
15453 !! html
15454 <h2><a href="#a" class="mw-headline-anchor" aria-hidden="true" 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>
15455 <table style="&#95;_TOC&#95;_">
15456 <tr><td></td></tr>
15457 </table>
15458
15459 !! html+tidy
15460 <h2><a href="#a" class="mw-headline-anchor" aria-hidden="true" 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>
15461 <table style="__TOC__">
15462 <tr>
15463 <td></td>
15464 </tr>
15465 </table>
15466 !! end
15467
15468 # Known to produce bogus xml (extra </td>)
15469 !! test
15470 Fuzz testing: Parser16
15471 !! options
15472 noxml
15473 !! wikitext
15474 {|
15475 !https://||||||
15476 !! html
15477 <table>
15478 <tr>
15479 <th>https://</th>
15480 <th></th>
15481 <th></th>
15482 <th>
15483 </td>
15484 </tr>
15485 </table>
15486
15487 !! html+tidy
15488 <table>
15489 <tr>
15490 <th>https://</th>
15491 <th></th>
15492 <th></th>
15493 <th></th>
15494 </tr>
15495 </table>
15496 !! end
15497
15498 !! test
15499 Fuzz testing: Parser21
15500 !! wikitext
15501 {|
15502 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15503 |
15504 !! html
15505 <table>
15506 <tr>
15507 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15508 </th>
15509 <td>
15510 </td>
15511 </tr>
15512 </table>
15513
15514 !! end
15515
15516 !! test
15517 Fuzz testing: Parser22
15518 !! wikitext
15519 http://===r:::https://b
15520
15521 {|
15522 !! html
15523 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15524 </p>
15525 <table>
15526 <tr><td></td></tr>
15527 </table>
15528
15529 !! end
15530
15531 # Known to produce bad XML for now
15532 !! test
15533 Fuzz testing: Parser24
15534 !! options
15535 noxml
15536 !! wikitext
15537 {|
15538 {{{|
15539 <u CLASS=
15540 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15541 <br style="onmouseover='alert(document.cookie);' " />
15542
15543 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15544 |
15545 !! html
15546 <table>
15547 {{{|
15548 <u class="&#124;">}}}} &gt;
15549 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15550
15551 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15552 <tr>
15553 <td></u>
15554 </td>
15555 </tr>
15556 </table>
15557
15558 !! end
15559
15560 # Note: the current result listed for this is not what the original one was,
15561 # but the original bug was JavaScript injection, which is fixed in any case.
15562 # It's not clear that the original result listed was any more correct than the
15563 # current one. Original result:
15564 # <p>{{{|
15565 # </p>
15566 # <li class="&#124;&#124;">
15567 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15568 !!test
15569 Fuzz testing: Parser25 (bug 6055)
15570 !! wikitext
15571 {{{
15572 |
15573 <LI CLASS=||
15574 >
15575 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15576 !! html
15577 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15578 </p>
15579 !! end
15580
15581 !!test
15582 Fuzz testing: URL adjacent extension (with space, clean)
15583 !! wikitext
15584 http://example.com <nowiki>junk</nowiki>
15585 !! html/php
15586 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15587 </p>
15588 !! html/parsoid
15589 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15590 !! end
15591
15592 !!test
15593 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15594 !! wikitext
15595 http://example.com<nowiki>junk</nowiki>
15596 !! html/php
15597 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15598 </p>
15599 !! html/parsoid
15600 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15601 !! end
15602
15603 !!test
15604 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15605 !! wikitext
15606 http://example.com<pre>junk</pre>
15607 !! html/php
15608 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15609
15610 !! html/php+tidy
15611 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15612 <pre>
15613 junk
15614 </pre>
15615 !! html/parsoid
15616 <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>
15617 !!end
15618
15619 !!test
15620 Fuzz testing: image with bogus manual thumbnail
15621 !! wikitext
15622 [[Image:foobar.jpg|thumbnail= ]]
15623 !! html/php
15624 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15625
15626 !! html/parsoid
15627 <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>
15628 !!end
15629
15630 !! test
15631 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15632 !! wikitext
15633 <pre dir="&#10;"></pre>
15634 !! html
15635 <pre dir="&#10;"></pre>
15636
15637 !! end
15638
15639 !! test
15640 Parsing optional HTML elements (Bug 6171)
15641 !! options
15642 !! wikitext
15643 <table>
15644 <tr>
15645 <td> Some tabular data</td>
15646 <td> More tabular data ...
15647 <td> And yet som tabular data</td>
15648 </tr>
15649 </table>
15650 !! html
15651 <table>
15652 <tr>
15653 <td> Some tabular data</td>
15654 <td> More tabular data ...
15655 </td><td> And yet som tabular data</td>
15656 </tr>
15657 </table>
15658
15659 !! end
15660
15661 !! test
15662 Correct handling of <td>, <tr> (Bug 6171)
15663 !! options
15664 !! wikitext
15665 <table>
15666 <tr>
15667 <td> Some tabular data</td>
15668 <td> More tabular data ...</td>
15669 <td> And yet som tabular data</td>
15670 </tr>
15671 </table>
15672 !! html
15673 <table>
15674 <tr>
15675 <td> Some tabular data</td>
15676 <td> More tabular data ...</td>
15677 <td> And yet som tabular data</td>
15678 </tr>
15679 </table>
15680
15681 !! end
15682
15683
15684 !! test
15685 Parsing crashing regression (fr:JavaScript)
15686 !! wikitext
15687 </body></x>
15688 !! html
15689 <p>&lt;/body&gt;&lt;/x&gt;
15690 </p>
15691 !! end
15692
15693 !! test
15694 Inline wiki vs wiki block nesting
15695 !! wikitext
15696 '''Bold paragraph
15697
15698 New wiki paragraph
15699 !! html
15700 <p><b>Bold paragraph</b>
15701 </p><p>New wiki paragraph
15702 </p>
15703 !! end
15704
15705 # FIXME: The current php output is documented
15706 # and desired output is the parsoid target.
15707 !! test
15708 Inline HTML vs wiki block nesting
15709 !! wikitext
15710 <b>Bold paragraph
15711
15712 New wiki paragraph
15713 !! html/php
15714 <p><b>Bold paragraph
15715 </p><p>New wiki paragraph</b>
15716 </p>
15717 !! html/parsoid
15718 <p><b>Bold paragraph</b>
15719 </p><p>New wiki paragraph
15720 </p>
15721 !! end
15722
15723 # Original result was this:
15724 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15725 # </p>
15726 # While that might be marginally more intuitive, maybe, the six-apostrophe
15727 # construct is clearly pathological and the result stated here (which is what
15728 # the parser actually does) is about as reasonable as anything.
15729 !!test
15730 Mixing markup for italics and bold
15731 !! options
15732 !! wikitext
15733 '''bold''''''bold''bolditalics'''''
15734 !! html
15735 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15736 </p>
15737 !! end
15738
15739
15740 !! article
15741 Xyzzyx
15742 !! text
15743 Article for special page transclusion test
15744 !! endarticle
15745
15746 !! test
15747 Special page transclusion
15748 !! options
15749 !! wikitext
15750 {{Special:Prefixindex/Xyzzyx}}
15751 !! html
15752 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15753
15754 !! end
15755
15756 !! test
15757 Special page transclusion twice (bug 5021)
15758 !! options
15759 !! wikitext
15760 {{Special:Prefixindex/Xyzzyx}}
15761 {{Special:Prefixindex/Xyzzyx}}
15762 !! html
15763 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15764 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15765
15766 !! end
15767
15768 !! test
15769 Transclusion of default MediaWiki message
15770 !! wikitext
15771 {{MediaWiki:Mainpage}}
15772 !! html
15773 <p>Main Page
15774 </p>
15775 !! end
15776
15777 !! test
15778 Transclusion of nonexistent MediaWiki message
15779 !! wikitext
15780 {{MediaWiki:Mainpagexxx}}
15781 !! html
15782 <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>
15783 </p>
15784 !! end
15785
15786 !! test
15787 Transclusion of MediaWiki message with underscore
15788 !! wikitext
15789 {{MediaWiki:history_short}}
15790 !! html
15791 <p>History
15792 </p>
15793 !! end
15794
15795 !! test
15796 Transclusion of MediaWiki message with space
15797 !! wikitext
15798 {{MediaWiki:history short}}
15799 !! html
15800 <p>History
15801 </p>
15802 !! end
15803
15804 !! test
15805 Invalid header with following text
15806 !! wikitext
15807 = x = y
15808 !! html
15809 <p>= x = y
15810 </p>
15811 !! end
15812
15813
15814 !! test
15815 Section extraction test (section 0)
15816 !! options
15817 section=0
15818 !! wikitext
15819 start
15820 ==a==
15821 ===aa===
15822 ====aaa====
15823 ==b==
15824 ===ba===
15825 ===bb===
15826 ====bba====
15827 ===bc===
15828 ==c==
15829 ===ca===
15830 !! html
15831 start
15832 !! end
15833
15834 !! test
15835 Section extraction test (section 1)
15836 !! options
15837 section=1
15838 !! wikitext
15839 start
15840 ==a==
15841 ===aa===
15842 ====aaa====
15843 ==b==
15844 ===ba===
15845 ===bb===
15846 ====bba====
15847 ===bc===
15848 ==c==
15849 ===ca===
15850 !! html
15851 ==a==
15852 ===aa===
15853 ====aaa====
15854 !! end
15855
15856 !! test
15857 Section extraction test (section 2)
15858 !! options
15859 section=2
15860 !! wikitext
15861 start
15862 ==a==
15863 ===aa===
15864 ====aaa====
15865 ==b==
15866 ===ba===
15867 ===bb===
15868 ====bba====
15869 ===bc===
15870 ==c==
15871 ===ca===
15872 !! html
15873 ===aa===
15874 ====aaa====
15875 !! end
15876
15877 !! test
15878 Section extraction test (section 3)
15879 !! options
15880 section=3
15881 !! wikitext
15882 start
15883 ==a==
15884 ===aa===
15885 ====aaa====
15886 ==b==
15887 ===ba===
15888 ===bb===
15889 ====bba====
15890 ===bc===
15891 ==c==
15892 ===ca===
15893 !! html
15894 ====aaa====
15895 !! end
15896
15897 !! test
15898 Section extraction test (section 4)
15899 !! options
15900 section=4
15901 !! wikitext
15902 start
15903 ==a==
15904 ===aa===
15905 ====aaa====
15906 ==b==
15907 ===ba===
15908 ===bb===
15909 ====bba====
15910 ===bc===
15911 ==c==
15912 ===ca===
15913 !! html
15914 ==b==
15915 ===ba===
15916 ===bb===
15917 ====bba====
15918 ===bc===
15919 !! end
15920
15921 !! test
15922 Section extraction test (section 5)
15923 !! options
15924 section=5
15925 !! wikitext
15926 start
15927 ==a==
15928 ===aa===
15929 ====aaa====
15930 ==b==
15931 ===ba===
15932 ===bb===
15933 ====bba====
15934 ===bc===
15935 ==c==
15936 ===ca===
15937 !! html
15938 ===ba===
15939 !! end
15940
15941 !! test
15942 Section extraction test (section 6)
15943 !! options
15944 section=6
15945 !! wikitext
15946 start
15947 ==a==
15948 ===aa===
15949 ====aaa====
15950 ==b==
15951 ===ba===
15952 ===bb===
15953 ====bba====
15954 ===bc===
15955 ==c==
15956 ===ca===
15957 !! html
15958 ===bb===
15959 ====bba====
15960 !! end
15961
15962 !! test
15963 Section extraction test (section 7)
15964 !! options
15965 section=7
15966 !! wikitext
15967 start
15968 ==a==
15969 ===aa===
15970 ====aaa====
15971 ==b==
15972 ===ba===
15973 ===bb===
15974 ====bba====
15975 ===bc===
15976 ==c==
15977 ===ca===
15978 !! html
15979 ====bba====
15980 !! end
15981
15982 !! test
15983 Section extraction test (section 8)
15984 !! options
15985 section=8
15986 !! wikitext
15987 start
15988 ==a==
15989 ===aa===
15990 ====aaa====
15991 ==b==
15992 ===ba===
15993 ===bb===
15994 ====bba====
15995 ===bc===
15996 ==c==
15997 ===ca===
15998 !! html
15999 ===bc===
16000 !! end
16001
16002 !! test
16003 Section extraction test (section 9)
16004 !! options
16005 section=9
16006 !! wikitext
16007 start
16008 ==a==
16009 ===aa===
16010 ====aaa====
16011 ==b==
16012 ===ba===
16013 ===bb===
16014 ====bba====
16015 ===bc===
16016 ==c==
16017 ===ca===
16018 !! html
16019 ==c==
16020 ===ca===
16021 !! end
16022
16023 !! test
16024 Section extraction test (section 10)
16025 !! options
16026 section=10
16027 !! wikitext
16028 start
16029 ==a==
16030 ===aa===
16031 ====aaa====
16032 ==b==
16033 ===ba===
16034 ===bb===
16035 ====bba====
16036 ===bc===
16037 ==c==
16038 ===ca===
16039 !! html
16040 ===ca===
16041 !! end
16042
16043 !! test
16044 Section extraction test (nonexistent section 11)
16045 !! options
16046 section=11
16047 !! wikitext
16048 start
16049 ==a==
16050 ===aa===
16051 ====aaa====
16052 ==b==
16053 ===ba===
16054 ===bb===
16055 ====bba====
16056 ===bc===
16057 ==c==
16058 ===ca===
16059 !! html
16060 !! end
16061
16062 !! test
16063 Section extraction test with bogus heading (section 1)
16064 !! options
16065 section=1
16066 !! wikitext
16067 ==a==
16068 ==bogus== not a legal section
16069 ==b==
16070 !! html
16071 ==a==
16072 ==bogus== not a legal section
16073 !! end
16074
16075 !! test
16076 Section extraction test with bogus heading (section 2)
16077 !! options
16078 section=2
16079 !! wikitext
16080 ==a==
16081 ==bogus== not a legal section
16082 ==b==
16083 !! html
16084 ==b==
16085 !! end
16086
16087 !! test
16088 Section extraction test with comment after heading (section 1)
16089 !! options
16090 section=1
16091 !! wikitext
16092 ==a==
16093 ==b== <!-- -->
16094 ==c==
16095 !! html
16096 ==a==
16097 !! end
16098
16099 !! test
16100 Section extraction test with comment after heading (section 2)
16101 !! options
16102 section=2
16103 !! wikitext
16104 ==a==
16105 ==b== <!-- -->
16106 ==c==
16107 !! html
16108 ==b== <!-- -->
16109 !! end
16110
16111 !! test
16112 Section extraction test with bogus <nowiki> heading (section 1)
16113 !! options
16114 section=1
16115 !! wikitext
16116 ==a==
16117 ==bogus== <nowiki>not a legal section</nowiki>
16118 ==b==
16119 !! html
16120 ==a==
16121 ==bogus== <nowiki>not a legal section</nowiki>
16122 !! end
16123
16124 !! test
16125 Section extraction test with bogus <nowiki> heading (section 2)
16126 !! options
16127 section=2
16128 !! wikitext
16129 ==a==
16130 ==bogus== <nowiki>not a legal section</nowiki>
16131 ==b==
16132 !! html
16133 ==b==
16134 !! end
16135
16136
16137 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16138 # instead of respecting commented sections
16139 !! test
16140 Section extraction prefixed by comment (section 1)
16141 !! options
16142 section=1
16143 !! wikitext
16144 <!-- -->==sec1==
16145 ==sec2==
16146 !! html
16147 ==sec2==
16148 !!end
16149
16150 !! test
16151 Section extraction prefixed by comment (section 2)
16152 !! options
16153 section=2
16154 !! wikitext
16155 <!-- -->==sec1==
16156 ==sec2==
16157 !! html
16158
16159 !!end
16160
16161
16162 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16163 # instead of respecting HTML-style headings
16164 !! test
16165 Section extraction, mixed wiki and html (section 1)
16166 !! options
16167 section=1
16168 !! wikitext
16169 <h2>unmarked</h2>
16170 unmarked
16171 ==1==
16172 one
16173 ==2==
16174 two
16175 !! html
16176 ==1==
16177 one
16178 !! end
16179
16180 !! test
16181 Section extraction, mixed wiki and html (section 2)
16182 !! options
16183 section=2
16184 !! wikitext
16185 <h2>unmarked</h2>
16186 unmarked
16187 ==1==
16188 one
16189 ==2==
16190 two
16191 !! html
16192 ==2==
16193 two
16194 !! end
16195
16196
16197 # Formerly testing for bug 3342
16198 !! test
16199 Section extraction, heading surrounded by <noinclude>
16200 !! options
16201 section=1
16202 !! wikitext
16203 <noinclude>==unmarked==</noinclude>
16204 ==marked==
16205 !! html
16206 ==marked==
16207 !!end
16208
16209 # Test behavior of bug 19910
16210 !! test
16211 Sectiion with all-equals
16212 !! options
16213 section=2
16214 !! wikitext
16215 ===
16216 The line above must have a trailing space
16217 === <!--
16218 --> <!-- -->
16219 But just in case it doesn't...
16220 !! html
16221 === <!--
16222 --> <!-- -->
16223 But just in case it doesn't...
16224 !! end
16225
16226 !! test
16227 Section replacement test (section 0)
16228 !! options
16229 replace=0,"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 xxx
16244
16245 ==a==
16246 ===aa===
16247 ====aaa====
16248 ==b==
16249 ===ba===
16250 ===bb===
16251 ====bba====
16252 ===bc===
16253 ==c==
16254 ===ca===
16255 !! end
16256
16257 !! test
16258 Section replacement test (section 1)
16259 !! options
16260 replace=1,"xxx"
16261 !! wikitext
16262 start
16263 ==a==
16264 ===aa===
16265 ====aaa====
16266 ==b==
16267 ===ba===
16268 ===bb===
16269 ====bba====
16270 ===bc===
16271 ==c==
16272 ===ca===
16273 !! html
16274 start
16275 xxx
16276
16277 ==b==
16278 ===ba===
16279 ===bb===
16280 ====bba====
16281 ===bc===
16282 ==c==
16283 ===ca===
16284 !! end
16285
16286 !! test
16287 Section replacement test (section 2)
16288 !! options
16289 replace=2,"xxx"
16290 !! wikitext
16291 start
16292 ==a==
16293 ===aa===
16294 ====aaa====
16295 ==b==
16296 ===ba===
16297 ===bb===
16298 ====bba====
16299 ===bc===
16300 ==c==
16301 ===ca===
16302 !! html
16303 start
16304 ==a==
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 3)
16318 !! options
16319 replace=3,"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 xxx
16337
16338 ==b==
16339 ===ba===
16340 ===bb===
16341 ====bba====
16342 ===bc===
16343 ==c==
16344 ===ca===
16345 !! end
16346
16347 !! test
16348 Section replacement test (section 4)
16349 !! options
16350 replace=4,"xxx"
16351 !! wikitext
16352 start
16353 ==a==
16354 ===aa===
16355 ====aaa====
16356 ==b==
16357 ===ba===
16358 ===bb===
16359 ====bba====
16360 ===bc===
16361 ==c==
16362 ===ca===
16363 !! html
16364 start
16365 ==a==
16366 ===aa===
16367 ====aaa====
16368 xxx
16369
16370 ==c==
16371 ===ca===
16372 !! end
16373
16374 !! test
16375 Section replacement test (section 5)
16376 !! options
16377 replace=5,"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 xxx
16397
16398 ===bb===
16399 ====bba====
16400 ===bc===
16401 ==c==
16402 ===ca===
16403 !! end
16404
16405 !! test
16406 Section replacement test (section 6)
16407 !! options
16408 replace=6,"xxx"
16409 !! wikitext
16410 start
16411 ==a==
16412 ===aa===
16413 ====aaa====
16414 ==b==
16415 ===ba===
16416 ===bb===
16417 ====bba====
16418 ===bc===
16419 ==c==
16420 ===ca===
16421 !! html
16422 start
16423 ==a==
16424 ===aa===
16425 ====aaa====
16426 ==b==
16427 ===ba===
16428 xxx
16429
16430 ===bc===
16431 ==c==
16432 ===ca===
16433 !! end
16434
16435 !! test
16436 Section replacement test (section 7)
16437 !! options
16438 replace=7,"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 xxx
16460
16461 ===bc===
16462 ==c==
16463 ===ca===
16464 !! end
16465
16466 !! test
16467 Section replacement test (section 8)
16468 !! options
16469 replace=8,"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 xxx
16492
16493 ==c==
16494 ===ca===
16495 !!end
16496
16497 !! test
16498 Section replacement test (section 9)
16499 !! options
16500 replace=9,"xxx"
16501 !! wikitext
16502 start
16503 ==a==
16504 ===aa===
16505 ====aaa====
16506 ==b==
16507 ===ba===
16508 ===bb===
16509 ====bba====
16510 ===bc===
16511 ==c==
16512 ===ca===
16513 !! html
16514 start
16515 ==a==
16516 ===aa===
16517 ====aaa====
16518 ==b==
16519 ===ba===
16520 ===bb===
16521 ====bba====
16522 ===bc===
16523 xxx
16524 !! end
16525
16526 !! test
16527 Section replacement test (section 10)
16528 !! options
16529 replace=10,"xxx"
16530 !! wikitext
16531 start
16532 ==a==
16533 ===aa===
16534 ====aaa====
16535 ==b==
16536 ===ba===
16537 ===bb===
16538 ====bba====
16539 ===bc===
16540 ==c==
16541 ===ca===
16542 !! html
16543 start
16544 ==a==
16545 ===aa===
16546 ====aaa====
16547 ==b==
16548 ===ba===
16549 ===bb===
16550 ====bba====
16551 ===bc===
16552 ==c==
16553 xxx
16554 !! end
16555
16556 !! test
16557 Section replacement test with initial whitespace (bug 13728)
16558 !! options
16559 replace=2,"xxx"
16560 !! wikitext
16561 Preformatted initial line
16562 ==a==
16563 ===a===
16564 !! html
16565 Preformatted initial line
16566 ==a==
16567 xxx
16568 !! end
16569
16570
16571 !! test
16572 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16573 !! options
16574 section=1
16575 !! wikitext
16576 ==a==
16577 a
16578 !! html
16579 ==a==
16580 a
16581 !! end
16582
16583 !! test
16584 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16585 !! options
16586 section=1
16587 !! wikitext
16588 ==a==
16589 a
16590 !! html
16591 ==a==
16592 a
16593 !! end
16594
16595
16596 !! test
16597 Section extraction, <pre> around bogus header (bug 10309)
16598 !! options
16599 noxml section=2
16600 !! wikitext
16601 == Section One ==
16602 <pre>
16603 =======
16604 </pre>
16605
16606 == Section Two ==
16607 stuff
16608 !! html
16609 == Section Two ==
16610 stuff
16611 !! end
16612
16613 !! test
16614 Section replacement, <pre> around bogus header (bug 10309)
16615 !! options
16616 noxml replace=2,"xxx"
16617 !! wikitext
16618 == Section One ==
16619 <pre>
16620 =======
16621 </pre>
16622
16623 == Section Two ==
16624 stuff
16625 !! html
16626 == Section One ==
16627 <pre>
16628 =======
16629 </pre>
16630
16631 xxx
16632 !! end
16633
16634
16635
16636 !! test
16637 Handling of &#x0A; in URLs
16638 !! wikitext
16639 ** irc://&#x0A;a
16640 !! html/php
16641 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16642
16643 !! html/parsoid
16644 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16645 a">irc://
16646 a</a></li></ul></li></ul>
16647 !! end
16648
16649 !! test
16650 Handling of %0A in URLs
16651 !! wikitext
16652 ** irc://%0Aa
16653 !! html/php
16654 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16655
16656 !! html/parsoid
16657 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16658 !! end
16659
16660
16661 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16662 !! test
16663 5 quotes, code coverage +1 line
16664 !! options
16665 parsoid=wt2html
16666 !! wikitext
16667 '''''
16668 !! html/php
16669 !! html/parsoid
16670 <p><b><i></i></b></p>
16671 !! end
16672
16673 # same html as previous, but wikitext adjusted to match parsoid html2wt
16674 # note that wt2html and html2html will put the <i> before the <b>
16675 !! test
16676 5 quotes, code coverage +1 line w/ nowiki (1)
16677 !! options
16678 parsoid=wt2wt,html2wt
16679 !! wikitext
16680 '''''<nowiki/>'''''
16681 !! html/php
16682 <p><i></i>
16683 </p>
16684 !! html/parsoid
16685 <p><b><i></i></b></p>
16686 !! end
16687
16688 # same as previous, just swapping the <i> and <b>
16689 !! test
16690 5 quotes, code coverage +1 line w/ nowiki (2)
16691 !! wikitext
16692 '''''<nowiki/>'''''
16693 !! html/php
16694 <p><i></i>
16695 </p>
16696 !! html/parsoid
16697 <p><i><b></b></i></p>
16698 !! end
16699
16700 !! test
16701 Special:Search page linking.
16702 !! wikitext
16703 {{Special:search}}
16704 !! html
16705 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16706 </p>
16707 !! end
16708
16709 !! test
16710 {{!}} is a magic word
16711 !! wikitext
16712 {{!}} is a magic word there and {{!}} is still a magic word here
16713 !! html/php
16714 <p>| is a magic word there and | is still a magic word here
16715 </p>
16716 !! html/parsoid
16717 <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>
16718 !! end
16719
16720 !! test
16721 Say the magic word
16722 !! options
16723 title=[[Parser test]]
16724 !! wikitext
16725 * {{PAGENAME}}
16726 * {{PAGENAMEE}}
16727 * {{FULLPAGENAME}}
16728 * {{FULLPAGENAMEE}}
16729 * {{BASEPAGENAME}}
16730 * {{BASEPAGENAMEE}}
16731 * {{SUBPAGENAME}}
16732 * {{SUBPAGENAMEE}}
16733 * {{ROOTPAGENAME}}
16734 * {{ROOTPAGENAMEE}}
16735 * {{TALKPAGENAME}}
16736 * {{TALKPAGENAMEE}}
16737 * {{SUBJECTPAGENAME}}
16738 * {{SUBJECTPAGENAMEE}}
16739 * {{NAMESPACEE}}
16740 * {{NAMESPACE}}
16741 * {{NAMESPACENUMBER}}
16742 * {{TALKSPACE}}
16743 * {{TALKSPACEE}}
16744 * {{SUBJECTSPACE}}
16745 * {{SUBJECTSPACEE}}
16746 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16747 !! html
16748 <ul><li> Parser test</li>
16749 <li> Parser_test</li>
16750 <li> Parser test</li>
16751 <li> Parser_test</li>
16752 <li> Parser test</li>
16753 <li> Parser_test</li>
16754 <li> Parser test</li>
16755 <li> Parser_test</li>
16756 <li> Parser test</li>
16757 <li> Parser_test</li>
16758 <li> Talk:Parser test</li>
16759 <li> Talk:Parser_test</li>
16760 <li> Parser test</li>
16761 <li> Parser_test</li>
16762 <li> </li>
16763 <li> </li>
16764 <li> 0</li>
16765 <li> Talk</li>
16766 <li> Talk</li>
16767 <li> </li>
16768 <li> </li>
16769 <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>
16770
16771 !! end
16772 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16773
16774 !! test
16775 Gallery
16776 !! wikitext
16777 <gallery>
16778 image1.png |
16779 image2.gif|||||
16780
16781 image3|
16782 image4 |300px| centre
16783 image5.svg| http://///////
16784 [[x|xx]]]]
16785 * image6
16786 </gallery>
16787 !! html
16788 <ul class="gallery mw-gallery-traditional">
16789 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16790 <div class="thumb" style="height: 150px;">Image1.png</div>
16791 <div class="gallerytext">
16792 </div>
16793 </div></li>
16794 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16795 <div class="thumb" style="height: 150px;">Image2.gif</div>
16796 <div class="gallerytext">
16797 <p>||||
16798 </p>
16799 </div>
16800 </div></li>
16801 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16802 <div class="thumb" style="height: 150px;">Image3</div>
16803 <div class="gallerytext">
16804 </div>
16805 </div></li>
16806 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16807 <div class="thumb" style="height: 150px;">Image4</div>
16808 <div class="gallerytext">
16809 <p>300px| centre
16810 </p>
16811 </div>
16812 </div></li>
16813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16814 <div class="thumb" style="height: 150px;">Image5.svg</div>
16815 <div class="gallerytext">
16816 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16817 </p>
16818 </div>
16819 </div></li>
16820 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16821 <div class="thumb" style="height: 150px;">* image6</div>
16822 <div class="gallerytext">
16823 </div>
16824 </div></li>
16825 </ul>
16826
16827 !! end
16828
16829 !! test
16830 Gallery (with options)
16831 !! wikitext
16832 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16833 File:Nonexistent.jpg|caption
16834 File:Nonexistent.jpg
16835 image:foobar.jpg|some '''caption''' [[Main Page]]
16836 image:foobar.jpg
16837 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16838 </gallery>
16839 !! html
16840 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16841 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16842 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16843 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16844 <div class="gallerytext">
16845 <p>caption
16846 </p>
16847 </div>
16848 </div></li>
16849 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16850 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16851 <div class="gallerytext">
16852 </div>
16853 </div></li>
16854 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16855 <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>
16856 <div class="gallerytext">
16857 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16858 </p>
16859 </div>
16860 </div></li>
16861 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16862 <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>
16863 <div class="gallerytext">
16864 </div>
16865 </div></li>
16866 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16867 <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>
16868 <div class="gallerytext">
16869 <p>Blabla|blabla.
16870 </p>
16871 </div>
16872 </div></li>
16873 </ul>
16874
16875 !! end
16876
16877 !! test
16878 Gallery with link that has fragment
16879 !! wikitext
16880 <gallery>
16881 image:foobar.jpg|link=Main_Page
16882 image:foobar.jpg|link=Main_Page#section
16883 image:foobar.jpg|link=Main Page#section|caption
16884 </gallery>
16885 !! html
16886 <ul class="gallery mw-gallery-traditional">
16887 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16888 <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>
16889 <div class="gallerytext">
16890 </div>
16891 </div></li>
16892 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16893 <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>
16894 <div class="gallerytext">
16895 </div>
16896 </div></li>
16897 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16898 <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>
16899 <div class="gallerytext">
16900 <p>caption
16901 </p>
16902 </div>
16903 </div></li>
16904 </ul>
16905
16906 !! end
16907
16908 !! test
16909 Gallery with wikitext inside caption
16910 !! wikitext
16911 <gallery>
16912 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16913 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16914 </gallery>
16915 !! html
16916 <ul class="gallery mw-gallery-traditional">
16917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16918 <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>
16919 <div class="gallerytext">
16920 <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>
16921 </p>
16922 </div>
16923 </div></li>
16924 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16925 <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>
16926 <div class="gallerytext">
16927 <p>This is a test template
16928 </p>
16929 </div>
16930 </div></li>
16931 </ul>
16932
16933 !! end
16934
16935 !! test
16936 gallery (with showfilename option)
16937 !! wikitext
16938 <gallery showfilename>
16939 File:Nonexistent.jpg|caption
16940 File:Nonexistent.jpg
16941 image:foobar.jpg|some '''caption''' [[Main Page]]
16942 File:Foobar.jpg
16943 </gallery>
16944 !! html
16945 <ul class="gallery mw-gallery-traditional">
16946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16947 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16948 <div class="gallerytext">
16949 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16950 caption
16951 </p>
16952 </div>
16953 </div></li>
16954 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16955 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16956 <div class="gallerytext">
16957 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16958 </p>
16959 </div>
16960 </div></li>
16961 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16962 <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>
16963 <div class="gallerytext">
16964 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16965 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16966 </p>
16967 </div>
16968 </div></li>
16969 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16970 <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>
16971 <div class="gallerytext">
16972 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16973 </p>
16974 </div>
16975 </div></li>
16976 </ul>
16977
16978 !! end
16979
16980 !! test
16981 Gallery (with namespace-less filenames)
16982 !! wikitext
16983 <gallery>
16984 File:Nonexistent.jpg
16985 Nonexistent.jpg
16986 image:foobar.jpg
16987 foobar.jpg
16988 </gallery>
16989 !! html
16990 <ul class="gallery mw-gallery-traditional">
16991 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16992 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16993 <div class="gallerytext">
16994 </div>
16995 </div></li>
16996 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16997 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16998 <div class="gallerytext">
16999 </div>
17000 </div></li>
17001 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17002 <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>
17003 <div class="gallerytext">
17004 </div>
17005 </div></li>
17006 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17007 <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>
17008 <div class="gallerytext">
17009 </div>
17010 </div></li>
17011 </ul>
17012
17013 !! end
17014
17015 !! test
17016 HTML Hex character encoding (spells the word "JavaScript")
17017 !! options
17018 parsoid=wt2html,wt2wt,html2html
17019 !! wikitext
17020 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17021 !! html/php
17022 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17023 </p>
17024 !! html/php+tidy
17025 <p>JavaScript</p>
17026 !! html/parsoid
17027 <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>
17028 !! end
17029
17030 !! test
17031 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17032 !! wikitext
17033 &#xsee;&#XSEE;
17034 !! html/php
17035 <p>&amp;#xsee;&amp;#XSEE;
17036 </p>
17037 !! html/parsoid
17038 <p>&amp;#xsee;&amp;#XSEE;</p>
17039 !! end
17040
17041 !! test
17042 HTML Hex character encoding mixed case
17043 !! options
17044 parsoid=wt2html,wt2wt,html2html
17045 !! wikitext
17046 &#xEE;&#Xee;
17047 !! html/php
17048 <p>&#xee;&#xee;
17049 </p>
17050 !! html/php+tidy
17051 <p>îî</p>
17052 !! html/parsoid
17053 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17054 !! end
17055
17056 !! test
17057 __FORCETOC__ override
17058 !! wikitext
17059 __NEWSECTIONLINK__
17060 __FORCETOC__
17061 !! html
17062 <p><br />
17063 </p>
17064 !! end
17065
17066 !! test
17067 ISBN code coverage
17068 !! wikitext
17069 ISBN 978-0-1234-56&#x20;789
17070 !! html
17071 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17072 </p>
17073 !! html+tidy
17074 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17075 !! html/parsoid
17076 <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>
17077 !! end
17078
17079 !! test
17080 ISBN followed by 5 spaces
17081 !! wikitext
17082 ISBN
17083 !! html
17084 <p>ISBN
17085 </p>
17086 !! end
17087
17088 !! test
17089 Double ISBN
17090 !! wikitext
17091 ISBN ISBN 1234567890
17092 !! html/php
17093 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17094 </p>
17095 !! html/parsoid
17096 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17097 !! end
17098
17099 !! test
17100 ISBN with an X
17101 !! wikitext
17102 ISBN 3-462-04561-X
17103 ISBN 080442957X
17104 ISBN 978080442957X
17105 !! html/php
17106 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17107 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17108 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17109 </p>
17110 !! html/parsoid
17111 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17112 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17113 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17114 !! end
17115
17116 !! test
17117 ISBN with empty prefix (parsoid test)
17118 !! wikitext
17119 ISBN 1234567890
17120 !! html/php
17121 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17122 </p>
17123 !! html/parsoid
17124 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17125 !! end
17126
17127 !! test
17128 Bug 22905: <abbr> followed by ISBN followed by </a>
17129 !! wikitext
17130 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17131 !! html/php
17132 <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>
17133 </p>
17134 !! html/parsoid
17135 <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>
17136 !! end
17137
17138 !! test
17139 Double RFC
17140 !! wikitext
17141 RFC RFC 1234
17142 !! html
17143 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17144 </p>
17145 !! end
17146
17147 !! test
17148 Double RFC with a wiki link
17149 !! wikitext
17150 RFC [[RFC 1234]]
17151 !! html
17152 <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>
17153 </p>
17154 !! end
17155
17156 !! test
17157 RFC code coverage
17158 !! wikitext
17159 RFC 983&#x20;987
17160 !! html
17161 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17162 </p>
17163 !! html+tidy
17164 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17165 !! end
17166
17167 !! test
17168 Centre-aligned image
17169 !! wikitext
17170 [[Image:foobar.jpg|centre]]
17171 !! html
17172 <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>
17173
17174 !!end
17175
17176 !! test
17177 None-aligned image
17178 !! wikitext
17179 [[Image:foobar.jpg|none]]
17180 !! html
17181 <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>
17182
17183 !!end
17184
17185 !! test
17186 Width + Height sized image (using px) (height is ignored)
17187 !! wikitext
17188 [[Image:foobar.jpg|640x480px]]
17189 !! html
17190 <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>
17191 </p>
17192 !!end
17193
17194 !! test
17195 Width-sized image (using px, no following whitespace)
17196 !! wikitext
17197 [[Image:foobar.jpg|640px]]
17198 !! html
17199 <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>
17200 </p>
17201 !!end
17202
17203 !! test
17204 Width-sized image (using px, with following whitespace - test regression from r39467)
17205 !! wikitext
17206 [[Image:foobar.jpg|640px ]]
17207 !! html
17208 <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>
17209 </p>
17210 !!end
17211
17212 !! test
17213 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17214 !! wikitext
17215 [[Image:foobar.jpg| 640px]]
17216 !! html
17217 <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>
17218 </p>
17219 !!end
17220
17221 !! test
17222 Image with page parameter
17223 !! options
17224 djvu
17225 !! wikitext
17226 [[File:LoremIpsum.djvu|page=2]]
17227 !! html/php
17228 <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>
17229 </p>
17230 !! html/parsoid
17231 <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>
17232 !! end
17233
17234 !! test
17235 Another italics / bold test
17236 !! wikitext
17237 ''' ''x'
17238 !! html
17239 <pre>'<i> </i>x'
17240 </pre>
17241 !!end
17242
17243 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17244 !! test
17245 dt/dd/dl test
17246 !! wikitext
17247 :;;;::
17248 !! html/php
17249 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17250
17251 !! html/parsoid
17252 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17253
17254 !!end
17255
17256
17257 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17258 !! test
17259 Images with the "|" character in the comment
17260 !! wikitext
17261 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17262 !! html/php
17263 <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>
17264
17265 !! html/parsoid
17266 <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>
17267 !! end
17268
17269 !! test
17270 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17271 !! wikitext
17272 <html><script>alert(1);</script></html>
17273 !! html
17274 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17275 </p>
17276 !! end
17277
17278 !! test
17279 HTML with raw HTML ($wgRawHtml==true)
17280 !! options
17281 wgRawHtml=1
17282 !! wikitext
17283 <html><script>alert(1);</script></html>
17284 !! html
17285 <p><script>alert(1);</script>
17286 </p>
17287 !! end
17288
17289 !! test
17290 Parents of subpages, one level up
17291 !! options
17292 subpage title=[[Subpage test/L1/L2/L3]]
17293 !! wikitext
17294 [[../|L2]]
17295 !! html
17296 <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>
17297 </p>
17298 !! end
17299
17300
17301 !! test
17302 Parents of subpages, one level up, not named
17303 !! options
17304 subpage title=[[Subpage test/L1/L2/L3]]
17305 !! wikitext
17306 [[../]]
17307 !! html
17308 <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>
17309 </p>
17310 !! end
17311
17312
17313
17314 !! test
17315 Parents of subpages, two levels up
17316 !! options
17317 subpage title=[[Subpage test/L1/L2/L3]]
17318 !! wikitext
17319 [[../../|L1]]2
17320
17321 [[../../|L1]]l
17322 !! html
17323 <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
17324 </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>
17325 </p>
17326 !! end
17327
17328 !! test
17329 Parents of subpages, two levels up, without trailing slash or name.
17330 !! options
17331 subpage title=[[Subpage test/L1/L2/L3]]
17332 !! wikitext
17333 [[../..]]
17334 !! html
17335 <p>[[../..]]
17336 </p>
17337 !! end
17338
17339 !! test
17340 Parents of subpages, two levels up, with lots of extra trailing slashes.
17341 !! options
17342 subpage title=[[Subpage test/L1/L2/L3]]
17343 !! wikitext
17344 [[../../////]]
17345 !! html
17346 <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>
17347 </p>
17348 !! end
17349
17350 !! article
17351 Subpage test/L1/L2/L3Sibling
17352 !! text
17353 Sibling article
17354 !! endarticle
17355
17356 !! test
17357 Transclusion of a sibling page (one level up)
17358 !! options
17359 subpage title=[[Subpage test/L1/L2/L3]]
17360 !! wikitext
17361 {{../L3Sibling}}
17362 !! html
17363 <p>Sibling article
17364 </p>
17365 !! end
17366
17367 !! test
17368 Transclusion of a child page
17369 !! options
17370 subpage title=[[Subpage test/L1/L2]]
17371 !! wikitext
17372 {{/L3Sibling}}
17373 !! html
17374 <p>Sibling article
17375 </p>
17376 !! end
17377
17378 !! test
17379 Non-transclusion because of too many up levels
17380 !! options
17381 subpage title=[[Subpage test/L1/L2/L3]]
17382 !! wikitext
17383 {{../../../../More than parent}}
17384 !! html
17385 <p>{{../../../../More than parent}}
17386 </p>
17387 !! end
17388
17389 !! test
17390 Definition list code coverage
17391 !! wikitext
17392 ; title : def
17393 ; title : def
17394 ;title: def
17395 !! html/php
17396 <dl><dt> title &#160;</dt>
17397 <dd> def</dd>
17398 <dt> title&#160;</dt>
17399 <dd> def</dd>
17400 <dt>title</dt>
17401 <dd> def</dd></dl>
17402
17403 !! html/parsoid
17404 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17405 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17406 <dt>title</dt><dd> def</dd></dl>
17407 !! end
17408
17409 !! test
17410 Don't fall for the self-closing div
17411 !! wikitext
17412 <div>hello world</div/>
17413 !! html
17414 <div>hello world</div>
17415
17416 !! end
17417
17418 !! test
17419 MSGNW magic word
17420 !! wikitext
17421 {{MSGNW:msg}}
17422 !! html
17423 <p>&#91;&#91;:Template:Msg&#93;&#93;
17424 </p>
17425 !! end
17426
17427 !! test
17428 RAW magic word
17429 !! wikitext
17430 {{RAW:QUERTY}}
17431 !! html
17432 <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>
17433 </p>
17434 !! end
17435
17436 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17437 !! test
17438 Always escape literal '>' in output, not just after '<'
17439 !! wikitext
17440 ><>
17441 !! html
17442 <p>&gt;&lt;&gt;
17443 </p>
17444 !! end
17445
17446 !! test
17447 Template caching
17448 !! wikitext
17449 {{Test}}
17450 {{Test}}
17451 !! html
17452 <p>This is a test template
17453 This is a test template
17454 </p>
17455 !! end
17456
17457
17458 !! article
17459 MediaWiki:Fake
17460 !! text
17461 ==header==
17462 !! endarticle
17463
17464 !! test
17465 Inclusion of !userCanEdit() content
17466 !! wikitext
17467 {{MediaWiki:Fake}}
17468 !! html
17469 <h2><a href="#header" class="mw-headline-anchor" aria-hidden="true" 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>
17470
17471 !! end
17472
17473
17474 !! test
17475 Out-of-order TOC heading levels
17476 !! wikitext
17477 ==2==
17478 ======6======
17479 ===3===
17480 =1=
17481 =====5=====
17482 ==2==
17483 !! html
17484 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17485 <ul>
17486 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17487 <ul>
17488 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17489 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17490 </ul>
17491 </li>
17492 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17493 <ul>
17494 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17495 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17496 </ul>
17497 </li>
17498 </ul>
17499 </div>
17500
17501 <h2><a href="#2" class="mw-headline-anchor" aria-hidden="true" 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>
17502 <h6><a href="#6" class="mw-headline-anchor" aria-hidden="true" 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>
17503 <h3><a href="#3" class="mw-headline-anchor" aria-hidden="true" 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>
17504 <h1><a href="#1" class="mw-headline-anchor" aria-hidden="true" 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>
17505 <h5><a href="#5" class="mw-headline-anchor" aria-hidden="true" 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>
17506 <h2><a href="#2_2" class="mw-headline-anchor" aria-hidden="true" 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>
17507
17508 !! end
17509
17510
17511 !! test
17512 ISBN with a dummy number
17513 !! wikitext
17514 ISBN ---
17515 !! html
17516 <p>ISBN ---
17517 </p>
17518 !! end
17519
17520
17521 !! test
17522 ISBN with space-delimited number
17523 !! wikitext
17524 ISBN 92 9017 032 8
17525 !! html
17526 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17527 </p>
17528 !! end
17529
17530
17531 !! test
17532 ISBN with multiple spaces, no number
17533 !! wikitext
17534 ISBN foo
17535 !! html
17536 <p>ISBN foo
17537 </p>
17538 !! end
17539
17540
17541 !! test
17542 ISBN length
17543 !! wikitext
17544 ISBN 123456789
17545
17546 ISBN 1234567890
17547
17548 ISBN 12345678901
17549 !! html
17550 <p>ISBN 123456789
17551 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17552 </p><p>ISBN 12345678901
17553 </p>
17554 !! end
17555
17556
17557 !! test
17558 ISBN with trailing year (bug 8110)
17559 !! wikitext
17560 ISBN 1-234-56789-0 - 2006
17561
17562 ISBN 1 234 56789 0 - 2006
17563 !! html
17564 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17565 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17566 </p>
17567 !! end
17568
17569
17570 !! test
17571 anchorencode
17572 !! wikitext
17573 {{anchorencode:foo bar©#%n}}
17574 !! html
17575 <p>foo_bar.C2.A9.23.25n
17576 </p>
17577 !! end
17578
17579 !! test
17580 anchorencode trims spaces
17581 !! wikitext
17582 {{anchorencode: __pretty__please__}}
17583 !! html
17584 <p>pretty_please
17585 </p>
17586 !! end
17587
17588 !! test
17589 anchorencode deals with links
17590 !! wikitext
17591 {{anchorencode: [[hello|world]] [[hi]]}}
17592 !! html
17593 <p>world_hi
17594 </p>
17595 !! end
17596
17597 !! test
17598 anchorencode deals with templates
17599 !! wikitext
17600 {{anchorencode: {{Foo}} }}
17601 !! html
17602 <p>FOO
17603 </p>
17604 !! end
17605
17606 !! test
17607 anchorencode encodes like the TOC generator: (bug 18431)
17608 !! wikitext
17609 === _ +:.3A%3A&&amp;]] ===
17610 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17611 __NOEDITSECTION__
17612 !! html
17613 <h3><a href="#.2B:.3A.253A.26.26.5D.5D" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17614 <p>.2B:.3A.253A.26.26.5D.5D
17615 </p>
17616 !! end
17617
17618 !! test
17619 Bug 6200: blockquotes and paragraph formatting
17620 !! wikitext
17621 <blockquote>
17622 foo
17623 </blockquote>
17624
17625 bar
17626
17627 baz
17628 !! html
17629 <blockquote>
17630 <p>foo
17631 </p>
17632 </blockquote>
17633 <p>bar
17634 </p>
17635 <pre>baz
17636 </pre>
17637 !! end
17638
17639 !! test
17640 Bug 8293: Use of center tag ruins paragraph formatting
17641 !! wikitext
17642 <center>
17643 foo
17644 </center>
17645
17646 bar
17647
17648 baz
17649 !! html
17650 <center>
17651 <p>foo
17652 </p>
17653 </center>
17654 <p>bar
17655 </p>
17656 <pre>baz
17657 </pre>
17658 !! end
17659
17660 !!test
17661 Parsing of overlapping (improperly nested) inline html tags
17662 !! wikitext
17663 <span><s>x</span></s>
17664 !! html/php
17665 <p><span><s>x&lt;/span&gt;</s></span>
17666 </p>
17667 !! html/parsoid
17668 <p><span><s>x</s></span>
17669 </p>
17670 !!end
17671
17672 ###
17673 ### Language variants related tests
17674 ###
17675 !! test
17676 Self-link in language variants
17677 !! options
17678 title=[[Dunav]] language=sr
17679 !! wikitext
17680 Both [[Dunav]] and [[Дунав]] are names for this river.
17681 !! html
17682 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17683 </p>
17684 !!end
17685
17686 !! article
17687 Дуна
17688 !! text
17689 content
17690 !! endarticle
17691
17692 !! test
17693 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17694 !! options
17695 title=[[Duna]] language=sr
17696 !! wikitext
17697 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17698 !! html
17699 <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.
17700 </p>
17701 !! end
17702
17703 !! test
17704 Link to a section of a variant of this title shouldn't be parsed as self-link
17705 !! options
17706 title=[[Duna]] language=sr
17707 !! wikitext
17708 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17709 !! html
17710 <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.
17711 </p>
17712 !! end
17713
17714 !! test
17715 Link to pages in language variants
17716 !! options
17717 language=sr
17718 !! wikitext
17719 Main Page can be written as [[Маин Паге]]
17720 !! html
17721 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17722 </p>
17723 !!end
17724
17725
17726 !! test
17727 Multiple links to pages in language variants
17728 !! options
17729 language=sr
17730 !! wikitext
17731 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17732 !! html
17733 <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>.
17734 </p>
17735 !!end
17736
17737
17738 !! test
17739 Simple template in language variants
17740 !! options
17741 language=sr
17742 !! wikitext
17743 {{тест}}
17744 !! html
17745 <p>This is a test template
17746 </p>
17747 !! end
17748
17749
17750 !! test
17751 Template with explicit namespace in language variants
17752 !! options
17753 language=sr
17754 !! wikitext
17755 {{Template:тест}}
17756 !! html
17757 <p>This is a test template
17758 </p>
17759 !! end
17760
17761
17762 !! test
17763 Basic test for template parameter in language variants
17764 !! options
17765 language=sr
17766 !! wikitext
17767 {{парамтест|param=foo}}
17768 !! html
17769 <p>This is a test template with parameter foo
17770 </p>
17771 !! end
17772
17773
17774 !! test
17775 Simple category in language variants
17776 !! options
17777 language=sr cat
17778 !! wikitext
17779 [[Category:МедиаWики Усер'с Гуиде]]
17780 !! html
17781 <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>
17782 !! end
17783
17784
17785 !! article
17786 Category:分类
17787 !! text
17788 blah
17789 !! endarticle
17790
17791 !! article
17792 Category:分類
17793 !! text
17794 blah
17795 !! endarticle
17796
17797 !! test
17798 Don't convert blue categorylinks to another variant (bug 33210)
17799 !! options
17800 language=zh cat
17801 !! wikitext
17802 [[A]][[Category:分类]]
17803 !! html
17804 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17805 !! end
17806
17807
17808 !! test
17809 Stripping -{}- tags (language variants)
17810 !! options
17811 language=sr
17812 !! wikitext
17813 Latin proverb: -{Ne nuntium necare}-
17814 !! html
17815 <p>Latin proverb: Ne nuntium necare
17816 </p>
17817 !! end
17818
17819
17820 !! test
17821 Prevent conversion with -{}- tags (language variants)
17822 !! options
17823 language=sr variant=sr-ec
17824 !! wikitext
17825 Latinski: -{Ne nuntium necare}-
17826 !! html
17827 <p>Латински: Ne nuntium necare
17828 </p>
17829 !! end
17830
17831
17832 !! test
17833 Prevent conversion of text with -{}- tags (language variants)
17834 !! options
17835 language=sr variant=sr-ec
17836 !! wikitext
17837 Latinski: -{Ne nuntium necare}-
17838 !! html
17839 <p>Латински: Ne nuntium necare
17840 </p>
17841 !! end
17842
17843
17844 !! test
17845 Prevent conversion of links with -{}- tags (language variants)
17846 !! options
17847 language=sr variant=sr-ec
17848 !! wikitext
17849 -{[[Main Page]]}-
17850 !! html
17851 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17852 </p>
17853 !! end
17854
17855
17856 !! test
17857 -{}- tags within headlines (within html for parserConvert())
17858 !! options
17859 language=sr variant=sr-ec
17860 !! wikitext
17861 == -{Naslov}- ==
17862 !! html
17863 <h2><a href="#-.7BNaslov.7D-" class="mw-headline-anchor" aria-hidden="true" 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>
17864
17865 !! end
17866
17867
17868 !! test
17869 Explicit definition of language variant alternatives
17870 !! options
17871 language=zh variant=zh-tw
17872 !! wikitext
17873 -{zh:China;zh-tw:Taiwan}-, not China
17874 !! html
17875 <p>Taiwan, not China
17876 </p>
17877 !! end
17878
17879
17880 !! test
17881 Conversion around HTML tags
17882 !! options
17883 language=sr variant=sr-ec
17884 !! wikitext
17885 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17886 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17887 !! html
17888 <p>
17889 <span title="ЛаCтин">ски</span>
17890 </p>
17891 !! end
17892
17893
17894 !! test
17895 Explicit session-wise language variant mapping (A flag and - flag)
17896 !! options
17897 language=zh variant=zh-tw
17898 !! wikitext
17899 Taiwan is not China.
17900 But -{A|zh:China;zh-tw:Taiwan}- is China,
17901 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17902 and -{China}- is China.
17903 !! html
17904 <p>Taiwan is not China.
17905 But Taiwan is Taiwan,
17906 (This should be stripped!)
17907 and China is China.
17908 </p>
17909 !! end
17910
17911 !! test
17912 Explicit session-wise language variant mapping (H flag for hide)
17913 !! options
17914 language=zh variant=zh-tw
17915 !! wikitext
17916 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17917 Taiwan is China.
17918 !! html
17919 <p>(This should be stripped!)
17920 Taiwan is Taiwan.
17921 </p>
17922 !! end
17923
17924 !! test
17925 Adding explicit conversion rule for title (T flag)
17926 !! options
17927 language=zh variant=zh-tw showtitle
17928 !! wikitext
17929 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17930 !! html
17931 Taiwan
17932 <p>Should be stripped!
17933 </p>
17934 !! end
17935
17936 !! test
17937 Testing that changing the language variant here in the tests actually works
17938 !! options
17939 language=zh variant=zh showtitle
17940 !! wikitext
17941 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17942 !! html
17943 China
17944 <p>Should be stripped!
17945 </p>
17946 !! end
17947
17948 !! test
17949 Recursive conversion of alt and title attrs shouldn't clear converter state
17950 !! options
17951 language=zh variant=zh-cn showtitle
17952 !! wikitext
17953 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17954 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17955 !! html
17956 China
17957 <p>
17958 Should be stripped<span title="Exclamation">!</span>
17959 </p>
17960 !! end
17961
17962 !! test
17963 Bug 24072: more test on conversion rule for title
17964 !! options
17965 language=zh variant=zh-tw showtitle
17966 !! wikitext
17967 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17968 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17969 !! html
17970 Taiwan
17971 <p>This should be stripped!
17972 This won't take interferes with the title rule.
17973 </p>
17974 !! end
17975
17976 !! test
17977 Partly disable title conversion if variant == main language code
17978 !! options
17979 language=zh variant=zh title=[[ZH]] showtitle
17980 !! wikitext
17981 -{T|zh-cn:CN;zh-tw:TW}-
17982 !! html
17983 ZH
17984 <p>
17985 </p>
17986 !! end
17987
17988 !! test
17989 Partly disable title conversion if variant == main language code, more
17990 !! options
17991 language=zh variant=zh title=[[ZH]] showtitle
17992 !! wikitext
17993 -{T|TW}-
17994 !! html
17995 ZH
17996 <p>
17997 </p>
17998 !! end
17999
18000 !! test
18001 Raw output of variant escape tags (R flag)
18002 !! options
18003 language=zh variant=zh-tw
18004 !! wikitext
18005 Raw: -{R|zh:China;zh-tw:Taiwan}-
18006 !! html
18007 <p>Raw: zh:China;zh-tw:Taiwan
18008 </p>
18009 !! end
18010
18011 !! test
18012 Nested using of manual convert syntax
18013 !! options
18014 language=zh variant=zh-hk
18015 !! wikitext
18016 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18017 !! html
18018 <p>Nested: Hello Hong Kong!
18019 </p>
18020 !! end
18021
18022 !! test
18023 Proper conversion of text in external links
18024 !! options
18025 language=sr variant=sr-ec
18026 !! wikitext
18027 http://www.google.com
18028 gopher://www.google.com
18029 [http://www.google.com http://www.google.com]
18030 [gopher://www.google.com gopher://www.google.com]
18031 [https://www.google.com irc://www.google.com]
18032 [ftp://www.google.com www.google.com/ftp://dir]
18033 [//www.google.com www.google.com]
18034 !! html
18035 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18036 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18037 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18038 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18039 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18040 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18041 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18042 </p>
18043 !! end
18044
18045 !! test
18046 Do not convert roman numbers to language variants
18047 !! options
18048 language=sr variant=sr-ec
18049 !! wikitext
18050 Fridrih IV je car.
18051 !! html
18052 <p>Фридрих IV је цар.
18053 </p>
18054 !! end
18055
18056 !! test
18057 Unclosed language converter markup "-{"
18058 !! options
18059 language=sr
18060 !! wikitext
18061 -{T|hello
18062 !! html
18063 <p>-{T|hello
18064 </p>
18065 !! end
18066
18067 !! test
18068 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18069 !! options
18070 language=sr
18071 !! wikitext
18072 -{R|=&gt;}-
18073 !! html
18074 <p>=&gt;
18075 </p>
18076 !!end
18077
18078 !! test
18079 Don't break link parsing if language converter markup is in the caption.
18080 !! options
18081 language=sr variant=sr-ec
18082 !! wikitext
18083 [[Main Page|-{R|main page}-]]
18084 !! html
18085 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18086 </p>
18087 !! end
18088
18089 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18090 !! test
18091 Don't break image parsing if language converter markup is in the caption.
18092 !! options
18093 language=sr
18094 !! wikitext
18095 [[File:Foobar.jpg|-{R|caption}-]]
18096 !! html/parsoid
18097 <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>
18098 </p>
18099 !! end
18100
18101 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18102 !! test
18103 Don't break list handling if language converter markup is in the item.
18104 !! options
18105 language=zh variant=zh-cn
18106 !! wikitext
18107 ;-{zh-cn:AAA;zh-tw:BBB}-
18108 !! html/php
18109 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18110
18111 !! html/parsoid
18112 <dl><dt>AAA
18113 </dt></dl>
18114 !! end
18115
18116 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18117 !! test
18118 Don't break table handling if language converter markup is in the cell.
18119 !! options
18120 language=sr variant=sr-ec
18121 !! wikitext
18122 {|
18123 |-
18124 | -{R|B}-
18125 |}
18126 !! html/php
18127 <table>
18128
18129 <tr>
18130 <td>Б}-
18131 </td></tr></table>
18132
18133 !! html/parsoid
18134 <table>
18135
18136 <tr>
18137 <td> B
18138 </td></tr></table>
18139
18140 !! end
18141
18142 !! test
18143 Bug 529: Uncovered bullet
18144 !! wikitext
18145 * Foo {{bullet}}
18146 !! html
18147 <ul><li> Foo </li>
18148 <li> Bar</li></ul>
18149
18150 !! end
18151
18152 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18153 # Templates in Wikipedia rely on this behavior, as tidy has always been
18154 # enabled there. These tests are normally run *without* tidy, so specify the
18155 # full output here.
18156 # To test realistic parsing behavior, apply a tidy-like transformation to both
18157 # the expected output and your parser's output.
18158 !! test
18159 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18160 !! wikitext
18161 ******* Foo {{bullet}}
18162 !! html
18163 <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>
18164 <li> Bar</li></ul>
18165
18166 !! end
18167
18168 !! test
18169 Bug 529: Uncovered table already at line-start
18170 !! wikitext
18171 x
18172
18173 {{table}}
18174 y
18175 !! html
18176 <p>x
18177 </p>
18178 <table>
18179 <tr>
18180 <td> 1 </td>
18181 <td> 2
18182 </td></tr>
18183 <tr>
18184 <td> 3 </td>
18185 <td> 4
18186 </td></tr></table>
18187 <p>y
18188 </p>
18189 !! end
18190
18191 !! test
18192 Bug 529: Uncovered bullet in parser function result
18193 !! wikitext
18194 * Foo {{lc:{{bullet}} }}
18195 !! html
18196 <ul><li> Foo </li>
18197 <li> bar</li></ul>
18198
18199 !! end
18200
18201 !! test
18202 Bug 5678: Double-parsed template argument
18203 !! wikitext
18204 {{lc:{{{1}}}|hello}}
18205 !! html
18206 <p>{{{1}}}
18207 </p>
18208 !! end
18209
18210 !! test
18211 Bug 5678: Double-parsed template invocation
18212 !! wikitext
18213 {{lc:{{paramtest {{!}} param = hello }} }}
18214 !! html
18215 <p>{{paramtest | param = hello }}
18216 </p>
18217 !! end
18218
18219 !! test
18220 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18221 !! options
18222 language=cs
18223 title=[[Main Page]]
18224 !! wikitext
18225 {{PRVNÍVELKÉ:ěščř}}
18226 {{prvnívelké:ěščř}}
18227 {{PRVNÍMALÉ:ěščř}}
18228 {{prvnímalé:ěščř}}
18229 {{MALÁ:ěščř}}
18230 {{malá:ěščř}}
18231 {{VELKÁ:ěščř}}
18232 {{velká:ěščř}}
18233 !! html
18234 <p>Ěščř
18235 Ěščř
18236 ěščř
18237 ěščř
18238 ěščř
18239 ěščř
18240 ĚŠČŘ
18241 ĚŠČŘ
18242 </p>
18243 !! end
18244
18245 !! test
18246 Morwen/13: Unclosed link followed by heading
18247 !! wikitext
18248 [[link
18249 ==heading==
18250 !! html
18251 <p>[[link
18252 </p>
18253 <h2><a href="#heading" class="mw-headline-anchor" aria-hidden="true" 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>
18254
18255 !! end
18256
18257 !! test
18258 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18259 !! wikitext
18260 {{foo|
18261 =heading=
18262 !! html
18263 <p>{{foo|
18264 </p>
18265 <h1><a href="#heading" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="heading">heading</span></h1>
18266
18267 !! end
18268
18269 !! test
18270 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18271 !! wikitext
18272 {{foo|
18273 ==heading==
18274 !! html
18275 <p>{{foo|
18276 </p>
18277 <h2><a href="#heading" class="mw-headline-anchor" aria-hidden="true" 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>
18278
18279 !! end
18280
18281 !! test
18282 Tildes in comments
18283 !! options
18284 pst
18285 !! wikitext
18286 <!-- ~~~~ -->
18287 !! html
18288 <!-- ~~~~ -->
18289 !! end
18290
18291 !! test
18292 Paragraphs inside divs (no extra line breaks)
18293 !! wikitext
18294 <div>Line one
18295
18296 Line two</div>
18297 !! html
18298 <div>Line one
18299 Line two</div>
18300
18301 !! end
18302
18303 !! test
18304 Paragraphs inside divs (extra line break on open)
18305 !! wikitext
18306 <div>
18307 Line one
18308
18309 Line two</div>
18310 !! html
18311 <div>
18312 <p>Line one
18313 </p>
18314 Line two</div>
18315
18316 !! end
18317
18318 !! test
18319 Paragraphs inside divs (extra line break on close)
18320 !! wikitext
18321 <div>Line one
18322
18323 Line two
18324 </div>
18325 !! html
18326 <div>Line one
18327 <p>Line two
18328 </p>
18329 </div>
18330
18331 !! end
18332
18333 !! test
18334 Paragraphs inside divs (extra line break on open and close)
18335 !! wikitext
18336 <div>
18337 Line one
18338
18339 Line two
18340 </div>
18341 !! html
18342 <div>
18343 <p>Line one
18344 </p><p>Line two
18345 </p>
18346 </div>
18347
18348 !! end
18349
18350 !! test
18351 Nesting tags, paragraphs on lines which begin with <div>
18352 !! wikitext
18353 <div></div><strong>A
18354 B</strong>
18355 !! html/php+tidy
18356 <p><strong>A</strong></p>
18357 <p><strong>B</strong></p>
18358 !! html/parsoid
18359 <div></div>
18360 <p><strong>A
18361 B</strong>
18362 </p>
18363 !! end
18364
18365 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18366 !! test
18367 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18368 !! wikitext
18369 <blockquote>Line one
18370
18371 Line two</blockquote>
18372 !! html
18373 <blockquote>Line one
18374 Line two</blockquote>
18375
18376 !! html+tidy
18377 <blockquote>
18378 <p>Line one Line two</p>
18379 </blockquote>
18380 !! end
18381
18382 !! test
18383 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18384 !! wikitext
18385 <blockquote>
18386 Line one
18387
18388 Line two</blockquote>
18389 !! html
18390 <blockquote>
18391 <p>Line one
18392 </p>
18393 Line two</blockquote>
18394
18395 !! html+tidy
18396 <blockquote>
18397 <p>Line one</p>
18398 Line two</blockquote>
18399 !! end
18400
18401 !! test
18402 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18403 !! wikitext
18404 <blockquote>Line one
18405
18406 Line two
18407 </blockquote>
18408 !! html
18409 <blockquote>Line one
18410 <p>Line two
18411 </p>
18412 </blockquote>
18413
18414 !! html+tidy
18415 <blockquote>
18416 <p>Line one</p>
18417 <p>Line two</p>
18418 </blockquote>
18419 !! end
18420
18421 !! test
18422 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18423 !! wikitext
18424 <blockquote>
18425 Line one
18426
18427 Line two
18428 </blockquote>
18429 !! html
18430 <blockquote>
18431 <p>Line one
18432 </p><p>Line two
18433 </p>
18434 </blockquote>
18435
18436 !! html+tidy
18437 <blockquote>
18438 <p>Line one</p>
18439 <p>Line two</p>
18440 </blockquote>
18441 !! end
18442
18443 !! test
18444 Paragraphs inside blockquotes/divs (no extra line breaks)
18445 !! wikitext
18446 <blockquote><div>Line one
18447
18448 Line two</div></blockquote>
18449 !! html
18450 <blockquote><div>Line one
18451 Line two</div></blockquote>
18452
18453 !! end
18454
18455 !! test
18456 Paragraphs inside blockquotes/divs (extra line break on open)
18457 !! wikitext
18458 <blockquote><div>
18459 Line one
18460
18461 Line two</div></blockquote>
18462 !! html
18463 <blockquote><div>
18464 <p>Line one
18465 </p>
18466 Line two</div></blockquote>
18467
18468 !! end
18469
18470 !! test
18471 Paragraphs inside blockquotes/divs (extra line break on close)
18472 !! wikitext
18473 <blockquote><div>Line one
18474
18475 Line two
18476 </div></blockquote>
18477 !! html
18478 <blockquote><div>Line one
18479 <p>Line two
18480 </p>
18481 </div></blockquote>
18482
18483 !! end
18484
18485 !! test
18486 Paragraphs inside blockquotes/divs (extra line break on open and close)
18487 !! wikitext
18488 <blockquote><div>
18489 Line one
18490
18491 Line two
18492 </div></blockquote>
18493 !! html
18494 <blockquote><div>
18495 <p>Line one
18496 </p><p>Line two
18497 </p>
18498 </div></blockquote>
18499
18500 !! end
18501
18502 !! test
18503 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18504 !! options
18505 wgLinkHolderBatchSize=0
18506 !! wikitext
18507 [[meatball:1]]
18508 [[meatball:2]]
18509 [[meatball:3]]
18510 !! html
18511 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18512 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18513 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18514 </p>
18515 !! end
18516
18517 !! test
18518 Free external link invading image caption
18519 !! wikitext
18520 [[Image:Foobar.jpg|thumb|http://x|hello]]
18521 !! html
18522 <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>
18523
18524 !! end
18525
18526 !! test
18527 Bug 15196: localised external link numbers
18528 !! options
18529 language=fa
18530 !! wikitext
18531 [http://en.wikipedia.org/]
18532 !! html/php
18533 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18534 </p>
18535 !! html/parsoid
18536 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18537 !! end
18538
18539 !! test
18540 Multibyte character in padleft
18541 !! wikitext
18542 {{padleft:-Hello|7|Æ}}
18543 !! html
18544 <p>Æ-Hello
18545 </p>
18546 !! end
18547
18548 !! test
18549 Multibyte character in padright
18550 !! wikitext
18551 {{padright:Hello-|7|Æ}}
18552 !! html
18553 <p>Hello-Æ
18554 </p>
18555 !! end
18556
18557 !!test
18558 formatdate parser function
18559 !! wikitext
18560 {{#formatdate:2009-03-24}}
18561 !! html
18562 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18563 </p>
18564 !! end
18565
18566 !!test
18567 formatdate parser function, with default format
18568 !! wikitext
18569 {{#formatdate:2009-03-24|mdy}}
18570 !! html
18571 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18572 </p>
18573 !! end
18574
18575 !! test
18576 Spacing of numbers in formatted dates
18577 !! wikitext
18578 {{#formatdate:January 15}}
18579 !! html
18580 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18581 </p>
18582 !! end
18583
18584 !! test
18585 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
18586 !! options
18587 language=nl title=[[MediaWiki:Common.css]]
18588 !! wikitext
18589 {{#formatdate:2009-03-24|dmy}}
18590 !! html
18591 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18592 </p>
18593 !! end
18594
18595 #
18596 #
18597 #
18598
18599 #
18600 # Edit comments
18601 #
18602
18603 !! test
18604 Edit comment with link
18605 !! options
18606 comment
18607 !! wikitext
18608 I like the [[Main Page]] a lot
18609 !! html
18610 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18611 !!end
18612
18613 !! test
18614 Edit comment with link and link text
18615 !! options
18616 comment
18617 !! wikitext
18618 I like the [[Main Page|best pages]] a lot
18619 !! html
18620 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18621 !!end
18622
18623 !! test
18624 Edit comment with link and link text with suffix
18625 !! options
18626 comment
18627 !! wikitext
18628 I like the [[Main Page|best page]]s a lot
18629 !! html
18630 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18631 !!end
18632
18633 !! test
18634 Edit comment with section link (non-local, eg in history list)
18635 !! options
18636 comment title=[[Main Page]]
18637 !! wikitext
18638 /* External links */ removed bogus entries
18639 !! html
18640 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18641 !!end
18642
18643 !! test
18644 Edit comment with section link and text before it (non-local, eg in history list)
18645 !! options
18646 comment title=[[Main Page]]
18647 !! wikitext
18648 pre-comment text /* External links */ removed bogus entries
18649 !! html
18650 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>
18651 !!end
18652
18653 !! test
18654 Edit comment with section link (local, eg in diff view)
18655 !! options
18656 comment local title=[[Main Page]]
18657 !! wikitext
18658 /* External links */ removed bogus entries
18659 !! html
18660 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18661 !!end
18662
18663 !! test
18664 Edit comment with subpage link (bug 14080)
18665 !! options
18666 comment
18667 subpage
18668 title=[[Subpage test]]
18669 !! wikitext
18670 Poked at a [[/subpage]] here...
18671 !! html
18672 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18673 !!end
18674
18675 !! test
18676 Edit comment with subpage link and link text (bug 14080)
18677 !! options
18678 comment
18679 subpage
18680 title=[[Subpage test]]
18681 !! wikitext
18682 Poked at a [[/subpage|neat little page]] here...
18683 !! html
18684 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18685 !!end
18686
18687 !! test
18688 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18689 !! options
18690 comment
18691 title=[[Subpage test]]
18692 !! wikitext
18693 Poked at a [[/subpage]] here...
18694 !! html
18695 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...
18696 !!end
18697
18698 !! test
18699 Edit comment with bare anchor link (local, as on diff)
18700 !! options
18701 comment
18702 local
18703 title=[[Main Page]]
18704 !! wikitext
18705 [[#section]]
18706 !! html
18707 <a href="#section">#section</a>
18708 !! end
18709
18710 !! test
18711 Edit comment with bare anchor link (non-local, as on history)
18712 !! options
18713 comment
18714 title=[[Main Page]]
18715 !! wikitext
18716 [[#section]]
18717 !! html
18718 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18719 !! end
18720
18721 !! test
18722 Anchor starting with underscore
18723 !! wikitext
18724 [[#_ref|One]]
18725 !! html
18726 <p><a href="#_ref">One</a>
18727 </p>
18728 !! end
18729
18730 !! test
18731 Id starting with underscore
18732 !! wikitext
18733 <div id="_ref"></div>
18734 !! html
18735 <div id="_ref"></div>
18736
18737 !! end
18738
18739 !! test
18740 Space normalisation on autocomment (bug 22784)
18741 !! options
18742 comment
18743 title=[[Main Page]]
18744 !! wikitext
18745 /* __hello__world__ */
18746 !! html
18747 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18748 !! end
18749
18750 !! test
18751 percent-encoding and + signs in comments (Bug 26410)
18752 !! options
18753 comment
18754 !! wikitext
18755 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18756 !! html
18757 <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>
18758 !! end
18759
18760 # Parsoid doesn't support this yet: see bug 73581
18761 # but it *should* omit the 'src' attribute if the image is bad.
18762 # PHP side of tests was disabled in
18763 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18764 # because of issues in the PHP parserTests infrastructure
18765 # (but the output below is indeed what the PHP side emits)
18766 !! test
18767 Bad images - basic functionality
18768 !! wikitext
18769 [[File:Bad.jpg]]
18770 !! DISABLED/html/php
18771 !! html/parsoid
18772 <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>
18773 !! end
18774
18775 !! test
18776 Bad images - bug 16039: text after bad image disappears
18777 !! wikitext
18778 Foo bar
18779 [[File:Bad.jpg]]
18780 Bar foo
18781 !! DISABLED/html/php
18782 <p>Foo bar
18783 </p><p>Bar foo
18784 </p>
18785 !! html/parsoid
18786 <p>Foo bar
18787 <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>
18788 Bar foo</p>
18789 !! end
18790
18791 !! test
18792 Verify that displaytitle works (bug #22501) no displaytitle
18793 !! options
18794 showtitle
18795 !! config
18796 wgAllowDisplayTitle=true
18797 wgRestrictDisplayTitle=false
18798 !! wikitext
18799 this is not the the title
18800 !! html
18801 Parser test
18802 <p>this is not the the title
18803 </p>
18804 !! end
18805
18806 !! test
18807 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18808 !! options
18809 showtitle
18810 title=[[Screen]]
18811 !! config
18812 wgAllowDisplayTitle=true
18813 wgRestrictDisplayTitle=false
18814 !! wikitext
18815 this is not the the title
18816 {{DISPLAYTITLE:whatever}}
18817 !! html
18818 whatever
18819 <p>this is not the the title
18820 </p>
18821 !! end
18822
18823 !! test
18824 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18825 !! options
18826 showtitle
18827 title=[[Screen]]
18828 !! config
18829 wgAllowDisplayTitle=true
18830 wgRestrictDisplayTitle=true
18831 !! wikitext
18832 this is not the the title
18833 {{DISPLAYTITLE:whatever}}
18834 !! html
18835 Screen
18836 <p>this is not the the title
18837 </p>
18838 !! end
18839
18840 !! test
18841 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18842 !! options
18843 showtitle
18844 title=[[Screen]]
18845 !! config
18846 wgAllowDisplayTitle=true
18847 wgRestrictDisplayTitle=true
18848 !! wikitext
18849 this is not the the title
18850 {{DISPLAYTITLE:screen}}
18851 !! html
18852 screen
18853 <p>this is not the the title
18854 </p>
18855 !! end
18856
18857 !! test
18858 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18859 !! options
18860 showtitle
18861 title=[[Screen]]
18862 !! config
18863 wgAllowDisplayTitle=false
18864 !! wikitext
18865 this is not the the title
18866 {{DISPLAYTITLE:screen}}
18867 !! html
18868 Screen
18869 <p>this is not the the title
18870 <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>
18871 </p>
18872 !! end
18873
18874 !! test
18875 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18876 !! options
18877 showtitle
18878 title=[[Screen]]
18879 !! config
18880 wgAllowDisplayTitle=false
18881 !! wikitext
18882 this is not the the title
18883 !! html
18884 Screen
18885 <p>this is not the the title
18886 </p>
18887 !! end
18888
18889 !! test
18890 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18891 !! options
18892 showtitle
18893 title=[[Screen]]
18894 !! config
18895 wgAllowDisplayTitle=true
18896 wgRestrictDisplayTitle=true
18897 !! wikitext
18898 this is not the the title
18899 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18900 !! html
18901 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18902 <p>this is not the the title
18903 </p>
18904 !! end
18905
18906 !! test
18907 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18908 !! options
18909 showtitle
18910 title=[[Screen]]
18911 !! config
18912 wgAllowDisplayTitle=true
18913 wgRestrictDisplayTitle=true
18914 !! wikitext
18915 this is not the the title
18916 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18917 !! html
18918 <span style="color: red;">s</span>creen
18919 <p>this is not the the title
18920 </p>
18921 !! end
18922
18923 !! test
18924 preload: check <noinclude> and <includeonly>
18925 !! options
18926 preload
18927 !! wikitext
18928 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18929 !! html
18930 Hello kind world.
18931 !! end
18932
18933 !! test
18934 preload: check <onlyinclude>
18935 !! options
18936 preload
18937 !! wikitext
18938 Goodbye <onlyinclude>Hello world</onlyinclude>
18939 !! html
18940 Hello world
18941 !! end
18942
18943 !! test
18944 preload: can pass tags through if we want to
18945 !! options
18946 preload
18947 !! wikitext
18948 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18949 !! html
18950 <includeonly>Hello world</includeonly>
18951 !! end
18952
18953 !! test
18954 preload: check that it doesn't try to do tricks
18955 !! options
18956 preload
18957 !! wikitext
18958 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18959 !! html
18960 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18961 !! end
18962
18963 !! test
18964 Play a bit with r67090 and bug 3158
18965 !! wikitext
18966 <div style="width:50% !important">&nbsp;</div>
18967 <div style="width:50%&nbsp;!important">&nbsp;</div>
18968 <div style="width:50%&#160;!important">&nbsp;</div>
18969 <div style="border : solid;">&nbsp;</div>
18970 !! html/php
18971 <div style="width:50% !important">&#160;</div>
18972 <div style="width:50% !important">&#160;</div>
18973 <div style="width:50% !important">&#160;</div>
18974 <div style="border&#160;: solid;">&#160;</div>
18975
18976 !! html/parsoid
18977 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18978 <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>
18979 <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>
18980 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18981
18982 !! end
18983
18984 !! test
18985 HTML5 data attributes
18986 !! wikitext
18987 <span data-foo="bar">Baz</span>
18988 <p data-abc-def_hij="">Quuz</p>
18989 !! html
18990 <p><span data-foo="bar">Baz</span>
18991 </p>
18992 <p data-abc-def_hij="">Quuz</p>
18993
18994 !! end
18995
18996 !! test
18997 percent-encoding and + signs in internal links (Bug 26410)
18998 !! wikitext
18999 [[User:+%]] [[Page+title%]]
19000 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19001 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19002 [[%33%45]] [[%33%45+]]
19003 !! html/php
19004 <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>
19005 <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>
19006 <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>
19007 <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>
19008 </p>
19009 !! html/parsoid
19010 <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>
19011 !! end
19012
19013 !! test
19014 Special characters in embedded file links (bug 27679)
19015 !! wikitext
19016 [[File:Contains & ampersand.jpg]]
19017 [[File:Does not exist.jpg|Title with & ampersand]]
19018 !! html/php
19019 <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>
19020 <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>
19021 </p>
19022 !! html/parsoid
19023 <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>
19024 <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>
19025 !! end
19026
19027 !! test
19028 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19029 !! wikitext
19030 Text&apos;s been normalized?
19031 !! html
19032 <p>Text&#39;s been normalized?
19033 </p>
19034 !! end
19035
19036 !! test
19037 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19038 !! wikitext
19039 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19040 !! html
19041 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19042 </p>
19043 !! end
19044
19045 !! test
19046 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19047 !! wikitext
19048 [http://www.example.org/ ideograms]
19049 !! html
19050 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19051 </p>
19052 !! end
19053
19054 !! test
19055 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19056 !! wikitext
19057 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19058 !! html
19059 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19060 </p>
19061 !! end
19062
19063 !! article
19064 Mediawiki:loop1
19065 !! text
19066 {{Identical|A}}
19067 !! endarticle
19068
19069 !! article
19070 Mediawiki:loop2
19071 !! text
19072 {{Identical|B}}
19073 !! endarticle
19074
19075 !! article
19076 Template:Identical
19077 !! text
19078 {{int:loop1}}
19079 {{int:loop2}}
19080 !! endarticle
19081
19082 !! test
19083 Bug 31098 Template which includes system messages which includes the template
19084 !! wikitext
19085 {{Identical}}
19086 !! html
19087 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19088 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19089 </p>
19090 !! end
19091
19092 !! test
19093 Bug31490 Turkish: ucfirst 'blah'
19094 !! options
19095 language=tr
19096 !! wikitext
19097 {{ucfirst:blah}}
19098 !! html
19099 <p>Blah
19100 </p>
19101 !! end
19102
19103 !! test
19104 Bug31490 Turkish: ucfirst 'ix'
19105 !! options
19106 language=tr
19107 !! wikitext
19108 {{ucfirst:ix}}
19109 !! html
19110 <p>İx
19111 </p>
19112 !! end
19113
19114 !! test
19115 Bug31490 Turkish: lcfirst 'BLAH'
19116 !! options
19117 language=tr
19118 !! wikitext
19119 {{lcfirst:BLAH}}
19120 !! html
19121 <p>bLAH
19122 </p>
19123 !! end
19124
19125 !! test
19126 Bug31490 Turkish: ucfırst (with a dotless i)
19127 !! options
19128 language=tr
19129 !! wikitext
19130 {{ucfırst:blah}}
19131 !! html
19132 <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>
19133 </p>
19134 !! end
19135
19136 !! test
19137 Bug31490 ucfırst (with a dotless i) with English language
19138 !! options
19139 language=en
19140 !! wikitext
19141 {{ucfırst:blah}}
19142 !! html
19143 <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>
19144 </p>
19145 !! end
19146
19147 !! test
19148 Bug 26375: TOC with italics
19149 !! options
19150 title=[[Main Page]]
19151 !! wikitext
19152 __TOC__
19153 == ''Lost'' episodes ==
19154 !! html
19155 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19156 <ul>
19157 <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>
19158 </ul>
19159 </div>
19160
19161 <h2><a href="#Lost_episodes" class="mw-headline-anchor" aria-hidden="true" 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>
19162
19163 !! end
19164
19165 !! test
19166 Bug 26375: TOC with bold
19167 !! options
19168 title=[[Main Page]]
19169 !! wikitext
19170 __TOC__
19171 == '''should be bold''' then normal text ==
19172 !! html
19173 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19174 <ul>
19175 <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>
19176 </ul>
19177 </div>
19178
19179 <h2><a href="#should_be_bold_then_normal_text" class="mw-headline-anchor" aria-hidden="true" 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>
19180
19181 !! end
19182
19183 !! test
19184 Bug 33845: Headings become cursive in TOC when they contain an image
19185 !! options
19186 title=[[Main Page]]
19187 !! wikitext
19188 __TOC__
19189 == Image [[Image:foobar.jpg]] ==
19190 !! html
19191 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19192 <ul>
19193 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19194 </ul>
19195 </div>
19196
19197 <h2><a href="#Image" class="mw-headline-anchor" aria-hidden="true" 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>
19198
19199 !! end
19200
19201 !! test
19202 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19203 !! options
19204 title=[[Main Page]]
19205 !! wikitext
19206 __TOC__
19207 == <blockquote>Quote</blockquote> ==
19208 !! html
19209 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19210 <ul>
19211 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19212 </ul>
19213 </div>
19214
19215 <h2><a href="#Quote" class="mw-headline-anchor" aria-hidden="true" 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>
19216
19217 !! html+tidy
19218 <p></p>
19219 <div id="toc" class="toc">
19220 <div id="toctitle">
19221 <h2>Contents</h2>
19222 </div>
19223 <ul>
19224 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19225 </ul>
19226 </div>
19227 <p></p>
19228 <h2><a href="#Quote" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Quote"></span></h2>
19229 <blockquote>
19230 <p><span class="mw-headline" id="Quote">Quote</span></p>
19231 </blockquote>
19232 <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>
19233 !! end
19234
19235 !! test
19236 Unclosed tags in TOC
19237 !! options
19238 title=[[Main Page]]
19239 !! wikitext
19240 __TOC__
19241 == Proof: 2 < 3 ==
19242 <small>Hanc marginis exiguitas non caperet.</small>
19243 QED
19244 !! html
19245 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19246 <ul>
19247 <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>
19248 </ul>
19249 </div>
19250
19251 <h2><a href="#Proof:_2_.3C_3" class="mw-headline-anchor" aria-hidden="true" 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>
19252 <p><small>Hanc marginis exiguitas non caperet.</small>
19253 QED
19254 </p>
19255 !! end
19256
19257 !! test
19258 Multiple tags in TOC
19259 !! wikitext
19260 __TOC__
19261 == <i>Foo</i> <b>Bar</b> ==
19262
19263 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19264 !! html
19265 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19266 <ul>
19267 <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>
19268 <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>
19269 </ul>
19270 </div>
19271
19272 <h2><a href="#Foo_Bar" class="mw-headline-anchor" aria-hidden="true" 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>
19273 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" aria-hidden="true" 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>
19274
19275 !! html+tidy
19276 <p></p>
19277 <div id="toc" class="toc">
19278 <div id="toctitle">
19279 <h2>Contents</h2>
19280 </div>
19281 <ul>
19282 <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>
19283 <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>
19284 </ul>
19285 </div>
19286 <p></p>
19287 <h2><a href="#Foo_Bar" class="mw-headline-anchor" aria-hidden="true" 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>
19288 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19289 <blockquote>
19290 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19291 </blockquote>
19292 <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>
19293 !! end
19294
19295 !! test
19296 Tags with parameters in TOC
19297 !! wikitext
19298 __TOC__
19299 == <sup class="in-h2">Hello</sup> ==
19300
19301 == <sup class="a > b">Evilbye</sup> ==
19302 !! html
19303 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19304 <ul>
19305 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19306 <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>
19307 </ul>
19308 </div>
19309
19310 <h2><a href="#Hello" class="mw-headline-anchor" aria-hidden="true" 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>
19311 <h2><a href="#b.22.3EEvilbye" class="mw-headline-anchor" aria-hidden="true" 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>
19312
19313 !! end
19314
19315 !! test
19316 span tags with directionality in TOC
19317 !! wikitext
19318 __TOC__
19319 == <span dir="ltr">C++</span> ==
19320
19321 == <span dir="rtl">זבנג!</span> ==
19322
19323 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19324
19325 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19326
19327 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19328 !! html
19329 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19330 <ul>
19331 <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>
19332 <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>
19333 <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>
19334 <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>
19335 <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>
19336 </ul>
19337 </div>
19338
19339 <h2><a href="#C.2B.2B" class="mw-headline-anchor" aria-hidden="true" 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>
19340 <h2><a href="#.D7.96.D7.91.D7.A0.D7.92.21" class="mw-headline-anchor" aria-hidden="true" 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>
19341 <h2><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" aria-hidden="true" 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>
19342 <h2><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" aria-hidden="true" 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>
19343 <h2><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" aria-hidden="true" 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>
19344
19345 !! end
19346
19347 !! test
19348 Bug 72884: bdi element in ToC
19349 !! wikitext
19350 __TOC__
19351 == <bdi>test</bdi> ==
19352 !! html
19353 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19354 <ul>
19355 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19356 </ul>
19357 </div>
19358
19359 <h2><a href="#test" class="mw-headline-anchor" aria-hidden="true" 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>
19360
19361 !! end
19362
19363 # Note that the html output does not have the <p></p>, but the
19364 # html+tidy output *does*. This is because the empty <p></p> is
19365 # removed by the sanitizer, but only when tidy is *not* enabled (!).
19366 !! test
19367 Empty <p> tag in TOC, removed by Sanitizer (T92892)
19368 !! wikitext
19369 __TOC__
19370 == x ==
19371 !! html
19372 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19373 <ul>
19374 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19375 </ul>
19376 </div>
19377
19378 <h2><a href="#x" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19379
19380 !! html+tidy
19381 <p></p>
19382 <div id="toc" class="toc">
19383 <div id="toctitle">
19384 <h2>Contents</h2>
19385 </div>
19386 <ul>
19387 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19388 </ul>
19389 </div>
19390 <p></p>
19391 <h2><a href="#x" class="mw-headline-anchor" aria-hidden="true" title="Link to this section">§</a><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19392 !! end
19393
19394 !! article
19395 MediaWiki:Bug32057
19396 !! text
19397 == {{int:headline_sample}} ==
19398 !! endarticle
19399
19400 !! test
19401 Bug 32057: Title needed when expanding <h> nodes.
19402 !! options
19403 title=[[Main Page]]
19404 !! wikitext
19405 {{int:Bug32057}}
19406 !! html
19407 <h2><a href="#Headline_text" class="mw-headline-anchor" aria-hidden="true" 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>
19408
19409 !! end
19410
19411 !! test
19412 Strip marker in urlencode
19413 !! wikitext
19414 {{urlencode:x<nowiki/>y}}
19415 {{urlencode:x<nowiki/>y|wiki}}
19416 {{urlencode:x<nowiki/>y|path}}
19417 !! html
19418 <p>xy
19419 xy
19420 xy
19421 </p>
19422 !! end
19423
19424 !! test
19425 Strip marker in lc
19426 !! wikitext
19427 {{lc:x<nowiki/>y}}
19428 !! html
19429 <p>xy
19430 </p>
19431 !! end
19432
19433 !! test
19434 Strip marker in uc
19435 !! wikitext
19436 {{uc:x<nowiki/>y}}
19437 !! html
19438 <p>XY
19439 </p>
19440 !! end
19441
19442 !! test
19443 Strip marker in formatNum
19444 !! wikitext
19445 {{formatnum:1<nowiki/>2}}
19446 {{formatnum:1<nowiki/>2|R}}
19447 !! html
19448 <p>12
19449 12
19450 </p>
19451 !! end
19452
19453 !! test
19454 Check noCommafy in formatNum
19455 !! options
19456 language=be-tarask
19457 !! wikitext
19458 {{formatnum:123456.78}}
19459 {{formatnum:123456.78|NOSEP}}
19460 !! html
19461 <p>123 456,78
19462 123456.78
19463 </p>
19464 !! end
19465
19466 !! test
19467 Wrong option for formatNum (bug 56199)
19468 !! wikitext
19469 {{formatnum:1,234.56|Random}}
19470 {{formatnum:1,234.56|EVERYTHING}}
19471 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19472 !! html
19473 <p>1,234.56
19474 1,234.56
19475 1,234.56
19476 </p>
19477 !! end
19478
19479 !! test
19480 Strip marker in grammar
19481 !! options
19482 language=fi
19483 !! wikitext
19484 {{grammar:elative|foo<nowiki/>bar}}
19485 !! html
19486 <p>foobarista
19487 </p>
19488 !! end
19489
19490 !! test
19491 Strip marker in padleft
19492 !! wikitext
19493 {{padleft:|2|x<nowiki/>y}}
19494 !! html
19495 <p>xy
19496 </p>
19497 !! end
19498
19499 !! test
19500 Strip marker in padright
19501 !! wikitext
19502 {{padright:|2|x<nowiki/>y}}
19503 !! html
19504 <p>xy
19505 </p>
19506 !! end
19507
19508 !! test
19509 Strip marker in anchorencode
19510 !! wikitext
19511 {{anchorencode:x<nowiki/>y}}
19512 !! html
19513 <p>xy
19514 </p>
19515 !! end
19516
19517 !! test
19518 nowiki inside link inside heading (bug 18295)
19519 !! wikitext
19520 ==[[foo|x<nowiki>y</nowiki>z]]==
19521 !! html
19522 <h2><a href="#xyz" class="mw-headline-anchor" aria-hidden="true" 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>
19523
19524 !! end
19525
19526 !! test
19527 new support for bdi element (bug 31817)
19528 !! wikitext
19529 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19530 !! html
19531 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19532
19533 !!end
19534
19535 !! test
19536 Ignore pipe between table row attributes
19537 !! wikitext
19538 {|
19539 | quux
19540 |- id=foo | style='color: red'
19541 | bar
19542 |}
19543 !! html
19544 <table>
19545 <tr>
19546 <td> quux
19547 </td></tr>
19548 <tr id="foo" style="color: red">
19549 <td> bar
19550 </td></tr></table>
19551
19552 !! end
19553
19554 !!test
19555 Gallery override link with WikiLink (bug 34852)
19556 !! wikitext
19557 <gallery>
19558 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19559 </gallery>
19560 !! html
19561 <ul class="gallery mw-gallery-traditional">
19562 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19563 <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>
19564 <div class="gallerytext">
19565 <p>caption
19566 </p>
19567 </div>
19568 </div></li>
19569 </ul>
19570
19571 !! end
19572
19573 !!test
19574 Gallery override link with absolute external link (bug 34852)
19575 !! wikitext
19576 <gallery>
19577 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19578 </gallery>
19579 !! html
19580 <ul class="gallery mw-gallery-traditional">
19581 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19582 <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>
19583 <div class="gallerytext">
19584 <p>caption
19585 </p>
19586 </div>
19587 </div></li>
19588 </ul>
19589
19590 !! end
19591
19592 !!test
19593 Gallery override link with malicious javascript (bug 34852)
19594 !! wikitext
19595 <gallery>
19596 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19597 </gallery>
19598 !! html
19599 <ul class="gallery mw-gallery-traditional">
19600 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19601 <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>
19602 <div class="gallerytext">
19603 <p>caption
19604 </p>
19605 </div>
19606 </div></li>
19607 </ul>
19608
19609 !! end
19610
19611 !!test
19612 Gallery with invalid title as link (bug 43964)
19613 !! wikitext
19614 <gallery>
19615 File:foobar.jpg|link=<
19616 </gallery>
19617 !! html
19618 <ul class="gallery mw-gallery-traditional">
19619 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19620 <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>
19621 <div class="gallerytext">
19622 </div>
19623 </div></li>
19624 </ul>
19625
19626 !! end
19627
19628 !!test
19629 Language parser function
19630 !! wikitext
19631 {{#language:ar}}
19632 !! html
19633 <p>العربية
19634 </p>
19635 !! end
19636
19637 !!test
19638 Padleft and padright as substr
19639 !! wikitext
19640 {{padleft:|3|abcde}}
19641 {{padright:|3|abcde}}
19642 !! html
19643 <p>abc
19644 abc
19645 </p>
19646 !! end
19647
19648 !!test
19649 Special parser function
19650 !! wikitext
19651 {{#special:RandomPage}}
19652 {{#special:BaDtItLe}}
19653 {{#special:Foobar}}
19654 !! html
19655 <p>Special:Random
19656 Special:Badtitle
19657 Special:Foobar
19658 </p>
19659 !! end
19660
19661 !!test
19662 Bug 34939 - Case insensitive link parsing ([HttP://])
19663 !! wikitext
19664 [HttP://MediaWiki.Org/]
19665 !! html/php
19666 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19667 </p>
19668 !! html/parsoid
19669 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19670 !! end
19671
19672 !!test
19673 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19674 !! wikitext
19675 [HttP://MediaWiki.Org/ MediaWiki]
19676 !! html
19677 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19678 </p>
19679 !! end
19680
19681 !!test
19682 Bug 34939 - Case insensitive link parsing (HttP://)
19683 !! wikitext
19684 HttP://MediaWiki.Org/
19685 !! html/php
19686 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19687 </p>
19688 !! html/parsoid
19689 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19690 !! end
19691
19692 !!test
19693 Disable TOC
19694 !! options
19695 notoc
19696 !! wikitext
19697 Lead
19698 == Section 1 ==
19699 == Section 2 ==
19700 == Section 3 ==
19701 == Section 4 ==
19702 == Section 5 ==
19703 !! html
19704 <p>Lead
19705 </p>
19706
19707 <h2><a href="#Section_1" class="mw-headline-anchor" aria-hidden="true" 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>
19708 <h2><a href="#Section_2" class="mw-headline-anchor" aria-hidden="true" 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>
19709 <h2><a href="#Section_3" class="mw-headline-anchor" aria-hidden="true" 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>
19710 <h2><a href="#Section_4" class="mw-headline-anchor" aria-hidden="true" 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>
19711 <h2><a href="#Section_5" class="mw-headline-anchor" aria-hidden="true" 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>
19712
19713 !! end
19714
19715
19716 ###
19717 ### Parsoid-specific tests
19718 ### Parsoid-PHP parser incompatibilities
19719 ###
19720 !!test
19721 1. SOL-sensitive wikitext tokens as template-args
19722 !!options
19723 parsoid=wt2html,wt2wt
19724 !! wikitext
19725 {{echo|*a}}
19726 {{echo|#a}}
19727 {{echo|:a}}
19728 !! html
19729 <span about="#mwt1" typeof="mw:Transclusion">
19730 </span><ul about="#mwt1"><li>a</li>
19731 </ul>
19732 <span about="#mwt2" typeof="mw:Transclusion">
19733 </span><ol about="#mwt2"><li>a</li>
19734 </ol>
19735 <span about="#mwt3" typeof="mw:Transclusion">
19736 </span><dl about="#mwt3"><dd>a</dd>
19737 </dl>
19738 !!end
19739
19740 #### -----------------------------------------------------------------
19741 #### Parsoid-specific functionality tests
19742 #### -----------------------------------------------------------------
19743
19744 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19745 # We know wt2wt will fail, but we expect selser to pass.
19746 # Due to the nature of our testing, wt2wt and selser tests will enter the
19747 # blacklist and we'll catch selser regressions based on changes to the
19748 # blacklist entries for selser tests.
19749 !! test
19750 1. Bad treebuilder fixup of formatting elt is cleaned up
19751 !! options
19752 parsoid=wt2html,wt2wt
19753 !! wikitext
19754 {|
19755 |
19756 <small>
19757 [[Image:Foobar.jpg|right|Test]]
19758 </small>
19759 |}
19760 !! html/parsoid
19761 <table>
19762 <tbody><tr><td>
19763 <small>
19764 <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>
19765 </small>
19766 </td></tr>
19767 </tbody></table>
19768 !! end
19769
19770 !! test
19771 2. Bad treebuilder fixup of formatting elt is cleaned up
19772 !! options
19773 parsoid=wt2html,wt2wt
19774 !! wikitext
19775 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19776
19777 <small>[[Image:Foobar.jpg|right|300px]]</small>
19778 !! html/parsoid
19779 <p><b>foo</b></p>
19780 <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>
19781 <p><b>bar</b></p>
19782 <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>
19783 !! end
19784
19785 #### ----------------------------------------------------------------
19786 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19787 #### tags. Parsoid's output for these tags differs from that of the
19788 #### PHP parser.
19789 #### ----------------------------------------------------------------
19790
19791 !!test
19792 Ref: 1. ref-location should be replaced with an index span
19793 !!options
19794 parsoid
19795 !! wikitext
19796 A <ref>foo</ref>
19797 B <ref name="x">foo</ref>
19798 C <ref name="y" />
19799 <references />
19800 !! html
19801 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19802 B <span about="#mwt4" class="reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
19803 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>
19804 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
19805 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
19806 <li about="#cite_note-x-2" id="cite_note-x-2"><span rel="mw:referencedBy"><a href="#cite_ref-x_2-0">↑</a></span> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
19807 <li about="#cite_note-y-3" id="cite_note-y-3"><span rel="mw:referencedBy"><a href="#cite_ref-y_3-0">↑</a></span> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
19808 </ol>
19809 !!end
19810
19811 !!test
19812 Ref: 2. ref-tags with identical names should all get the same index
19813 !!options
19814 parsoid
19815 !! wikitext
19816 A <ref name="x">foo</ref>
19817 B <ref name="x" />
19818 <references />
19819 !! html
19820 <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":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19821 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>
19822 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
19823 <li about="#cite_note-x-1" 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> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
19824 </ol>
19825 !!end
19826
19827 !!test
19828 Ref: 3. spaces in ref-names should be ignored
19829 !!options
19830 parsoid
19831 !! wikitext
19832 A <ref name="x">foo</ref>
19833 B <ref name=" x " />
19834 C <ref name= x />
19835 <references />
19836 !! html
19837 <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":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19838 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>
19839 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>
19840 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
19841 <li about="#cite_note-x-1" 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> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
19842 </ol>
19843 !!end
19844
19845 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19846 !!test
19847 Ref: 4. 'constructor' should be accepted as a valid ref-name
19848 !!options
19849 parsoid
19850 !! wikitext
19851 A <ref name="constructor">foo</ref>
19852 <references />
19853 !! html
19854 <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":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
19855 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19856 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><span rel="mw:referencedBy"><a href="#cite_ref-constructor_1-0">↑</a></span> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
19857 </ol>
19858 !!end
19859
19860 !!test
19861 Ref: 5. body should accept generic wikitext
19862 !!options
19863 parsoid
19864 !! wikitext
19865 A <ref>
19866 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19867 </ref>
19868
19869 <references />
19870 !! html
19871 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19872
19873 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19874 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
19875 </span></li>
19876 </ol>
19877 !!end
19878
19879 !!test
19880 Ref: 6. indent-pres should not be output in ref-body
19881 !!options
19882 parsoid
19883 !! wikitext
19884 A <ref>
19885 foo
19886 bar
19887 baz
19888 </ref>
19889
19890 <references />
19891 !! html
19892 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19893
19894 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19895 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
19896 bar
19897 baz
19898 </span></li>
19899 </ol>
19900 !!end
19901
19902 !!test
19903 Ref: 7. No p-wrapping in ref-body
19904 !!options
19905 parsoid
19906 !! wikitext
19907 A <ref>
19908 foo
19909
19910 bar
19911
19912
19913 baz
19914
19915
19916
19917 booz
19918 </ref>
19919
19920 <references />
19921 !! html
19922 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19923
19924 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19925 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
19926
19927 bar
19928
19929
19930 baz
19931
19932
19933
19934 booz
19935 </span></li>
19936 </ol>
19937 !!end
19938
19939 !!test
19940 Ref: 8. transclusion wikitext has lower precedence
19941 !!options
19942 parsoid
19943 !! wikitext
19944 A <ref> foo {{echo|</ref> B C}}
19945
19946 <references />
19947 !! html
19948 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19949 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19950 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
19951 </ol>
19952 !!end
19953
19954 !!test
19955 Ref: 9. unclosed comments should not leak out of ref-body
19956 !!options
19957 parsoid
19958 !! wikitext
19959 A <ref> foo <!--</ref> B C
19960 <references />
19961 !! html
19962 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19963 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19964 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
19965 </ol>
19966 !!end
19967
19968 !!test
19969 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19970 !!options
19971 parsoid
19972 !! wikitext
19973 A <ref> <b> foo </ref> B C
19974
19975 <references />
19976 !! html
19977 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19978
19979
19980 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19981 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
19982 </ol>
19983 !!end
19984
19985 !!test
19986 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19987 !!options
19988 parsoid
19989 !! wikitext
19990 A <ref>foo</ref> B
19991 C <ref>bar</ref> D
19992 <references />
19993 !! html
19994 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19995 C <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
19996 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
19997 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
19998 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
19999 </ol>
20000 !!end
20001
20002 !!test
20003 Ref: 12. ref-tags act as trailing newline migration barrier
20004 !!options
20005 parsoid
20006 !! wikitext
20007 <!--the newline at the end of this line moves out of the p-tag-->a
20008
20009 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
20010 <ref />
20011
20012 c
20013 <references />
20014 !! html
20015 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
20016
20017
20018 <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>
20019 <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>
20020
20021 <p>c</p>
20022 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20023 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
20024 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
20025 !!end
20026
20027 !!test
20028 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20029 !!options
20030 parsoid
20031 !! wikitext
20032 <ref>foo</ref> A
20033 <ref>bar
20034 </ref> B
20035 <references />
20036 !! html
20037 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
20038 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
20039 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20040 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20041 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
20042 </span></li>
20043 </ol>
20044 !!end
20045
20046 !!test
20047 Ref: 14. A nested ref-tag should be emitted as plain text
20048 !!options
20049 parsoid
20050 !! wikitext
20051 <ref>foo <ref>bar</ref> baz</ref>
20052
20053 <references />
20054 !! html
20055 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20056 </p>
20057 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20058 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
20059 </ol>
20060 !!end
20061
20062 !!test
20063 Ref: 15. ref-tags with identical names should get identical indexes
20064 !!options
20065 parsoid
20066 !! wikitext
20067 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20068 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20069
20070 <references />
20071 !! html
20072 <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":{"id":"mw-reference-text-cite_note-a-1"},"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>
20073 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":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20074
20075 <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> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b_2-0">2.0</a> <a href="#cite_ref-b_2-1">2.1</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
20076 </ol>
20077 !!end
20078
20079 ## We don't bother wt2wt-ing non-standard whitespace
20080 !!test
20081 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20082 !!options
20083 parsoid=wt2html
20084 !! wikitext
20085 A <ref >foo</ref >
20086
20087 <references />
20088 !! html
20089 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20090 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20091 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
20092 !!end
20093
20094 !!test
20095 Ref: 17. Generate valid HTML5 id/about attributes
20096 !!options
20097 parsoid
20098 !!wikitext
20099 <ref name="a b">foo</ref>
20100
20101 <references />
20102 !!html
20103 <p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
20104 </p>
20105
20106 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20107 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
20108 </ol>
20109 !!end
20110
20111 !!test
20112 Ref: 18. T58916: Extension attributes should be parsed as plain text
20113 !!options
20114 parsoid
20115 !!wikitext
20116 <ref name="{{echo|a}}">foo</ref>
20117
20118 <references />
20119 !!html
20120 <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":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span>
20121 </p>
20122
20123 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20124 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" 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> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
20125 </ol>
20126 !!end
20127
20128 !!test
20129 Ref: 19. ref-tags with identical name encodings should get identical indexes
20130 !!options
20131 parsoid
20132 !! wikitext
20133 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20134
20135 <references />
20136 !! html
20137 <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":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"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>
20138 </p>
20139 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20140 <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> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
20141 </ol>
20142 !!end
20143
20144 !!test
20145 Ref: 20. ref-tags with identical names but different content should keep it
20146 !!options
20147 parsoid
20148 !! wikitext
20149 A <ref name="foo">Foo one</ref>
20150 B <ref name="foo">Foo two</ref>
20151 C <ref name="foo" />
20152
20153 <references />
20154 !! html
20155 <p>A <span about="#mwt2" class="reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span>
20156 B <span about="#mwt4" class="reference" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span>
20157 C <span about="#mwt6" class="reference" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span></p>
20158
20159 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-foo_1-0">1.0</a> <a href="#cite_ref-foo_1-1">1.1</a> <a href="#cite_ref-foo_1-2">1.2</a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
20160 </ol>
20161 !!end
20162
20163 !!test
20164 References: 1. references tag without any refs should be handled properly
20165 !!options
20166 parsoid
20167 !! wikitext
20168 <references />
20169 !! html
20170 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20171 !!end
20172
20173 !!test
20174 References: 2. references tag with group only outputs references from that group
20175 !!options
20176 parsoid
20177 !! wikitext
20178 A <ref group="a">foo</ref>
20179 B <ref group="b">bar</ref>
20180 C <ref>baz</ref>
20181
20182 <references group="a" />
20183 <references />
20184 <references group="b" />
20185 !! html
20186 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20187 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span>
20188 C <span class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3">[1]</a></span></p>
20189
20190 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20191 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20192 </ol>
20193 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20194 <li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
20195 </ol>
20196 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20197 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20198 </ol>
20199 !!end
20200
20201 !!test
20202 References: 3. ref list should be cleared after processing references
20203 !!options
20204 parsoid
20205 !! wikitext
20206 A <ref>foo</ref>
20207
20208 <references />
20209
20210 B <ref>bar</ref>
20211
20212 <references />
20213 !! html
20214 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20215
20216 <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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20217 </ol>
20218
20219 <p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20220
20221 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20222 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20223 </ol>
20224 !!end
20225
20226 !!test
20227 References: 4. only referenced group should be cleared after processing references
20228 !!options
20229 parsoid
20230 !! wikitext
20231 A <ref group="a">afoo</ref>
20232 B <ref>bfoo</ref>
20233
20234 <references group="a" />
20235
20236 C <ref>cfoo</ref>
20237
20238 <references />
20239 !! html
20240 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20241 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20242
20243 <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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
20244 </ol>
20245
20246 <p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
20247
20248 <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> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
20249 </ol>
20250 !!end
20251
20252 !!test
20253 References: 5. ref tags in references should be processed while ignoring all other content
20254 !!options
20255 parsoid
20256 !! wikitext
20257 A <ref name="a" />
20258 B <ref name="b">bar</ref>
20259
20260 <references>
20261 <ref name="a">foo</ref>
20262 This should just get lost.
20263 </references>
20264 !! html
20265 <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>
20266 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20267
20268
20269 <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\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"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> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
20270 </ol>
20271 !!end
20272
20273 !!test
20274 References: 6. <references /> from a transclusion
20275 !!options
20276 parsoid
20277 !! wikitext
20278 <ref>Foo</ref> {{echo|<references />}}
20279 !! html
20280 <p><span about="#mwt3" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
20281 </ol>
20282 !!end
20283
20284 !! test
20285 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20286 !! options
20287 parsoid
20288 !! wikitext
20289 A <ref>foo bar for a</ref>
20290 B <ref group="X" name="b" />
20291
20292 <references />
20293
20294 <references group="X">
20295 <ref name="b">foo</ref>
20296 </references>
20297 !! html
20298 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20299 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>
20300 </p>
20301
20302 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20303 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
20304 </ol>
20305
20306 <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\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
20307 <li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
20308 </ol>
20309 !! end
20310
20311 !! test
20312 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20313 !! options
20314 parsoid
20315 !! wikitext
20316 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20317 <references />
20318 !! html
20319 <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>
20320 <ol class="references" typeof="mw:Extension/references" about="#mwt7" 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> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
20321 </ol>
20322 !!end
20323
20324 # This test only works in wt2html now as the <references /> are always generated
20325 # unless selser is active. Once T72722 is fixed, we should add a changes test
20326 # here to ensure that unrelated changes don't add the new <references /> in
20327 # wt2wt.
20328 !! test
20329 References: 9. Generate missing references list at the end
20330 !! options
20331 parsoid
20332 !! wikitext
20333 A <ref>foo</ref>
20334 B <ref group="inexistent">bar</ref>
20335 !! html
20336 <p>A <span class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B <span class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2">[inexistent 1]</a></span></p>
20337 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20338 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20339 </ol>
20340 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20341 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20342 </ol>
20343 !! end
20344
20345 !! test
20346 Entities in ref name
20347 !! options
20348 parsoid
20349 !! wikitext
20350 <ref name="test &amp; me">hi</ref>
20351 <references />
20352 !! html
20353 <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":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p>
20354 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20355 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><span rel="mw:referencedBy"><a href="#cite_ref-test_.26_me_1-0">↑</a></span> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
20356 </ol>
20357 !! end
20358
20359 # This test is wt2html only because we're permitting the serializer to produce
20360 # dirty diffs, normalizing the unclosed references to the self-closed version.
20361 !! test
20362 Generate references for unclosed references tag
20363 !! options
20364 parsoid=wt2html
20365 !! wikitext
20366 a<ref>foo</ref>
20367
20368 <references>
20369 !! html
20370 <p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20371 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20372 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
20373 !! end
20374
20375 !! test
20376 New reference serializes on its own line
20377 !! options
20378 parsoid=wt2wt,html2wt
20379 !! wikitext
20380 foo
20381 <references />
20382 !! html
20383 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20384 !! end
20385
20386 #--------- Test stripping of empty nodes in template content ----------
20387 !!test
20388 Empty LI and TR nodes should be stripped from template content
20389 !!wikitext
20390 {{EmptyLITest}}
20391 {{EmptyTRTest}}
20392 !!html/parsoid
20393 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20394 <li>a</li>
20395 <li>b</li>
20396 </ul>
20397 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20398 <tbody>
20399 <tr>
20400 <td>foo</td>
20401 </tr>
20402 <tr>
20403 <td>bar</td>
20404 </tr>
20405 </tbody>
20406 </table>
20407 !!end
20408
20409 !!test
20410 Empty LI and TR nodes should not be stripped from top-level content
20411 !!wikitext
20412 * a
20413 *
20414 * b
20415 {|
20416 |-
20417 |-
20418 |foo
20419 |}
20420 !!html/parsoid
20421 <ul>
20422 <li> a</li>
20423 <li></li>
20424 <li> b</li>
20425 </ul>
20426 <table>
20427 <tbody>
20428 <tr></tr>
20429 <tr>
20430 <td>foo</td>
20431 </tr>
20432 </tbody>
20433 </table>
20434 !!end
20435
20436 !!test
20437 Empty TR nodes should not be stripped if they have any attributes set
20438 !!wikitext
20439 {{EmptyTRWithHTMLAttrTest}}
20440 !!html/parsoid
20441 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20442 <tr align="center"></tr>
20443 <tr><td>foo</td></tr>
20444 <tr align="center"></tr>
20445 <tr><td>bar</td></tr>
20446 </table>
20447 !!end
20448
20449 #### ----------------------------------------------------------------
20450 #### The following section of tests are primarily to test
20451 #### wikitext escaping capabilities of Parsoid. Given that
20452 #### escaping can be done any number of ways, the wikitext (input)
20453 #### is always adjusted to reflect how Parsoid adds nowiki
20454 #### escape tags.
20455 ####
20456 #### We are marking several tests as parsoid-only since the
20457 #### HTML in the result section is different from what the
20458 #### PHP parser generates for it.
20459 #### ----------------------------------------------------------------
20460
20461
20462 #### --------------- Headings ---------------
20463 #### 0. Unnested
20464 #### 1. Nested inside html <h1>=foo=</h1>
20465 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20466 #### 3. Nested inside html with wikitext split by html tags
20467 #### 4. No escape needed
20468 #### 5. Empty headings <h1></h1>
20469 #### 6. Heading chars in SOL context
20470 #### ----------------------------------------
20471 !! test
20472 Headings: 0. Unnested
20473 !! options
20474 parsoid
20475 !! wikitext
20476 <nowiki>=foo=</nowiki>
20477
20478 <nowiki> =foo= </nowiki>
20479 <!--cmt-->
20480 <nowiki>=foo=</nowiki>
20481
20482 =foo''a''<nowiki>=</nowiki>
20483 !! html
20484 <p><span typeof="mw:Nowiki">=foo=</span></p>
20485
20486 <p><span typeof="mw:Nowiki"> =foo= </span>
20487 <!--cmt-->
20488 <span typeof="mw:Nowiki">=foo=</span></p>
20489
20490 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20491 !!end
20492
20493 # New headings and existing headings are handled differently
20494 !! test
20495 Headings: 1. Nested inside html
20496 !! options
20497 parsoid=html2wt
20498 !! html
20499 <h1>=foo=</h1>
20500 <h2>=foo=</h2>
20501 <h3>=foo=</h3>
20502
20503 <h1 data-parsoid=''>=foo=</h1>
20504 <h2 data-parsoid=''>=foo=</h2>
20505 <h3 data-parsoid=''>=foo=</h3>
20506 <h4 data-parsoid=''>=foo=</h4>
20507 <h5 data-parsoid=''>=foo=</h5>
20508 <h6 data-parsoid=''>=foo=</h6>
20509 !! wikitext
20510 = =foo= =
20511
20512 == =foo= ==
20513
20514 === =foo= ===
20515
20516 =<nowiki>=foo=</nowiki>=
20517 ==<nowiki>=foo=</nowiki>==
20518 ===<nowiki>=foo=</nowiki>===
20519 ====<nowiki>=foo=</nowiki>====
20520 =====<nowiki>=foo=</nowiki>=====
20521 ======<nowiki>=foo=</nowiki>======
20522
20523 !!end
20524
20525 !! test
20526 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20527 !! options
20528 parsoid=html2wt
20529 !! html
20530 <h1>foo</h1>*bar
20531 <h1>foo</h1>=bar
20532 <h1>foo</h1>=bar=
20533 !! wikitext
20534 = foo =
20535 <nowiki>*</nowiki>bar
20536
20537 = foo =
20538 =bar
20539
20540 = foo =
20541 <nowiki>=bar=</nowiki>
20542 !!end
20543
20544 !! test
20545 Headings: 3. Nested inside html with wikitext split by html tags
20546 !! options
20547 parsoid=html2wt,wt2wt
20548 !! wikitext
20549 = ='''bold'''<nowiki>foo=</nowiki> =
20550 !! html/parsoid
20551 <h1>=<b>bold</b>foo=</h1>
20552 !!end
20553
20554 !! test
20555 Headings: 4a. No escaping needed (testing just h1 and h2)
20556 !! wikitext
20557 = =foo =
20558
20559 = foo= =
20560
20561 = =foo= =
20562
20563 = =foo= bar =
20564
20565 == =foo ==
20566
20567 == foo= ==
20568
20569 = = =
20570
20571 = ''=''foo= =
20572 !! html/parsoid
20573 <h1>=foo</h1>
20574 <h1>foo=</h1>
20575 <h1> =foo= </h1>
20576 <h1>=foo= bar</h1>
20577 <h2>=foo</h2>
20578 <h2>foo=</h2>
20579 <h1>=</h1>
20580 <h1><i>=</i>foo=</h1>
20581 !!end
20582
20583 !! test
20584 Headings: 4b. No escaping needed (inside p-tags)
20585 !! options
20586 parsoid=html2wt
20587 !! html
20588 <p>===
20589 =foo= x
20590 =foo= <s></s>
20591 </p>
20592 !! wikitext
20593 ===
20594 =foo= x
20595 =foo= <s></s>
20596 !!end
20597
20598 !! test
20599 Headings: 5. Empty headings
20600 !! options
20601 parsoid
20602 !! wikitext
20603 =<nowiki/>=
20604
20605 ==<nowiki/>==
20606
20607 ===<nowiki/>===
20608
20609 ====<nowiki/>====
20610
20611 =====<nowiki/>=====
20612
20613 ======<nowiki/>======
20614 !! html
20615 <h1></h1>
20616 <h2></h2>
20617 <h3></h3>
20618 <h4></h4>
20619 <h5></h5>
20620 <h6></h6>
20621 !!end
20622
20623 !! test
20624 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20625 !! options
20626 parsoid
20627 !! wikitext
20628 <nowiki>=a=</nowiki>
20629
20630 <nowiki>=a=</nowiki>
20631
20632 <nowiki>=a=</nowiki>
20633
20634 <nowiki>=a=</nowiki>
20635 !! html
20636 <p>=a=</p>
20637 <p>=a= </p>
20638 <p>=a= </p>
20639 <p>=a= </p>
20640 !!end
20641
20642 !! test
20643 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20644 !! options
20645 parsoid
20646 !! wikitext
20647 <nowiki>=a=
20648 b</nowiki>
20649
20650 <nowiki>=a=
20651 b</nowiki>
20652
20653 <nowiki>=a=
20654 b</nowiki>
20655
20656 <nowiki>=a=
20657 b</nowiki>
20658 !! html
20659 <p>=a=
20660 b</p>
20661 <p>=a=
20662 b</p>
20663 <p>=a=
20664 b</p>
20665 <p>=a=
20666 b</p>
20667 </p>
20668 !!end
20669
20670 !! test
20671 Headings: 6c. Heading chars in SOL context (leading newline break)
20672 !! options
20673 parsoid
20674 !! wikitext
20675 a
20676 <nowiki>=b=</nowiki>
20677 !! html
20678 <p>a
20679 =b=</p>
20680 !!end
20681
20682 !! test
20683 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20684 !! options
20685 parsoid
20686 !! wikitext
20687 <!--c0--><nowiki>=a=</nowiki>
20688
20689 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20690 !! html
20691 <p><!--c0-->=a=</p>
20692 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20693 !!end
20694
20695 !! test
20696 Headings: 6d. Heading chars in SOL context (No escaping needed)
20697 !! options
20698 parsoid=html2wt
20699 !! html
20700 =a=<div>b</div>
20701 !! wikitext
20702 =a=<div>b</div>
20703 !!end
20704
20705 !! test
20706 Headings: 7. Insert a newline between new content and headings
20707 !! options
20708 parsoid=html2wt
20709 !! html
20710 <h2>NEW</h2>
20711 <p>new</p>
20712 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20713 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20714 !! wikitext
20715 == NEW ==
20716 new
20717
20718 ==A==
20719 a
20720
20721 !! end
20722
20723 #### --------------- Lists ---------------
20724 #### 0. Outside nests (*foo, etc.)
20725 #### 1. Nested inside html <ul><li>*foo</li></ul>
20726 #### 2. Inside definition lists
20727 #### 3. Only bullets at start should be escaped
20728 #### 4. No escapes needed
20729 #### 5. No unnecessary escapes
20730 #### 6. Escape bullets in SOL position
20731 #### 7. Escape bullets in a multi-line context
20732 #### ----------------------------------------
20733
20734 !! test
20735 Lists: 0. Outside nests
20736 !! wikitext
20737 <nowiki>*</nowiki>foo
20738
20739 <nowiki>#</nowiki>foo
20740
20741 <nowiki>;Foo:</nowiki>bar
20742 !! html
20743 <p>*foo
20744 </p><p>#foo
20745 </p><p>;Foo:bar
20746 </p>
20747 !!end
20748
20749 !! test
20750 Lists: 1. Nested inside html
20751 !! wikitext
20752 *<nowiki>*foo</nowiki>
20753
20754 *<nowiki>#foo</nowiki>
20755
20756 *<nowiki>:foo</nowiki>
20757
20758 *<nowiki>;foo</nowiki>
20759
20760 #<nowiki>*foo</nowiki>
20761
20762 #<nowiki>#foo</nowiki>
20763
20764 #<nowiki>:foo</nowiki>
20765
20766 #<nowiki>;foo</nowiki>
20767 !! html
20768 <ul><li>*foo</li></ul>
20769 <ul><li>#foo</li></ul>
20770 <ul><li>:foo</li></ul>
20771 <ul><li>;foo</li></ul>
20772 <ol><li>*foo</li></ol>
20773 <ol><li>#foo</li></ol>
20774 <ol><li>:foo</li></ol>
20775 <ol><li>;foo</li></ol>
20776
20777 !!end
20778
20779 !! test
20780 Lists: 2. Inside definition lists
20781 !! wikitext
20782 ;<nowiki>;foo</nowiki>
20783
20784 ;<nowiki>:foo</nowiki>
20785
20786 ;<nowiki>:foo</nowiki>
20787 :bar
20788
20789 :<nowiki>:foo</nowiki>
20790 !! html
20791 <dl><dt>;foo</dt></dl>
20792 <dl><dt>:foo</dt></dl>
20793 <dl><dt>:foo</dt>
20794 <dd>bar</dd></dl>
20795 <dl><dd>:foo</dd></dl>
20796
20797 !!end
20798
20799 !! test
20800 Lists: 3. Only bullets at start of text should be escaped
20801 !! wikitext
20802 *<nowiki>*foo*bar</nowiki>
20803
20804 *<nowiki>*foo</nowiki>''it''*bar
20805 !! html
20806 <ul><li>*foo*bar</li></ul>
20807 <ul><li>*foo<i>it</i>*bar</li></ul>
20808
20809 !!end
20810
20811 !! test
20812 Lists: 4. No escapes needed
20813 !! options
20814 parsoid
20815 !! wikitext
20816 *foo*bar
20817
20818 *''foo''*bar
20819
20820 *[[Foo]]: bar
20821
20822 *[[Foo]]*bar
20823 !! html
20824 <ul>
20825 <li>foo*bar
20826 </li>
20827 </ul>
20828 <ul>
20829 <li><i>foo</i>*bar
20830 </li>
20831 </ul>
20832 <ul>
20833 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20834 </li>
20835 </ul>
20836 <ul>
20837 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20838 </li>
20839 </ul>
20840 !!end
20841
20842 !! test
20843 Lists: 5. No unnecessary escapes
20844 !! wikitext
20845 * bar <span><nowiki>[[foo]]</nowiki></span>
20846
20847 * =bar <span><nowiki>[[foo]]</nowiki></span>
20848
20849 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20850
20851 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20852
20853 * =bar <span>foo]]</span>=
20854
20855 * <s></s>: a
20856
20857 * ''* foo''
20858 !! html
20859 <ul><li> bar <span>[[foo]]</span></li></ul>
20860 <ul><li> =bar <span>[[foo]]</span></li></ul>
20861 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20862 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20863 <ul><li> =bar <span>foo]]</span>=</li></ul>
20864 <ul><li> <s></s>: a</li></ul>
20865 <ul><li> <i>* foo</i></li></ul>
20866
20867 !!end
20868
20869 !! test
20870 Lists: 6. Escape bullets in SOL position
20871 !! options
20872 parsoid=html2wt
20873 !! html
20874 <p><!--cmt-->*foo</p>
20875 !! wikitext
20876 <!--cmt--><nowiki>*</nowiki>foo
20877 !!end
20878
20879 !! test
20880 Lists: 7. Escape bullets in a multi-line context
20881 !! wikitext
20882 a
20883 <nowiki>*</nowiki>b
20884 !! html
20885 <p>a
20886 *b
20887 </p>
20888 !!end
20889
20890 !! test
20891 Lists: 8. Escape colons only if not present in tags
20892 !! options
20893 parsoid=html2wt
20894 !! html
20895 <dl><dt>a:b<i>c:d</i></dt></dl>
20896 !! wikitext
20897 ; <nowiki>a:b</nowiki>''c:d''
20898 !! end
20899
20900 #### --------------- HRs ---------------
20901 #### 1. Single line
20902 #### -----------------------------------
20903
20904 !! test
20905 HRs: 1. Single line
20906 !! wikitext
20907 ----<nowiki>----</nowiki>
20908 ----=foo=
20909 ----*foo
20910 !! html+tidy
20911 <hr />
20912 <p>----</p>
20913 <hr />
20914 <p>=foo=</p>
20915 <hr />
20916 <p>*foo</p>
20917 !! end
20918
20919 #### --------------- Tables ---------------
20920 #### 1a. Simple example
20921 #### 1b. No escaping needed (!foo)
20922 #### 1c. No escaping needed (|foo)
20923 #### 1d. No escaping needed (|}foo)
20924 ####
20925 #### 2a. Nested in td (<td>foo|bar</td>)
20926 #### 2b. Nested in td (<td>foo||bar</td>)
20927 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20928 ####
20929 #### 3a. Nested in th (<th>foo!bar</th>)
20930 #### 3b. Nested in th (<th>foo!!bar</th>)
20931 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20932 ####
20933 #### 4a. Escape -
20934 #### 4b. Escape +
20935 #### 4c. No escaping needed
20936 #### --------------------------------------
20937
20938 !! test
20939 Tables: 1a. Simple example
20940 !! wikitext
20941 <nowiki>{|
20942 |}</nowiki>
20943 !! html
20944 <p>{|
20945 |}
20946 </p>
20947 !! end
20948
20949 !! test
20950 Tables: 1b. No escaping needed
20951 !! wikitext
20952 !foo
20953 !! html
20954 <p>!foo
20955 </p>
20956 !! end
20957
20958 !! test
20959 Tables: 1c. No escaping needed
20960 !! wikitext
20961 |foo
20962 !! html
20963 <p>|foo
20964 </p>
20965 !! end
20966
20967 !! test
20968 Tables: 1d. No escaping needed
20969 !! wikitext
20970 |}foo
20971 !! html
20972 <p>|}foo
20973 </p>
20974 !! end
20975
20976 !! test
20977 Tables: 2a. Nested in td
20978 !! options
20979 parsoid=html2wt
20980 !! html/parsoid
20981 <table><tbody><tr>
20982 <td>foo|bar</td></tr>
20983 <tr><td>x<div>a|b</div></td>
20984 </tbody></table>
20985 !! wikitext
20986 {|
20987 |<nowiki>foo|bar</nowiki>
20988 |-
20989 |x<div><nowiki>a|b</nowiki></div>
20990 |}
20991 !! html/php+tidy
20992 <table>
20993 <tr>
20994 <td>foo|bar</td>
20995 </tr>
20996 <tr>
20997 <td>x
20998 <div>a|b</div>
20999 </td>
21000 </tr>
21001 </table>
21002 !! end
21003
21004 !! test
21005 Tables: 2b. Nested in td
21006 !! options
21007 parsoid=html2wt
21008 !! html/parsoid
21009 <table><tbody><tr>
21010 <td>foo||bar</td>
21011 <td>a<i>b||c</i></td>
21012 <td>a<i><div>b||c</div></i></td>
21013 </tr></tbody></table>
21014 !! wikitext
21015 {|
21016 |<nowiki>foo||bar</nowiki>
21017 |a''<nowiki>b||c</nowiki>''
21018 |a''<div><nowiki>b||c</nowiki></div>''
21019 |}
21020 !! html/php
21021 <table>
21022 <tr>
21023 <td>foo||bar
21024 </td>
21025 <td>a<i>b||c</i>
21026 </td>
21027 <td>a<i><div>b||c</div></i>
21028 </td></tr></table>
21029
21030 !! end
21031
21032 !! test
21033 Tables: 2c. Nested in td -- no escaping needed
21034 !! wikitext
21035 {|
21036
21037 |foo!!bar
21038 |}
21039 !! html/*
21040 <table>
21041
21042 <tr>
21043 <td>foo!!bar
21044 </td></tr></table>
21045
21046 !! end
21047
21048 !! test
21049 Tables: 3a. Nested in th
21050 !! wikitext
21051 {|
21052
21053 !foo!bar
21054 |}
21055 !! html/*
21056 <table>
21057
21058 <tr>
21059 <th>foo!bar
21060 </th></tr></table>
21061
21062 !! end
21063
21064 !! test
21065 Tables: 3b. Nested in th
21066 !! options
21067 parsoid=html2wt
21068 !! html/parsoid
21069 <table><tbody>
21070 <tr><th>foo!!bar</th>
21071 <th><i>foo|bar</i></th>
21072 <th><i>foo!!bar</i></th>
21073 <th><i><span>foo!!bar</span></i></th>
21074 </tr></tbody></table>
21075 !! wikitext
21076 {|
21077 !<nowiki>foo!!bar</nowiki>
21078 !''<nowiki>foo|bar</nowiki>''
21079 !''<nowiki>foo!!bar</nowiki>''
21080 !''<span><nowiki>foo!!bar</nowiki></span>''
21081 |}
21082 !! html/php
21083 <table>
21084 <tr>
21085 <th>foo!!bar
21086 </th>
21087 <th><i>foo|bar</i>
21088 </th>
21089 <th><i>foo!!bar</i>
21090 </th>
21091 <th><i><span>foo!!bar</span></i>
21092 </th></tr></table>
21093
21094 !! end
21095
21096 !! test
21097 Tables: 3c. Nested in th
21098 !! options
21099 parsoid=html2wt
21100 !! html/parsoid
21101 <table><tbody>
21102 <tr><th>foo||bar</th>
21103 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21104 </tr></tbody></table>
21105 !! wikitext
21106 {|
21107 !<nowiki>foo||bar</nowiki>
21108 !<nowiki>foo||bar</nowiki>
21109 |}
21110 !! html/php
21111 <table>
21112 <tr>
21113 <th>foo||bar
21114 </th>
21115 <th>foo||bar
21116 </th></tr></table>
21117
21118 !! end
21119
21120 !! test
21121 Tables: 4a. Escape -
21122 !! options
21123 parsoid=html2wt
21124 !! html/*
21125 <table>
21126
21127 <tr>
21128 <th>-bar
21129 </th></tr>
21130 <tr>
21131 <td>-bar
21132 </td></tr></table>
21133
21134 !! wikitext
21135 {|
21136
21137 !-bar
21138
21139 |-
21140 |<nowiki>-bar</nowiki>
21141 |}
21142 !! end
21143
21144 !! test
21145 Tables: 4b. Escape +
21146 !! options
21147 parsoid=html2wt
21148 !! html/*
21149 <table>
21150
21151 <tr>
21152 <th>+bar
21153 </th></tr>
21154 <tr>
21155 <td>+bar
21156 </td></tr></table>
21157
21158 !! wikitext
21159 {|
21160
21161 !+bar
21162
21163 |-
21164 |<nowiki>+bar</nowiki>
21165 |}
21166 !! end
21167
21168 !! test
21169 Tables: 4c. No escaping needed
21170 !! wikitext
21171 {|
21172 |foo-bar
21173 |foo+bar
21174 |-
21175 |''foo''-bar
21176 |''foo''+bar
21177 |-
21178 |foo
21179 bar|baz
21180 +bar
21181 -bar
21182 |-
21183 |x
21184 <div>a|b</div>
21185 |}
21186 !! html/php
21187 <table>
21188 <tr>
21189 <td>foo-bar
21190 </td>
21191 <td>foo+bar
21192 </td></tr>
21193 <tr>
21194 <td><i>foo</i>-bar
21195 </td>
21196 <td><i>foo</i>+bar
21197 </td></tr>
21198 <tr>
21199 <td>foo
21200 <p>bar|baz
21201 +bar
21202 -bar
21203 </p>
21204 </td></tr>
21205 <tr>
21206 <td>x
21207 <div>a|b</div>
21208 </td></tr></table>
21209
21210 !! html/parsoid
21211 <table><tbody>
21212 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21213 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21214 <tr><td>foo
21215 <p>bar|baz
21216 +bar
21217 -bar</p></td></tr>
21218 <tr><td>x
21219 <div>a|b</div></td>
21220 </tbody></table>
21221 !! end
21222
21223 !! test
21224 Tables: 4d. No escaping needed
21225 !! wikitext
21226 {|
21227 |[[Foo]]-bar
21228 ||+1
21229 ||-2
21230 |}
21231 !! html/php
21232 <table>
21233 <tr>
21234 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21235 </td>
21236 <td>+1
21237 </td>
21238 <td>-2
21239 </td></tr></table>
21240
21241 !! html/parsoid
21242 <table>
21243 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21244 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21245 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21246 </tbody></table>
21247 !! end
21248
21249 !! test
21250 Tables: Digest broken attributes on table and tr tag
21251 !! options
21252 parsoid=wt2html
21253 !! wikitext
21254 {| || |} ++
21255 |- || || ++ --
21256 |- > [
21257 |}
21258 !! html
21259 <table>
21260 <tbody>
21261 <tr></tr>
21262 <tr></tr>
21263 </tbody></table>
21264 !! end
21265
21266 #### --------------- Links ----------------
21267 #### 1. Quote marks in link text
21268 #### 2. Wikilinks: Escapes needed
21269 #### 3. Wikilinks: No escapes needed
21270 #### 4. Extlinks: Escapes needed
21271 #### 5. Extlinks: No escapes needed
21272 #### --------------------------------------
21273 !! test
21274 Links 1. WikiLinks: No escapes needed
21275 !! wikitext
21276 [[Foo|Foo''boo'']]
21277 [[Foo|[Foobar]]]
21278 [[Foo|x [Foobar] x]]
21279 !! html/php
21280 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21281 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21282 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21283 </p>
21284 !! html/parsoid
21285 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21286 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21287 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21288 !! end
21289
21290 !! test
21291 Links 2. WikiLinks: Escapes needed
21292 !! options
21293 parsoid=html2wt
21294 !! html/parsoid
21295 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21296 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21297 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21298 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21299 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21300 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21301 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21302 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21303 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21304 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21305 !! wikitext
21306 [[Foo|<nowiki>Foobar]</nowiki>]]
21307 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21308 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21309 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21310 [[Foo|<nowiki>|Bar</nowiki>]]
21311 [[Foo|<nowiki>]]bar</nowiki>]]
21312 [[Foo|<nowiki>[[bar</nowiki>]]
21313 [[Foo|<nowiki>x [[ y</nowiki>]]
21314 [[Foo|<nowiki>x ]] y</nowiki>]]
21315 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21316 !! html/php
21317 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21318 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21319 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21320 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21321 <a href="/wiki/Foo" title="Foo">|Bar</a>
21322 <a href="/wiki/Foo" title="Foo">]]bar</a>
21323 <a href="/wiki/Foo" title="Foo">[[bar</a>
21324 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21325 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21326 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21327 </p>
21328 !! end
21329
21330 !! test
21331 Links 3. WikiLinks: No escapes needed
21332 !! wikitext
21333 [[Foo|[Foobar]]
21334 [[Foo|foo|bar]]
21335 !! html/php
21336 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21337 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21338 </p>
21339 !! html/parsoid
21340 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21341 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21342 !! end
21343
21344 !! test
21345 Links 4. ExtLinks: Escapes needed
21346 !! options
21347 parsoid=html2wt
21348 !! html/parsoid
21349 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21350 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21351 <p>[http://google.com]</p>
21352 <p>[http://google.com google]</p>
21353 !! wikitext
21354 [http://google.com <nowiki>[google]</nowiki>]
21355 [http://google.com <nowiki>google]</nowiki>]
21356
21357 <nowiki>[http://google.com]</nowiki>
21358
21359 <nowiki>[http://google.com google]</nowiki>
21360
21361 !! html/php
21362 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21363 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21364 </p><p>[http://google.com]
21365 </p><p>[http://google.com google]
21366 </p>
21367 !! end
21368
21369 !! test
21370 Links 5. ExtLinks: No escapes needed
21371 !! wikitext
21372 [http://google.com [google]
21373 !! html/php
21374 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21375 </p>
21376 !! html/parsoid
21377 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21378 !! end
21379
21380 !! test
21381 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21382 !! html/parsoid
21383 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21384 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21385 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21386 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21387 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21388 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21389 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21390 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21391 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21392 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21393 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21394 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21395 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21396 </p>
21397 !! wikitext
21398 x<nowiki/>http://example.com<nowiki/>y
21399 http://example.com<nowiki/>?x
21400 http://example.com<nowiki/>&x
21401 http://example.com<nowiki/>'x
21402 http://example.com<nowiki/>,x
21403 http://example.com<nowiki/>.x
21404 http://example.com<nowiki/>;x
21405 http://example.com<nowiki/>:x
21406 http://example.com<nowiki/>;x
21407 http://example.com<nowiki/>!x
21408 http://example.com<nowiki/>=x
21409 http://example.com<nowiki/>(x)
21410 http://example.com(x<nowiki/>)
21411 !! end
21412
21413 !! test
21414 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21415 !! html/parsoid
21416 <p>x
21417 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21418 y
21419 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21420 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21421 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21422 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21423 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21424 </p>
21425 !! wikitext
21426 x
21427 http://example.com
21428 y
21429 "http://example.com"
21430 (http://example.com)
21431 (http://example.com) foo
21432 http://example.com,
21433 http://example.com, foo
21434 !! html/php
21435 <p>x
21436 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21437 y
21438 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21439 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21440 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21441 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21442 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21443 </p>
21444 !! end
21445
21446 !! test
21447 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21448 !! html/parsoid
21449 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21450 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21451 !! wikitext
21452 http://example.com.,;:!?\
21453 -http://example.com:
21454 !! html/php
21455 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21456 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21457 </p>
21458 !! end
21459
21460 !! test
21461 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21462 !! html/parsoid
21463 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21464 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21465 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21466 !! wikitext
21467 RFC 123<nowiki/>4
21468 RFC 123<nowiki/>y
21469 X<nowiki/>RFC 123<nowiki/>y
21470 !! end
21471
21472 !! test
21473 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21474 !! html/parsoid
21475 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21476 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21477 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21478 </p>
21479 !! wikitext
21480 RFC 123?foo
21481 RFC 123&foo
21482 -RFC 123-
21483 !! html/php
21484 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21485 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21486 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21487 </p>
21488 !! end
21489
21490 !! test
21491 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21492 !! html/parsoid
21493 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21494 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21495 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21496 !! wikitext
21497 PMID 123<nowiki/>4
21498 PMID 123<nowiki/>y
21499 X<nowiki/>PMID 123<nowiki/>y
21500 !! end
21501
21502 !! test
21503 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21504 !! html/parsoid
21505 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21506 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21507 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21508 </p>
21509 !! wikitext
21510 PMID 123?foo
21511 PMID 123&foo
21512 -PMID 123-
21513 !! html/php
21514 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21515 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21516 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21517 </p>
21518 !! end
21519
21520 !! test
21521 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21522 !! html/parsoid
21523 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21524 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21525 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21526 </p>
21527 !! wikitext
21528 ISBN 1234567890<nowiki/>1
21529 ISBN 1234567890<nowiki/>x
21530 a<nowiki/>ISBN 1234567890<nowiki/>b
21531 !! end
21532
21533 !! test
21534 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21535 !! html/parsoid
21536 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21537 !! wikitext
21538 -ISBN 1234567890's
21539 !! html/php
21540 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21541 </p>
21542 !! end
21543
21544 !! test
21545 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21546 !! options
21547 parsoid=html2wt
21548 !! html/*
21549 <p>this is not a link: http://example.com
21550 </p>
21551 !! wikitext
21552 this is not a link: <nowiki>http://example.com</nowiki>
21553 !! end
21554
21555 !! test
21556 Links 15. Link trails can't become link prefixes.
21557 !! options
21558 language=is
21559 !! wikitext
21560 [[Söfnuður]]-[[00]]
21561 !! html/php
21562 <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>
21563 </p>
21564 !! html/parsoid
21565 <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>
21566 !! end
21567
21568 #### --------------- Quotes ---------------
21569 #### 1. Quotes inside <b> and <i>
21570 #### 2. Link fragments separated by <i> and <b> tags
21571 #### 3. Link fragments inside <i> and <b>
21572 #### 4. No escaping needed
21573 #### --------------------------------------
21574 !! test
21575 1a. Quotes inside <b> and <i>
21576 !! options
21577 parsoid=html2wt,wt2wt
21578 !! wikitext
21579 ''<nowiki/>'foo'''
21580 ''<nowiki>''foo''</nowiki>''
21581 ''<nowiki>'''foo'''</nowiki>''
21582 ''foo''<nowiki/>'s
21583 '''<nowiki/>'foo''''
21584 '''<nowiki>''foo''</nowiki>'''
21585 '''<nowiki>'''foo'''</nowiki>'''
21586 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21587 '''foo'''<nowiki/>'s
21588 '''foo''
21589 ''foo''<nowiki/>'
21590 ''foo'''<nowiki/>'
21591 '''foo''<nowiki/>'
21592 ''''foo'''
21593 '''foo'''<nowiki/>'
21594 ''''foo'''<nowiki/>'
21595 ''fools'<span> errand</span>''
21596 ''<span>fool</span>'s errand''
21597 '<nowiki/>''foo'' bar '''baz''
21598 a|!*#-:;+-~[]{}b'''x''
21599 !! html/*
21600 <p><i>'foo'</i>
21601 <i>''foo''</i>
21602 <i>'''foo'''</i>
21603 <i>foo</i>'s
21604 <b>'foo'</b>
21605 <b>''foo''</b>
21606 <b>'''foo'''</b>
21607 <b>foo'<i>bar'</i>baz</b>
21608 <b>foo</b>'s
21609 '<i>foo</i>
21610 <i>foo</i>'
21611 <i>foo'</i>'
21612 '<i>foo</i>'
21613 '<b>foo</b>
21614 <b>foo</b>'
21615 '<b>foo</b>'
21616 <i>fools'<span> errand</span></i>
21617 <i><span>fool</span>'s errand</i>
21618 '<i>foo</i> bar '<i>baz</i>
21619 a|!*#-:;+-~[]{}b'<i>x</i>
21620 </p>
21621 !! end
21622
21623 !! test
21624 1b. Quotes inside <b> and <i> with other tags on same line
21625 !! options
21626 parsoid=html2wt,wt2wt
21627 !! wikitext
21628 '''a'' foo ''[[bar]]''
21629 ''a''' foo ''[[bar]]''
21630 ''a''' foo '''{{echo|[[bar]]}}'''
21631 [[foo]] x'''[[bar]]''
21632 '''foo'' <ref>test</ref>
21633 '''foo'' <div title="name">test</div>
21634 '''foo'' and <br> bar
21635 <references />
21636 !! html
21637 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21638 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21639 <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>
21640 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21641 '<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
21642 '<i>foo</i> <div title="name">test</div>
21643 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21644 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21645 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
21646 </ol>
21647 !! end
21648
21649 !! test
21650 2. Link fragments separated by <i> and <b> tags
21651 !! wikitext
21652 [[''foo''<nowiki>hello]]</nowiki>
21653
21654 [['''foo'''<nowiki>hello]]</nowiki>
21655 !! html
21656 <p>[[<i>foo</i>hello]]
21657 </p><p>[[<b>foo</b>hello]]
21658 </p>
21659 !! end
21660
21661 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21662 # this is one of the shortcomings of this format
21663 !! test
21664 3. Link fragments inside <i> and <b>
21665 !! wikitext
21666 ''[[foo''<nowiki>]]</nowiki>
21667
21668 '''[[foo'''<nowiki>]]</nowiki>
21669 !! html
21670 <p><i>[[foo</i>]]
21671 </p><p><b>[[foo</b>]]
21672 </p>
21673 !! end
21674
21675 !! test
21676 4. No escaping needed
21677 !! wikitext
21678 '<span>''bar''</span>'
21679 '<span>'''bar'''</span>'
21680 'a:b'foo
21681 !! html
21682 <p>'<span><i>bar</i></span>'
21683 '<span><b>bar</b></span>'
21684 'a:b'foo
21685 </p>
21686 !! end
21687
21688 #### ----------- Paragraphs ---------------
21689 #### 1. No unnecessary escapes
21690 #### --------------------------------------
21691
21692 !! test
21693 1. No unnecessary escapes
21694 !! wikitext
21695 bar <span><nowiki>[[foo]]</nowiki></span>
21696
21697 =bar <span><nowiki>[[foo]]</nowiki></span>
21698
21699 [[bar <span><nowiki>[[foo]]</nowiki></span>
21700
21701 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21702
21703 =bar <span>foo]]</span><nowiki>=</nowiki>
21704 !! html
21705 <p>bar <span>[[foo]]</span>
21706 </p><p>=bar <span>[[foo]]</span>
21707 </p><p>[[bar <span>[[foo]]</span>
21708 </p><p>]]bar <span>[[foo]]</span>
21709 </p><p>=bar <span>foo]]</span>=
21710 </p>
21711 !!end
21712
21713 #### ----------------------- PRE --------------------------
21714 #### 1. Leading whitespace in SOL context should be escaped
21715 #### ------------------------------------------------------
21716 !! test
21717 1. Leading whitespace in SOL context should be escaped
21718 !! options
21719 parsoid
21720 !! wikitext
21721 <nowiki> </nowiki>a
21722
21723 <nowiki> </nowiki> a
21724
21725 <nowiki> </nowiki>a(tab)
21726
21727 <nowiki> </nowiki> a
21728 <!--cmt-->
21729 <nowiki> </nowiki> a
21730
21731 a
21732 <nowiki> </nowiki>b
21733
21734 a
21735 <nowiki> </nowiki>b
21736
21737 a
21738 <nowiki> </nowiki> b
21739 !! html
21740 <p> a</p>
21741 <p> a</p>
21742 <p> a(tab)</p>
21743 <p> a</p>
21744 <p><!--cmt--> a</p>
21745 <p>a
21746 b</p>
21747 <p>a
21748 b</p>
21749 <p>a
21750 b</p>
21751 !! end
21752
21753 !! test
21754 2. Leading whitespace in non-indent-pre contexts should not be escaped
21755 !! options
21756 parsoid
21757 !! wikitext
21758 foo <ref>''a''
21759 b</ref>
21760 <references />
21761 !! html
21762 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
21763 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21764 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
21765 b</span></li>
21766 </ol>
21767 !! end
21768
21769 !! test
21770 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21771 !! options
21772 parsoid
21773 !! wikitext
21774 <blockquote>
21775 a
21776 <span>b</span>
21777 c
21778 </blockquote>
21779 !! html
21780 <blockquote>
21781 <p>
21782 a
21783 <span>b</span>
21784 c</p>
21785 </blockquote>
21786 !! end
21787
21788 !! test
21789 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21790 !! options
21791 parsoid
21792 !! wikitext
21793 [[File:Foobar.jpg|thumb|caption]]
21794 !! html
21795 !! html/parsoid
21796 <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>
21797 !! end
21798
21799 !! test
21800 5. Nowiki escaping should account for indent-pres
21801 !! options
21802 parsoid=html2wt
21803 !! html
21804 <pre>==foo==</pre>
21805 !! wikitext
21806 ==foo==
21807 !! end
21808
21809 #### --------------- Behavior Switches --------------------
21810 !! test
21811 1. Valid behavior switches should be escaped
21812 !! options
21813 parsoid=html2wt
21814 !! html
21815 __TOC__
21816 <i>__TOC__</i>
21817 !! wikitext
21818 <nowiki>__TOC__</nowiki>
21819 ''<nowiki>__TOC__</nowiki>''
21820 !! end
21821
21822 !! test
21823 2. Invalid behavior switches should not be escaped
21824 !! options
21825 parsoid=html2wt
21826 !! html
21827 __TOO__
21828 __|__
21829 !! wikitext
21830 __TOO__
21831 __|__
21832 !! end
21833
21834 #### --------------- HTML tags ---------------
21835 #### 1. a tags
21836 #### 2. other tags
21837 #### 3. multi-line html tag
21838 #### 4. extension tags
21839 #### -----------------------------------------
21840 !! test
21841 1. a tags
21842 !! options
21843 parsoid
21844 !! wikitext
21845 <a href="http://google.com">google</a>
21846 !! html
21847 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21848 !! end
21849
21850 !! test
21851 2. other tags
21852 !! wikitext
21853 * <nowiki><div>foo</div></nowiki>
21854 * <nowiki><div style="color:red">foo</div></nowiki>
21855 * <nowiki><td></nowiki>
21856 !! html
21857 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
21858 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
21859 <li> &lt;td&gt;</li></ul>
21860
21861 !! end
21862
21863 !! test
21864 3. multi-line html tag
21865 !! wikitext
21866 <nowiki><div
21867 >foo</div
21868 ></nowiki>
21869 !! html
21870 <p>&lt;div
21871 &gt;foo&lt;/div
21872 &gt;
21873 </p>
21874 !! end
21875
21876 !! test
21877 4. extension tags
21878 !! wikitext
21879 <nowiki><ref>foo</ref></nowiki>
21880
21881 <nowiki><ref>bar</nowiki>
21882
21883 baz<nowiki></ref></nowiki>
21884 !! html
21885 <p>&lt;ref&gt;foo&lt;/ref&gt;
21886 </p><p>&lt;ref&gt;bar
21887 </p><p>baz&lt;/ref&gt;
21888 </p>
21889 !! end
21890
21891 #### --------------- Others ---------------
21892 !! test
21893 Escaping nowikis
21894 !! wikitext
21895 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21896 !! html
21897 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21898 </p>
21899 !! end
21900
21901 ## The quote-char in the input is necessary for triggering the bug
21902 !! test
21903 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21904 !! options
21905 parsoid=wt2wt,html2wt
21906 !! wikitext
21907 foo's bar :
21908 !! html
21909 <p>foo's bar :</p>
21910 !! end
21911
21912 !! test
21913
21914 Tag-like HTML structures are passed through as text
21915 !! wikitext
21916 <x y>
21917
21918 <x.y>
21919
21920 <x-y>
21921
21922 1>2
21923
21924 x<y
21925
21926 a>b
21927
21928 1<d e>f
21929 !! html
21930 <p>&lt;x y&gt;
21931 </p><p>&lt;x.y&gt;
21932 </p><p>&lt;x-y&gt;
21933 </p><p>1&gt;2
21934 </p><p>x&lt;y
21935 </p><p>a&gt;b
21936 </p><p>1&lt;d e&gt;f
21937 </p>
21938 !! end
21939
21940 !! test
21941 HTML tag with necessary entities in attributes
21942 !! wikitext
21943 <span title="&amp;amp;">foo</span>
21944 !! html
21945 <p><span title="&amp;amp;">foo</span>
21946 </p>
21947 !! end
21948
21949 !! test
21950 HTML tag with 'unnecessary' entity encoding in attributes
21951 !! wikitext
21952 <span title="&amp;">foo</span>
21953 !! html
21954 <p><span title="&amp;">foo</span>
21955 </p>
21956 !! end
21957
21958 !! test
21959 HTML tag with broken attribute value quoting
21960 !! wikitext
21961 <span title="Hello world>Foo</span>
21962 !! html/php
21963 <p><span>Foo</span>
21964 </p>
21965 !! html/parsoid
21966 <p><span title="Hello world">Foo</span>
21967 </p>
21968 !! end
21969
21970 !! test
21971 Parsoid-only: HTML tag with broken attribute value quoting
21972 !! options
21973 parsoid
21974 !! wikitext
21975 <span title="Hello world>Foo</span>
21976 !! html
21977 <p><span title="Hello world">Foo</span>
21978 </p>
21979 !! end
21980
21981 !! test
21982 Table with broken attribute value quoting
21983 !! wikitext
21984 {|
21985 | title="Hello world|Foo
21986 |}
21987 !! html/php
21988 <table>
21989 <tr>
21990 <td>Foo
21991 </td></tr></table>
21992
21993 !! html/parsoid
21994 <table>
21995 <tr>
21996 <td title="Hello world">Foo
21997 </td></tr></table>
21998
21999 !! end
22000
22001 !! test
22002 Table with broken attribute value quoting on consecutive lines
22003 !! wikitext
22004 {|
22005 | title="Hello world|Foo
22006 | style="color:red|Bar
22007 |}
22008 !! html/php
22009 <table>
22010 <tr>
22011 <td>Foo
22012 </td>
22013 <td>Bar
22014 </td></tr></table>
22015
22016 !! html/parsoid
22017 <table><tbody>
22018 <tr>
22019 <td title="Hello world">Foo
22020 </td><td style="color: red">Bar
22021 </td></tr></tbody></table>
22022
22023 !! end
22024
22025 !! test
22026 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22027 !! options
22028 parsoid
22029 !! wikitext
22030 {{}}
22031 !! html
22032 {{}}
22033 !! end
22034
22035 !! test
22036 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22037 !! options
22038 parsoid
22039 !! wikitext
22040 }}{{
22041 !! html
22042 }}{{
22043 !! end
22044
22045 !!test
22046 Accept empty td cell attribute
22047 !! wikitext
22048 {|
22049 | align="center" | foo || |
22050 |}
22051 !! html
22052 <table>
22053 <tr>
22054 <td align="center"> foo </td>
22055 <td>
22056 </td></tr></table>
22057
22058 !!end
22059
22060 !!test
22061 Non-empty attributes in th-cells
22062 !! wikitext
22063 {|
22064 ! Foo !! style="color: red" | Bar
22065 |}
22066 !! html
22067 <table>
22068 <tr>
22069 <th> Foo </th>
22070 <th style="color: red"> Bar
22071 </th></tr></table>
22072
22073 !!end
22074
22075 !!test
22076 Accept empty attributes in th-cells
22077 !! wikitext
22078 {|
22079 !| foo !!| bar
22080 |}
22081 !! html
22082 <table>
22083 <tr>
22084 <th> foo </th>
22085 <th> bar
22086 </th></tr></table>
22087
22088 !!end
22089
22090 !!test
22091 Empty table rows go away
22092 !! wikitext
22093 {|
22094 | Hello
22095 | there
22096 |- class="foo"
22097 |-
22098 |}
22099 !! html
22100 <table>
22101 <tr>
22102 <td> Hello
22103 </td>
22104 <td> there
22105 </td></tr>
22106
22107 </table>
22108
22109 !! end
22110
22111 ###
22112 ### Parsoid-centric tests for testing RTing of inter-element separators
22113 ### Edge cases not tested by existing parser tests and specific to
22114 ### Parsoid-specific serialization strategies.
22115 ###
22116
22117 !!test
22118 RT-ed inter-element separators should be valid separators
22119 !! wikitext
22120 {|
22121 |- [[foo]]
22122 |}
22123 !! html
22124 <table>
22125
22126 </table>
22127
22128 !!end
22129
22130 # Parsoid-only since PHP parser relies on Tidy for correct output
22131 !!test
22132 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22133 !!options
22134 parsoid
22135 !! wikitext
22136 {|
22137 |<small>foo
22138 bar
22139 |}
22140
22141 {|
22142 |<small>foo<small>
22143 |}
22144 !! html
22145 <table>
22146 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22147 <p>bar</p></small></td></tr>
22148 </tbody></table>
22149
22150 <table>
22151 <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>
22152 </tbody></table>
22153 !!end
22154
22155 !!test
22156 Empty TD followed by TD with tpl-generated attribute
22157 !! wikitext
22158 {|
22159 |-
22160 |
22161 |{{echo|style='color:red'}}|foo
22162 |}
22163 !! html
22164 <table>
22165
22166 <tr>
22167 <td>
22168 </td>
22169 <td>foo
22170 </td></tr></table>
22171
22172 !!end
22173
22174 !!test
22175 Indented table with an empty td
22176 !! wikitext
22177 {|
22178 |-
22179 |
22180 |foo
22181 |}
22182 !! html
22183 <table>
22184
22185 <tr>
22186 <td>
22187 </td>
22188 <td>foo
22189 </td></tr></table>
22190
22191 !!end
22192
22193 ## We have some newline diffs RT-ing this edge case
22194 ## and it is not important enough -- we seem to be emitting
22195 ## at most 2 newlines after a </tr> and this is unrelated to
22196 ## the issue from T85627 that this is testing.
22197 !!test
22198 Indented table with blank lines in between (T85627)
22199 !! options
22200 parsoid=wt2html
22201 !! wikitext
22202 {|
22203 |foo
22204
22205
22206 |}
22207 !! html
22208 <table>
22209
22210 <tr>
22211 <td>foo
22212 </td></tr></table>
22213
22214 !!end
22215
22216 !!test
22217 Indented block & table
22218 !! wikitext
22219 <div>foo</div>
22220 {|
22221 |foo
22222 |}
22223 !! html/php
22224 <div>foo</div>
22225 <table>
22226 <tr>
22227 <td>foo
22228 </td></tr></table>
22229
22230 !! html/parsoid
22231 <div data-parsoid='{"stx":"html"}'>foo</div>
22232 <table><tbody>
22233 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22234 </tbody></table>
22235 !!end
22236
22237 !! test
22238 Indent and comment before table row
22239 !! wikitext
22240 {|
22241 <!--hi-->|-
22242 | there
22243 |}
22244 !! html/php
22245 <table>
22246
22247 <tr>
22248 <td> there
22249 </td></tr></table>
22250
22251 !! html/parsoid
22252 <table>
22253 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22254 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22255 </tbody></table>
22256 !! end
22257
22258 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22259 !!test
22260 Empty TR followed by a template-generated TR
22261 !!options
22262 parsoid
22263 !! wikitext
22264 {|
22265 |-
22266 {{echo|<tr><td>foo</td></tr>}}
22267 |}
22268 !! html
22269 <table>
22270 <tbody>
22271 <tr></tr>
22272 <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}}]}'>
22273 <td>foo</td></tr>
22274 </tbody></table>
22275 !!end
22276
22277 ## PHP and parsoid output differ for this, and since this is primarily
22278 ## for testing Parsoid's serializer, marking this Parsoid only
22279 !!test
22280 Empty TR followed by mixed-ws-comment line should RT correctly
22281 !!options
22282 parsoid
22283 !! wikitext
22284 {|
22285 |-
22286 <!--c-->
22287 |-
22288 <!--c--> <!--d-->
22289 |}
22290 !! html
22291 <table>
22292 <tbody>
22293 <tr></tr>
22294 <!--c-->
22295 <tr>
22296 <!--c--> </tr><!--d-->
22297 </tbody></table>
22298
22299 !!end
22300
22301 !!test
22302 Multi-line image caption generated by templates with/without trailing newlines
22303 !! wikitext
22304 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22305 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22306 !! html/parsoid
22307 <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>
22308 <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>
22309 !!end
22310
22311 !! test
22312 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22313 !! options
22314 parsoid=html2wt
22315 !! html
22316 <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>
22317
22318 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22319 !! wikitext
22320 <includeonly>foo</includeonly>
22321 new para
22322
22323 [[./Category:Foo]]
22324
22325 = new heading =
22326 !! end
22327
22328 ## PHP emits broken html for this, and since this is primarily
22329 ## a Parsoid serializer test, marking this Parsoid only
22330 !!test
22331 Improperly nested inline or quotes tags with whitespace in between
22332 !!options
22333 parsoid
22334 !! wikitext
22335 <span> <s>x</span> </s>
22336 ''' ''x''' ''
22337 !! html
22338 <p><span> <s>x</s></span><s> </s>
22339 <b> <i>x</i></b><i> </i>
22340 </p>
22341 !!end
22342
22343 !!test
22344 Encapsulate protected attributes from wt
22345 !!options
22346 parsoid
22347 !! wikitext
22348 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22349 !! html
22350 <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>
22351 </body>
22352 !!end
22353
22354 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22355 ## Having nested or stray pre tags results in the attempt to add duplicates,
22356 ## causing an assertion fail. This test tries to prevent that situation.
22357 !!test
22358 Ensure ParagraphWrapper can deal with stray closing pre tags
22359 !!options
22360 parsoid=wt2html
22361 !! wikitext
22362 plain text</pre>
22363 !! html
22364 plain text
22365 !!end
22366
22367 !!test
22368 1. Ensure fostered text content is wrapped in element nodes
22369 !!options
22370 parsoid=wt2html
22371 !! wikitext
22372 <table>hi</table><table>ho</table>
22373 !! html
22374 <p>hi</p>
22375 <table></table>
22376 <p>ho</p>
22377 <table></table>
22378 !!end
22379
22380 !!test
22381 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22382 !!options
22383 parsoid=wt2html,wt2wt
22384 !! wikitext
22385 <table>
22386 <tr> || ||
22387 <td> a
22388 </table>
22389 !! html
22390 <p> || ||
22391 </p><table>
22392 <tbody><tr><td> a</td></tr>
22393 </tbody></table>
22394 !!end
22395
22396 !!test
22397 Encapsulation properly handles null DSR information from foster box
22398 !!options
22399 parsoid=wt2html,wt2wt
22400 !! wikitext
22401 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22402 !! html
22403 <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>
22404 !!end
22405
22406 !!test
22407 1. Encapsulate foster-parented transclusion content
22408 !!options
22409 parsoid=wt2wt,wt2html
22410 !! wikitext
22411 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22412 !! html
22413 <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>
22414 <tbody>
22415 <tr>
22416 <td>bar</td>
22417 </tr>
22418 </tbody>
22419 </table>
22420 !!end
22421
22422 !!test
22423 2. Encapsulate foster-parented transclusion content
22424 !!options
22425 parsoid=wt2wt,wt2html
22426 !! wikitext
22427 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22428 !! html
22429 <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>
22430 <table>
22431 <tbody>
22432 <tr>
22433 <td>bar</td>
22434 </tr>
22435 </tbody>
22436 </table>
22437 !!end
22438
22439 !!test
22440 3. Encapsulate foster-parented transclusion content
22441 !!options
22442 parsoid=wt2wt,wt2html
22443 !! wikitext
22444 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22445 !! html
22446 <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;]}">
22447 <p>foo</p>
22448 </div>
22449 <table>
22450 <tbody>
22451 <tr>
22452 <td>bar</td>
22453 </tr>
22454 </tbody>
22455 </table>
22456 !!end
22457
22458 !!test
22459 4. Encapsulate foster-parented transclusion content
22460 !!options
22461 parsoid=wt2wt,wt2html
22462 !! wikitext
22463 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22464 !! html
22465 <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;]}">
22466 <p>foo</p>
22467 </div>
22468 <table>
22469 <tbody>
22470 <tr>
22471 <td>bar</td>
22472 </tr>
22473 </tbody>
22474 </table>
22475 !!end
22476
22477 !!test
22478 5. Encapsulate foster-parented transclusion content
22479 !!options
22480 parsoid=wt2wt,wt2html
22481 !! wikitext
22482 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22483 !! html
22484 <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>
22485 <table>
22486 <tbody>
22487 <tr>
22488 <td>
22489 <div>
22490 <p>foo</p>
22491 </div>
22492 </td>
22493 </tr>
22494 </tbody>
22495 </table>
22496 !!end
22497
22498 !!test
22499 6. Encapsulate foster-parented transclusion content
22500 !!options
22501 parsoid=wt2wt,wt2html
22502 !! wikitext
22503 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22504 !! html
22505 <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>
22506 <table>
22507 <tbody>
22508 <tr>
22509 <td>
22510 <div>
22511 <p>foo</p>
22512 </div>
22513 </td>
22514 </tr>
22515 </tbody>
22516 </table>
22517 <p>ok</p>
22518 !!end
22519
22520 !!test
22521 7. Encapsulate foster-parented transclusion content
22522 !!options
22523 parsoid=wt2wt,wt2html
22524 !! wikitext
22525 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22526 !! html
22527 <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>
22528 <table>
22529 <tbody>
22530 <tr>
22531 <td>bar</td>
22532 </tr>
22533 </tbody>
22534 </table>
22535 !!end
22536
22537 !!test
22538 8. Encapsulate foster-parented transclusion content
22539 !!options
22540 parsoid=wt2wt,wt2html
22541 !! wikitext
22542 {{echo|a
22543 }}{|{{echo|style='color:red'}}
22544 |-
22545 |b
22546 |}
22547 !! html
22548 <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>
22549 <tbody>
22550 <tr>
22551 <td>b</td>
22552 </tr>
22553 </tbody>
22554 </table>
22555 !!end
22556
22557 !!test
22558 9. Encapsulate foster-parented transclusion content
22559 !!options
22560 parsoid=wt2wt,wt2html
22561 !! wikitext
22562 <table>{{echo|hi</table>hello}}
22563 !! html
22564 <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>
22565 !!end
22566
22567 !!test
22568 Table in fosterable position
22569 !!options
22570 parsoid=wt2html,wt2wt
22571 !! wikitext
22572 {{OpenTable}}
22573 <div>
22574 {|
22575 |}
22576 </div>
22577 |}
22578 !! html
22579 <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">
22580 </span>
22581 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22582
22583 <table>
22584 </table>
22585 !!end
22586
22587 # Parsoid only for bug 64747
22588 !! test
22589 Properly encapsulate empty-content transclusions in fosterable positions
22590 !! wikitext
22591 <table>
22592 {{#if:|
22593 <td>foo</td>
22594 }}
22595 </table>
22596 !! html/parsoid
22597 <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":["","","",""]}]]}'>
22598
22599 </table>
22600 !! end
22601
22602 !!test
22603 Support <object> element with .data attribute
22604 !!options
22605 parsoid=html2wt
22606 !! html
22607 <object data="test.swf"></object>
22608 !! wikitext
22609 <object data="test.swf"></object>
22610 !!end
22611
22612 !! test
22613 Don't block XML namespace declaration
22614 !! wikitext
22615 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22616 !! html/php
22617 <p><span>MediaWiki</span>
22618 </p>
22619 !! html/parsoid
22620 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22621 !! end
22622
22623 # -----------------------------------------------------------------
22624 # The following section of tests are primarily to spec requirements
22625 # around serialization of new/edited content.
22626 #
22627 # All these tests are marked Parsoid html2wt and html2html only
22628 # ----------------------------------------------------------------
22629
22630 # 'mi' is a localinterwiki prefix as well as a language
22631 !! test
22632 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22633 !! options
22634 parsoid=html2wt
22635 !! html
22636 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22637 !! wikitext
22638 [[Foo]]
22639 !! end
22640
22641 !! test
22642 New wiki links (href variations)
22643 !! options
22644 parsoid=html2wt
22645 !! html
22646 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22647 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22648 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22649 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22650 !! wikitext
22651 [[Foo_bar]]
22652 [[Foo_bar]]
22653 [[Foo_bar]]
22654 [[Toxine bactérienne]]
22655 !! end
22656
22657 !! test
22658 New wiki links (content string variations)
22659 !! options
22660 parsoid=html2wt
22661 !! html
22662 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22663 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22664 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22665 !! wikitext
22666 [[Foo_bar]]
22667 [[Foo bar]]
22668 [[Foo_bar|./Foo_bar]]
22669 !! end
22670
22671 !! test
22672 New category links (href variations)
22673 !! options
22674 parsoid=html2wt
22675 !! html
22676 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22677 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22678 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22679 !! wikitext
22680 [[Category:Toxine bactérienne]]
22681 [[Category:Toxine bactérienne]]
22682 [[Category:Toxine bactérienne]]
22683 !! end
22684
22685 !! test
22686 New sol transparent links don't need indent-pre nowiki protection
22687 !! options
22688 parsoid=html2wt
22689 language=de
22690 !! html
22691 <link rel="mw:PageProp/redirect" href="./Main_Page">
22692 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
22693 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
22694 !! wikitext
22695 #WEITERLEITUNG [[Main Page]]
22696 <!-- this is good --> [[Category:Good]]
22697 <!-- this is great --> [[Kategorie:Great]]
22698 !! end
22699
22700 !! test
22701 New interlanguage links (href variations)
22702 !! options
22703 parsoid=html2wt
22704 !! html
22705 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22706 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22707 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22708 !! wikitext
22709 [[es:Toxine bactérienne]]
22710 [[es:Toxine_bactérienne]]
22711 [[es:Toxine_bactérienne]]
22712 !! end
22713
22714 !! test
22715 Image: Modifying size of an image (1)
22716 !! options
22717 parsoid={
22718 "modes": ["wt2wt"],
22719 "changes": [
22720 ["img[height]", "attr", "height", "22"],
22721 ["img[width]", "attr", "width", "200"]
22722 ]
22723 }
22724 !! wikitext
22725 [[Image:Foobar.jpg|230x230px]]
22726 !! wikitext/edited
22727 [[Image:Foobar.jpg|200x200px]]
22728 !!end
22729
22730 !! test
22731 Image: Modifying size of an image (2)
22732 !! options
22733 parsoid={
22734 "modes": ["wt2wt"],
22735 "changes": [
22736 ["img[height]", "attr", "height", "100"],
22737 ["img[width]", "attr", "width", "500"]
22738 ]
22739 }
22740 !! wikitext
22741 [[Image:Foobar.jpg|230x230px]]
22742 !! wikitext/edited
22743 [[Image:Foobar.jpg|500x500px]]
22744 !!end
22745
22746 # Change in size is ignored so long as class='mw-default-size'
22747 !! test
22748 Image: Modifying size of an image (3)
22749 !! options
22750 parsoid={
22751 "modes": ["wt2wt"],
22752 "changes": [
22753 ["figure[class]", "removeClass", "mw-default-size"],
22754 ["figure img", "attr", "height", "19"],
22755 ["figure img", "attr", "width", "170"]
22756 ]
22757 }
22758 !! wikitext
22759 [[Image:Foobar.jpg|thumb]]
22760 !! wikitext/edited
22761 [[Image:Foobar.jpg|thumb|170x170px]]
22762 !!end
22763
22764 !! test
22765 Image: Modifying alignment of an image (bug 48665)
22766 !! options
22767 parsoid={
22768 "modes": ["wt2wt"],
22769 "changes": [
22770 ["figure[class]", "removeClass", "mw-halign-right"],
22771 ["figure[class]", "addClass", "mw-halign-left"]
22772 ]
22773 }
22774 !! wikitext
22775 [[Image:Foobar.jpg|thumb|caption|right]]
22776 !! wikitext/edited
22777 [[Image:Foobar.jpg|thumb|caption|left]]
22778 !! end
22779
22780 !! test
22781 Image: Modifying mw-default-size of an frameless image (bug 62805)
22782 !! options
22783 parsoid={
22784 "modes": ["wt2wt"],
22785 "changes": [
22786 ["figure.mw-default-size", "removeClass", "mw-default-size"]
22787 ]
22788 }
22789 !! wikitext
22790 [[Image:Foobar.jpg|frameless|right]]
22791 !! wikitext/edited
22792 [[Image:Foobar.jpg|frameless|right|220x220px]]
22793 !! end
22794
22795 !! test
22796 Image: Modifying valign of an image (bug 49221)
22797 !! options
22798 parsoid={
22799 "modes": ["wt2wt"],
22800 "changes": [
22801 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22802 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22803 ]
22804 }
22805 !! wikitext
22806 [[File:Foobar.jpg|20px|middle]]
22807 !! wikitext/edited
22808 [[File:Foobar.jpg|20px|text-top]]
22809 !! end
22810
22811 !! test
22812 Image: Modifying alt attribute of an image (bug 56400)
22813 !! options
22814 parsoid={
22815 "modes": ["wt2wt"],
22816 "changes": [
22817 ["img[alt]", "attr", "alt", "some alternate edited text"]
22818 ]
22819 }
22820 !! wikitext
22821 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22822 !! wikitext/edited
22823 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22824 !!end
22825
22826 !! test
22827 Image: Modifying caption of an image
22828 !! options
22829 parsoid={
22830 "modes": ["wt2wt"],
22831 "changes": [
22832 ["figcaption", "text", "new caption"]
22833 ]
22834 }
22835 !! wikitext
22836 [[Image:Foobar.jpg|thumb|original caption]]
22837 !! wikitext/edited
22838 [[Image:Foobar.jpg|thumb|new caption]]
22839 !!end
22840
22841 !! test
22842 Image: empty alt attribute (bug 48924)
22843 !! options
22844 parsoid
22845 !! wikitext
22846 [[File:Foobar.jpg|thumb|alt=|bar]]
22847 !! html
22848 <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>
22849 !! end
22850
22851 #!! test
22852 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22853 #!! options
22854 #parsoid=html2wt
22855 #language=ar
22856 #!! html
22857 #<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>
22858 #!! wikitext
22859 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22860 #!! end
22861
22862 !! test
22863 Image: Block level image should have \n before and after
22864 !! wikitext
22865 123
22866 [[File:Foobar.jpg|right|thumb|150x150px]]
22867 456
22868 !! html/parsoid
22869 <p>123</p>
22870 <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>
22871 <p>456</p>
22872 !!end
22873
22874 !! test
22875 Image: New block level image should have \n before and after (existing content)
22876 !! wikitext
22877 123
22878 [[File:Foobar.jpg|right|thumb|150x150px]]
22879 456
22880 !! html/parsoid
22881 <p>123</p>
22882 <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>
22883 <p>456</p>
22884 !!end
22885
22886 !! test
22887 Image: upright option (parsoid)
22888 !! options
22889 parsoid
22890 !! wikitext
22891 [[File:Foobar.jpg|thumb|upright|caption]]
22892 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22893 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22894 !! html
22895 <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>
22896 <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>
22897 <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>
22898 !!end
22899
22900 !! test
22901 Image: upright option is ignored on inline and frame images (parsoid)
22902 !! options
22903 parsoid
22904 !! wikitext
22905 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22906 !! html
22907 <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>
22908 !!end
22909
22910 !! test
22911 Image: from basic HTML (1)
22912 !! options
22913 parsoid=html2wt
22914 !! html/parsoid
22915 <span typeof="mw:Image">
22916 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22917 </span>
22918 !! wikitext
22919 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22920 !! end
22921
22922 !! test
22923 Image: from basic HTML (2)
22924 !! options
22925 parsoid=html2wt
22926 !! html/parsoid
22927 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22928 !! wikitext
22929 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22930 !! end
22931
22932 !! test
22933 Image: from basic HTML (3)
22934 !! options
22935 parsoid=html2wt
22936 !! html/parsoid
22937 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22938 !! wikitext
22939 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22940 !! end
22941
22942 !! test
22943 Image: from basic HTML (4)
22944 !! options
22945 parsoid=html2wt
22946 !! html/parsoid
22947 <img src="File:Foobar.jpg">
22948 !! wikitext
22949 [[File:Foobar.jpg|link=]]
22950 !! end
22951
22952 !! test
22953 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22954 !! options
22955 parsoid=html2wt
22956 !! html
22957 <ul>
22958 <li><p>foo</p></li>
22959 </ul>
22960 !! wikitext
22961 * foo
22962 !! end
22963
22964 !! test
22965 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22966 !! options
22967 parsoid=html2wt
22968 !! html
22969 <ul> <li>foo</li></ul>
22970 !! wikitext
22971 * foo
22972 !! end
22973
22974 !! test
22975 Don't strip leading whitespace when handling indent-pre suppressing tags
22976 !! options
22977 parsoid=html2wt
22978 !! html
22979 <table>
22980 <tr><td> indented row</td></tr>
22981 </table>
22982 <blockquote><p>
22983 <b>This is very bold of you!</b>
22984 </p>
22985 <table><tr><td>
22986 indented cell (no pre-wrapping!)
22987 </td></tr></table>
22988 </blockquote>
22989 <p>foo</p>
22990 <div>bar</div>
22991 !! wikitext
22992 {|
22993 | indented row
22994 |}
22995 <blockquote>
22996 '''This is very bold of you!'''
22997
22998 {|
22999 |
23000 indented cell (no pre-wrapping!)
23001 |}
23002 </blockquote>
23003 foo
23004 <div>bar</div>
23005 !! end
23006
23007 !! test
23008 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
23009 !! options
23010 parsoid=html2wt
23011 !! wikitext
23012 foo
23013 <nowiki> </nowiki><span>bar</span>
23014
23015 <span>foo2
23016 <nowiki> </nowiki></span>bar2
23017
23018 <div>foo</div>
23019 <nowiki> </nowiki><span>bar</span>
23020
23021 <div>
23022 <nowiki> </nowiki><span>foo</span>
23023 </div>
23024 !! html
23025 <p>foo</p>
23026 <span>bar</span>
23027
23028 <span>foo2
23029 </span>bar2
23030
23031 <div>foo</div>
23032 <span>bar</span>
23033
23034 <div>
23035 <span>foo</span>
23036 </div>
23037 !! end
23038
23039 !! test
23040 Lists: Add space after bullets
23041 !! options
23042 parsoid=html2wt
23043 !! html
23044 <ul>
23045 <li>foo</li>
23046 <li> bar</li>
23047 <li><span> baz</span></li>
23048 </ul>
23049 !! wikitext
23050 * foo
23051 * bar
23052 * <span> baz</span>
23053 !! end
23054
23055 !! test
23056 Lists: Dont insert newlines in a serialized list item.
23057 !! options
23058 parsoid=html2wt
23059 !! html
23060 <ul><li>a<br>b</li><li>c</li></ul>
23061 !! wikitext
23062 * a<br>b
23063 * c
23064 !! end
23065
23066 !! test
23067 Headings: Add space before/after == (Bug 51744)
23068 !! options
23069 parsoid=html2wt
23070 !! html
23071 <h2>foo</h2>
23072 <h2> bar</h2>
23073 <h2>baz </h2>
23074 <h2><span> baz</span></h2>
23075 !! wikitext
23076 == foo ==
23077
23078 == bar ==
23079
23080 == baz ==
23081
23082 == <span> baz</span> ==
23083 !! end
23084
23085 !! test
23086 Headings: Force metas to serialize before/after
23087 !! options
23088 parsoid=html2wt
23089 !! html
23090 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23091 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23092
23093 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23094 !! wikitext
23095 == hello there ==
23096 [[Category:A1]]
23097
23098 [[Category:A2]]
23099 == hi pal ==
23100
23101 <!--foo--> [[Category:A3]]
23102 == how goes it ==
23103 !! end
23104
23105 !! test
23106 Parsoid: Serialize positional parameters with = in them as named parameter
23107 !! options
23108 parsoid=html2wt
23109 !! html
23110 <p about="#mwt1" typeof="mw:Transclusion"
23111 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23112
23113 <p about="#mwt1" typeof="mw:Transclusion"
23114 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23115
23116 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23117 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23118 <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>
23119 !! wikitext
23120 {{echo|1 = f=oo}}
23121
23122 {{echo|1 = f=oo|2 = bar}}
23123
23124 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23125 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23126 {{echo|<nowiki>f=oo</nowiki>|bar}}
23127 !! end
23128
23129 !! test
23130 Parsoid: Serialize positional parameters with = in extlink as named parameter
23131 !! options
23132 parsoid=html2wt
23133 !! html
23134 <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>
23135 !! wikitext
23136 {{echo|1 = http://stuff?is=ok}}
23137 !! end
23138
23139 !! test
23140 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23141 !! options
23142 parsoid=html2wt
23143 !! html
23144 <div>a<p>b</p></div>
23145 <div>a
23146 <p>b</p></div>
23147 <div>
23148 a
23149 <p>b</p></div>
23150 !! wikitext
23151 <div>a
23152 b
23153 </div>
23154 <div>a
23155 b
23156 </div>
23157 <div>
23158 a
23159
23160 b
23161 </div>
23162 !! end
23163
23164 !! test
23165 Substrings resembling wikitext in hrefs should not get nowiki escapes
23166 !! options
23167 parsoid=html2wt
23168 !! html
23169 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23170 !! wikitext
23171 [[Foo''bar''baz]]
23172 !! end
23173
23174 #-----------------------------
23175 # I/B quote minimization tests
23176 #-----------------------------
23177
23178 !! test
23179 1. I/B quote minimization: wikitext-only tags should be combined
23180 !! options
23181 parsoid=html2wt
23182 !! html
23183 <p><i>A</i><i>B</i></p>
23184 <p><b>A</b><b>B</b></p>
23185 <p><i>A</i><b><i>B</i></b></p>
23186 <p><b>A</b><i><b>B</b></i></p>
23187 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23188 <p><i><b>A</b></i><i><b>B</b></i></p>
23189 <p><i><b>A</b></i><b><i>B</i></b></p>
23190 <p><b><i>A</i></b><i><b>B</b></i></p>
23191 !! wikitext
23192 ''AB''
23193
23194 '''AB'''
23195
23196 ''A'''B'''''
23197
23198 '''A''B'''''
23199
23200 '''A''BC''D'''
23201
23202 '''''AB'''''
23203
23204 '''''AB'''''
23205
23206 '''''AB'''''
23207 !! end
23208
23209 !! test
23210 2. I/B quote minimization: wikitext and html tags should not be combined
23211 !! options
23212 parsoid=html2wt
23213 !! html
23214 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23215 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23216 !! wikitext
23217 ''A''<i>B</i>
23218
23219 ''A''<nowiki/>'''<i>B</i>'''
23220 !! end
23221
23222 !! test
23223 3. I/B quote minimization: templated content stops minimization
23224 !! options
23225 parsoid=html2wt
23226 !! html
23227 <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>
23228 <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>
23229 !! wikitext
23230 ''A''{{echo|''B''}}
23231
23232 ''A''{{echo|'''''B'''''}}
23233 !! end
23234
23235 !! test
23236 4. I/B quote minimization: new content should be mimimized with adjacent old content
23237 !! options
23238 parsoid=html2wt
23239 !! html
23240 <p><i>A</i><i>B</i></p>
23241 <p><b>A</b><b>B</b></p>
23242 <p><i>A</i><b><i>B</i></b></p>
23243 !! wikitext
23244 ''AB''
23245
23246 '''AB'''
23247
23248 ''A'''B'''''
23249 !! end
23250
23251 !! test
23252 5a. Merge adjacent quote nodes if they've been edited
23253 !! options
23254 parsoid={
23255 "modes": ["wt2wt"],
23256 "changes": [
23257 ["p", "contents", "remove", ":contains('b')"]
23258 ]
23259 }
23260 !! wikitext
23261 ''a''b''c''
23262 !! wikitext/edited
23263 ''ac''
23264 !! end
23265
23266 !! test
23267 5b. Merge adjacent quote nodes if they've been edited
23268 !! options
23269 parsoid={
23270 "modes": ["wt2wt"],
23271 "changes": [
23272 ["#x", "remove"]
23273 ]
23274 }
23275 !! wikitext
23276 ''a''<span id="x">b</span>''c''
23277 !! wikitext/edited
23278 ''ac''
23279 !! end
23280
23281 #------------------------------------
23282 # End of I/B quote minimization tests
23283 #------------------------------------
23284
23285 !!test
23286 Bug 54262: New entities
23287 !! options
23288 parsoid=html2wt
23289 !! wikitext
23290 &nbsp;
23291 !! html
23292 <span typeof="mw:Entity">&nbsp;</span>
23293 !! end
23294
23295 ## Note that there is no wikitext output for 'unknownproperty' ##
23296 ## Unknown magic words are silently dropped ##
23297
23298 !! test
23299 Magic words
23300 !! options
23301 parsoid=html2wt
23302 !! html
23303 <meta property='mw:PageProp/toc' />
23304 <meta property='mw:PageProp/notoc' />
23305 <meta property='mw:PageProp/forcetoc' />
23306 <meta property='mw:PageProp/index' />
23307 <meta property='mw:PageProp/noindex' />
23308 <meta property='mw:PageProp/nogallery' />
23309 <meta property='mw:PageProp/noeditsection' />
23310 <meta property='mw:PageProp/notitleconvert' />
23311 <meta property='mw:PageProp/nocontentconvert' />
23312 <meta property='mw:PageProp/unknownproperty' />
23313 !! wikitext
23314 __TOC__
23315 __NOTOC__
23316 __FORCETOC__
23317 __INDEX__
23318 __NOINDEX__
23319 __NOGALLERY__
23320 __NOEDITSECTION__
23321 __NOTITLECONVERT__
23322 __NOCONTENTCONVERT__
23323 !! end
23324
23325 !! test
23326 Consecutive <pre>s should not get merged
23327 !! options
23328 parsoid=html2wt,html2html
23329 !! html
23330 <pre>a</pre><pre>b</pre>
23331
23332 <pre>c
23333 </pre><pre>
23334 d</pre>
23335
23336 <pre>e
23337
23338 </pre><pre>
23339
23340 f</pre>
23341 !! wikitext
23342 a
23343
23344 b
23345
23346 c
23347
23348 d
23349
23350 e
23351
23352
23353
23354 f
23355 !! end
23356
23357 !! test
23358 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23359 !! options
23360 parsoid=html2wt
23361 !! html
23362 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23363 !! wikitext
23364 [[Special:BookSources/1234567890|ISBN 1234567895]]
23365 !! end
23366
23367 !! test
23368 Edited RFC links not serializable as RFC links should serialize as extlinks
23369 !! options
23370 parsoid=html2wt
23371 !! html
23372 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23373 !! wikitext
23374 [//tools.ietf.org/html/rfc123 New RFC]
23375 !! end
23376
23377 !! test
23378 Edited PMID links not serializable as PMID links should serialize as extlinks
23379 !! options
23380 parsoid=html2wt
23381 !! html
23382 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23383 !! wikitext
23384 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23385 !! end
23386
23387 !! test
23388 WTS of autolinks with trailing/surrounding context
23389 !! options
23390 parsoid=html2wt
23391 !! html/parsoid
23392 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23393 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23394 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23395 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23396 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23397 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23398 !! wikitext
23399 http://cscott.net<nowiki/>'''foo'''
23400
23401 http://cscott.net<b>foo</b>
23402
23403 '''http://cscott.net<nowiki/>'''
23404
23405 '''http://cscott.net '''
23406
23407 '''http://cscott.net<nowiki/>x'''
23408
23409 http://cscott.net<nowiki/>x
23410 !! end
23411
23412 !! test
23413 WTS of autolinks with nowikis (round-trip)
23414 !! wikitext
23415 x<nowiki/>http://cscott.net<nowiki/>x
23416 !! html/parsoid
23417 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23418 !! end
23419
23420 # this is the "easy" test because it leaves in place all the
23421 # data-parsoid information indicating this is an autolink
23422 !! test
23423 WTS of autolinks with escapes (editing)
23424 !! options
23425 parsoid={
23426 "modes": ["wt2wt"],
23427 "changes": [
23428 [ "meta", "remove" ]
23429 ]
23430 }
23431 !! wikitext
23432 x<nowiki/>http://cscott.net<nowiki/>x
23433 !! wikitext/edited
23434 x<nowiki/>http://cscott.net<nowiki/>x
23435 !! end
23436
23437 !! test
23438 Edited Redirect link should emit a non-piped wikitext link
23439 !! options
23440 parsoid=html2wt
23441 !! html
23442 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23443 !! wikitext
23444 #REDIRECT [[Bar]]
23445 !! end
23446
23447 !! test
23448 T75121: Infer extension name from typeOf if data-mw is not present
23449 !! options
23450 parsoid=html2wt
23451 !! html
23452 <div typeOf="mw:Extension/foo"></div>
23453 !! wikitext
23454 <foo />
23455 !! end
23456
23457 # -----------------------------------------------------------------
23458 # End of section for Parsoid-only html2wt tests for serialization
23459 # of new content
23460 # -----------------------------------------------------------------
23461
23462 TODO:
23463 more images
23464 more tables
23465 character entities
23466 and much more
23467 Try for 100% code coverage