Sync up with Parsoid parserTests.
[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 <b→> doesn't terminate </b→>
1213
1214 <bä> doesn't terminate </bä>
1215
1216 <boo> doesn't terminate </boo>
1217
1218 <s.foo> doesn't terminate </s.foo>
1219
1220 <sub-ID#1>
1221 !! html
1222 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1223 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1224 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1225 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1226 </p><p>&lt;sub-ID#1&gt;
1227 </p>
1228 !! end
1229
1230 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1231 !! test
1232 Non-word characters don't terminate tag names + tidy
1233 !! wikitext
1234 <b→> doesn't terminate </b→>
1235
1236 <bä> doesn't terminate </bä>
1237
1238 <boo> doesn't terminate </boo>
1239
1240 <s.foo> doesn't terminate </s.foo>
1241
1242 <sub-ID#1>
1243 !! html+tidy
1244 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1245 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1246 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1247 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1248 <p>&lt;sub-ID#1&gt;</p>
1249 !! end
1250
1251 !! test
1252 Isolated close tags should be treated as literal text (bug 52760)
1253 !! wikitext
1254 </b>
1255
1256 <s.foo>s</s>
1257 !! html
1258 <p>&lt;/b&gt;
1259 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1260 </p>
1261 !! end
1262
1263 ###
1264 ### Special characters
1265 ###
1266
1267 !! test
1268 Bare pipe character (bug 52363)
1269 !! wikitext
1270 |
1271 !! html
1272 <p>|
1273 </p>
1274 !! end
1275
1276 !! test
1277 Bare pipe character from a template (bug 52363)
1278 !! wikitext
1279 {{pipe}}
1280 !! html
1281 <p>|
1282 </p>
1283 !! end
1284
1285 ###
1286 ### <nowiki> test cases
1287 ###
1288
1289 !! test
1290 <nowiki> unordered list
1291 !! wikitext
1292 <nowiki>* This is not an unordered list item.</nowiki>
1293 !! html
1294 <p>* This is not an unordered list item.
1295 </p>
1296 !! end
1297
1298 !! test
1299 <nowiki> spacing
1300 !! wikitext
1301 <nowiki>Lorem ipsum dolor
1302
1303 sed abit.
1304 sed nullum.
1305
1306 :and a colon
1307 </nowiki>
1308 !! html
1309 <p>Lorem ipsum dolor
1310
1311 sed abit.
1312 sed nullum.
1313
1314 :and a colon
1315
1316 </p>
1317 !! end
1318
1319 !! test
1320 nowiki 3
1321 !! wikitext
1322 :There is not nowiki.
1323 :There is <nowiki>nowiki</nowiki>.
1324
1325 #There is not nowiki.
1326 #There is <nowiki>nowiki</nowiki>.
1327
1328 *There is not nowiki.
1329 *There is <nowiki>nowiki</nowiki>.
1330 !! html
1331 <dl><dd>There is not nowiki.</dd>
1332 <dd>There is nowiki.</dd></dl>
1333 <ol><li>There is not nowiki.</li>
1334 <li>There is nowiki.</li></ol>
1335 <ul><li>There is not nowiki.</li>
1336 <li>There is nowiki.</li></ul>
1337
1338 !! end
1339
1340 !! test
1341 Entities inside <nowiki>
1342 !! wikitext
1343 <nowiki>&lt;</nowiki>
1344 !! html
1345 <p>&lt;
1346 </p>
1347 !! end
1348
1349 !! test
1350 Entities inside template parameters
1351 !! options
1352 parsoid
1353 !! wikitext
1354 {{echo|&ndash;}}
1355 !! html
1356 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1357 !! end
1358
1359 !! test
1360 Properly escape nowiki when combined with other wiki markup
1361 !! options
1362 parsoid=html2wt
1363 !! html
1364 <p>* &lt;/nowiki&gt; tag</p>
1365 !! wikitext
1366 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1367 !! end
1368
1369 ###
1370 ### Comments
1371 ###
1372 !! test
1373 Comments and Indent-Pre
1374 !! wikitext
1375 <!-- comment 1 --> asdf
1376
1377 <!-- comment 1 --> asdf
1378 <!-- comment 2 -->
1379
1380 <!-- comment 1 --> asdf
1381 <!-- comment 2 -->xyz
1382
1383 <!-- comment 1 --> asdf
1384 <!-- comment 2 --> xyz
1385 !! html
1386 <pre>asdf
1387 </pre>
1388 <pre>asdf
1389 </pre>
1390 <pre>asdf
1391 </pre>
1392 <p>xyz
1393 </p>
1394 <pre>asdf
1395 xyz
1396 </pre>
1397 !! end
1398
1399 !! test
1400 Comment test 2a
1401 !! wikitext
1402 asdf
1403 <!-- comment 1 -->
1404 jkl
1405 !! html
1406 <p>asdf
1407 jkl
1408 </p>
1409 !! end
1410
1411 !! test
1412 Comment test 2b
1413 !! wikitext
1414 asdf
1415 <!-- comment 1 -->
1416
1417 jkl
1418 !! html
1419 <p>asdf
1420 </p><p>jkl
1421 </p>
1422 !! end
1423
1424 !! test
1425 Comment test 3
1426 !! wikitext
1427 asdf
1428 <!-- comment 1 -->
1429 <!-- comment 2 -->
1430 jkl
1431 !! html
1432 <p>asdf
1433 jkl
1434 </p>
1435 !! end
1436
1437 !! test
1438 Comment test 4
1439 !! wikitext
1440 asdf<!-- comment 1 -->jkl
1441 !! html
1442 <p>asdfjkl
1443 </p>
1444 !! end
1445
1446 !! test
1447 Comment spacing
1448 !! wikitext
1449 a
1450 <!-- foo --> b <!-- bar -->
1451 c
1452 !! html
1453 <p>a
1454 </p>
1455 <pre> b
1456 </pre>
1457 <p>c
1458 </p>
1459 !! end
1460
1461 !! test
1462 Comment whitespace
1463 !! wikitext
1464 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1465 !! html
1466
1467 !! end
1468
1469 !! test
1470 Comment semantics and delimiters
1471 !! wikitext
1472 <!-- --><!----><!-----><!------>
1473 !! html
1474
1475 !! end
1476
1477 !! test
1478 Comment semantics and delimiters, redux
1479 !! wikitext
1480 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1481 -- foo -- funky huh? ... -->
1482 !! html
1483
1484 !! end
1485
1486 !! test
1487 Comment semantics and delimiters: directors cut
1488 !! wikitext
1489 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1490 everything starting with < followed by !-- until the first -- and > we see,
1491 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1492 -->-->
1493 !! html
1494 <p>--&gt;
1495 </p>
1496 !! end
1497
1498 !! test
1499 Comment semantics: nesting
1500 !! wikitext
1501 <!--<!-- no, we're not going to do anything fancy here -->-->
1502 !! html
1503 <p>--&gt;
1504 </p>
1505 !! end
1506
1507 !! test
1508 Comment semantics: unclosed comment at end
1509 !! wikitext
1510 <!--This comment will run out to the end of the document
1511 !! html
1512
1513 !! end
1514
1515 # Bug 58184: document parsoid's behaviour
1516 !! test
1517 Suppress comment closing tag in lenient browsers
1518 !! options
1519 parsoid=wt2html,html2html
1520 !! wikitext
1521 <!-- Browsers--!> think this is closed -->
1522 !! html/php
1523
1524 !! html/parsoid
1525 <!-- Browsers--¡> think this is closed -->
1526 !! end
1527
1528 !! test
1529 Comment in template title
1530 !! wikitext
1531 {{f<!---->oo}}
1532 !! html
1533 <p>FOO
1534 </p>
1535 !! end
1536
1537 !! test
1538 Comment on its own line post-expand
1539 !! wikitext
1540 a
1541 {{blank}}<!---->
1542 b
1543 !! html
1544 <p>a
1545 </p><p>b
1546 </p>
1547 !! end
1548
1549 !! test
1550 Comment on its own line post-expand with non-significant whitespace
1551 !! wikitext
1552 a
1553 {{blank}} <!---->
1554 b
1555 !! html
1556 <p>a
1557 </p><p>b
1558 </p>
1559 !! end
1560
1561 !! test
1562 Multiple comments should still parse as SOL-transparent
1563 !! options
1564 parsoid=wt2html,wt2wt
1565 !! wikitext
1566 <!--c1-->*a
1567 <!--c2--><!--c3--><!--c4-->*b
1568 !! html
1569 <ul>
1570 <li>a
1571 </li>
1572 <li>b
1573 </li>
1574 </ul>
1575 !! end
1576
1577 ###
1578 ### paragraph wrapping tests
1579 ###
1580 !! test
1581 No block tags
1582 !! wikitext
1583 a
1584
1585 b
1586 !! html
1587 <p>a
1588 </p><p>b
1589 </p>
1590 !! end
1591
1592 !! test
1593 Block tag on one line (<div>)
1594 !! wikitext
1595 a <div>foo</div>
1596
1597 b
1598 !! html
1599 a <div>foo</div>
1600 <p>b
1601 </p>
1602 !! html+tidy
1603 <p>a</p>
1604 <div>foo</div>
1605 <p>b</p>
1606 !! end
1607
1608 !! test
1609 Block tag on one line (<blockquote>)
1610 !! wikitext
1611 a <blockquote>foo</blockquote>
1612
1613 b
1614 !! html
1615 a <blockquote>foo</blockquote>
1616 <p>b
1617 </p>
1618 !! html+tidy
1619 <p>a</p>
1620 <blockquote>
1621 <p>foo</p>
1622 </blockquote>
1623 <p>b</p>
1624 !! end
1625
1626 !! test
1627 Block tag on both lines (<div>)
1628 !! wikitext
1629 a <div>foo</div>
1630
1631 b <div>foo</div>
1632 !! html
1633 a <div>foo</div>
1634 b <div>foo</div>
1635
1636 !! html+tidy
1637 <p>a</p>
1638 <div>foo</div>
1639 <p>b</p>
1640 <div>foo</div>
1641 !! end
1642
1643 !! test
1644 Block tag on both lines (<blockquote>)
1645 !! wikitext
1646 a <blockquote>foo</blockquote>
1647
1648 b <blockquote>foo</blockquote>
1649 !! html
1650 a <blockquote>foo</blockquote>
1651 b <blockquote>foo</blockquote>
1652
1653 !! html+tidy
1654 <p>a</p>
1655 <blockquote>
1656 <p>foo</p>
1657 </blockquote>
1658 <p>b</p>
1659 <blockquote>
1660 <p>foo</p>
1661 </blockquote>
1662 !! end
1663
1664 !! test
1665 Multiple lines without block tags
1666 !! wikitext
1667 <div>foo</div> a
1668 b
1669 c
1670 d<!--foo--> e
1671 x <div>foo</div> z
1672 !! html
1673 <div>foo</div> a
1674 <p>b
1675 c
1676 d e
1677 </p>
1678 x <div>foo</div> z
1679
1680 !! html+tidy
1681 <div>foo</div>
1682 <p>a</p>
1683 <p>b c d e</p>
1684 <p>x</p>
1685 <div>foo</div>
1686 <p>z</p>
1687 !! end
1688
1689 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1690 # So, we have a separate section for Parsoid. We don't want
1691 # to mimic this stripping behavior in Parsoid. It affects
1692 # editing experience and also requires us to maintain additional
1693 # info for RT-ing.
1694 !! test
1695 Empty lines between lines with block tags
1696 !! wikitext
1697 <div></div>
1698
1699
1700 <div></div>a
1701
1702 b
1703 <div>a</div>b
1704
1705 <div>b</div>d
1706
1707
1708 <div>e</div>
1709 !! html
1710 <div></div>
1711 <p><br />
1712 </p>
1713 <div></div>a
1714 <p>b
1715 </p>
1716 <div>a</div>b
1717 <div>b</div>d
1718 <p><br />
1719 </p>
1720 <div>e</div>
1721
1722 !! html+tidy
1723 <p><br /></p>
1724 <p>a</p>
1725 <p>b</p>
1726 <div>a</div>
1727 <p>b</p>
1728 <div>b</div>
1729 <p>d</p>
1730 <p><br /></p>
1731 <div>e</div>
1732 !! html/parsoid
1733 <div data-parsoid='{"stx":"html"}'></div>
1734
1735 <p><br /></p>
1736 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1737
1738 <p>b</p>
1739 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1740
1741 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1742
1743 <p><br /></p>
1744 <div data-parsoid='{"stx":"html"}'>e</div>
1745 !! end
1746
1747 ## PHP parser emits output which is broken
1748 ## XXX The parsoid output doesn't match the tidy output.
1749 !! test
1750 Unclosed HTML p-tags should be handled properly
1751 !! wikitext
1752 <div><p>foo</div>
1753 a
1754
1755 b
1756 !! html/php+tidy
1757 <div>
1758 <p>foo&lt;/div&gt;</p>
1759 <p>a</p>
1760 b</div>
1761 !! html/parsoid
1762 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1763 <p>a</p>
1764 <p>b</p>
1765 !! end
1766
1767 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1768 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1769 ## them for now.
1770 !! test
1771 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1772 !! options
1773 parsoid=wt2html
1774 !! wikitext
1775 a [[Category:A1]] [[Category:A2]]
1776 [[Category:A3]]
1777 [[Category:A4]]
1778 !! html/parsoid
1779 <p>a</p>
1780 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1781 !! end
1782
1783 !! test
1784 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1785 !! options
1786 parsoid=wt2html
1787 !! wikitext
1788 [[Category:A1]]a
1789 !! html/parsoid
1790 <link href="Category:A1"/><p>a</p>
1791 !! end
1792
1793 ###
1794 ### Preformatted text
1795 ###
1796 !! test
1797 Preformatted text
1798 !! wikitext
1799 This is some
1800 Preformatted text
1801 With ''italic''
1802 And '''bold'''
1803 And a [[Main Page|link]]
1804 !! html
1805 <pre>This is some
1806 Preformatted text
1807 With <i>italic</i>
1808 And <b>bold</b>
1809 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1810 </pre>
1811 !! end
1812
1813 !! test
1814 Tabs don't trigger preformatted text
1815 !! wikitext
1816 This is not
1817 preformatted text.
1818 This is preformatted text.
1819 So is this.
1820 !! html
1821 <p> This is not
1822 preformatted text.
1823 </p>
1824 <pre>This is preformatted text.
1825 So is this.
1826 </pre>
1827 !! end
1828
1829 !! test
1830 Ident preformatting with inline content
1831 !! wikitext
1832 a
1833 ''b''
1834 !! html
1835 <pre>a
1836 <i>b</i>
1837 </pre>
1838 !! end
1839
1840 !! test
1841 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1842 !! wikitext
1843 <pre><nowiki>
1844 <b>
1845 <cite>
1846 <em>
1847 </nowiki></pre>
1848 !! html
1849 <pre>
1850 &lt;b&gt;
1851 &lt;cite&gt;
1852 &lt;em&gt;
1853 </pre>
1854
1855 !! end
1856
1857 !! test
1858 Regression with preformatted in <center>
1859 !! wikitext
1860 <center>
1861 Blah
1862 </center>
1863 !! html
1864 <center>
1865 <pre>Blah
1866 </pre>
1867 </center>
1868
1869 !! end
1870
1871 !! test
1872 Bug 52763: Preformatted in <blockquote>
1873 !! wikitext
1874 <blockquote>
1875 Blah
1876 {|
1877 |
1878 indented cell (no pre-wrapping!)
1879 |}
1880 </blockquote>
1881 !! html
1882 <blockquote>
1883 <p> Blah
1884 </p>
1885 <table>
1886 <tr>
1887 <td>
1888 <p> indented cell (no pre-wrapping!)
1889 </p>
1890 </td></tr></table>
1891 </blockquote>
1892
1893 !! end
1894
1895 !! test
1896 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1897 !! wikitext
1898 <blockquote>
1899 Foo
1900
1901 Bar
1902 </blockquote>
1903 !! html
1904 <blockquote>
1905 <p>Foo
1906 </p><p>Bar
1907 </p>
1908 </blockquote>
1909
1910 !! end
1911
1912 !! test
1913 Bug 15491: <ins>/<del> in blockquote
1914 !! wikitext
1915 <blockquote>
1916 Foo <del>bar</del> <ins>baz</ins> quux
1917 </blockquote>
1918 !! html
1919 <blockquote>
1920 <p>Foo <del>bar</del> <ins>baz</ins> quux
1921 </p>
1922 </blockquote>
1923
1924 !! end
1925
1926 # Note that the p-wrapping is newline sensitive, which could be
1927 # considered a bug: tidy will wrap only the 'Foo' in the example
1928 # below in a <p> tag. (see comment 23-25 of bug #6200)
1929 !! test
1930 Bug 15491: <ins>/<del> in blockquote (2)
1931 !! wikitext
1932 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1933 </blockquote>
1934 !! html
1935 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1936 </blockquote>
1937
1938 !! html+tidy
1939 <blockquote>
1940 <p>Foo</p>
1941 <del>bar</del> <ins>baz</ins> quux</blockquote>
1942 !! end
1943
1944 !! test
1945 <pre> with attributes (bug 3202)
1946 !! wikitext
1947 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1948 !! html
1949 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1950
1951 !! end
1952
1953 !! test
1954 <pre> with width attribute (bug 3202)
1955 !! wikitext
1956 <pre width="8">Narrow screen goodies</pre>
1957 !! html
1958 <pre width="8">Narrow screen goodies</pre>
1959
1960 !! end
1961
1962 !! test
1963 <pre> with forbidden attribute (bug 3202)
1964 !! wikitext
1965 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1966 !! html
1967 <pre width="8">Narrow screen goodies</pre>
1968
1969 !! end
1970
1971 !! test
1972 Entities inside <pre>
1973 !! wikitext
1974 <pre>&lt;</pre>
1975 !! html
1976 <pre>&lt;</pre>
1977
1978 !! end
1979
1980 !! test
1981 <pre> with forbidden attribute values (bug 3202)
1982 !! wikitext
1983 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1984 !! html
1985 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1986
1987 !! end
1988
1989 !! test
1990 <nowiki> inside <pre> (bug 13238)
1991 !! wikitext
1992 <pre>
1993 <nowiki>
1994 </pre>
1995 <pre>
1996 <nowiki></nowiki>
1997 </pre>
1998 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1999 !! html
2000 <pre>
2001 &lt;nowiki&gt;
2002 </pre>
2003 <pre>
2004
2005 </pre>
2006 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2007
2008 !! end
2009
2010 !! test
2011 <nowiki> and <pre> preference (first one wins)
2012 !! wikitext
2013 <pre>
2014 <nowiki>
2015 </pre>
2016 </nowiki>
2017 </pre>
2018
2019 <nowiki>
2020 <pre>
2021 <nowiki>
2022 </pre>
2023 </nowiki>
2024 </pre>
2025
2026 !! html
2027 <pre>
2028 &lt;nowiki&gt;
2029 </pre>
2030 <p>&lt;/nowiki&gt;
2031 &lt;/pre&gt;
2032 </p><p>
2033 &lt;pre&gt;
2034 &lt;nowiki&gt;
2035 &lt;/pre&gt;
2036
2037 &lt;/pre&gt;
2038 </p>
2039 !! end
2040
2041 !! test
2042 </pre> inside nowiki
2043 !! wikitext
2044 <nowiki></pre></nowiki>
2045 !! html
2046 <p>&lt;/pre&gt;
2047 </p>
2048 !! end
2049
2050 # Parsoid doesn't strip empty tags, like Tidy does.
2051 !! test
2052 Empty pre; pre inside other HTML tags (bug 54946)
2053 !! options
2054 parsoid=wt2html,wt2wt
2055 !! wikitext
2056 a
2057
2058 <div><pre>
2059 foo
2060 </pre></div>
2061 <pre></pre>
2062 !! html/php
2063 <p>a
2064 </p>
2065 <div><pre>
2066 foo
2067 </pre></div>
2068 <pre></pre>
2069
2070 !! html/php+tidy
2071 <p>a</p>
2072 <div>
2073 <pre>
2074 foo
2075 </pre></div>
2076 !! html/parsoid
2077 <p>a</p>
2078
2079 <div><pre>foo
2080 </pre></div>
2081 <pre></pre>
2082 !! end
2083
2084 !! test
2085 HTML pre followed by indent-pre
2086 !! wikitext
2087 <pre>foo</pre>
2088 bar
2089 !! html
2090 <pre>foo</pre>
2091 <pre>bar
2092 </pre>
2093 !! end
2094
2095 !!test
2096 Block tag pre
2097 !!options
2098 parsoid
2099 !! wikitext
2100 <p><pre>foo</pre></p>
2101 !! html
2102 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2103 !!end
2104
2105 !!test
2106 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2107 !! wikitext
2108 {{echo|}}
2109 !! html
2110
2111 !!end
2112
2113 !!test
2114 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2115 !! wikitext
2116 {{echo|
2117 foo}}
2118 !! html
2119 <p>foo
2120 </p>
2121 !!end
2122
2123 !! test
2124 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2125 !! wikitext
2126 {{echo|a
2127 b}}
2128 !! html
2129 <pre>a
2130 </pre>
2131 <p>b
2132 </p>
2133 !!end
2134
2135 !! test
2136 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2137 !! wikitext
2138 {{echo|a
2139 b
2140 c
2141 d
2142 e
2143 }}
2144 !! html
2145 <pre>a
2146 </pre>
2147 <p>b
2148 c
2149 </p>
2150 <pre>d
2151 </pre>
2152 <p>e
2153 </p>
2154 !!end
2155
2156 !!test
2157 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2158 !! wikitext
2159 {{echo| foo}}
2160
2161 {{echo| foo}}{{echo| bar}}
2162
2163 {{echo| foo}}
2164 {{echo| bar}}
2165
2166 {{echo|<!--cmt--> foo}}
2167
2168 <!--cmt-->{{echo| foo}}
2169
2170 {{echo|{{echo| }}bar}}
2171 !! html
2172 <pre>foo
2173 </pre>
2174 <pre>foo bar
2175 </pre>
2176 <pre>foo
2177 bar
2178 </pre>
2179 <pre>foo
2180 </pre>
2181 <pre>foo
2182 </pre>
2183 <pre>bar
2184 </pre>
2185 !!end
2186
2187 !! test
2188 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2189 !! wikitext
2190 {{echo| }}a
2191
2192 {{echo|
2193 }}a
2194
2195 {{echo|
2196 b}}
2197
2198 {{echo|a
2199 }}b
2200
2201 {{echo|a
2202 }} b
2203 !! html
2204 <pre>a
2205 </pre>
2206 <p><br />
2207 </p>
2208 <pre>a
2209 </pre>
2210 <p><br />
2211 </p>
2212 <pre>b
2213 </pre>
2214 <p>a
2215 </p>
2216 <pre>b
2217 </pre>
2218 <p>a
2219 </p>
2220 <pre>b
2221 </pre>
2222 !!end
2223
2224 !! test
2225 Things that look like <pre> tags aren't treated as such
2226 !! wikitext
2227 Barack Obama <President> of the United States
2228 <President></President>
2229 !! html
2230 <p>Barack Obama &lt;President&gt; of the United States
2231 &lt;President&gt;&lt;/President&gt;
2232 </p>
2233 !! end
2234
2235 ## PHP parser discards the "<pre " string
2236 !! test
2237 Handle broken pre-like tags (bug 64025)
2238 !! options
2239 parsoid=wt2html
2240 !! wikitext
2241 {{echo|<pre <pre>x</pre>}}
2242
2243 <table><pre </table>
2244 !! html/php
2245 <pre>x</pre>
2246 <table><pre></pre></table>
2247
2248 !! html/parsoid
2249 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2250
2251
2252 <p>&lt;pre </p>
2253
2254 <table></table>
2255 !! end
2256
2257 !! test
2258 Parsoid: handle pre with space after attribute
2259 !! options
2260 parsoid=wt2html
2261 !! wikitext
2262 <pre style="width:50%;" >{{echo|foo}}</pre>
2263 !! html
2264 <pre style="width:50%;">{{echo|foo}}</pre>
2265 !! end
2266
2267 # TODO / maybe: fix wt2wt for this
2268 !! test
2269 Parsoid: Don't paragraph-wrap fosterable content
2270 !! options
2271 parsoid=wt2html
2272 !! wikitext
2273 {|
2274 <td></td>
2275 <td></td>
2276
2277
2278
2279 |}
2280 !! html
2281 <table>
2282
2283 <tbody>
2284 <tr>
2285 <td></td>
2286
2287 <td></td></tr>
2288
2289
2290
2291 </tbody></table>
2292 !! end
2293
2294 !! test
2295 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2296 !! options
2297 parsoid=wt2html
2298 !! wikitext
2299 {|
2300 <td>
2301 <td>
2302 </td>
2303
2304
2305
2306 |}
2307 !! html
2308 <table>
2309
2310 <tbody>
2311 <tr>
2312 <td></td>
2313
2314 <td>
2315 </td></tr>
2316
2317
2318
2319 </tbody></table>
2320 !! end
2321
2322
2323 #--------------------------------------------------------------------
2324 # Transclusion parameter whitespace stripping tests
2325 # Behavior is different for positional and named parameters
2326 #--------------------------------------------------------------------
2327 !! test
2328 Templates: Strip leading and trailing whitespace from named-param values
2329 !! wikitext
2330 {{echo|1= a }}
2331
2332 {{echo|1= {{echo|b}} }}
2333
2334 {{echo| 1 =
2335 c }}
2336
2337 {{echo| 1 =
2338 * d
2339 }}
2340 !! html
2341 <p>a
2342 </p><p>b
2343 </p><p>c
2344 </p>
2345 <ul><li> d</li></ul>
2346
2347 !! end
2348
2349 !! test
2350 Templates: Don't strip whitespace from positional-param values
2351 !! wikitext
2352 {{echo|a }}
2353
2354 {{echo|{{echo|b}} }}
2355
2356 {{echo| c
2357 }}
2358
2359 {{echo| {{echo|d}}
2360 }}
2361
2362 {{echo|
2363 e}}
2364
2365 {{echo|
2366 * f}}
2367
2368 {{echo|
2369 }}g
2370 !! html
2371 <p>a
2372 </p><p>b
2373 </p>
2374 <pre>c
2375 </pre>
2376 <p><br />
2377 </p>
2378 <pre>d
2379 </pre>
2380 <p><br />
2381 </p>
2382 <pre>e
2383 </pre>
2384 <p><br />
2385 </p>
2386 <ul><li> f</li></ul>
2387 <p><br />
2388 </p>
2389 <pre>g
2390 </pre>
2391 !! end
2392
2393 !! test
2394 Templates: Handle empty comment-and-ws-only lines correctly
2395 !! wikitext
2396 {{echo|foo
2397 <!--should be ignored-->
2398 <!--should be ignored as well-->
2399 bar}}
2400 !! html
2401 <p>foo
2402 bar
2403 </p>
2404 !! end
2405
2406 !! test
2407 Templates: Handle comments in the target
2408 !! wikitext
2409 {{echo
2410 <!-- should be ignored -->
2411 |foo}}
2412
2413 {{echo<!-- should be ignored -->
2414 |foo}}
2415
2416 {{echo<!-- should be ignored -->|foo}}
2417
2418 {{<!-- should be ignored -->echo|foo}}
2419 !!html/parsoid
2420 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2421
2422 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2423
2424 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2425
2426 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2427 !!end
2428
2429 !! test
2430 Templates: Handle comments in parameter names (bug 67657)
2431 !! wikitext
2432 {{echo|1
2433 <!-- should be ignored -->
2434 =foo}}
2435
2436 {{echo|
2437 <!-- should be ignored -->
2438 1 = foo}}
2439
2440 {{echo|1<!-- should be ignored --> = foo}}
2441
2442 {{echo|<!-- should be ignored -->1 = foo}}
2443 !!html/parsoid
2444 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2445
2446 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2447
2448 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2449
2450 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2451 !!end
2452
2453 !! test
2454 Templates: Other wikitext in parameter names (bug 67657)
2455 !! wikitext
2456 {{echo|''1''=foo}}
2457 !!html/parsoid
2458 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2459 !!html/php
2460 <p>{{{1}}}
2461 </p>
2462 !!end
2463
2464 #--------------------------------------------------------------------
2465 # Transclusion parameter escaping tests
2466 #--------------------------------------------------------------------
2467 !! test
2468 Templates: Parsoid parameter escaping test 1
2469 !! options
2470 parsoid
2471 !! wikitext
2472 {{echo|[foo]|{{echo|[bar]}}}}
2473 !! html
2474 <p about="#mwt1" typeof="mw:Transclusion"
2475 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2476 !! end
2477
2478 !! test
2479 Parsoid: Pipes in external links in template parameter
2480 !! options
2481 parsoid
2482 !! wikitext
2483 {{echo|[{{echo|http://example.com}} link]}}
2484 !! html
2485 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2486 !! end
2487
2488 !! test
2489 Parsoid: pipe in transclusion parameter
2490 !! options
2491 parsoid
2492 !! wikitext
2493 {{echo|http://foo.com/a&#124;b}}
2494 !! html
2495 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2496 typeof="mw:Transclusion"
2497 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2498 !! end
2499
2500 !! test
2501 Parsoid: Pipe in external link target and content in template parameter
2502 !! options
2503 parsoid=html2wt,wt2wt
2504 !! wikitext
2505 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2506 !! html
2507 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2508 typeof="mw:Transclusion"
2509 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2510 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2511 !! end
2512
2513 !! test
2514 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2515 !! options
2516 parsoid
2517 !! wikitext
2518 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2519 !! html
2520 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2521 !! end
2522
2523 !! test
2524 Templates: Don't escape already nowiki-escaped text in template parameters
2525 !! options
2526 parsoid=html2wt,wt2wt
2527 !! wikitext
2528 {{echo|foo<nowiki>|</nowiki>bar}}
2529 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2530 {{echo|<nowiki></nowiki>}}
2531 !! html
2532 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2533 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2534 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2535 </p>
2536 !! end
2537
2538 ## Bug 52824
2539 !! test
2540 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2541 !! options
2542 parsoid=html2wt,wt2wt
2543 !! wikitext
2544 {{echo|{{echo|1=bar}}}}
2545 !! html
2546 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2547 !! end
2548
2549 ## Bug 56733
2550 !! test
2551 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2552 !! options
2553 parsoid
2554 !! wikitext
2555 {{echo|a : b}}
2556 !! html
2557 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2558 !! end
2559
2560 ## Bug T73412
2561 !! test
2562 Templates: Preserve blank parameter names
2563 !! wikitext
2564 {{echo|=foo}}
2565 !! html/php
2566 <p>{{{1}}}
2567 </p>
2568 !! html/parsoid
2569 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2570 !! end
2571
2572 ###
2573 ### Parsoid-centric tests for testing RT edge cases for pre
2574 ###
2575
2576 !!test
2577 1a. Indent-Pre and Comments
2578 !! wikitext
2579 a
2580 <!--a-->
2581 c
2582 !! html
2583 <pre>a
2584 </pre>
2585 <p>c
2586 </p>
2587 !!end
2588
2589 !!test
2590 1b. Indent-Pre and Comments
2591 !! wikitext
2592 a
2593 <!--a-->
2594 c
2595 !! html
2596 <pre>a
2597 </pre>
2598 <p>c
2599 </p>
2600 !!end
2601
2602 !!test
2603 1c. Indent-Pre and Comments
2604 !! wikitext
2605 <!--a--> a
2606
2607 <!--a--> a
2608 !! html
2609 <pre> a
2610 </pre>
2611 <pre> a
2612 </pre>
2613 !!end
2614
2615 !!test
2616 1d. Indent-Pre and Comments
2617 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2618 !! wikitext
2619 <!--a--> a
2620
2621 <!--b-->b
2622 !! html
2623 <pre>a
2624 </pre>
2625 <pre>b
2626 </pre>
2627 !!end
2628
2629 !!test
2630 2a. Indent-Pre and tables
2631 !! wikitext
2632 {|
2633 |-
2634 !h1!!h2
2635 |foo||bar
2636 |}
2637 !! html
2638 <table>
2639
2640 <tr>
2641 <th>h1</th>
2642 <th>h2
2643 </th>
2644 <td>foo</td>
2645 <td>bar
2646 </td></tr></table>
2647
2648 !!end
2649
2650 !!test
2651 2b. Indent-Pre and tables
2652 !! wikitext
2653 {|
2654 |-
2655 |foo
2656 |}
2657 !! html
2658 <table>
2659
2660 <tr>
2661 <td>foo
2662 </td></tr></table>
2663
2664 !!end
2665
2666 !!test
2667 2c. Indent-Pre and tables (bug 42252)
2668 !! wikitext
2669 {|
2670 |+ foo
2671 ! | bar
2672 |}
2673 !! html
2674 <table>
2675 <caption> foo
2676 </caption>
2677 <tr>
2678 <th> bar
2679 </th></tr></table>
2680
2681 !!end
2682
2683 !!test
2684 2d. Indent-Pre and tables
2685 !! wikitext
2686 a
2687 {|
2688 | b
2689 |}
2690 !! html/php
2691 <pre>a
2692 </pre>
2693 <table>
2694 <tr>
2695 <td> b
2696 </td></tr></table>
2697
2698 !! html/parsoid
2699 <pre>a</pre>
2700 <table>
2701 <tbody><tr><td> b</td></tr>
2702 </tbody></table>
2703 !!end
2704
2705 !!test
2706 2e. Indent-Pre and table-line syntax
2707 !! wikitext
2708 a
2709 | b
2710 | c
2711 !! html/php
2712 <pre>a
2713 | b
2714 | c
2715 </pre>
2716 !!end
2717
2718 !!test
2719 2f. Indent-pre started by table-line syntax
2720 !! wikitext
2721 a
2722 | b
2723 | c
2724 !! html/php
2725 <p>a
2726 </p>
2727 <pre>| b
2728 | c
2729 </pre>
2730 !! html/parsoid
2731 <p>a</p>
2732 <pre>
2733 | b
2734 | c</pre>
2735 !!end
2736
2737 !!test
2738 3a. Indent-Pre and block tags (single-line html)
2739 !! wikitext
2740 a <p> foo </p>
2741 b <div> foo </div>
2742 c <blockquote> foo </blockquote>
2743 <span> foo </span>
2744 !! html
2745 a <p> foo </p>
2746 b <div> foo </div>
2747 c <blockquote> foo </blockquote>
2748 <pre><span> foo </span>
2749 </pre>
2750 !! html/parsoid
2751 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2752 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2753 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2754 <pre><span> foo </span>
2755 </pre>
2756 !! html+tidy
2757 <p>a</p>
2758 <p>foo</p>
2759 <p>b</p>
2760 <div>foo</div>
2761 <p>c</p>
2762 <blockquote>
2763 <p>foo</p>
2764 </blockquote>
2765 <pre>
2766 <span> foo </span>
2767 </pre>
2768 !! end
2769
2770 !!test
2771 3b. Indent-Pre and block tags (multi-line html)
2772 !! wikitext
2773 a <span>foo</span>
2774 b <div> foo </div>
2775 !! html
2776 <pre>a <span>foo</span>
2777 </pre>
2778 b <div> foo </div>
2779
2780 !! html/parsoid
2781 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2782 b <div data-parsoid='{"stx":"html"}'> foo </div>
2783 !! html+tidy
2784 <pre>
2785 a <span>foo</span>
2786 </pre>
2787 <p>b</p>
2788 <div>foo</div>
2789 !!end
2790
2791 !!test
2792 3c. Indent-Pre and block tags (pre-content on separate line)
2793 !! wikitext
2794 <p>
2795 foo
2796 </p>
2797
2798 <div>
2799 foo
2800 </div>
2801
2802 <center>
2803 foo
2804 </center>
2805
2806 <blockquote>
2807 foo
2808 </blockquote>
2809
2810 <blockquote>
2811 <pre>
2812 foo
2813 </pre>
2814 </blockquote>
2815
2816 <table><tr><td>
2817 foo
2818 </td></tr></table>
2819
2820 <ul><li>
2821 foo
2822 </li></ul>
2823
2824 !! html
2825 <p>
2826 foo
2827 </p>
2828 <div>
2829 <pre>foo
2830 </pre>
2831 </div>
2832 <center>
2833 <pre>foo
2834 </pre>
2835 </center>
2836 <blockquote>
2837 <p> foo
2838 </p>
2839 </blockquote>
2840 <blockquote>
2841 <pre>
2842 foo
2843 </pre>
2844 </blockquote>
2845 <table><tr><td>
2846 <pre>foo
2847 </pre>
2848 </td></tr></table>
2849 <ul><li>
2850 foo
2851 </li></ul>
2852
2853 !!end
2854
2855 !!test
2856 4. Indent-Pre and extension tags
2857 !! wikitext
2858 a <gallery>
2859 File:foobar.jpg
2860 </gallery>
2861 !! html
2862 a <ul class="gallery mw-gallery-traditional">
2863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2864 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
2865 <div class="gallerytext">
2866 </div>
2867 </div></li>
2868 </ul>
2869
2870 !! html+tidy
2871 <p>a</p>
2872 <ul class="gallery mw-gallery-traditional">
2873 <li class="gallerybox" style="width: 155px">
2874 <div style="width: 155px">
2875 <div class="thumb" style="width: 150px;">
2876 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
2877 </div>
2878 <div class="gallerytext"></div>
2879 </div>
2880 </li>
2881 </ul>
2882 !!end
2883
2884 !! test
2885 Table wikitext syntax outside wiki-tables
2886 !! wikitext
2887 a
2888 ! not a table heading
2889 |- not a table row
2890 | not a table cell
2891 | class="foo bar" | baz
2892 b
2893 |}
2894 |-
2895 c
2896 !! html
2897 <p>a
2898 ! not a table heading
2899 |- not a table row
2900 | not a table cell
2901 | class="foo bar" | baz
2902 b
2903 |}
2904 |-
2905 c
2906 </p>
2907 !! end
2908
2909 !!test
2910 Render paragraphs when indent-pre is suppressed in blocklevels
2911 !! wikitext
2912 <blockquote>
2913 foo
2914
2915 bar
2916 </blockquote>
2917 !! html
2918 <blockquote>
2919 <p> foo
2920 </p><p> bar
2921 </p>
2922 </blockquote>
2923
2924 !!end
2925
2926 !!test
2927 4. Multiple spaces at start-of-line
2928 !! wikitext
2929 <p> foo </p>
2930 foo
2931 {|
2932 |foo
2933 |}
2934 !! html
2935 <p> foo </p>
2936 <pre> foo
2937 </pre>
2938 <table>
2939 <tr>
2940 <td>foo
2941 </td></tr></table>
2942
2943 !!end
2944
2945 ## NOTE: the leading white-space chars on empty line are significant
2946 !! test
2947 5a. White-space in indent-pre
2948 !! wikitext
2949 a<br />
2950
2951 b
2952 !! html
2953 <pre>a<br />
2954
2955 b
2956 </pre>
2957 !! end
2958
2959 ## NOTE: the leading white-space chars on empty line are significant
2960 !! test
2961 5b. White-space in indent-pre
2962 !! wikitext
2963 a
2964
2965 b
2966
2967
2968 c
2969 !! html
2970 <pre>a
2971
2972 b
2973
2974
2975 c
2976 </pre>
2977 !! end
2978
2979 !! test
2980 5c. White-space in indent-pre
2981 !! wikitext
2982 ''a''
2983 ''b''
2984 ''c''
2985 !! html
2986 <pre><i>a</i>
2987 <i>b</i>
2988 <i>c</i>
2989 </pre>
2990 !! end
2991
2992 !! test
2993 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2994 !! wikitext
2995 a
2996
2997 <!-- continue -->
2998 b
2999
3000 c
3001
3002 d
3003 !! html
3004 <pre>a
3005
3006 b
3007 </pre>
3008 <pre>c
3009
3010 </pre>
3011 <p>d
3012 </p>
3013 !! end
3014
3015 !! test
3016 7a. Indent-pre and category links
3017 !! options
3018 parsoid=wt2html,wt2wt
3019 !! wikitext
3020 [[Category:foo]] <!-- No pre-wrapping -->
3021 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3022 !! html
3023 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3024 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
3025 !! end
3026
3027 !! test
3028 7b. Indent-pre and category links
3029 !! options
3030 parsoid=wt2html,wt2wt
3031 !! wikitext
3032 [[Category:foo]] a
3033 [[Category:foo]] {{echo|b}}
3034 !! html
3035 <pre>
3036 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3037 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3038 !! end
3039
3040 ###
3041 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3042 ###
3043
3044 !!test
3045 HTML-pre: 1. embedded newlines
3046 !! wikitext
3047 <pre>foo</pre>
3048
3049 <pre>
3050 foo
3051 </pre>
3052
3053 <pre>
3054
3055 foo
3056 </pre>
3057
3058 <pre>
3059
3060
3061 foo
3062 </pre>
3063 !! html
3064 <pre>foo</pre>
3065 <pre>
3066 foo
3067 </pre>
3068 <pre>
3069
3070 foo
3071 </pre>
3072 <pre>
3073
3074
3075 foo
3076 </pre>
3077
3078 !! html/parsoid
3079 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3080
3081 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3082 foo
3083 </pre>
3084
3085 <pre data-parsoid='{"stx":"html"}'>
3086
3087 foo
3088 </pre>
3089
3090 <pre data-parsoid='{"stx":"html"}'>
3091
3092
3093 foo
3094 </pre>
3095 !!end
3096
3097 !! test
3098 HTML-pre: big spaces
3099 !! wikitext
3100 <pre>
3101
3102
3103
3104
3105 haha
3106
3107
3108
3109
3110 haha
3111
3112
3113
3114
3115 </pre>
3116 !! html
3117 <pre>
3118
3119
3120
3121
3122 haha
3123
3124
3125
3126
3127 haha
3128
3129
3130
3131
3132 </pre>
3133
3134 !! html/parsoid
3135 <pre data-parsoid='{"stx":"html"}'>
3136
3137
3138
3139
3140 haha
3141
3142
3143
3144
3145 haha
3146
3147
3148
3149
3150 </pre>
3151 !! end
3152
3153 !!test
3154 HTML-pre: 2: indented text
3155 !! wikitext
3156 <pre>
3157 foo
3158 </pre>
3159 !! html
3160 <pre>
3161 foo
3162 </pre>
3163
3164 !!end
3165
3166 !!test
3167 HTML-pre: 3: other wikitext
3168 !! wikitext
3169 <pre>
3170 * foo
3171 # bar
3172 = no-h =
3173 '' no-italic ''
3174 [[ NoLink ]]
3175 </pre>
3176 !! html
3177 <pre>
3178 * foo
3179 # bar
3180 = no-h =
3181 '' no-italic ''
3182 [[ NoLink ]]
3183 </pre>
3184
3185 !!end
3186
3187 ###
3188 ### Definition lists
3189 ###
3190 !! test
3191 Simple definition
3192 !! wikitext
3193 ; name : Definition
3194 !! html
3195 <dl><dt> name&#160;</dt>
3196 <dd> Definition</dd></dl>
3197
3198 !! end
3199
3200 !! test
3201 Definition list for indentation only
3202 !! wikitext
3203 : Indented text
3204 !! html
3205 <dl><dd> Indented text</dd></dl>
3206
3207 !! end
3208
3209 !! test
3210 Definition list with no space
3211 !! wikitext
3212 ;name:Definition
3213 !! html
3214 <dl><dt>name</dt>
3215 <dd>Definition</dd></dl>
3216
3217 !!end
3218
3219 !! test
3220 Definition list with URL link
3221 !! wikitext
3222 ; http://example.com/ : definition
3223 !! html
3224 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3225 <dd> definition</dd></dl>
3226
3227 !! end
3228
3229 !! test
3230 Definition list with bracketed URL link
3231 !! wikitext
3232 ;[http://www.example.com/ Example]:Something about it
3233 !! html
3234 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3235 <dd>Something about it</dd></dl>
3236
3237 !! end
3238
3239 !! test
3240 Definition list with wikilink containing colon
3241 !! wikitext
3242 ; [[Help:FAQ]]: The least-read page on Wikipedia
3243 !! html
3244 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3245 <dd> The least-read page on Wikipedia</dd></dl>
3246
3247 !! end
3248
3249 # At Brion's and JeLuF's insistence... :)
3250 !! test
3251 Definition list with news link containing colon
3252 !! wikitext
3253 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3254 !! html/php
3255 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3256 <dd> This isn't even a real newsgroup!</dd></dl>
3257
3258 !! html/parsoid
3259 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3260 !! end
3261
3262 !! test
3263 Malformed definition list with colon
3264 !! wikitext
3265 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3266 !! html
3267 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3268
3269 !! end
3270
3271 !! test
3272 Definition lists: colon in external link text
3273 !! wikitext
3274 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3275 !! html
3276 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3277 <dd> OK, I made that up</dd></dl>
3278
3279 !! end
3280
3281 !! test
3282 Definition lists: colon in HTML attribute
3283 !! wikitext
3284 ;<b style="display: inline">bold</b>
3285 !! html
3286 <dl><dt><b style="display: inline">bold</b></dt></dl>
3287
3288 !! end
3289
3290 !! test
3291 Definition lists: self-closed tag
3292 !! wikitext
3293 ;one<br/>two : two-line fun
3294 !! html
3295 <dl><dt>one<br />two&#160;</dt>
3296 <dd> two-line fun</dd></dl>
3297
3298 !! end
3299
3300 !! test
3301 Bug 11748: Literal closing tags
3302 !! wikitext
3303 <dl>
3304 <dt>test 1</dt>
3305 <dd>test test test test test</dd>
3306 <dt>test 2</dt>
3307 <dd>test test test test test</dd>
3308 </dl>
3309 !! html
3310 <dl>
3311 <dt>test 1</dt>
3312 <dd>test test test test test</dd>
3313 <dt>test 2</dt>
3314 <dd>test test test test test</dd>
3315 </dl>
3316
3317 !! end
3318
3319 !! test
3320 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3321 !! wikitext
3322 <ul><li>
3323 ; term : description
3324 * unordered
3325 </li></ul>
3326 !! html
3327 <ul><li>
3328 <dl><dt> term&#160;</dt>
3329 <dd> description</dd></dl>
3330 <ul><li> unordered</li></ul>
3331 </li></ul>
3332
3333 !! end
3334
3335 !! test
3336
3337 Definition list with empty definition and following paragraph
3338 !! wikitext
3339 ; term:
3340 Paragraph text
3341 !! html
3342 <dl><dt> term</dt>
3343 <dd></dd></dl>
3344 <p>Paragraph text
3345 </p>
3346 !! end
3347
3348 !! test
3349 Nested definition lists using html syntax
3350 !! wikitext
3351 <dl><dt>x</dt>
3352 <dd>a</dd>
3353 <dd>b</dd></dl>
3354
3355 !! end
3356
3357 !! test
3358 Definition Lists: No nesting: Multiple dd's
3359 !! wikitext
3360 ;x
3361 :a
3362 :b
3363 !! html
3364 <dl><dt>x</dt>
3365 <dd>a</dd>
3366 <dd>b</dd></dl>
3367
3368 !! end
3369
3370 !! test
3371 Definition Lists: Indentation: Regular
3372 !! wikitext
3373 :i1
3374 ::i2
3375 :::i3
3376 !! html
3377 <dl><dd>i1
3378 <dl><dd>i2
3379 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3380
3381 !! end
3382
3383 !! test
3384 Definition Lists: Indentation: Missing 1st level
3385 !! wikitext
3386 ::i2
3387 :::i3
3388 !! html
3389 <dl><dd><dl><dd>i2
3390 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3391
3392 !! end
3393
3394 !! test
3395 Definition Lists: Indentation: Multi-level indent
3396 !! wikitext
3397 :::i3
3398 !! html
3399 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3400
3401 !! end
3402
3403 !! test
3404 Definition Lists: Hacky use to indent tables
3405 !! wikitext
3406 ::{|
3407 |foo
3408 |bar
3409 |}
3410 this text
3411 should be left alone
3412 !! html
3413 <dl><dd><dl><dd><table>
3414 <tr>
3415 <td>foo
3416 </td>
3417 <td>bar
3418 </td></tr></table></dd></dl></dd></dl>
3419 <p>this text
3420 should be left alone
3421 </p>
3422 !! end
3423
3424 !! test
3425 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3426 !! wikitext
3427 <!-- foo -->
3428 ::{|
3429 |foo
3430 |bar
3431 |}<!-- bar -->
3432 this text
3433 should be left alone
3434 !! html/parsoid
3435 <!-- foo -->
3436 <dl><dd><dl><dd><table><tr>
3437 <td>foo</td>
3438 <td>bar</td>
3439 </tr></table><!-- bar --></dd></dl></dd></dl>
3440 <p>this text
3441 should be left alone</p>
3442 !! end
3443
3444 !! test
3445 Definition Lists: Hacky use to indent tables, with comment before table
3446 !! wikitext
3447 ::<!-- foo -->{|
3448 |foo
3449 |}
3450 !! html/parsoid
3451 <dl><dd><dl><dd><!-- foo --><table><tr>
3452 <td>foo</td>
3453 </tr></table></dd></dl></dd></dl>
3454 !! end
3455
3456 # Bug 52473
3457 !! test
3458 Definition Lists: Hacky use to indent tables (WS-insensitive)
3459 !! options
3460 parsoid
3461 !! wikitext
3462 : {|
3463 |a
3464 |}
3465 !! html
3466 <dl>
3467 <dd> <table><tr><td>a</td></tr></table> </dd>
3468 </dl>
3469 !! end
3470 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3471 ## as an empty dt item. It also ignores all but the last ";" when followed
3472 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3473 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3474 ## ";"s.
3475 ##
3476 ## Ex: ";;t2 ::d2" is transformed into:
3477 ##
3478 ## <dl>
3479 ## <dt>t2 </dt>
3480 ## <dd>
3481 ## <dl>
3482 ## <dt></dt>
3483 ## <dd>d2</dd>
3484 ## </dl>
3485 ## </dd>
3486 ## </dl>
3487 ##
3488 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3489 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3490 ##
3491 ## <dl>
3492 ## <dt>
3493 ## <dl>
3494 ## <dt>t2 </dt>
3495 ## <dd>:d2</dd>
3496 ## </dl>
3497 ## </dt>
3498 ## </dl>
3499 ##
3500 ## All Parsoid only definition list tests have this difference.
3501 ##
3502 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3503 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3504
3505 !! test
3506 Table / list interaction: indented table with lists in table contents
3507 !! wikitext
3508 :{|
3509 |-
3510 | a
3511 * b
3512 |-
3513 | c
3514 * d
3515 |}
3516 !! html
3517 <dl><dd><table>
3518
3519 <tr>
3520 <td> a
3521 <ul><li> b</li></ul>
3522 </td></tr>
3523 <tr>
3524 <td> c
3525 <ul><li> d</li></ul>
3526 </td></tr></table></dd></dl>
3527
3528 !! end
3529
3530 !!test
3531 Table / list interaction: lists nested in tables nested in indented lists
3532 !! wikitext
3533 :{|
3534 |
3535 :a
3536 :b
3537 |
3538 *c
3539 *d
3540 |}
3541
3542 *e
3543 *f
3544 !! html
3545 <dl><dd><table>
3546 <tr>
3547 <td>
3548 <dl><dd>a</dd>
3549 <dd>b</dd></dl>
3550 </td>
3551 <td>
3552 <ul><li>c</li>
3553 <li>d</li></ul>
3554 </td></tr></table></dd></dl>
3555 <ul><li>e</li>
3556 <li>f</li></ul>
3557
3558 !!end
3559
3560 !! test
3561 Definition Lists: Nesting: Multi-level (Parsoid only)
3562 !! options
3563 parsoid
3564 !! wikitext
3565 ;t1 :d1
3566 ;;t2 ::d2
3567 ;;;t3 :::d3
3568 !! html
3569 <dl>
3570 <dt>t1 </dt>
3571 <dd>d1</dd>
3572 <dt>
3573 <dl>
3574 <dt>t2 </dt>
3575 <dd>:d2</dd>
3576 <dt>
3577 <dl>
3578 <dt>t3 </dt>
3579 <dd>::d3</dd>
3580 </dl>
3581 </dt>
3582 </dl>
3583 </dt>
3584 </dl>
3585
3586
3587 !! end
3588
3589
3590 !! test
3591 Definition Lists: Nesting: Test 2 (Parsoid only)
3592 !! options
3593 parsoid
3594 !! wikitext
3595 ;t1
3596 ::d2
3597 !! html
3598 <dl>
3599 <dt>t1</dt>
3600 <dd>
3601 <dl>
3602 <dd>d2</dd>
3603 </dl>
3604 </dd>
3605 </dl>
3606
3607 !! end
3608
3609
3610 !! test
3611 Definition Lists: Nesting: Test 3 (Parsoid only)
3612 !! options
3613 parsoid
3614 !! wikitext
3615 :;t1
3616 ::::d2
3617 !! html
3618 <dl>
3619 <dd>
3620 <dl>
3621 <dt>t1</dt>
3622 <dd>
3623 <dl>
3624 <dd>
3625 <dl>
3626 <dd>d2</dd>
3627 </dl>
3628 </dd>
3629 </dl>
3630 </dd>
3631 </dl>
3632 </dd>
3633 </dl>
3634
3635 !! end
3636
3637
3638 !! test
3639 Definition Lists: Nesting: Test 4
3640 !! wikitext
3641 ::;t3
3642 :::d3
3643 !! html
3644 <dl><dd><dl><dd><dl><dt>t3</dt>
3645 <dd>d3</dd></dl></dd></dl></dd></dl>
3646
3647 !! end
3648
3649
3650 ## The Parsoid team believes the following three test exposes a
3651 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3652 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3653 ## It also exposes a "misfeature" in tidy, which doesn't like
3654 ## <dl> tags with a single <dt> child; it converts the <dt> into
3655 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3656 !! test
3657 Definition Lists: Mixed Lists: Test 1
3658 !! wikitext
3659 :;* foo
3660 ::* bar
3661 :; baz
3662 !! html/php
3663 <dl><dd><dl><dt><ul><li> foo</li>
3664 <li> bar</li></ul></dt></dl>
3665 <dl><dt> baz</dt></dl></dd></dl>
3666
3667 !! html/php+tidy
3668 <dl>
3669 <dd>
3670 <dl>
3671 <dd>
3672 <ul>
3673 <li>foo</li>
3674 <li>bar</li>
3675 </ul>
3676 </dd>
3677 </dl>
3678 <dl>
3679 <dt>baz</dt>
3680 </dl>
3681 </dd>
3682 </dl>
3683 !! html/parsoid
3684 <dl>
3685 <dd><dl>
3686 <dt><ul>
3687 <li> foo
3688 </li>
3689 </ul></dt>
3690 <dd><ul>
3691 <li> bar
3692 </li>
3693 </ul></dd>
3694 <dt> baz</dt>
3695 </dl></dd>
3696 </dl>
3697 !! end
3698
3699 !! test
3700 Definition Lists: Mixed Lists: Test 2
3701 !! wikitext
3702 *: d1
3703 *: d2
3704 !! html
3705 <ul><li><dl><dd> d1</dd>
3706 <dd> d2</dd></dl></li></ul>
3707
3708 !! end
3709
3710
3711 !! test
3712 Definition Lists: Mixed Lists: Test 3
3713 !! wikitext
3714 *::: d1
3715 *::: d2
3716 !! html
3717 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3718 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3719
3720 !! end
3721
3722
3723 !! test
3724 Definition Lists: Mixed Lists: Test 4
3725 !! wikitext
3726 *;d1 :d2
3727 *;d3 :d4
3728 !! html
3729 <ul><li><dl><dt>d1&#160;</dt>
3730 <dd>d2</dd>
3731 <dt>d3&#160;</dt>
3732 <dd>d4</dd></dl></li></ul>
3733
3734 !! end
3735
3736
3737 !! test
3738 Definition Lists: Mixed Lists: Test 5
3739 !! wikitext
3740 *:d1
3741 *:: d2
3742 !! html
3743 <ul><li><dl><dd>d1
3744 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3745
3746 !! end
3747
3748
3749 !! test
3750 Definition Lists: Mixed Lists: Test 6
3751 !! wikitext
3752 #*:d1
3753 #*::: d3
3754 !! html
3755 <ol><li><ul><li><dl><dd>d1
3756 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3757
3758 !! end
3759
3760
3761 !! test
3762 Definition Lists: Mixed Lists: Test 7
3763 !! wikitext
3764 :* d1
3765 :* d2
3766 !! html
3767 <dl><dd><ul><li> d1</li>
3768 <li> d2</li></ul></dd></dl>
3769
3770 !! end
3771
3772
3773 !! test
3774 Definition Lists: Mixed Lists: Test 8
3775 !! wikitext
3776 :* d1
3777 ::* d2
3778 !! html
3779 <dl><dd><ul><li> d1</li></ul>
3780 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3781
3782 !! end
3783
3784
3785 !! test
3786 Definition Lists: Mixed Lists: Test 9
3787 !! wikitext
3788 *;foo :bar
3789 !! html
3790 <ul><li><dl><dt>foo&#160;</dt>
3791 <dd>bar</dd></dl></li></ul>
3792
3793 !! end
3794
3795
3796 !! test
3797 Definition Lists: Mixed Lists: Test 10
3798 !! wikitext
3799 *#;foo :bar
3800 !! html
3801 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3802 <dd>bar</dd></dl></li></ol></li></ul>
3803
3804 !! end
3805
3806 # The Parsoid team disagrees with the PHP parser's seemingly-random
3807 # rules regarding dd/dt on the next two tests. Parsoid is more
3808 # consistent, and recognizes the shared nesting and keeps the
3809 # still-open tags around until the nesting is complete.
3810 # (And tidy again converts <dt> to <dd> before 'bar'.)
3811
3812 !! test
3813 Definition Lists: Mixed Lists: Test 11
3814 !! wikitext
3815 *#*#;*;;foo :bar
3816 *#*#;boo :baz
3817 !! html/php
3818 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3819 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3820 <dl><dt>boo&#160;</dt>
3821 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3822
3823 !! html/php+tidy
3824 <ul>
3825 <li>
3826 <ol>
3827 <li>
3828 <ul>
3829 <li>
3830 <ol>
3831 <li>
3832 <dl>
3833 <dt>foo&#160;</dt>
3834 <dd>
3835 <ul>
3836 <li>
3837 <dl>
3838 <dd>
3839 <dl>
3840 <dt>bar</dt>
3841 </dl>
3842 </dd>
3843 </dl>
3844 </li>
3845 </ul>
3846 </dd>
3847 </dl>
3848 <dl>
3849 <dt>boo&#160;</dt>
3850 <dd>baz</dd>
3851 </dl>
3852 </li>
3853 </ol>
3854 </li>
3855 </ul>
3856 </li>
3857 </ol>
3858 </li>
3859 </ul>
3860 !! html/parsoid
3861 <ul>
3862 <li>
3863 <ol>
3864 <li>
3865 <ul>
3866 <li>
3867 <ol>
3868 <li>
3869 <dl>
3870 <dt>
3871 <ul>
3872 <li>
3873 <dl>
3874 <dt>
3875 <dl>
3876 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3877 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3878 </dl></dt>
3879 </dl></li>
3880 </ul></dt>
3881 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3882 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3883 </dl></li>
3884 </ol></li>
3885 </ul></li>
3886 </ol></li>
3887 </ul>
3888 !! end
3889
3890
3891 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3892 !! test
3893 Definition Lists: Weird Ones: Test 1
3894 !! wikitext
3895 *#;*::;; foo : bar (who uses this?)
3896 !! html/php
3897 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3898 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
3899
3900 !! html/php+tidy
3901 <ul>
3902 <li>
3903 <ol>
3904 <li>
3905 <dl>
3906 <dt>foo&#160;</dt>
3907 <dd>
3908 <ul>
3909 <li>
3910 <dl>
3911 <dd>
3912 <dl>
3913 <dd>
3914 <dl>
3915 <dd>
3916 <dl>
3917 <dt>bar (who uses this?)</dt>
3918 </dl>
3919 </dd>
3920 </dl>
3921 </dd>
3922 </dl>
3923 </dd>
3924 </dl>
3925 </li>
3926 </ul>
3927 </dd>
3928 </dl>
3929 </li>
3930 </ol>
3931 </li>
3932 </ul>
3933 !! html/parsoid
3934 <ul>
3935 <li>
3936 <ol>
3937 <li>
3938 <dl>
3939 <dt>
3940 <ul>
3941 <li>
3942 <dl>
3943 <dd>
3944 <dl>
3945 <dd>
3946 <dl>
3947 <dt>
3948 <dl>
3949 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
3950 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3951 </dl></dt>
3952 </dl></dd>
3953 </dl></dd>
3954 </dl></li>
3955 </ul></dt>
3956 </dl></li>
3957 </ol></li>
3958 </ul>
3959 !! end
3960
3961 !! test
3962 Definition Lists: colons occurring in tags
3963 !! wikitext
3964 ;a:b
3965 ;'''a:b'''
3966 ;<i>a:b</i>
3967 ;<span>a:b</span>
3968 ;<div>a:b</div>
3969 ;<div>a
3970 :b</div>
3971 ;{{echo|a:b}}
3972 ;{{echo|''a:b''}}
3973 !! html+tidy
3974 <dl>
3975 <dt>a</dt>
3976 <dd>b</dd>
3977 <dt><b>a:b</b></dt>
3978 <dt><i>a:b</i></dt>
3979 <dt><span>a:b</span></dt>
3980 <dd>
3981 <div>a:b</div>
3982 </dd>
3983 <dd>
3984 <div>a
3985 <dl>
3986 <dd>b</dd>
3987 </dl>
3988 </div>
3989 </dd>
3990 <dt>a</dt>
3991 <dd>b</dd>
3992 <dt><i>a:b</i></dt>
3993 </dl>
3994 !! end
3995
3996 !! test
3997 Definition Lists: colons and tables 1
3998 !! wikitext
3999 :{|
4000 | x
4001 |}
4002 :{|
4003 | y
4004 |}
4005 !! html
4006 <dl><dd><table>
4007 <tr>
4008 <td> x
4009 </td></tr></table></dd></dl>
4010 <dl><dd><table>
4011 <tr>
4012 <td> y
4013 </td></tr></table></dd></dl>
4014
4015 !! end
4016
4017 # Parsoid's output (as documented below) differs from php's in this case.
4018 # This is probably a bug. If we fixup parsoid to match php's output, the
4019 # above test should pass and the below test case can be removed. It is
4020 # unclear which output is more desirable.
4021
4022 !! test
4023 Definition Lists: colons and tables 2
4024 !! wikitext
4025 :{|
4026 | x
4027 |}
4028 :{|
4029 | y
4030 |}
4031 !! html/parsoid
4032 <dl><dd><table>
4033 <tr>
4034 <td> x
4035 </td></tr></table></dd>
4036 <dd><table>
4037 <tr>
4038 <td> y
4039 </td></tr></table></dd></dl>
4040 !! end
4041
4042
4043 ###
4044 ### External links
4045 ###
4046 !! test
4047 External links: non-bracketed
4048 !! wikitext
4049 Non-bracketed: http://example.com
4050 !! html
4051 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4052 </p>
4053 !! end
4054
4055 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4056 !! test
4057 External links: numbered
4058 !! wikitext
4059 Numbered: [http://example.com]
4060 Numbered: [http://example.net]
4061 Numbered: [http://example.com]
4062 !! html/php
4063 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4064 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4065 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4066 </p>
4067 !! html/parsoid
4068 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4069 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4070 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4071 !!end
4072
4073 !! test
4074 External links: specified text
4075 !! wikitext
4076 Specified text: [http://example.com link]
4077 !! html
4078 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4079 </p>
4080 !!end
4081
4082 !! test
4083 External links: trail
4084 !! wikitext
4085 Linktrails should not work for external links: [http://example.com link]s
4086 !! html
4087 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4088 </p>
4089 !! end
4090
4091 !! test
4092 External links: dollar sign in URL
4093 !! wikitext
4094 http://example.com/1$2345
4095 !! html
4096 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4097 </p>
4098 !! end
4099
4100 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4101 !! test
4102 External links: dollar sign in URL (autonumber)
4103 !! wikitext
4104 [http://example.com/1$2345]
4105 !! html/php
4106 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4107 </p>
4108 !! html/parsoid
4109 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4110 !!end
4111
4112 !! test
4113 External links: open square bracket forbidden in URL (bug 4377)
4114 !! options
4115 parsoid=wt2html,wt2wt,html2html
4116 !! wikitext
4117 http://example.com/1[2345
4118 !! html/php
4119 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4120 </p>
4121 !! html/parsoid
4122 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4123 !! end
4124
4125 !! test
4126 External links: open square bracket forbidden in URL (named) (bug 4377)
4127 !! options
4128 parsoid=wt2html,html2html
4129 !! wikitext
4130 [http://example.com/1[2345]
4131 !! html/php
4132 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4133 </p>
4134 !! html/parsoid
4135 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4136 !!end
4137
4138 # parsoid adds a space before the link name
4139 !! test
4140 External links: open square bracket forbidden in URL (named) (bug 4377)
4141 Parsoid variant.
4142 !! wikitext
4143 [http://example.com/1 [2345]
4144 !! html
4145 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4146 </p>
4147 !!end
4148
4149 !! test
4150 External links: nowiki in URL link text (bug 6230)
4151 !! wikitext
4152 [http://example.com/ <nowiki>''example site''</nowiki>]
4153 !! html
4154 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4155 </p>
4156 !! end
4157
4158 !! test
4159 External links: newline forbidden in text (bug 6230 regression check)
4160 !! wikitext
4161 [http://example.com/ first
4162 second]
4163 !! html
4164 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4165 second]
4166 </p>
4167 !!end
4168
4169 !! test
4170 External links: Pipe char between url and text
4171 !! wikitext
4172 [http://example.com | link]
4173 !! html
4174 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4175 </p>
4176 !!end
4177
4178 !! test
4179 External links: protocol-relative URL in brackets
4180 !! wikitext
4181 [//example.com/ Test]
4182 !! html
4183 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4184 </p>
4185 !! end
4186
4187 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4188 !! test
4189 External links: protocol-relative URL in brackets without text
4190 !! wikitext
4191 [//example.com]
4192 !! html/php
4193 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4194 </p>
4195 !! html/parsoid
4196 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4197 !! end
4198
4199 !! test
4200 External links: protocol-relative URL in free text is left alone
4201 !! wikitext
4202 //example.com/Foo
4203 !! html
4204 <p>//example.com/Foo
4205 </p>
4206 !!end
4207
4208 !! test
4209 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4210 !! wikitext
4211 foo//example.com/Foo
4212 !! html
4213 <p>foo//example.com/Foo
4214 </p>
4215 !! end
4216
4217 !! test
4218 External links: with no contents
4219 !! wikitext
4220 [http://en.wikipedia.org/wiki/Foo]
4221
4222 [[wikipedia:Foo|Bar]]
4223
4224 [[wikipedia:Foo|<span>Bar</span>]]
4225 !! html/php
4226 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4227 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4228 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4229 </p>
4230 !! html/parsoid
4231 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4232 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4233 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4234 !! end
4235
4236 !! test
4237 External links: Free with trailing punctuation
4238 !! wikitext
4239 http://example.com,
4240 http://example.com;
4241 http://example.com\
4242 http://example.com.
4243 http://example.com:
4244 http://example.com!
4245 http://example.com?
4246 http://example.com)
4247 http://example.com/url_with_(brackets)
4248 (http://example.com/url_without_brackets)
4249 http://example.com/url_with_entity&nbsp;
4250 http://example.com/url_with_entity&#xA0;
4251 http://example.com/url_with_entity&#160;
4252 http://example.com/url_with_entity&lt;
4253 http://example.com/url_with_entity&#x3C;
4254 http://example.com/url_with_entity&#60;
4255 !! html/php
4256 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4257 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4258 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4259 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4260 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4261 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4262 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4263 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4264 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4265 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4266 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4267 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4268 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4269 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4270 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4271 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4272 </p>
4273 !! html/parsoid
4274 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4275 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4276 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4277 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4278 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4279 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4280 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4281 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4282 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4283 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4284 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4285 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4286 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4287 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4288 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4289 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4290 !! end
4291
4292 !! test
4293 External links: No preceding word characters allowed (bug 65278)
4294 !! wikitext
4295 NOPEhttp://example.com
4296 N0http://example.com
4297 ok:http://example.com
4298 ok-http://example.com
4299 !! html
4300 <p>NOPEhttp://example.com
4301 N0http://example.com
4302 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4303 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4304 </p>
4305 !! end
4306
4307 !! test
4308 External image
4309 !! wikitext
4310 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4311 !! html
4312 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4313 </p>
4314 !! end
4315
4316 !! test
4317 External image from https
4318 !! wikitext
4319 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4320 !! html
4321 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4322 </p>
4323 !! end
4324
4325 !! test
4326 External image (when not allowed)
4327 !! options
4328 wgAllowExternalImages=0
4329 !! wikitext
4330 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4331 !! html
4332 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Link to non-http image, no img tag
4338 !! wikitext
4339 Link to non-http image, no img tag: ftp://example.com/test.jpg
4340 !! html
4341 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4342 </p>
4343 !! end
4344
4345 !! test
4346 External links: terminating separator
4347 !! wikitext
4348 Terminating separator: http://example.com/thing,
4349 !! html
4350 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4351 </p>
4352 !! end
4353
4354 !! test
4355 External links: intervening separator
4356 !! wikitext
4357 Intervening separator: http://example.com/1,2,3
4358 !! html
4359 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4360 </p>
4361 !! end
4362
4363 !! test
4364 External links: old bug with URL in query
4365 !! wikitext
4366 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4367 !! html
4368 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4369 </p>
4370 !! end
4371
4372 !! test
4373 External links: old URL-in-URL bug, mixed protocols
4374 !! wikitext
4375 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4376 !! html
4377 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4378 </p>
4379 !!end
4380
4381 !! test
4382 External links: URL in text
4383 !! wikitext
4384 URL in text: [http://example.com http://example.com]
4385 !! html
4386 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4387 </p>
4388 !! end
4389
4390 !! test
4391 External links: Clickable images
4392 !! wikitext
4393 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4394 !! html/php
4395 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4396 </p>
4397 !! html/parsoid
4398 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4399 !! end
4400
4401 !! test
4402 External links: raw ampersand
4403 !! wikitext
4404 Old &amp; use: http://x&y
4405 !! html
4406 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4407 </p>
4408 !! end
4409
4410 !! test
4411 External links: encoded ampersand
4412 !! wikitext
4413 Old &amp; use: http://x&amp;y
4414 !! html/php
4415 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4416 </p>
4417 !! html/parsoid
4418 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4419 !! end
4420
4421 !! test
4422 External links: encoded equals (bug 6102)
4423 !! wikitext
4424 http://example.com/?foo&#61;bar
4425 !! html/php
4426 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4427 </p>
4428 !! html/parsoid
4429 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4430 !! end
4431
4432 ##
4433 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4434 ## does it number them. As discussed in bug 53505, we can identify
4435 ## autonumbered links via CSS.
4436 ##
4437
4438 !! test
4439 External links: [raw ampersand]
4440 !! wikitext
4441 Old &amp; use: [http://x&y]
4442 !! html/php
4443 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4447 !! end
4448
4449 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4450 # mode will return the [raw ampersand] wikitext
4451 !! test
4452 External links: [encoded ampersand]
4453 !! options
4454 parsoid=wt2html,wt2wt,html2html
4455 !! wikitext
4456 Old &amp; use: [http://x&amp;y]
4457 !! html/php
4458 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4459 </p>
4460 !! html/parsoid
4461 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4462 !! end
4463
4464 !! test
4465 External links: [raw equals]
4466 !! wikitext
4467 [http://example.com/?foo=bar]
4468 !! html/php
4469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4470 </p>
4471 !! html/parsoid
4472 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4473 !! end
4474
4475 # note that parsoid html is identical to [raw equals] case; so html2wt
4476 # mode will return the [raw equals] wikitext
4477 !! test
4478 External links: [encoded equals] (bug 6102)
4479 !! options
4480 parsoid=wt2html,wt2wt,html2html
4481 !! wikitext
4482 [http://example.com/?foo&#61;bar]
4483 !! html/php
4484 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4485 </p>
4486 !! html/parsoid
4487 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4488 !! end
4489
4490 # xxx parsoid strips the IDN character, so the round-trip tests will
4491 # obviously fail and are disabled. --cscott
4492 !! test
4493 External links: [IDN ignored character reference in hostname; strip it right off]
4494 !! options
4495 parsoid=wt2html,wt2wt,html2html
4496 !! wikitext
4497 [http://e&zwnj;xample.com/]
4498 !! html/php
4499 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4500 </p>
4501 !! html/parsoid
4502 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4503 !! end
4504
4505 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4506 # Where an external link could easily circumvent the sanitization of the text of
4507 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4508 # test demands a higher standard. That's a bit strange.
4509 #
4510 # Example:
4511 #
4512 # http://e‌xample.com -> [http://example.com|http://example.com]
4513 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4514 #
4515 # The first example is sanitized, but the second is not. Any security benefits
4516 # from this production are trivial to circumvent. Either remove this test and
4517 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4518 # the test accordingly.
4519 #
4520 # All our love,
4521 # The Parsoid team.
4522 # xxx parsoid strips the IDN character, so the round-trip tests will
4523 # obviously fail and are disabled. --cscott
4524 !! test
4525 External links: IDN ignored character reference in hostname; strip it right off
4526 !! options
4527 parsoid=wt2html,html2html
4528 !! wikitext
4529 http://e&zwnj;xample.com/
4530 !! html/php
4531 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4532 </p>
4533 !! html/parsoid
4534 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4535 !! end
4536
4537 !! test
4538 External links: www.jpeg.org (bug 554)
4539 !! wikitext
4540 http://www.jpeg.org
4541 !! html
4542 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4543 </p>
4544 !! end
4545
4546 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4547 !! test
4548 External links: URL within URL (original bug 2)
4549 !! wikitext
4550 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4551 !! html/php
4552 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4553 </p>
4554 !! html/parsoid
4555 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4556 !! end
4557
4558 !! test
4559 BUG 361: URL inside bracketed URL
4560 !! wikitext
4561 [http://www.example.com/foo http://www.example.com/bar]
4562 !! html
4563 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4564 </p>
4565 !! end
4566
4567 !! test
4568 BUG 361: URL within URL, not bracketed
4569 !! wikitext
4570 http://www.example.com/foo?=http://www.example.com/bar
4571 !! html
4572 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4573 </p>
4574 !! end
4575
4576 !! test
4577 BUG 289: ">"-token in URL-tail
4578 !! wikitext
4579 http://www.example.com/<hello>
4580 !! html
4581 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4582 </p>
4583 !!end
4584
4585 !! test
4586 BUG 289: literal ">"-token in URL-tail
4587 !! wikitext
4588 http://www.example.com/<b>html</b>
4589 !! html/php
4590 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4591 </p>
4592 !! html/parsoid
4593 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4594 !! end
4595
4596 !! test
4597 BUG 289: ">"-token in bracketed URL
4598 !! wikitext
4599 [http://www.example.com/<hello> stuff]
4600 !! html
4601 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4602 </p>
4603 !!end
4604
4605 !! test
4606 BUG 289: literal ">"-token in bracketed URL
4607 !! wikitext
4608 [http://www.example.com/<b>html</b> stuff]
4609 !! html
4610 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4611 </p>
4612 !!end
4613
4614 !! test
4615 BUG 289: literal double quote at end of URL
4616 !! wikitext
4617 http://www.example.com/"hello"
4618 !! html
4619 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4620 </p>
4621 !!end
4622
4623 !! test
4624 BUG 289: literal double quote in bracketed URL
4625 !! wikitext
4626 [http://www.example.com/"hello" stuff]
4627 !! html
4628 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4629 </p>
4630 !!end
4631
4632 !! test
4633 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4634 !! wikitext
4635 [http://www.example.com test]
4636 !! html
4637 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4638 </p>
4639 !! end
4640
4641 !! test
4642 External links: link text with spaces
4643 !! wikitext
4644 [http://www.example.com a b c]
4645 [http://www.example.com ''a'' ''b'']
4646 !! html
4647 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4648 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4649 </p>
4650 !! end
4651
4652 !! test
4653 External links: wiki links within external link (Bug 3695)
4654 !! wikitext
4655 [http://example.com [[wikilink]] embedded in ext link]
4656 !! html/php
4657 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
4658 </p>
4659 !! html/parsoid
4660 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
4661 !! end
4662
4663 !! test
4664 BUG 787: Links with one slash after the url protocol are invalid
4665 !! wikitext
4666 http:/example.com
4667
4668 [http:/example.com title]
4669 !! html
4670 <p>http:/example.com
4671 </p><p>[http:/example.com title]
4672 </p>
4673 !! end
4674
4675 !! test
4676 Bracketed external links with template-generated invalid target
4677 !! wikitext
4678 [{{echo|http:/example.com}} title]
4679 !! html
4680 <p>[http:/example.com title]
4681 </p>
4682 !! end
4683
4684 !! test
4685 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4686 !! wikitext
4687 ''[http://example.com text'']
4688 [http://example.com '''text]'''
4689 ''Something [http://example.com in italic'']
4690 ''Something [http://example.com mixed''''', even bold]'''
4691 '''''Now [http://example.com both''''']
4692 !! html
4693 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4694 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4695 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4696 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4697 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4698 </p>
4699 !! end
4700
4701
4702 !! test
4703 Bug 4781: %26 in URL
4704 !! wikitext
4705 http://www.example.com/?title=AT%26T
4706 !! html/php
4707 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4708 </p>
4709 !! html/parsoid
4710 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4711 !! end
4712
4713 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4714 # % is actually legal in HTML5. Any change in output would need testing though.
4715 !! test
4716 Bug 4781, 5267: %25 in URL
4717 !! wikitext
4718 http://www.example.com/?title=100%25_Bran
4719 !! html/php
4720 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
4721 </p>
4722 !! html/parsoid
4723 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4724 !! end
4725
4726 !! test
4727 Bug 4781, 5267: %28, %29 in URL
4728 !! wikitext
4729 http://www.example.com/?title=Ben-Hur_%281959_film%29
4730 !! html/php
4731 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
4732 </p>
4733 !! html/parsoid
4734 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
4735 !! end
4736
4737
4738 !! test
4739 Bug 4781: %26 in autonumber URL
4740 !! wikitext
4741 [http://www.example.com/?title=AT%26T]
4742 !! html/php
4743 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4744 </p>
4745 !! html/parsoid
4746 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4747 !! end
4748
4749 !! test
4750 Bug 4781, 5267: %26 in autonumber URL
4751 !! wikitext
4752 [http://www.example.com/?title=100%25_Bran]
4753 !! html/php
4754 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4755 </p>
4756 !! html/parsoid
4757 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4758 !! end
4759
4760 !! test
4761 Bug 4781, 5267: %28, %29 in autonumber URL
4762 !! wikitext
4763 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4764 !! html/php
4765 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4766 </p>
4767 !! html/parsoid
4768 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4769 !! end
4770
4771
4772 !! test
4773 Bug 4781: %26 in bracketed URL
4774 !! wikitext
4775 [http://www.example.com/?title=AT%26T link]
4776 !! html/php
4777 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4778 </p>
4779 !! html/parsoid
4780 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4781 !! end
4782
4783 !! test
4784 Bug 4781, 5267: %25 in bracketed URL
4785 !! wikitext
4786 [http://www.example.com/?title=100%25_Bran link]
4787 !! html
4788 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4789 </p>
4790 !! end
4791
4792 !! test
4793 Bug 4781, 5267: %28, %29 in bracketed URL
4794 !! wikitext
4795 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4796 !! html/php
4797 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4798 </p>
4799 !! html/parsoid
4800 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4801 !! end
4802
4803 !! test
4804 External link containing a period in the anchor. (bug 63947)
4805 !! wikitext
4806 [//foo.org/bar#baz. bang]
4807
4808 [//foo.org/bar. bang]
4809 !! html/php
4810 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4811 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4812 </p>
4813 !! html/parsoid
4814 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4815 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4816 !! end
4817
4818 !! test
4819 External link containing a single quote. (bug 63947)
4820 !! wikitext
4821 [//foo.org/bar'baz]
4822
4823 [//foo.org/bar'baz bang]
4824 !! html/php
4825 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4826 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4827 </p>
4828 !! html/parsoid
4829 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4830 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4831 !! end
4832
4833
4834 !! test
4835 External link containing a period in the anchor. (bug 63947)
4836 !! wikitext
4837 [//foo.org/bar#baz. bang]
4838
4839 [//foo.org/bar. bang]
4840 !! html/php
4841 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4842 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4843 </p>
4844 !! html/parsoid
4845 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4846 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4847 !! end
4848
4849 !! test
4850 External link containing a single quote. (bug 63947)
4851 !! wikitext
4852 [//foo.org/bar'baz]
4853
4854 [//foo.org/bar'baz bang]
4855 !! html/php
4856 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4857 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4858 </p>
4859 !! html/parsoid
4860 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4861 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4862 !! end
4863
4864
4865 !! test
4866 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4867 !! wikitext
4868 Some [http://example.com/ pretty ''italics'' and stuff]!
4869 !! html
4870 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4871 </p>
4872 !! end
4873
4874 !! test
4875 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4876 !! wikitext
4877 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4878 !! html
4879 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
4880 </p>
4881 !! end
4882
4883 !! test
4884 External link containing double-single-quotes with no space separating the url from text in italics
4885 !! wikitext
4886 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
4887 !! html/php
4888 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
4889 </p>
4890 !! html/php+tidy
4891 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
4892 !! html/parsoid
4893 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
4894 !! end
4895
4896 !! test
4897 External link with comments in link text
4898 !! wikitext
4899 [http://www.google.com Google <!-- comment -->]
4900 !! html
4901 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4902 </p>
4903 !! end
4904
4905 !! test
4906 URL-encoding in URL functions (single parameter)
4907 !! wikitext
4908 {{localurl:Some page|amp=&}}
4909 !! html
4910 <p>/index.php?title=Some_page&amp;amp=&amp;
4911 </p>
4912 !! end
4913
4914 !! test
4915 URL-encoding in URL functions (multiple parameters)
4916 !! wikitext
4917 {{localurl:Some page|q=?&amp=&}}
4918 !! html
4919 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4920 </p>
4921 !! end
4922
4923 !! test
4924 Brackets in urls
4925 !! wikitext
4926 http://example.com/index.php?foozoid%5B%5D=bar
4927
4928 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4929 !! html/php
4930 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4931 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4932 </p>
4933 !! html/parsoid
4934 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
4935
4936 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4937 !! end
4938
4939 !! test
4940 IPv6 urls (bug 21261)
4941 !! options
4942 disabled
4943 !! wikitext
4944 http://[2404:130:0:1000::187:2]/index.php
4945 !! html
4946 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4947 </p>
4948 !! end
4949
4950 !! test
4951 Non-extlinks in brackets
4952 !! wikitext
4953 [foo]
4954 [foo bar]
4955 [foo ''bar'']
4956 [fool's] errand
4957 [fool's errand]
4958 [{{echo|foo}}]
4959 [{{echo|foo}} bar]
4960 [{{echo|foo}} ''bar'']
4961 [{{echo|foo}}l's] errand
4962 [{{echo|foo}}l's errand]
4963 [url={{echo|foo}}]
4964 [url=http://example.com]
4965 !! html
4966 <p>[foo]
4967 [foo bar]
4968 [foo <i>bar</i>]
4969 [fool's] errand
4970 [fool's errand]
4971 [foo]
4972 [foo bar]
4973 [foo <i>bar</i>]
4974 [fool's] errand
4975 [fool's errand]
4976 [url=foo]
4977 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4978 </p>
4979 !! end
4980
4981 !! test
4982 Percent encoding in external links
4983 !! wikitext
4984 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4985 !! html/php
4986 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink"
4990 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4991 !! end
4992
4993 !! test
4994 Use url link syntax for links where the content is equal the link target
4995 !! wikitext
4996 http://example.com
4997 !! html/php
4998 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4999 </p>
5000 !! html/parsoid
5001 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5002 !! end
5003
5004 !! test
5005 Parenthesis in external links, especially URL links
5006 !! wikitext
5007 http://example.com)
5008
5009 http://example.com/test)
5010
5011 http://example.com/(test)
5012
5013 http://example.com/((test)
5014
5015 (http://example.com/(test))
5016
5017 (http://example.com/(test)))))
5018
5019 http://example.com/a)b
5020
5021 [http://example.com) foo]
5022 !! html/php
5023 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5024 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5025 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5026 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5027 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5028 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5029 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5030 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5031 </p>
5032 !! html/parsoid
5033 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5034 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5035 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5036 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5037 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5038 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5039 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5040 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5041 !! end
5042
5043 !! test
5044 Parenthesis in external links, w/ transclusion or comment
5045 !! wikitext
5046 (http://example.com/{{echo|hi}})
5047
5048 (http://example.com<!-- hi -->)
5049 !! html/php
5050 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5051 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5052 </p>
5053 !! html/parsoid
5054 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5055
5056 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5057 !! end
5058
5059 !! test
5060 Replace invalid link targets when serializing
5061 !! options
5062 parsoid=html2wt
5063 !! html
5064 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5065 !! wikitext
5066 [[MediaWiki:Badtitletext|Manual]]
5067 !! end
5068
5069 ###
5070 ### Quotes
5071 ###
5072
5073 !! test
5074 Quotes
5075 !! wikitext
5076 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5077
5078 Normal text. '''''Bold italic text.''''' Normal text.
5079 !! html
5080 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5081 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5082 </p>
5083 !! end
5084
5085
5086 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5087 # parser strips. The wikitext contains just the first half of the bold
5088 # quote pair.
5089 !! test
5090 Unclosed and unmatched quotes
5091 !! wikitext
5092 '''''Bold italic text '''with bold deactivated''' in between.'''''
5093
5094 '''''Bold italic text ''with italic deactivated'' in between.'''''
5095
5096 '''Bold text..
5097
5098 ..spanning two paragraphs (should not work).'''
5099
5100 '''Bold tag left open
5101
5102 ''Italic tag left open
5103
5104 Normal text.
5105
5106 <!-- Unmatching number of opening, closing tags: -->
5107 '''This year''''s election ''should'' beat '''last year''''s.
5108
5109 ''Tom'''s car is bigger than ''Susan'''s.
5110
5111 Plain ''italic'''s plain
5112 !! html/php
5113 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5114 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5115 </p><p><b>Bold text..</b>
5116 </p><p>..spanning two paragraphs (should not work).
5117 </p><p><b>Bold tag left open</b>
5118 </p><p><i>Italic tag left open</i>
5119 </p><p>Normal text.
5120 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5121 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5122 </p><p>Plain <i>italic'</i>s plain
5123 </p>
5124 !! html/parsoid
5125 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5126 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5127 </p><p><b>Bold text..</b>
5128 </p><p>..spanning two paragraphs (should not work).<b></b>
5129 </p><p><b>Bold tag left open</b>
5130 </p><p><i>Italic tag left open</i>
5131 </p><p>Normal text.
5132 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5133 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5134 </p><p>Plain <i>italic'</i>s plain
5135 </p>
5136 !! end
5137
5138 ###
5139 ### Tables
5140 ###
5141 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5142 ###
5143
5144 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5145 # is the bare minimum required by the spec, see:
5146 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5147 # Parsoid team replies: empty table tags are legal in HTML5
5148 !! test
5149 A table with no data.
5150 !! options
5151 parsoid=wt2html
5152 !! wikitext
5153 {||}
5154 !! html/php
5155
5156 !! html/parsoid
5157 <table></table>
5158
5159 !! end
5160
5161 !! test
5162 A table with stray table end tags on start tag line (wt2html)
5163 !! options
5164 parsoid=wt2html
5165 !! wikitext
5166 {|style="color: red;"|}
5167
5168 {|style="color: red;" |}
5169 |foo
5170 |}
5171
5172 {|style="color: red;"|} id="foo"
5173 |foo
5174 |}
5175
5176 {|style="color: red;" |} id="foo"
5177 |foo
5178 |}
5179 !! html
5180 <table style="color: red;"></table>
5181
5182 <table style="color: red;">
5183 <tbody><tr>
5184 <td>foo</td>
5185 </tr></tbody>
5186 </table>
5187
5188 <table style="color: red;" id="foo">
5189 <tbody><tr>
5190 <td>foo</td>
5191 </tr></tbody>
5192 </table>
5193
5194 <table style="color: red;" id="foo">
5195 <tbody><tr>
5196 <td>foo</td>
5197 </tr></tbody>
5198 </table>
5199
5200 !! end
5201
5202 !! test
5203 A table with no data (take 2)
5204 !! wikitext
5205 {|
5206 |}
5207 !! html/parsoid
5208 <table></table>
5209 !! end
5210
5211 # A table with nothing but a caption is invalid XHTML, we might want to render
5212 # this as <p>caption</p>
5213 # Parsoid team replies: table with only a caption is legal in HTML5
5214 !! test
5215 A table with nothing but a caption
5216 !! wikitext
5217 {|
5218 |+ caption
5219 |}
5220 !! html/php
5221 <table>
5222 <caption> caption
5223 </caption><tr><td></td></tr></table>
5224
5225 !! html/parsoid
5226 <table><caption> caption</caption></table>
5227 !! end
5228
5229 !! test
5230 A table with caption with default-spaced attributes and a table row
5231 !! wikitext
5232 {|
5233 |+ style="color: red;" | caption1
5234 |-
5235 | foo
5236 |}
5237 !! html
5238 <table>
5239 <caption style="color: red;"> caption1
5240 </caption>
5241 <tr>
5242 <td> foo
5243 </td></tr></table>
5244
5245 !! end
5246
5247 !! test
5248 A table with captions with non-default spaced attributes and a table row
5249 !! wikitext
5250 {|
5251 |+style="color: red;"|caption2
5252 |+ style="color: red;"| caption3
5253 |-
5254 | foo
5255 |}
5256 !! html
5257 <table>
5258 <caption style="color: red;">caption2
5259 </caption>
5260 <caption style="color: red;"> caption3
5261 </caption>
5262 <tr>
5263 <td> foo
5264 </td></tr></table>
5265
5266 !! end
5267
5268 !! test
5269 Table td-cell syntax variations
5270 !! wikitext
5271 {|
5272 | foo bar foo | baz
5273 | foo bar foo || baz
5274 | style='color:red;' | baz
5275 | style='color:red;' || baz
5276 |}
5277 !! html
5278 <table>
5279 <tr>
5280 <td> baz
5281 </td>
5282 <td> foo bar foo </td>
5283 <td> baz
5284 </td>
5285 <td style="color:red;"> baz
5286 </td>
5287 <td> style='color:red;' </td>
5288 <td> baz
5289 </td></tr></table>
5290
5291 !! end
5292
5293 !! test
5294 Simple table
5295 !! wikitext
5296 {|
5297 | 1 || 2
5298 |-
5299 | 3 || 4
5300 |}
5301 !! html
5302 <table>
5303 <tr>
5304 <td> 1 </td>
5305 <td> 2
5306 </td></tr>
5307 <tr>
5308 <td> 3 </td>
5309 <td> 4
5310 </td></tr></table>
5311
5312 !! end
5313
5314 !! test
5315 Simple table but with multiple dashes for row wikitext
5316 !! wikitext
5317 {|
5318 | foo
5319 |-----
5320 | bar
5321 |}
5322 !! html
5323 <table>
5324 <tr>
5325 <td> foo
5326 </td></tr>
5327 <tr>
5328 <td> bar
5329 </td></tr></table>
5330
5331 !! end
5332 !! test
5333 Multiplication table
5334 !! wikitext
5335 {| border="1" cellpadding="2"
5336 |+Multiplication table
5337 |-
5338 ! &times; !! 1 !! 2 !! 3
5339 |-
5340 ! 1
5341 | 1 || 2 || 3
5342 |-
5343 ! 2
5344 | 2 || 4 || 6
5345 |-
5346 ! 3
5347 | 3 || 6 || 9
5348 |-
5349 ! 4
5350 | 4 || 8 || 12
5351 |-
5352 ! 5
5353 | 5 || 10 || 15
5354 |}
5355 !! html
5356 <table border="1" cellpadding="2">
5357 <caption>Multiplication table
5358 </caption>
5359 <tr>
5360 <th> &#215; </th>
5361 <th> 1 </th>
5362 <th> 2 </th>
5363 <th> 3
5364 </th></tr>
5365 <tr>
5366 <th> 1
5367 </th>
5368 <td> 1 </td>
5369 <td> 2 </td>
5370 <td> 3
5371 </td></tr>
5372 <tr>
5373 <th> 2
5374 </th>
5375 <td> 2 </td>
5376 <td> 4 </td>
5377 <td> 6
5378 </td></tr>
5379 <tr>
5380 <th> 3
5381 </th>
5382 <td> 3 </td>
5383 <td> 6 </td>
5384 <td> 9
5385 </td></tr>
5386 <tr>
5387 <th> 4
5388 </th>
5389 <td> 4 </td>
5390 <td> 8 </td>
5391 <td> 12
5392 </td></tr>
5393 <tr>
5394 <th> 5
5395 </th>
5396 <td> 5 </td>
5397 <td> 10 </td>
5398 <td> 15
5399 </td></tr></table>
5400
5401 !! end
5402
5403 !! test
5404 Accept "||" in table headings
5405 !! wikitext
5406 {|
5407 !h1 || h2
5408 |}
5409 !! html
5410 <table>
5411 <tr>
5412 <th>h1 </th>
5413 <th> h2
5414 </th></tr></table>
5415
5416 !! end
5417
5418 !! test
5419 Accept "!!" in table data
5420 !! wikitext
5421 {|
5422 | Foo!! ||
5423 |}
5424 !! html
5425 <table>
5426 <tr>
5427 <td> Foo!! </td>
5428 <td>
5429 </td></tr></table>
5430
5431 !! html/parsoid
5432 <table>
5433 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5434 </tbody></table>
5435 !! end
5436
5437 !! test
5438 Accept "||" in indented table headings
5439 !! wikitext
5440 :{|
5441 !h1 || h2
5442 |}
5443 !! html
5444 <dl><dd><table>
5445 <tr>
5446 <th>h1 </th>
5447 <th> h2
5448 </th></tr></table></dd></dl>
5449
5450 !! end
5451
5452 !! test
5453 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5454 !! wikitext
5455 {|
5456 !| h1
5457 || a
5458 |}
5459 !! html
5460 <table>
5461 <tr>
5462 <th> h1
5463 </th>
5464 <td> a
5465 </td></tr></table>
5466
5467 !! end
5468
5469 !!test
5470 Accept "| !" at start of line in tables (ignore !-attribute)
5471 !! wikitext
5472 {|
5473 |-
5474 | !style="color:red" | bar
5475 |}
5476 !! html
5477 <table>
5478
5479 <tr>
5480 <td> bar
5481 </td></tr></table>
5482
5483 !!end
5484
5485 !!test
5486 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
5487 !! wikitext
5488 {|
5489 |-
5490 |style='color:red;'|+1
5491 |style='color:blue;'|-1
5492 |-
5493 | 1 || 2 || 3
5494 | 1 ||+2 ||-3
5495 |-
5496 | +1
5497 | -1
5498 |}
5499 !! html
5500 <table>
5501
5502 <tr>
5503 <td style="color:red;">+1
5504 </td>
5505 <td style="color:blue;">-1
5506 </td></tr>
5507 <tr>
5508 <td> 1 </td>
5509 <td> 2 </td>
5510 <td> 3
5511 </td>
5512 <td> 1 </td>
5513 <td>+2 </td>
5514 <td>-3
5515 </td></tr>
5516 <tr>
5517 <td> +1
5518 </td>
5519 <td> -1
5520 </td></tr></table>
5521
5522 !!end
5523
5524 !! test
5525 Table rowspan
5526 !! wikitext
5527 {| border=1
5528 | Cell 1, row 1
5529 |rowspan=2| Cell 2, row 1 (and 2)
5530 | Cell 3, row 1
5531 |-
5532 | Cell 1, row 2
5533 | Cell 3, row 2
5534 |}
5535 !! html
5536 <table border="1">
5537 <tr>
5538 <td> Cell 1, row 1
5539 </td>
5540 <td rowspan="2"> Cell 2, row 1 (and 2)
5541 </td>
5542 <td> Cell 3, row 1
5543 </td></tr>
5544 <tr>
5545 <td> Cell 1, row 2
5546 </td>
5547 <td> Cell 3, row 2
5548 </td></tr></table>
5549
5550 !! end
5551
5552 !! test
5553 Nested table
5554 !! wikitext
5555 {| border=1
5556 | &alpha;
5557 |
5558 {| bgcolor=#ABCDEF border=2
5559 |nested
5560 |-
5561 |table
5562 |}
5563 |the original table again
5564 |}
5565 !! html
5566 <table border="1">
5567 <tr>
5568 <td> &#945;
5569 </td>
5570 <td>
5571 <table bgcolor="#ABCDEF" border="2">
5572 <tr>
5573 <td>nested
5574 </td></tr>
5575 <tr>
5576 <td>table
5577 </td></tr></table>
5578 </td>
5579 <td>the original table again
5580 </td></tr></table>
5581
5582 !! end
5583
5584 !! test
5585 Invalid attributes in table cell (bug 1830)
5586 !! wikitext
5587 {|
5588 |Cell:|broken
5589 |}
5590 !! html
5591 <table>
5592 <tr>
5593 <td>broken
5594 </td></tr></table>
5595
5596 !! end
5597
5598 # The "|}" to close the table is missing from the input, so parsoid's
5599 # *2wt modes will fail.
5600 !! test
5601 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5602 !! options
5603 parsoid=wt2html,html2html
5604 !! wikitext
5605 {|
5606 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5607 !! html/php
5608 <table>
5609 <tr>
5610 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5611 <td>]" onmouseover="alert(document.cookie)"&gt;test
5612 </td>
5613 </tr>
5614 </table>
5615
5616 !! html/parsoid
5617 <table><tbody>
5618 <tr>
5619 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5620 !! end
5621
5622 # FIXME: The php output is broken.
5623 !! test
5624 ! and || in td attributes should not be parsed as <th>/<td>
5625 !! wikitext
5626 {|
5627 | style="color: red !important;" data-contrived="put this here ||" | foo
5628 |}
5629 !! html/php
5630 <table>
5631 <tr>
5632 <td> style="color: red !important;" data-contrived="put this here </td>
5633 <td> foo
5634 </td></tr></table>
5635
5636 !! html/parsoid
5637 <table>
5638 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5639 </tbody></table>
5640 !! end
5641
5642 !! test
5643 Indented table markup mixed with indented pre content (proposed in bug 6200)
5644 !! wikitext
5645 <table>
5646 <tr>
5647 <td>
5648 Text that should be rendered preformatted
5649 </td>
5650 </tr>
5651 </table>
5652 !! html
5653 <table>
5654 <tr>
5655 <td>
5656 <pre>Text that should be rendered preformatted
5657 </pre>
5658 </td>
5659 </tr>
5660 </table>
5661
5662 !! end
5663
5664 !! test
5665 1. Template-generated table cell attributes and cell content
5666 !! wikitext
5667 {|
5668 |{{table_attribs}}
5669 | {{table_attribs}}
5670 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5671 |align=center {{table_attribs}}
5672 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5673 |}
5674 !! html
5675 <table>
5676 <tr>
5677 <td style="color:red;">Foo
5678 </td>
5679 <td style="color:red;">Foo
5680 </td>
5681 <td style="color:red;">Foo
5682 </td>
5683 <td align="center" style="color:red;">Foo
5684 </td>
5685 <td align="center" style="color:red;">Foo
5686 </td></tr></table>
5687
5688 !! end
5689
5690 !! test
5691 2. Template-generated table cell attributes and cell content
5692 !! wikitext
5693 {|
5694 |{{table_attribs_2}}
5695 |}
5696 !! html/php
5697 <table>
5698 <tr>
5699 <td style="color:red;">Foo
5700 </td>
5701 <td>Bar</td>
5702 <td>Baz
5703 </td></tr></table>
5704
5705 !! html/parsoid
5706 <table>
5707 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
5708 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5709 </tbody></table>
5710 !! end
5711
5712 !! test
5713 3. Template-generated table cell attributes and cell content
5714 !! wikitext
5715 {|
5716 !align=center {{table_header_cells}}
5717 |-
5718 |align=center {{table_cells}}
5719 |}
5720 !! html/php
5721 <table>
5722 <tr>
5723 <th align="center" style="color:red;">Foo</th>
5724 <th style="color:red;"><i>Bar</i></th>
5725 <th style="color:brown;"><i>Foo</i> and Baz
5726 </th></tr>
5727 <tr>
5728 <td align="center" style="color:red;">Foo</td>
5729 <td style="color:red;"><i>Bar</i></td>
5730 <td style="color:brown;"><i>Foo</i> and Baz
5731 </td></tr></table>
5732
5733 !! html/parsoid
5734 <table>
5735 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
5736 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
5737 </tbody></table>
5738 !! end
5739
5740 !! test
5741 Table with row followed by newlines and table heading
5742 !! wikitext
5743 {|
5744 |-
5745
5746 ! foo
5747 |}
5748 !! html
5749 <table>
5750
5751
5752 <tr>
5753 <th> foo
5754 </th></tr></table>
5755
5756 !! end
5757
5758 !! test
5759 Table with empty line following the start tag
5760 !! wikitext
5761 {|
5762
5763 |-
5764 | foo
5765 |}
5766 !! html
5767 <table>
5768
5769
5770 <tr>
5771 <td> foo
5772 </td></tr></table>
5773
5774 !! end
5775
5776 # FIXME: Preserve the attribute properly (with an empty string as value) in
5777 # the PHP parser. Parsoid implements the behavior below.
5778 !! test
5779 Table attributes with empty value
5780 !! wikitext
5781 {|
5782 | style=| hello
5783 |}
5784 !! html/parsoid
5785 <table>
5786 <tbody>
5787 <tr>
5788 <td style=""> hello
5789 </td></tr></tbody></table>
5790
5791 !! end
5792
5793 !! test
5794 Wikitext table with a lot of comments
5795 !! wikitext
5796 {|
5797 <!-- c0 -->
5798 | foo
5799 <!-- c1 -->
5800 |- <!-- c2 -->
5801 <!-- c3 -->
5802 |<!-- c4 -->
5803 <!-- c5 -->
5804 |}
5805 !! html
5806 <table>
5807 <tr>
5808 <td> foo
5809 </td></tr>
5810 <tr>
5811 <td>
5812 </td></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Wikitext table with double-line table cell
5818 !! wikitext
5819 {|
5820 |a
5821 b
5822 |}
5823 !! html
5824 <table>
5825 <tr>
5826 <td>a
5827 <p>b
5828 </p>
5829 </td></tr></table>
5830
5831 !! end
5832
5833 !! test
5834 Table cell with a single comment
5835 !! wikitext
5836 {|
5837 | <!-- c1 -->
5838 | a
5839 |}
5840 !! html
5841 <table>
5842 <tr>
5843 <td>
5844 </td>
5845 <td> a
5846 </td></tr></table>
5847
5848 !! end
5849
5850 !! test
5851 Table-cell after a comment-only-empty-line
5852 !! wikitext
5853 {|
5854 |a
5855 <!--c1-->
5856 <!--c2-->| b
5857 |}
5858 !! html
5859 <table>
5860 <tr>
5861 <td>a
5862 </td>
5863 <td> b
5864 </td></tr></table>
5865
5866 !! html/parsoid
5867 <table>
5868 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5869 <!--c1-->
5870 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5871 </tbody></table>
5872
5873 !! end
5874
5875 !! test
5876 Build table with {{!}}
5877 !! wikitext
5878 {{{!}} class="wikitable"
5879 ! header
5880 ! second header
5881 {{!}}- style="color:red;"
5882 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5883 {{!}}}
5884 !! html
5885 <table class="wikitable">
5886 <tr>
5887 <th> header
5888 </th>
5889 <th> second header
5890 </th></tr>
5891 <tr style="color:red;">
5892 <td> data </td>
5893 <td style="color:red;"> second data
5894 </td></tr></table>
5895
5896 !! end
5897
5898 !! test
5899 Build table with pipe as data
5900 !! wikitext
5901 {| class="wikitable"
5902 ! header
5903 ! second header
5904 |- style="color:red;"
5905 | data || style="color:red;" | second data
5906 |-
5907 | style="color:red;" | data with | || style="color:red;" | second data with |
5908 |-
5909 || data with | ||| second data with |
5910 |}
5911 !! html
5912 <table class="wikitable">
5913 <tr>
5914 <th> header
5915 </th>
5916 <th> second header
5917 </th></tr>
5918 <tr style="color:red;">
5919 <td> data </td>
5920 <td style="color:red;"> second data
5921 </td></tr>
5922 <tr>
5923 <td style="color:red;"> data with | </td>
5924 <td style="color:red;"> second data with |
5925 </td></tr>
5926 <tr>
5927 <td> data with | </td>
5928 <td> second data with |
5929 </td></tr></table>
5930
5931 !! end
5932
5933 !! test
5934 Build table with wikilink
5935 !! wikitext
5936 {| class="wikitable"
5937 ! header || second header
5938 |- style="color:red;"
5939 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5940 |-
5941 | data || second data [[Main Page|link|text with pipe]]
5942 |}
5943 !! html
5944 <table class="wikitable">
5945 <tr>
5946 <th> header </th>
5947 <th> second header
5948 </th></tr>
5949 <tr style="color:red;">
5950 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5951 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5952 </td></tr>
5953 <tr>
5954 <td> data </td>
5955 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5956 </td></tr></table>
5957
5958 !! end
5959
5960 # The expected HTML structure in this test is debatable. The PHP parser does
5961 # not parse this kind of table at all. The main focus for Parsoid is on
5962 # round-tripping, so this output is ok for now. TODO: revisit!
5963 !! test
5964 Wikitext table with html-syntax row
5965 !! wikitext
5966 {|
5967 |-
5968 <td>foo</td>
5969 |}
5970 !! html/parsoid
5971 <table>
5972 <tbody>
5973 <tr>
5974 <td>foo</td></tr></tbody></table>
5975 !! end
5976
5977 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5978 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5979 ## PHP parser, which tidy then compounds by fostering the content
5980 ## entirely out of the table. Parsoid recognizes the table context
5981 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5982 ## depends on PHP's treatment of broken table markup!
5983 !! test
5984 Implicit <td> after a |-
5985 !! options
5986 parsoid=wt2html,html2html
5987 !! wikitext
5988 {|
5989 |-
5990 a
5991 |}
5992 !! html/php
5993 <table>
5994
5995 a
5996 </table>
5997
5998 !! html/php+tidy
5999 <p>a</p>
6000 !! html/parsoid
6001 <table>
6002 <tr><td>a</td></tr>
6003 </table>
6004 !! end
6005
6006 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6007 !! test
6008 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6009 !! options
6010 parsoid=wt2html,html2html
6011 !! wikitext
6012 {|
6013 |-
6014 |
6015 a
6016 |-
6017 b
6018 |}
6019 !! html/php
6020 <table>
6021
6022 <tr>
6023 <td>
6024 <pre>a
6025 </pre>
6026 </td></tr>
6027 b
6028 </table>
6029
6030 !! html/php+tidy
6031 <p>b</p>
6032 <table>
6033 <tr>
6034 <td>
6035 <pre>
6036 a
6037 </pre></td>
6038 </tr>
6039 </table>
6040 !! html/parsoid
6041 <table>
6042 <tbody>
6043 <tr><td><pre>a</pre></td></tr>
6044 <tr><td> b</td></tr>
6045 </tbody>
6046 </table>
6047 !! end
6048
6049 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6050 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6051 !! test
6052 Lists should be recognized in an implicit <td> context
6053 !! options
6054 parsoid=wt2html,html2html
6055 !! wikitext
6056 {|
6057 |-
6058 *a
6059 |}
6060 !! html/php
6061 <table>
6062
6063 <ul><li>a</li></ul>
6064 </table>
6065
6066 !! html/php+tidy
6067 <ul>
6068 <li>a</li>
6069 </ul>
6070 !! html/parsoid
6071 <table>
6072 <tr>
6073 <td><ul>
6074 <li>a</li>
6075 </ul></td>
6076 </tr>
6077 </table>
6078 !! end
6079
6080 !! test
6081 Parsoid: Round-trip tables directly followed by content (bug 51219)
6082 !! options
6083 parsoid=wt2html,wt2wt
6084 !! wikitext
6085 {|
6086 |foo
6087 |} bar
6088
6089 {|
6090 |baz
6091 |}<b>quux</b>
6092 !! html+tidy
6093 <table>
6094 <tr>
6095 <td>foo</td>
6096 </tr>
6097 </table>
6098 <p>bar</p>
6099 <table>
6100 <tr>
6101 <td>baz</td>
6102 </tr>
6103 </table>
6104 <p><b>quux</b></p>
6105 !! end
6106
6107 !! test
6108 Parsoid: Default to a newline after tables in new content (bug 51219)
6109 !! options
6110 parsoid=html2wt
6111 !! html
6112 <table><tbody>
6113 <tr><td>foo</td></tr></tbody></table> bar
6114 <table><tbody>
6115 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6116 !! wikitext
6117 {|
6118 |foo
6119 |}
6120 <nowiki> </nowiki>bar
6121 {|
6122 |baz
6123 |}
6124 '''quux'''
6125 !! end
6126
6127 !! test
6128 Parsoid: newline inducing block nodes don't suppress <nowiki>
6129 !! options
6130 parsoid=html2wt
6131 !! html
6132 a<h1>foo</h1>
6133 !! wikitext
6134 <nowiki> </nowiki>a
6135
6136 = foo =
6137 !! end
6138
6139 !! test
6140 Parsoid: Row-syntax table headings followed by comment & table cells
6141 !! options
6142 parsoid=wt2html,wt2wt
6143 !! wikitext
6144 {|
6145 ! foo || bar
6146 <!-- foo --> || baz || quux
6147 |}
6148 !! html/php
6149 <table>
6150 <tr>
6151 <th> foo </th>
6152 <th> bar
6153 </th>
6154 <td> baz </td>
6155 <td> quux
6156 </td></tr></table>
6157
6158 !! html/parsoid
6159 <table>
6160 <tbody><tr><th> foo </th><th> bar
6161 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6162 </tbody></table>
6163 !! end
6164
6165
6166 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6167 # preserves it.
6168 !!test
6169 Parsoid: Recover better from broken table attributes
6170 !!options
6171 parsoid=wt2html
6172 !!wikitext
6173 {| class="foo
6174 | class="bar" |
6175 foo
6176 |}
6177 !!html/php+tidy
6178 <table>
6179 <tr>
6180 <td class="bar">
6181 <p>foo</p>
6182 </td>
6183 </tr>
6184 </table>
6185 !!html/parsoid
6186 <table class="foo">
6187 <tr>
6188 <td class="bar">
6189 <p>foo</p></td></tr>
6190 </tbody></table>
6191 !!end
6192
6193 !! test
6194 Strip unsupported table tags
6195 !! options
6196 parsoid=html2wt
6197 !! html
6198 <table>
6199 <thead>
6200 <tr>
6201 <th>Month</th>
6202 <th>Savings</th>
6203 </tr>
6204 </thead>
6205 <tbody>
6206 <tr>
6207 <td>January</td>
6208 <td>$100</td>
6209 </tr>
6210 <tr>
6211 <td>February</td>
6212 <td>$80</td>
6213 </tr>
6214 </tbody>
6215 <tfoot>
6216 <tr>
6217 <td>Sum</td>
6218 <td>$180</td>
6219 </tr>
6220 </tfoot>
6221 </table>
6222 !! wikitext
6223 {|
6224
6225 !Month
6226 !Savings
6227
6228 |January
6229 |$100
6230
6231 |-
6232 |February
6233 |$80
6234
6235 |Sum
6236 |$180
6237
6238 |}
6239 !! end
6240
6241 !!test
6242 Testing serialization after deletion of table cells
6243 !!options
6244 parsoid={
6245 "modes": ["wt2wt"],
6246 "changes": [
6247 ["#x", "remove"]
6248 ]
6249 }
6250 !!wikitext
6251 {|
6252 !h1 !!h2 !!h3
6253 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6254 |}
6255 !! wikitext/edited
6256 {|
6257 !h1 !!h2 !!h3
6258 |c2 |||c3
6259 |}
6260 !!end
6261
6262 ###
6263 ### Internal links
6264 ###
6265 !! test
6266 Plain link, capitalized
6267 !! wikitext
6268 [[Main Page]]
6269 !! html
6270 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6271 </p>
6272 !! end
6273
6274 !! test
6275 Plain link, uncapitalized
6276 !! wikitext
6277 [[main Page]]
6278 !! html
6279 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6280 </p>
6281 !! end
6282
6283 !! test
6284 Piped link
6285 !! wikitext
6286 [[Main Page|The Main Page]]
6287 !! html
6288 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6289 </p>
6290 !! end
6291
6292 !! test
6293 Piped link with comment in link text
6294 !! wikitext
6295 [[Main Page|The Main<!--front--> Page]]
6296 !! html
6297 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6298 </p>
6299 !! end
6300
6301 !! test
6302 Piped link with multiple pipe characters in link text
6303 !! wikitext
6304 [[Main Page||The|Main|Page|]]
6305 !! html/php
6306 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6307 </p>
6308 !! html/parsoid
6309 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6310 !! end
6311
6312 !! test
6313 Broken link
6314 !! wikitext
6315 [[Zigzagzogzagzig]]
6316 !! html
6317 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6318 </p>
6319 !! end
6320
6321 !! test
6322 Broken link with fragment
6323 !! wikitext
6324 [[Zigzagzogzagzig#zug]]
6325 !! html
6326 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6327 </p>
6328 !! end
6329
6330 !! test
6331 Special page link with fragment
6332 !! wikitext
6333 [[Special:Version#anchor]]
6334 !! html
6335 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6336 </p>
6337 !! end
6338
6339 !! test
6340 Nonexistent special page link with fragment
6341 !! wikitext
6342 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6343 !! html
6344 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6345 </p>
6346 !! end
6347
6348 !! test
6349 Link with prefix
6350 !! wikitext
6351 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6352 !! html
6353 <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>
6354 </p>
6355 !! end
6356
6357 !! test
6358 Link with suffix
6359 !! wikitext
6360 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6361 !! html
6362 <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>!!!
6363 </p>
6364 !! end
6365
6366 !! article
6367 prefixed article
6368 !! text
6369 Some text
6370 !! endarticle
6371
6372 !! test
6373 Bug 43661: Piped links with identical prefixes
6374 !! wikitext
6375 [[prefixed article|prefixed articles with spaces]]
6376
6377 [[prefixed article|prefixed articlesaoeu]]
6378
6379 [[Main Page|Main Page test]]
6380 !! html
6381 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6382 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6383 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6384 </p>
6385 !! end
6386
6387
6388 !! test
6389 Link with HTML entity in suffix / tail
6390 !! wikitext
6391 [[Main Page]]&quot;, [[Main Page]]&#97;
6392 !! html/php
6393 <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;
6394 </p>
6395 !! html/parsoid
6396 <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>
6397 !! end
6398
6399 !! test
6400 Link with 3 brackets
6401 !! wikitext
6402 [[[Main Page]]]
6403 !! html
6404 <p>[[[Main Page]]]
6405 </p>
6406 !! end
6407
6408 !! test
6409 Link with 4 brackets
6410 !! wikitext
6411 [[[[Main Page]]]]
6412 !! html
6413 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6414 </p>
6415 !! end
6416
6417 !! test
6418 Piped link with 3 brackets
6419 !! wikitext
6420 [[[main page|the main page]]]
6421 !! html
6422 <p>[[[main page|the main page]]]
6423 </p>
6424 !! end
6425
6426 !! test
6427 Piped link with extlink-like text
6428 !! wikitext
6429 [[Main Page|[bar]]]
6430 [[Main Page|This is a [bar]]]
6431 !! html/php
6432 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6433 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6434 </p>
6435 !! html/parsoid
6436 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6437 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6438 !! end
6439
6440 !! test
6441 Link with multiple pipes
6442 !! wikitext
6443 [[Main Page|The|Main|Page]]
6444 !! html
6445 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6446 </p>
6447 !! end
6448
6449 # Note that parsoid does not munge anchor text; all non-space
6450 # characters are valid in HTML5 ids.
6451 !! test
6452 Anchor containing a #. (bug 63430)
6453 !! wikitext
6454 [[Main Page#And#Link]]
6455 !! html/php
6456 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6457 </p>
6458 !! html/parsoid
6459 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6460 !! end
6461
6462 !! test
6463 Link to namespaces
6464 !! wikitext
6465 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6466 !! html
6467 <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>
6468 </p>
6469 !! end
6470
6471 !! test
6472 Link with space in namespace
6473 !! wikitext
6474 [[User talk:Foo bar]]
6475 !! html
6476 <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>
6477 </p>
6478 !! end
6479
6480 !! article
6481 MemoryAlpha:AlphaTest
6482 !! text
6483 This is an article in the MemoryAlpha namespace
6484 (which shadows the memoryalpha interwiki link).
6485 !! endarticle
6486
6487 !! test
6488 Namespace takes precedence over interwiki link (bug 51680)
6489 !! wikitext
6490 [[MemoryAlpha:AlphaTest]]
6491 !! html
6492 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6493 </p>
6494 !! end
6495
6496 # The previous test doesn't work correctly in html2*, due to not recognizing the
6497 # link as an internal one. This one checks for the correct behavior.
6498 !! test
6499 Link to namespace preferred over interwiki with correct rel attribute
6500 !! options
6501 parsoid=html2wt,html2html
6502 !! html
6503 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6504 !! wikitext
6505 [[MemoryAlpha:AlphaTest]]
6506 !! end
6507
6508 !! test
6509 Piped link to namespace
6510 !! wikitext
6511 [[Meta:Disclaimers|The disclaimers]]
6512 !! html
6513 <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>
6514 </p>
6515 !! end
6516
6517 !! test
6518 Link containing }
6519 !! wikitext
6520 [[Usually caused by a typo (oops}]]
6521 !! html
6522 <p>[[Usually caused by a typo (oops}]]
6523 </p>
6524 !! end
6525
6526 !! article
6527 7% Solution
6528 !! text
6529 Just a test of an article title containing a percent.
6530 !! endarticle
6531
6532 !! test
6533 Link containing % (not as a hex sequence)
6534 !! wikitext
6535 [[7% Solution]]
6536 !! html/php
6537 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6538 </p>
6539 !! html/parsoid
6540 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6541 !! end
6542
6543 # note that the parsoid HTML is identical to the previous test output,
6544 # so the previous test ensures that the html2wt mode will generate the
6545 # "not as a hex sequence" wikitext.
6546 !! test
6547 Link containing % as a single hex sequence interpreted to char
6548 !! options
6549 parsoid=wt2wt,wt2html,html2html
6550 !! wikitext
6551 [[7%25 Solution]]
6552 !! html/php
6553 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6554 </p>
6555 !! html/parsoid
6556 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6557 !!end
6558
6559 !! test
6560 Link containing % as a double hex sequence interpreted to hex sequence
6561 !! wikitext
6562 [[7%2525 Solution]]
6563 !! html
6564 <p>[[7%2525 Solution]]
6565 </p>
6566 !!end
6567
6568 # note that parsoid does not munge anchor text; all non-space
6569 # characters are valid in HTML5 anchors.
6570 !! test
6571 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6572 Example for such a section: == < ==
6573 !! wikitext
6574 [[%23%3c]][[%23%3e]]
6575 !! html/php
6576 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6577 </p>
6578 !! html/parsoid
6579 <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>
6580 !! end
6581
6582 !! test
6583 Link containing "<#" and ">#" as a hex sequences
6584 !! wikitext
6585 [[%3c%23]][[%3e%23]]
6586 !! html
6587 <p>[[%3c%23]][[%3e%23]]
6588 </p>
6589 !! end
6590
6591 !! test
6592 Link containing an equals sign
6593 !! wikitext
6594 [[Special:BookSources/isbn=4-00-026157-6]]
6595 !! html/php
6596 <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>
6597 </p>
6598 !! html/parsoid
6599 <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>
6600 !! end
6601
6602 !! article
6603 Foo~bar
6604 !! text
6605 Just a test of an article title containing a tilde.
6606 !! endarticle
6607
6608 # note that links containing signatures, like [[Foo~~~~]], are
6609 # massaged by the pre-save transform (PST) and so the tildes are never
6610 # seen by the parser.
6611 !! test
6612 Link containing a tilde
6613 !! wikitext
6614 [[Foo~bar]]
6615 !! html/php
6616 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6617 </p>
6618 !! html/parsoid
6619 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6620 !! end
6621
6622 !! test
6623 Link containing double-single-quotes '' (bug 4598)
6624 !! wikitext
6625 [[Lista d''e paise d''o munno]]
6626 !! html/php
6627 <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>
6628 </p>
6629 !! html/parsoid
6630 <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>
6631 !! end
6632
6633 !! test
6634 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6635 !! wikitext
6636 Some [[Link|pretty ''italics'' and stuff]]!
6637 !! html/php
6638 <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>!
6639 </p>
6640 !! html/parsoid
6641 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6642 !! end
6643
6644 !! test
6645 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6646 !! wikitext
6647 ''Some [[Link|pretty ''italics'' and stuff]]!''
6648 !! html
6649 <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>
6650 </p>
6651 !! end
6652
6653 !! test
6654 Link with double quotes in title part (literal) and alternate part (interpreted)
6655 !! wikitext
6656 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6657
6658 [[''Pentecoste'']]
6659
6660 [[''Pentecoste''|Pentecoste]]
6661
6662 [[''Pentecoste''|''Pentecoste'']]
6663 !! html/php
6664 <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>
6665 </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>
6666 </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>
6667 </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>
6668 </p>
6669 !! html/parsoid
6670 <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>
6671 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6672 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6673 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6674 !! end
6675
6676 !! test
6677 Broken image links with HTML captions (bug 39700)
6678 !! wikitext
6679 [[File:Nonexistent|<script></script>]]
6680 [[File:Nonexistent|100x100px|<script></script>]]
6681 [[File:Nonexistent|&lt;]]
6682 [[File:Nonexistent|a<i>b</i>c]]
6683 !! html/php
6684 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6685 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6686 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6687 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6688 </p>
6689 !! html/parsoid
6690 <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>
6691 <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>
6692 <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>
6693 <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>
6694 !! end
6695
6696 !! test
6697 Plain link to URL
6698 !! wikitext
6699 [[http://www.example.com]]
6700 !! html/php
6701 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6702 </p>
6703 !! html/parsoid
6704 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6705 !! end
6706
6707 !! test
6708 Plain link to URL with link text
6709 !! wikitext
6710 [[http://www.example.com Link text]]
6711 !! html
6712 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6713 </p>
6714 !! end
6715
6716 !! test
6717 Plain link to protocol-relative URL
6718 !! wikitext
6719 [[//www.example.com]]
6720 !! html/php
6721 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6722 </p>
6723 !! html/parsoid
6724 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6725 !! end
6726
6727 !! test
6728 Plain link to protocol-relative URL with link text
6729 !! wikitext
6730 [[//www.example.com Link text]]
6731 !! html
6732 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6733 </p>
6734 !! end
6735
6736 !! test
6737 Plain link to page with question mark in title
6738 !! wikitext
6739 [[A?b]]
6740
6741 [[A?b|Baz]]
6742 !! html
6743 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6744 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6745 </p>
6746 !! end
6747
6748
6749 # I'm fairly sure the expected result here is wrong.
6750 # We want these to be URL links, not pseudo-pages with URLs for titles....
6751 # However the current output is also pretty screwy.
6752 #
6753 # ----
6754 # I'm changing it to match the current output--it arguably makes more
6755 # sense in the light of the test above. Old expected result was:
6756 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6757 #</p>
6758 # But I think this test is bordering on "garbage in, garbage out" anyway.
6759 # -- wtm
6760 !! test
6761 Piped link to URL
6762 !! wikitext
6763 Piped link to URL: [[http://www.example.com|an example URL]]
6764 !! html/php
6765 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6766 </p>
6767 !! html/parsoid
6768 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6769 !! end
6770
6771 !! test
6772 BUG 2: [[page|http://url/]] should link to page, not http://url/
6773 !! wikitext
6774 [[Main Page|http://url/]]
6775 !! html/php
6776 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6777 </p>
6778 !! html/parsoid
6779 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6780 !! end
6781
6782 # Parsoid does not mark self-links, by design.
6783 !! test
6784 BUG 337: Escaped self-links should be bold
6785 !! options
6786 title=[[Bug462]]
6787 !! wikitext
6788 [[Bu&#103;462]] [[Bug462]]
6789 !! html/php
6790 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6791 </p>
6792 !! html/php+tidy
6793 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6794 !! html/parsoid
6795 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6796 !! end
6797
6798 !! test
6799 Self-link to section should not be bold
6800 !! options
6801 title=[[Main Page]]
6802 !! wikitext
6803 [[Main Page#section]]
6804 !! html
6805 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6806 </p>
6807 !! end
6808
6809 !! article
6810 00
6811 !! text
6812 This is 00.
6813 !! endarticle
6814
6815 !!test
6816 Self-link to numeric title
6817 !!options
6818 title=[[0]]
6819 !! wikitext
6820 [[0]]
6821 !! html
6822 <p><strong class="selflink">0</strong>
6823 </p>
6824 !!end
6825
6826 !!test
6827 Link to numeric-equivalent title
6828 !!options
6829 title=[[0]]
6830 !! wikitext
6831 [[00]]
6832 !! html
6833 <p><a href="/wiki/00" title="00">00</a>
6834 </p>
6835 !!end
6836
6837 !! test
6838 <nowiki> inside a link
6839 !! wikitext
6840 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6841 !! html
6842 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6843 </p>
6844 !! end
6845
6846 !! test
6847 Non-breaking spaces in title
6848 !! wikitext
6849 [[&nbsp; Main &nbsp; Page &nbsp;]]
6850 !! html
6851 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6852 </p>
6853 !!end
6854
6855 !! test
6856 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6857 !! options
6858 language=ca
6859 !! wikitext
6860 '''[[Main Page]]'''
6861 !! html
6862 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6863 </p>
6864 !! end
6865
6866 !! test
6867 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6868 !! options
6869 language=ca
6870 !! wikitext
6871 ''[[Main Page]]''
6872 !! html
6873 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6874 </p>
6875 !! end
6876
6877 !! test
6878 Internal link with en linktrail: no apostrophes (bug 27473)
6879 !! options
6880 language=en
6881 !! wikitext
6882 [[Something]]'nice
6883 !! html
6884 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6885 </p>
6886 !! end
6887
6888 !! test
6889 Internal link with ca linktrail with apostrophes (bug 27473)
6890 !! options
6891 language=ca
6892 !! wikitext
6893 [[Something]]'nice
6894 !! html
6895 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6896 </p>
6897 !! end
6898
6899 !! test
6900 Internal link with kaa linktrail with apostrophes (bug 27473)
6901 !! options
6902 language=kaa
6903 !! wikitext
6904 [[Something]]'nice
6905 !! html
6906 <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>
6907 </p>
6908 !! end
6909
6910 !! test
6911 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6912 !! wikitext
6913 [[User:Foo/Test/63636:Bar|Test]]
6914 !! html/php
6915 <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>
6916 </p>
6917 !! html/parsoid
6918 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6919 !! end
6920
6921 !! test
6922 Purely hash wikilink
6923 !! options
6924 title=[[User:test/123]]
6925 !! wikitext
6926 [[#a|b]]
6927 !! html/php
6928 <p><a href="#a">b</a>
6929 </p>
6930 !! html/parsoid
6931 <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>
6932 !! end
6933
6934 !! test
6935 1. Interaction of linktrail and template encapsulation
6936 !! options
6937 parsoid
6938 !! wikitext
6939 {{echo|[[Foo]]}}l
6940 !! html
6941 <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>
6942 !! end
6943
6944 !! test
6945 2. Interaction of linktrail and template encapsulation
6946 !! options
6947 parsoid
6948 !! wikitext
6949 {{echo|Some [[Fool]]}}s
6950 !! html
6951 <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>
6952 !! end
6953
6954 !! test
6955 3. Interaction of linktrail and template encapsulation
6956 !! options
6957 parsoid
6958 !! wikitext
6959 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6960 !! html
6961 <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>
6962 !! end
6963
6964 !! article
6965 Söfnuður
6966 !! text
6967 Test.
6968 !! endarticle
6969
6970 !! test
6971 Internal link with is link prefix
6972 !! options
6973 language=is
6974 !! wikitext
6975 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6976 !! html
6977 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6978 </p>
6979 !! end
6980
6981 !! article
6982 Mótmælendatrú
6983 !! text
6984 Test.
6985 !! endarticle
6986
6987 !! test
6988 Internal link with is link trail and link prefix
6989 !! options
6990 language=is
6991 !! wikitext
6992 [[mótmælendatrú|xxx]]ar
6993 [[mótmælendatrú]]ar
6994 mótmælenda[[söfnuður]]
6995 mótmælenda[[söfnuður|söfnuðir]]
6996 mótmælenda[[söfnuður|söfnuðir]]xxx
6997 !! html
6998 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6999 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7000 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7001 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7002 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7003 </p>
7004 !! end
7005
7006 !! test
7007 Parsoid link trail escaping
7008 !! options
7009 parsoid=html2wt,html2html
7010 !! html
7011 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7012 !! wikitext
7013 [[apple]]<nowiki/>s
7014 !! end
7015
7016 !! test
7017 Parsoid link prefix escaping
7018 !! options
7019 language=is
7020 parsoid=html2wt,html2html
7021 !! html
7022 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7023 !! wikitext
7024 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7025 !! end
7026
7027 !! test
7028 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7029 !! wikitext
7030 [[Foo| bar]]
7031
7032 [[Foo| ''bar'']]
7033
7034 [http://wp.org foo]
7035
7036 [http://wp.org ''foo'']
7037 !! html
7038 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7039 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7040 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7041 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7042 </p>
7043 !! end
7044
7045 !! test
7046 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7047 !! options
7048 parsoid
7049 !! wikitext
7050 [[Foo|{{echo|a}} b {{echo|c}}]]
7051 !! html
7052 <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>
7053 !! end
7054
7055 !! test
7056 Link with angle bracket after anchor
7057 !! wikitext
7058 [[Foo#<bar>]]
7059 !! html/php
7060 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7061 </p>
7062 !! html/parsoid
7063 <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>
7064 !! end
7065
7066 ###
7067 ### Interwiki links (see maintenance/interwiki.sql)
7068 ###
7069
7070 !! test
7071 Inline interwiki link
7072 !! options
7073 parsoid=wt2html,wt2wt,html2html
7074 !! wikitext
7075 [[MeatBall:SoftSecurity]]
7076 !! html/php
7077 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7078 </p>
7079 !! html/parsoid
7080 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7081 !! end
7082
7083 !! test
7084 Inline interwiki link with empty title (bug 2372)
7085 !! options
7086 parsoid=wt2html,wt2wt,html2html
7087 !! wikitext
7088 [[MeatBall:]]
7089 !! html/php
7090 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7091 </p>
7092 !! html/parsoid
7093 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7094 !! end
7095
7096 !! test
7097 Interwiki link encoding conversion (bug 1636)
7098 !! wikitext
7099 *[[Wikipedia:ro:Olteni&#0355;a]]
7100 *[[Wikipedia:ro:Olteni&#355;a]]
7101 !! html
7102 <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>
7103 <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>
7104
7105 !! html+tidy
7106 <ul>
7107 <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>
7108 <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>
7109 </ul>
7110 !! end
7111
7112 !! test
7113 Interwiki link with fragment (bug 2130)
7114 !! wikitext
7115 [[MeatBall:SoftSecurity#foo]]
7116 !! html
7117 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7118 </p>
7119 !! end
7120
7121 # Ideally the wikipedia: prefix here should be proto-relative too
7122 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7123 # define the 'en' prefix, and originally the test used 'wikipedia',
7124 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7125 # article.
7126 !! test
7127 Different interwiki prefixes mapping to the same URL
7128 !! wikitext
7129 [[:en:Foo]]
7130
7131 [[:en:Foo|Foo]]
7132
7133 [[wikipedia:Foo]]
7134
7135 [[:wikipedia:Foo|Foo]]
7136
7137 [[wikipedia:en:Foo]]
7138
7139 [[:wikipedia:en:Foo]]
7140
7141 [[ wikiPEdia :Foo]]
7142 !! html/parsoid
7143 <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>
7144
7145 <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>
7146
7147 <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>
7148
7149 <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>
7150
7151 <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>
7152
7153 <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>
7154
7155 <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>
7156 !! end
7157
7158 !! test
7159 Interwiki links that cannot be represented in wiki syntax
7160 !! wikitext
7161 [[meatball:ok]]
7162 [[meatball:ok#foo|ok with fragment]]
7163 [[meatball:ok_as_well?|ok ending with ? mark]]
7164 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7165 [http://de.wikipedia.org/wiki/#foo is just fragment]
7166
7167 !! html/php
7168 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7169 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7170 <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>
7171 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7172 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7173 </p>
7174 !! html/parsoid
7175 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7176 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7177 <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>
7178 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7179 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7180 !! end
7181
7182 !! test
7183 Interwiki links: trail
7184 !! wikitext
7185 [[wikipedia:Foo|Ba]]r
7186 !! html/php
7187 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7188 </p>
7189 !! html/parsoid
7190 <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>
7191 !! end
7192
7193 !! test
7194 Local interwiki link
7195 !! options
7196 parsoid=wt2html,wt2wt,html2html
7197 !! wikitext
7198 [[local:Template:Foo]]
7199 !! html/php
7200 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7201 </p>
7202 !! html/parsoid
7203 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7204 !! end
7205
7206 # Parsoid does not mark self-links, by design.
7207 !! test
7208 Local interwiki link: self-link to current page
7209 !! options
7210 title=[[Main Page]]
7211 parsoid=wt2html,wt2wt,html2html
7212 !! wikitext
7213 [[local:Main Page]]
7214 !! html/php
7215 <p><strong class="selflink">local:Main Page</strong>
7216 </p>
7217 !! html/parsoid
7218 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7219 !! end
7220
7221 !! test
7222 Local interwiki link: prefix only (bug 64167)
7223 !! options
7224 parsoid=wt2html,wt2wt,html2html
7225 !! wikitext
7226 [[local:]]
7227 !! html/php
7228 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7229 </p>
7230 !! html/parsoid
7231 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7232 !! end
7233
7234 !! test
7235 Local interwiki link: with additional interwiki prefix (bug 61357)
7236 !! options
7237 parsoid=wt2html,wt2wt,html2html
7238 !! wikitext
7239 [[local:meatball:Hello]]
7240 !! html/php
7241 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7242 </p>
7243 !! html/parsoid
7244 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7245 !! end
7246
7247 !! test
7248 Multiple local interwiki link prefixes
7249 !! wikitext
7250 [[local:local:local:local:mi:local:Foo]]
7251 !! options
7252 parsoid=wt2html,wt2wt,html2html
7253 !! html/php
7254 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7255 </p>
7256 !! html/parsoid
7257 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7258 !! end
7259
7260 ###
7261 ### Interlanguage links
7262 ### Language links (so that searching for '### language' matches..)
7263 ###
7264
7265 !! test
7266 Interlanguage link
7267 !! options
7268 parsoid=wt2html,wt2wt,html2html
7269 !! wikitext
7270 Blah blah blah
7271 [[zh:Chinese]]
7272 !! html/php
7273 <p>Blah blah blah
7274 </p>
7275 !! html/parsoid
7276 <p>Blah blah blah</p>
7277 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7278 !! end
7279
7280 !! test
7281 Interlanguage link with spacing
7282 !! options
7283 parsoid=wt2html,wt2wt,html2html
7284 !! wikitext
7285 Blah blah blah
7286 [[ zh : Chinese ]]
7287 !! html/php
7288 <p>Blah blah blah
7289 </p>
7290 !! html/parsoid
7291 <p>Blah blah blah</p>
7292 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7293 !! end
7294
7295 !! test
7296 Double interlanguage link
7297 !! options
7298 parsoid=wt2html,wt2wt,html2html
7299 !! wikitext
7300 Blah blah blah
7301 [[es:Spanish]]
7302 [[zh:Chinese]]
7303 !! html/php
7304 <p>Blah blah blah
7305 </p>
7306 !! html/parsoid
7307 <p>Blah blah blah</p>
7308 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7309 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7310 !! end
7311
7312 !! test
7313 Interlanguage link variations
7314 !! options
7315 parsoid=wt2html,wt2wt,html2html
7316 !! wikitext
7317 Blah blah blah
7318 [[ es :Spanish]]
7319 [[ ZH :Chinese]]
7320 [[es:Foo_bar]]
7321 [[es:Foo bar]]
7322 !! html/php
7323 <p>Blah blah blah
7324 </p>
7325 !! html/parsoid
7326 <p>Blah blah blah</p>
7327 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7328 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7329 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7330 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7331 !! end
7332
7333 !! test
7334 Interlanguage link, with prefix links
7335 !! options
7336 language=ln
7337 !! wikitext
7338 Blah blah blah
7339 [[zh:Chinese]]
7340 !! html/php
7341 <p>Blah blah blah
7342 </p>
7343 !! html/parsoid
7344 <p>Blah blah blah</p>
7345 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7346 !! end
7347
7348 !! test
7349 Double interlanguage link, with prefix links (bug 8897)
7350 !! options
7351 language=ln
7352 !! wikitext
7353 Blah blah blah
7354 [[es:Spanish]]
7355 [[zh:Chinese]]
7356 !! html/php
7357 <p>Blah blah blah
7358 </p>
7359 !! html/parsoid
7360 <p>Blah blah blah</p>
7361 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7362 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7363 !! end
7364
7365 !! test
7366 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7367 !! wikitext
7368 Blah blah blah
7369 [[mul:Article]]
7370 !! html/php
7371 <p>Blah blah blah
7372 </p>
7373 !! html/parsoid
7374 <p>Blah blah blah</p>
7375 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7376 !! end
7377
7378 !! test
7379 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7380 !! options
7381 language=ln
7382 !! wikitext
7383 [[WW&nbsp;II]]
7384 !! html
7385 <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>
7386 </p>
7387 !! end
7388
7389 !! test
7390 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7391 !! options
7392 parsoid=html2wt
7393 !! html
7394 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7395 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7396 !! wikitext
7397 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7398
7399 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7400 !! end
7401
7402 !! test
7403 Parsoid: handle constructor well
7404 !! wikitext
7405 [[constructor]]
7406
7407 [[constructor:foo]]
7408 !! html/php
7409 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7410 </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>
7411 </p>
7412 !! html/parsoid
7413 <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>
7414
7415 <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>
7416 !! end
7417
7418 !! article
7419 ko:
7420 !! text
7421 Test.
7422 !! endarticle
7423
7424 # Note that `ko` isn't a known interlanguage prefix
7425 !! test
7426 Parsoid: recognize interlanguage links without a target page
7427 !! options
7428 ill
7429 !! wikitext
7430 [[es:]]
7431
7432 [[ko:]]
7433 !! html/php
7434 es:
7435 !! html/parsoid
7436 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7437
7438 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7439 !! end
7440
7441 # Note that `ko` isn't a known interwiki prefix
7442 !! test
7443 Parsoid: recognize interwiki links without a target page
7444 !! options
7445 parsoid=wt2html,wt2wt,html2html
7446 !! wikitext
7447 [[:es:]]
7448
7449 [[:ko:]]
7450 !! html/php
7451 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7452 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7453 </p>
7454 !! html/parsoid
7455 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7456 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7457 !! end
7458
7459 !! test
7460 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7461 !! wikitext
7462 [[mi:Foo]]
7463 !! html/php
7464 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7465 </p>
7466 !! html/parsoid
7467 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7468 !! end
7469
7470 !! test
7471 Interlanguage link with preceding local interwiki link (bug 68085)
7472 !! options
7473 parsoid=wt2html,wt2wt,html2html
7474 !! wikitext
7475 Blah blah blah
7476 [[local:es:Spanish]]
7477 !! html/php
7478 <p>Blah blah blah
7479 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7480 </p>
7481 !! html/parsoid
7482 <p>Blah blah blah
7483 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7484 !! end
7485
7486 !! test
7487 Looks like an interlanguage link, but is actually a local interwiki
7488 !! options
7489 parsoid=wt2html,wt2wt,html2html
7490 !! wikitext
7491 Blah blah blah
7492 [[mi:Template:Foo]]
7493 !! html/php
7494 <p>Blah blah blah
7495 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7496 </p>
7497 !! html/parsoid
7498 <p>Blah blah blah
7499 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7500 !! end
7501
7502 ###
7503 ### Redirects, Parsoid-only
7504 ###
7505 !! test
7506 1. Simple redirect to page
7507 !! options
7508 parsoid
7509 !! wikitext
7510 #REDIRECT [[Main Page]]
7511 !! html
7512 <link rel="mw:PageProp/redirect" href="./Main_Page">
7513 !! end
7514
7515 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7516 !! test
7517 2. Other redirect variants
7518 !! options
7519 parsoid=wt2html,wt2wt
7520 !! wikitext
7521 #REDIRECT [[Main_Page]]
7522 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7523 !! html/parsoid
7524 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7525 !! end
7526
7527 !! test
7528 Empty redirect
7529 !! options
7530 parsoid=wt2html,wt2wt
7531 !! wikitext
7532 #REDIRECT [[]]
7533 !! html
7534 <ol>
7535 <li>REDIRECT [[]]</li></ol>
7536 !! end
7537
7538 !! test
7539 Optional colon in #REDIRECT
7540 !! options
7541 # the colon is archaic syntax. we support it for wt2html, but we
7542 # don't care that it roundtrips back to the modern syntax.
7543 parsoid=wt2html,html2html
7544 !! wikitext
7545 #REDIRECT:[[Main Page]]
7546 !! html
7547 <link rel="mw:PageProp/redirect" href="./Main_Page">
7548 !! end
7549
7550 !! test
7551 Whitespace in #REDIRECT with optional colon
7552 !! options
7553 # the colon and gratuitous whitespace is archaic syntax. we support
7554 # it for wt2html, but we don't care that it roundtrips back to the
7555 # modern syntax (without extra whitespace)
7556 parsoid=wt2html,html2html
7557 !! wikitext
7558
7559 #REDIRECT
7560 :
7561 [[Main Page]]
7562 !! html
7563 <link rel="mw:PageProp/redirect" href="./Main_Page">
7564 !! end
7565
7566 !! test
7567 Piped link in #REDIRECT
7568 !! options
7569 # content after piped link is ignored. we support this syntax,
7570 # but don't care that the piped link is lost when we roundtrip this.
7571 parsoid=wt2html
7572 !! wikitext
7573 #REDIRECT [[Main Page|bar]]
7574 !! html
7575 <link rel="mw:PageProp/redirect" href="./Main_Page">
7576 !! end
7577
7578 !! test
7579 Redirect to category
7580 !! options
7581 parsoid=wt2html
7582 !! wikitext
7583 #REDIRECT [[Category:Foo]]
7584 !! html
7585 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7586 !! end
7587
7588 !! test
7589 Redirect to category with URL encoding
7590 !! options
7591 parsoid=wt2html
7592 !! wikitext
7593 #REDIRECT [[Category%3AFoo]]
7594 !! html
7595 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7596 !! end
7597
7598 !! test
7599 Redirect to category page
7600 !! options
7601 parsoid=wt2html,html2html
7602 !! wikitext
7603 #REDIRECT [[:Category:Foo]]
7604 !! html
7605 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7606 !! end
7607
7608 !! test
7609 Redirect to image page (1)
7610 !! options
7611 parsoid
7612 !! wikitext
7613 #REDIRECT [[File:Wiki.png]]
7614 !! html
7615 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7616 !! end
7617
7618 !! test
7619 Redirect to image page (2)
7620 !! options
7621 parsoid
7622 !! wikitext
7623 #REDIRECT [[Image:Wiki.png]]
7624 !! html
7625 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7626 !! end
7627
7628 !! test
7629 Redirect to language
7630 !! options
7631 parsoid
7632 !! wikitext
7633 #REDIRECT [[en:File:Wiki.png]]
7634 !! html
7635 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7636 !! end
7637
7638 !! test
7639 Redirect to interwiki
7640 !! options
7641 parsoid
7642 !! wikitext
7643 #REDIRECT [[meatball:File:Wiki.png]]
7644 !! html
7645 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7646 !! end
7647
7648 !! test
7649 Non-English #REDIRECT
7650 !! options
7651 parsoid
7652 language=is
7653 !! wikitext
7654 #TILVÍSUN [[Main Page]]
7655 !! html
7656 <link rel="mw:PageProp/redirect" href="./Main_Page">
7657 !! end
7658
7659 !! test
7660 New redirect
7661 !! options
7662 parsoid=html2wt
7663 !! html
7664 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7665 !! wikitext
7666 Foo
7667 #REDIRECT [[Foo]]
7668 !! end
7669
7670 ##
7671 ## XHTML tidiness
7672 ###
7673
7674 !! test
7675 <br> to <br />
7676 !! wikitext
7677 1<br>2<br />3
7678 !! html
7679 <p>1<br />2<br />3
7680 </p>
7681 !! end
7682
7683 !! test
7684 Broken br tag sanitization
7685 !! wikitext
7686 </br>
7687 !! html/php
7688 <p>&lt;/br&gt;
7689 </p>
7690 !! end
7691
7692 # TODO: Fix html2html mode (bug 51055)!
7693 # This </br> handling was added as part of bug 50831; but it
7694 # differs from how PHP+tidy handles this. We should investigate
7695 # this.
7696 !! test
7697 Parsoid: Broken br tag recognition
7698 !! options
7699 parsoid=wt2html
7700 !! wikitext
7701 </br>
7702
7703 <br/ >
7704 !! html/php+tidy
7705 <p>&lt;/br&gt;</p>
7706 <p><br /></p>
7707 !! html/parsoid
7708 <p><br></p>
7709 <p><br/></p>
7710 !! end
7711
7712 !! test
7713 Incorrecly removing closing slashes from correctly formed XHTML
7714 !! wikitext
7715 <br style="clear:both;" />
7716 !! html
7717 <p><br style="clear:both;" />
7718 </p>
7719 !! end
7720
7721 !! test
7722 Failing to transform badly formed HTML into correct XHTML
7723 !! wikitext
7724 <br style="clear: left;">
7725 <br style="clear: right;">
7726 <br style="clear: both;">
7727 !! html
7728 <p><br style="clear: left;" />
7729 <br style="clear: right;" />
7730 <br style="clear: both;" />
7731 </p>
7732 !!end
7733
7734 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7735 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7736 !! test
7737 Handling html with a div self-closing tag
7738 !! wikitext
7739 <div title />
7740 <div title/>
7741 <div title/ >
7742 <div title=bar />
7743 <div title=bar/>
7744 <div title=bar/ >
7745 !! html/php
7746 <p>&lt;div title /&gt;
7747 &lt;div title/&gt;
7748 </p>
7749 <div>
7750 <p>&lt;div title=bar /&gt;
7751 &lt;div title=bar/&gt;
7752 </p>
7753 <div title="bar/"></div>
7754 </div>
7755
7756 !! html/parsoid
7757 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7758 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7759 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7760 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7761 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7762 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7763 !! end
7764
7765 !! test
7766 Handling html with a br self-closing tag
7767 !! wikitext
7768 <br title />
7769 <br title/>
7770 <br title/ >
7771 <br title=bar />
7772 <br title=bar/>
7773 <br title=bar/ >
7774 !! html/php
7775 <p><br title="title" />
7776 <br title="title" />
7777 <br />
7778 <br title="bar" />
7779 <br title="bar" />
7780 <br title="bar/" />
7781 </p>
7782 !! html/parsoid
7783 <p><br title="" />
7784 <br title="" />
7785 <br title="" />
7786 <br title="bar" />
7787 <br title="bar" />
7788 <br title="bar/" />
7789 </p>
7790 !! end
7791
7792 !! test
7793 Horizontal ruler (should it add that extra space?)
7794 !! wikitext
7795 <hr>
7796 <hr >
7797 foo <hr
7798 > bar
7799 !! html+tidy
7800 <hr />
7801 <hr />
7802 <p>foo</p>
7803 <hr />
7804 <p>bar</p>
7805 !! end
7806
7807 !! test
7808 Horizontal ruler -- 4+ dashes render hr
7809 !! wikitext
7810 ----
7811 !! html
7812 <hr />
7813
7814 !! end
7815
7816 !! test
7817 Horizontal ruler -- eats additional dashes on the same line
7818 !! wikitext
7819 ---------
7820 !! html
7821 <hr />
7822
7823 !! end
7824
7825 !! test
7826 Horizontal ruler -- does not collapse dashes on consecutive lines
7827 !! wikitext
7828 ----
7829 ----
7830 !! html
7831 <hr />
7832 <hr />
7833
7834 !! end
7835
7836 !! test
7837 Horizontal ruler -- <4 dashes render as plain text
7838 !! wikitext
7839 ---
7840 !! html
7841 <p>---
7842 </p>
7843 !! end
7844
7845 !! test
7846 Horizontal ruler -- Supports content following dashes on same line
7847 !! wikitext
7848 ---- Foo
7849 !! html
7850 <hr /> Foo
7851
7852 !! html+tidy
7853 <hr />
7854 <p>Foo</p>
7855 !! end
7856
7857 ###
7858 ### Block-level elements
7859 ###
7860 !! test
7861 Common list
7862 !! wikitext
7863 *Common list
7864 * item 2
7865 *item 3
7866 !! html
7867 <ul><li>Common list</li>
7868 <li> item 2</li>
7869 <li>item 3</li></ul>
7870
7871 !! end
7872
7873 !! test
7874 Numbered list
7875 !! wikitext
7876 #Numbered list
7877 #item 2
7878 # item 3
7879 !! html
7880 <ol><li>Numbered list</li>
7881 <li>item 2</li>
7882 <li> item 3</li></ol>
7883
7884 !! end
7885
7886 !! test
7887 Mixed list
7888 !! wikitext
7889 *Mixed list
7890 *# with numbers
7891 ** and bullets
7892 *# and numbers
7893 *bullets again
7894 **bullet level 2
7895 ***bullet level 3
7896 ***#Number on level 4
7897 **bullet level 2
7898 **#Number on level 3
7899 **#Number on level 3
7900 *#number level 2
7901 *Level 1
7902 *** Level 3
7903 #** Level 3, but ordered
7904 !! html
7905 <ul><li>Mixed list
7906 <ol><li> with numbers</li></ol>
7907 <ul><li> and bullets</li></ul>
7908 <ol><li> and numbers</li></ol></li>
7909 <li>bullets again
7910 <ul><li>bullet level 2
7911 <ul><li>bullet level 3
7912 <ol><li>Number on level 4</li></ol></li></ul></li>
7913 <li>bullet level 2
7914 <ol><li>Number on level 3</li>
7915 <li>Number on level 3</li></ol></li></ul>
7916 <ol><li>number level 2</li></ol></li>
7917 <li>Level 1
7918 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7919 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7920
7921 !! end
7922
7923 !! test
7924 Nested lists 1
7925 !! wikitext
7926 *foo
7927 **bar
7928 !! html
7929 <ul><li>foo
7930 <ul><li>bar</li></ul></li></ul>
7931
7932 !! end
7933
7934 !! test
7935 Nested lists 2
7936 !! wikitext
7937 **foo
7938 *bar
7939 !! html
7940 <ul><li><ul><li>foo</li></ul></li>
7941 <li>bar</li></ul>
7942
7943 !! end
7944
7945 !! test
7946 Nested lists 3 (first element empty)
7947 !! wikitext
7948 *
7949 **bar
7950 !! html
7951 <ul><li>
7952 <ul><li>bar</li></ul></li></ul>
7953
7954 !! end
7955
7956 !! test
7957 Nested lists 4 (first element empty)
7958 !! wikitext
7959 **
7960 *bar
7961 !! html
7962 <ul><li><ul><li></li></ul></li>
7963 <li>bar</li></ul>
7964
7965 !! end
7966
7967 !! test
7968 Nested lists 5 (both elements empty)
7969 !! wikitext
7970 **
7971 *
7972 !! html
7973 <ul><li><ul><li></li></ul></li>
7974 <li></li></ul>
7975
7976 !! end
7977
7978 !! test
7979 Nested lists 6 (both elements empty)
7980 !! wikitext
7981 *
7982 **
7983 !! html
7984 <ul><li>
7985 <ul><li></li></ul></li></ul>
7986
7987 !! end
7988
7989 !! test
7990 Nested lists 7 (skip initial nesting levels)
7991 !! wikitext
7992 *** foo
7993 !! html
7994 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7995
7996 !! end
7997
7998 !! test
7999 Nested lists 8 (multiple nesting transitions)
8000 !! wikitext
8001 * foo
8002 *** bar
8003 ** baz
8004 * boo
8005 !! html
8006 <ul><li> foo
8007 <ul><li><ul><li> bar</li></ul></li>
8008 <li> baz</li></ul></li>
8009 <li> boo</li></ul>
8010
8011 !! end
8012
8013 !! test
8014 1. Lists with start-of-line-transparent tokens before bullets: Comments
8015 !! wikitext
8016 *foo
8017 *<!--cmt-->bar
8018 <!--cmt-->*baz
8019 !! html
8020 <ul><li>foo</li>
8021 <li>bar</li>
8022 <li>baz</li></ul>
8023
8024 !! end
8025
8026 !! test
8027 2. Lists with start-of-line-transparent tokens before bullets: Template close
8028 !! wikitext
8029 *foo {{echo|bar
8030 }}*baz
8031 !! html
8032 <ul><li>foo bar</li>
8033 <li>baz</li></ul>
8034
8035 !! end
8036
8037 !! test
8038 List items are not parsed correctly following a <pre> block (bug 785)
8039 !! wikitext
8040 * <pre>foo</pre>
8041 * <pre>bar</pre>
8042 * zar
8043 !! html
8044 <ul><li> <pre>foo</pre></li>
8045 <li> <pre>bar</pre></li>
8046 <li> zar</li></ul>
8047
8048 !! end
8049
8050 !! test
8051 List items from template
8052 !! wikitext
8053
8054 {{inner list}}
8055 * item 2
8056
8057 * item 0
8058 {{inner list}}
8059 * item 2
8060
8061 * item 0
8062 * notSOL{{inner list}}
8063 * item 2
8064 !! html
8065 <ul><li> item 1</li>
8066 <li> item 2</li></ul>
8067 <ul><li> item 0</li>
8068 <li> item 1</li>
8069 <li> item 2</li></ul>
8070 <ul><li> item 0</li>
8071 <li> notSOL</li>
8072 <li> item 1</li>
8073 <li> item 2</li></ul>
8074
8075 !! end
8076
8077 !! test
8078 List interrupted by empty line or heading
8079 !! wikitext
8080 * foo
8081
8082 ** bar
8083 == A heading ==
8084 * Another list item
8085 !! html
8086 <ul><li> foo</li></ul>
8087 <ul><li><ul><li> bar</li></ul></li></ul>
8088 <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>
8089 <ul><li> Another list item</li></ul>
8090
8091 !!end
8092
8093 !!test
8094 Multiple list tags generated by templates
8095 !! wikitext
8096 {{echo|<li>}}a
8097 {{echo|<li>}}b
8098 {{echo|<li>}}c
8099 !! html
8100 <li>a
8101 <li>b
8102 <li>c</li>
8103 </li>
8104 </li>
8105
8106 !! html+tidy
8107 <ul>
8108 <li>a</li>
8109 <li>b</li>
8110 <li>c</li>
8111 </ul>
8112 !!end
8113
8114 !!test
8115 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8116 !! wikitext
8117 *a
8118 <!--This line will NOT split the list-->
8119 *b
8120 <!--This line will NOT split the list either-->
8121 *c
8122 <!--foo--> <!----> <!--This line NOT split the list either-->
8123 *d
8124 !! html
8125 <ul><li>a</li>
8126 <li>b</li>
8127 <li>c</li>
8128 <li>d</li></ul>
8129
8130 !!end
8131
8132 !!test
8133 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8134 !! wikitext
8135 *a
8136 <!--This line will NOT split the list-->
8137 *b
8138 <!--This line will NOT split the list either-->
8139 *c
8140 <!--foo--> <!----> <!--This line NOT split the list
8141 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 Test the li-hack
8153 (The PHP parser relies on Tidy for the hack)
8154 !!options
8155 parsoid=wt2html,wt2wt
8156 !! wikitext
8157 * foo
8158 * <li>li-hack
8159 * {{echo|<li>templated li-hack}}
8160 * <!--foo--> <li> unsupported li-hack with preceding comments
8161
8162 <ul>
8163 <li><li>not a li-hack
8164 </li>
8165 </ul>
8166 !! html+tidy
8167 <ul>
8168 <li>foo</li>
8169 <li>li-hack</li>
8170 <li>templated li-hack</li>
8171 <li>unsupported li-hack with preceding comments</li>
8172 </ul>
8173 <ul>
8174 <li>not a li-hack</li>
8175 </ul>
8176 !!end
8177
8178 !! test
8179 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8180 !! options
8181 parsoid
8182 !! wikitext
8183 # foo
8184 ## bar
8185 * foo
8186 ** bar
8187 : foo
8188 :: bar
8189 !! html
8190 <ol>
8191 <li> foo<ol>
8192 <li> bar</li>
8193 </ol></li>
8194 </ol><ul>
8195 <li> foo<ul>
8196 <li> bar</li>
8197 </ul></li>
8198 </ul><dl>
8199 <dd> foo<dl>
8200 <dd> bar</dd>
8201 </dl></dd>
8202 </dl>
8203 !! end
8204
8205 !! test
8206 Parsoid: Test of whitespace serialization with Templated bullets
8207 !! options
8208 parsoid
8209 !! wikitext
8210 * {{bullet}}
8211 !! html
8212 <ul>
8213 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8214 </ul>
8215 !! end
8216
8217 # ------------------------------------------------------------------------
8218 # The next set of tests are about Parsoid's ability to handle badly nested
8219 # tags (parse, minimize scope of fixup, and roundtrip back)
8220 # ------------------------------------------------------------------------
8221
8222 !! test
8223 Unbalanced closing block tags break a list
8224 (php parser relies on Tidy to fix up)
8225 !! wikitext
8226 <div>
8227 *a</div><div>
8228 *b</div>
8229 !! html+tidy
8230 <div>
8231 <ul>
8232 <li>a</li>
8233 </ul>
8234 </div>
8235 <div>
8236 <ul>
8237 <li>b</li>
8238 </ul>
8239 </div>
8240 !! end
8241
8242 # Parsoid fails this test, but it might be tricky to support properly.
8243 # See bug 68395.
8244 !! test
8245 Unbalanced closing non-block tags don't break a list
8246 (php parser relies on Tidy to fix up)
8247 !! wikitext
8248 <span>
8249 *a</span><span>
8250 *b</span>
8251 !! html/php+tidy
8252 <ul>
8253 <li><span>a</span></li>
8254 <li><span>b</span></li>
8255 </ul>
8256 !! html/parsoid
8257 <span>
8258 <ul>
8259 <li>a<span></span>
8260 </li>
8261 <li>b
8262 </li>
8263 </ul>
8264 </span>
8265 !! end
8266
8267 !! test
8268 Unclosed formatting tags that straddle lists are closed and reopened
8269 (php parser relies on Tidy to fix up)
8270 !! options
8271 parsoid=wt2html,wt2wt,html2html
8272 !! wikitext
8273 # <s> a
8274 # b </s>
8275 !! html/php+tidy
8276 <ol>
8277 <li><s>a</s></li>
8278 <li><s>b</s></li>
8279 </ol>
8280 !! html/parsoid
8281 <ol><li> <s> a</s></li>
8282 <li><s> b </s></li></ol>
8283 !! end
8284
8285 # Parsoid fails this test, but it might be tricky to support properly.
8286 # See bug 68395.
8287 !!test
8288 List embedded in a non-block tag
8289 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8290 !! wikitext
8291 <small>
8292 * foo
8293 </small>
8294 !! html/php+tidy
8295 <ul>
8296 <li><small>foo</small></li>
8297 </ul>
8298 !! html/parsoid
8299 <small>
8300 <ul>
8301 <li> foo</li>
8302 </ul>
8303 </small>
8304 !!end
8305
8306 # This is a bug in the PHP parser + tidy combination.
8307 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8308 # and then fostered out of the table by tidy.)
8309 # We believe the Parsoid output to be correct.
8310 !! test
8311 Table with missing opening <tr> tag
8312 !! options
8313 parsoid=wt2html,wt2wt
8314 !! wikitext
8315 <table>
8316 <td>foo</td>
8317 </tr>
8318 </table>
8319 !! html/php+tidy
8320 <p>&lt;/tr&gt;</p>
8321 <table>
8322 <tr>
8323 <td>foo</td>
8324 </tr>
8325 </table>
8326 !! html/parsoid
8327 <table>
8328 <tr>
8329 <td>foo</td>
8330 </tr>
8331 </table>
8332 !! end
8333
8334 ###
8335 ### Magic Words
8336 ###
8337
8338 # Note that the current date is hard-coded as
8339 # 1970-01-01T00:02:03Z (a Thursday)
8340 # when running parser tests. The timezone is also fixed to GMT, so
8341 # local date will be identical to current date.
8342
8343 !! test
8344 Magic Word: {{CURRENTDAY}}
8345 !! wikitext
8346 {{CURRENTDAY}}
8347 !! html
8348 <p>1
8349 </p>
8350 !! end
8351
8352 !! test
8353 Magic Word: {{CURRENTDAY2}}
8354 !! wikitext
8355 {{CURRENTDAY2}}
8356 !! html
8357 <p>01
8358 </p>
8359 !! end
8360
8361 !! test
8362 Magic Word: {{CURRENTDAYNAME}}
8363 !! wikitext
8364 {{CURRENTDAYNAME}}
8365 !! html
8366 <p>Thursday
8367 </p>
8368 !! end
8369
8370 !! test
8371 Magic Word: {{CURRENTDOW}}
8372 !! wikitext
8373 {{CURRENTDOW}}
8374 !! html
8375 <p>4
8376 </p>
8377 !! end
8378
8379 !! test
8380 Magic Word: {{CURRENTMONTH}}
8381 !! wikitext
8382 {{CURRENTMONTH}}
8383 !! html
8384 <p>01
8385 </p>
8386 !! end
8387
8388 !! test
8389 Magic Word: {{CURRENTMONTH1}}
8390 !! wikitext
8391 {{CURRENTMONTH1}}
8392 !! html
8393 <p>1
8394 </p>
8395 !! end
8396
8397 !! test
8398 Magic Word: {{CURRENTMONTHABBREV}}
8399 !! wikitext
8400 {{CURRENTMONTHABBREV}}
8401 !! html
8402 <p>Jan
8403 </p>
8404 !! end
8405
8406 !! test
8407 Magic Word: {{CURRENTMONTHNAME}}
8408 !! wikitext
8409 {{CURRENTMONTHNAME}}
8410 !! html
8411 <p>January
8412 </p>
8413 !! end
8414
8415 !! test
8416 Magic Word: {{CURRENTMONTHNAMEGEN}}
8417 !! wikitext
8418 {{CURRENTMONTHNAMEGEN}}
8419 !! html
8420 <p>January
8421 </p>
8422 !! end
8423
8424 !! test
8425 Magic Word: {{CURRENTTIME}}
8426 !! wikitext
8427 {{CURRENTTIME}}
8428 !! html
8429 <p>00:02
8430 </p>
8431 !! end
8432
8433 !! test
8434 Magic Word: {{CURRENTHOUR}}
8435 !! wikitext
8436 {{CURRENTHOUR}}
8437 !! html
8438 <p>00
8439 </p>
8440 !! end
8441
8442 !! test
8443 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8444 !! wikitext
8445 {{CURRENTWEEK}}
8446 !! html
8447 <p>1
8448 </p>
8449 !! end
8450
8451 !! test
8452 Magic Word: {{CURRENTYEAR}}
8453 !! wikitext
8454 {{CURRENTYEAR}}
8455 !! html
8456 <p>1970
8457 </p>
8458 !! end
8459
8460 !! test
8461 Magic Word: {{CURRENTTIMESTAMP}}
8462 !! wikitext
8463 {{CURRENTTIMESTAMP}}
8464 !! html
8465 <p>19700101000203
8466 </p>
8467 !! end
8468
8469 !! test
8470 Magic Words LOCAL (UTC)
8471 !! wikitext
8472 * {{LOCALMONTH}}
8473 * {{LOCALMONTH1}}
8474 * {{LOCALMONTHNAME}}
8475 * {{LOCALMONTHNAMEGEN}}
8476 * {{LOCALMONTHABBREV}}
8477 * {{LOCALDAY}}
8478 * {{LOCALDAY2}}
8479 * {{LOCALDAYNAME}}
8480 * {{LOCALYEAR}}
8481 * {{LOCALTIME}}
8482 * {{LOCALHOUR}}
8483 * {{LOCALWEEK}}
8484 * {{LOCALDOW}}
8485 * {{LOCALTIMESTAMP}}
8486 !! html
8487 <ul><li> 01</li>
8488 <li> 1</li>
8489 <li> January</li>
8490 <li> January</li>
8491 <li> Jan</li>
8492 <li> 1</li>
8493 <li> 01</li>
8494 <li> Thursday</li>
8495 <li> 1970</li>
8496 <li> 00:02</li>
8497 <li> 00</li>
8498 <li> 1</li>
8499 <li> 4</li>
8500 <li> 19700101000203</li></ul>
8501
8502 !! end
8503
8504 !! test
8505 Magic Word: {{FULLPAGENAME}}
8506 !! options
8507 title=[[User:Ævar Arnfjörð Bjarmason]]
8508 !! wikitext
8509 {{FULLPAGENAME}}
8510 !! html
8511 <p>User:Ævar Arnfjörð Bjarmason
8512 </p>
8513 !! end
8514
8515 !! test
8516 Magic Word: {{FULLPAGENAMEE}}
8517 !! options
8518 title=[[User:Ævar Arnfjörð Bjarmason]]
8519 !! wikitext
8520 {{FULLPAGENAMEE}}
8521 !! html
8522 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8523 </p>
8524 !! end
8525
8526 !! test
8527 Magic Word: {{TALKSPACE}}
8528 !! options
8529 title=[[User:Ævar Arnfjörð Bjarmason]]
8530 !! wikitext
8531 {{TALKSPACE}}
8532 !! html
8533 <p>User talk
8534 </p>
8535 !! end
8536
8537 !! test
8538 Magic Word: {{TALKSPACE}}, same namespace
8539 !! options
8540 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8541 !! wikitext
8542 {{TALKSPACE}}
8543 !! html
8544 <p>User talk
8545 </p>
8546 !! end
8547
8548 !! test
8549 Magic Word: {{TALKSPACE}}, main namespace
8550 !! options
8551 title=[[Parser Test]]
8552 !! wikitext
8553 {{TALKSPACE}}
8554 !! html
8555 <p>Talk
8556 </p>
8557 !! end
8558
8559 !! test
8560 Magic Word: {{TALKSPACEE}}
8561 !! options
8562 title=[[User:Ævar Arnfjörð Bjarmason]]
8563 !! wikitext
8564 {{TALKSPACEE}}
8565 !! html
8566 <p>User_talk
8567 </p>
8568 !! end
8569
8570 !! test
8571 Magic Word: {{SUBJECTSPACE}}
8572 !! options
8573 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8574 !! wikitext
8575 {{SUBJECTSPACE}}
8576 !! html
8577 <p>User
8578 </p>
8579 !! end
8580
8581 !! test
8582 Magic Word: {{SUBJECTSPACE}}, same namespace
8583 !! options
8584 title=[[User:Ævar Arnfjörð Bjarmason]]
8585 !! wikitext
8586 {{SUBJECTSPACE}}
8587 !! html
8588 <p>User
8589 </p>
8590 !! end
8591
8592 !! test
8593 Magic Word: {{SUBJECTSPACE}}, main namespace
8594 !! options
8595 title=[[Parser Test]]
8596 !! wikitext
8597 {{SUBJECTSPACE}}
8598 !! html
8599
8600 !! end
8601
8602 !! test
8603 Magic Word: {{SUBJECTSPACEE}}
8604 !! options
8605 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8606 !! wikitext
8607 {{SUBJECTSPACEE}}
8608 !! html
8609 <p>User
8610 </p>
8611 !! end
8612
8613 !! test
8614 Magic Word: {{NAMESPACE}}
8615 !! options
8616 title=[[User:Ævar Arnfjörð Bjarmason]]
8617 !! wikitext
8618 {{NAMESPACE}}
8619 !! html
8620 <p>User
8621 </p>
8622 !! end
8623
8624 !! test
8625 Magic Word: {{NAMESPACEE}}
8626 !! options
8627 title=[[User:Ævar Arnfjörð Bjarmason]]
8628 !! wikitext
8629 {{NAMESPACEE}}
8630 !! html
8631 <p>User
8632 </p>
8633 !! end
8634
8635 !! test
8636 Magic Word: {{NAMESPACENUMBER}}
8637 !! options
8638 title=[[User:Ævar Arnfjörð Bjarmason]]
8639 !! wikitext
8640 {{NAMESPACENUMBER}}
8641 !! html
8642 <p>2
8643 </p>
8644 !! end
8645
8646 !! test
8647 Magic Word: {{SUBPAGENAME}}
8648 !! options
8649 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8650 !! wikitext
8651 {{SUBPAGENAME}}
8652 !! html
8653 <p>sub ö
8654 </p>
8655 !! end
8656
8657 !! test
8658 Magic Word: {{SUBPAGENAMEE}}
8659 !! options
8660 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8661 !! wikitext
8662 {{SUBPAGENAMEE}}
8663 !! html
8664 <p>sub_%C3%B6
8665 </p>
8666 !! end
8667
8668 !! test
8669 Magic Word: {{ROOTPAGENAME}}
8670 !! options
8671 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8672 !! wikitext
8673 {{ROOTPAGENAME}}
8674 !! html
8675 <p>Ævar Arnfjörð Bjarmason
8676 </p>
8677 !! end
8678
8679 !! test
8680 Magic Word: {{ROOTPAGENAMEE}}
8681 !! options
8682 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8683 !! wikitext
8684 {{ROOTPAGENAMEE}}
8685 !! html
8686 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8687 </p>
8688 !! end
8689
8690 !! test
8691 Magic Word: {{BASEPAGENAME}}
8692 !! options
8693 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8694 !! wikitext
8695 {{BASEPAGENAME}}
8696 !! html
8697 <p>Ævar Arnfjörð Bjarmason
8698 </p>
8699 !! end
8700
8701 !! test
8702 Magic Word: {{BASEPAGENAMEE}}
8703 !! options
8704 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8705 !! wikitext
8706 {{BASEPAGENAMEE}}
8707 !! html
8708 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8709 </p>
8710 !! end
8711
8712 !! test
8713 Magic Word: {{TALKPAGENAME}}
8714 !! options
8715 title=[[User:Ævar Arnfjörð Bjarmason]]
8716 !! wikitext
8717 {{TALKPAGENAME}}
8718 !! html
8719 <p>User talk:Ævar Arnfjörð Bjarmason
8720 </p>
8721 !! end
8722
8723 !! test
8724 Magic Word: {{TALKPAGENAMEE}}
8725 !! options
8726 title=[[User:Ævar Arnfjörð Bjarmason]]
8727 !! wikitext
8728 {{TALKPAGENAMEE}}
8729 !! html
8730 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8731 </p>
8732 !! end
8733
8734 !! test
8735 Magic Word: {{SUBJECTPAGENAME}}
8736 !! options
8737 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8738 !! wikitext
8739 {{SUBJECTPAGENAME}}
8740 !! html
8741 <p>User:Ævar Arnfjörð Bjarmason
8742 </p>
8743 !! end
8744
8745 !! test
8746 Magic Word: {{SUBJECTPAGENAMEE}}
8747 !! options
8748 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8749 !! wikitext
8750 {{SUBJECTPAGENAMEE}}
8751 !! html
8752 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8753 </p>
8754 !! end
8755
8756 !! test
8757 Magic Word: {{NUMBEROFFILES}}
8758 !! wikitext
8759 {{NUMBEROFFILES}}
8760 !! html
8761 <p>5
8762 </p>
8763 !! end
8764
8765 !! test
8766 Magic Word: {{PAGENAME}}
8767 !! options
8768 title=[[User:Ævar Arnfjörð Bjarmason]]
8769 !! wikitext
8770 {{PAGENAME}}
8771 !! html
8772 <p>Ævar Arnfjörð Bjarmason
8773 </p>
8774 !! end
8775
8776 !! test
8777 Magic Word: {{PAGENAME}} with metacharacters
8778 !! options
8779 title=[['foo & bar = baz']]
8780 !! wikitext
8781 ''{{PAGENAME}}''
8782 !! html/php
8783 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8784 </p>
8785 !! html+tidy
8786 <p><i>'foo &amp; bar = baz'</i></p>
8787 !! end
8788
8789 !! test
8790 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8791 !! options
8792 title=[[*RFC 1234 http://example.com/]]
8793 !! wikitext
8794 {{PAGENAME}}
8795 !! html/php
8796 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8797 </p>
8798 !! html+tidy
8799 <p>*RFC 1234 http://example.com/</p>
8800 !! end
8801
8802 !! test
8803 Magic Word: {{PAGENAMEE}}
8804 !! options
8805 title=[[User:Ævar Arnfjörð Bjarmason]]
8806 !! wikitext
8807 {{PAGENAMEE}}
8808 !! html
8809 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8810 </p>
8811 !! end
8812
8813 !! test
8814 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8815 !! options
8816 title=[[*RFC 1234 http://example.com/]]
8817 !! wikitext
8818 {{PAGENAMEE}}
8819 !! html/php
8820 <p>&#42;RFC_1234_http&#58;//example.com/
8821 </p>
8822 !! html+tidy
8823 <p>*RFC_1234_http://example.com/</p>
8824 !! end
8825
8826 !! test
8827 Magic Word: {{REVISIONID}}
8828 !! wikitext
8829 {{REVISIONID}}
8830 !! html
8831 <p>1337
8832 </p>
8833 !! end
8834
8835 !! test
8836 Magic Word: {{SCRIPTPATH}}
8837 !! wikitext
8838 {{SCRIPTPATH}}
8839 !! html
8840 <p>/
8841 </p>
8842 !! end
8843
8844 !! test
8845 Magic Word: {{STYLEPATH}}
8846 !! wikitext
8847 {{STYLEPATH}}
8848 !! html
8849 <p>/skins
8850 </p>
8851 !! end
8852
8853 !! test
8854 Magic Word: {{SERVER}}
8855 !! wikitext
8856 {{SERVER}}
8857 !! html
8858 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8859 </p>
8860 !! end
8861
8862 !! test
8863 Magic Word: {{SERVERNAME}}
8864 !! wikitext
8865 {{SERVERNAME}}
8866 !! html
8867 <p>example.org
8868 </p>
8869 !! end
8870
8871 !! test
8872 Magic Word: {{SITENAME}}
8873 !! wikitext
8874 {{SITENAME}}
8875 !! html
8876 <p>MediaWiki
8877 </p>
8878 !! end
8879
8880 !! test
8881 Case-sensitive magic words, when cased differently, should just be template transclusions
8882 !! wikitext
8883 {{CurrentMonth}}
8884 {{currentday}}
8885 {{cURreNTweEK}}
8886 {{currentHour}}
8887 !! html
8888 <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>
8889 <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>
8890 <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>
8891 <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>
8892 </p>
8893 !! end
8894
8895 !! test
8896 Case-insensitive magic words should still work with weird casing.
8897 !! wikitext
8898 {{sErVeRNaMe}}
8899 {{LCFirst:AOEU}}
8900 {{ucFIRST:aoeu}}
8901 {{SERver}}
8902 !! html
8903 <p>example.org
8904 aOEU
8905 Aoeu
8906 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8907 </p>
8908 !! end
8909
8910 # From plwiki:PLOS_ONE
8911 !! test
8912 Parsoid: Page property magic word with magic word contents
8913 !! wikitext
8914 {{DISPLAYTITLE:''{{PAGENAME}}''}}
8915 !! html/parsoid
8916 <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>"}]]}'/>
8917 !! end
8918
8919 !! test
8920 Parsoid: Template-generated DISPLAYTITLE
8921 !! wikitext
8922 {{{{echo|DISPLAYTITLE}}:Foo}}
8923 !! html/parsoid
8924 <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}}]}'/>
8925 !! end
8926
8927 !! test
8928 Namespace 1 {{ns:1}}
8929 !! wikitext
8930 {{ns:1}}
8931 !! html
8932 <p>Talk
8933 </p>
8934 !! end
8935
8936 !! test
8937 Namespace 1 {{ns:01}}
8938 !! wikitext
8939 {{ns:01}}
8940 !! html
8941 <p>Talk
8942 </p>
8943 !! end
8944
8945 !! test
8946 Namespace 0 {{ns:0}} (bug 4783)
8947 !! wikitext
8948 {{ns:0}}
8949 !! html
8950
8951 !! end
8952
8953 !! test
8954 Namespace 0 {{ns:00}} (bug 4783)
8955 !! wikitext
8956 {{ns:00}}
8957 !! html
8958
8959 !! end
8960
8961 !! test
8962 Namespace -1 {{ns:-1}}
8963 !! wikitext
8964 {{ns:-1}}
8965 !! html
8966 <p>Special
8967 </p>
8968 !! end
8969
8970 !! test
8971 Namespace User {{ns:User}}
8972 !! wikitext
8973 {{ns:User}}
8974 !! html
8975 <p>User
8976 </p>
8977 !! end
8978
8979 !! test
8980 Namespace User talk {{ns:User_talk}}
8981 !! wikitext
8982 {{ns:User_talk}}
8983 !! html
8984 <p>User talk
8985 </p>
8986 !! end
8987
8988 !! test
8989 Namespace User talk {{ns:uSeR tAlK}}
8990 !! wikitext
8991 {{ns:uSeR tAlK}}
8992 !! html
8993 <p>User talk
8994 </p>
8995 !! end
8996
8997 !! test
8998 Namespace File {{ns:File}}
8999 !! wikitext
9000 {{ns:File}}
9001 !! html
9002 <p>File
9003 </p>
9004 !! end
9005
9006 !! test
9007 Namespace File {{ns:Image}}
9008 !! wikitext
9009 {{ns:Image}}
9010 !! html
9011 <p>File
9012 </p>
9013 !! end
9014
9015 !! test
9016 Namespace (lang=de) Benutzer {{ns:User}}
9017 !! options
9018 language=de
9019 !! wikitext
9020 {{ns:User}}
9021 !! html
9022 <p>Benutzer
9023 </p>
9024 !! end
9025
9026 !! test
9027 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9028 !! options
9029 language=de
9030 !! wikitext
9031 {{ns:3}}
9032 !! html
9033 <p>Benutzer Diskussion
9034 </p>
9035 !! end
9036
9037
9038 !! test
9039 Urlencode
9040 !! wikitext
9041 {{urlencode:hi world?!}}
9042 {{urlencode:hi world?!|WIKI}}
9043 {{urlencode:hi world?!|PATH}}
9044 {{urlencode:hi world?!|QUERY}}
9045 !! html
9046 <p>hi+world%3F%21
9047 hi_world%3F!
9048 hi%20world%3F%21
9049 hi+world%3F%21
9050 </p>
9051 !! end
9052
9053 !! test
9054 Magic Word: prioritize type info over data-parsoid
9055 !! options
9056 parsoid=html2wt
9057 !! html
9058 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9059 !! wikitext
9060 __FORCETOC__
9061 !! end
9062
9063 !! test
9064 Magic Word: serialize on separate line (parsoid)
9065 !! options
9066 parsoid=wt2wt,html2wt
9067 !! wikitext
9068 foo
9069 __NOTOC__
9070 bar
9071 !! html
9072 foo<meta property="mw:PageProp/notoc"/>bar
9073 !! end
9074
9075 !! test
9076 Magic Word: rt non-english wikis
9077 !! options
9078 parsoid=wt2wt
9079 language=de
9080 !! wikitext
9081 __NOEDITSECTION__
9082 !! html
9083 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9084 !! end
9085
9086 ###
9087 ### Magic links
9088 ###
9089 !! test
9090 Magic links: internal link to RFC (bug 479)
9091 !! wikitext
9092 [[RFC 123]]
9093 !! html
9094 <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>
9095 </p>
9096 !! end
9097
9098 !! test
9099 Magic links: RFC (bug 479)
9100 !! wikitext
9101 RFC 822
9102 !! html
9103 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9104 </p>
9105 !! end
9106
9107 !! test
9108 Magic links: RFC (bug 65278)
9109 !! wikitext
9110 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9111 !! html
9112 <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.
9113 </p>
9114 !! end
9115
9116 !! test
9117 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9118 !! wikitext
9119 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9120 RFC
9121 822
9122 !! html
9123 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9124 RFC
9125 822
9126 </p>
9127 !! end
9128
9129 !! test
9130 Magic links: ISBN (bug 1937)
9131 !! wikitext
9132 ISBN 0-306-40615-2
9133 !! html
9134 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9135 </p>
9136 !! end
9137
9138 !! test
9139 Magic links: ISBN (bug 65278)
9140 !! wikitext
9141 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9142 !! html/php
9143 <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.
9144 </p>
9145 !! html/parsoid
9146 <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>
9147 !! end
9148
9149 !! test
9150 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9151 !! wikitext
9152 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9153 ISBN
9154 9780316098113
9155 ISBN 978
9156 0316098113
9157 !! html
9158 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9159 ISBN
9160 9780316098113
9161 ISBN 978
9162 0316098113
9163 </p>
9164 !! end
9165
9166 !! test
9167 Magic links: PMID incorrectly converts space to underscore
9168 !! wikitext
9169 PMID 1234
9170 !! html
9171 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9172 </p>
9173 !! end
9174
9175 !! test
9176 Magic links: PMID (bug 65278)
9177 !! wikitext
9178 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9179 !! html
9180 <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.
9181 </p>
9182 !! end
9183
9184 !! test
9185 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9186 !! wikitext
9187 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9188 PMID
9189 1234
9190 !! html
9191 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9192 PMID
9193 1234
9194 </p>
9195 !! end
9196
9197 ###
9198 ### Templates
9199 ####
9200
9201 !! test
9202 Nonexistent template
9203 !! wikitext
9204 {{thistemplatedoesnotexist}}
9205 !! html
9206 <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>
9207 </p>
9208 !! end
9209
9210 !! test
9211 Template with invalid target containing tags
9212 !! wikitext
9213 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9214 !! html
9215 <p>{{a<b>b</b>|foo|a=b|a = b}}
9216 </p>
9217 !! end
9218
9219 !! test
9220 Template with invalid target containing unclosed tag
9221 !! wikitext
9222 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9223 !! html
9224 <p>{{a<b>|foo|a=b|a = b}}</b>
9225 </p>
9226 !! end
9227
9228 !! test
9229 Template with invalid target containing wikilink
9230 !! wikitext
9231 {{[[Main Page]]}}
9232 !! html/php
9233 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9234 </p>
9235 !! html/parsoid
9236 <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>
9237 !! end
9238
9239 !! test
9240 Template with just whitespace in it, bug #68421
9241 !! wikitext
9242 {{echo|{{ }}}}
9243 !! html/parsoid
9244 <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>
9245 !! end
9246
9247 !! article
9248 Template:test
9249 !! text
9250 This is a test template
9251 !! endarticle
9252
9253 !! test
9254 Simple template
9255 !! wikitext
9256 {{test}}
9257 !! html
9258 <p>This is a test template
9259 </p>
9260 !! end
9261
9262 !! test
9263 Template with explicit namespace
9264 !! wikitext
9265 {{Template:test}}
9266 !! html
9267 <p>This is a test template
9268 </p>
9269 !! end
9270
9271
9272 !! article
9273 Template:paramtest
9274 !! text
9275 This is a test template with parameter {{{param}}}
9276 !! endarticle
9277
9278 !! test
9279 Template parameter
9280 !! wikitext
9281 {{paramtest|param=foo}}
9282 !! html
9283 <p>This is a test template with parameter foo
9284 </p>
9285 !! end
9286
9287 !! article
9288 Template:paramtestnum
9289 !! text
9290 [[{{{1}}}|{{{2}}}]]
9291 !! endarticle
9292
9293 !! test
9294 Template unnamed parameter
9295 !! wikitext
9296 {{paramtestnum|Main Page|the main page}}
9297 !! html
9298 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9299 </p>
9300 !! end
9301
9302 !! article
9303 Template:templatesimple
9304 !! text
9305 (test)
9306 !! endarticle
9307
9308 !! article
9309 Template:templateredirect
9310 !! text
9311 #redirect [[Template:templatesimple]]
9312 !! endarticle
9313
9314 !! article
9315 Template:templateasargtestnum
9316 !! text
9317 {{{{{1}}}}}
9318 !! endarticle
9319
9320 !! article
9321 Template:templateasargtest
9322 !! text
9323 {{template{{{templ}}}}}
9324 !! endarticle
9325
9326 !! article
9327 Template:templateasargtest2
9328 !! text
9329 {{{{{templ}}}}}
9330 !! endarticle
9331
9332 !! test
9333 Template with template name as unnamed argument
9334 !! wikitext
9335 {{templateasargtestnum|templatesimple}}
9336 !! html
9337 <p>(test)
9338 </p>
9339 !! end
9340
9341 !! test
9342 Template with template name as argument
9343 !! wikitext
9344 {{templateasargtest|templ=simple}}
9345 !! html
9346 <p>(test)
9347 </p>
9348 !! end
9349
9350 !! test
9351 Template with template name as argument (2)
9352 !! wikitext
9353 {{templateasargtest2|templ=templatesimple}}
9354 !! html
9355 <p>(test)
9356 </p>
9357 !! end
9358
9359 !! article
9360 Template:templateasargtestdefault
9361 !! text
9362 {{{{{templ|templatesimple}}}}}
9363 !! endarticle
9364
9365 !! article
9366 Template:templa
9367 !! text
9368 '''templ'''
9369 !! endarticle
9370
9371 !! test
9372 Template with default value
9373 !! wikitext
9374 {{templateasargtestdefault}}
9375 !! html
9376 <p>(test)
9377 </p>
9378 !! end
9379
9380 !! test
9381 Template with default value (value set)
9382 !! wikitext
9383 {{templateasargtestdefault|templ=templa}}
9384 !! html
9385 <p><b>templ</b>
9386 </p>
9387 !! end
9388
9389 !! test
9390 Template redirect
9391 !! wikitext
9392 {{templateredirect}}
9393 !! html
9394 <p>(test)
9395 </p>
9396 !! end
9397
9398 !! test
9399 Template with argument in separate line
9400 !! wikitext
9401 {{ templateasargtest |
9402 templ = simple }}
9403 !! html
9404 <p>(test)
9405 </p>
9406 !! end
9407
9408 !! test
9409 Template with complex template as argument
9410 !! wikitext
9411 {{paramtest|
9412 param ={{ templateasargtest |
9413 templ = simple }}}}
9414 !! html
9415 <p>This is a test template with parameter (test)
9416 </p>
9417 !! end
9418
9419 !! test
9420 Template with thumb image (with link in description)
9421 !! wikitext
9422 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9423 !! html/php
9424 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>
9425
9426 !! html+tidy
9427 <p>This is a test template with parameter</p>
9428 <div class="thumb tright">
9429 <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>
9430 <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>
9431 </div>
9432 </div>
9433 !! html/parsoid
9434 <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>
9435 !! end
9436
9437 !! article
9438 Template:complextemplate
9439 !! text
9440 {{{1}}} {{paramtest|
9441 param ={{{param}}}}}
9442 !! endarticle
9443
9444 !! test
9445 Template with complex arguments
9446 !! wikitext
9447 {{complextemplate|
9448 param ={{ templateasargtest |
9449 templ = simple }}|[[Template:complextemplate|link]]}}
9450 !! html
9451 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9452 </p>
9453 !! end
9454
9455 !! test
9456 BUG 553: link with two variables in a piped link
9457 !! wikitext
9458 {|
9459 |[[{{{1}}}|{{{2}}}]]
9460 |}
9461 !! html
9462 <table>
9463 <tr>
9464 <td>[[{{{1}}}|{{{2}}}]]
9465 </td></tr></table>
9466
9467 !! end
9468
9469 !! test
9470 Magic variable as template parameter
9471 !! wikitext
9472 {{paramtest|param={{SITENAME}}}}
9473 !! html
9474 <p>This is a test template with parameter MediaWiki
9475 </p>
9476 !! end
9477
9478 !! article
9479 Template:linktest
9480 !! text
9481 [[{{{param}}}|link]]
9482 !! endarticle
9483
9484 !! test
9485 Template parameter as link source
9486 !! wikitext
9487 {{linktest|param=Main Page}}
9488 !! html
9489 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9490 </p>
9491 !! end
9492
9493 !!article
9494 Template:paramtest2
9495 !! text
9496 including another template, {{paramtest|param={{{arg}}}}}
9497 !! endarticle
9498
9499 !! test
9500 Template passing argument to another template
9501 !! wikitext
9502 {{paramtest2|arg='hmm'}}
9503 !! html
9504 <p>including another template, This is a test template with parameter 'hmm'
9505 </p>
9506 !! end
9507
9508 !! article
9509 Template:Linktest2
9510 !! text
9511 Main Page
9512 !! endarticle
9513
9514 !! test
9515 Template as link source
9516 !! wikitext
9517 [[{{linktest2}}]]
9518
9519 [[{{linktest2}}|Main Page]]
9520
9521 [[{{linktest2}}]]Page
9522 !! html
9523 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9524 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9525 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9526 </p>
9527 !! end
9528
9529
9530 !! article
9531 Template:loop1
9532 !! text
9533 {{loop2}}
9534 !! endarticle
9535
9536 !! article
9537 Template:loop2
9538 !! text
9539 {{loop1}}
9540 !! endarticle
9541
9542 !! test
9543 Template infinite loop
9544 !! wikitext
9545 {{loop1}}
9546 !! html
9547 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9548 </p>
9549 !! end
9550
9551 !! test
9552 Template from main namespace
9553 !! wikitext
9554 {{:Main Page}}
9555 !! html
9556 <p>blah blah
9557 </p>
9558 !! end
9559
9560 !! article
9561 Template:table
9562 !! text
9563 {|
9564 | 1 || 2
9565 |-
9566 | 3 || 4
9567 |}
9568 !! endarticle
9569
9570 !! test
9571 BUG 529: Template with table, not included at beginning of line
9572 !! wikitext
9573 foo {{table}}
9574 !! html
9575 <p>foo
9576 </p>
9577 <table>
9578 <tr>
9579 <td> 1 </td>
9580 <td> 2
9581 </td></tr>
9582 <tr>
9583 <td> 3 </td>
9584 <td> 4
9585 </td></tr></table>
9586
9587 !! end
9588
9589 !! test
9590 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9591 !! wikitext
9592 foo
9593 {{table}}
9594 !! html
9595 <p>foo
9596 </p>
9597 <table>
9598 <tr>
9599 <td> 1 </td>
9600 <td> 2
9601 </td></tr>
9602 <tr>
9603 <td> 3 </td>
9604 <td> 4
9605 </td></tr></table>
9606
9607 !! end
9608
9609 !! test
9610 BUG 41: Template parameters shown as broken links
9611 !! wikitext
9612 {{{parameter}}}
9613 !! html
9614 <p>{{{parameter}}}
9615 </p>
9616 !! end
9617
9618 !! test
9619 Template with targets containing wikilinks
9620 !! wikitext
9621 {{[[foo]]}}
9622
9623 {{[[{{echo|foo}}]]}}
9624
9625 {{{{echo|[[foo}}]]}}
9626 !! html
9627 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9628 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9629 </p><p>{{[[foo}}]]
9630 </p>
9631 !! end
9632
9633 !! article
9634 Template:MSGNW test
9635 !! text
9636 ''None'' of '''this''' should be
9637 * interpreted
9638 but rather passed unmodified
9639 {{test}}
9640 <gallery>
9641 File:Foobar.jpg
9642 </gallery>
9643 !! endarticle
9644
9645 # hmm, fix this or just deprecate msgnw and document its behavior?
9646 !! test
9647 msgnw keyword
9648 !! wikitext
9649 {{msgnw:MSGNW test}}
9650 !! html
9651 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9652 &#42; interpreted
9653 &#32;but rather passed unmodified
9654 &#123;&#123;test&#125;&#125;
9655 &#60;gallery&#62;
9656 File:Foobar.jpg
9657 &#60;/gallery&#62;
9658 </p>
9659 !! end
9660
9661 !! test
9662 int keyword
9663 !! wikitext
9664 {{int:youhavenewmessages|lots of money|not!}}
9665 !! html
9666 <p>You have lots of money (not!).
9667 </p>
9668 !! end
9669
9670 !! article
9671 Template:Includes
9672 !! text
9673 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9674 !! endarticle
9675
9676 !! test
9677 <includeonly> and <noinclude> being included
9678 !! wikitext
9679 {{Includes}}
9680 !! html
9681 <p>Foobar
9682 </p>
9683 !! end
9684
9685 !! article
9686 Template:Includes2
9687 !! text
9688 <onlyinclude>Foo</onlyinclude>bar
9689 !! endarticle
9690
9691 !! test
9692 <onlyinclude> being included
9693 !! wikitext
9694 {{Includes2}}
9695 !! html
9696 <p>Foo
9697 </p>
9698 !! end
9699
9700
9701 !! article
9702 Template:Includes3
9703 !! text
9704 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9705 !! endarticle
9706
9707 !! test
9708 <onlyinclude> and <includeonly> being included
9709 !! wikitext
9710 {{Includes3}}
9711 !! html
9712 <p>Foo
9713 </p>
9714 !! end
9715
9716 !! test
9717 <includeonly> and <noinclude> on a page
9718 !! wikitext
9719 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9720 !! html
9721 <p>Foozar
9722 </p>
9723 !! end
9724
9725 !! test
9726 Un-closed <noinclude>
9727 !! wikitext
9728 <noinclude>
9729 !! html
9730 !! end
9731
9732 !! test
9733 <onlyinclude> on a page
9734 !! wikitext
9735 <onlyinclude>Foo</onlyinclude>bar
9736 !! html
9737 <p>Foobar
9738 </p>
9739 !! end
9740
9741 !! test
9742 Un-closed <onlyinclude>
9743 !! wikitext
9744 <onlyinclude>
9745 !! html
9746 !! end
9747
9748 !!test
9749 Self-closed noinclude, includeonly, onlyinclude tags
9750 !! wikitext
9751 <noinclude />
9752 <includeonly />
9753 <onlyinclude />
9754 !! html
9755 <p><br />
9756 </p>
9757 !!end
9758
9759 !!test
9760 Unbalanced includeonly and noinclude tags
9761 !! wikitext
9762 {|
9763 |a</noinclude>
9764 |b</noinclude></noinclude>
9765 |c</noinclude></includeonly>
9766 |d</includeonly></includeonly>
9767 |}
9768 !! html
9769 <table>
9770 <tr>
9771 <td>a
9772 </td>
9773 <td>b
9774 </td>
9775 <td>c&lt;/includeonly&gt;
9776 </td>
9777 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9778 </td></tr></table>
9779
9780 !!end
9781
9782 !! article
9783 Template:Includeonly section
9784 !! text
9785 <includeonly>
9786 ==Includeonly section==
9787 </includeonly>
9788 ==Section T-1==
9789 !!endarticle
9790
9791 !! test
9792 Bug 6563: Edit link generation for section shown by <includeonly>
9793 !! wikitext
9794 {{includeonly section}}
9795 !! html
9796 <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>
9797 <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>
9798
9799 !! end
9800
9801 # Uses same input as the contents of [[Template:Includeonly section]]
9802 !! test
9803 Bug 6563: Section extraction for section shown by <includeonly>
9804 !! options
9805 section=T-2
9806 !! wikitext
9807 <includeonly>
9808 ==Includeonly section==
9809 </includeonly>
9810 ==Section T-2==
9811 !! html
9812 ==Section T-2==
9813 !! end
9814
9815 !! test
9816 Bug 6563: Edit link generation for section suppressed by <includeonly>
9817 !! wikitext
9818 <includeonly>
9819 ==Includeonly section==
9820 </includeonly>
9821 ==Section 1==
9822 !! html
9823 <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>
9824
9825 !! end
9826
9827 !! test
9828 Bug 6563: Section extraction for section suppressed by <includeonly>
9829 !! options
9830 section=1
9831 !! wikitext
9832 <includeonly>
9833 ==Includeonly section==
9834 </includeonly>
9835 ==Section 1==
9836 !! html
9837 ==Section 1==
9838 !! end
9839
9840 !! test
9841 Un-closed <includeonly>
9842 !! wikitext
9843 <includeonly>
9844 !! html
9845 !! end
9846
9847 !! test
9848 Includes and comments at SOL
9849 !! wikitext
9850 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9851
9852 <noinclude>
9853 some
9854 </noinclude>* stuff
9855 * here
9856
9857 <includeonly>can have stuff</includeonly>=== here ===
9858
9859 !! html/php
9860 <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>
9861 <p>some
9862 </p>
9863 <ul><li> stuff</li>
9864 <li> here</li></ul>
9865 <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>
9866
9867 !! html/parsoid
9868 <!-- 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>
9869
9870 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9871 <p>some</p>
9872 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9873 <li> here</li></ul>
9874
9875 <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>
9876
9877 !! end
9878
9879 # TODO: test with DOM fragment reuse!
9880 !! test
9881 Parsoid: DOM fragment reuse
9882 !! options
9883 parsoid=wt2wt,wt2html
9884 !! wikitext
9885 a{{echo|b<table></table>c}}d
9886
9887 a{{echo|b
9888 <table></table>
9889 c}}d
9890
9891 {{echo|a
9892
9893 <table></table>
9894
9895 b}}
9896 !! html
9897 <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>
9898
9899 <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">
9900 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9901 </span><p about="#mwt2">cd</p>
9902
9903 <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">
9904
9905 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9906
9907 </span><p about="#mwt3">b</p>
9908 !! end
9909
9910 !! test
9911 Parsoid: Merge double tds (bug 50603)
9912 !! options
9913 parsoid
9914 !! wikitext
9915 {|
9916 |{{echo|{{!}} foo}}
9917 |}
9918 !! html
9919 <table><tbody>
9920 <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>
9921 </tbody></table>
9922 !! end
9923
9924 !! test
9925 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9926 !! options
9927 parsoid
9928 !! wikitext
9929 {{echo|<div>}}
9930 {|
9931 |{{echo|{{!}} foo}}
9932 |}
9933 {{echo|</div>}}
9934 !! html
9935 <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}}]}'>
9936 <table><tbody>
9937 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9938 </tbody></table>
9939 </div>
9940 !! end
9941
9942 ###
9943 ### <includeonly> and <noinclude> in attributes
9944 ###
9945 !!test
9946 0. includeonly around the entire attribute
9947 !! wikitext
9948 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9949 !! html
9950 <p><span id="v2">bar</span>
9951 </p>
9952 !!end
9953
9954 !!test
9955 1. includeonly in html attr key
9956 !! wikitext
9957 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9958 !! html
9959 <p><span id="foo">bar</span>
9960 </p>
9961 !!end
9962
9963 !!test
9964 2. includeonly in html attr value
9965 !! wikitext
9966 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9967 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9968 !! html
9969 <p><span id="v1">bar</span>
9970 <span id="v1">bar</span>
9971 </p>
9972 !!end
9973
9974 !!test
9975 3. includeonly in part of an attr value
9976 !! wikitext
9977 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9978 !! html
9979 <p><span style="color:red;">bar</span>
9980 </p>
9981 !!end
9982
9983 !!test
9984 4. includeonly in table attributes
9985 !! wikitext
9986 {|
9987 |- <noinclude>
9988 |-
9989 |a
9990 </noinclude>
9991 |- <includeonly>
9992 |-
9993 |b
9994 </includeonly>
9995 |}
9996 !! html
9997 <table>
9998
9999
10000 <tr>
10001 <td>a
10002 </td></tr>
10003 </table>
10004
10005 !!end
10006
10007 ###
10008 ### Token Stream Patcher tests
10009 ###
10010 ### These tests won't always pass wt2wt and other modes because
10011 ### on serialization, the table will be output on a new line.
10012 ### For now, we are blacklisting them, and using this to test selser.
10013 ###
10014
10015 !!test
10016 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10017 !!options
10018 parsoid=wt2html,wt2wt
10019 !!wikitext
10020 {{echo|}}{| width = '100%'
10021 |foo
10022 |}
10023 !!html/parsoid
10024 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10025 <tbody><tr><td>foo</td></tr>
10026 </tbody></table>
10027 !!end
10028
10029 !!test
10030 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10031 !!options
10032 parsoid=wt2html,wt2wt
10033 !!wikitext
10034 <includeonly>a</includeonly>{| {{{b}}}
10035 |c
10036 |}
10037 !!html/parsoid
10038 <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}}}":""}}'>
10039 <tbody><tr><td>c</td></tr>
10040 </tbody></table>
10041
10042 !!end
10043
10044 ###
10045 ### Testing parsing of templates where a template arg
10046 ### has the same name as the template itself.
10047 ###
10048
10049 !! article
10050 Template:quote
10051 !! text
10052 {{{quote|{{{1}}}}}}
10053 !! endarticle
10054
10055 !!test
10056 Templates: Template Name/Arg clash: 1. Use of positional param
10057 !! wikitext
10058 {{quote|foo}}
10059 !! html
10060 <p>foo
10061 </p>
10062 !!end
10063
10064 !!test
10065 Templates: Template Name/Arg clash: 2. Use of named param
10066 !! wikitext
10067 {{quote|quote=foo}}
10068 !! html
10069 <p>foo
10070 </p>
10071 !!end
10072
10073 !!test
10074 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10075 !! wikitext
10076 {{quote|quote}}
10077 !! html
10078 <p>quote
10079 </p>
10080 !!end
10081
10082 ###
10083 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10084 ###
10085
10086 !!test
10087 Templates: 1. Simple use
10088 !! wikitext
10089 {{echo|Foo}}
10090 !! html
10091 <p>Foo
10092 </p>
10093 !!end
10094
10095 !!test
10096 Templates: 2. Inside a block tag
10097 !! wikitext
10098 <div>{{echo|Foo}}</div>
10099 <blockquote>{{echo|Foo}}</blockquote>
10100 !! html
10101 <div>Foo</div>
10102 <blockquote>Foo</blockquote>
10103
10104 !! html+tidy
10105 <div>Foo</div>
10106 <blockquote>
10107 <p>Foo</p>
10108 </blockquote>
10109 !!end
10110
10111 !!test
10112 Templates: P-wrapping: 1a. Templates on consecutive lines
10113 !! wikitext
10114 {{echo|Foo}}
10115 {{echo|bar}}
10116 !! html
10117 <p>Foo
10118 bar
10119 </p>
10120 !!end
10121
10122 !!test
10123 Templates: P-wrapping: 1b. Templates on consecutive lines
10124 !! wikitext
10125 Foo
10126
10127 {{echo|bar}}
10128 {{echo|baz}}
10129 !! html
10130 <p>Foo
10131 </p><p>bar
10132 baz
10133 </p>
10134 !!end
10135
10136 !!test
10137 Templates: P-wrapping: 1c. Templates on consecutive lines
10138 !! wikitext
10139 {{echo|Foo}}
10140 {{echo|bar}} <div>baz</div>
10141 !! html
10142 <p>Foo
10143 </p>
10144 bar <div>baz</div>
10145
10146 !! html+tidy
10147 <p>Foo</p>
10148 <p>bar</p>
10149 <div>baz</div>
10150 !! end
10151
10152 !!test
10153 Templates: P-wrapping: 1d. Template preceded by comment-only line
10154 !!options
10155 parsoid
10156 !! wikitext
10157 <!-- foo -->
10158 {{echo|Bar}}
10159 !! html
10160 <!-- foo -->
10161
10162 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10163 !!end
10164
10165 !!test
10166 Templates: Inline Text: 1. Multiple template uses
10167 !! wikitext
10168 {{echo|Foo}}bar{{echo|baz}}
10169 !! html
10170 <p>Foobarbaz
10171 </p>
10172 !!end
10173
10174 !!test
10175 Templates: Inline Text: 2. Back-to-back template uses
10176 !! wikitext
10177 {{echo|Foo}}{{echo|bar}}
10178 !! html
10179 <p>Foobar
10180 </p>
10181 !!end
10182
10183 !!test
10184 Templates: Block Tags: 1. Multiple template uses
10185 !! wikitext
10186 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10187 !! html
10188 <div>Foo</div><div>bar</div><div>baz</div>
10189
10190 !!end
10191
10192 !!test
10193 Templates: Block Tags: 2. Back-to-back template uses
10194 !! wikitext
10195 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10196 !! html
10197 <div>Foo</div><div>bar</div>
10198
10199 !!end
10200
10201 # This is an edge case relating to paragraph wrapping.
10202 !!test
10203 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10204 !! wikitext
10205 {{echo|a
10206 b</p>}}
10207 !! html/parsoid
10208 <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
10209 b</p>
10210 !!end
10211
10212 !!test
10213 Templates: Links: 1. Simple example
10214 !! wikitext
10215 {{echo|[[Foo|bar]]}}
10216 !! html
10217 <p><a href="/wiki/Foo" title="Foo">bar</a>
10218 </p>
10219 !!end
10220
10221 !!test
10222 Templates: Links: 2. Generation of link href
10223 !! wikitext
10224 [[{{echo|Foo}}|bar]]
10225 !! html
10226 <p><a href="/wiki/Foo" title="Foo">bar</a>
10227 </p>
10228 !!end
10229
10230 !!test
10231 Templates: Links: 3. Generation of part of a link href
10232 !! wikitext
10233 [[Fo{{echo|o}}|bar]]
10234
10235 [[Foo{{echo|bar}}]]
10236
10237 [[Foo{{echo|bar}}baz]]
10238
10239 [[Foo{{echo|bar}}|bar]]
10240
10241 [[:Foo{{echo|bar}}]]
10242
10243 [[:Foo{{echo|bar}}|bar]]
10244 !! html
10245 <p><a href="/wiki/Foo" title="Foo">bar</a>
10246 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10247 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10248 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10249 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10250 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10251 </p>
10252 !!end
10253
10254 !!test
10255 Templates: Links: 4. Multiple templates generating link href
10256 !! wikitext
10257 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10258 !! html
10259 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10260 </p>
10261 !!end
10262
10263 !!test
10264 Templates: Links: 5. Generation of link text
10265 !! wikitext
10266 [[Foo|{{echo|bar}}]]
10267 !! html
10268 <p><a href="/wiki/Foo" title="Foo">bar</a>
10269 </p>
10270 !!end
10271
10272 !!test
10273 Templates: Links: 5. Nested templates (only outermost template should be marked)
10274 !! wikitext
10275 {{echo|[[{{echo|Foo}}|bar]]}}
10276 !! html
10277 <p><a href="/wiki/Foo" title="Foo">bar</a>
10278 </p>
10279 !!end
10280
10281 !!test
10282 Templates: HTML Tag: 1. Generation of HTML attr. key
10283 !! wikitext
10284 <div {{echo|style}}="color:red;">foo</div>
10285 !! html
10286 <div style="color:red;">foo</div>
10287
10288 !!end
10289
10290 !!test
10291 Templates: HTML Tag: 2. Generation of HTML attr. value
10292 !! wikitext
10293 <div style={{echo|'color:red;'}}>foo</div>
10294 !! html
10295 <div style="color:red;">foo</div>
10296
10297 !!end
10298
10299 !!test
10300 Templates: HTML Tag: 3. Generation of HTML attr key and value
10301 !! wikitext
10302 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10303 !! html
10304 <div style="color:red;">foo</div>
10305
10306 !!end
10307
10308 !!test
10309 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10310 !! wikitext
10311 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10312 !! html
10313 <div title="This is a long title with just one piece templated">foo</div>
10314
10315 !!end
10316
10317 !!test
10318 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10319 !! wikitext
10320 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10321 !! html
10322 <div title="This is a long title with just one piece templated">foo</div>
10323
10324 !!end
10325
10326 !!test
10327 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10328 !! wikitext
10329 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10330 !! html
10331 <div title="This is a long title with just one piece templated">foo</div>
10332
10333 !!end
10334
10335 # SSS FIXME: While it is great we added support for all this,
10336 # do we want to make this part of the spec? Maybe we want to
10337 # deprecate this kind of usage in the future?
10338 !!test
10339 Templates: HTML Tag: 7. Generation of partial attribute key string
10340 !! wikitext
10341 <div st{{echo|yle}}="color:red;">foo</div>
10342 !! html
10343 <div style="color:red;">foo</div>
10344
10345 !!end
10346
10347 !! test
10348 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10349 !! wikitext
10350 <div {{echo|1=id="v1"}}>bar</div>
10351 !! html
10352 <div id="v1">bar</div>
10353
10354 !!end
10355
10356 !! test
10357 Templates: HTML Tag: 9. Multiple template-generated attributes
10358 !! wikitext
10359 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10360 !! html
10361 <div id="v1" title="foo">bar</div>
10362
10363 !!end
10364
10365 !! test
10366 Templates: Support for templates generating attributes and content
10367 !! wikitext
10368 {| {{mixed_attr_content_template}}
10369 |-
10370 |bar
10371 |}
10372 !! html/php
10373 <table style="color:red;" title="T48811">
10374
10375 <tr>
10376 <td>foo
10377 </td></tr>
10378 <tr>
10379 <td>bar
10380 </td></tr></table>
10381
10382 !! html/parsoid
10383 <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|}"]}'>
10384 <tbody><tr>
10385 <td>foo</td></tr>
10386 <tr>
10387 <td>bar</td></tr>
10388 </tbody></table>
10389 !!end
10390
10391 !!test
10392 Templates: HTML Tables: 1. Generating start of a HTML table
10393 !! wikitext
10394 {{echo|<table><tr><td>foo</td>}}</tr></table>
10395 !! html
10396 <table><tr><td>foo</td></tr></table>
10397
10398 !!end
10399
10400 !!test
10401 Templates: HTML Tables: 2a. Generating middle of a HTML table
10402 !! wikitext
10403 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10404 !! html
10405 <table><tr><td>foo</td></tr></table>
10406
10407 !!end
10408
10409 !!test
10410 Templates: HTML Tables: 2b. Generating middle of a HTML table
10411 !! wikitext
10412 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10413 !! html
10414 <table><tr><td>foo</td></tr></table>
10415
10416 !!end
10417
10418 !!test
10419 Templates: HTML Tables: 3. Generating end of a HTML table
10420 !! wikitext
10421 <table><tr>{{echo|<td>foo</td></tr></table>}}
10422 !! html
10423 <table><tr><td>foo</td></tr></table>
10424
10425 !!end
10426
10427 !!test
10428 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10429 !! wikitext
10430 {{echo|<table>}}<tr><td>foo</td></tr></table>
10431 !! html
10432 <table><tr><td>foo</td></tr></table>
10433
10434 !!end
10435
10436 !!test
10437 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10438 !! wikitext
10439 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10440 !! html
10441 <table><tr><td>foo</td></tr></table>
10442
10443 !!end
10444
10445 !!test
10446 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10447 !! wikitext
10448 <table><tr>{{echo|<td>}}foo</td></tr></table>
10449 !! html
10450 <table><tr><td>foo</td></tr></table>
10451
10452 !!end
10453
10454 !!test
10455 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10456 !! wikitext
10457 <table><tr><td>foo{{echo|</td>}}</tr></table>
10458 !! html
10459 <table><tr><td>foo</td></tr></table>
10460
10461 !!end
10462
10463 !!test
10464 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10465 !! wikitext
10466 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10467 !! html
10468 <table><tr><td>foo</td></tr></table>
10469
10470 !!end
10471
10472 !!test
10473 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10474 !! wikitext
10475 <table><tr><td>foo</td></tr>{{echo|</table>}}
10476 !! html
10477 <table><tr><td>foo</td></tr></table>
10478
10479 !!end
10480
10481 !!test
10482 Templates: HTML Tables: 5. Proper fostering of categories from inside
10483 !!options
10484 parsoid=wt2html,wt2wt
10485 !! wikitext
10486 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10487 <!--Two categories (Bug 50330)-->
10488 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10489 !! html
10490 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10491 <!--Two categories (Bug 50330)-->
10492 <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>
10493 !!end
10494
10495 !!test
10496 Templates: Wiki Tables: 1a. Fostering of entire template content
10497 !! wikitext
10498 {|
10499 {{echo|a}}
10500 |}
10501 !! html
10502 <table>
10503 a
10504 <tr><td></td></tr></table>
10505
10506 !! html+tidy
10507 <p>a</p>
10508 <table>
10509 <tr>
10510 <td></td>
10511 </tr>
10512 </table>
10513 !! end
10514
10515 !!test
10516 Templates: Wiki Tables: 1b. Fostering of entire template content
10517 !! wikitext
10518 {|
10519 {{echo|<div>}}
10520 foo
10521 {{echo|</div>}}
10522 |}
10523 !! html
10524 <table>
10525 <div>
10526 <p>foo
10527 </p>
10528 </div>
10529 <tr><td></td></tr></table>
10530
10531 !! html+tidy
10532 <div>
10533 <p>foo</p>
10534 </div>
10535 <table>
10536 <tr>
10537 <td></td>
10538 </tr>
10539 </table>
10540 !! end
10541
10542 !!test
10543 Templates: Wiki Tables: 2. Fostering of partial template content
10544 !! wikitext
10545 {|
10546 {{echo|a
10547 <div>b</div>}}
10548 |}
10549 !! html
10550 <table>
10551 a
10552 <div>b</div>
10553 <tr><td></td></tr></table>
10554
10555 !! html+tidy
10556 <p>a</p>
10557 <div>b</div>
10558 <table>
10559 <tr>
10560 <td></td>
10561 </tr>
10562 </table>
10563 !! end
10564
10565 !!test
10566 Templates: Wiki Tables: 3. td-content via multiple templates
10567 !! wikitext
10568 {|
10569 {{echo|{{pipe}}a}}{{echo|b}}
10570 |}
10571 !! html
10572 <table>
10573 <tr>
10574 <td>ab
10575 </td></tr></table>
10576
10577 !!end
10578
10579 !!test
10580 Templates: Wiki Tables: 4. Templated tags, no content
10581 !! wikitext
10582 {{tbl-start}}
10583 {{tbl-end}}
10584 !! html
10585 <table>
10586 <tr><td></td></tr></table>
10587
10588 !!end
10589
10590 !!test
10591 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10592 !! wikitext
10593 {{tbl-start}}
10594 |foo
10595 {{tbl-end}}
10596 !! html
10597 <table>
10598 <tr>
10599 <td>foo
10600 </td></tr></table>
10601
10602 !!end
10603
10604 !!test
10605 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10606 !! wikitext
10607 {{tbl-start}}
10608 {{!}}foo
10609 {{tbl-end}}
10610 !! html
10611 <table>
10612 <tr>
10613 <td>foo
10614 </td></tr></table>
10615
10616 !!end
10617
10618 !!test
10619 Templates: Lists: Multi-line list-items via templates
10620 !! wikitext
10621 *{{echo|a {{nonexistent|
10622 unused}}}}
10623 *{{echo|b {{nonexistent|
10624 unused}}}}
10625 !! html
10626 <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>
10627 <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>
10628
10629 !!end
10630
10631 !!test
10632 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10633 !! wikitext
10634 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10635 !! html
10636 <p><i>ab</i>c<i>d</i>e
10637 </p>
10638 !!end
10639
10640 !!test
10641 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10642 (PHP parser generates misnested html)
10643 !! wikitext
10644 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10645 !! html/parsoid
10646 <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>
10647 !!end
10648
10649 !!test
10650 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10651 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10652 !! options
10653 parsoid=wt2html,wt2wt
10654 !! wikitext
10655 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10656 !! html
10657 <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>
10658 <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>
10659 <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>
10660 !!end
10661
10662 !!test
10663 Templates: Ugly nesting: 4. Divs opened/closed across templates
10664 !! wikitext
10665 a<div>b{{echo|c</div>d}}e
10666 !! html
10667 a<div>bc</div>de
10668
10669 !! html+tidy
10670 <p>a</p>
10671 <div>bc</div>
10672 <p>de</p>
10673 !! end
10674
10675 !!test
10676 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10677 (Parsoid-centric)
10678 !! options
10679 parsoid
10680 !! wikitext
10681 {|
10682 |{{echo|foo</table>}}
10683 |bar
10684 |}
10685 !! html
10686 <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|}"]}'>
10687
10688 <tbody>
10689 <tr>
10690 <td>foo</td></tr></tbody></table><span about="#mwt1">
10691 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10692 |}</span>
10693 !!end
10694
10695 !!test
10696 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10697 (Parsoid-centric)
10698 !! options
10699 parsoid
10700 !! wikitext
10701 <table>
10702 <tr>
10703 <td>
10704 <table>
10705 <tr>
10706 <td>1. {{echo|foo </table>}}</td>
10707 <td> bar </td>
10708 <td>2. {{echo|baz </table>}}</td>
10709 </tr>
10710 <tr>
10711 <td>abc</td>
10712 </tr>
10713 </table>
10714 </td>
10715 </tr>
10716 <tr>
10717 <td>xyz</td>
10718 </tr>
10719 </table>
10720 !! html
10721 <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>"]}'>
10722 <tbody><tr>
10723 <td>
10724 <table>
10725 <tbody><tr>
10726 <td>1. foo </td></tr></tbody></table></td>
10727 <td> bar </td>
10728 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10729 </span><span about="#mwt2">
10730 </span><span about="#mwt2">
10731 </span><span about="#mwt2">abc</span><span about="#mwt2">
10732 </span><span about="#mwt2">
10733 </span><span about="#mwt2">
10734 </span><span about="#mwt2">
10735 </span><span about="#mwt2">
10736 </span><span about="#mwt2">
10737 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10738 </span><span about="#mwt2">
10739 </span>
10740 !!end
10741
10742 !! test
10743 Templates: Ugly templates: 3. newline-only template parameter
10744 !! wikitext
10745 foo {{echo|
10746 }}
10747 !! html
10748 <p>foo
10749 </p>
10750 !! end
10751
10752 # This looks like a bug: a single newline triggers p/br for some reason.
10753 !! test
10754 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10755 !! wikitext
10756 {{echo|
10757 }}
10758 !! html
10759 <p><br />
10760 </p>
10761 !! end
10762
10763 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10764 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10765 !! test
10766 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10767 !! wikitext
10768 {{echo|<table>}}
10769 {{echo|<div>foo}}
10770 {{echo|</table>}}
10771 !! html/parsoid
10772 <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
10773 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10774 </table>
10775 !! end
10776
10777 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10778 # that are "identical" and generate nesting cycles in the algorithm
10779 !! test
10780 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10781 !! wikitext
10782 {{echo|<table><tr><td><table>}}
10783 {{echo|<div>}}
10784 {{echo|</div>}}
10785 !! html/parsoid
10786 <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"}'>
10787 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10788 </table></td></tr></tbody></table>
10789 !! end
10790
10791 !!test
10792 Parser Functions: 1. Simple example
10793 !! wikitext
10794 {{uc:foo}}
10795 !! html
10796 <p>FOO
10797 </p>
10798 !!end
10799
10800 !!test
10801 Parser Functions: 2. Nested use (only outermost should be marked up)
10802 !! wikitext
10803 {{uc:{{lc:FOO}}}}
10804 !! html
10805 <p>FOO
10806 </p>
10807 !!end
10808
10809 ###
10810 ### Pre-save transform tests
10811 ###
10812 !! test
10813 pre-save transform: subst:
10814 !! options
10815 PST
10816 !! wikitext
10817 {{subst:test}}
10818 !! html
10819 This is a test template
10820 !! end
10821
10822 !! test
10823 pre-save transform: normal template
10824 !! options
10825 PST
10826 !! wikitext
10827 {{test}}
10828 !! html
10829 {{test}}
10830 !! end
10831
10832 !! test
10833 pre-save transform: nonexistent template
10834 !! options
10835 PST
10836 !! wikitext
10837 {{thistemplatedoesnotexist}}
10838 !! html
10839 {{thistemplatedoesnotexist}}
10840 !! end
10841
10842
10843 !! test
10844 pre-save transform: subst magic variables
10845 !! options
10846 PST
10847 !! wikitext
10848 {{subst:SITENAME}}
10849 !! html
10850 MediaWiki
10851 !! end
10852
10853 # This is bug 89, which I fixed. -- wtm
10854 !! test
10855 pre-save transform: subst: templates with parameters
10856 !! options
10857 pst
10858 !! wikitext
10859 {{subst:paramtest|param="something else"}}
10860 !! html
10861 This is a test template with parameter "something else"
10862 !! end
10863
10864 !! article
10865 Template:nowikitest
10866 !! text
10867 <nowiki>'''not wiki'''</nowiki>
10868 !! endarticle
10869
10870 !! test
10871 pre-save transform: nowiki in subst (bug 1188)
10872 !! options
10873 pst
10874 !! wikitext
10875 {{subst:nowikitest}}
10876 !! html
10877 <nowiki>'''not wiki'''</nowiki>
10878 !! end
10879
10880
10881 !! article
10882 Template:commenttest
10883 !! text
10884 This template has <!-- a comment --> in it.
10885 !! endarticle
10886
10887 !! test
10888 pre-save transform: comment in subst (bug 1936)
10889 !! options
10890 pst
10891 !! wikitext
10892 {{subst:commenttest}}
10893 !! html
10894 This template has <!-- a comment --> in it.
10895 !! end
10896
10897 !! test
10898 pre-save transform: unclosed tag
10899 !! options
10900 pst noxml
10901 !! wikitext
10902 <nowiki>'''not wiki'''
10903 !! html
10904 <nowiki>'''not wiki'''
10905 !! end
10906
10907 !! test
10908 pre-save transform: mixed tag case
10909 !! options
10910 pst noxml
10911 !! wikitext
10912 <NOwiki>'''not wiki'''</noWIKI>
10913 !! html
10914 <NOwiki>'''not wiki'''</noWIKI>
10915 !! end
10916
10917 !! test
10918 pre-save transform: unclosed comment in <nowiki>
10919 !! options
10920 pst noxml
10921 !! wikitext
10922 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10923 !! html
10924 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10925 !!end
10926
10927 # Leading @ in this template definition works around a limitation
10928 # in parsoid's parserTests which otherwise strips the <span> from the
10929 # result (confusing it for a template wrapper)
10930 !! article
10931 Template:dangerous
10932 !!text
10933 @<span onmouseover="alert('crap')">Oh no</span>
10934 !!endarticle
10935
10936 !!test
10937 (confirming safety of fix for subst bug 1936)
10938 !! wikitext
10939 {{Template:dangerous}}
10940 !! html
10941 <p>@<span>Oh no</span>
10942 </p>
10943 !! end
10944
10945 !! test
10946 pre-save transform: comment containing gallery (bug 5024)
10947 !! options
10948 pst
10949 !! wikitext
10950 <!-- <gallery>data</gallery> -->
10951 !! html
10952 <!-- <gallery>data</gallery> -->
10953 !!end
10954
10955 !! test
10956 pre-save transform: comment containing extension
10957 !! options
10958 pst
10959 !! wikitext
10960 <!-- <tag>data</tag> -->
10961 !! html
10962 <!-- <tag>data</tag> -->
10963 !!end
10964
10965 !! test
10966 pre-save transform: comment containing nowiki
10967 !! options
10968 pst
10969 !! wikitext
10970 <!-- <nowiki>data</nowiki> -->
10971 !! html
10972 <!-- <nowiki>data</nowiki> -->
10973 !!end
10974
10975 !! test
10976 pre-save transform: <noinclude> in subst (bug 3298)
10977 !! options
10978 pst
10979 !! wikitext
10980 {{subst:Includes}}
10981 !! html
10982 Foobar
10983 !! end
10984
10985 !! test
10986 pre-save transform: <onlyinclude> in subst (bug 3298)
10987 !! options
10988 pst
10989 !! wikitext
10990 {{subst:Includes2}}
10991 !! html
10992 Foo
10993 !! end
10994
10995 !! article
10996 Template:SubstTest
10997 !!text
10998 {{<includeonly>subst:</includeonly>Includes}}
10999 !! endarticle
11000
11001 !! article
11002 Template:SafeSubstTest
11003 !! text
11004 {{<includeonly>safesubst:</includeonly>Includes}}
11005 !! endarticle
11006
11007 !! test
11008 bug 22297: safesubst: works during PST
11009 !! options
11010 pst
11011 !! wikitext
11012 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11013 !! html
11014 FoobarFoobar
11015 !! end
11016
11017 !! test
11018 bug 22297: safesubst: works during normal parse
11019 !! wikitext
11020 {{SafeSubstTest}}
11021 !! html
11022 <p>Foobar
11023 </p>
11024 !! end
11025
11026 !! test
11027 subst: does not work during normal parse
11028 !! wikitext
11029 {{SubstTest}}
11030 !! html
11031 <p>{{subst:Includes}}
11032 </p>
11033 !! end
11034
11035 !! test
11036 pre-save transform: context links ("pipe trick")
11037 !! options
11038 pst
11039 !! wikitext
11040 [[Article (context)|]]
11041 [[Bar:Article|]]
11042 [[:Bar:Article|]]
11043 [[Bar:Article (context)|]]
11044 [[:Bar:Article (context)|]]
11045 [[|Article]]
11046 [[|Article (context)]]
11047 [[Bar:X (Y) Z|]]
11048 [[:Bar:X (Y) Z|]]
11049 !! html
11050 [[Article (context)|Article]]
11051 [[Bar:Article|Article]]
11052 [[:Bar:Article|Article]]
11053 [[Bar:Article (context)|Article]]
11054 [[:Bar:Article (context)|Article]]
11055 [[Article]]
11056 [[Article (context)]]
11057 [[Bar:X (Y) Z|X (Y) Z]]
11058 [[:Bar:X (Y) Z|X (Y) Z]]
11059 !! end
11060
11061 !! test
11062 pre-save transform: context links ("pipe trick") with interwiki prefix
11063 !! options
11064 pst
11065 !! wikitext
11066 [[interwiki:Article|]]
11067 [[:interwiki:Article|]]
11068 [[interwiki:Bar:Article|]]
11069 [[:interwiki:Bar:Article|]]
11070 !! html
11071 [[interwiki:Article|Article]]
11072 [[:interwiki:Article|Article]]
11073 [[interwiki:Bar:Article|Bar:Article]]
11074 [[:interwiki:Bar:Article|Bar:Article]]
11075 !! end
11076
11077 !! test
11078 pre-save transform: context links ("pipe trick") with parens in title
11079 !! options
11080 pst title=[[Somearticle (context)]]
11081 !! wikitext
11082 [[|Article]]
11083 !! html
11084 [[Article (context)|Article]]
11085 !! end
11086
11087 !! test
11088 pre-save transform: context links ("pipe trick") with comma in title
11089 !! options
11090 pst title=[[Someplace, Somewhere]]
11091 !! wikitext
11092 [[|Otherplace]]
11093 [[Otherplace, Elsewhere|]]
11094 [[Otherplace, Elsewhere, Anywhere|]]
11095 !! html
11096 [[Otherplace, Somewhere|Otherplace]]
11097 [[Otherplace, Elsewhere|Otherplace]]
11098 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11099 !! end
11100
11101 !! test
11102 pre-save transform: context links ("pipe trick") with parens and comma
11103 !! options
11104 pst title=[[Someplace (IGNORED), Somewhere]]
11105 !! wikitext
11106 [[|Otherplace]]
11107 [[Otherplace (place), Elsewhere|]]
11108 !! html
11109 [[Otherplace, Somewhere|Otherplace]]
11110 [[Otherplace (place), Elsewhere|Otherplace]]
11111 !! end
11112
11113 !! test
11114 pre-save transform: context links ("pipe trick") with comma and parens
11115 !! options
11116 pst title=[[Who, me? (context)]]
11117 !! wikitext
11118 [[|Yes, you.]]
11119 [[Me, Myself, and I (1937 song)|]]
11120 !! html
11121 [[Yes, you. (context)|Yes, you.]]
11122 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11123 !! end
11124
11125 !! test
11126 pre-save transform: context links ("pipe trick") with namespace
11127 !! options
11128 pst title=[[Ns:Somearticle]]
11129 !! wikitext
11130 [[|Article]]
11131 !! html
11132 [[Ns:Article|Article]]
11133 !! end
11134
11135 !! test
11136 pre-save transform: context links ("pipe trick") with namespace and parens
11137 !! options
11138 pst title=[[Ns:Somearticle (context)]]
11139 !! wikitext
11140 [[|Article]]
11141 !! html
11142 [[Ns:Article (context)|Article]]
11143 !! end
11144
11145 !! test
11146 pre-save transform: context links ("pipe trick") with namespace and comma
11147 !! options
11148 pst title=[[Ns:Somearticle, Context, Whatever]]
11149 !! wikitext
11150 [[|Article]]
11151 !! html
11152 [[Ns:Article, Context, Whatever|Article]]
11153 !! end
11154
11155 !! test
11156 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11157 !! options
11158 pst title=[[Ns:Somearticle, Context (context)]]
11159 !! wikitext
11160 [[|Article]]
11161 !! html
11162 [[Ns:Article (context)|Article]]
11163 !! end
11164
11165 !! test
11166 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11167 !! options
11168 pst title=[[Ns:Somearticle (IGNORED), Context]]
11169 !! wikitext
11170 [[|Article]]
11171 !! html
11172 [[Ns:Article, Context|Article]]
11173 !! end
11174
11175 !! test
11176 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11177 !! options
11178 pst
11179 !! wikitext
11180 [[Article(context)|]]
11181 [[Bar:Article(context)|]]
11182 [[:Bar:Article(context)|]]
11183 [[|Article(context)]]
11184 [[Bar:X(Y)Z|]]
11185 [[:Bar:X(Y)Z|]]
11186 !! html
11187 [[Article(context)|Article]]
11188 [[Bar:Article(context)|Article]]
11189 [[:Bar:Article(context)|Article]]
11190 [[Article(context)]]
11191 [[Bar:X(Y)Z|X(Y)Z]]
11192 [[:Bar:X(Y)Z|X(Y)Z]]
11193 !! end
11194
11195 !! test
11196 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11197 !! options
11198 pst
11199 !! wikitext
11200 [[Article (context)|]]
11201 [[Bar:Article (context)|]]
11202 [[:Bar:Article (context)|]]
11203 [[|Article (context)]]
11204 [[Bar:X (Y) Z|]]
11205 [[:Bar:X (Y) Z|]]
11206 !! html
11207 [[Article (context)|Article]]
11208 [[Bar:Article (context)|Article]]
11209 [[:Bar:Article (context)|Article]]
11210 [[Article (context)]]
11211 [[Bar:X (Y) Z|X (Y) Z]]
11212 [[:Bar:X (Y) Z|X (Y) Z]]
11213 !! end
11214
11215 !! test
11216 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11217 !! options
11218 pst
11219 !! wikitext
11220 [[Article(context)|]]
11221 [[Bar:Article(context)|]]
11222 [[:Bar:Article(context)|]]
11223 [[|Article(context)]]
11224 [[Bar:X(Y)Z|]]
11225 [[:Bar:X(Y)Z|]]
11226 !! html
11227 [[Article(context)|Article]]
11228 [[Bar:Article(context)|Article]]
11229 [[:Bar:Article(context)|Article]]
11230 [[Article(context)]]
11231 [[Bar:X(Y)Z|X(Y)Z]]
11232 [[:Bar:X(Y)Z|X(Y)Z]]
11233 !! end
11234
11235 !! test
11236 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11237 !! options
11238 pst
11239 !! wikitext
11240 [[Article (context), context|]]
11241 [[Article (context),context|]]
11242 [[Bar:Article (context), context|]]
11243 [[Bar:Article (context),context|]]
11244 [[:Bar:Article (context), context|]]
11245 [[:Bar:Article (context),context|]]
11246 !! html
11247 [[Article (context), context|Article]]
11248 [[Article (context),context|Article]]
11249 [[Bar:Article (context), context|Article]]
11250 [[Bar:Article (context),context|Article]]
11251 [[:Bar:Article (context), context|Article]]
11252 [[:Bar:Article (context),context|Article]]
11253 !! end
11254
11255 !! test
11256 pre-save transform: trim trailing empty lines
11257 !! options
11258 pst
11259 !! wikitext
11260 Empty lines are trimmed
11261
11262
11263
11264
11265 !! html
11266 Empty lines are trimmed
11267 !! end
11268
11269 !! test
11270 pre-save transform: Signature expansion
11271 !! options
11272 pst
11273 !! wikitext
11274 * ~~~
11275 * <noinclude>~~~</noinclude>
11276 * <includeonly>~~~</includeonly>
11277 * <onlyinclude>~~~</onlyinclude>
11278 !! html
11279 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11280 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11281 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11282 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11283 !! end
11284
11285
11286 !! test
11287 pre-save transform: Signature expansion in nowiki tags (bug 93)
11288 !! options
11289 pst disabled
11290 !! wikitext
11291 Shall not expand:
11292
11293 <nowiki>~~~~</nowiki>
11294
11295 <includeonly><nowiki>~~~~</nowiki></includeonly>
11296
11297 <noinclude><nowiki>~~~~</nowiki></noinclude>
11298
11299 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11300
11301 {{subst:Foo}} shall be converted to FOO
11302
11303 As well as inside noinclude/onlyinclude
11304 <noinclude>{{subst:Foo}}</noinclude>
11305 <onlyinclude>{{subst:Foo}}</onlyinclude>
11306
11307 But not inside includeonly
11308 <includeonly>{{subst:Foo}}</includeonly>
11309 !! html
11310 Shall not expand:
11311
11312 <nowiki>~~~~</nowiki>
11313
11314 <includeonly><nowiki>~~~~</nowiki></includeonly>
11315
11316 <noinclude><nowiki>~~~~</nowiki></noinclude>
11317
11318 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11319
11320 FOO shall be converted to FOO
11321
11322 As well as inside noinclude/onlyinclude
11323 <noinclude>FOO</noinclude>
11324 <onlyinclude>FOO</onlyinclude>
11325
11326 But not inside includeonly
11327 <includeonly>{{subst:Foo}}</includeonly>
11328 !! end
11329
11330 !! test
11331 Parsoid: Recognize nowiki with trailing space in tags
11332 !! options
11333 parsoid=wt2html
11334 !! wikitext
11335 <nowiki ><div>[[foo]]</nowiki >
11336
11337 a<nowiki / >b
11338
11339 c<nowiki />d
11340
11341 e<nowiki/ >f
11342 !! html
11343 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11344 <p>ab</p>
11345 <p>cd</p>
11346 <p>ef</p>
11347 !! end
11348
11349 !! test
11350 Parsoid: Recognize nowiki with odd capitalization
11351 !! options
11352 parsoid=wt2html
11353 !! wikitext
11354 <noWikI ><div>[[foo]]</Nowiki >
11355 !! html
11356 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11357 !! end
11358
11359
11360 !! test
11361 Parsoid: Escape nowiki with trailing space in tags
11362 !! options
11363 parsoid=html2wt
11364 !! html
11365 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11366 <p>a&lt;nowiki /&gt;b</p>
11367 <p>c&lt;nowiki/ &gt;d</p>
11368 !! wikitext
11369 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11370
11371 a&lt;nowiki /&gt;b
11372
11373 c&lt;nowiki/ &gt;d
11374 !! end
11375
11376 !! test
11377 Parsoid: Escape weird noWikI capitalizations
11378 !! options
11379 parsoid=html2wt
11380 !! html
11381 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11382 !! wikitext
11383 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11384 !! end
11385
11386 ###
11387 ### Message transform tests
11388 ###
11389 !! test
11390 message transform: magic variables
11391 !! options
11392 msg
11393 !! wikitext
11394 {{SITENAME}}
11395 !! html
11396 MediaWiki
11397 !! end
11398
11399 !! test
11400 message transform: should not transform wiki markup
11401 !! options
11402 msg
11403 !! wikitext
11404 ''test''
11405 !! html
11406 ''test''
11407 !! end
11408
11409 !! test
11410 message transform: <noinclude> in transcluded template (bug 4926)
11411 !! options
11412 msg
11413 !! wikitext
11414 {{Includes}}
11415 !! html
11416 Foobar
11417 !! end
11418
11419 !! test
11420 message transform: <onlyinclude> in transcluded template (bug 4926)
11421 !! options
11422 msg
11423 !! wikitext
11424 {{Includes2}}
11425 !! html
11426 Foo
11427 !! end
11428
11429 !! test
11430 {{#special:}} page name, known
11431 !! options
11432 msg
11433 !! wikitext
11434 {{#special:Recentchanges}}
11435 !! html
11436 Special:RecentChanges
11437 !! end
11438
11439 !! test
11440 {{#special:}} page name with subpage, known
11441 !! options
11442 msg
11443 !! wikitext
11444 {{#special:Recentchanges/param}}
11445 !! html
11446 Special:RecentChanges/param
11447 !! end
11448
11449 !! test
11450 {{#special:}} page name, unknown
11451 !! options
11452 msg
11453 !! wikitext
11454 {{#special:foobar nonexistent}}
11455 !! html
11456 Special:Foobar nonexistent
11457 !! end
11458
11459 !! test
11460 {{#speciale:}} page name, known
11461 !! options
11462 msg
11463 !! wikitext
11464 {{#speciale:Recentchanges}}
11465 !! html
11466 Special:RecentChanges
11467 !! end
11468
11469 !! test
11470 {{#speciale:}} page name with subpage, known
11471 !! options
11472 msg
11473 !! wikitext
11474 {{#speciale:Recentchanges/param}}
11475 !! html
11476 Special:RecentChanges/param
11477 !! end
11478
11479 !! test
11480 {{#speciale:}} page name, unknown
11481 !! options
11482 msg
11483 !! wikitext
11484 {{#speciale:foobar nonexistent}}
11485 !! html
11486 Special:Foobar_nonexistent
11487 !! end
11488
11489 ###
11490 ### Images
11491 ###
11492 ### For Parsoid-specific tests, see
11493 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11494
11495 !! test
11496 Simple image
11497 !! options
11498 parsoid=wt2html,wt2wt,html2html
11499 !! wikitext
11500 [[Image:foobar.jpg]]
11501 !! html/php
11502 <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>
11503 </p>
11504 !! html/parsoid
11505 <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>
11506 !! end
11507
11508 !! test
11509 Simple image (using File: namespace, now canonical)
11510 !! wikitext
11511 [[File:Foobar.jpg]]
11512 !! html/php
11513 <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>
11514 </p>
11515 !! html/parsoid
11516 <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>
11517 !! end
11518
11519 !! test
11520 Right-aligned image
11521 !! wikitext
11522 [[File:Foobar.jpg|right]]
11523 !! html/php
11524 <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>
11525
11526 !! html/parsoid
11527 <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>
11528 !! end
11529
11530 !! test
11531 Image with caption
11532 !! wikitext
11533 [[File:Foobar.jpg|right|Caption text]]
11534 !! html/php
11535 <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>
11536
11537 !! html/parsoid
11538 <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>
11539 !! end
11540
11541 !! test
11542 Image with caption, bug 53312 #1
11543 !! wikitext
11544 [[File:Foobar.jpg|right|Caption page stuff]]
11545 !! html/php
11546 <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>
11547
11548 !! html/parsoid
11549 <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>
11550 !! end
11551
11552 !! test
11553 Image with caption, bug 53312 #2
11554 !! wikitext
11555 [[File:Foobar.jpg|right|Caption page=]]
11556 !! html/php
11557 <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>
11558
11559 !! html/parsoid
11560 <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>
11561 !! end
11562
11563 !! test
11564 Image with caption, bug 53312 #3
11565 !! wikitext
11566 [[File:Foobar.jpg|right|Caption page=stuff]]
11567 !! html/php
11568 <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>
11569
11570 !! html/parsoid
11571 <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>
11572 !! end
11573
11574 !! test
11575 Allow empty links in image captions (Bug 60753)
11576 !! options
11577 thumbsize=220
11578 !! wikitext
11579 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11580 [[]]
11581 [[Link2]]
11582 ]]
11583 !! html/php
11584 <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>
11585
11586 !! html/parsoid
11587 <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>
11588 [[]]
11589 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11590 </figcaption></figure>
11591 !! end
11592
11593 !! test
11594 Titles in unlinked images (T23454)
11595 !! wikitext
11596 [[File:Foobar.jpg|link=|stuff]]
11597 !! html/php
11598 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11599 </p>
11600 !! end
11601
11602 !! test
11603 Link with empty target
11604 !! wikitext
11605 [[]]
11606 !! html
11607 <p>[[]]
11608 </p>
11609 !! end
11610
11611 !! test
11612 Image with link trail
11613 !! wikitext
11614 Linktrails should not work for images: [[File:Foobar.jpg]]s
11615 !! html/php
11616 <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
11617 </p>
11618 !! html/parsoid
11619 <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>
11620 !! end
11621
11622 !! test
11623 Image with empty attribute
11624 !! options
11625 parsoid=wt2html,wt2wt,html2html
11626 !! wikitext
11627 [[File:Foobar.jpg|right||Caption text]]
11628 !! html/php
11629 <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>
11630
11631 !! html/parsoid
11632 <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>
11633 !! end
11634
11635 !! test
11636 1. Block image with individual attributes from templates
11637 !! wikitext
11638 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11639 !! html/php
11640 <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>
11641
11642 !! html/parsoid
11643 <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>
11644 !! end
11645
11646 !! test
11647 2. Block Image with individual attributes from templates
11648 !! wikitext
11649 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11650 !! html/php
11651 <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>
11652
11653 !! html/parsoid
11654 <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>
11655 !! end
11656
11657 !! test
11658 3. Inline image with individual attributes from templates
11659 !! wikitext
11660 [[File:Foobar.jpg|{{echo|50px}}]]
11661 !! html/php
11662 <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>
11663 </p>
11664 !! html/parsoid
11665 <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>
11666 !! end
11667
11668 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11669 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11670 !! test
11671 Image with multiple attributes from the same template
11672 !! wikitext
11673 [[File:Foobar.jpg|{{image_attribs}}]]
11674 !! html/php
11675 <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>
11676
11677 !! html/parsoid
11678 <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>
11679 !! end
11680
11681 !! test
11682 Image with link tails
11683 !! options
11684 thumbsize=220
11685 !! wikitext
11686 123[[File:Foobar.jpg]]456
11687 123[[File:Foobar.jpg|right]]456
11688 123[[File:Foobar.jpg|thumb]]456
11689 !! html/php
11690 <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
11691 </p>
11692 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
11693 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
11694
11695 !! html/php+tidy
11696 <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>
11697 <p>123</p>
11698 <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>
11699 <p>456 123</p>
11700 <div class="thumb tright">
11701 <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>
11702 <div class="thumbcaption">
11703 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11704 </div>
11705 </div>
11706 </div>
11707 <p>456</p>
11708 !! html/parsoid
11709 <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>
11710 <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>
11711 <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>
11712 !! end
11713
11714 !! test
11715 Image with multiple captions -- only last one is accepted
11716 !! wikitext
11717 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11718 !! html/php
11719 <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>
11720
11721 !! html/parsoid
11722 <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>
11723 !! end
11724
11725 !! test
11726 Image with multiple widths -- use last
11727 !! wikitext
11728 [[File:Foobar.jpg|200px|300px|caption]]
11729 !! html/php
11730 <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>
11731 </p>
11732 !! html/parsoid
11733 <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>
11734 !! end
11735
11736 !! test
11737 Image with multiple alignments -- use first (bug 48664)
11738 !! options
11739 thumbsize=220
11740 !! wikitext
11741 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11742
11743 [[File:Foobar.jpg|middle|text-top|caption]]
11744 !! html/php
11745 <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>
11746 <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>
11747 </p>
11748 !! html/parsoid
11749 <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>
11750 <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>
11751 !! end
11752
11753 !! test
11754 Image with width attribute at different positions
11755 !! wikitext
11756 [[File:Foobar.jpg|200px|right|Caption]]
11757 [[File:Foobar.jpg|right|200px|Caption]]
11758 [[File:Foobar.jpg|right|Caption|200px]]
11759 !! html/php
11760 <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>
11761 <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>
11762 <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>
11763
11764 !! html/parsoid
11765 <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>
11766 <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>
11767 <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>
11768 !! end
11769
11770 # a sad bit of backward-compatibility
11771 !! test
11772 Image with size specified with pxpx (bug 13500, 51628)
11773 !! options
11774 parsoid=wt2html,wt2wt,html2html
11775 !! wikitext
11776 [[File:Foobar.jpg|20pxpx]]
11777 [[File:Foobar.jpg|200x20pxpx]]
11778 !! html/php
11779 <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>
11780 <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>
11781 </p>
11782 !! html/parsoid
11783 <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>
11784 !! end
11785
11786 !! test
11787 Image with link parameter, wiki target
11788 !! wikitext
11789 [[File:Foobar.jpg|link=Main Page]]
11790 !! html/php
11791 <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>
11792 </p>
11793 !! html/parsoid
11794 <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>
11795 !! end
11796
11797 # parsoid bug 49293 (part 1)
11798 !! test
11799 Image with link parameter, URL target
11800 !! wikitext
11801 [[File:Foobar.jpg|link=http://example.com/]]
11802 !! html/php
11803 <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>
11804 </p>
11805 !! html/parsoid
11806 <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>
11807 !! end
11808
11809 # parsoid bug 49293 (part 2)
11810 !! test
11811 Image with link parameter, protocol-less URL target
11812 !! wikitext
11813 [[File:Foobar.jpg|link=//example.com/]]
11814 !! html/php
11815 <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>
11816 </p>
11817 !! html/parsoid
11818 <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>
11819 !! end
11820
11821 !! test
11822 Image with link parameter, wgExternalLinkTarget
11823 !! wikitext
11824 [[Image:foobar.jpg|link=http://example.com/]]
11825 !! config
11826 wgExternalLinkTarget='foobar'
11827 !! html
11828 <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>
11829 </p>
11830 !! end
11831
11832 !! test
11833 Image with link parameter, wgNoFollowLinks set to false
11834 !! wikitext
11835 [[Image:foobar.jpg|link=http://example.com/]]
11836 !! config
11837 wgNoFollowLinks=false
11838 !! html
11839 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11840 </p>
11841 !! end
11842
11843 !! test
11844 Image with link parameter, wgNoFollowDomainExceptions
11845 !! wikitext
11846 [[Image:foobar.jpg|link=http://example.com/]]
11847 !! config
11848 wgNoFollowDomainExceptions='example.com'
11849 !! html
11850 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11851 </p>
11852 !! end
11853
11854 !! test
11855 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11856 !! wikitext
11857 [[Image:foobar.jpg|link=http://example.com/|Title]]
11858 !! config
11859 wgExternalLinkTarget='foobar'
11860 !! html
11861 <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>
11862 </p>
11863 !! end
11864
11865 !! test
11866 Image with empty link parameter
11867 !! wikitext
11868 [[File:Foobar.jpg|link=]]
11869 !! html/php
11870 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11871 </p>
11872 !! html/parsoid
11873 <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>
11874 !! end
11875
11876 !! test
11877 Image with link parameter (wiki target) and unnamed parameter
11878 !! wikitext
11879 [[File:Foobar.jpg|link=Main_Page|Title]]
11880 !! html/php
11881 <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>
11882 </p>
11883 !! html/parsoid
11884 <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>
11885 !! end
11886
11887 !! test
11888 Image with link parameter (URL target) and unnamed parameter
11889 !! wikitext
11890 [[File:Foobar.jpg|link=http://example.com/|Title]]
11891 !! html/php
11892 <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>
11893 </p>
11894 !! html/parsoid
11895 <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>
11896 !! end
11897
11898 !! test
11899 Thumbnail image with link parameter
11900 !! options
11901 thumbsize=220
11902 parsoid=wt2html,wt2wt,html2html
11903 !! wikitext
11904 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11905 !! html/php
11906 <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>
11907
11908 !! html/parsoid
11909 <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>
11910 !! end
11911
11912 !! test
11913 Manually-specified thumbnail image
11914 !! options
11915 thumbsize=220
11916 !! wikitext
11917 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11918 !! html/php
11919 <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>
11920
11921 !! html/parsoid
11922 <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>
11923 !! end
11924
11925 !! test
11926 Manually-specified thumbnail image with explicit link to wiki page
11927 !! options
11928 thumbsize=220
11929 parsoid=wt2html,wt2wt,html2html
11930 !! wikitext
11931 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11932 !! html/php
11933 <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>
11934
11935 !! html/parsoid
11936 <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>
11937 !! end
11938
11939 !! test
11940 Manually-specified thumbnail image with explicit link to url
11941 !! options
11942 thumbsize=220
11943 parsoid=wt2html,wt2wt,html2html
11944 !! wikitext
11945 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11946 !! html/php
11947 <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>
11948
11949 !! html/parsoid
11950 <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>
11951 !! end
11952
11953 !! test
11954 Manually-specified thumbnail image with explicit no link
11955 !! options
11956 thumbsize=220
11957 parsoid=wt2html,wt2wt,html2html
11958 !! wikitext
11959 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11960 !! html/php
11961 <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>
11962
11963 !! html/parsoid
11964 <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>
11965 !! end
11966
11967 !! test
11968 Manually-specified thumbnail image with explicit link and alt text
11969 !! options
11970 thumbsize=220
11971 parsoid=wt2html,wt2wt,html2html
11972 !! wikitext
11973 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11974 !! html/php
11975 <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>
11976
11977 !! html/parsoid
11978 <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>
11979 !! end
11980
11981 !! test
11982 Image with frame and link
11983 !! options
11984 parsoid=wt2html,wt2wt,html2html
11985 !! wikitext
11986 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11987 !! html/php
11988 <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>
11989
11990 !! html/parsoid
11991 <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>
11992 !! end
11993
11994 !! test
11995 Image with frame and link and explicit alt
11996 !! options
11997 parsoid=wt2html,wt2wt,html2html
11998 !! wikitext
11999 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12000 !! html/php
12001 <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>
12002
12003 !! html/parsoid
12004 <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>
12005 !! end
12006
12007 !! test
12008 Image with wiki markup in implicit alt
12009 !! options
12010 parsoid=wt2html,wt2wt,html2html
12011 !! wikitext
12012 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12013
12014 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12015 !! html/php
12016 <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>
12017 </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>
12018 </p>
12019 !! html/parsoid
12020 <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>
12021 <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>
12022 !! end
12023
12024 ###################
12025 # Conflicting image format options.
12026 # First option specified should 'win'.
12027 # All three cases in each test should be identical.
12028
12029 !! test
12030 Image with 'frameless' first.
12031 !! options
12032 parsoid=wt2html,wt2wt,html2html
12033 !! wikitext
12034 [[File:Foobar.jpg|frameless|caption]]
12035
12036 [[File:Foobar.jpg|frameless|frame|caption]]
12037
12038 [[File:Foobar.jpg|frameless|thumb|caption]]
12039 !! html/php
12040 <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>
12041 </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>
12042 </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>
12043 </p>
12044 !! html/parsoid
12045 <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>
12046 <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>
12047 <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>
12048 !! end
12049
12050 !! test
12051 Image with 'frame' first.
12052 !! options
12053 parsoid=wt2html,wt2wt,html2html
12054 !! wikitext
12055 [[File:Foobar.jpg|frame|caption]]
12056 [[File:Foobar.jpg|frame|frameless|caption]]
12057 [[File:Foobar.jpg|frame|thumb|caption]]
12058 !! html/php
12059 <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>
12060 <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>
12061 <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>
12062
12063 !! html/parsoid
12064 <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>
12065 <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>
12066 <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>
12067 !! end
12068
12069 !! test
12070 Image with 'thumb' first.
12071 !! options
12072 parsoid=wt2html,wt2wt,html2html
12073 !! wikitext
12074 [[File:Foobar.jpg|thumb|caption]]
12075 [[File:Foobar.jpg|thumb|frameless|caption]]
12076 [[File:Foobar.jpg|thumb|frame|caption]]
12077 !! html/php
12078 <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>
12079 <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>
12080 <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>
12081
12082 !! html/parsoid
12083 <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>
12084 <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>
12085 <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>
12086 !! end
12087
12088 ###################
12089 # Image sizing.
12090 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12091 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12092 # Foobar has actual size of 1941x220
12093 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12094 # a scalable format.
12095 # 2. Framed images always ignore size options; always render at default size.
12096 # 3. "Unspecified format" and border are the only types which can be
12097 # enlarged.
12098
12099 !! test
12100 Image: "unspecified format" and border enlarge
12101 !! options
12102 parsoid=wt2html,wt2wt,html2html
12103 !! wikitext
12104 [[File:Foobar.jpg|2000px]]
12105
12106 [[File:Foobar.jpg|border|2000px]]
12107 !! html/php
12108 <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>
12109 </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>
12110 </p>
12111 !! html/parsoid
12112 <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>
12113 <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>
12114 !! end
12115
12116 !! test
12117 Image: "unspecified format" and border reduce
12118 !! options
12119 parsoid=wt2html,wt2wt,html2html
12120 !! wikitext
12121 [[File:Foobar.jpg|1000px]]
12122
12123 [[File:Foobar.jpg|border|1000px]]
12124 !! html/php
12125 <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>
12126 </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>
12127 </p>
12128 !! html/parsoid
12129 <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>
12130 <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>
12131 !! end
12132
12133 !! test
12134 Image: thumbs reduce
12135 !! options
12136 parsoid=wt2html,wt2wt,html2html
12137 !! wikitext
12138 [[File:Foobar.jpg|thumb|50px]]
12139 !! html/php
12140 <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>
12141
12142 !! html/parsoid
12143 <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>
12144 !! end
12145
12146 !! test
12147 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12148 !! options
12149 parsoid=wt2html,wt2wt,html2html
12150 !! wikitext
12151 [[File:Foobar.jpg|thumb|2000px]]
12152
12153 [[File:Foobar.svg|thumb|2000px]]
12154 !! html/php
12155 <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>
12156 <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>
12157
12158 !! html/parsoid
12159 <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>
12160 <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>
12161 !! end
12162
12163 !! test
12164 Image: frameless can reduce in size
12165 !! options
12166 parsoid=wt2html,wt2wt,html2html
12167 !! wikitext
12168 [[File:Foobar.jpg|frameless|50px]]
12169 !! html/php
12170 <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>
12171 </p>
12172 !! html/parsoid
12173 <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>
12174 !! end
12175
12176 !! test
12177 Image: bitmap frameless can't be enlarged past original size, but vector can
12178 !! options
12179 parsoid=wt2html,wt2wt,html2html
12180 !! wikitext
12181 [[File:Foobar.jpg|frameless|2000px]]
12182
12183 [[File:Foobar.svg|frameless|2000px]]
12184 !! html/php
12185 <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>
12186 </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>
12187 </p>
12188 !! html/parsoid
12189 <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>
12190 <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>
12191 !! end
12192
12193 !! test
12194 Image: framed images are always unscaled.
12195 !! options
12196 parsoid=wt2html,wt2wt,html2html
12197 !! wikitext
12198 [[File:Foobar.jpg|frame]]
12199
12200 [[File:Foobar.jpg|frame|50px]]
12201
12202 [[File:Foobar.jpg|frame|50x50px]]
12203
12204 [[File:Foobar.jpg|frame|2000px]]
12205 !! html/php
12206 <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>
12207 <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>
12208 <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>
12209 <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>
12210
12211 !! html/parsoid
12212 <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>
12213 <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>
12214 <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>
12215 <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>
12216 !! end
12217
12218 ###################
12219
12220 !! test
12221 Link to image page- image page normally doesn't exists, hence edit link
12222 Add test with existing image page
12223 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12224 !! wikitext
12225 [[:Image:test]]
12226 !! html
12227 <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>
12228 </p>
12229 !! end
12230
12231 !! test
12232 bug 18784 Link to non-existent image page with caption should use caption as link text
12233 !! wikitext
12234 [[:Image:test|caption]]
12235 !! html
12236 <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>
12237 </p>
12238 !! end
12239
12240 !! test
12241 Frameless image caption with a free URL
12242 !! wikitext
12243 [[File:Foobar.jpg|http://example.com]]
12244 !! html/php
12245 <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>
12246 </p>
12247 !! html/parsoid
12248 <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>
12249 !! end
12250
12251 !! test
12252 Thumbnail image caption with a free URL
12253 !! options
12254 thumbsize=220
12255 !! wikitext
12256 [[File:Foobar.jpg|thumb|http://example.com]]
12257 !! html/php
12258 <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>
12259
12260 !! html/parsoid
12261 <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>
12262 !! end
12263
12264 !! test
12265 Thumbnail image caption with a free URL and explicit alt
12266 !! options
12267 thumbsize=220
12268 parsoid=wt2html,wt2wt,html2html
12269 !! wikitext
12270 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12271 !! html/php
12272 <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>
12273
12274 !! html/parsoid
12275 <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>
12276 !! end
12277
12278 !! test
12279 SVG thumbnails with no language set
12280 !! options
12281 !! wikitext
12282 [[File:Foobar.svg|thumb|caption]]
12283 !! html/php
12284 <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>
12285
12286 !! html/parsoid
12287 <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>
12288 !! end
12289
12290 !! test
12291 SVG thumbnails with language de
12292 !! options
12293 parsoid=wt2html,wt2wt,html2html
12294 !! wikitext
12295 [[File:Foobar.svg|thumb|caption|lang=de]]
12296 !! html/php
12297 <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>
12298
12299 !! html/parsoid
12300 <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>
12301 !! end
12302
12303 !! test
12304 SVG thumbnails with invalid language code
12305 !! options
12306 parsoid=wt2html,wt2wt,html2html
12307 !! wikitext
12308 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12309 !! html/php
12310 <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>
12311
12312 !! html/parsoid
12313 <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>
12314 !! end
12315
12316 !! test
12317 BUG 1887: A ISBN with a thumbnail
12318 !! wikitext
12319 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12320 !! html/php
12321 <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>
12322
12323 !! html/parsoid
12324 <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>
12325 !! end
12326
12327 !! test
12328 BUG 1887: A RFC with a thumbnail
12329 !! wikitext
12330 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12331 !! html/php
12332 <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>
12333
12334 !! html/parsoid
12335 <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>
12336 !! end
12337
12338 !! test
12339 BUG 1887: A mailto link with a thumbnail
12340 !! wikitext
12341 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12342 !! html/php
12343 <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>
12344
12345 !! html/parsoid
12346 <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>
12347 !! end
12348
12349 # Pending resolution to bug 368
12350 !! test
12351 BUG 648: Frameless image caption with a link
12352 !! wikitext
12353 [[File:Foobar.jpg|text with a [[link]] in it]]
12354 !! html/php
12355 <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>
12356 </p>
12357 !! html/parsoid
12358 <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>
12359 !! end
12360
12361 !! test
12362 BUG 648: Frameless image caption with a link (suffix)
12363 !! wikitext
12364 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12365 !! html/php
12366 <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>
12367 </p>
12368 !! html/parsoid
12369 <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>
12370 !! end
12371
12372 !! test
12373 BUG 648: Frameless image caption with an interwiki link
12374 !! wikitext
12375 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12376 !! html/php
12377 <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>
12378 </p>
12379 !! html/parsoid
12380 <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>
12381 !! end
12382
12383 !! test
12384 BUG 648: Frameless image caption with a piped interwiki link
12385 !! wikitext
12386 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12387 !! html/php
12388 <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>
12389 </p>
12390 !! html/parsoid
12391 <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>
12392 !! end
12393
12394 !! test
12395 Escape HTML special chars in image alt text
12396 !! wikitext
12397 [[File:Foobar.jpg|& < > "]]
12398 !! html/php
12399 <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>
12400 </p>
12401 !! html/parsoid
12402 <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>
12403 !! end
12404
12405 !! test
12406 BUG 499: Alt text should have &#1234;, not &amp;1234;
12407 !! wikitext
12408 [[File:Foobar.jpg|&#9792;]]
12409 !! html/php
12410 <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>
12411 </p>
12412 !! html/parsoid
12413 <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>
12414 !! end
12415
12416 !! test
12417 Broken image caption with link
12418 !! options
12419 parsoid=wt2html,wt2wt,html2html
12420 !! wikitext
12421 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12422 !! html/php
12423 <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.
12424 </p>
12425 !! html/parsoid
12426 <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>
12427 !! end
12428
12429 !! test
12430 Image caption containing another image
12431 !! wikitext
12432 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12433 !! html/php
12434 <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>
12435
12436 !! html/parsoid
12437 <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>
12438 !! end
12439
12440 !! test
12441 Image: caption containing a newline
12442 !! wikitext
12443 [[File:Foobar.jpg|This
12444 *is some text]]
12445 !! html/php
12446 <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>
12447 </p>
12448 !! html/parsoid
12449 <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>
12450 !!end
12451
12452 !!test
12453 Image: caption containing leading space
12454 (The leading space should not trigger nowiki escaping in wt2wt mode)
12455 !! wikitext
12456 [[File:Foobar.jpg|thumb| bar]]
12457 !! html/php
12458 <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>
12459
12460 !! html/parsoid
12461 <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>
12462 !!end
12463
12464 !! test
12465 Image: caption containing a table
12466 !! options
12467 parsoid=wt2html,wt2wt,html2html
12468 !! wikitext
12469 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12470 {|
12471 ! Foo !! Bar
12472 |-
12473 | Foo1 || Bar1
12474 |}
12475 and some more text.]]
12476 !! html/php
12477 <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>
12478
12479 !! html/parsoid
12480 <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
12481 <table>
12482 <tbody>
12483 <tr><th>Foo </th><th>Bar</th></tr>
12484 <tr>
12485 <td>Foo1 </td>
12486 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12487 !! end
12488
12489 !! test
12490 Bug 3090: External links other than http: in image captions
12491 !! wikitext
12492 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12493 !! html/php
12494 <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>
12495
12496 !! html/parsoid
12497 <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>
12498 !! end
12499
12500 !! test
12501 Custom class
12502 !! options
12503 parsoid=wt2html,wt2wt,html2html
12504 !! wikitext
12505 [[Image:foobar.jpg|a|class=b]]
12506 !! html/php
12507 <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>
12508 </p>
12509 !! html/parsoid
12510 <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>
12511 !! end
12512
12513 !! test
12514 Localized image handling (1).
12515 !! options
12516 parsoid=wt2html,wt2wt,html2html
12517 language=es
12518 !! wikitext
12519 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12520 !! html/php
12521 <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>
12522
12523 !! html/parsoid
12524 <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>
12525 !! end
12526
12527 !! test
12528 Localized image handling (2).
12529 !! options
12530 thumbsize=220
12531 parsoid=wt2html,wt2wt,html2html
12532 language=es
12533 !! wikitext
12534 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12535 !! html/php
12536 <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>
12537
12538 !! html/parsoid
12539 <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>
12540 !! end
12541
12542 !! test
12543 "border", "frameless" and "class" attributes on an image.
12544 !! options
12545 thumbsize=220
12546 parsoid=wt2html,wt2wt,html2html
12547 !! wikitext
12548 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12549 !! html/php
12550 <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>
12551 </p>
12552 !! html/parsoid
12553 <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>
12554 !! end
12555
12556 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12557 !! test
12558 Invalid image attributes (bug 62500)
12559 !! options
12560 thumbsize=220
12561 parsoid=wt2html,wt2wt,html2html
12562 !! wikitext
12563 [[File:Foobar.jpg|thumb|float|left|caption]]
12564
12565 [[File:Foobar.jpg|thumb|righ|caption]]
12566
12567 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12568 !! html/php
12569 <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>
12570 <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>
12571 <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>
12572
12573 !! html/parsoid
12574 <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>
12575 <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>
12576 <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>
12577 !! end
12578
12579 !! article
12580 File:Barfoo.jpg
12581 !! text
12582 #REDIRECT [[File:Barfoo.jpg]]
12583 !! endarticle
12584
12585 # FIXME: Parsoid should run this test -- but we'd need to teach the
12586 # mockAPI about the redirected Barfoo.jpg image.
12587 !! test
12588 Redirected image
12589 !! wikitext
12590 [[Image:Barfoo.jpg]]
12591 !! html/php
12592 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12593 </p>
12594 !! end
12595
12596 !! test
12597 Missing image with uploads disabled
12598 !! options
12599 wgEnableUploads=0
12600 !! wikitext
12601 [[File:Foobaz.jpg]]
12602 !! html/php
12603 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12604 </p>
12605 !! html/parsoid
12606 <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>
12607 !! end
12608
12609 # Parsoid-specific testing for images
12610 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12611 # Currently imperfect due to a flaw in the Parsoid testrunner
12612 # Work in progress
12613 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12614 # image tests.
12615
12616 !! test
12617 Parsoid-specific image handling - simple image with size and middle alignment
12618 !! wikitext
12619 [[File:Foobar.jpg|middle|50px]]
12620 !! html/parsoid
12621 <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>
12622 !! end
12623
12624 !! test
12625 Parsoid-specific image handling - simple image with size, middle alignment,
12626 non-standard namespace alias
12627 !! options
12628 parsoid=wt2wt,wt2html,html2html
12629 !! wikitext
12630 [[Image:Foobar.jpg|middle|50px]]
12631 !! html/parsoid
12632 <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>
12633 !! end
12634
12635 !! test
12636 Parsoid-specific image handling - simple image with size and middle alignment
12637 (existing content)
12638 !! wikitext
12639 [[File:Foobar.jpg|50px|middle]]
12640 !! html/parsoid
12641 <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>
12642 !! end
12643
12644 !! test
12645 Parsoid-specific image handling - simple image with size and middle alignment
12646 and non-standard namespace name
12647 !! options
12648 parsoid=wt2html,wt2wt,html2html
12649 !! wikitext
12650 [[Image:Foobar.jpg|50px|middle]]
12651 !! html/parsoid
12652 <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>
12653 !! end
12654
12655 !! test
12656 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12657 !! wikitext
12658 [[File:Foobar.jpg|500x10px|baseline|caption]]
12659 !! html/parsoid
12660 <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>
12661 !! end
12662
12663 !! test
12664 Parsoid-specific image handling - simple image with border and size spec
12665 !! wikitext
12666 [[File:Foobar.jpg|50px|border|caption]]
12667 !! html/parsoid
12668 <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>
12669 !! end
12670
12671 !! test
12672 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12673 !! wikitext
12674 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12675 !! html/parsoid
12676 <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>
12677 !! end
12678
12679 !! test
12680 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12681 (existing content)
12682 !! wikitext
12683 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12684 !! html/parsoid
12685 <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>
12686 !! end
12687
12688 !! test
12689 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12690 !! wikitext
12691 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12692 !! html/parsoid
12693 <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>
12694 !! end
12695
12696 !! test
12697 Parsoid-specific image handling - thumbnail with specific size, halign,
12698 valign, and caption (existing content)
12699 !! wikitext
12700 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12701 !! html/parsoid
12702 <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>
12703 !! end
12704
12705 !! test
12706 Parsoid-specific image handling - framed image with specific size and caption
12707 (size is ignored)
12708 !! options
12709 parsoid=wt2html,wt2wt,html2html
12710 !! wikitext
12711 [[File:Foobar.jpg|frame|500x50px|caption]]
12712 !! html/parsoid
12713 <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>
12714 !! end
12715
12716 !! test
12717 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12718 (size is ignored)
12719 !! options
12720 parsoid=wt2html,wt2wt,html2html
12721 !! wikitext
12722 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12723 !! html/parsoid
12724 <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>
12725 !! end
12726
12727 !! test
12728 Parsoid-specific image handling - frameless image with specific size, border, and caption
12729 !! wikitext
12730 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12731 !! html/parsoid
12732 <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>
12733 !! end
12734
12735 !! test
12736 Parsoid-specific image handling - simple image with a formatted caption
12737 !! wikitext
12738 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12739 !! html/parsoid
12740 <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>
12741 !! end
12742
12743 !! test
12744 Parsoid-specific image handling - caption with a template in it
12745 !! wikitext
12746 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12747 !! html/parsoid
12748 <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>
12749 !! end
12750
12751 !! test
12752 Parsoid-specific image handling - caption with unbalanced tags in it
12753 !! options
12754 parsoid=wt2html,wt2wt,html2html
12755 !! wikitext
12756 foo
12757 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12758 bar
12759 !! html/parsoid
12760 <p>foo</p>
12761 <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>
12762 <p>bar</p>
12763 !! end
12764
12765 !! test
12766 Parsoid-specific image handling - empty caption (1)
12767 !! options
12768 parsoid=wt2html,wt2wt
12769 !! wikitext
12770 [[File:Foobar.jpg|thumb|]]
12771 !! html/parsoid
12772 <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>
12773 !! end
12774
12775 # empty captions don't get serialized unless we're in the "round trip" case
12776 !! test
12777 Parsoid-specific image handling - empty caption (2)
12778 !! options
12779 parsoid=html2wt
12780 !! html/parsoid
12781 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12782 <a href="File:Foobar.jpg">
12783 <img resource="./File:Foobar.jpg"
12784 src="//example.com/images/3/3a/Foobar.jpg"
12785 height="25" width="220"/>
12786 </a>
12787 <figcaption></figcaption>
12788 </figure>
12789 !! wikitext
12790 [[File:Foobar.jpg|thumb]]
12791 !! end
12792
12793 !! test
12794 Parsoid-specific image handling - whitespace caption
12795 !! wikitext
12796 [[File:Foobar.jpg|thumb| ]]
12797 !! html/parsoid
12798 <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>
12799 !! end
12800
12801 !! test
12802 Parsoid-specific image handling - lang option
12803 !! wikitext
12804 foo
12805 [[File:Foobar.svg|lang=de|caption]]
12806 bar
12807 !! html/parsoid
12808 <p>foo
12809 <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>
12810 bar</p>
12811 !! end
12812
12813
12814 ###
12815 ### Subpages
12816 ###
12817 !! article
12818 Subpage test/subpage
12819 !! text
12820 foo
12821 !! endarticle
12822
12823 !! test
12824 Subpage link
12825 !! options
12826 subpage title=[[Subpage test]]
12827 !! wikitext
12828 [[/subpage]]
12829 !! html
12830 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12831 </p>
12832 !! end
12833
12834 !! test
12835 Subpage noslash link
12836 !! options
12837 subpage title=[[Subpage test]]
12838 !! wikitext
12839 [[/subpage/]]
12840 !! html
12841 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12842 </p>
12843 !! end
12844
12845 !! article
12846 Subpage test/1/2/subpage
12847 !! text
12848 blah
12849 !! endarticle
12850
12851 !! test
12852 Relative subpage noslash link
12853 !! options
12854 parsoid=wt2wt,wt2html,html2html
12855 subpage title=[[Subpage test/1/2/3/4]]
12856 !! wikitext
12857 [[../../subpage/]]
12858
12859 [[../../subpage]]
12860 !! html/php
12861 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12862 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12863 </p>
12864 !! html/parsoid
12865 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12866 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12867 !! end
12868
12869 !! test
12870 Parsoid: dot-slash prefixed wikilinks
12871 !! wikitext
12872 [[./foo]]
12873
12874 [[././bar]]
12875
12876 [[././baz/]]
12877 !! html/php
12878 <p>[[./foo]]
12879 </p><p>[[././bar]]
12880 </p><p>[[././baz/]]
12881 </p>
12882 !! html/parsoid
12883 <p>[[./foo]]
12884 </p><p>[[././bar]]
12885 </p><p>[[././baz/]]
12886 </p>
12887 !! end
12888
12889 !! test
12890 Render invalid page names as plain text (bug 51090)
12891 !! wikitext
12892 [[./../foo|bar]]
12893 [[foo�|bar]]
12894 [[foo/.|bar]]
12895 [[foo/..|bar]]
12896 [[foo~~~bar]]
12897 [[foo>bar]]
12898 [[foo[bar]]
12899 [[.]]
12900 [[..]]
12901 [[foo././bar]]
12902
12903 [[{{echo|./../foo}}|bar]]
12904 [[{{echo|foo/.}}|bar]]
12905 [[{{echo|foo/..}}|bar]]
12906 [[{{echo|foo~~~~bar}}]]
12907 [[{{echo|foo>bar}}]]
12908 [[{{echo|foo././bar}}]]
12909 [[{{echo|foo{bar}}]]
12910 [[{{echo|foo}bar}}]]
12911 [[{{echo|foo[bar}}]]
12912 [[{{echo|foo]bar}}]]
12913 [[{{echo|foo<bar}}]]
12914 !!html/php
12915 <p>[[./../foo|bar]]
12916 [[foo�|bar]]
12917 [[foo/.|bar]]
12918 [[foo/..|bar]]
12919 [[foo~~~bar]]
12920 [[foo&gt;bar]]
12921 [[foo[bar]]
12922 [[.]]
12923 [[..]]
12924 [[foo././bar]]
12925 </p><p>[[./../foo|bar]]
12926 [[foo/.|bar]]
12927 [[foo/..|bar]]
12928 [[foo~~~~bar]]
12929 [[foo&gt;bar]]
12930 [[foo././bar]]
12931 [[foo{bar]]
12932 [[foo}bar]]
12933 [[foo[bar]]
12934 [[foo]bar]]
12935 [[foo&lt;bar]]
12936 </p>
12937 !!html/parsoid
12938 <p>[[./../foo|bar]]
12939 [[foo�|bar]]
12940 [[foo/.|bar]]
12941 [[foo/..|bar]]
12942 [[foo~~~bar]]
12943 [[foo>bar]]
12944 [[foo[bar]]
12945 [[.]]
12946 [[..]]
12947 [[foo././bar]]</p>
12948
12949 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12950 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12951 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12952 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12953 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12954 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12955 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12956 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12957 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12958 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12959 [[<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>
12960 !!end
12961
12962 !! test
12963 Disabled subpages
12964 !! wikitext
12965 [[/subpage]]
12966 !! html
12967 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12968 </p>
12969 !! end
12970
12971 !! test
12972 BUG 561: {{/Subpage}}
12973 !! options
12974 subpage title=[[Page]]
12975 !! wikitext
12976 {{/Subpage}}
12977 !! html
12978 <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>
12979 </p>
12980 !! end
12981
12982 ###
12983 ### Categories
12984 ###
12985 !! article
12986 Category:MediaWiki User's Guide
12987 !! text
12988 blah
12989 !! endarticle
12990
12991 !! test
12992 Link to category
12993 !! wikitext
12994 [[:Category:MediaWiki User's Guide]]
12995 !! html
12996 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12997 </p>
12998 !! end
12999
13000 !! test
13001 Simple category
13002 !! options
13003 cat
13004 !! wikitext
13005 [[Category:MediaWiki User's Guide]]
13006 !! html
13007 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13008 !! end
13009
13010 !! test
13011 PAGESINCATEGORY invalid title fatal (r33546 fix)
13012 !! wikitext
13013 {{PAGESINCATEGORY:<bogus>}}
13014 !! html
13015 <p>0
13016 </p>
13017 !! end
13018
13019 !! test
13020 Category with different sort key
13021 !! options
13022 cat
13023 !! wikitext
13024 [[Category:MediaWiki User's Guide|Foo]]
13025 !! html
13026 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13027 !! end
13028
13029 !! test
13030 Category with identical sort key
13031 !! options
13032 cat
13033 !! wikitext
13034 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13035 !! html
13036 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13037 !! end
13038
13039 !! test
13040 Category with empty sort key
13041 !! options
13042 cat
13043 pst
13044 !! wikitext
13045 [[Category:MediaWiki User's Guide|]]
13046 !! html
13047 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13048 !! end
13049
13050 !! test
13051 Category with empty sort key and parentheses
13052 !! options
13053 cat
13054 pst
13055 !! wikitext
13056 [[Category:Foo (bar)|]]
13057 !! html
13058 [[Category:Foo (bar)|Foo]]
13059 !! end
13060
13061 !! test
13062 Category with link tail
13063 !! options
13064 cat
13065 pst
13066 !! wikitext
13067 123[[Category:Foo]]456
13068 !! html
13069 123[[Category:Foo]]456
13070 !! end
13071
13072 !! test
13073 Category with template
13074 !! options
13075 cat
13076 pst
13077 !! wikitext
13078 [[Category:{{echo|Foo}}]]
13079 !! html
13080 [[Category:{{echo|Foo}}]]
13081 !! end
13082
13083 !! test
13084 Category with template in sort key
13085 !! options
13086 cat
13087 pst
13088 !! wikitext
13089 [[Category:Foo|{{echo|Bar}}]]
13090 !! html
13091 [[Category:Foo|{{echo|Bar}}]]
13092 !! end
13093
13094 !! test
13095 Category with template in sort key and title
13096 !! options
13097 cat
13098 pst
13099 !! wikitext
13100 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13101 !! html
13102 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13103 !! end
13104
13105 !! test
13106 Category / paragraph interactions
13107 !! wikitext
13108 Foo [[Category:Baz]] Bar
13109
13110 Foo [[Category:Baz]]
13111 Bar
13112
13113 Foo
13114 [[Category:Baz]]
13115 Bar
13116
13117 Foo
13118 [[Category:Baz]] Bar
13119
13120 Foo
13121 [[Category:Baz]]
13122 [[Category:Baz]]
13123 [[Category:Baz]]
13124 Bar
13125
13126 [[Category:Baz]]
13127 [[Category:Baz]]
13128 [[Category:Baz]]
13129
13130 [[Category:Baz]]
13131 {{echo|[[Category:Baz]]}}
13132 [[Category:Baz]]
13133 !! html
13134 <p>Foo Bar
13135 </p><p>Foo
13136 Bar
13137 </p><p>Foo
13138 Bar
13139 </p><p>Foo Bar
13140 </p><p>Foo
13141 Bar
13142 </p>
13143 !! end
13144
13145 !! test
13146 Parsoid: Serialize link to category page with colon escape
13147 !! options
13148 parsoid
13149 !! wikitext
13150
13151 [[:Category:Foo]]
13152 [[:Category:Foo|Bar]]
13153 !! html
13154 <p>
13155 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13156 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13157 </p>
13158 !! end
13159
13160 !! test
13161 Parsoid: Link prefix/suffixes aren't applied to category links
13162 !! options
13163 parsoid=wt2html,wt2wt,html2html
13164 language=is
13165 !! wikitext
13166 x[[Category:Foo]]y
13167 !! html
13168 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13169 !! end
13170
13171 !! test
13172 Parsoid: Serialize link to file page with colon escape
13173 !! options
13174 parsoid
13175 !! wikitext
13176
13177 [[:File:Foo.png]]
13178 [[:File:Foo.png|Bar]]
13179 !! html
13180 <p>
13181 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13182 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13183 </p>
13184 !! end
13185
13186 !! test
13187 Parsoid: Serialize a genuine category link without colon escape
13188 !! options
13189 parsoid
13190 !! wikitext
13191 [[Category:Foo]]
13192 [[Category:Foo|Bar]]
13193 !! html
13194 <link rel="mw:PageProp/Category" href="Category:Foo">
13195 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13196 !! end
13197
13198 !! test
13199 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13200 !! options
13201 parsoid=html2wt
13202 !! html
13203 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13204 !! wikitext
13205 [[Category:Toxine bactérienne]]
13206 !! end
13207
13208 !! test
13209 Parsoid: Defaultsort
13210 !! wikitext
13211 {{DEFAULTSORT:Foo}}
13212 !! html/parsoid
13213 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13214 !! end
13215
13216 !! test
13217 Parsoid: Defaultsort (template-generated)
13218 !! wikitext
13219 {{{{echo|DEFAULTSORT}}:Foo}}
13220 !! html/parsoid
13221 <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}}]}'/>
13222 !! end
13223
13224 ###
13225 ### Inter-language links
13226 ###
13227 !! test
13228 Interlanguage links
13229 !! options
13230 ill
13231 !! wikitext
13232 [[es:Alimento]]
13233 [[fr:Nourriture]]
13234 [[zh:食品]]
13235 !! html/php
13236 es:Alimento fr:Nourriture zh:食品
13237 !! html/parsoid
13238 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13239 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13240 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13241 !! end
13242
13243 !! test
13244 Duplicate interlanguage links (bug 24502)
13245 !! options
13246 ill
13247 !! wikitext
13248 [[es:1]]
13249 [[es:2]]
13250 [[fr:1]]
13251 [[fr:2]]
13252 !! html/php
13253 es:1 fr:1
13254 !! html/parsoid
13255 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13256 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13257 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13258 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13259 !! end
13260
13261 ###
13262 ### Sections
13263 ###
13264 !! test
13265 Basic section headings
13266 !! wikitext
13267 == Headline 1 ==
13268 Some text
13269
13270 ==Headline 2==
13271 More
13272 ===Smaller headline===
13273 Blah blah
13274 !! html
13275 <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>
13276 <p>Some text
13277 </p>
13278 <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>
13279 <p>More
13280 </p>
13281 <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>
13282 <p>Blah blah
13283 </p>
13284 !! end
13285
13286 !! test
13287 Section headings with TOC
13288 !! wikitext
13289 == Headline 1 ==
13290 === Subheadline 1 ===
13291 ===== Skipping a level =====
13292 ====== Skipping a level ======
13293
13294 == Headline 2 ==
13295 Some text
13296 ===Another headline===
13297 !! html
13298 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13299 <ul>
13300 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13301 <ul>
13302 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13303 <ul>
13304 <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>
13305 <ul>
13306 <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>
13307 </ul>
13308 </li>
13309 </ul>
13310 </li>
13311 </ul>
13312 </li>
13313 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13314 <ul>
13315 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13316 </ul>
13317 </li>
13318 </ul>
13319 </div>
13320
13321 <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>
13322 <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>
13323 <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>
13324 <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>
13325 <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>
13326 <p>Some text
13327 </p>
13328 <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>
13329
13330 !! end
13331
13332 !! test
13333 TOC anchors don't collide
13334 !! wikitext
13335 __FORCETOC__
13336 == Headline 2 ==
13337 == Headline ==
13338 == Headline 2 ==
13339 == Headline ==
13340 !! html
13341 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13342 <ul>
13343 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13344 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13345 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13346 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13347 </ul>
13348 </div>
13349
13350 <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>
13351 <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>
13352 <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>
13353 <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>
13354
13355 !! end
13356
13357 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13358 !! test
13359 Handling of sections up to level 6 and beyond
13360 !! wikitext
13361 = Level 1 Heading=
13362 == Level 2 Heading==
13363 === Level 3 Heading===
13364 ==== Level 4 Heading====
13365 ===== Level 5 Heading=====
13366 ====== Level 6 Heading======
13367 ======= Level 7 Heading=======
13368 ======== Level 8 Heading========
13369 ========= Level 9 Heading=========
13370 ========== Level 10 Heading==========
13371 !! html
13372 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13373 <ul>
13374 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13375 <ul>
13376 <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>
13377 <ul>
13378 <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>
13379 <ul>
13380 <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>
13381 <ul>
13382 <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>
13383 <ul>
13384 <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>
13385 <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>
13386 <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>
13387 <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>
13388 <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>
13389 </ul>
13390 </li>
13391 </ul>
13392 </li>
13393 </ul>
13394 </li>
13395 </ul>
13396 </li>
13397 </ul>
13398 </li>
13399 </ul>
13400 </div>
13401
13402 <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>
13403 <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>
13404 <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>
13405 <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>
13406 <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>
13407 <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>
13408 <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>
13409 <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>
13410 <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>
13411 <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>
13412
13413 !! end
13414
13415 !! test
13416 TOC regression (bug 9764)
13417 !! wikitext
13418 == title 1 ==
13419 === title 1.1 ===
13420 ==== title 1.1.1 ====
13421 === title 1.2 ===
13422 == title 2 ==
13423 === title 2.1 ===
13424 !! html
13425 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13426 <ul>
13427 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13428 <ul>
13429 <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>
13430 <ul>
13431 <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>
13432 </ul>
13433 </li>
13434 <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>
13435 </ul>
13436 </li>
13437 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13438 <ul>
13439 <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>
13440 </ul>
13441 </li>
13442 </ul>
13443 </div>
13444
13445 <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>
13446 <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>
13447 <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>
13448 <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>
13449 <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>
13450 <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>
13451
13452 !! end
13453
13454 !! test
13455 TOC with wgMaxTocLevel=3 (bug 6204)
13456 !! options
13457 wgMaxTocLevel=3
13458 !! wikitext
13459 == title 1 ==
13460 === title 1.1 ===
13461 ==== title 1.1.1 ====
13462 === title 1.2 ===
13463 == title 2 ==
13464 === title 2.1 ===
13465 !! html
13466 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13467 <ul>
13468 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13469 <ul>
13470 <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>
13471 <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>
13472 </ul>
13473 </li>
13474 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13475 <ul>
13476 <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>
13477 </ul>
13478 </li>
13479 </ul>
13480 </div>
13481
13482 <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>
13483 <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>
13484 <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>
13485 <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>
13486 <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>
13487 <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>
13488
13489 !! end
13490
13491 !! test
13492 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13493 !! options
13494 wgMaxTocLevel=3
13495 !! wikitext
13496 ==Section 1==
13497 ===Section 1.1===
13498 ====Section 1.1.1====
13499 ====Section 1.1.1.1====
13500 ==Section 2==
13501 !! html
13502 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13503 <ul>
13504 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13505 <ul>
13506 <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>
13507 </ul>
13508 </li>
13509 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13510 </ul>
13511 </div>
13512
13513 <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>
13514 <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>
13515 <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>
13516 <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>
13517 <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>
13518
13519 !! end
13520
13521
13522 !! test
13523 Resolving duplicate section names
13524 !! wikitext
13525 == Foo bar ==
13526 == Foo bar ==
13527 !! html
13528 <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>
13529 <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>
13530
13531 !! end
13532
13533 !! test
13534 Resolving duplicate section names with differing case (bug 10721)
13535 !! wikitext
13536 == Foo bar ==
13537 == Foo Bar ==
13538 !! html
13539 <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>
13540 <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>
13541
13542 !! end
13543
13544 !! article
13545 Template:sections
13546 !! text
13547 ===Section 1===
13548 ==Section 2==
13549 !! endarticle
13550
13551 !! test
13552 Template with sections, __NOTOC__
13553 !! wikitext
13554 __NOTOC__
13555 ==Section 0==
13556 {{sections}}
13557 ==Section 4==
13558 !! html
13559 <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>
13560 <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>
13561 <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>
13562 <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>
13563
13564 !! end
13565
13566 !! test
13567 __NOEDITSECTION__ keyword
13568 !! wikitext
13569 __NOEDITSECTION__
13570 ==Section 1==
13571 ==Section 2==
13572 !! html
13573 <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>
13574 <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>
13575
13576 !! end
13577
13578 !! test
13579 Link inside a section heading
13580 !! wikitext
13581 ==Section with a [[Main Page|link]] in it==
13582 !! html
13583 <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>
13584
13585 !! end
13586
13587 !! test
13588 TOC regression (bug 12077)
13589 !! wikitext
13590 __TOC__
13591 == title 1 ==
13592 === title 1.1 ===
13593 == title 2 ==
13594 !! html
13595 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13596 <ul>
13597 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13598 <ul>
13599 <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>
13600 </ul>
13601 </li>
13602 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13603 </ul>
13604 </div>
13605
13606 <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>
13607 <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>
13608 <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>
13609
13610 !! end
13611
13612 !! test
13613 BUG 1219 URL next to image (good)
13614 !! wikitext
13615 http://example.com [[File:Foobar.jpg]]
13616 !! html/php
13617 <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>
13618 </p>
13619 !! html/parsoid
13620 <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>
13621 !!end
13622
13623 !! test
13624 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13625 !! wikitext
13626 ===
13627 The line above must have a trailing space!
13628 === <!--
13629 --> <!-- -->
13630 But just in case it doesn't...
13631 !! html
13632 <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>
13633 <p>The line above must have a trailing space!
13634 </p>
13635 <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>
13636 <p>But just in case it doesn't...
13637 </p>
13638 !! end
13639
13640 !! test
13641 Header with special characters (bug 25462)
13642 !! wikitext
13643 The tooltips shall not show entities to the user (ie. be double escaped)
13644
13645 == text > text ==
13646 section 1
13647
13648 == text < text ==
13649 section 2
13650
13651 == text & text ==
13652 section 3
13653
13654 == text ' text ==
13655 section 4
13656
13657 == text " text ==
13658 section 5
13659 !! html
13660 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13661 </p>
13662 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13663 <ul>
13664 <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>
13665 <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>
13666 <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>
13667 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13668 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13669 </ul>
13670 </div>
13671
13672 <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>
13673 <p>section 1
13674 </p>
13675 <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>
13676 <p>section 2
13677 </p>
13678 <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>
13679 <p>section 3
13680 </p>
13681 <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>
13682 <p>section 4
13683 </p>
13684 <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>
13685 <p>section 5
13686 </p>
13687 !! end
13688
13689 !! test
13690 Header with space, plus and underscore as entity
13691 !! wikitext
13692 Id should not contain + for spaces
13693
13694 == Space between Text ==
13695 section 1
13696
13697 == Space-Entity&#32;between&#32;Text ==
13698 section 2
13699
13700 == Plus+between+Text ==
13701 section 3
13702
13703 == Plus-Entity&#43;between&#43;Text ==
13704 section 4
13705
13706 == Underscore_between_Text ==
13707 section 5
13708
13709 == Underscore-Entity&#95;between&#95;Text ==
13710 section 6
13711
13712 [[#Space between Text]]
13713 [[#Space-Entity&#32;between&#32;Text]]
13714 [[#Plus+between+Text]]
13715 [[#Plus-Entity&#43;between&#43;Text]]
13716 [[#Underscore_between_Text]]
13717 [[#Underscore-Entity&#95;between&#95;Text]]
13718 !! html
13719 <p>Id should not contain + for spaces
13720 </p>
13721 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13722 <ul>
13723 <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>
13724 <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>
13725 <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>
13726 <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>
13727 <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>
13728 <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>
13729 </ul>
13730 </div>
13731
13732 <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>
13733 <p>section 1
13734 </p>
13735 <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>
13736 <p>section 2
13737 </p>
13738 <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>
13739 <p>section 3
13740 </p>
13741 <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>
13742 <p>section 4
13743 </p>
13744 <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>
13745 <p>section 5
13746 </p>
13747 <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>
13748 <p>section 6
13749 </p><p><a href="#Space_between_Text">#Space between Text</a>
13750 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13751 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13752 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13753 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13754 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13755 </p>
13756 !! end
13757
13758 !! test
13759 Headers with excess '=' characters
13760 (Are similar tests necessary beyond the 1st level?)
13761 !! wikitext
13762 =foo==
13763 ==foo=
13764 =''italic'' heading==
13765 ==''italic'' heading=
13766 !! html
13767 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13768 <ul>
13769 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13770 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13771 <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>
13772 <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>
13773 </ul>
13774 </div>
13775
13776 <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>
13777 <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>
13778 <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>
13779 <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>
13780
13781 !! end
13782
13783 !! test
13784 HTML headers vs TOC (bug 23393)
13785 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13786 !! wikitext
13787 <h1>Header 1</h1>
13788 == Header 1.1 ==
13789 == Header 1.2 ==
13790
13791 <h1>Header 2
13792 </h1>
13793 == Header 2.1 ==
13794 == Header 2.2 ==
13795 __NOEDITSECTION__
13796 !! html
13797 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13798 <ul>
13799 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13800 <ul>
13801 <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>
13802 <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>
13803 </ul>
13804 </li>
13805 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13806 <ul>
13807 <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>
13808 <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>
13809 </ul>
13810 </li>
13811 </ul>
13812 </div>
13813
13814 <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>
13815 <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>
13816 <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>
13817 <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>
13818 <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>
13819 <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>
13820
13821 !! end
13822
13823 !! test
13824 Single-line or multiline-comments can follow headings
13825 !! options
13826 parsoid=wt2html,wt2wt
13827 !! wikitext
13828 ==foo==<!---->
13829 ==bar==<!--c1-->
13830 ==baz==<!--
13831 c2
13832 c3-->
13833 !! html
13834 <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>
13835 <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>
13836 <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>
13837
13838 !! end
13839
13840 !! test
13841 BUG 1219 URL next to image (broken)
13842 !! wikitext
13843 http://example.com[[File:Foobar.jpg]]
13844 !! html/php
13845 <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>
13846 </p>
13847 !! html/parsoid
13848 <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>
13849 !!end
13850
13851 !! test
13852 Bug 1186 news: in the middle of text
13853 !! wikitext
13854 http://en.wikinews.org/wiki/Wikinews:Workplace
13855 !! html
13856 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13857 </p>
13858 !!end
13859
13860
13861 !! test
13862 Namespaced link must have a title
13863 !! wikitext
13864 [[Project:]]
13865 !! html
13866 <p>[[Project:]]
13867 </p>
13868 !!end
13869
13870 !! test
13871 Namespaced link must have a title (bad fragment version)
13872 !! wikitext
13873 [[Project:#fragment]]
13874 !! html
13875 <p>[[Project:#fragment]]
13876 </p>
13877 !!end
13878
13879
13880 ###
13881 ### HTML tags and HTML attributes
13882 ###
13883
13884 !! test
13885 div with no attributes
13886 !! wikitext
13887 <div>HTML rocks</div>
13888 !! html
13889 <div>HTML rocks</div>
13890
13891 !! end
13892
13893 !! test
13894 div with double-quoted attribute
13895 !! wikitext
13896 <div id="rock">HTML rocks</div>
13897 !! html
13898 <div id="rock">HTML rocks</div>
13899
13900 !! end
13901
13902 !! test
13903 div with single-quoted attribute
13904 !! wikitext
13905 <div id='rock'>HTML rocks</div>
13906 !! html
13907 <div id="rock">HTML rocks</div>
13908
13909 !! end
13910
13911 !! test
13912 div with unquoted attribute
13913 !! wikitext
13914 <div id=rock>HTML rocks</div>
13915 !! html
13916 <div id="rock">HTML rocks</div>
13917
13918 !! end
13919
13920 !! test
13921 div with illegal double attributes
13922 !! wikitext
13923 <div id="a" id="b">HTML rocks</div>
13924 !! html
13925 <div id="b">HTML rocks</div>
13926
13927 !!end
13928
13929 # FIXME: produce empty string instead of "class" in the PHP parser, following
13930 # the HTML5 spec.
13931 !! test
13932 div with empty attribute value, space before equals
13933 !! options
13934 parsoid
13935 !! wikitext
13936 <div class =>HTML rocks</div>
13937 !! html
13938 <div class="">HTML rocks</div>
13939
13940 !! end
13941
13942 !! test
13943 div with multiple empty attribute values
13944 !! options
13945 parsoid
13946 !! wikitext
13947 <div id= title=>HTML rocks</div>
13948 !! html
13949 <div id="" title="">HTML rocks</div>
13950
13951 !! end
13952
13953 !! test
13954 table with multiple empty attribute values
13955 !! options
13956 parsoid
13957 !! wikitext
13958 {| title= id=
13959 | hi
13960 |}
13961 !! html
13962 <table title="" id="">
13963 <tbody><tr><td> hi</td></tr>
13964 </tbody></table>
13965 !! end
13966
13967 !! test
13968 div with braces in attribute value
13969 !! wikitext
13970 <div title="{}">Foo</div>
13971 !! html/php
13972 <div title="&#123;}">Foo</div>
13973
13974 !! html/parsoid
13975 <div title="{}">Foo</div>
13976 !! end
13977
13978 # This it very inconsistent in the PHP parser: it returns
13979 # class="class" if there is a space between the name and the equal sign (see
13980 # 'div with empty attribute value, space before equals'), but strips the
13981 # attribute completely if the space is missing. We hope that not much content
13982 # depends on this, so are implementing the behavior below in Parsoid for
13983 # consistencies' sake.
13984 # FIXME: fix this behavior in the PHP parser?
13985 !! test
13986 div with empty attribute value, no space before equals
13987 !! options
13988 parsoid=wt2html,html2html
13989 !! wikitext
13990 <div class=>HTML rocks</div>
13991 !! html/php
13992 <div>HTML rocks</div>
13993
13994 !! html/parsoid
13995 <div class="">HTML rocks</div>
13996 !! end
13997
13998 !! test
13999 HTML multiple attributes correction
14000 !! wikitext
14001 <p class="error" class="awesome">Awesome!</p>
14002 !! html
14003 <p class="awesome">Awesome!</p>
14004
14005 !!end
14006
14007 !! test
14008 Table multiple attributes correction
14009 !! wikitext
14010 {|
14011 !+ class="error" class="awesome"| status
14012 |}
14013 !! html
14014 <table>
14015 <tr>
14016 <th class="awesome"> status
14017 </th></tr></table>
14018
14019 !!end
14020
14021 !! test
14022 DIV IN UPPERCASE
14023 !! wikitext
14024 <DIV ID="x">HTML ROCKS</DIV>
14025 !! html
14026 <div id="x">HTML ROCKS</div>
14027
14028 !!end
14029
14030 !! test
14031 Non-ASCII pseudo-tags are rendered as text
14032 !! wikitext
14033 <khyô>
14034 !! html
14035 <p>&lt;khyô&gt;
14036 </p>
14037 !! end
14038
14039 !! test
14040 Pseudo-tag with URL 'name' renders as url link
14041 !! wikitext
14042 <http://example.com/>
14043 !! html
14044 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14045 </p>
14046 !! end
14047
14048 !! test
14049 text with amp in the middle of nowhere
14050 !! wikitext
14051 Remember AT&T?
14052 !! html
14053 <p>Remember AT&amp;T?
14054 </p>
14055 !! end
14056
14057 !! test
14058 text with character entity: eacute
14059 !! wikitext
14060 I always thought &eacute; was a cute letter.
14061 !! html
14062 <p>I always thought &#233; was a cute letter.
14063 </p>
14064 !! html+tidy
14065 <p>I always thought é was a cute letter.</p>
14066 !! end
14067
14068 !! test
14069 text with entity-escaped character entity-like string: eacute
14070 !! wikitext
14071 I always thought &amp;eacute; was a cute letter.
14072 !! html
14073 <p>I always thought &amp;eacute; was a cute letter.
14074 </p>
14075 !! end
14076
14077 !! test
14078 text with undefined character entity: xacute
14079 !! wikitext
14080 I always thought &xacute; was a cute letter.
14081 !! html
14082 <p>I always thought &amp;xacute; was a cute letter.
14083 </p>
14084 !! end
14085
14086 # TODO: generalize to PHP parser?
14087 !! test
14088 HTML5 tags
14089 !! options
14090 parsoid
14091 !! wikitext
14092 <data value="5">five</data>
14093 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14094 <mark>This highlighted text</mark>
14095 !! html
14096 <p><data value="5">five</data>
14097 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14098 <mark>This highlighted text</mark></p>
14099 !! end
14100
14101 !! test
14102 HTML tag with leading space is parsed as text
14103 !! wikitext
14104 < div>foo< /div>
14105 !! html
14106 <p>&lt; div&gt;foo&lt; /div&gt;
14107 </p>
14108 !! end
14109
14110 ###
14111 ### Nesting tests (see bug 41545, 50604, 51081)
14112 ###
14113
14114 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14115 # Note that html2wt is considerably more difficult if we use <b> in
14116 # the test case, instead of <big>
14117 !! test
14118 Ensure that HTML adoption agency algorithm is properly implemented.
14119 !! wikitext
14120 <big>X<big>Y</big>Z</big>
14121 !! html
14122 <p><big>X<big>Y</big>Z</big>
14123 </p>
14124 !! end
14125
14126 # This was bug 41545 in the PHP parser.
14127 # Note that tidy doesn't handle this correctly.
14128 !! test
14129 Nesting of <kbd>
14130 !! wikitext
14131 <kbd>X<kbd>Y</kbd>Z</kbd>
14132 !! html
14133 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14134 </p>
14135 !! end
14136
14137 # The following cases were bug 51081 in the PHP parser.
14138 # Note that there are some other nestable tags (b, i, etc) which are
14139 # not covered; see bug 51081 for discussion.
14140
14141 # Note that tidy doesn't handle this correctly.
14142 !! test
14143 Nesting of <em>
14144 !! wikitext
14145 <em>X<em>Y</em>Z</em>
14146 !! html
14147 <p><em>X<em>Y</em>Z</em>
14148 </p>
14149 !! end
14150
14151 # Note that tidy doesn't handle this correctly.
14152 !! test
14153 Nesting of <strong>
14154 !! wikitext
14155 <strong>X<strong>Y</strong>Z</strong>
14156 !! html
14157 <p><strong>X<strong>Y</strong>Z</strong>
14158 </p>
14159 !! end
14160
14161 !! test
14162 Nesting of <q>
14163 !! wikitext
14164 <q>X<q>Y</q>Z</q>
14165 !! html+tidy
14166 <p><q>X<q>Y</q>Z</q></p>
14167 !! end
14168
14169 # Note that tidy doesn't handle this correctly.
14170 !! test
14171 Nesting of <ruby>
14172 !! wikitext
14173 <ruby>X<ruby>Y</ruby>Z</ruby>
14174 !! html
14175 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14176 </p>
14177 !! end
14178
14179 # Note that tidy doesn't handle this correctly.
14180 !! test
14181 Nesting of <bdo>
14182 !! wikitext
14183 <bdo>X<bdo>Y</bdo>Z</bdo>
14184 !! html
14185 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14186 </p>
14187 !! end
14188
14189
14190 ###
14191 ### Media links
14192 ###
14193
14194 !! test
14195 Media link
14196 !! wikitext
14197 [[Media:Foobar.jpg]]
14198 !! html
14199 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14200 </p>
14201 !! end
14202
14203 !! test
14204 Media link with text
14205 !! wikitext
14206 [[Media:Foobar.jpg|A neat file to look at]]
14207 !! html
14208 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14209 </p>
14210 !! end
14211
14212 # FIXME: this is still bad HTML tag nesting
14213 !! test
14214 Media link with nasty text
14215 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
14216 !! wikitext
14217 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14218 !! html
14219 <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>
14220
14221 !! html+tidy
14222 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a></p>
14223 !! end
14224
14225 !! test
14226 Media link to nonexistent file (bug 1702)
14227 !! wikitext
14228 [[Media:No such.jpg]]
14229 !! html
14230 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14231 </p>
14232 !! end
14233
14234 !! test
14235 Image link to nonexistent file (bug 1850 - good)
14236 !! wikitext
14237 [[File:No_such.jpg]]
14238 !! html/php
14239 <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>
14240 </p>
14241 !! html/parsoid
14242 <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>
14243 !! end
14244
14245 !! test
14246 :Image link to nonexistent file (bug 1850 - bad)
14247 !! wikitext
14248 [[:Image:No such.jpg]]
14249 !! html/php
14250 <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>
14251 </p>
14252 !! html/parsoid
14253 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14254 !! end
14255
14256
14257
14258 !! test
14259 Character reference normalization in link text (bug 1938)
14260 !! wikitext
14261 [[Main Page|this&that]]
14262 !! html
14263 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14264 </p>
14265 !!end
14266
14267 !! article
14268 אַ
14269 !! text
14270 Test for unicode normalization
14271
14272 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14273 !! endarticle
14274
14275 !! test
14276 (bug 19451) Links should refer to the normalized form.
14277 !! wikitext
14278 [[&#xFB2E;]]
14279 [[&#x5d0;&#x5b7;]]
14280 [[&#x5d0;ַ]]
14281 [[א&#x5b7;]]
14282 [[אַ]]
14283 !! html
14284 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14285 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14286 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14287 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14288 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14289 </p>
14290 !! end
14291
14292 !! test
14293 Empty attribute crash test (bug 2067)
14294 !! wikitext
14295 <font color="">foo</font>
14296 !! html
14297 <p><font color="">foo</font>
14298 </p>
14299 !! end
14300
14301 !! test
14302 Empty attribute crash test single-quotes (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 Attribute test: equals, then nothing
14312 !! wikitext
14313 <font color=>foo</font>
14314 !! html
14315 <p><font>foo</font>
14316 </p>
14317 !! end
14318
14319 !! test
14320 Attribute test: unquoted value
14321 !! wikitext
14322 <font color=x>foo</font>
14323 !! html
14324 <p><font color="x">foo</font>
14325 </p>
14326 !! end
14327
14328 !! test
14329 Attribute test: unquoted but illegal value (hash)
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: no value
14339 !! wikitext
14340 <font color>foo</font>
14341 !! html
14342 <p><font color="color">foo</font>
14343 </p>
14344 !! end
14345
14346 !! test
14347 Bug 2095: link with three closing brackets
14348 !! wikitext
14349 [[Main Page]]]
14350 !! html/php
14351 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14352 </p>
14353 !! html/parsoid
14354 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14355 !! end
14356
14357 !! test
14358 Bug 2095: link with pipe and three closing brackets
14359 !! wikitext
14360 [[Main Page|link]]]
14361 !! html/php
14362 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14363 </p>
14364 !! html/parsoid
14365 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14366 !! end
14367
14368 !! test
14369 Bug 2095: link with pipe and three closing brackets, version 2
14370 !! wikitext
14371 [[Main Page|[http://example.com/]]]
14372 !! html/php
14373 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14374 </p>
14375 !! html/parsoid
14376 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14377 !! end
14378
14379
14380 ###
14381 ### Safety
14382 ###
14383
14384 !! article
14385 Template:Dangerous attribute
14386 !! text
14387 " onmouseover="alert(document.cookie)
14388 !! endarticle
14389
14390 !! article
14391 Template:Dangerous style attribute
14392 !! text
14393 border-size: expression(alert(document.cookie))
14394 !! endarticle
14395
14396 !! article
14397 Template:Div style
14398 !! text
14399 <div style="float: right; {{{1}}}">Magic div</div>
14400 !! endarticle
14401
14402 !! test
14403 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14404 !! wikitext
14405 <div title="{{test}}"></div>
14406 !! html
14407 <div title="This is a test template"></div>
14408
14409 !! end
14410
14411 # Parsoid has enough context to handle this case
14412 !! test
14413 Bug 2304: HTML attribute safety (dangerous template; 2309)
14414 !! wikitext
14415 <div title="{{dangerous attribute}}"></div>
14416 !! html/php
14417 <div title=""></div>
14418
14419 !! html/parsoid
14420 <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>
14421 !! end
14422
14423 !! test
14424 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14425 !! wikitext
14426 <div style="{{dangerous style attribute}}"></div>
14427 !! html
14428 <div style="/* insecure input */"></div>
14429
14430 !! end
14431
14432 !! test
14433 Bug 2304: HTML attribute safety (safe parameter; 2309)
14434 !! wikitext
14435 {{div style|width: 200px}}
14436 !! html
14437 <div style="float: right; width: 200px">Magic div</div>
14438
14439 !! end
14440
14441 !! test
14442 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14443 !! wikitext
14444 {{div style|width: expression(alert(document.cookie))}}
14445 !! html
14446 <div style="/* insecure input */">Magic div</div>
14447
14448 !! end
14449
14450 !! test
14451 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14452 !! wikitext
14453 {{div style|"><script>alert(document.cookie)</script>}}
14454 !! html
14455 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14456
14457 !! end
14458
14459 !! test
14460 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 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 (link)
14470 !! wikitext
14471 <div title="[[Main Page]]"></div>
14472 !! html
14473 <div title="&#91;&#91;Main Page]]"></div>
14474
14475 !! end
14476
14477 !! test
14478 Bug 2304: HTML attribute safety (italics)
14479 !! wikitext
14480 <div title="''foobar''"></div>
14481 !! html
14482 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14483
14484 !! end
14485
14486 !! test
14487 Bug 2304: HTML attribute safety (bold)
14488 !! wikitext
14489 <div title="'''foobar'''"></div>
14490 !! html
14491 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14492
14493 !! end
14494
14495
14496 !! test
14497 Bug 2304: HTML attribute safety (ISBN)
14498 !! wikitext
14499 <div title="ISBN 1234567890"></div>
14500 !! html
14501 <div title="&#73;SBN 1234567890"></div>
14502
14503 !! end
14504
14505 !! test
14506 Bug 2304: HTML attribute safety (RFC)
14507 !! wikitext
14508 <div title="RFC 1234"></div>
14509 !! html
14510 <div title="&#82;FC 1234"></div>
14511
14512 !! end
14513
14514 !! test
14515 Bug 2304: HTML attribute safety (PMID)
14516 !! wikitext
14517 <div title="PMID 1234567890"></div>
14518 !! html
14519 <div title="&#80;MID 1234567890"></div>
14520
14521 !! end
14522
14523 !! test
14524 Bug 2304: HTML attribute safety (web link)
14525 !! wikitext
14526 <div title="http://example.com/"></div>
14527 !! html
14528 <div title="http&#58;//example.com/"></div>
14529
14530 !! end
14531
14532 !! test
14533 Bug 2304: HTML attribute safety (named web link)
14534 !! wikitext
14535 <div title="[http://example.com/ link]"></div>
14536 !! html
14537 <div title="&#91;http&#58;//example.com/ link]"></div>
14538
14539 !! end
14540
14541 !! test
14542 Bug 3244: HTML attribute safety (extension; safe)
14543 !! wikitext
14544 <div style="<nowiki>background:blue</nowiki>"></div>
14545 !! html
14546 <div style="background:blue"></div>
14547
14548 !! end
14549
14550 !! test
14551 Bug 3244: HTML attribute safety (extension; unsafe)
14552 !! wikitext
14553 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14554 !! html
14555 <div style="/* insecure input */"></div>
14556
14557 !! end
14558
14559 # More MSIE fun discovered by Tom Gilder
14560
14561 !! test
14562 MSIE CSS safety test: spurious slash
14563 !! wikitext
14564 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14565 !! html
14566 <div style="/* insecure input */">evil</div>
14567
14568 !! end
14569
14570 !! test
14571 MSIE CSS safety test: hex code
14572 !! wikitext
14573 <div style="background-image:u\72l(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: comment in url
14581 !! wikitext
14582 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14583 !! html
14584 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14585
14586 !! end
14587
14588 !! test
14589 MSIE CSS safety test: comment in expression
14590 !! wikitext
14591 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14592 !! html
14593 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14594
14595 !! end
14596
14597 !! test
14598 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14599 !! wikitext
14600 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14601 !! html
14602 <p style="/* invalid control char */">A</p>
14603
14604 !! end
14605
14606 !! test
14607 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14608 !! wikitext
14609 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14610 <div style="top:EXPRESSION(alert())">B</div>
14611 !! html
14612 <p style="/* insecure input */">A</p>
14613 <div style="/* insecure input */">B</div>
14614
14615 !! end
14616
14617 !! test
14618 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14619 !! wikitext
14620 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14621 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14622 !! html
14623 <div style="/* insecure input */">A</div>
14624 <p style="/* insecure input */">B</p>
14625
14626 !! end
14627
14628 !! test
14629 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14630 !! wikitext
14631 <div style="background-image:url⁽javascript:alert())">A</div>
14632 <div style="background-image:url₍javascript:alert())">B</div>
14633 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14634 !! html
14635 <div style="/* insecure input */">A</div>
14636 <div style="/* insecure input */">B</div>
14637 <p style="/* insecure input */">C</p>
14638
14639 !! end
14640
14641 !! test
14642 Opera -o-link CSS
14643 !! wikitext
14644 <div
14645 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;"
14646 style="-o-link:attr(title);-o-link-source:current">X</div>
14647 !! html
14648 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14649
14650 !! end
14651
14652 !! test
14653 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14654 !! wikitext
14655 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14656 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14657 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14658 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14659 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14660 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14661 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14662 !! html
14663 <p style="/* insecure input */">A</p>
14664 <p style="/* insecure input */">B</p>
14665 <p style="/* insecure input */">C</p>
14666 <p style="/* insecure input */">D</p>
14667 <p style="/* insecure input */">E</p>
14668 <p style="/* insecure input */">F</p>
14669 <p style="/* insecure input */">G</p>
14670
14671 !! end
14672
14673 !! test
14674 Table attribute legitimate extension
14675 !! wikitext
14676 {|
14677 !+ style="<nowiki>color:blue</nowiki>"| status
14678 |}
14679 !! html
14680 <table>
14681 <tr>
14682 <th style="color:blue"> status
14683 </th></tr></table>
14684
14685 !!end
14686
14687 !! test
14688 Table attribute safety
14689 !! wikitext
14690 {|
14691 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14692 |}
14693 !! html
14694 <table>
14695 <tr>
14696 <th style="/* insecure input */"> status
14697 </th></tr></table>
14698
14699 !! end
14700
14701 !! test
14702 CSS line continuation 1
14703 !! wikitext
14704 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14705 !! html
14706 <div style="/* insecure input */"></div>
14707
14708 !! end
14709
14710 !! test
14711 CSS line continuation 2
14712 !! wikitext
14713 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14714 !! html
14715 <div style="/* insecure input */"></div>
14716
14717 !! end
14718
14719 !! article
14720 Template:Identity
14721 !! text
14722 {{{1}}}
14723 !! endarticle
14724
14725 !! test
14726 Expansion of multi-line templates in attribute values (bug 6255)
14727 !! wikitext
14728 <div style="background: {{identity|#00FF00}}">-</div>
14729 !! html
14730 <div style="background: #00FF00">-</div>
14731
14732 !! end
14733
14734
14735 !! test
14736 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14737 !! wikitext
14738 <div style="background:
14739 #00FF00">-</div>
14740 !! html/php
14741 <div style="background: #00FF00">-</div>
14742
14743 !! html/parsoid
14744 <div style="background:
14745 #00FF00">-</div>
14746 !! end
14747
14748 !! test
14749 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14750 !! wikitext
14751 <div style="background: &#10;#00FF00">-</div>
14752 !! html
14753 <div style="background: &#10;#00FF00">-</div>
14754
14755 !! end
14756
14757 !! test
14758 evil <math>-wiki-tags without Extension:Math enabled
14759 !! wikitext
14760 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14761 !! html+tidy
14762 <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>
14763 !! end
14764
14765 ###
14766 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14767 ###
14768 !! test
14769 Parser hook: empty input
14770 !! wikitext
14771 <tag></tag>
14772 !! html
14773 <pre>
14774 ''
14775 array (
14776 )
14777 </pre>
14778
14779 !! end
14780
14781 !! test
14782 Parser hook: empty input using terminated empty elements
14783 !! wikitext
14784 <tag/>
14785 !! html
14786 <pre>
14787 NULL
14788 array (
14789 )
14790 </pre>
14791
14792 !! end
14793
14794 !! test
14795 Parser hook: empty input using terminated empty elements (space before)
14796 !! wikitext
14797 <tag />
14798 !! html
14799 <pre>
14800 NULL
14801 array (
14802 )
14803 </pre>
14804
14805 !! end
14806
14807 !! test
14808 Parser hook: basic input
14809 !! wikitext
14810 <tag>input</tag>
14811 !! html
14812 <pre>
14813 'input'
14814 array (
14815 )
14816 </pre>
14817
14818 !! end
14819
14820
14821 !! test
14822 Parser hook: case insensitive
14823 !! wikitext
14824 <TAG>input</TAG>
14825 !! html
14826 <pre>
14827 'input'
14828 array (
14829 )
14830 </pre>
14831
14832 !! end
14833
14834
14835 !! test
14836 Parser hook: case insensitive, redux
14837 !! wikitext
14838 <TaG>input</TAg>
14839 !! html
14840 <pre>
14841 'input'
14842 array (
14843 )
14844 </pre>
14845
14846 !! end
14847
14848 !! test
14849 Parser hook: nested tags
14850 !! options
14851 noxml
14852 !! wikitext
14853 <tag><tag></tag></tag>
14854 !! html
14855 <pre>
14856 '<tag>'
14857 array (
14858 )
14859 </pre>&lt;/tag&gt;
14860
14861 !! end
14862
14863 !! test
14864 Parser hook: basic arguments
14865 !! wikitext
14866 <tag width=200 height = "100" depth = '50' square></tag>
14867 !! html
14868 <pre>
14869 ''
14870 array (
14871 'width' => '200',
14872 'height' => '100',
14873 'depth' => '50',
14874 'square' => 'square',
14875 )
14876 </pre>
14877
14878 !! end
14879
14880 !! test
14881 Parser hook: argument containing a forward slash (bug 5344)
14882 !! wikitext
14883 <tag filename='/tmp/bla'></tag>
14884 !! html
14885 <pre>
14886 ''
14887 array (
14888 'filename' => '/tmp/bla',
14889 )
14890 </pre>
14891
14892 !! end
14893
14894 !! test
14895 Parser hook: empty input using terminated empty elements (bug 2374)
14896 !! wikitext
14897 <tag foo=bar/>text
14898 !! html
14899 <pre>
14900 NULL
14901 array (
14902 'foo' => 'bar',
14903 )
14904 </pre>text
14905
14906 !! end
14907
14908 # </tag> should be output literally since there is no matching tag that begins it
14909 !! test
14910 Parser hook: basic arguments using terminated empty elements (bug 2374)
14911 !! wikitext
14912 <tag width=200 height = "100" depth = '50' square/>
14913 other stuff
14914 </tag>
14915 !! html
14916 <pre>
14917 NULL
14918 array (
14919 'width' => '200',
14920 'height' => '100',
14921 'depth' => '50',
14922 'square' => 'square',
14923 )
14924 </pre>
14925 <p>other stuff
14926 &lt;/tag&gt;
14927 </p>
14928 !! end
14929
14930 ###
14931 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14932 ###
14933
14934 !! test
14935 Parser hook: static parser hook not inside a comment
14936 !! wikitext
14937 <statictag>hello, world</statictag>
14938 <statictag action=flush/>
14939 !! html
14940 <p>hello, world
14941 </p>
14942 !! end
14943
14944
14945 !! test
14946 Parser hook: static parser hook inside a comment
14947 !! wikitext
14948 <!-- <statictag>hello, world</statictag> -->
14949 <statictag action=flush/>
14950 !! html
14951 <p><br />
14952 </p>
14953 !! end
14954
14955 # Nested template calls; this case was broken by Parser.php rev 1.506,
14956 # since reverted.
14957
14958 !! article
14959 Template:One-parameter
14960 !! text
14961 (My parameter is: {{{1}}})
14962 !! endarticle
14963
14964 !! article
14965 Template:Map-one-parameter
14966 !! text
14967 {{{{{1}}}|{{{2}}}}}
14968 !! endarticle
14969
14970 !! test
14971 Nested template calls
14972 !! wikitext
14973 {{Map-one-parameter|One-parameter|param}}
14974 !! html
14975 <p>(My parameter is: param)
14976 </p>
14977 !! end
14978
14979
14980 ###
14981 ### Sanitizer
14982 ###
14983
14984 # HTML+Tidy effectively strips out the empty tags completely
14985 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14986 # which Tidy would have done for the PHP parser had there been content inside it.
14987 !! test
14988 Sanitizer: Closing of open tags
14989 !! wikitext
14990 <s></s><table></table>
14991 !! html
14992 <s></s><table></table>
14993
14994 !! html/parsoid
14995 <p><s></s></p><table></table>
14996 !! end
14997
14998 !! test
14999 Sanitizer: Closing of open but not closed tags
15000 !! wikitext
15001 <s>foo
15002 !! html
15003 <p><s>foo</s>
15004 </p>
15005 !! end
15006
15007 !! test
15008 Sanitizer: Closing of closed but not open tags
15009 !! wikitext
15010 </s>
15011 !! html
15012 <p>&lt;/s&gt;
15013 </p>
15014 !! end
15015
15016 !! test
15017 Sanitizer: Closing of closed but not open table tags
15018 !! wikitext
15019 Table not started</td></tr></table>
15020 !! html
15021 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15022 </p>
15023 !! end
15024
15025 !! test
15026 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15027 !! wikitext
15028 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15029 !! html
15030 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15031 </p>
15032 !! end
15033
15034 # In HTML5, the restrictions are that id must contain at least one character,
15035 # and must not contain any space characters.
15036 !! test
15037 Sanitizer: Validating the contents of the id attribute (bug 4515)
15038 !! options
15039 disabled
15040 !! wikitext
15041 <br id="" /><br id="a space" />
15042 !! html
15043 Something ...
15044 !! end
15045
15046 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15047 !! test
15048 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15049 !! options
15050 disabled
15051 !! wikitext
15052 <br id="foo" /><br id="foo" />
15053 !! html
15054 Something need to be done. foo-2 ?
15055 !! end
15056
15057 !! test
15058 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15059 !! wikitext
15060 <div itemscope>
15061 <meta itemprop="hello" content="world">
15062 <meta http-equiv="refresh" content="5">
15063 <meta itemprop="hello" http-equiv="refresh" content="5">
15064 <link itemprop="hello" href="{{SERVER}}">
15065 <link rel="stylesheet" href="{{SERVER}}">
15066 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15067 </div>
15068 !! html
15069 <div itemscope="itemscope">
15070 <p> <meta itemprop="hello" content="world" />
15071 &lt;meta http-equiv="refresh" content="5"&gt;
15072 <meta itemprop="hello" content="5" />
15073 </p>
15074 <link itemprop="hello" href="http&#58;//example.org" />
15075 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15076 <link itemprop="hello" href="http&#58;//example.org" />
15077 </div>
15078
15079 !! end
15080
15081 !! test
15082 Language converter: output gets cut off unexpectedly (bug 5757)
15083 !! options
15084 language=zh
15085 !! wikitext
15086 this bit is safe: }-
15087
15088 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15089
15090 then we get cut off here: }-
15091
15092 all additional text is vanished
15093 !! html
15094 <p>this bit is safe: }-
15095 </p><p>but if we add a conversion instance: xxx
15096 </p><p>then we get cut off here: }-
15097 </p><p>all additional text is vanished
15098 </p>
15099 !! end
15100
15101 !! test
15102 Self closed html pairs (bug 5487)
15103 !! options
15104 !! wikitext
15105 <center><font id="bug" />Centered text</center>
15106 <div><font id="bug2" />In div text</div>
15107 !! html
15108 <center>&lt;font id="bug" /&gt;Centered text</center>
15109 <div>&lt;font id="bug2" /&gt;In div text</div>
15110
15111 !! end
15112
15113 #
15114 #
15115 #
15116
15117 !! test
15118 Punctuation: nbsp before exclamation
15119 !! wikitext
15120 C'est grave !
15121 !! html
15122 <p>C'est grave&#160;!
15123 </p>
15124 !! end
15125
15126 !! test
15127 Punctuation: CSS !important (bug 11874)
15128 !! wikitext
15129 <div style="width:50% !important">important</div>
15130 !! html
15131 <div style="width:50% !important">important</div>
15132
15133 !!end
15134
15135 !! test
15136 Punctuation: CSS ! important (bug 11874; with space after)
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 HTML bullet list, closed tags (bug 5497)
15146 !! wikitext
15147 <ul>
15148 <li>One</li>
15149 <li>Two</li>
15150 </ul>
15151 !! html/php
15152 <ul>
15153 <li>One</li>
15154 <li>Two</li>
15155 </ul>
15156
15157 !! html/parsoid
15158 <ul data-parsoid='{"stx":"html"}'>
15159 <li data-parsoid='{"stx":"html"}'>One</li>
15160 <li data-parsoid='{"stx":"html"}'>Two</li>
15161 </ul>
15162
15163 !! end
15164
15165 !! test
15166 HTML bullet list, unclosed tags (bug 5497)
15167 !! wikitext
15168 <ul>
15169 <li>One
15170 <li>Two
15171 </ul>
15172 !! html/php+tidy
15173 <ul>
15174 <li>One</li>
15175 <li>Two</li>
15176 </ul>
15177 !! html/parsoid
15178 <ul data-parsoid='{"stx":"html"}'>
15179 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15180 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15181 </ul>
15182
15183 !! end
15184
15185 !! test
15186 HTML ordered list, closed tags (bug 5497)
15187 !! wikitext
15188 <ol>
15189 <li>One</li>
15190 <li>Two</li>
15191 </ol>
15192 !! html/php
15193 <ol>
15194 <li>One</li>
15195 <li>Two</li>
15196 </ol>
15197
15198 !! html/parsoid
15199 <ol data-parsoid='{"stx":"html"}'>
15200 <li data-parsoid='{"stx":"html"}'>One</li>
15201 <li data-parsoid='{"stx":"html"}'>Two</li>
15202 </ol>
15203
15204 !! end
15205
15206 !! test
15207 HTML ordered list, unclosed tags (bug 5497)
15208 !! options
15209 !! wikitext
15210 <ol>
15211 <li>One
15212 <li>Two
15213 </ol>
15214 !! html/php+tidy
15215 <ol>
15216 <li>One</li>
15217 <li>Two</li>
15218 </ol>
15219 !! html/parsoid
15220 <ol data-parsoid='{"stx":"html"}'>
15221 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15222 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15223 </ol>
15224
15225 !! end
15226
15227 !! test
15228 HTML nested bullet list, closed tags (bug 5497)
15229 !! wikitext
15230 <ul>
15231 <li>One</li>
15232 <li>Two:
15233 <ul>
15234 <li>Sub-one</li>
15235 <li>Sub-two</li>
15236 </ul>
15237 </li>
15238 </ul>
15239 !! html
15240 <ul>
15241 <li>One</li>
15242 <li>Two:
15243 <ul>
15244 <li>Sub-one</li>
15245 <li>Sub-two</li>
15246 </ul>
15247 </li>
15248 </ul>
15249
15250 !! end
15251
15252 !! test
15253 HTML nested bullet list, open tags (bug 5497)
15254 !! wikitext
15255 <ul>
15256 <li>One
15257 <li>Two:
15258 <ul>
15259 <li>Sub-one
15260 <li>Sub-two
15261 </ul>
15262 </ul>
15263 !! html/php+tidy
15264 <ul>
15265 <li>One</li>
15266 <li>Two:
15267 <ul>
15268 <li>Sub-one</li>
15269 <li>Sub-two</li>
15270 </ul>
15271 </li>
15272 </ul>
15273 !! html/parsoid
15274 <ul>
15275 <li>One
15276 </li>
15277 <li>Two:
15278 <ul>
15279 <li>Sub-one
15280 </li>
15281 <li>Sub-two
15282 </li>
15283 </ul>
15284 </li>
15285 </ul>
15286
15287 !! end
15288
15289 !! test
15290 HTML nested ordered list, closed tags (bug 5497)
15291 !! wikitext
15292 <ol>
15293 <li>One</li>
15294 <li>Two:
15295 <ol>
15296 <li>Sub-one</li>
15297 <li>Sub-two</li>
15298 </ol>
15299 </li>
15300 </ol>
15301 !! html
15302 <ol>
15303 <li>One</li>
15304 <li>Two:
15305 <ol>
15306 <li>Sub-one</li>
15307 <li>Sub-two</li>
15308 </ol>
15309 </li>
15310 </ol>
15311
15312 !! end
15313
15314 !! test
15315 HTML nested ordered list, open tags (bug 5497)
15316 !! wikitext
15317 <ol>
15318 <li>One
15319 <li>Two:
15320 <ol>
15321 <li>Sub-one
15322 <li>Sub-two
15323 </ol>
15324 </ol>
15325 !! html/php
15326 <ol>
15327 <li>One
15328 <li>Two:
15329 <ol>
15330 <li>Sub-one
15331 <li>Sub-two
15332 </ol>
15333 </ol>
15334
15335 !! html/parsoid
15336 <ol>
15337 <li>One
15338 </li>
15339 <li>Two:
15340 <ol>
15341 <li>Sub-one
15342 </li>
15343 <li>Sub-two
15344 </li>
15345 </ol>
15346 </li>
15347 </ol>
15348
15349 !! end
15350
15351 !! test
15352 HTML ordered list item with parameters oddity
15353 !! wikitext
15354 <ol><li id="fragment">One</li>
15355 </ol>
15356 !! html
15357 <ol><li id="fragment">One</li>
15358 </ol>
15359
15360 !! end
15361
15362 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15363 !!test
15364 bug 5918: autonumbering
15365 !! wikitext
15366 [http://first/] [http://second] [ftp://ftp]
15367
15368 ftp://inlineftp
15369
15370 [mailto:enclosed@mail.tld With target]
15371
15372 [mailto:enclosed@mail.tld]
15373
15374 mailto:inline@mail.tld
15375 !! html/php
15376 <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>
15377 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15378 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15379 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15380 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15381 </p>
15382 !! html/parsoid
15383 <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>
15384 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15385 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15386 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15387 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15388 !! end
15389
15390
15391 #
15392 # Security and HTML correctness
15393 # From Nick Jenkins' fuzz testing
15394 #
15395
15396 !! test
15397 Fuzz testing: Parser13
15398 !! wikitext
15399 {|
15400 | http://a|
15401 !! html
15402 <table>
15403 <tr>
15404 <td>
15405 </td>
15406 </tr>
15407 </table>
15408
15409 !! end
15410
15411 !! test
15412 Fuzz testing: Parser14
15413 !! wikitext
15414 == onmouseover= ==
15415 http://__TOC__
15416 !! html
15417 <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>
15418 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15419 <ul>
15420 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15421 </ul>
15422 </div>
15423
15424
15425 !! html+tidy
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 <p>http://</p>
15428 <div id="toc" class="toc">
15429 <div id="toctitle">
15430 <h2>Contents</h2>
15431 </div>
15432 <ul>
15433 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15434 </ul>
15435 </div>
15436 !! end
15437
15438 !! test
15439 Fuzz testing: Parser14-table
15440 !! wikitext
15441 ==a==
15442 {| STYLE=__TOC__
15443 !! html
15444 <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>
15445 <table style="&#95;_TOC&#95;_">
15446 <tr><td></td></tr>
15447 </table>
15448
15449 !! html+tidy
15450 <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>
15451 <table style="__TOC__">
15452 <tr>
15453 <td></td>
15454 </tr>
15455 </table>
15456 !! end
15457
15458 # Known to produce bogus xml (extra </td>)
15459 !! test
15460 Fuzz testing: Parser16
15461 !! options
15462 noxml
15463 !! wikitext
15464 {|
15465 !https://||||||
15466 !! html
15467 <table>
15468 <tr>
15469 <th>https://</th>
15470 <th></th>
15471 <th></th>
15472 <th>
15473 </td>
15474 </tr>
15475 </table>
15476
15477 !! html+tidy
15478 <table>
15479 <tr>
15480 <th>https://</th>
15481 <th></th>
15482 <th></th>
15483 <th></th>
15484 </tr>
15485 </table>
15486 !! end
15487
15488 !! test
15489 Fuzz testing: Parser21
15490 !! wikitext
15491 {|
15492 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15493 |
15494 !! html
15495 <table>
15496 <tr>
15497 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15498 </th>
15499 <td>
15500 </td>
15501 </tr>
15502 </table>
15503
15504 !! end
15505
15506 !! test
15507 Fuzz testing: Parser22
15508 !! wikitext
15509 http://===r:::https://b
15510
15511 {|
15512 !! html
15513 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15514 </p>
15515 <table>
15516 <tr><td></td></tr>
15517 </table>
15518
15519 !! end
15520
15521 # Known to produce bad XML for now
15522 !! test
15523 Fuzz testing: Parser24
15524 !! options
15525 noxml
15526 !! wikitext
15527 {|
15528 {{{|
15529 <u CLASS=
15530 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15531 <br style="onmouseover='alert(document.cookie);' " />
15532
15533 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15534 |
15535 !! html
15536 <table>
15537 {{{|
15538 <u class="&#124;">}}}} &gt;
15539 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15540
15541 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15542 <tr>
15543 <td></u>
15544 </td>
15545 </tr>
15546 </table>
15547
15548 !! end
15549
15550 # Note: the current result listed for this is not what the original one was,
15551 # but the original bug was JavaScript injection, which is fixed in any case.
15552 # It's not clear that the original result listed was any more correct than the
15553 # current one. Original result:
15554 # <p>{{{|
15555 # </p>
15556 # <li class="&#124;&#124;">
15557 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15558 !!test
15559 Fuzz testing: Parser25 (bug 6055)
15560 !! wikitext
15561 {{{
15562 |
15563 <LI CLASS=||
15564 >
15565 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15566 !! html
15567 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15568 </p>
15569 !! end
15570
15571 !!test
15572 Fuzz testing: URL adjacent extension (with space, clean)
15573 !! wikitext
15574 http://example.com <nowiki>junk</nowiki>
15575 !! html/php
15576 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15577 </p>
15578 !! html/parsoid
15579 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15580 !! end
15581
15582 !!test
15583 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15584 !! wikitext
15585 http://example.com<nowiki>junk</nowiki>
15586 !! html/php
15587 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15588 </p>
15589 !! html/parsoid
15590 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15591 !! end
15592
15593 !!test
15594 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15595 !! wikitext
15596 http://example.com<pre>junk</pre>
15597 !! html/php
15598 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15599
15600 !! html/php+tidy
15601 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15602 <pre>
15603 junk
15604 </pre>
15605 !! html/parsoid
15606 <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>
15607 !!end
15608
15609 !!test
15610 Fuzz testing: image with bogus manual thumbnail
15611 !! wikitext
15612 [[Image:foobar.jpg|thumbnail= ]]
15613 !! html/php
15614 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15615
15616 !! html/parsoid
15617 <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>
15618 !!end
15619
15620 !! test
15621 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15622 !! wikitext
15623 <pre dir="&#10;"></pre>
15624 !! html
15625 <pre dir="&#10;"></pre>
15626
15627 !! end
15628
15629 !! test
15630 Parsing optional HTML elements (Bug 6171)
15631 !! options
15632 !! wikitext
15633 <table>
15634 <tr>
15635 <td> Some tabular data</td>
15636 <td> More tabular data ...
15637 <td> And yet som tabular data</td>
15638 </tr>
15639 </table>
15640 !! html
15641 <table>
15642 <tr>
15643 <td> Some tabular data</td>
15644 <td> More tabular data ...
15645 </td><td> And yet som tabular data</td>
15646 </tr>
15647 </table>
15648
15649 !! end
15650
15651 !! test
15652 Correct handling of <td>, <tr> (Bug 6171)
15653 !! options
15654 !! wikitext
15655 <table>
15656 <tr>
15657 <td> Some tabular data</td>
15658 <td> More tabular data ...</td>
15659 <td> And yet som tabular data</td>
15660 </tr>
15661 </table>
15662 !! html
15663 <table>
15664 <tr>
15665 <td> Some tabular data</td>
15666 <td> More tabular data ...</td>
15667 <td> And yet som tabular data</td>
15668 </tr>
15669 </table>
15670
15671 !! end
15672
15673
15674 !! test
15675 Parsing crashing regression (fr:JavaScript)
15676 !! wikitext
15677 </body></x>
15678 !! html
15679 <p>&lt;/body&gt;&lt;/x&gt;
15680 </p>
15681 !! end
15682
15683 !! test
15684 Inline wiki vs wiki block nesting
15685 !! wikitext
15686 '''Bold paragraph
15687
15688 New wiki paragraph
15689 !! html
15690 <p><b>Bold paragraph</b>
15691 </p><p>New wiki paragraph
15692 </p>
15693 !! end
15694
15695 # FIXME: The current php output is documented
15696 # and desired output is the parsoid target.
15697 !! test
15698 Inline HTML vs wiki block nesting
15699 !! wikitext
15700 <b>Bold paragraph
15701
15702 New wiki paragraph
15703 !! html/php
15704 <p><b>Bold paragraph
15705 </p><p>New wiki paragraph</b>
15706 </p>
15707 !! html/parsoid
15708 <p><b>Bold paragraph</b>
15709 </p><p>New wiki paragraph
15710 </p>
15711 !! end
15712
15713 # Original result was this:
15714 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15715 # </p>
15716 # While that might be marginally more intuitive, maybe, the six-apostrophe
15717 # construct is clearly pathological and the result stated here (which is what
15718 # the parser actually does) is about as reasonable as anything.
15719 !!test
15720 Mixing markup for italics and bold
15721 !! options
15722 !! wikitext
15723 '''bold''''''bold''bolditalics'''''
15724 !! html
15725 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15726 </p>
15727 !! end
15728
15729
15730 !! article
15731 Xyzzyx
15732 !! text
15733 Article for special page transclusion test
15734 !! endarticle
15735
15736 !! test
15737 Special page transclusion
15738 !! options
15739 !! wikitext
15740 {{Special:Prefixindex/Xyzzyx}}
15741 !! html
15742 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15743
15744 !! end
15745
15746 !! test
15747 Special page transclusion twice (bug 5021)
15748 !! options
15749 !! wikitext
15750 {{Special:Prefixindex/Xyzzyx}}
15751 {{Special:Prefixindex/Xyzzyx}}
15752 !! html
15753 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15754 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15755
15756 !! end
15757
15758 !! test
15759 Transclusion of default MediaWiki message
15760 !! wikitext
15761 {{MediaWiki:Mainpage}}
15762 !! html
15763 <p>Main Page
15764 </p>
15765 !! end
15766
15767 !! test
15768 Transclusion of nonexistent MediaWiki message
15769 !! wikitext
15770 {{MediaWiki:Mainpagexxx}}
15771 !! html
15772 <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>
15773 </p>
15774 !! end
15775
15776 !! test
15777 Transclusion of MediaWiki message with underscore
15778 !! wikitext
15779 {{MediaWiki:history_short}}
15780 !! html
15781 <p>History
15782 </p>
15783 !! end
15784
15785 !! test
15786 Transclusion of MediaWiki message with space
15787 !! wikitext
15788 {{MediaWiki:history short}}
15789 !! html
15790 <p>History
15791 </p>
15792 !! end
15793
15794 !! test
15795 Invalid header with following text
15796 !! wikitext
15797 = x = y
15798 !! html
15799 <p>= x = y
15800 </p>
15801 !! end
15802
15803
15804 !! test
15805 Section extraction test (section 0)
15806 !! options
15807 section=0
15808 !! wikitext
15809 start
15810 ==a==
15811 ===aa===
15812 ====aaa====
15813 ==b==
15814 ===ba===
15815 ===bb===
15816 ====bba====
15817 ===bc===
15818 ==c==
15819 ===ca===
15820 !! html
15821 start
15822 !! end
15823
15824 !! test
15825 Section extraction test (section 1)
15826 !! options
15827 section=1
15828 !! wikitext
15829 start
15830 ==a==
15831 ===aa===
15832 ====aaa====
15833 ==b==
15834 ===ba===
15835 ===bb===
15836 ====bba====
15837 ===bc===
15838 ==c==
15839 ===ca===
15840 !! html
15841 ==a==
15842 ===aa===
15843 ====aaa====
15844 !! end
15845
15846 !! test
15847 Section extraction test (section 2)
15848 !! options
15849 section=2
15850 !! wikitext
15851 start
15852 ==a==
15853 ===aa===
15854 ====aaa====
15855 ==b==
15856 ===ba===
15857 ===bb===
15858 ====bba====
15859 ===bc===
15860 ==c==
15861 ===ca===
15862 !! html
15863 ===aa===
15864 ====aaa====
15865 !! end
15866
15867 !! test
15868 Section extraction test (section 3)
15869 !! options
15870 section=3
15871 !! wikitext
15872 start
15873 ==a==
15874 ===aa===
15875 ====aaa====
15876 ==b==
15877 ===ba===
15878 ===bb===
15879 ====bba====
15880 ===bc===
15881 ==c==
15882 ===ca===
15883 !! html
15884 ====aaa====
15885 !! end
15886
15887 !! test
15888 Section extraction test (section 4)
15889 !! options
15890 section=4
15891 !! wikitext
15892 start
15893 ==a==
15894 ===aa===
15895 ====aaa====
15896 ==b==
15897 ===ba===
15898 ===bb===
15899 ====bba====
15900 ===bc===
15901 ==c==
15902 ===ca===
15903 !! html
15904 ==b==
15905 ===ba===
15906 ===bb===
15907 ====bba====
15908 ===bc===
15909 !! end
15910
15911 !! test
15912 Section extraction test (section 5)
15913 !! options
15914 section=5
15915 !! wikitext
15916 start
15917 ==a==
15918 ===aa===
15919 ====aaa====
15920 ==b==
15921 ===ba===
15922 ===bb===
15923 ====bba====
15924 ===bc===
15925 ==c==
15926 ===ca===
15927 !! html
15928 ===ba===
15929 !! end
15930
15931 !! test
15932 Section extraction test (section 6)
15933 !! options
15934 section=6
15935 !! wikitext
15936 start
15937 ==a==
15938 ===aa===
15939 ====aaa====
15940 ==b==
15941 ===ba===
15942 ===bb===
15943 ====bba====
15944 ===bc===
15945 ==c==
15946 ===ca===
15947 !! html
15948 ===bb===
15949 ====bba====
15950 !! end
15951
15952 !! test
15953 Section extraction test (section 7)
15954 !! options
15955 section=7
15956 !! wikitext
15957 start
15958 ==a==
15959 ===aa===
15960 ====aaa====
15961 ==b==
15962 ===ba===
15963 ===bb===
15964 ====bba====
15965 ===bc===
15966 ==c==
15967 ===ca===
15968 !! html
15969 ====bba====
15970 !! end
15971
15972 !! test
15973 Section extraction test (section 8)
15974 !! options
15975 section=8
15976 !! wikitext
15977 start
15978 ==a==
15979 ===aa===
15980 ====aaa====
15981 ==b==
15982 ===ba===
15983 ===bb===
15984 ====bba====
15985 ===bc===
15986 ==c==
15987 ===ca===
15988 !! html
15989 ===bc===
15990 !! end
15991
15992 !! test
15993 Section extraction test (section 9)
15994 !! options
15995 section=9
15996 !! wikitext
15997 start
15998 ==a==
15999 ===aa===
16000 ====aaa====
16001 ==b==
16002 ===ba===
16003 ===bb===
16004 ====bba====
16005 ===bc===
16006 ==c==
16007 ===ca===
16008 !! html
16009 ==c==
16010 ===ca===
16011 !! end
16012
16013 !! test
16014 Section extraction test (section 10)
16015 !! options
16016 section=10
16017 !! wikitext
16018 start
16019 ==a==
16020 ===aa===
16021 ====aaa====
16022 ==b==
16023 ===ba===
16024 ===bb===
16025 ====bba====
16026 ===bc===
16027 ==c==
16028 ===ca===
16029 !! html
16030 ===ca===
16031 !! end
16032
16033 !! test
16034 Section extraction test (nonexistent section 11)
16035 !! options
16036 section=11
16037 !! wikitext
16038 start
16039 ==a==
16040 ===aa===
16041 ====aaa====
16042 ==b==
16043 ===ba===
16044 ===bb===
16045 ====bba====
16046 ===bc===
16047 ==c==
16048 ===ca===
16049 !! html
16050 !! end
16051
16052 !! test
16053 Section extraction test with bogus heading (section 1)
16054 !! options
16055 section=1
16056 !! wikitext
16057 ==a==
16058 ==bogus== not a legal section
16059 ==b==
16060 !! html
16061 ==a==
16062 ==bogus== not a legal section
16063 !! end
16064
16065 !! test
16066 Section extraction test with bogus heading (section 2)
16067 !! options
16068 section=2
16069 !! wikitext
16070 ==a==
16071 ==bogus== not a legal section
16072 ==b==
16073 !! html
16074 ==b==
16075 !! end
16076
16077 !! test
16078 Section extraction test with comment after heading (section 1)
16079 !! options
16080 section=1
16081 !! wikitext
16082 ==a==
16083 ==b== <!-- -->
16084 ==c==
16085 !! html
16086 ==a==
16087 !! end
16088
16089 !! test
16090 Section extraction test with comment after heading (section 2)
16091 !! options
16092 section=2
16093 !! wikitext
16094 ==a==
16095 ==b== <!-- -->
16096 ==c==
16097 !! html
16098 ==b== <!-- -->
16099 !! end
16100
16101 !! test
16102 Section extraction test with bogus <nowiki> heading (section 1)
16103 !! options
16104 section=1
16105 !! wikitext
16106 ==a==
16107 ==bogus== <nowiki>not a legal section</nowiki>
16108 ==b==
16109 !! html
16110 ==a==
16111 ==bogus== <nowiki>not a legal section</nowiki>
16112 !! end
16113
16114 !! test
16115 Section extraction test with bogus <nowiki> heading (section 2)
16116 !! options
16117 section=2
16118 !! wikitext
16119 ==a==
16120 ==bogus== <nowiki>not a legal section</nowiki>
16121 ==b==
16122 !! html
16123 ==b==
16124 !! end
16125
16126
16127 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16128 # instead of respecting commented sections
16129 !! test
16130 Section extraction prefixed by comment (section 1)
16131 !! options
16132 section=1
16133 !! wikitext
16134 <!-- -->==sec1==
16135 ==sec2==
16136 !! html
16137 ==sec2==
16138 !!end
16139
16140 !! test
16141 Section extraction prefixed by comment (section 2)
16142 !! options
16143 section=2
16144 !! wikitext
16145 <!-- -->==sec1==
16146 ==sec2==
16147 !! html
16148
16149 !!end
16150
16151
16152 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16153 # instead of respecting HTML-style headings
16154 !! test
16155 Section extraction, mixed wiki and html (section 1)
16156 !! options
16157 section=1
16158 !! wikitext
16159 <h2>unmarked</h2>
16160 unmarked
16161 ==1==
16162 one
16163 ==2==
16164 two
16165 !! html
16166 ==1==
16167 one
16168 !! end
16169
16170 !! test
16171 Section extraction, mixed wiki and html (section 2)
16172 !! options
16173 section=2
16174 !! wikitext
16175 <h2>unmarked</h2>
16176 unmarked
16177 ==1==
16178 one
16179 ==2==
16180 two
16181 !! html
16182 ==2==
16183 two
16184 !! end
16185
16186
16187 # Formerly testing for bug 3342
16188 !! test
16189 Section extraction, heading surrounded by <noinclude>
16190 !! options
16191 section=1
16192 !! wikitext
16193 <noinclude>==unmarked==</noinclude>
16194 ==marked==
16195 !! html
16196 ==marked==
16197 !!end
16198
16199 # Test behavior of bug 19910
16200 !! test
16201 Sectiion with all-equals
16202 !! options
16203 section=2
16204 !! wikitext
16205 ===
16206 The line above must have a trailing space
16207 === <!--
16208 --> <!-- -->
16209 But just in case it doesn't...
16210 !! html
16211 === <!--
16212 --> <!-- -->
16213 But just in case it doesn't...
16214 !! end
16215
16216 !! test
16217 Section replacement test (section 0)
16218 !! options
16219 replace=0,"xxx"
16220 !! wikitext
16221 start
16222 ==a==
16223 ===aa===
16224 ====aaa====
16225 ==b==
16226 ===ba===
16227 ===bb===
16228 ====bba====
16229 ===bc===
16230 ==c==
16231 ===ca===
16232 !! html
16233 xxx
16234
16235 ==a==
16236 ===aa===
16237 ====aaa====
16238 ==b==
16239 ===ba===
16240 ===bb===
16241 ====bba====
16242 ===bc===
16243 ==c==
16244 ===ca===
16245 !! end
16246
16247 !! test
16248 Section replacement test (section 1)
16249 !! options
16250 replace=1,"xxx"
16251 !! wikitext
16252 start
16253 ==a==
16254 ===aa===
16255 ====aaa====
16256 ==b==
16257 ===ba===
16258 ===bb===
16259 ====bba====
16260 ===bc===
16261 ==c==
16262 ===ca===
16263 !! html
16264 start
16265 xxx
16266
16267 ==b==
16268 ===ba===
16269 ===bb===
16270 ====bba====
16271 ===bc===
16272 ==c==
16273 ===ca===
16274 !! end
16275
16276 !! test
16277 Section replacement test (section 2)
16278 !! options
16279 replace=2,"xxx"
16280 !! wikitext
16281 start
16282 ==a==
16283 ===aa===
16284 ====aaa====
16285 ==b==
16286 ===ba===
16287 ===bb===
16288 ====bba====
16289 ===bc===
16290 ==c==
16291 ===ca===
16292 !! html
16293 start
16294 ==a==
16295 xxx
16296
16297 ==b==
16298 ===ba===
16299 ===bb===
16300 ====bba====
16301 ===bc===
16302 ==c==
16303 ===ca===
16304 !! end
16305
16306 !! test
16307 Section replacement test (section 3)
16308 !! options
16309 replace=3,"xxx"
16310 !! wikitext
16311 start
16312 ==a==
16313 ===aa===
16314 ====aaa====
16315 ==b==
16316 ===ba===
16317 ===bb===
16318 ====bba====
16319 ===bc===
16320 ==c==
16321 ===ca===
16322 !! html
16323 start
16324 ==a==
16325 ===aa===
16326 xxx
16327
16328 ==b==
16329 ===ba===
16330 ===bb===
16331 ====bba====
16332 ===bc===
16333 ==c==
16334 ===ca===
16335 !! end
16336
16337 !! test
16338 Section replacement test (section 4)
16339 !! options
16340 replace=4,"xxx"
16341 !! wikitext
16342 start
16343 ==a==
16344 ===aa===
16345 ====aaa====
16346 ==b==
16347 ===ba===
16348 ===bb===
16349 ====bba====
16350 ===bc===
16351 ==c==
16352 ===ca===
16353 !! html
16354 start
16355 ==a==
16356 ===aa===
16357 ====aaa====
16358 xxx
16359
16360 ==c==
16361 ===ca===
16362 !! end
16363
16364 !! test
16365 Section replacement test (section 5)
16366 !! options
16367 replace=5,"xxx"
16368 !! wikitext
16369 start
16370 ==a==
16371 ===aa===
16372 ====aaa====
16373 ==b==
16374 ===ba===
16375 ===bb===
16376 ====bba====
16377 ===bc===
16378 ==c==
16379 ===ca===
16380 !! html
16381 start
16382 ==a==
16383 ===aa===
16384 ====aaa====
16385 ==b==
16386 xxx
16387
16388 ===bb===
16389 ====bba====
16390 ===bc===
16391 ==c==
16392 ===ca===
16393 !! end
16394
16395 !! test
16396 Section replacement test (section 6)
16397 !! options
16398 replace=6,"xxx"
16399 !! wikitext
16400 start
16401 ==a==
16402 ===aa===
16403 ====aaa====
16404 ==b==
16405 ===ba===
16406 ===bb===
16407 ====bba====
16408 ===bc===
16409 ==c==
16410 ===ca===
16411 !! html
16412 start
16413 ==a==
16414 ===aa===
16415 ====aaa====
16416 ==b==
16417 ===ba===
16418 xxx
16419
16420 ===bc===
16421 ==c==
16422 ===ca===
16423 !! end
16424
16425 !! test
16426 Section replacement test (section 7)
16427 !! options
16428 replace=7,"xxx"
16429 !! wikitext
16430 start
16431 ==a==
16432 ===aa===
16433 ====aaa====
16434 ==b==
16435 ===ba===
16436 ===bb===
16437 ====bba====
16438 ===bc===
16439 ==c==
16440 ===ca===
16441 !! html
16442 start
16443 ==a==
16444 ===aa===
16445 ====aaa====
16446 ==b==
16447 ===ba===
16448 ===bb===
16449 xxx
16450
16451 ===bc===
16452 ==c==
16453 ===ca===
16454 !! end
16455
16456 !! test
16457 Section replacement test (section 8)
16458 !! options
16459 replace=8,"xxx"
16460 !! wikitext
16461 start
16462 ==a==
16463 ===aa===
16464 ====aaa====
16465 ==b==
16466 ===ba===
16467 ===bb===
16468 ====bba====
16469 ===bc===
16470 ==c==
16471 ===ca===
16472 !! html
16473 start
16474 ==a==
16475 ===aa===
16476 ====aaa====
16477 ==b==
16478 ===ba===
16479 ===bb===
16480 ====bba====
16481 xxx
16482
16483 ==c==
16484 ===ca===
16485 !!end
16486
16487 !! test
16488 Section replacement test (section 9)
16489 !! options
16490 replace=9,"xxx"
16491 !! wikitext
16492 start
16493 ==a==
16494 ===aa===
16495 ====aaa====
16496 ==b==
16497 ===ba===
16498 ===bb===
16499 ====bba====
16500 ===bc===
16501 ==c==
16502 ===ca===
16503 !! html
16504 start
16505 ==a==
16506 ===aa===
16507 ====aaa====
16508 ==b==
16509 ===ba===
16510 ===bb===
16511 ====bba====
16512 ===bc===
16513 xxx
16514 !! end
16515
16516 !! test
16517 Section replacement test (section 10)
16518 !! options
16519 replace=10,"xxx"
16520 !! wikitext
16521 start
16522 ==a==
16523 ===aa===
16524 ====aaa====
16525 ==b==
16526 ===ba===
16527 ===bb===
16528 ====bba====
16529 ===bc===
16530 ==c==
16531 ===ca===
16532 !! html
16533 start
16534 ==a==
16535 ===aa===
16536 ====aaa====
16537 ==b==
16538 ===ba===
16539 ===bb===
16540 ====bba====
16541 ===bc===
16542 ==c==
16543 xxx
16544 !! end
16545
16546 !! test
16547 Section replacement test with initial whitespace (bug 13728)
16548 !! options
16549 replace=2,"xxx"
16550 !! wikitext
16551 Preformatted initial line
16552 ==a==
16553 ===a===
16554 !! html
16555 Preformatted initial line
16556 ==a==
16557 xxx
16558 !! end
16559
16560
16561 !! test
16562 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16563 !! options
16564 section=1
16565 !! wikitext
16566 ==a==
16567 a
16568 !! html
16569 ==a==
16570 a
16571 !! end
16572
16573 !! test
16574 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16575 !! options
16576 section=1
16577 !! wikitext
16578 ==a==
16579 a
16580 !! html
16581 ==a==
16582 a
16583 !! end
16584
16585
16586 !! test
16587 Section extraction, <pre> around bogus header (bug 10309)
16588 !! options
16589 noxml section=2
16590 !! wikitext
16591 == Section One ==
16592 <pre>
16593 =======
16594 </pre>
16595
16596 == Section Two ==
16597 stuff
16598 !! html
16599 == Section Two ==
16600 stuff
16601 !! end
16602
16603 !! test
16604 Section replacement, <pre> around bogus header (bug 10309)
16605 !! options
16606 noxml replace=2,"xxx"
16607 !! wikitext
16608 == Section One ==
16609 <pre>
16610 =======
16611 </pre>
16612
16613 == Section Two ==
16614 stuff
16615 !! html
16616 == Section One ==
16617 <pre>
16618 =======
16619 </pre>
16620
16621 xxx
16622 !! end
16623
16624
16625
16626 !! test
16627 Handling of &#x0A; in URLs
16628 !! wikitext
16629 ** irc://&#x0A;a
16630 !! html/php
16631 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16632
16633 !! html/parsoid
16634 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16635 a">irc://
16636 a</a></li></ul></li></ul>
16637 !! end
16638
16639 !! test
16640 Handling of %0A in URLs
16641 !! wikitext
16642 ** irc://%0Aa
16643 !! html/php
16644 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16645
16646 !! html/parsoid
16647 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16648 !! end
16649
16650
16651 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16652 !! test
16653 5 quotes, code coverage +1 line
16654 !! options
16655 parsoid=wt2html
16656 !! wikitext
16657 '''''
16658 !! html/php
16659 !! html/parsoid
16660 <p><b><i></i></b></p>
16661 !! end
16662
16663 # same html as previous, but wikitext adjusted to match parsoid html2wt
16664 # note that wt2html and html2html will put the <i> before the <b>
16665 !! test
16666 5 quotes, code coverage +1 line w/ nowiki (1)
16667 !! options
16668 parsoid=wt2wt,html2wt
16669 !! wikitext
16670 '''''<nowiki/>'''''
16671 !! html/php
16672 <p><i></i>
16673 </p>
16674 !! html/parsoid
16675 <p><b><i></i></b></p>
16676 !! end
16677
16678 # same as previous, just swapping the <i> and <b>
16679 !! test
16680 5 quotes, code coverage +1 line w/ nowiki (2)
16681 !! wikitext
16682 '''''<nowiki/>'''''
16683 !! html/php
16684 <p><i></i>
16685 </p>
16686 !! html/parsoid
16687 <p><i><b></b></i></p>
16688 !! end
16689
16690 !! test
16691 Special:Search page linking.
16692 !! wikitext
16693 {{Special:search}}
16694 !! html
16695 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16696 </p>
16697 !! end
16698
16699 !! test
16700 {{!}} is a magic word
16701 !! wikitext
16702 {{!}} is a magic word there and {{!}} is still a magic word here
16703 !! html/php
16704 <p>| is a magic word there and | is still a magic word here
16705 </p>
16706 !! html/parsoid
16707 <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>
16708 !! end
16709
16710 !! test
16711 Say the magic word
16712 !! options
16713 title=[[Parser test]]
16714 !! wikitext
16715 * {{PAGENAME}}
16716 * {{PAGENAMEE}}
16717 * {{FULLPAGENAME}}
16718 * {{FULLPAGENAMEE}}
16719 * {{BASEPAGENAME}}
16720 * {{BASEPAGENAMEE}}
16721 * {{SUBPAGENAME}}
16722 * {{SUBPAGENAMEE}}
16723 * {{ROOTPAGENAME}}
16724 * {{ROOTPAGENAMEE}}
16725 * {{TALKPAGENAME}}
16726 * {{TALKPAGENAMEE}}
16727 * {{SUBJECTPAGENAME}}
16728 * {{SUBJECTPAGENAMEE}}
16729 * {{NAMESPACEE}}
16730 * {{NAMESPACE}}
16731 * {{NAMESPACENUMBER}}
16732 * {{TALKSPACE}}
16733 * {{TALKSPACEE}}
16734 * {{SUBJECTSPACE}}
16735 * {{SUBJECTSPACEE}}
16736 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16737 !! html
16738 <ul><li> Parser test</li>
16739 <li> Parser_test</li>
16740 <li> Parser test</li>
16741 <li> Parser_test</li>
16742 <li> Parser test</li>
16743 <li> Parser_test</li>
16744 <li> Parser test</li>
16745 <li> Parser_test</li>
16746 <li> Parser test</li>
16747 <li> Parser_test</li>
16748 <li> Talk:Parser test</li>
16749 <li> Talk:Parser_test</li>
16750 <li> Parser test</li>
16751 <li> Parser_test</li>
16752 <li> </li>
16753 <li> </li>
16754 <li> 0</li>
16755 <li> Talk</li>
16756 <li> Talk</li>
16757 <li> </li>
16758 <li> </li>
16759 <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>
16760
16761 !! end
16762 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16763
16764 !! test
16765 Gallery
16766 !! wikitext
16767 <gallery>
16768 image1.png |
16769 image2.gif|||||
16770
16771 image3|
16772 image4 |300px| centre
16773 image5.svg| http://///////
16774 [[x|xx]]]]
16775 * image6
16776 </gallery>
16777 !! html
16778 <ul class="gallery mw-gallery-traditional">
16779 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16780 <div class="thumb" style="height: 150px;">Image1.png</div>
16781 <div class="gallerytext">
16782 </div>
16783 </div></li>
16784 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16785 <div class="thumb" style="height: 150px;">Image2.gif</div>
16786 <div class="gallerytext">
16787 <p>||||
16788 </p>
16789 </div>
16790 </div></li>
16791 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16792 <div class="thumb" style="height: 150px;">Image3</div>
16793 <div class="gallerytext">
16794 </div>
16795 </div></li>
16796 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16797 <div class="thumb" style="height: 150px;">Image4</div>
16798 <div class="gallerytext">
16799 <p>300px| centre
16800 </p>
16801 </div>
16802 </div></li>
16803 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16804 <div class="thumb" style="height: 150px;">Image5.svg</div>
16805 <div class="gallerytext">
16806 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16807 </p>
16808 </div>
16809 </div></li>
16810 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16811 <div class="thumb" style="height: 150px;">* image6</div>
16812 <div class="gallerytext">
16813 </div>
16814 </div></li>
16815 </ul>
16816
16817 !! end
16818
16819 !! test
16820 Gallery (with options)
16821 !! wikitext
16822 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16823 File:Nonexistent.jpg|caption
16824 File:Nonexistent.jpg
16825 image:foobar.jpg|some '''caption''' [[Main Page]]
16826 image:foobar.jpg
16827 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16828 </gallery>
16829 !! html
16830 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16831 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16832 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16833 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16834 <div class="gallerytext">
16835 <p>caption
16836 </p>
16837 </div>
16838 </div></li>
16839 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16840 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16841 <div class="gallerytext">
16842 </div>
16843 </div></li>
16844 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16845 <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>
16846 <div class="gallerytext">
16847 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16848 </p>
16849 </div>
16850 </div></li>
16851 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16852 <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>
16853 <div class="gallerytext">
16854 </div>
16855 </div></li>
16856 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16857 <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>
16858 <div class="gallerytext">
16859 <p>Blabla|blabla.
16860 </p>
16861 </div>
16862 </div></li>
16863 </ul>
16864
16865 !! end
16866
16867 !! test
16868 Gallery with link that has fragment
16869 !! wikitext
16870 <gallery>
16871 image:foobar.jpg|link=Main_Page
16872 image:foobar.jpg|link=Main_Page#section
16873 image:foobar.jpg|link=Main Page#section|caption
16874 </gallery>
16875 !! html
16876 <ul class="gallery mw-gallery-traditional">
16877 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16878 <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>
16879 <div class="gallerytext">
16880 </div>
16881 </div></li>
16882 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16883 <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>
16884 <div class="gallerytext">
16885 </div>
16886 </div></li>
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#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>
16889 <div class="gallerytext">
16890 <p>caption
16891 </p>
16892 </div>
16893 </div></li>
16894 </ul>
16895
16896 !! end
16897
16898 !! test
16899 Gallery with wikitext inside caption
16900 !! wikitext
16901 <gallery>
16902 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16903 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16904 </gallery>
16905 !! html
16906 <ul class="gallery mw-gallery-traditional">
16907 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16908 <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>
16909 <div class="gallerytext">
16910 <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>
16911 </p>
16912 </div>
16913 </div></li>
16914 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16915 <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>
16916 <div class="gallerytext">
16917 <p>This is a test template
16918 </p>
16919 </div>
16920 </div></li>
16921 </ul>
16922
16923 !! end
16924
16925 !! test
16926 gallery (with showfilename option)
16927 !! wikitext
16928 <gallery showfilename>
16929 File:Nonexistent.jpg|caption
16930 File:Nonexistent.jpg
16931 image:foobar.jpg|some '''caption''' [[Main Page]]
16932 File:Foobar.jpg
16933 </gallery>
16934 !! html
16935 <ul class="gallery mw-gallery-traditional">
16936 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16937 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16938 <div class="gallerytext">
16939 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16940 caption
16941 </p>
16942 </div>
16943 </div></li>
16944 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16945 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16946 <div class="gallerytext">
16947 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16948 </p>
16949 </div>
16950 </div></li>
16951 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16952 <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>
16953 <div class="gallerytext">
16954 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16955 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16956 </p>
16957 </div>
16958 </div></li>
16959 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16960 <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>
16961 <div class="gallerytext">
16962 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16963 </p>
16964 </div>
16965 </div></li>
16966 </ul>
16967
16968 !! end
16969
16970 !! test
16971 Gallery (with namespace-less filenames)
16972 !! wikitext
16973 <gallery>
16974 File:Nonexistent.jpg
16975 Nonexistent.jpg
16976 image:foobar.jpg
16977 foobar.jpg
16978 </gallery>
16979 !! html
16980 <ul class="gallery mw-gallery-traditional">
16981 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16982 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16983 <div class="gallerytext">
16984 </div>
16985 </div></li>
16986 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16987 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16988 <div class="gallerytext">
16989 </div>
16990 </div></li>
16991 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16992 <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>
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="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>
16998 <div class="gallerytext">
16999 </div>
17000 </div></li>
17001 </ul>
17002
17003 !! end
17004
17005 !! test
17006 HTML Hex character encoding (spells the word "JavaScript")
17007 !! options
17008 parsoid=wt2html,wt2wt,html2html
17009 !! wikitext
17010 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17011 !! html/php
17012 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17013 </p>
17014 !! html/php+tidy
17015 <p>JavaScript</p>
17016 !! html/parsoid
17017 <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>
17018 !! end
17019
17020 !! test
17021 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17022 !! wikitext
17023 &#xsee;&#XSEE;
17024 !! html/php
17025 <p>&amp;#xsee;&amp;#XSEE;
17026 </p>
17027 !! html/parsoid
17028 <p>&amp;#xsee;&amp;#XSEE;</p>
17029 !! end
17030
17031 !! test
17032 HTML Hex character encoding mixed case
17033 !! options
17034 parsoid=wt2html,wt2wt,html2html
17035 !! wikitext
17036 &#xEE;&#Xee;
17037 !! html/php
17038 <p>&#xee;&#xee;
17039 </p>
17040 !! html/php+tidy
17041 <p>îî</p>
17042 !! html/parsoid
17043 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17044 !! end
17045
17046 !! test
17047 __FORCETOC__ override
17048 !! wikitext
17049 __NEWSECTIONLINK__
17050 __FORCETOC__
17051 !! html
17052 <p><br />
17053 </p>
17054 !! end
17055
17056 !! test
17057 ISBN code coverage
17058 !! wikitext
17059 ISBN 978-0-1234-56&#x20;789
17060 !! html
17061 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17062 </p>
17063 !! html+tidy
17064 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17065 !! html/parsoid
17066 <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>
17067 !! end
17068
17069 !! test
17070 ISBN followed by 5 spaces
17071 !! wikitext
17072 ISBN
17073 !! html
17074 <p>ISBN
17075 </p>
17076 !! end
17077
17078 !! test
17079 Double ISBN
17080 !! wikitext
17081 ISBN ISBN 1234567890
17082 !! html/php
17083 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17084 </p>
17085 !! html/parsoid
17086 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17087 !! end
17088
17089 !! test
17090 ISBN with an X
17091 !! wikitext
17092 ISBN 3-462-04561-X
17093 ISBN 080442957X
17094 ISBN 978080442957X
17095 !! html/php
17096 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17097 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17098 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17099 </p>
17100 !! html/parsoid
17101 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17102 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17103 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17104 !! end
17105
17106 !! test
17107 ISBN with empty prefix (parsoid test)
17108 !! wikitext
17109 ISBN 1234567890
17110 !! html/php
17111 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17112 </p>
17113 !! html/parsoid
17114 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17115 !! end
17116
17117 !! test
17118 Bug 22905: <abbr> followed by ISBN followed by </a>
17119 !! wikitext
17120 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17121 !! html/php
17122 <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>
17123 </p>
17124 !! html/parsoid
17125 <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>
17126 !! end
17127
17128 !! test
17129 Double RFC
17130 !! wikitext
17131 RFC RFC 1234
17132 !! html
17133 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17134 </p>
17135 !! end
17136
17137 !! test
17138 Double RFC with a wiki link
17139 !! wikitext
17140 RFC [[RFC 1234]]
17141 !! html
17142 <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>
17143 </p>
17144 !! end
17145
17146 !! test
17147 RFC code coverage
17148 !! wikitext
17149 RFC 983&#x20;987
17150 !! html
17151 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17152 </p>
17153 !! html+tidy
17154 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17155 !! end
17156
17157 !! test
17158 Centre-aligned image
17159 !! wikitext
17160 [[Image:foobar.jpg|centre]]
17161 !! html
17162 <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>
17163
17164 !!end
17165
17166 !! test
17167 None-aligned image
17168 !! wikitext
17169 [[Image:foobar.jpg|none]]
17170 !! html
17171 <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>
17172
17173 !!end
17174
17175 !! test
17176 Width + Height sized image (using px) (height is ignored)
17177 !! wikitext
17178 [[Image:foobar.jpg|640x480px]]
17179 !! html
17180 <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>
17181 </p>
17182 !!end
17183
17184 !! test
17185 Width-sized image (using px, no following whitespace)
17186 !! wikitext
17187 [[Image:foobar.jpg|640px]]
17188 !! html
17189 <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>
17190 </p>
17191 !!end
17192
17193 !! test
17194 Width-sized image (using px, with following whitespace - test regression from r39467)
17195 !! wikitext
17196 [[Image:foobar.jpg|640px ]]
17197 !! html
17198 <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>
17199 </p>
17200 !!end
17201
17202 !! test
17203 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17204 !! wikitext
17205 [[Image:foobar.jpg| 640px]]
17206 !! html
17207 <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>
17208 </p>
17209 !!end
17210
17211 !! test
17212 Image with page parameter
17213 !! options
17214 djvu
17215 !! wikitext
17216 [[File:LoremIpsum.djvu|page=2]]
17217 !! html/php
17218 <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>
17219 </p>
17220 !! html/parsoid
17221 <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>
17222 !! end
17223
17224 !! test
17225 Another italics / bold test
17226 !! wikitext
17227 ''' ''x'
17228 !! html
17229 <pre>'<i> </i>x'
17230 </pre>
17231 !!end
17232
17233 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17234 !! test
17235 dt/dd/dl test
17236 !! wikitext
17237 :;;;::
17238 !! html/php
17239 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17240
17241 !! html/parsoid
17242 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17243
17244 !!end
17245
17246
17247 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17248 !! test
17249 Images with the "|" character in the comment
17250 !! wikitext
17251 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17252 !! html/php
17253 <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>
17254
17255 !! html/parsoid
17256 <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>
17257 !! end
17258
17259 !! test
17260 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17261 !! wikitext
17262 <html><script>alert(1);</script></html>
17263 !! html
17264 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17265 </p>
17266 !! end
17267
17268 !! test
17269 HTML with raw HTML ($wgRawHtml==true)
17270 !! options
17271 wgRawHtml=1
17272 !! wikitext
17273 <html><script>alert(1);</script></html>
17274 !! html
17275 <p><script>alert(1);</script>
17276 </p>
17277 !! end
17278
17279 !! test
17280 Parents of subpages, one level up
17281 !! options
17282 subpage title=[[Subpage test/L1/L2/L3]]
17283 !! wikitext
17284 [[../|L2]]
17285 !! html
17286 <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>
17287 </p>
17288 !! end
17289
17290
17291 !! test
17292 Parents of subpages, one level up, not named
17293 !! options
17294 subpage title=[[Subpage test/L1/L2/L3]]
17295 !! wikitext
17296 [[../]]
17297 !! html
17298 <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>
17299 </p>
17300 !! end
17301
17302
17303
17304 !! test
17305 Parents of subpages, two levels up
17306 !! options
17307 subpage title=[[Subpage test/L1/L2/L3]]
17308 !! wikitext
17309 [[../../|L1]]2
17310
17311 [[../../|L1]]l
17312 !! html
17313 <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
17314 </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>
17315 </p>
17316 !! end
17317
17318 !! test
17319 Parents of subpages, two levels up, without trailing slash or name.
17320 !! options
17321 subpage title=[[Subpage test/L1/L2/L3]]
17322 !! wikitext
17323 [[../..]]
17324 !! html
17325 <p>[[../..]]
17326 </p>
17327 !! end
17328
17329 !! test
17330 Parents of subpages, two levels up, with lots of extra trailing slashes.
17331 !! options
17332 subpage title=[[Subpage test/L1/L2/L3]]
17333 !! wikitext
17334 [[../../////]]
17335 !! html
17336 <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>
17337 </p>
17338 !! end
17339
17340 !! article
17341 Subpage test/L1/L2/L3Sibling
17342 !! text
17343 Sibling article
17344 !! endarticle
17345
17346 !! test
17347 Transclusion of a sibling page (one level up)
17348 !! options
17349 subpage title=[[Subpage test/L1/L2/L3]]
17350 !! wikitext
17351 {{../L3Sibling}}
17352 !! html
17353 <p>Sibling article
17354 </p>
17355 !! end
17356
17357 !! test
17358 Transclusion of a child page
17359 !! options
17360 subpage title=[[Subpage test/L1/L2]]
17361 !! wikitext
17362 {{/L3Sibling}}
17363 !! html
17364 <p>Sibling article
17365 </p>
17366 !! end
17367
17368 !! test
17369 Non-transclusion because of too many up levels
17370 !! options
17371 subpage title=[[Subpage test/L1/L2/L3]]
17372 !! wikitext
17373 {{../../../../More than parent}}
17374 !! html
17375 <p>{{../../../../More than parent}}
17376 </p>
17377 !! end
17378
17379 !! test
17380 Definition list code coverage
17381 !! wikitext
17382 ; title : def
17383 ; title : def
17384 ;title: def
17385 !! html/php
17386 <dl><dt> title &#160;</dt>
17387 <dd> def</dd>
17388 <dt> title&#160;</dt>
17389 <dd> def</dd>
17390 <dt>title</dt>
17391 <dd> def</dd></dl>
17392
17393 !! html/parsoid
17394 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17395 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17396 <dt>title</dt><dd> def</dd></dl>
17397 !! end
17398
17399 !! test
17400 Don't fall for the self-closing div
17401 !! wikitext
17402 <div>hello world</div/>
17403 !! html
17404 <div>hello world</div>
17405
17406 !! end
17407
17408 !! test
17409 MSGNW magic word
17410 !! wikitext
17411 {{MSGNW:msg}}
17412 !! html
17413 <p>&#91;&#91;:Template:Msg&#93;&#93;
17414 </p>
17415 !! end
17416
17417 !! test
17418 RAW magic word
17419 !! wikitext
17420 {{RAW:QUERTY}}
17421 !! html
17422 <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>
17423 </p>
17424 !! end
17425
17426 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17427 !! test
17428 Always escape literal '>' in output, not just after '<'
17429 !! wikitext
17430 ><>
17431 !! html
17432 <p>&gt;&lt;&gt;
17433 </p>
17434 !! end
17435
17436 !! test
17437 Template caching
17438 !! wikitext
17439 {{Test}}
17440 {{Test}}
17441 !! html
17442 <p>This is a test template
17443 This is a test template
17444 </p>
17445 !! end
17446
17447
17448 !! article
17449 MediaWiki:Fake
17450 !! text
17451 ==header==
17452 !! endarticle
17453
17454 !! test
17455 Inclusion of !userCanEdit() content
17456 !! wikitext
17457 {{MediaWiki:Fake}}
17458 !! html
17459 <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>
17460
17461 !! end
17462
17463
17464 !! test
17465 Out-of-order TOC heading levels
17466 !! wikitext
17467 ==2==
17468 ======6======
17469 ===3===
17470 =1=
17471 =====5=====
17472 ==2==
17473 !! html
17474 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17475 <ul>
17476 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17477 <ul>
17478 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17479 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17480 </ul>
17481 </li>
17482 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17483 <ul>
17484 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17485 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17486 </ul>
17487 </li>
17488 </ul>
17489 </div>
17490
17491 <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>
17492 <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>
17493 <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>
17494 <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>
17495 <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>
17496 <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>
17497
17498 !! end
17499
17500
17501 !! test
17502 ISBN with a dummy number
17503 !! wikitext
17504 ISBN ---
17505 !! html
17506 <p>ISBN ---
17507 </p>
17508 !! end
17509
17510
17511 !! test
17512 ISBN with space-delimited number
17513 !! wikitext
17514 ISBN 92 9017 032 8
17515 !! html
17516 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17517 </p>
17518 !! end
17519
17520
17521 !! test
17522 ISBN with multiple spaces, no number
17523 !! wikitext
17524 ISBN foo
17525 !! html
17526 <p>ISBN foo
17527 </p>
17528 !! end
17529
17530
17531 !! test
17532 ISBN length
17533 !! wikitext
17534 ISBN 123456789
17535
17536 ISBN 1234567890
17537
17538 ISBN 12345678901
17539 !! html
17540 <p>ISBN 123456789
17541 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17542 </p><p>ISBN 12345678901
17543 </p>
17544 !! end
17545
17546
17547 !! test
17548 ISBN with trailing year (bug 8110)
17549 !! wikitext
17550 ISBN 1-234-56789-0 - 2006
17551
17552 ISBN 1 234 56789 0 - 2006
17553 !! html
17554 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17555 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17556 </p>
17557 !! end
17558
17559
17560 !! test
17561 anchorencode
17562 !! wikitext
17563 {{anchorencode:foo bar©#%n}}
17564 !! html
17565 <p>foo_bar.C2.A9.23.25n
17566 </p>
17567 !! end
17568
17569 !! test
17570 anchorencode trims spaces
17571 !! wikitext
17572 {{anchorencode: __pretty__please__}}
17573 !! html
17574 <p>pretty_please
17575 </p>
17576 !! end
17577
17578 !! test
17579 anchorencode deals with links
17580 !! wikitext
17581 {{anchorencode: [[hello|world]] [[hi]]}}
17582 !! html
17583 <p>world_hi
17584 </p>
17585 !! end
17586
17587 !! test
17588 anchorencode deals with templates
17589 !! wikitext
17590 {{anchorencode: {{Foo}} }}
17591 !! html
17592 <p>FOO
17593 </p>
17594 !! end
17595
17596 !! test
17597 anchorencode encodes like the TOC generator: (bug 18431)
17598 !! wikitext
17599 === _ +:.3A%3A&&amp;]] ===
17600 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17601 __NOEDITSECTION__
17602 !! html
17603 <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>
17604 <p>.2B:.3A.253A.26.26.5D.5D
17605 </p>
17606 !! end
17607
17608 !! test
17609 Bug 6200: blockquotes and paragraph formatting
17610 !! wikitext
17611 <blockquote>
17612 foo
17613 </blockquote>
17614
17615 bar
17616
17617 baz
17618 !! html
17619 <blockquote>
17620 <p>foo
17621 </p>
17622 </blockquote>
17623 <p>bar
17624 </p>
17625 <pre>baz
17626 </pre>
17627 !! end
17628
17629 !! test
17630 Bug 8293: Use of center tag ruins paragraph formatting
17631 !! wikitext
17632 <center>
17633 foo
17634 </center>
17635
17636 bar
17637
17638 baz
17639 !! html
17640 <center>
17641 <p>foo
17642 </p>
17643 </center>
17644 <p>bar
17645 </p>
17646 <pre>baz
17647 </pre>
17648 !! end
17649
17650 !!test
17651 Parsing of overlapping (improperly nested) inline html tags
17652 !! wikitext
17653 <span><s>x</span></s>
17654 !! html/php
17655 <p><span><s>x&lt;/span&gt;</s></span>
17656 </p>
17657 !! html/parsoid
17658 <p><span><s>x</s></span>
17659 </p>
17660 !!end
17661
17662 ###
17663 ### Language variants related tests
17664 ###
17665 !! test
17666 Self-link in language variants
17667 !! options
17668 title=[[Dunav]] language=sr
17669 !! wikitext
17670 Both [[Dunav]] and [[Дунав]] are names for this river.
17671 !! html
17672 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17673 </p>
17674 !!end
17675
17676 !! article
17677 Дуна
17678 !! text
17679 content
17680 !! endarticle
17681
17682 !! test
17683 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17684 !! options
17685 title=[[Duna]] language=sr
17686 !! wikitext
17687 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17688 !! html
17689 <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.
17690 </p>
17691 !! end
17692
17693 !! test
17694 Link to a section of a variant of this title shouldn't be parsed as self-link
17695 !! options
17696 title=[[Duna]] language=sr
17697 !! wikitext
17698 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17699 !! html
17700 <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.
17701 </p>
17702 !! end
17703
17704 !! test
17705 Link to pages in language variants
17706 !! options
17707 language=sr
17708 !! wikitext
17709 Main Page can be written as [[Маин Паге]]
17710 !! html
17711 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17712 </p>
17713 !!end
17714
17715
17716 !! test
17717 Multiple links to pages in language variants
17718 !! options
17719 language=sr
17720 !! wikitext
17721 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17722 !! html
17723 <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>.
17724 </p>
17725 !!end
17726
17727
17728 !! test
17729 Simple template in language variants
17730 !! options
17731 language=sr
17732 !! wikitext
17733 {{тест}}
17734 !! html
17735 <p>This is a test template
17736 </p>
17737 !! end
17738
17739
17740 !! test
17741 Template with explicit namespace in language variants
17742 !! options
17743 language=sr
17744 !! wikitext
17745 {{Template:тест}}
17746 !! html
17747 <p>This is a test template
17748 </p>
17749 !! end
17750
17751
17752 !! test
17753 Basic test for template parameter in language variants
17754 !! options
17755 language=sr
17756 !! wikitext
17757 {{парамтест|param=foo}}
17758 !! html
17759 <p>This is a test template with parameter foo
17760 </p>
17761 !! end
17762
17763
17764 !! test
17765 Simple category in language variants
17766 !! options
17767 language=sr cat
17768 !! wikitext
17769 [[Category:МедиаWики Усер'с Гуиде]]
17770 !! html
17771 <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>
17772 !! end
17773
17774
17775 !! article
17776 Category:分类
17777 !! text
17778 blah
17779 !! endarticle
17780
17781 !! article
17782 Category:分類
17783 !! text
17784 blah
17785 !! endarticle
17786
17787 !! test
17788 Don't convert blue categorylinks to another variant (bug 33210)
17789 !! options
17790 language=zh cat
17791 !! wikitext
17792 [[A]][[Category:分类]]
17793 !! html
17794 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17795 !! end
17796
17797
17798 !! test
17799 Stripping -{}- tags (language variants)
17800 !! options
17801 language=sr
17802 !! wikitext
17803 Latin proverb: -{Ne nuntium necare}-
17804 !! html
17805 <p>Latin proverb: Ne nuntium necare
17806 </p>
17807 !! end
17808
17809
17810 !! test
17811 Prevent conversion with -{}- tags (language variants)
17812 !! options
17813 language=sr variant=sr-ec
17814 !! wikitext
17815 Latinski: -{Ne nuntium necare}-
17816 !! html
17817 <p>Латински: Ne nuntium necare
17818 </p>
17819 !! end
17820
17821
17822 !! test
17823 Prevent conversion of text with -{}- tags (language variants)
17824 !! options
17825 language=sr variant=sr-ec
17826 !! wikitext
17827 Latinski: -{Ne nuntium necare}-
17828 !! html
17829 <p>Латински: Ne nuntium necare
17830 </p>
17831 !! end
17832
17833
17834 !! test
17835 Prevent conversion of links with -{}- tags (language variants)
17836 !! options
17837 language=sr variant=sr-ec
17838 !! wikitext
17839 -{[[Main Page]]}-
17840 !! html
17841 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17842 </p>
17843 !! end
17844
17845
17846 !! test
17847 -{}- tags within headlines (within html for parserConvert())
17848 !! options
17849 language=sr variant=sr-ec
17850 !! wikitext
17851 == -{Naslov}- ==
17852 !! html
17853 <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>
17854
17855 !! end
17856
17857
17858 !! test
17859 Explicit definition of language variant alternatives
17860 !! options
17861 language=zh variant=zh-tw
17862 !! wikitext
17863 -{zh:China;zh-tw:Taiwan}-, not China
17864 !! html
17865 <p>Taiwan, not China
17866 </p>
17867 !! end
17868
17869
17870 !! test
17871 Conversion around HTML tags
17872 !! options
17873 language=sr variant=sr-ec
17874 !! wikitext
17875 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17876 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17877 !! html
17878 <p>
17879 <span title="ЛаCтин">ски</span>
17880 </p>
17881 !! end
17882
17883
17884 !! test
17885 Explicit session-wise language variant mapping (A flag and - flag)
17886 !! options
17887 language=zh variant=zh-tw
17888 !! wikitext
17889 Taiwan is not China.
17890 But -{A|zh:China;zh-tw:Taiwan}- is China,
17891 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17892 and -{China}- is China.
17893 !! html
17894 <p>Taiwan is not China.
17895 But Taiwan is Taiwan,
17896 (This should be stripped!)
17897 and China is China.
17898 </p>
17899 !! end
17900
17901 !! test
17902 Explicit session-wise language variant mapping (H flag for hide)
17903 !! options
17904 language=zh variant=zh-tw
17905 !! wikitext
17906 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17907 Taiwan is China.
17908 !! html
17909 <p>(This should be stripped!)
17910 Taiwan is Taiwan.
17911 </p>
17912 !! end
17913
17914 !! test
17915 Adding explicit conversion rule for title (T flag)
17916 !! options
17917 language=zh variant=zh-tw showtitle
17918 !! wikitext
17919 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17920 !! html
17921 Taiwan
17922 <p>Should be stripped!
17923 </p>
17924 !! end
17925
17926 !! test
17927 Testing that changing the language variant here in the tests actually works
17928 !! options
17929 language=zh variant=zh showtitle
17930 !! wikitext
17931 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17932 !! html
17933 China
17934 <p>Should be stripped!
17935 </p>
17936 !! end
17937
17938 !! test
17939 Recursive conversion of alt and title attrs shouldn't clear converter state
17940 !! options
17941 language=zh variant=zh-cn showtitle
17942 !! wikitext
17943 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17944 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17945 !! html
17946 China
17947 <p>
17948 Should be stripped<span title="Exclamation">!</span>
17949 </p>
17950 !! end
17951
17952 !! test
17953 Bug 24072: more test on conversion rule for title
17954 !! options
17955 language=zh variant=zh-tw showtitle
17956 !! wikitext
17957 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17958 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17959 !! html
17960 Taiwan
17961 <p>This should be stripped!
17962 This won't take interferes with the title rule.
17963 </p>
17964 !! end
17965
17966 !! test
17967 Partly disable title conversion if variant == main language code
17968 !! options
17969 language=zh variant=zh title=[[ZH]] showtitle
17970 !! wikitext
17971 -{T|zh-cn:CN;zh-tw:TW}-
17972 !! html
17973 ZH
17974 <p>
17975 </p>
17976 !! end
17977
17978 !! test
17979 Partly disable title conversion if variant == main language code, more
17980 !! options
17981 language=zh variant=zh title=[[ZH]] showtitle
17982 !! wikitext
17983 -{T|TW}-
17984 !! html
17985 ZH
17986 <p>
17987 </p>
17988 !! end
17989
17990 !! test
17991 Raw output of variant escape tags (R flag)
17992 !! options
17993 language=zh variant=zh-tw
17994 !! wikitext
17995 Raw: -{R|zh:China;zh-tw:Taiwan}-
17996 !! html
17997 <p>Raw: zh:China;zh-tw:Taiwan
17998 </p>
17999 !! end
18000
18001 !! test
18002 Nested using of manual convert syntax
18003 !! options
18004 language=zh variant=zh-hk
18005 !! wikitext
18006 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18007 !! html
18008 <p>Nested: Hello Hong Kong!
18009 </p>
18010 !! end
18011
18012 !! test
18013 Proper conversion of text in external links
18014 !! options
18015 language=sr variant=sr-ec
18016 !! wikitext
18017 http://www.google.com
18018 gopher://www.google.com
18019 [http://www.google.com http://www.google.com]
18020 [gopher://www.google.com gopher://www.google.com]
18021 [https://www.google.com irc://www.google.com]
18022 [ftp://www.google.com www.google.com/ftp://dir]
18023 [//www.google.com www.google.com]
18024 !! html
18025 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18026 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18027 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18028 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18029 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18030 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18031 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18032 </p>
18033 !! end
18034
18035 !! test
18036 Do not convert roman numbers to language variants
18037 !! options
18038 language=sr variant=sr-ec
18039 !! wikitext
18040 Fridrih IV je car.
18041 !! html
18042 <p>Фридрих IV је цар.
18043 </p>
18044 !! end
18045
18046 !! test
18047 Unclosed language converter markup "-{"
18048 !! options
18049 language=sr
18050 !! wikitext
18051 -{T|hello
18052 !! html
18053 <p>-{T|hello
18054 </p>
18055 !! end
18056
18057 !! test
18058 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18059 !! options
18060 language=sr
18061 !! wikitext
18062 -{R|=&gt;}-
18063 !! html
18064 <p>=&gt;
18065 </p>
18066 !!end
18067
18068 !! test
18069 Don't break link parsing if language converter markup is in the caption.
18070 !! options
18071 language=sr variant=sr-ec
18072 !! wikitext
18073 [[Main Page|-{R|main page}-]]
18074 !! html
18075 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18076 </p>
18077 !! end
18078
18079 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18080 !! test
18081 Don't break image parsing if language converter markup is in the caption.
18082 !! options
18083 language=sr
18084 !! wikitext
18085 [[File:Foobar.jpg|-{R|caption}-]]
18086 !! html/parsoid
18087 <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>
18088 </p>
18089 !! end
18090
18091 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18092 !! test
18093 Don't break list handling if language converter markup is in the item.
18094 !! options
18095 language=zh variant=zh-cn
18096 !! wikitext
18097 ;-{zh-cn:AAA;zh-tw:BBB}-
18098 !! html/php
18099 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18100
18101 !! html/parsoid
18102 <dl><dt>AAA
18103 </dt></dl>
18104 !! end
18105
18106 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18107 !! test
18108 Don't break table handling if language converter markup is in the cell.
18109 !! options
18110 language=sr variant=sr-ec
18111 !! wikitext
18112 {|
18113 |-
18114 | -{R|B}-
18115 |}
18116 !! html/php
18117 <table>
18118
18119 <tr>
18120 <td>Б}-
18121 </td></tr></table>
18122
18123 !! html/parsoid
18124 <table>
18125
18126 <tr>
18127 <td> B
18128 </td></tr></table>
18129
18130 !! end
18131
18132 !! test
18133 Bug 529: Uncovered bullet
18134 !! wikitext
18135 * Foo {{bullet}}
18136 !! html
18137 <ul><li> Foo </li>
18138 <li> Bar</li></ul>
18139
18140 !! end
18141
18142 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18143 # Templates in Wikipedia rely on this behavior, as tidy has always been
18144 # enabled there. These tests are normally run *without* tidy, so specify the
18145 # full output here.
18146 # To test realistic parsing behavior, apply a tidy-like transformation to both
18147 # the expected output and your parser's output.
18148 !! test
18149 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18150 !! wikitext
18151 ******* Foo {{bullet}}
18152 !! html
18153 <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>
18154 <li> Bar</li></ul>
18155
18156 !! end
18157
18158 !! test
18159 Bug 529: Uncovered table already at line-start
18160 !! wikitext
18161 x
18162
18163 {{table}}
18164 y
18165 !! html
18166 <p>x
18167 </p>
18168 <table>
18169 <tr>
18170 <td> 1 </td>
18171 <td> 2
18172 </td></tr>
18173 <tr>
18174 <td> 3 </td>
18175 <td> 4
18176 </td></tr></table>
18177 <p>y
18178 </p>
18179 !! end
18180
18181 !! test
18182 Bug 529: Uncovered bullet in parser function result
18183 !! wikitext
18184 * Foo {{lc:{{bullet}} }}
18185 !! html
18186 <ul><li> Foo </li>
18187 <li> bar</li></ul>
18188
18189 !! end
18190
18191 !! test
18192 Bug 5678: Double-parsed template argument
18193 !! wikitext
18194 {{lc:{{{1}}}|hello}}
18195 !! html
18196 <p>{{{1}}}
18197 </p>
18198 !! end
18199
18200 !! test
18201 Bug 5678: Double-parsed template invocation
18202 !! wikitext
18203 {{lc:{{paramtest {{!}} param = hello }} }}
18204 !! html
18205 <p>{{paramtest | param = hello }}
18206 </p>
18207 !! end
18208
18209 !! test
18210 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18211 !! options
18212 language=cs
18213 title=[[Main Page]]
18214 !! wikitext
18215 {{PRVNÍVELKÉ:ěščř}}
18216 {{prvnívelké:ěščř}}
18217 {{PRVNÍMALÉ:ěščř}}
18218 {{prvnímalé:ěščř}}
18219 {{MALÁ:ěščř}}
18220 {{malá:ěščř}}
18221 {{VELKÁ:ěščř}}
18222 {{velká:ěščř}}
18223 !! html
18224 <p>Ěščř
18225 Ěščř
18226 ěščř
18227 ěščř
18228 ěščř
18229 ěščř
18230 ĚŠČŘ
18231 ĚŠČŘ
18232 </p>
18233 !! end
18234
18235 !! test
18236 Morwen/13: Unclosed link followed by heading
18237 !! wikitext
18238 [[link
18239 ==heading==
18240 !! html
18241 <p>[[link
18242 </p>
18243 <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>
18244
18245 !! end
18246
18247 !! test
18248 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18249 !! wikitext
18250 {{foo|
18251 =heading=
18252 !! html
18253 <p>{{foo|
18254 </p>
18255 <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>
18256
18257 !! end
18258
18259 !! test
18260 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18261 !! wikitext
18262 {{foo|
18263 ==heading==
18264 !! html
18265 <p>{{foo|
18266 </p>
18267 <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>
18268
18269 !! end
18270
18271 !! test
18272 Tildes in comments
18273 !! options
18274 pst
18275 !! wikitext
18276 <!-- ~~~~ -->
18277 !! html
18278 <!-- ~~~~ -->
18279 !! end
18280
18281 !! test
18282 Paragraphs inside divs (no extra line breaks)
18283 !! wikitext
18284 <div>Line one
18285
18286 Line two</div>
18287 !! html
18288 <div>Line one
18289 Line two</div>
18290
18291 !! end
18292
18293 !! test
18294 Paragraphs inside divs (extra line break on open)
18295 !! wikitext
18296 <div>
18297 Line one
18298
18299 Line two</div>
18300 !! html
18301 <div>
18302 <p>Line one
18303 </p>
18304 Line two</div>
18305
18306 !! end
18307
18308 !! test
18309 Paragraphs inside divs (extra line break on close)
18310 !! wikitext
18311 <div>Line one
18312
18313 Line two
18314 </div>
18315 !! html
18316 <div>Line one
18317 <p>Line two
18318 </p>
18319 </div>
18320
18321 !! end
18322
18323 !! test
18324 Paragraphs inside divs (extra line break on open and close)
18325 !! wikitext
18326 <div>
18327 Line one
18328
18329 Line two
18330 </div>
18331 !! html
18332 <div>
18333 <p>Line one
18334 </p><p>Line two
18335 </p>
18336 </div>
18337
18338 !! end
18339
18340 !! test
18341 Nesting tags, paragraphs on lines which begin with <div>
18342 !! wikitext
18343 <div></div><strong>A
18344 B</strong>
18345 !! html/php+tidy
18346 <p><strong>A</strong></p>
18347 <p><strong>B</strong></p>
18348 !! html/parsoid
18349 <div></div>
18350 <p><strong>A
18351 B</strong>
18352 </p>
18353 !! end
18354
18355 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18356 !! test
18357 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18358 !! wikitext
18359 <blockquote>Line one
18360
18361 Line two</blockquote>
18362 !! html
18363 <blockquote>Line one
18364 Line two</blockquote>
18365
18366 !! html+tidy
18367 <blockquote>
18368 <p>Line one Line two</p>
18369 </blockquote>
18370 !! end
18371
18372 !! test
18373 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18374 !! wikitext
18375 <blockquote>
18376 Line one
18377
18378 Line two</blockquote>
18379 !! html
18380 <blockquote>
18381 <p>Line one
18382 </p>
18383 Line two</blockquote>
18384
18385 !! html+tidy
18386 <blockquote>
18387 <p>Line one</p>
18388 Line two</blockquote>
18389 !! end
18390
18391 !! test
18392 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18393 !! wikitext
18394 <blockquote>Line one
18395
18396 Line two
18397 </blockquote>
18398 !! html
18399 <blockquote>Line one
18400 <p>Line two
18401 </p>
18402 </blockquote>
18403
18404 !! html+tidy
18405 <blockquote>
18406 <p>Line one</p>
18407 <p>Line two</p>
18408 </blockquote>
18409 !! end
18410
18411 !! test
18412 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18413 !! wikitext
18414 <blockquote>
18415 Line one
18416
18417 Line two
18418 </blockquote>
18419 !! html
18420 <blockquote>
18421 <p>Line one
18422 </p><p>Line two
18423 </p>
18424 </blockquote>
18425
18426 !! html+tidy
18427 <blockquote>
18428 <p>Line one</p>
18429 <p>Line two</p>
18430 </blockquote>
18431 !! end
18432
18433 !! test
18434 Paragraphs inside blockquotes/divs (no extra line breaks)
18435 !! wikitext
18436 <blockquote><div>Line one
18437
18438 Line two</div></blockquote>
18439 !! html
18440 <blockquote><div>Line one
18441 Line two</div></blockquote>
18442
18443 !! end
18444
18445 !! test
18446 Paragraphs inside blockquotes/divs (extra line break on open)
18447 !! wikitext
18448 <blockquote><div>
18449 Line one
18450
18451 Line two</div></blockquote>
18452 !! html
18453 <blockquote><div>
18454 <p>Line one
18455 </p>
18456 Line two</div></blockquote>
18457
18458 !! end
18459
18460 !! test
18461 Paragraphs inside blockquotes/divs (extra line break on close)
18462 !! wikitext
18463 <blockquote><div>Line one
18464
18465 Line two
18466 </div></blockquote>
18467 !! html
18468 <blockquote><div>Line one
18469 <p>Line two
18470 </p>
18471 </div></blockquote>
18472
18473 !! end
18474
18475 !! test
18476 Paragraphs inside blockquotes/divs (extra line break on open and close)
18477 !! wikitext
18478 <blockquote><div>
18479 Line one
18480
18481 Line two
18482 </div></blockquote>
18483 !! html
18484 <blockquote><div>
18485 <p>Line one
18486 </p><p>Line two
18487 </p>
18488 </div></blockquote>
18489
18490 !! end
18491
18492 !! test
18493 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18494 !! options
18495 wgLinkHolderBatchSize=0
18496 !! wikitext
18497 [[meatball:1]]
18498 [[meatball:2]]
18499 [[meatball:3]]
18500 !! html
18501 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18502 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18503 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18504 </p>
18505 !! end
18506
18507 !! test
18508 Free external link invading image caption
18509 !! wikitext
18510 [[Image:Foobar.jpg|thumb|http://x|hello]]
18511 !! html
18512 <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>
18513
18514 !! end
18515
18516 !! test
18517 Bug 15196: localised external link numbers
18518 !! options
18519 language=fa
18520 !! wikitext
18521 [http://en.wikipedia.org/]
18522 !! html/php
18523 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18524 </p>
18525 !! html/parsoid
18526 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18527 !! end
18528
18529 !! test
18530 Multibyte character in padleft
18531 !! wikitext
18532 {{padleft:-Hello|7|Æ}}
18533 !! html
18534 <p>Æ-Hello
18535 </p>
18536 !! end
18537
18538 !! test
18539 Multibyte character in padright
18540 !! wikitext
18541 {{padright:Hello-|7|Æ}}
18542 !! html
18543 <p>Hello-Æ
18544 </p>
18545 !! end
18546
18547 !!test
18548 formatdate parser function
18549 !! wikitext
18550 {{#formatdate:2009-03-24}}
18551 !! html
18552 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18553 </p>
18554 !! end
18555
18556 !!test
18557 formatdate parser function, with default format
18558 !! wikitext
18559 {{#formatdate:2009-03-24|mdy}}
18560 !! html
18561 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18562 </p>
18563 !! end
18564
18565 !! test
18566 Spacing of numbers in formatted dates
18567 !! wikitext
18568 {{#formatdate:January 15}}
18569 !! html
18570 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18571 </p>
18572 !! end
18573
18574 !! test
18575 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
18576 !! options
18577 language=nl title=[[MediaWiki:Common.css]]
18578 !! wikitext
18579 {{#formatdate:2009-03-24|dmy}}
18580 !! html
18581 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18582 </p>
18583 !! end
18584
18585 #
18586 #
18587 #
18588
18589 #
18590 # Edit comments
18591 #
18592
18593 !! test
18594 Edit comment with link
18595 !! options
18596 comment
18597 !! wikitext
18598 I like the [[Main Page]] a lot
18599 !! html
18600 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18601 !!end
18602
18603 !! test
18604 Edit comment with link and link text
18605 !! options
18606 comment
18607 !! wikitext
18608 I like the [[Main Page|best pages]] a lot
18609 !! html
18610 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18611 !!end
18612
18613 !! test
18614 Edit comment with link and link text with suffix
18615 !! options
18616 comment
18617 !! wikitext
18618 I like the [[Main Page|best page]]s 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 section link (non-local, eg in history list)
18625 !! options
18626 comment title=[[Main Page]]
18627 !! wikitext
18628 /* External links */ removed bogus entries
18629 !! html
18630 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18631 !!end
18632
18633 !! test
18634 Edit comment with section link and text before it (non-local, eg in history list)
18635 !! options
18636 comment title=[[Main Page]]
18637 !! wikitext
18638 pre-comment text /* External links */ removed bogus entries
18639 !! html
18640 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>
18641 !!end
18642
18643 !! test
18644 Edit comment with section link (local, eg in diff view)
18645 !! options
18646 comment local title=[[Main Page]]
18647 !! wikitext
18648 /* External links */ removed bogus entries
18649 !! html
18650 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18651 !!end
18652
18653 !! test
18654 Edit comment with subpage link (bug 14080)
18655 !! options
18656 comment
18657 subpage
18658 title=[[Subpage test]]
18659 !! wikitext
18660 Poked at a [[/subpage]] here...
18661 !! html
18662 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18663 !!end
18664
18665 !! test
18666 Edit comment with subpage link and link text (bug 14080)
18667 !! options
18668 comment
18669 subpage
18670 title=[[Subpage test]]
18671 !! wikitext
18672 Poked at a [[/subpage|neat little page]] here...
18673 !! html
18674 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18675 !!end
18676
18677 !! test
18678 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18679 !! options
18680 comment
18681 title=[[Subpage test]]
18682 !! wikitext
18683 Poked at a [[/subpage]] here...
18684 !! html
18685 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...
18686 !!end
18687
18688 !! test
18689 Edit comment with bare anchor link (local, as on diff)
18690 !! options
18691 comment
18692 local
18693 title=[[Main Page]]
18694 !! wikitext
18695 [[#section]]
18696 !! html
18697 <a href="#section">#section</a>
18698 !! end
18699
18700 !! test
18701 Edit comment with bare anchor link (non-local, as on history)
18702 !! options
18703 comment
18704 title=[[Main Page]]
18705 !! wikitext
18706 [[#section]]
18707 !! html
18708 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18709 !! end
18710
18711 !! test
18712 Anchor starting with underscore
18713 !! wikitext
18714 [[#_ref|One]]
18715 !! html
18716 <p><a href="#_ref">One</a>
18717 </p>
18718 !! end
18719
18720 !! test
18721 Id starting with underscore
18722 !! wikitext
18723 <div id="_ref"></div>
18724 !! html
18725 <div id="_ref"></div>
18726
18727 !! end
18728
18729 !! test
18730 Space normalisation on autocomment (bug 22784)
18731 !! options
18732 comment
18733 title=[[Main Page]]
18734 !! wikitext
18735 /* __hello__world__ */
18736 !! html
18737 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18738 !! end
18739
18740 !! test
18741 percent-encoding and + signs in comments (Bug 26410)
18742 !! options
18743 comment
18744 !! wikitext
18745 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18746 !! html
18747 <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>
18748 !! end
18749
18750 # Parsoid doesn't support this yet: see bug 73581
18751 # but it *should* omit the 'src' attribute if the image is bad.
18752 # PHP side of tests was disabled in
18753 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18754 # because of issues in the PHP parserTests infrastructure
18755 # (but the output below is indeed what the PHP side emits)
18756 !! test
18757 Bad images - basic functionality
18758 !! wikitext
18759 [[File:Bad.jpg]]
18760 !! DISABLED/html/php
18761 !! html/parsoid
18762 <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>
18763 !! end
18764
18765 !! test
18766 Bad images - bug 16039: text after bad image disappears
18767 !! wikitext
18768 Foo bar
18769 [[File:Bad.jpg]]
18770 Bar foo
18771 !! DISABLED/html/php
18772 <p>Foo bar
18773 </p><p>Bar foo
18774 </p>
18775 !! html/parsoid
18776 <p>Foo bar
18777 <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>
18778 Bar foo</p>
18779 !! end
18780
18781 !! test
18782 Verify that displaytitle works (bug #22501) no displaytitle
18783 !! options
18784 showtitle
18785 !! config
18786 wgAllowDisplayTitle=true
18787 wgRestrictDisplayTitle=false
18788 !! wikitext
18789 this is not the the title
18790 !! html
18791 Parser test
18792 <p>this is not the the title
18793 </p>
18794 !! end
18795
18796 !! test
18797 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18798 !! options
18799 showtitle
18800 title=[[Screen]]
18801 !! config
18802 wgAllowDisplayTitle=true
18803 wgRestrictDisplayTitle=false
18804 !! wikitext
18805 this is not the the title
18806 {{DISPLAYTITLE:whatever}}
18807 !! html
18808 whatever
18809 <p>this is not the the title
18810 </p>
18811 !! end
18812
18813 !! test
18814 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18815 !! options
18816 showtitle
18817 title=[[Screen]]
18818 !! config
18819 wgAllowDisplayTitle=true
18820 wgRestrictDisplayTitle=true
18821 !! wikitext
18822 this is not the the title
18823 {{DISPLAYTITLE:whatever}}
18824 !! html
18825 Screen
18826 <p>this is not the the title
18827 </p>
18828 !! end
18829
18830 !! test
18831 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18832 !! options
18833 showtitle
18834 title=[[Screen]]
18835 !! config
18836 wgAllowDisplayTitle=true
18837 wgRestrictDisplayTitle=true
18838 !! wikitext
18839 this is not the the title
18840 {{DISPLAYTITLE:screen}}
18841 !! html
18842 screen
18843 <p>this is not the the title
18844 </p>
18845 !! end
18846
18847 !! test
18848 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18849 !! options
18850 showtitle
18851 title=[[Screen]]
18852 !! config
18853 wgAllowDisplayTitle=false
18854 !! wikitext
18855 this is not the the title
18856 {{DISPLAYTITLE:screen}}
18857 !! html
18858 Screen
18859 <p>this is not the the title
18860 <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>
18861 </p>
18862 !! end
18863
18864 !! test
18865 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18866 !! options
18867 showtitle
18868 title=[[Screen]]
18869 !! config
18870 wgAllowDisplayTitle=false
18871 !! wikitext
18872 this is not the the title
18873 !! html
18874 Screen
18875 <p>this is not the the title
18876 </p>
18877 !! end
18878
18879 !! test
18880 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18881 !! options
18882 showtitle
18883 title=[[Screen]]
18884 !! config
18885 wgAllowDisplayTitle=true
18886 wgRestrictDisplayTitle=true
18887 !! wikitext
18888 this is not the the title
18889 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18890 !! html
18891 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18892 <p>this is not the the title
18893 </p>
18894 !! end
18895
18896 !! test
18897 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18898 !! options
18899 showtitle
18900 title=[[Screen]]
18901 !! config
18902 wgAllowDisplayTitle=true
18903 wgRestrictDisplayTitle=true
18904 !! wikitext
18905 this is not the the title
18906 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18907 !! html
18908 <span style="color: red;">s</span>creen
18909 <p>this is not the the title
18910 </p>
18911 !! end
18912
18913 !! test
18914 preload: check <noinclude> and <includeonly>
18915 !! options
18916 preload
18917 !! wikitext
18918 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18919 !! html
18920 Hello kind world.
18921 !! end
18922
18923 !! test
18924 preload: check <onlyinclude>
18925 !! options
18926 preload
18927 !! wikitext
18928 Goodbye <onlyinclude>Hello world</onlyinclude>
18929 !! html
18930 Hello world
18931 !! end
18932
18933 !! test
18934 preload: can pass tags through if we want to
18935 !! options
18936 preload
18937 !! wikitext
18938 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18939 !! html
18940 <includeonly>Hello world</includeonly>
18941 !! end
18942
18943 !! test
18944 preload: check that it doesn't try to do tricks
18945 !! options
18946 preload
18947 !! wikitext
18948 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18949 !! html
18950 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18951 !! end
18952
18953 !! test
18954 Play a bit with r67090 and bug 3158
18955 !! wikitext
18956 <div style="width:50% !important">&nbsp;</div>
18957 <div style="width:50%&nbsp;!important">&nbsp;</div>
18958 <div style="width:50%&#160;!important">&nbsp;</div>
18959 <div style="border : solid;">&nbsp;</div>
18960 !! html/php
18961 <div style="width:50% !important">&#160;</div>
18962 <div style="width:50% !important">&#160;</div>
18963 <div style="width:50% !important">&#160;</div>
18964 <div style="border&#160;: solid;">&#160;</div>
18965
18966 !! html/parsoid
18967 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18968 <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>
18969 <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>
18970 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18971
18972 !! end
18973
18974 !! test
18975 HTML5 data attributes
18976 !! wikitext
18977 <span data-foo="bar">Baz</span>
18978 <p data-abc-def_hij="">Quuz</p>
18979 !! html
18980 <p><span data-foo="bar">Baz</span>
18981 </p>
18982 <p data-abc-def_hij="">Quuz</p>
18983
18984 !! end
18985
18986 !! test
18987 percent-encoding and + signs in internal links (Bug 26410)
18988 !! wikitext
18989 [[User:+%]] [[Page+title%]]
18990 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18991 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18992 [[%33%45]] [[%33%45+]]
18993 !! html/php
18994 <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>
18995 <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>
18996 <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>
18997 <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>
18998 </p>
18999 !! html/parsoid
19000 <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>
19001 !! end
19002
19003 !! test
19004 Special characters in embedded file links (bug 27679)
19005 !! wikitext
19006 [[File:Contains & ampersand.jpg]]
19007 [[File:Does not exist.jpg|Title with & ampersand]]
19008 !! html/php
19009 <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>
19010 <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>
19011 </p>
19012 !! html/parsoid
19013 <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>
19014 <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>
19015 !! end
19016
19017 !! test
19018 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19019 !! wikitext
19020 Text&apos;s been normalized?
19021 !! html
19022 <p>Text&#39;s been normalized?
19023 </p>
19024 !! end
19025
19026 !! test
19027 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19028 !! wikitext
19029 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19030 !! html
19031 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19032 </p>
19033 !! end
19034
19035 !! test
19036 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19037 !! wikitext
19038 [http://www.example.org/ ideograms]
19039 !! html
19040 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19041 </p>
19042 !! end
19043
19044 !! test
19045 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19046 !! wikitext
19047 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19048 !! html
19049 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19050 </p>
19051 !! end
19052
19053 !! article
19054 Mediawiki:loop1
19055 !! text
19056 {{Identical|A}}
19057 !! endarticle
19058
19059 !! article
19060 Mediawiki:loop2
19061 !! text
19062 {{Identical|B}}
19063 !! endarticle
19064
19065 !! article
19066 Template:Identical
19067 !! text
19068 {{int:loop1}}
19069 {{int:loop2}}
19070 !! endarticle
19071
19072 !! test
19073 Bug 31098 Template which includes system messages which includes the template
19074 !! wikitext
19075 {{Identical}}
19076 !! html
19077 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19078 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19079 </p>
19080 !! end
19081
19082 !! test
19083 Bug31490 Turkish: ucfirst 'blah'
19084 !! options
19085 language=tr
19086 !! wikitext
19087 {{ucfirst:blah}}
19088 !! html
19089 <p>Blah
19090 </p>
19091 !! end
19092
19093 !! test
19094 Bug31490 Turkish: ucfirst 'ix'
19095 !! options
19096 language=tr
19097 !! wikitext
19098 {{ucfirst:ix}}
19099 !! html
19100 <p>İx
19101 </p>
19102 !! end
19103
19104 !! test
19105 Bug31490 Turkish: lcfirst 'BLAH'
19106 !! options
19107 language=tr
19108 !! wikitext
19109 {{lcfirst:BLAH}}
19110 !! html
19111 <p>bLAH
19112 </p>
19113 !! end
19114
19115 !! test
19116 Bug31490 Turkish: ucfırst (with a dotless i)
19117 !! options
19118 language=tr
19119 !! wikitext
19120 {{ucfırst:blah}}
19121 !! html
19122 <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>
19123 </p>
19124 !! end
19125
19126 !! test
19127 Bug31490 ucfırst (with a dotless i) with English language
19128 !! options
19129 language=en
19130 !! wikitext
19131 {{ucfırst:blah}}
19132 !! html
19133 <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>
19134 </p>
19135 !! end
19136
19137 !! test
19138 Bug 26375: TOC with italics
19139 !! options
19140 title=[[Main Page]]
19141 !! wikitext
19142 __TOC__
19143 == ''Lost'' episodes ==
19144 !! html
19145 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19146 <ul>
19147 <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>
19148 </ul>
19149 </div>
19150
19151 <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>
19152
19153 !! end
19154
19155 !! test
19156 Bug 26375: TOC with bold
19157 !! options
19158 title=[[Main Page]]
19159 !! wikitext
19160 __TOC__
19161 == '''should be bold''' then normal text ==
19162 !! html
19163 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19164 <ul>
19165 <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>
19166 </ul>
19167 </div>
19168
19169 <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>
19170
19171 !! end
19172
19173 !! test
19174 Bug 33845: Headings become cursive in TOC when they contain an image
19175 !! options
19176 title=[[Main Page]]
19177 !! wikitext
19178 __TOC__
19179 == Image [[Image:foobar.jpg]] ==
19180 !! html
19181 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19182 <ul>
19183 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19184 </ul>
19185 </div>
19186
19187 <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>
19188
19189 !! end
19190
19191 !! test
19192 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19193 !! options
19194 title=[[Main Page]]
19195 !! wikitext
19196 __TOC__
19197 == <blockquote>Quote</blockquote> ==
19198 !! html
19199 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19200 <ul>
19201 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19202 </ul>
19203 </div>
19204
19205 <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>
19206
19207 !! html+tidy
19208 <div id="toc" class="toc">
19209 <div id="toctitle">
19210 <h2>Contents</h2>
19211 </div>
19212 <ul>
19213 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19214 </ul>
19215 </div>
19216 <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>
19217 <blockquote>
19218 <p><span class="mw-headline" id="Quote">Quote</span></p>
19219 </blockquote>
19220 <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>
19221 !! end
19222
19223 !! test
19224 Unclosed tags in TOC
19225 !! options
19226 title=[[Main Page]]
19227 !! wikitext
19228 __TOC__
19229 == Proof: 2 < 3 ==
19230 <small>Hanc marginis exiguitas non caperet.</small>
19231 QED
19232 !! html
19233 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19234 <ul>
19235 <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>
19236 </ul>
19237 </div>
19238
19239 <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>
19240 <p><small>Hanc marginis exiguitas non caperet.</small>
19241 QED
19242 </p>
19243 !! end
19244
19245 !! test
19246 Multiple tags in TOC
19247 !! wikitext
19248 __TOC__
19249 == <i>Foo</i> <b>Bar</b> ==
19250
19251 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19252 !! html
19253 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19254 <ul>
19255 <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>
19256 <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>
19257 </ul>
19258 </div>
19259
19260 <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>
19261 <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>
19262
19263 !! html+tidy
19264 <div id="toc" class="toc">
19265 <div id="toctitle">
19266 <h2>Contents</h2>
19267 </div>
19268 <ul>
19269 <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>
19270 <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>
19271 </ul>
19272 </div>
19273 <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>
19274 <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>
19275 <blockquote>
19276 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19277 </blockquote>
19278 <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>
19279 !! end
19280
19281 !! test
19282 Tags with parameters in TOC
19283 !! wikitext
19284 __TOC__
19285 == <sup class="in-h2">Hello</sup> ==
19286
19287 == <sup class="a > b">Evilbye</sup> ==
19288 !! html
19289 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19290 <ul>
19291 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19292 <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>
19293 </ul>
19294 </div>
19295
19296 <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>
19297 <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>
19298
19299 !! end
19300
19301 !! test
19302 span tags with directionality in TOC
19303 !! wikitext
19304 __TOC__
19305 == <span dir="ltr">C++</span> ==
19306
19307 == <span dir="rtl">זבנג!</span> ==
19308
19309 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19310
19311 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19312
19313 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19314 !! html
19315 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19316 <ul>
19317 <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>
19318 <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>
19319 <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>
19320 <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>
19321 <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>
19322 </ul>
19323 </div>
19324
19325 <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>
19326 <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>
19327 <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>
19328 <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>
19329 <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>
19330
19331 !! end
19332
19333 !! test
19334 Bug 72884: bdi element in ToC
19335 !! wikitext
19336 __TOC__
19337 == <bdi>test</bdi> ==
19338 !! html
19339 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19340 <ul>
19341 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19342 </ul>
19343 </div>
19344
19345 <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>
19346
19347 !! end
19348
19349 !! article
19350 MediaWiki:Bug32057
19351 !! text
19352 == {{int:headline_sample}} ==
19353 !! endarticle
19354
19355 !! test
19356 Bug 32057: Title needed when expanding <h> nodes.
19357 !! options
19358 title=[[Main Page]]
19359 !! wikitext
19360 {{int:Bug32057}}
19361 !! html
19362 <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>
19363
19364 !! end
19365
19366 !! test
19367 Strip marker in urlencode
19368 !! wikitext
19369 {{urlencode:x<nowiki/>y}}
19370 {{urlencode:x<nowiki/>y|wiki}}
19371 {{urlencode:x<nowiki/>y|path}}
19372 !! html
19373 <p>xy
19374 xy
19375 xy
19376 </p>
19377 !! end
19378
19379 !! test
19380 Strip marker in lc
19381 !! wikitext
19382 {{lc:x<nowiki/>y}}
19383 !! html
19384 <p>xy
19385 </p>
19386 !! end
19387
19388 !! test
19389 Strip marker in uc
19390 !! wikitext
19391 {{uc:x<nowiki/>y}}
19392 !! html
19393 <p>XY
19394 </p>
19395 !! end
19396
19397 !! test
19398 Strip marker in formatNum
19399 !! wikitext
19400 {{formatnum:1<nowiki/>2}}
19401 {{formatnum:1<nowiki/>2|R}}
19402 !! html
19403 <p>12
19404 12
19405 </p>
19406 !! end
19407
19408 !! test
19409 Check noCommafy in formatNum
19410 !! options
19411 language=be-tarask
19412 !! wikitext
19413 {{formatnum:123456.78}}
19414 {{formatnum:123456.78|NOSEP}}
19415 !! html
19416 <p>123 456,78
19417 123456.78
19418 </p>
19419 !! end
19420
19421 !! test
19422 Wrong option for formatNum (bug 56199)
19423 !! wikitext
19424 {{formatnum:1,234.56|Random}}
19425 {{formatnum:1,234.56|EVERYTHING}}
19426 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19427 !! html
19428 <p>1,234.56
19429 1,234.56
19430 1,234.56
19431 </p>
19432 !! end
19433
19434 !! test
19435 Strip marker in grammar
19436 !! options
19437 language=fi
19438 !! wikitext
19439 {{grammar:elative|foo<nowiki/>bar}}
19440 !! html
19441 <p>foobarista
19442 </p>
19443 !! end
19444
19445 !! test
19446 Strip marker in padleft
19447 !! wikitext
19448 {{padleft:|2|x<nowiki/>y}}
19449 !! html
19450 <p>xy
19451 </p>
19452 !! end
19453
19454 !! test
19455 Strip marker in padright
19456 !! wikitext
19457 {{padright:|2|x<nowiki/>y}}
19458 !! html
19459 <p>xy
19460 </p>
19461 !! end
19462
19463 !! test
19464 Strip marker in anchorencode
19465 !! wikitext
19466 {{anchorencode:x<nowiki/>y}}
19467 !! html
19468 <p>xy
19469 </p>
19470 !! end
19471
19472 !! test
19473 nowiki inside link inside heading (bug 18295)
19474 !! wikitext
19475 ==[[foo|x<nowiki>y</nowiki>z]]==
19476 !! html
19477 <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>
19478
19479 !! end
19480
19481 !! test
19482 new support for bdi element (bug 31817)
19483 !! wikitext
19484 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19485 !! html
19486 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19487
19488 !!end
19489
19490 !! test
19491 Ignore pipe between table row attributes
19492 !! wikitext
19493 {|
19494 | quux
19495 |- id=foo | style='color: red'
19496 | bar
19497 |}
19498 !! html
19499 <table>
19500 <tr>
19501 <td> quux
19502 </td></tr>
19503 <tr id="foo" style="color: red">
19504 <td> bar
19505 </td></tr></table>
19506
19507 !! end
19508
19509 !!test
19510 Gallery override link with WikiLink (bug 34852)
19511 !! wikitext
19512 <gallery>
19513 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19514 </gallery>
19515 !! html
19516 <ul class="gallery mw-gallery-traditional">
19517 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19518 <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>
19519 <div class="gallerytext">
19520 <p>caption
19521 </p>
19522 </div>
19523 </div></li>
19524 </ul>
19525
19526 !! end
19527
19528 !!test
19529 Gallery override link with absolute external link (bug 34852)
19530 !! wikitext
19531 <gallery>
19532 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19533 </gallery>
19534 !! html
19535 <ul class="gallery mw-gallery-traditional">
19536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19537 <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>
19538 <div class="gallerytext">
19539 <p>caption
19540 </p>
19541 </div>
19542 </div></li>
19543 </ul>
19544
19545 !! end
19546
19547 !!test
19548 Gallery override link with malicious javascript (bug 34852)
19549 !! wikitext
19550 <gallery>
19551 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19552 </gallery>
19553 !! html
19554 <ul class="gallery mw-gallery-traditional">
19555 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19556 <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>
19557 <div class="gallerytext">
19558 <p>caption
19559 </p>
19560 </div>
19561 </div></li>
19562 </ul>
19563
19564 !! end
19565
19566 !!test
19567 Gallery with invalid title as link (bug 43964)
19568 !! wikitext
19569 <gallery>
19570 File:foobar.jpg|link=<
19571 </gallery>
19572 !! html
19573 <ul class="gallery mw-gallery-traditional">
19574 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19575 <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>
19576 <div class="gallerytext">
19577 </div>
19578 </div></li>
19579 </ul>
19580
19581 !! end
19582
19583 !!test
19584 Language parser function
19585 !! wikitext
19586 {{#language:ar}}
19587 !! html
19588 <p>العربية
19589 </p>
19590 !! end
19591
19592 !!test
19593 Padleft and padright as substr
19594 !! wikitext
19595 {{padleft:|3|abcde}}
19596 {{padright:|3|abcde}}
19597 !! html
19598 <p>abc
19599 abc
19600 </p>
19601 !! end
19602
19603 !!test
19604 Special parser function
19605 !! wikitext
19606 {{#special:RandomPage}}
19607 {{#special:BaDtItLe}}
19608 {{#special:Foobar}}
19609 !! html
19610 <p>Special:Random
19611 Special:Badtitle
19612 Special:Foobar
19613 </p>
19614 !! end
19615
19616 !!test
19617 Bug 34939 - Case insensitive link parsing ([HttP://])
19618 !! wikitext
19619 [HttP://MediaWiki.Org/]
19620 !! html/php
19621 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19622 </p>
19623 !! html/parsoid
19624 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19625 !! end
19626
19627 !!test
19628 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19629 !! wikitext
19630 [HttP://MediaWiki.Org/ MediaWiki]
19631 !! html
19632 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19633 </p>
19634 !! end
19635
19636 !!test
19637 Bug 34939 - Case insensitive link parsing (HttP://)
19638 !! wikitext
19639 HttP://MediaWiki.Org/
19640 !! html/php
19641 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19642 </p>
19643 !! html/parsoid
19644 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19645 !! end
19646
19647 !!test
19648 Disable TOC
19649 !! options
19650 notoc
19651 !! wikitext
19652 Lead
19653 == Section 1 ==
19654 == Section 2 ==
19655 == Section 3 ==
19656 == Section 4 ==
19657 == Section 5 ==
19658 !! html
19659 <p>Lead
19660 </p>
19661
19662 <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>
19663 <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>
19664 <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>
19665 <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>
19666 <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>
19667
19668 !! end
19669
19670
19671 ###
19672 ### Parsoid-specific tests
19673 ### Parsoid-PHP parser incompatibilities
19674 ###
19675 !!test
19676 1. SOL-sensitive wikitext tokens as template-args
19677 !!options
19678 parsoid=wt2html,wt2wt
19679 !! wikitext
19680 {{echo|*a}}
19681 {{echo|#a}}
19682 {{echo|:a}}
19683 !! html
19684 <span about="#mwt1" typeof="mw:Transclusion">
19685 </span><ul about="#mwt1"><li>a</li>
19686 </ul>
19687 <span about="#mwt2" typeof="mw:Transclusion">
19688 </span><ol about="#mwt2"><li>a</li>
19689 </ol>
19690 <span about="#mwt3" typeof="mw:Transclusion">
19691 </span><dl about="#mwt3"><dd>a</dd>
19692 </dl>
19693 !!end
19694
19695 #### -----------------------------------------------------------------
19696 #### Parsoid-specific functionality tests
19697 #### -----------------------------------------------------------------
19698
19699 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19700 # We know wt2wt will fail, but we expect selser to pass.
19701 # Due to the nature of our testing, wt2wt and selser tests will enter the
19702 # blacklist and we'll catch selser regressions based on changes to the
19703 # blacklist entries for selser tests.
19704 !! test
19705 1. Bad treebuilder fixup of formatting elt is cleaned up
19706 !! options
19707 parsoid=wt2html,wt2wt
19708 !! wikitext
19709 {|
19710 |
19711 <small>
19712 [[Image:Foobar.jpg|right|Test]]
19713 </small>
19714 |}
19715 !! html/parsoid
19716 <table>
19717 <tbody><tr><td>
19718 <small>
19719 <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>
19720 </small>
19721 </td></tr>
19722 </tbody></table>
19723 !! end
19724
19725 !! test
19726 2. Bad treebuilder fixup of formatting elt is cleaned up
19727 !! options
19728 parsoid=wt2html,wt2wt
19729 !! wikitext
19730 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19731
19732 <small>[[Image:Foobar.jpg|right|300px]]</small>
19733 !! html/parsoid
19734 <p><b>foo</b></p>
19735 <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>
19736 <p><b>bar</b></p>
19737 <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>
19738 !! end
19739
19740 #### ----------------------------------------------------------------
19741 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19742 #### tags. Parsoid's output for these tags differs from that of the
19743 #### PHP parser.
19744 #### ----------------------------------------------------------------
19745
19746 !!test
19747 Ref: 1. ref-location should be replaced with an index span
19748 !!options
19749 parsoid
19750 !! wikitext
19751 A <ref>foo</ref>
19752 B <ref name="x">foo</ref>
19753 C <ref name="y" />
19754 <references />
19755 !! html
19756 <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>
19757 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>
19758 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>
19759 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
19760 <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>
19761 <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>
19762 <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>
19763 </ol>
19764 !!end
19765
19766 !!test
19767 Ref: 2. ref-tags with identical names should all get the same index
19768 !!options
19769 parsoid
19770 !! wikitext
19771 A <ref name="x">foo</ref>
19772 B <ref name="x" />
19773 <references />
19774 !! html
19775 <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>
19776 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>
19777 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
19778 <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>
19779 </ol>
19780 !!end
19781
19782 !!test
19783 Ref: 3. spaces in ref-names should be ignored
19784 !!options
19785 parsoid
19786 !! wikitext
19787 A <ref name="x">foo</ref>
19788 B <ref name=" x " />
19789 C <ref name= x />
19790 <references />
19791 !! html
19792 <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>
19793 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>
19794 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>
19795 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
19796 <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>
19797 </ol>
19798 !!end
19799
19800 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19801 !!test
19802 Ref: 4. 'constructor' should be accepted as a valid ref-name
19803 !!options
19804 parsoid
19805 !! wikitext
19806 A <ref name="constructor">foo</ref>
19807 <references />
19808 !! html
19809 <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>
19810 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19811 <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>
19812 </ol>
19813 !!end
19814
19815 !!test
19816 Ref: 5. body should accept generic wikitext
19817 !!options
19818 parsoid
19819 !! wikitext
19820 A <ref>
19821 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19822 </ref>
19823
19824 <references />
19825 !! html
19826 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19827
19828 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19829 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <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>
19830 </span></li>
19831 </ol>
19832 !!end
19833
19834 !!test
19835 Ref: 6. indent-pres should not be output in ref-body
19836 !!options
19837 parsoid
19838 !! wikitext
19839 A <ref>
19840 foo
19841 bar
19842 baz
19843 </ref>
19844
19845 <references />
19846 !! html
19847 <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>
19848
19849 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19850 <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
19851 bar
19852 baz
19853 </span></li>
19854 </ol>
19855 !!end
19856
19857 !!test
19858 Ref: 7. No p-wrapping in ref-body
19859 !!options
19860 parsoid
19861 !! wikitext
19862 A <ref>
19863 foo
19864
19865 bar
19866
19867
19868 baz
19869
19870
19871
19872 booz
19873 </ref>
19874
19875 <references />
19876 !! html
19877 <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>
19878
19879 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19880 <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
19881
19882 bar
19883
19884
19885 baz
19886
19887
19888
19889 booz
19890 </span></li>
19891 </ol>
19892 !!end
19893
19894 !!test
19895 Ref: 8. transclusion wikitext has lower precedence
19896 !!options
19897 parsoid
19898 !! wikitext
19899 A <ref> foo {{echo|</ref> B C}}
19900
19901 <references />
19902 !! html
19903 <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>
19904 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19905 <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>
19906 </ol>
19907 !!end
19908
19909 !!test
19910 Ref: 9. unclosed comments should not leak out of ref-body
19911 !!options
19912 parsoid
19913 !! wikitext
19914 A <ref> foo <!--</ref> B C
19915 <references />
19916 !! html
19917 <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>
19918 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19919 <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>
19920 </ol>
19921 !!end
19922
19923 !!test
19924 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19925 !!options
19926 parsoid
19927 !! wikitext
19928 A <ref> <b> foo </ref> B C
19929
19930 <references />
19931 !! html
19932 <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>
19933
19934
19935 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19936 <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>
19937 </ol>
19938 !!end
19939
19940 !!test
19941 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19942 !!options
19943 parsoid
19944 !! wikitext
19945 A <ref>foo</ref> B
19946 C <ref>bar</ref> D
19947 <references />
19948 !! html
19949 <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
19950 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>
19951 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
19952 <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>
19953 <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>
19954 </ol>
19955 !!end
19956
19957 !!test
19958 Ref: 12. ref-tags act as trailing newline migration barrier
19959 !!options
19960 parsoid
19961 !! wikitext
19962 <!--the newline at the end of this line moves out of the p-tag-->a
19963
19964 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19965 <ref />
19966
19967 c
19968 <references />
19969 !! html
19970 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19971
19972
19973 <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>
19974 <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>
19975
19976 <p>c</p>
19977 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
19978 <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>
19979 <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>
19980 !!end
19981
19982 !!test
19983 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19984 !!options
19985 parsoid
19986 !! wikitext
19987 <ref>foo</ref> A
19988 <ref>bar
19989 </ref> B
19990 <references />
19991 !! html
19992 <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
19993 <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>
19994 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
19995 <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>
19996 <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
19997 </span></li>
19998 </ol>
19999 !!end
20000
20001 !!test
20002 Ref: 14. A nested ref-tag should be emitted as plain text
20003 !!options
20004 parsoid
20005 !! wikitext
20006 <ref>foo <ref>bar</ref> baz</ref>
20007
20008 <references />
20009 !! html
20010 <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>
20011 </p>
20012 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20013 <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>
20014 </ol>
20015 !!end
20016
20017 !!test
20018 Ref: 15. ref-tags with identical names should get identical indexes
20019 !!options
20020 parsoid
20021 !! wikitext
20022 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20023 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20024
20025 <references />
20026 !! html
20027 <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>
20028 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>
20029
20030 <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>
20031 </ol>
20032 !!end
20033
20034 ## We don't bother wt2wt-ing non-standard whitespace
20035 !!test
20036 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20037 !!options
20038 parsoid=wt2html
20039 !! wikitext
20040 A <ref >foo</ref >
20041
20042 <references />
20043 !! html
20044 <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>
20045 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20046 <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>
20047 !!end
20048
20049 !!test
20050 Ref: 17. Generate valid HTML5 id/about attributes
20051 !!options
20052 parsoid
20053 !!wikitext
20054 <ref name="a b">foo</ref>
20055
20056 <references />
20057 !!html
20058 <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>
20059 </p>
20060
20061 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20062 <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>
20063 </ol>
20064 !!end
20065
20066 !!test
20067 Ref: 18. T58916: Extension attributes should be parsed as plain text
20068 !!options
20069 parsoid
20070 !!wikitext
20071 <ref name="{{echo|a}}">foo</ref>
20072
20073 <references />
20074 !!html
20075 <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>
20076 </p>
20077
20078 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20079 <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>
20080 </ol>
20081 !!end
20082
20083 !!test
20084 Ref: 19. ref-tags with identical name encodings should get identical indexes
20085 !!options
20086 parsoid
20087 !! wikitext
20088 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20089
20090 <references />
20091 !! html
20092 <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>
20093 </p>
20094 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20095 <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>
20096 </ol>
20097 !!end
20098
20099 !!test
20100 Ref: 20. ref-tags with identical names but different content should keep it
20101 !!options
20102 parsoid
20103 !! wikitext
20104 A <ref name="foo">Foo one</ref>
20105 B <ref name="foo">Foo two</ref>
20106 C <ref name="foo" />
20107
20108 <references />
20109 !! html
20110 <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>
20111 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>
20112 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>
20113
20114 <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>
20115 </ol>
20116 !!end
20117
20118 !!test
20119 References: 1. references tag without any refs should be handled properly
20120 !!options
20121 parsoid
20122 !! wikitext
20123 <references />
20124 !! html
20125 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20126 !!end
20127
20128 !!test
20129 References: 2. references tag with group only outputs references from that group
20130 !!options
20131 parsoid
20132 !! wikitext
20133 A <ref group="a">foo</ref>
20134 B <ref group="b">bar</ref>
20135 C <ref>baz</ref>
20136
20137 <references group="a" />
20138 <references />
20139 <references group="b" />
20140 !! html
20141 <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>
20142 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>
20143 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>
20144
20145 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20146 <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>
20147 </ol>
20148 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20149 <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>
20150 </ol>
20151 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20152 <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>
20153 </ol>
20154 !!end
20155
20156 !!test
20157 References: 3. ref list should be cleared after processing references
20158 !!options
20159 parsoid
20160 !! wikitext
20161 A <ref>foo</ref>
20162
20163 <references />
20164
20165 B <ref>bar</ref>
20166
20167 <references />
20168 !! html
20169 <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>
20170
20171 <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>
20172 </ol>
20173
20174 <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>
20175
20176 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20177 <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>
20178 </ol>
20179 !!end
20180
20181 !!test
20182 References: 4. only referenced group should be cleared after processing references
20183 !!options
20184 parsoid
20185 !! wikitext
20186 A <ref group="a">afoo</ref>
20187 B <ref>bfoo</ref>
20188
20189 <references group="a" />
20190
20191 C <ref>cfoo</ref>
20192
20193 <references />
20194 !! html
20195 <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>
20196 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>
20197
20198 <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>
20199 </ol>
20200
20201 <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>
20202
20203 <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>
20204 </ol>
20205 !!end
20206
20207 !!test
20208 References: 5. ref tags in references should be processed while ignoring all other content
20209 !!options
20210 parsoid
20211 !! wikitext
20212 A <ref name="a" />
20213 B <ref name="b">bar</ref>
20214
20215 <references>
20216 <ref name="a">foo</ref>
20217 This should just get lost.
20218 </references>
20219 !! html
20220 <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>
20221 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>
20222
20223
20224 <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>
20225 </ol>
20226 !!end
20227
20228 !!test
20229 References: 6. <references /> from a transclusion
20230 !!options
20231 parsoid
20232 !! wikitext
20233 <ref>Foo</ref> {{echo|<references />}}
20234 !! html
20235 <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>
20236 </ol>
20237 !!end
20238
20239 !! test
20240 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20241 !! options
20242 parsoid
20243 !! wikitext
20244 A <ref>foo bar for a</ref>
20245 B <ref group="X" name="b" />
20246
20247 <references />
20248
20249 <references group="X">
20250 <ref name="b">foo</ref>
20251 </references>
20252 !! html
20253 <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>
20254 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>
20255 </p>
20256
20257 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20258 <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>
20259 </ol>
20260
20261 <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"}}'>
20262 <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>
20263 </ol>
20264 !! end
20265
20266 !! test
20267 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20268 !! options
20269 parsoid
20270 !! wikitext
20271 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20272 <references />
20273 !! html
20274 <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>
20275 <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>
20276 </ol>
20277 !!end
20278
20279 # This test only works in wt2html now as the <references /> are always generated
20280 # unless selser is active. Once T72722 is fixed, we should add a changes test
20281 # here to ensure that unrelated changes don't add the new <references /> in
20282 # wt2wt.
20283 !! test
20284 References: 9. Generate missing references list at the end
20285 !! options
20286 parsoid
20287 !! wikitext
20288 A <ref>foo</ref>
20289 B <ref group="inexistent">bar</ref>
20290 !! html
20291 <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>
20292 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20293 <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>
20294 </ol>
20295 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20296 <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>
20297 </ol>
20298 !! end
20299
20300 !! test
20301 Entities in ref name
20302 !! options
20303 parsoid
20304 !! wikitext
20305 <ref name="test &amp; me">hi</ref>
20306 <references />
20307 !! html
20308 <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>
20309 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20310 <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>
20311 </ol>
20312 !! end
20313
20314 # This test is wt2html only because we're permitting the serializer to produce
20315 # dirty diffs, normalizing the unclosed references to the self-closed version.
20316 !! test
20317 Generate references for unclosed references tag
20318 !! options
20319 parsoid=wt2html
20320 !! wikitext
20321 a<ref>foo</ref>
20322
20323 <references>
20324 !! html
20325 <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>
20326 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20327 <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>
20328 !! end
20329
20330 !! test
20331 New reference serializes on its own line
20332 !! options
20333 parsoid=wt2wt,html2wt
20334 !! wikitext
20335 foo
20336 <references />
20337 !! html
20338 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20339 !! end
20340
20341 #--------- Test stripping of empty nodes in template content ----------
20342 !!test
20343 Empty LI and TR nodes should be stripped from template content
20344 !!wikitext
20345 {{EmptyLITest}}
20346 {{EmptyTRTest}}
20347 !!html/parsoid
20348 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20349 <li>a</li>
20350 <li>b</li>
20351 </ul>
20352 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20353 <tbody>
20354 <tr>
20355 <td>foo</td>
20356 </tr>
20357 <tr>
20358 <td>bar</td>
20359 </tr>
20360 </tbody>
20361 </table>
20362 !!end
20363
20364 !!test
20365 Empty LI and TR nodes should not be stripped from top-level content
20366 !!wikitext
20367 * a
20368 *
20369 * b
20370 {|
20371 |-
20372 |-
20373 |foo
20374 |}
20375 !!html/parsoid
20376 <ul>
20377 <li> a</li>
20378 <li></li>
20379 <li> b</li>
20380 </ul>
20381 <table>
20382 <tbody>
20383 <tr></tr>
20384 <tr>
20385 <td>foo</td>
20386 </tr>
20387 </tbody>
20388 </table>
20389 !!end
20390
20391 !!test
20392 Empty TR nodes should not be stripped if they have any attributes set
20393 !!wikitext
20394 {{EmptyTRWithHTMLAttrTest}}
20395 !!html/parsoid
20396 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20397 <tr align="center"></tr>
20398 <tr><td>foo</td></tr>
20399 <tr align="center"></tr>
20400 <tr><td>bar</td></tr>
20401 </table>
20402 !!end
20403
20404 #### ----------------------------------------------------------------
20405 #### The following section of tests are primarily to test
20406 #### wikitext escaping capabilities of Parsoid. Given that
20407 #### escaping can be done any number of ways, the wikitext (input)
20408 #### is always adjusted to reflect how Parsoid adds nowiki
20409 #### escape tags.
20410 ####
20411 #### We are marking several tests as parsoid-only since the
20412 #### HTML in the result section is different from what the
20413 #### PHP parser generates for it.
20414 #### ----------------------------------------------------------------
20415
20416
20417 #### --------------- Headings ---------------
20418 #### 0. Unnested
20419 #### 1. Nested inside html <h1>=foo=</h1>
20420 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20421 #### 3. Nested inside html with wikitext split by html tags
20422 #### 4. No escape needed
20423 #### 5. Empty headings <h1></h1>
20424 #### 6. Heading chars in SOL context
20425 #### ----------------------------------------
20426 !! test
20427 Headings: 0. Unnested
20428 !! options
20429 parsoid
20430 !! wikitext
20431 <nowiki>=foo=</nowiki>
20432
20433 <nowiki> =foo= </nowiki>
20434 <!--cmt-->
20435 <nowiki>=foo=</nowiki>
20436
20437 =foo''a''<nowiki>=</nowiki>
20438 !! html
20439 <p><span typeof="mw:Nowiki">=foo=</span></p>
20440
20441 <p><span typeof="mw:Nowiki"> =foo= </span>
20442 <!--cmt-->
20443 <span typeof="mw:Nowiki">=foo=</span></p>
20444
20445 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20446 !!end
20447
20448 # New headings and existing headings are handled differently
20449 !! test
20450 Headings: 1. Nested inside html
20451 !! options
20452 parsoid=html2wt
20453 !! html
20454 <h1>=foo=</h1>
20455 <h2>=foo=</h2>
20456 <h3>=foo=</h3>
20457
20458 <h1 data-parsoid=''>=foo=</h1>
20459 <h2 data-parsoid=''>=foo=</h2>
20460 <h3 data-parsoid=''>=foo=</h3>
20461 <h4 data-parsoid=''>=foo=</h4>
20462 <h5 data-parsoid=''>=foo=</h5>
20463 <h6 data-parsoid=''>=foo=</h6>
20464 !! wikitext
20465 = =foo= =
20466
20467 == =foo= ==
20468
20469 === =foo= ===
20470
20471 =<nowiki>=foo=</nowiki>=
20472 ==<nowiki>=foo=</nowiki>==
20473 ===<nowiki>=foo=</nowiki>===
20474 ====<nowiki>=foo=</nowiki>====
20475 =====<nowiki>=foo=</nowiki>=====
20476 ======<nowiki>=foo=</nowiki>======
20477
20478 !!end
20479
20480 !! test
20481 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20482 !! options
20483 parsoid=html2wt
20484 !! html
20485 <h1>foo</h1>*bar
20486 <h1>foo</h1>=bar
20487 <h1>foo</h1>=bar=
20488 !! wikitext
20489 = foo =
20490 <nowiki>*</nowiki>bar
20491
20492 = foo =
20493 =bar
20494
20495 = foo =
20496 <nowiki>=bar=</nowiki>
20497 !!end
20498
20499 !! test
20500 Headings: 3. Nested inside html with wikitext split by html tags
20501 !! options
20502 parsoid=html2wt,wt2wt
20503 !! wikitext
20504 = ='''bold'''<nowiki>foo=</nowiki> =
20505 !! html/parsoid
20506 <h1>=<b>bold</b>foo=</h1>
20507 !!end
20508
20509 !! test
20510 Headings: 4a. No escaping needed (testing just h1 and h2)
20511 !! wikitext
20512 = =foo =
20513
20514 = foo= =
20515
20516 = =foo= =
20517
20518 = =foo= bar =
20519
20520 == =foo ==
20521
20522 == foo= ==
20523
20524 = = =
20525
20526 = ''=''foo= =
20527 !! html/parsoid
20528 <h1>=foo</h1>
20529 <h1>foo=</h1>
20530 <h1> =foo= </h1>
20531 <h1>=foo= bar</h1>
20532 <h2>=foo</h2>
20533 <h2>foo=</h2>
20534 <h1>=</h1>
20535 <h1><i>=</i>foo=</h1>
20536 !!end
20537
20538 !! test
20539 Headings: 4b. No escaping needed (inside p-tags)
20540 !! options
20541 parsoid=html2wt
20542 !! html
20543 <p>===
20544 =foo= x
20545 =foo= <s></s>
20546 </p>
20547 !! wikitext
20548 ===
20549 =foo= x
20550 =foo= <s></s>
20551 !!end
20552
20553 !! test
20554 Headings: 5. Empty headings
20555 !! options
20556 parsoid
20557 !! wikitext
20558 =<nowiki/>=
20559
20560 ==<nowiki/>==
20561
20562 ===<nowiki/>===
20563
20564 ====<nowiki/>====
20565
20566 =====<nowiki/>=====
20567
20568 ======<nowiki/>======
20569 !! html
20570 <h1></h1>
20571 <h2></h2>
20572 <h3></h3>
20573 <h4></h4>
20574 <h5></h5>
20575 <h6></h6>
20576 !!end
20577
20578 !! test
20579 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20580 !! options
20581 parsoid
20582 !! wikitext
20583 <nowiki>=a=</nowiki>
20584
20585 <nowiki>=a=</nowiki>
20586
20587 <nowiki>=a=</nowiki>
20588
20589 <nowiki>=a=</nowiki>
20590 !! html
20591 <p>=a=</p>
20592 <p>=a= </p>
20593 <p>=a= </p>
20594 <p>=a= </p>
20595 !!end
20596
20597 !! test
20598 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20599 !! options
20600 parsoid
20601 !! wikitext
20602 <nowiki>=a=
20603 b</nowiki>
20604
20605 <nowiki>=a=
20606 b</nowiki>
20607
20608 <nowiki>=a=
20609 b</nowiki>
20610
20611 <nowiki>=a=
20612 b</nowiki>
20613 !! html
20614 <p>=a=
20615 b</p>
20616 <p>=a=
20617 b</p>
20618 <p>=a=
20619 b</p>
20620 <p>=a=
20621 b</p>
20622 </p>
20623 !!end
20624
20625 !! test
20626 Headings: 6c. Heading chars in SOL context (leading newline break)
20627 !! options
20628 parsoid
20629 !! wikitext
20630 a
20631 <nowiki>=b=</nowiki>
20632 !! html
20633 <p>a
20634 =b=</p>
20635 !!end
20636
20637 !! test
20638 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20639 !! options
20640 parsoid
20641 !! wikitext
20642 <!--c0--><nowiki>=a=</nowiki>
20643
20644 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20645 !! html
20646 <p><!--c0-->=a=</p>
20647 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20648 !!end
20649
20650 !! test
20651 Headings: 6d. Heading chars in SOL context (No escaping needed)
20652 !! options
20653 parsoid=html2wt
20654 !! html
20655 =a=<div>b</div>
20656 !! wikitext
20657 =a=<div>b</div>
20658 !!end
20659
20660 !! test
20661 Headings: 7. Insert a newline between new content and headings
20662 !! options
20663 parsoid=html2wt
20664 !! html
20665 <h2>NEW</h2>
20666 <p>new</p>
20667 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20668 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20669 !! wikitext
20670 == NEW ==
20671 new
20672
20673 ==A==
20674 a
20675
20676 !! end
20677
20678 #### --------------- Lists ---------------
20679 #### 0. Outside nests (*foo, etc.)
20680 #### 1. Nested inside html <ul><li>*foo</li></ul>
20681 #### 2. Inside definition lists
20682 #### 3. Only bullets at start should be escaped
20683 #### 4. No escapes needed
20684 #### 5. No unnecessary escapes
20685 #### 6. Escape bullets in SOL position
20686 #### 7. Escape bullets in a multi-line context
20687 #### ----------------------------------------
20688
20689 !! test
20690 Lists: 0. Outside nests
20691 !! wikitext
20692 <nowiki>*</nowiki>foo
20693
20694 <nowiki>#</nowiki>foo
20695
20696 <nowiki>;Foo:</nowiki>bar
20697 !! html
20698 <p>*foo
20699 </p><p>#foo
20700 </p><p>;Foo:bar
20701 </p>
20702 !!end
20703
20704 !! test
20705 Lists: 1. Nested inside html
20706 !! wikitext
20707 *<nowiki>*foo</nowiki>
20708
20709 *<nowiki>#foo</nowiki>
20710
20711 *<nowiki>:foo</nowiki>
20712
20713 *<nowiki>;foo</nowiki>
20714
20715 #<nowiki>*foo</nowiki>
20716
20717 #<nowiki>#foo</nowiki>
20718
20719 #<nowiki>:foo</nowiki>
20720
20721 #<nowiki>;foo</nowiki>
20722 !! html
20723 <ul><li>*foo</li></ul>
20724 <ul><li>#foo</li></ul>
20725 <ul><li>:foo</li></ul>
20726 <ul><li>;foo</li></ul>
20727 <ol><li>*foo</li></ol>
20728 <ol><li>#foo</li></ol>
20729 <ol><li>:foo</li></ol>
20730 <ol><li>;foo</li></ol>
20731
20732 !!end
20733
20734 !! test
20735 Lists: 2. Inside definition lists
20736 !! wikitext
20737 ;<nowiki>;foo</nowiki>
20738
20739 ;<nowiki>:foo</nowiki>
20740
20741 ;<nowiki>:foo</nowiki>
20742 :bar
20743
20744 :<nowiki>:foo</nowiki>
20745 !! html
20746 <dl><dt>;foo</dt></dl>
20747 <dl><dt>:foo</dt></dl>
20748 <dl><dt>:foo</dt>
20749 <dd>bar</dd></dl>
20750 <dl><dd>:foo</dd></dl>
20751
20752 !!end
20753
20754 !! test
20755 Lists: 3. Only bullets at start of text should be escaped
20756 !! wikitext
20757 *<nowiki>*foo*bar</nowiki>
20758
20759 *<nowiki>*foo</nowiki>''it''*bar
20760 !! html
20761 <ul><li>*foo*bar</li></ul>
20762 <ul><li>*foo<i>it</i>*bar</li></ul>
20763
20764 !!end
20765
20766 !! test
20767 Lists: 4. No escapes needed
20768 !! options
20769 parsoid
20770 !! wikitext
20771 *foo*bar
20772
20773 *''foo''*bar
20774
20775 *[[Foo]]: bar
20776
20777 *[[Foo]]*bar
20778 !! html
20779 <ul>
20780 <li>foo*bar
20781 </li>
20782 </ul>
20783 <ul>
20784 <li><i>foo</i>*bar
20785 </li>
20786 </ul>
20787 <ul>
20788 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20789 </li>
20790 </ul>
20791 <ul>
20792 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20793 </li>
20794 </ul>
20795 !!end
20796
20797 !! test
20798 Lists: 5. No unnecessary escapes
20799 !! wikitext
20800 * bar <span><nowiki>[[foo]]</nowiki></span>
20801
20802 * =bar <span><nowiki>[[foo]]</nowiki></span>
20803
20804 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20805
20806 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20807
20808 * =bar <span>foo]]</span>=
20809
20810 * <s></s>: a
20811
20812 * ''* foo''
20813 !! html
20814 <ul><li> bar <span>[[foo]]</span></li></ul>
20815 <ul><li> =bar <span>[[foo]]</span></li></ul>
20816 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20817 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20818 <ul><li> =bar <span>foo]]</span>=</li></ul>
20819 <ul><li> <s></s>: a</li></ul>
20820 <ul><li> <i>* foo</i></li></ul>
20821
20822 !!end
20823
20824 !! test
20825 Lists: 6. Escape bullets in SOL position
20826 !! options
20827 parsoid=html2wt
20828 !! html
20829 <p><!--cmt-->*foo</p>
20830 !! wikitext
20831 <!--cmt--><nowiki>*</nowiki>foo
20832 !!end
20833
20834 !! test
20835 Lists: 7. Escape bullets in a multi-line context
20836 !! wikitext
20837 a
20838 <nowiki>*</nowiki>b
20839 !! html
20840 <p>a
20841 *b
20842 </p>
20843 !!end
20844
20845 !! test
20846 Lists: 8. Escape colons only if not present in tags
20847 !! options
20848 parsoid=html2wt
20849 !! html
20850 <dl><dt>a:b<i>c:d</i></dt></dl>
20851 !! wikitext
20852 ; <nowiki>a:b</nowiki>''c:d''
20853 !! end
20854
20855 #### --------------- HRs ---------------
20856 #### 1. Single line
20857 #### -----------------------------------
20858
20859 !! test
20860 HRs: 1. Single line
20861 !! wikitext
20862 ----<nowiki>----</nowiki>
20863 ----=foo=
20864 ----*foo
20865 !! html+tidy
20866 <hr />
20867 <p>----</p>
20868 <hr />
20869 <p>=foo=</p>
20870 <hr />
20871 <p>*foo</p>
20872 !! end
20873
20874 #### --------------- Tables ---------------
20875 #### 1a. Simple example
20876 #### 1b. No escaping needed (!foo)
20877 #### 1c. No escaping needed (|foo)
20878 #### 1d. No escaping needed (|}foo)
20879 ####
20880 #### 2a. Nested in td (<td>foo|bar</td>)
20881 #### 2b. Nested in td (<td>foo||bar</td>)
20882 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20883 ####
20884 #### 3a. Nested in th (<th>foo!bar</th>)
20885 #### 3b. Nested in th (<th>foo!!bar</th>)
20886 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20887 ####
20888 #### 4a. Escape -
20889 #### 4b. Escape +
20890 #### 4c. No escaping needed
20891 #### --------------------------------------
20892
20893 !! test
20894 Tables: 1a. Simple example
20895 !! wikitext
20896 <nowiki>{|
20897 |}</nowiki>
20898 !! html
20899 <p>{|
20900 |}
20901 </p>
20902 !! end
20903
20904 !! test
20905 Tables: 1b. No escaping needed
20906 !! wikitext
20907 !foo
20908 !! html
20909 <p>!foo
20910 </p>
20911 !! end
20912
20913 !! test
20914 Tables: 1c. No escaping needed
20915 !! wikitext
20916 |foo
20917 !! html
20918 <p>|foo
20919 </p>
20920 !! end
20921
20922 !! test
20923 Tables: 1d. No escaping needed
20924 !! wikitext
20925 |}foo
20926 !! html
20927 <p>|}foo
20928 </p>
20929 !! end
20930
20931 !! test
20932 Tables: 2a. Nested in td
20933 !! options
20934 parsoid=html2wt
20935 !! html/parsoid
20936 <table><tbody><tr>
20937 <td>foo|bar</td></tr>
20938 <tr><td>x<div>a|b</div></td>
20939 </tbody></table>
20940 !! wikitext
20941 {|
20942 |<nowiki>foo|bar</nowiki>
20943 |-
20944 |x<div><nowiki>a|b</nowiki></div>
20945 |}
20946 !! html/php+tidy
20947 <table>
20948 <tr>
20949 <td>foo|bar</td>
20950 </tr>
20951 <tr>
20952 <td>x
20953 <div>a|b</div>
20954 </td>
20955 </tr>
20956 </table>
20957 !! end
20958
20959 !! test
20960 Tables: 2b. Nested in td
20961 !! options
20962 parsoid=html2wt
20963 !! html/parsoid
20964 <table><tbody><tr>
20965 <td>foo||bar</td>
20966 <td>a<i>b||c</i></td>
20967 <td>a<i><div>b||c</div></i></td>
20968 </tr></tbody></table>
20969 !! wikitext
20970 {|
20971 |<nowiki>foo||bar</nowiki>
20972 |a''<nowiki>b||c</nowiki>''
20973 |a''<div><nowiki>b||c</nowiki></div>''
20974 |}
20975 !! html/php
20976 <table>
20977 <tr>
20978 <td>foo||bar
20979 </td>
20980 <td>a<i>b||c</i>
20981 </td>
20982 <td>a<i><div>b||c</div></i>
20983 </td></tr></table>
20984
20985 !! end
20986
20987 !! test
20988 Tables: 2c. Nested in td -- no escaping needed
20989 !! wikitext
20990 {|
20991
20992 |foo!!bar
20993 |}
20994 !! html/*
20995 <table>
20996
20997 <tr>
20998 <td>foo!!bar
20999 </td></tr></table>
21000
21001 !! end
21002
21003 !! test
21004 Tables: 3a. Nested in th
21005 !! wikitext
21006 {|
21007
21008 !foo!bar
21009 |}
21010 !! html/*
21011 <table>
21012
21013 <tr>
21014 <th>foo!bar
21015 </th></tr></table>
21016
21017 !! end
21018
21019 !! test
21020 Tables: 3b. Nested in th
21021 !! options
21022 parsoid=html2wt
21023 !! html/parsoid
21024 <table><tbody>
21025 <tr><th>foo!!bar</th>
21026 <th><i>foo|bar</i></th>
21027 <th><i>foo!!bar</i></th>
21028 <th><i><span>foo!!bar</span></i></th>
21029 </tr></tbody></table>
21030 !! wikitext
21031 {|
21032 !<nowiki>foo!!bar</nowiki>
21033 !''<nowiki>foo|bar</nowiki>''
21034 !''<nowiki>foo!!bar</nowiki>''
21035 !''<span><nowiki>foo!!bar</nowiki></span>''
21036 |}
21037 !! html/php
21038 <table>
21039 <tr>
21040 <th>foo!!bar
21041 </th>
21042 <th><i>foo|bar</i>
21043 </th>
21044 <th><i>foo!!bar</i>
21045 </th>
21046 <th><i><span>foo!!bar</span></i>
21047 </th></tr></table>
21048
21049 !! end
21050
21051 !! test
21052 Tables: 3c. Nested in th
21053 !! options
21054 parsoid=html2wt
21055 !! html/parsoid
21056 <table><tbody>
21057 <tr><th>foo||bar</th>
21058 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21059 </tr></tbody></table>
21060 !! wikitext
21061 {|
21062 !<nowiki>foo||bar</nowiki>
21063 !<nowiki>foo||bar</nowiki>
21064 |}
21065 !! html/php
21066 <table>
21067 <tr>
21068 <th>foo||bar
21069 </th>
21070 <th>foo||bar
21071 </th></tr></table>
21072
21073 !! end
21074
21075 !! test
21076 Tables: 4a. Escape -
21077 !! options
21078 parsoid=html2wt
21079 !! html/*
21080 <table>
21081
21082 <tr>
21083 <th>-bar
21084 </th></tr>
21085 <tr>
21086 <td>-bar
21087 </td></tr></table>
21088
21089 !! wikitext
21090 {|
21091
21092 !-bar
21093
21094 |-
21095 |<nowiki>-bar</nowiki>
21096 |}
21097 !! end
21098
21099 !! test
21100 Tables: 4b. Escape +
21101 !! options
21102 parsoid=html2wt
21103 !! html/*
21104 <table>
21105
21106 <tr>
21107 <th>+bar
21108 </th></tr>
21109 <tr>
21110 <td>+bar
21111 </td></tr></table>
21112
21113 !! wikitext
21114 {|
21115
21116 !+bar
21117
21118 |-
21119 |<nowiki>+bar</nowiki>
21120 |}
21121 !! end
21122
21123 !! test
21124 Tables: 4c. No escaping needed
21125 !! wikitext
21126 {|
21127 |foo-bar
21128 |foo+bar
21129 |-
21130 |''foo''-bar
21131 |''foo''+bar
21132 |-
21133 |foo
21134 bar|baz
21135 +bar
21136 -bar
21137 |-
21138 |x
21139 <div>a|b</div>
21140 |}
21141 !! html/php
21142 <table>
21143 <tr>
21144 <td>foo-bar
21145 </td>
21146 <td>foo+bar
21147 </td></tr>
21148 <tr>
21149 <td><i>foo</i>-bar
21150 </td>
21151 <td><i>foo</i>+bar
21152 </td></tr>
21153 <tr>
21154 <td>foo
21155 <p>bar|baz
21156 +bar
21157 -bar
21158 </p>
21159 </td></tr>
21160 <tr>
21161 <td>x
21162 <div>a|b</div>
21163 </td></tr></table>
21164
21165 !! html/parsoid
21166 <table><tbody>
21167 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21168 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21169 <tr><td>foo
21170 <p>bar|baz
21171 +bar
21172 -bar</p></td></tr>
21173 <tr><td>x
21174 <div>a|b</div></td>
21175 </tbody></table>
21176 !! end
21177
21178 !! test
21179 Tables: 4d. No escaping needed
21180 !! wikitext
21181 {|
21182 |[[Foo]]-bar
21183 ||+1
21184 ||-2
21185 |}
21186 !! html/php
21187 <table>
21188 <tr>
21189 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21190 </td>
21191 <td>+1
21192 </td>
21193 <td>-2
21194 </td></tr></table>
21195
21196 !! html/parsoid
21197 <table>
21198 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21199 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21200 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21201 </tbody></table>
21202 !! end
21203
21204 !! test
21205 Tables: Digest broken attributes on table and tr tag
21206 !! options
21207 parsoid=wt2html
21208 !! wikitext
21209 {| || |} ++
21210 |- || || ++ --
21211 |- > [
21212 |}
21213 !! html
21214 <table>
21215 <tbody>
21216 <tr></tr>
21217 <tr></tr>
21218 </tbody></table>
21219 !! end
21220
21221 #### --------------- Links ----------------
21222 #### 1. Quote marks in link text
21223 #### 2. Wikilinks: Escapes needed
21224 #### 3. Wikilinks: No escapes needed
21225 #### 4. Extlinks: Escapes needed
21226 #### 5. Extlinks: No escapes needed
21227 #### --------------------------------------
21228 !! test
21229 Links 1. WikiLinks: No escapes needed
21230 !! wikitext
21231 [[Foo|Foo''boo'']]
21232 [[Foo|[Foobar]]]
21233 [[Foo|x [Foobar] x]]
21234 !! html/php
21235 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21236 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21237 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21238 </p>
21239 !! html/parsoid
21240 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21241 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21242 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21243 !! end
21244
21245 !! test
21246 Links 2. WikiLinks: Escapes needed
21247 !! options
21248 parsoid=html2wt
21249 !! html/parsoid
21250 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21251 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21252 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21253 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21254 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21255 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21256 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21257 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21258 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21259 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21260 !! wikitext
21261 [[Foo|<nowiki>Foobar]</nowiki>]]
21262 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21263 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21264 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21265 [[Foo|<nowiki>|Bar</nowiki>]]
21266 [[Foo|<nowiki>]]bar</nowiki>]]
21267 [[Foo|<nowiki>[[bar</nowiki>]]
21268 [[Foo|<nowiki>x [[ y</nowiki>]]
21269 [[Foo|<nowiki>x ]] y</nowiki>]]
21270 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21271 !! html/php
21272 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21273 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21274 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21275 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21276 <a href="/wiki/Foo" title="Foo">|Bar</a>
21277 <a href="/wiki/Foo" title="Foo">]]bar</a>
21278 <a href="/wiki/Foo" title="Foo">[[bar</a>
21279 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21280 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21281 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21282 </p>
21283 !! end
21284
21285 !! test
21286 Links 3. WikiLinks: No escapes needed
21287 !! wikitext
21288 [[Foo|[Foobar]]
21289 [[Foo|foo|bar]]
21290 !! html/php
21291 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21292 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21293 </p>
21294 !! html/parsoid
21295 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21296 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21297 !! end
21298
21299 !! test
21300 Links 4. ExtLinks: Escapes needed
21301 !! options
21302 parsoid=html2wt
21303 !! html/parsoid
21304 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21305 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21306 <p>[http://google.com]</p>
21307 <p>[http://google.com google]</p>
21308 !! wikitext
21309 [http://google.com <nowiki>[google]</nowiki>]
21310 [http://google.com <nowiki>google]</nowiki>]
21311
21312 <nowiki>[http://google.com]</nowiki>
21313
21314 <nowiki>[http://google.com google]</nowiki>
21315
21316 !! html/php
21317 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21318 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21319 </p><p>[http://google.com]
21320 </p><p>[http://google.com google]
21321 </p>
21322 !! end
21323
21324 !! test
21325 Links 5. ExtLinks: No escapes needed
21326 !! wikitext
21327 [http://google.com [google]
21328 !! html/php
21329 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21330 </p>
21331 !! html/parsoid
21332 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21333 !! end
21334
21335 !! test
21336 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21337 !! html/parsoid
21338 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21339 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21340 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21341 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21342 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21343 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21344 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21345 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21346 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21347 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21348 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21349 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21350 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21351 </p>
21352 !! wikitext
21353 x<nowiki/>http://example.com<nowiki/>y
21354 http://example.com<nowiki/>?x
21355 http://example.com<nowiki/>&x
21356 http://example.com<nowiki/>'x
21357 http://example.com<nowiki/>,x
21358 http://example.com<nowiki/>.x
21359 http://example.com<nowiki/>;x
21360 http://example.com<nowiki/>:x
21361 http://example.com<nowiki/>;x
21362 http://example.com<nowiki/>!x
21363 http://example.com<nowiki/>=x
21364 http://example.com<nowiki/>(x)
21365 http://example.com(x<nowiki/>)
21366 !! end
21367
21368 !! test
21369 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21370 !! html/parsoid
21371 <p>x
21372 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21373 y
21374 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21375 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21376 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21377 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21378 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21379 </p>
21380 !! wikitext
21381 x
21382 http://example.com
21383 y
21384 "http://example.com"
21385 (http://example.com)
21386 (http://example.com) foo
21387 http://example.com,
21388 http://example.com, foo
21389 !! html/php
21390 <p>x
21391 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21392 y
21393 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21394 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21395 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21396 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21397 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21398 </p>
21399 !! end
21400
21401 !! test
21402 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21403 !! html/parsoid
21404 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21405 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21406 !! wikitext
21407 http://example.com.,;:!?\
21408 -http://example.com:
21409 !! html/php
21410 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21411 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21412 </p>
21413 !! end
21414
21415 !! test
21416 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21417 !! html/parsoid
21418 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21419 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21420 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21421 !! wikitext
21422 RFC 123<nowiki/>4
21423 RFC 123<nowiki/>y
21424 X<nowiki/>RFC 123<nowiki/>y
21425 !! end
21426
21427 !! test
21428 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21429 !! html/parsoid
21430 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21431 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21432 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21433 </p>
21434 !! wikitext
21435 RFC 123?foo
21436 RFC 123&foo
21437 -RFC 123-
21438 !! html/php
21439 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21440 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21441 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21442 </p>
21443 !! end
21444
21445 !! test
21446 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21447 !! html/parsoid
21448 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21449 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21450 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21451 !! wikitext
21452 PMID 123<nowiki/>4
21453 PMID 123<nowiki/>y
21454 X<nowiki/>PMID 123<nowiki/>y
21455 !! end
21456
21457 !! test
21458 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21459 !! html/parsoid
21460 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21461 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21462 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21463 </p>
21464 !! wikitext
21465 PMID 123?foo
21466 PMID 123&foo
21467 -PMID 123-
21468 !! html/php
21469 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21470 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21471 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21472 </p>
21473 !! end
21474
21475 !! test
21476 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21477 !! html/parsoid
21478 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21479 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21480 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21481 </p>
21482 !! wikitext
21483 ISBN 1234567890<nowiki/>1
21484 ISBN 1234567890<nowiki/>x
21485 a<nowiki/>ISBN 1234567890<nowiki/>b
21486 !! end
21487
21488 !! test
21489 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21490 !! html/parsoid
21491 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21492 !! wikitext
21493 -ISBN 1234567890's
21494 !! html/php
21495 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21496 </p>
21497 !! end
21498
21499 !! test
21500 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21501 !! options
21502 parsoid=html2wt
21503 !! html/*
21504 <p>this is not a link: http://example.com
21505 </p>
21506 !! wikitext
21507 this is not a link: <nowiki>http://example.com</nowiki>
21508 !! end
21509
21510 !! test
21511 Links 15. Link trails can't become link prefixes.
21512 !! options
21513 language=is
21514 !! wikitext
21515 [[Söfnuður]]-[[00]]
21516 !! html/php
21517 <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>
21518 </p>
21519 !! html/parsoid
21520 <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>
21521 !! end
21522
21523 #### --------------- Quotes ---------------
21524 #### 1. Quotes inside <b> and <i>
21525 #### 2. Link fragments separated by <i> and <b> tags
21526 #### 3. Link fragments inside <i> and <b>
21527 #### 4. No escaping needed
21528 #### --------------------------------------
21529 !! test
21530 1a. Quotes inside <b> and <i>
21531 !! options
21532 parsoid=html2wt,wt2wt
21533 !! wikitext
21534 ''<nowiki/>'foo'''
21535 ''<nowiki>''foo''</nowiki>''
21536 ''<nowiki>'''foo'''</nowiki>''
21537 ''foo''<nowiki/>'s
21538 '''<nowiki/>'foo''''
21539 '''<nowiki>''foo''</nowiki>'''
21540 '''<nowiki>'''foo'''</nowiki>'''
21541 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21542 '''foo'''<nowiki/>'s
21543 '''foo''
21544 ''foo''<nowiki/>'
21545 ''foo'''<nowiki/>'
21546 '''foo''<nowiki/>'
21547 ''''foo'''
21548 '''foo'''<nowiki/>'
21549 ''''foo'''<nowiki/>'
21550 ''fools'<span> errand</span>''
21551 ''<span>fool</span>'s errand''
21552 '<nowiki/>''foo'' bar '''baz''
21553 a|!*#-:;+-~[]{}b'''x''
21554 !! html/*
21555 <p><i>'foo'</i>
21556 <i>''foo''</i>
21557 <i>'''foo'''</i>
21558 <i>foo</i>'s
21559 <b>'foo'</b>
21560 <b>''foo''</b>
21561 <b>'''foo'''</b>
21562 <b>foo'<i>bar'</i>baz</b>
21563 <b>foo</b>'s
21564 '<i>foo</i>
21565 <i>foo</i>'
21566 <i>foo'</i>'
21567 '<i>foo</i>'
21568 '<b>foo</b>
21569 <b>foo</b>'
21570 '<b>foo</b>'
21571 <i>fools'<span> errand</span></i>
21572 <i><span>fool</span>'s errand</i>
21573 '<i>foo</i> bar '<i>baz</i>
21574 a|!*#-:;+-~[]{}b'<i>x</i>
21575 </p>
21576 !! end
21577
21578 !! test
21579 1b. Quotes inside <b> and <i> with other tags on same line
21580 !! options
21581 parsoid=html2wt,wt2wt
21582 !! wikitext
21583 '''a'' foo ''[[bar]]''
21584 ''a''' foo ''[[bar]]''
21585 ''a''' foo '''{{echo|[[bar]]}}'''
21586 [[foo]] x'''[[bar]]''
21587 '''foo'' <ref>test</ref>
21588 '''foo'' <div title="name">test</div>
21589 '''foo'' and <br> bar
21590 <references />
21591 !! html
21592 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21593 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21594 <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>
21595 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21596 '<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>
21597 '<i>foo</i> <div title="name">test</div>
21598 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21599 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21600 <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>
21601 </ol>
21602 !! end
21603
21604 !! test
21605 2. Link fragments separated by <i> and <b> tags
21606 !! wikitext
21607 [[''foo''<nowiki>hello]]</nowiki>
21608
21609 [['''foo'''<nowiki>hello]]</nowiki>
21610 !! html
21611 <p>[[<i>foo</i>hello]]
21612 </p><p>[[<b>foo</b>hello]]
21613 </p>
21614 !! end
21615
21616 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21617 # this is one of the shortcomings of this format
21618 !! test
21619 3. Link fragments inside <i> and <b>
21620 !! wikitext
21621 ''[[foo''<nowiki>]]</nowiki>
21622
21623 '''[[foo'''<nowiki>]]</nowiki>
21624 !! html
21625 <p><i>[[foo</i>]]
21626 </p><p><b>[[foo</b>]]
21627 </p>
21628 !! end
21629
21630 !! test
21631 4. No escaping needed
21632 !! wikitext
21633 '<span>''bar''</span>'
21634 '<span>'''bar'''</span>'
21635 'a:b'foo
21636 !! html
21637 <p>'<span><i>bar</i></span>'
21638 '<span><b>bar</b></span>'
21639 'a:b'foo
21640 </p>
21641 !! end
21642
21643 #### ----------- Paragraphs ---------------
21644 #### 1. No unnecessary escapes
21645 #### --------------------------------------
21646
21647 !! test
21648 1. No unnecessary escapes
21649 !! wikitext
21650 bar <span><nowiki>[[foo]]</nowiki></span>
21651
21652 =bar <span><nowiki>[[foo]]</nowiki></span>
21653
21654 [[bar <span><nowiki>[[foo]]</nowiki></span>
21655
21656 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21657
21658 =bar <span>foo]]</span><nowiki>=</nowiki>
21659 !! html
21660 <p>bar <span>[[foo]]</span>
21661 </p><p>=bar <span>[[foo]]</span>
21662 </p><p>[[bar <span>[[foo]]</span>
21663 </p><p>]]bar <span>[[foo]]</span>
21664 </p><p>=bar <span>foo]]</span>=
21665 </p>
21666 !!end
21667
21668 #### ----------------------- PRE --------------------------
21669 #### 1. Leading whitespace in SOL context should be escaped
21670 #### ------------------------------------------------------
21671 !! test
21672 1. Leading whitespace in SOL context should be escaped
21673 !! options
21674 parsoid
21675 !! wikitext
21676 <nowiki> </nowiki>a
21677
21678 <nowiki> </nowiki> a
21679
21680 <nowiki> </nowiki>a(tab)
21681
21682 <nowiki> </nowiki> a
21683 <!--cmt-->
21684 <nowiki> </nowiki> a
21685
21686 a
21687 <nowiki> </nowiki>b
21688
21689 a
21690 <nowiki> </nowiki>b
21691
21692 a
21693 <nowiki> </nowiki> b
21694 !! html
21695 <p> a</p>
21696 <p> a</p>
21697 <p> a(tab)</p>
21698 <p> a</p>
21699 <p><!--cmt--> a</p>
21700 <p>a
21701 b</p>
21702 <p>a
21703 b</p>
21704 <p>a
21705 b</p>
21706 !! end
21707
21708 !! test
21709 2. Leading whitespace in non-indent-pre contexts should not be escaped
21710 !! options
21711 parsoid
21712 !! wikitext
21713 foo <ref>''a''
21714 b</ref>
21715 <references />
21716 !! html
21717 <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>
21718 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21719 <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>
21720 b</span></li>
21721 </ol>
21722 !! end
21723
21724 !! test
21725 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21726 !! options
21727 parsoid
21728 !! wikitext
21729 <blockquote>
21730 a
21731 <span>b</span>
21732 c
21733 </blockquote>
21734 !! html
21735 <blockquote>
21736 <p>
21737 a
21738 <span>b</span>
21739 c</p>
21740 </blockquote>
21741 !! end
21742
21743 !! test
21744 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21745 !! options
21746 parsoid
21747 !! wikitext
21748 [[File:Foobar.jpg|thumb|caption]]
21749 !! html
21750 !! html/parsoid
21751 <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>
21752 !! end
21753
21754 !! test
21755 5. Nowiki escaping should account for indent-pres
21756 !! options
21757 parsoid=html2wt
21758 !! html
21759 <pre>==foo==</pre>
21760 !! wikitext
21761 ==foo==
21762 !! end
21763
21764 #### --------------- Behavior Switches --------------------
21765 !! test
21766 1. Valid behavior switches should be escaped
21767 !! options
21768 parsoid=html2wt
21769 !! html
21770 __TOC__
21771 <i>__TOC__</i>
21772 !! wikitext
21773 <nowiki>__TOC__</nowiki>
21774 ''<nowiki>__TOC__</nowiki>''
21775 !! end
21776
21777 !! test
21778 2. Invalid behavior switches should not be escaped
21779 !! options
21780 parsoid=html2wt
21781 !! html
21782 __TOO__
21783 __|__
21784 !! wikitext
21785 __TOO__
21786 __|__
21787 !! end
21788
21789 #### --------------- HTML tags ---------------
21790 #### 1. a tags
21791 #### 2. other tags
21792 #### 3. multi-line html tag
21793 #### 4. extension tags
21794 #### -----------------------------------------
21795 !! test
21796 1. a tags
21797 !! options
21798 parsoid
21799 !! wikitext
21800 <a href="http://google.com">google</a>
21801 !! html
21802 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21803 !! end
21804
21805 !! test
21806 2. other tags
21807 !! wikitext
21808 * <nowiki><div>foo</div></nowiki>
21809 * <nowiki><div style="color:red">foo</div></nowiki>
21810 * <nowiki><td></nowiki>
21811 !! html
21812 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
21813 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
21814 <li> &lt;td&gt;</li></ul>
21815
21816 !! end
21817
21818 !! test
21819 3. multi-line html tag
21820 !! wikitext
21821 <nowiki><div
21822 >foo</div
21823 ></nowiki>
21824 !! html
21825 <p>&lt;div
21826 &gt;foo&lt;/div
21827 &gt;
21828 </p>
21829 !! end
21830
21831 !! test
21832 4. extension tags
21833 !! wikitext
21834 <nowiki><ref>foo</ref></nowiki>
21835
21836 <nowiki><ref>bar</nowiki>
21837
21838 baz<nowiki></ref></nowiki>
21839 !! html
21840 <p>&lt;ref&gt;foo&lt;/ref&gt;
21841 </p><p>&lt;ref&gt;bar
21842 </p><p>baz&lt;/ref&gt;
21843 </p>
21844 !! end
21845
21846 #### --------------- Others ---------------
21847 !! test
21848 Escaping nowikis
21849 !! wikitext
21850 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21851 !! html
21852 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21853 </p>
21854 !! end
21855
21856 ## The quote-char in the input is necessary for triggering the bug
21857 !! test
21858 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21859 !! options
21860 parsoid=wt2wt,html2wt
21861 !! wikitext
21862 foo's bar :
21863 !! html
21864 <p>foo's bar :</p>
21865 !! end
21866
21867 !! test
21868
21869 Tag-like HTML structures are passed through as text
21870 !! wikitext
21871 <x y>
21872
21873 <x.y>
21874
21875 <x-y>
21876
21877 1>2
21878
21879 x<y
21880
21881 a>b
21882
21883 1<d e>f
21884 !! html
21885 <p>&lt;x y&gt;
21886 </p><p>&lt;x.y&gt;
21887 </p><p>&lt;x-y&gt;
21888 </p><p>1&gt;2
21889 </p><p>x&lt;y
21890 </p><p>a&gt;b
21891 </p><p>1&lt;d e&gt;f
21892 </p>
21893 !! end
21894
21895
21896 # This was a bug in the PHP parser (see bug 17663 and its dups,
21897 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21898 !! test
21899 Tag names followed by punctuation should not be recognized as tags
21900 !! wikitext
21901 <s.ome> text
21902 !! html
21903 <p>&lt;s.ome&gt; text
21904 </p>
21905 !! end
21906
21907 !! test
21908 HTML tag with necessary entities in attributes
21909 !! wikitext
21910 <span title="&amp;amp;">foo</span>
21911 !! html
21912 <p><span title="&amp;amp;">foo</span>
21913 </p>
21914 !! end
21915
21916 !! test
21917 HTML tag with 'unnecessary' entity encoding in attributes
21918 !! wikitext
21919 <span title="&amp;">foo</span>
21920 !! html
21921 <p><span title="&amp;">foo</span>
21922 </p>
21923 !! end
21924
21925 !! test
21926 HTML tag with broken attribute value quoting
21927 !! wikitext
21928 <span title="Hello world>Foo</span>
21929 !! html/php
21930 <p><span>Foo</span>
21931 </p>
21932 !! html/parsoid
21933 <p><span title="Hello world">Foo</span>
21934 </p>
21935 !! end
21936
21937 !! test
21938 Parsoid-only: HTML tag with broken attribute value quoting
21939 !! options
21940 parsoid
21941 !! wikitext
21942 <span title="Hello world>Foo</span>
21943 !! html
21944 <p><span title="Hello world">Foo</span>
21945 </p>
21946 !! end
21947
21948 !! test
21949 Table with broken attribute value quoting
21950 !! wikitext
21951 {|
21952 | title="Hello world|Foo
21953 |}
21954 !! html/php
21955 <table>
21956 <tr>
21957 <td>Foo
21958 </td></tr></table>
21959
21960 !! html/parsoid
21961 <table>
21962 <tr>
21963 <td title="Hello world">Foo
21964 </td></tr></table>
21965
21966 !! end
21967
21968 !! test
21969 Table with broken attribute value quoting on consecutive lines
21970 !! wikitext
21971 {|
21972 | title="Hello world|Foo
21973 | style="color:red|Bar
21974 |}
21975 !! html/php
21976 <table>
21977 <tr>
21978 <td>Foo
21979 </td>
21980 <td>Bar
21981 </td></tr></table>
21982
21983 !! html/parsoid
21984 <table><tbody>
21985 <tr>
21986 <td title="Hello world">Foo
21987 </td><td style="color: red">Bar
21988 </td></tr></tbody></table>
21989
21990 !! end
21991
21992 !! test
21993 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21994 !! options
21995 parsoid
21996 !! wikitext
21997 {{}}
21998 !! html
21999 {{}}
22000 !! end
22001
22002 !! test
22003 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22004 !! options
22005 parsoid
22006 !! wikitext
22007 }}{{
22008 !! html
22009 }}{{
22010 !! end
22011
22012 !!test
22013 Accept empty td cell attribute
22014 !! wikitext
22015 {|
22016 | align="center" | foo || |
22017 |}
22018 !! html
22019 <table>
22020 <tr>
22021 <td align="center"> foo </td>
22022 <td>
22023 </td></tr></table>
22024
22025 !!end
22026
22027 !!test
22028 Non-empty attributes in th-cells
22029 !! wikitext
22030 {|
22031 ! Foo !! style="color: red" | Bar
22032 |}
22033 !! html
22034 <table>
22035 <tr>
22036 <th> Foo </th>
22037 <th style="color: red"> Bar
22038 </th></tr></table>
22039
22040 !!end
22041
22042 !!test
22043 Accept empty attributes in th-cells
22044 !! wikitext
22045 {|
22046 !| foo !!| bar
22047 |}
22048 !! html
22049 <table>
22050 <tr>
22051 <th> foo </th>
22052 <th> bar
22053 </th></tr></table>
22054
22055 !!end
22056
22057 !!test
22058 Empty table rows go away
22059 !! wikitext
22060 {|
22061 | Hello
22062 | there
22063 |- class="foo"
22064 |-
22065 |}
22066 !! html
22067 <table>
22068 <tr>
22069 <td> Hello
22070 </td>
22071 <td> there
22072 </td></tr>
22073
22074 </table>
22075
22076 !! end
22077
22078 ###
22079 ### Parsoid-centric tests for testing RTing of inter-element separators
22080 ### Edge cases not tested by existing parser tests and specific to
22081 ### Parsoid-specific serialization strategies.
22082 ###
22083
22084 !!test
22085 RT-ed inter-element separators should be valid separators
22086 !! wikitext
22087 {|
22088 |- [[foo]]
22089 |}
22090 !! html
22091 <table>
22092
22093 </table>
22094
22095 !!end
22096
22097 # Parsoid-only since PHP parser relies on Tidy for correct output
22098 !!test
22099 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22100 !!options
22101 parsoid
22102 !! wikitext
22103 {|
22104 |<small>foo
22105 bar
22106 |}
22107
22108 {|
22109 |<small>foo<small>
22110 |}
22111 !! html
22112 <table>
22113 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22114 <p>bar</p></small></td></tr>
22115 </tbody></table>
22116
22117 <table>
22118 <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>
22119 </tbody></table>
22120 !!end
22121
22122 !!test
22123 Empty TD followed by TD with tpl-generated attribute
22124 !! wikitext
22125 {|
22126 |-
22127 |
22128 |{{echo|style='color:red'}}|foo
22129 |}
22130 !! html
22131 <table>
22132
22133 <tr>
22134 <td>
22135 </td>
22136 <td>foo
22137 </td></tr></table>
22138
22139 !!end
22140
22141 !!test
22142 Indented table with an empty td
22143 !! wikitext
22144 {|
22145 |-
22146 |
22147 |foo
22148 |}
22149 !! html
22150 <table>
22151
22152 <tr>
22153 <td>
22154 </td>
22155 <td>foo
22156 </td></tr></table>
22157
22158 !!end
22159
22160 ## We have some newline diffs RT-ing this edge case
22161 ## and it is not important enough -- we seem to be emitting
22162 ## at most 2 newlines after a </tr> and this is unrelated to
22163 ## the issue from T85627 that this is testing.
22164 !!test
22165 Indented table with blank lines in between (T85627)
22166 !! options
22167 parsoid=wt2html
22168 !! wikitext
22169 {|
22170 |foo
22171
22172
22173 |}
22174 !! html
22175 <table>
22176
22177 <tr>
22178 <td>foo
22179 </td></tr></table>
22180
22181 !!end
22182
22183 !!test
22184 Indented block & table
22185 !! wikitext
22186 <div>foo</div>
22187 {|
22188 |foo
22189 |}
22190 !! html/php
22191 <div>foo</div>
22192 <table>
22193 <tr>
22194 <td>foo
22195 </td></tr></table>
22196
22197 !! html/parsoid
22198 <div data-parsoid='{"stx":"html"}'>foo</div>
22199 <table><tbody>
22200 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22201 </tbody></table>
22202 !!end
22203
22204 !! test
22205 Indent and comment before table row
22206 !! wikitext
22207 {|
22208 <!--hi-->|-
22209 | there
22210 |}
22211 !! html/php
22212 <table>
22213
22214 <tr>
22215 <td> there
22216 </td></tr></table>
22217
22218 !! html/parsoid
22219 <table>
22220 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22221 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22222 </tbody></table>
22223 !! end
22224
22225 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22226 !!test
22227 Empty TR followed by a template-generated TR
22228 !!options
22229 parsoid
22230 !! wikitext
22231 {|
22232 |-
22233 {{echo|<tr><td>foo</td></tr>}}
22234 |}
22235 !! html
22236 <table>
22237 <tbody>
22238 <tr></tr>
22239 <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}}]}'>
22240 <td>foo</td></tr>
22241 </tbody></table>
22242 !!end
22243
22244 ## PHP and parsoid output differ for this, and since this is primarily
22245 ## for testing Parsoid's serializer, marking this Parsoid only
22246 !!test
22247 Empty TR followed by mixed-ws-comment line should RT correctly
22248 !!options
22249 parsoid
22250 !! wikitext
22251 {|
22252 |-
22253 <!--c-->
22254 |-
22255 <!--c--> <!--d-->
22256 |}
22257 !! html
22258 <table>
22259 <tbody>
22260 <tr></tr>
22261 <!--c-->
22262 <tr>
22263 <!--c--> </tr><!--d-->
22264 </tbody></table>
22265
22266 !!end
22267
22268 !!test
22269 Multi-line image caption generated by templates with/without trailing newlines
22270 !! wikitext
22271 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22272 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22273 !! html/parsoid
22274 <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>
22275 <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>
22276 !!end
22277
22278 !! test
22279 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22280 !! options
22281 parsoid=html2wt
22282 !! html
22283 <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>
22284
22285 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22286 !! wikitext
22287 <includeonly>foo</includeonly>
22288 new para
22289
22290 [[./Category:Foo]]
22291
22292 = new heading =
22293 !! end
22294
22295 ## PHP emits broken html for this, and since this is primarily
22296 ## a Parsoid serializer test, marking this Parsoid only
22297 !!test
22298 Improperly nested inline or quotes tags with whitespace in between
22299 !!options
22300 parsoid
22301 !! wikitext
22302 <span> <s>x</span> </s>
22303 ''' ''x''' ''
22304 !! html
22305 <p><span> <s>x</s></span><s> </s>
22306 <b> <i>x</i></b><i> </i>
22307 </p>
22308 !!end
22309
22310 !!test
22311 Encapsulate protected attributes from wt
22312 !!options
22313 parsoid
22314 !! wikitext
22315 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22316 !! html
22317 <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>
22318 </body>
22319 !!end
22320
22321 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22322 ## Having nested or stray pre tags results in the attempt to add duplicates,
22323 ## causing an assertion fail. This test tries to prevent that situation.
22324 !!test
22325 Ensure ParagraphWrapper can deal with stray closing pre tags
22326 !!options
22327 parsoid=wt2html
22328 !! wikitext
22329 plain text</pre>
22330 !! html
22331 plain text
22332 !!end
22333
22334 !!test
22335 1. Ensure fostered text content is wrapped in element nodes
22336 !!options
22337 parsoid=wt2html
22338 !! wikitext
22339 <table>hi</table><table>ho</table>
22340 !! html
22341 <p>hi</p>
22342 <table></table>
22343 <p>ho</p>
22344 <table></table>
22345 !!end
22346
22347 !!test
22348 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22349 !!options
22350 parsoid=wt2html,wt2wt
22351 !! wikitext
22352 <table>
22353 <tr> || ||
22354 <td> a
22355 </table>
22356 !! html
22357 <p> || ||
22358 </p><table>
22359 <tbody><tr><td> a</td></tr>
22360 </tbody></table>
22361 !!end
22362
22363 !!test
22364 Encapsulation properly handles null DSR information from foster box
22365 !!options
22366 parsoid=wt2html,wt2wt
22367 !! wikitext
22368 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22369 !! html
22370 <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>
22371 !!end
22372
22373 !!test
22374 1. Encapsulate foster-parented transclusion content
22375 !!options
22376 parsoid=wt2wt,wt2html
22377 !! wikitext
22378 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22379 !! html
22380 <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>
22381 <tbody>
22382 <tr>
22383 <td>bar</td>
22384 </tr>
22385 </tbody>
22386 </table>
22387 !!end
22388
22389 !!test
22390 2. Encapsulate foster-parented transclusion content
22391 !!options
22392 parsoid=wt2wt,wt2html
22393 !! wikitext
22394 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22395 !! html
22396 <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>
22397 <table>
22398 <tbody>
22399 <tr>
22400 <td>bar</td>
22401 </tr>
22402 </tbody>
22403 </table>
22404 !!end
22405
22406 !!test
22407 3. Encapsulate foster-parented transclusion content
22408 !!options
22409 parsoid=wt2wt,wt2html
22410 !! wikitext
22411 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22412 !! html
22413 <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;]}">
22414 <p>foo</p>
22415 </div>
22416 <table>
22417 <tbody>
22418 <tr>
22419 <td>bar</td>
22420 </tr>
22421 </tbody>
22422 </table>
22423 !!end
22424
22425 !!test
22426 4. Encapsulate foster-parented transclusion content
22427 !!options
22428 parsoid=wt2wt,wt2html
22429 !! wikitext
22430 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22431 !! html
22432 <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;]}">
22433 <p>foo</p>
22434 </div>
22435 <table>
22436 <tbody>
22437 <tr>
22438 <td>bar</td>
22439 </tr>
22440 </tbody>
22441 </table>
22442 !!end
22443
22444 !!test
22445 5. Encapsulate foster-parented transclusion content
22446 !!options
22447 parsoid=wt2wt,wt2html
22448 !! wikitext
22449 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22450 !! html
22451 <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>
22452 <table>
22453 <tbody>
22454 <tr>
22455 <td>
22456 <div>
22457 <p>foo</p>
22458 </div>
22459 </td>
22460 </tr>
22461 </tbody>
22462 </table>
22463 !!end
22464
22465 !!test
22466 6. Encapsulate foster-parented transclusion content
22467 !!options
22468 parsoid=wt2wt,wt2html
22469 !! wikitext
22470 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22471 !! html
22472 <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>
22473 <table>
22474 <tbody>
22475 <tr>
22476 <td>
22477 <div>
22478 <p>foo</p>
22479 </div>
22480 </td>
22481 </tr>
22482 </tbody>
22483 </table>
22484 <p>ok</p>
22485 !!end
22486
22487 !!test
22488 7. Encapsulate foster-parented transclusion content
22489 !!options
22490 parsoid=wt2wt,wt2html
22491 !! wikitext
22492 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22493 !! html
22494 <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>
22495 <table>
22496 <tbody>
22497 <tr>
22498 <td>bar</td>
22499 </tr>
22500 </tbody>
22501 </table>
22502 !!end
22503
22504 !!test
22505 8. Encapsulate foster-parented transclusion content
22506 !!options
22507 parsoid=wt2wt,wt2html
22508 !! wikitext
22509 {{echo|a
22510 }}{|{{echo|style='color:red'}}
22511 |-
22512 |b
22513 |}
22514 !! html
22515 <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>
22516 <tbody>
22517 <tr>
22518 <td>b</td>
22519 </tr>
22520 </tbody>
22521 </table>
22522 !!end
22523
22524 !!test
22525 9. Encapsulate foster-parented transclusion content
22526 !!options
22527 parsoid=wt2wt,wt2html
22528 !! wikitext
22529 <table>{{echo|hi</table>hello}}
22530 !! html
22531 <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>
22532 !!end
22533
22534 !!test
22535 Table in fosterable position
22536 !!options
22537 parsoid=wt2html,wt2wt
22538 !! wikitext
22539 {{OpenTable}}
22540 <div>
22541 {|
22542 |}
22543 </div>
22544 |}
22545 !! html
22546 <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">
22547 </span>
22548 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22549
22550 <table>
22551 </table>
22552 !!end
22553
22554 # Parsoid only for bug 64747
22555 !! test
22556 Properly encapsulate empty-content transclusions in fosterable positions
22557 !! wikitext
22558 <table>
22559 {{#if:|
22560 <td>foo</td>
22561 }}
22562 </table>
22563 !! html/parsoid
22564 <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":["","","",""]}]]}'>
22565
22566 </table>
22567 !! end
22568
22569 !!test
22570 Support <object> element with .data attribute
22571 !!options
22572 parsoid=html2wt
22573 !! html
22574 <object data="test.swf"></object>
22575 !! wikitext
22576 <object data="test.swf"></object>
22577 !!end
22578
22579 !! test
22580 Don't block XML namespace declaration
22581 !! wikitext
22582 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22583 !! html/php
22584 <p><span>MediaWiki</span>
22585 </p>
22586 !! html/parsoid
22587 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22588 !! end
22589
22590 # -----------------------------------------------------------------
22591 # The following section of tests are primarily to spec requirements
22592 # around serialization of new/edited content.
22593 #
22594 # All these tests are marked Parsoid html2wt and html2html only
22595 # ----------------------------------------------------------------
22596
22597 # 'mi' is a localinterwiki prefix as well as a language
22598 !! test
22599 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22600 !! options
22601 parsoid=html2wt
22602 !! html
22603 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22604 !! wikitext
22605 [[Foo]]
22606 !! end
22607
22608 !! test
22609 New wiki links (href variations)
22610 !! options
22611 parsoid=html2wt
22612 !! html
22613 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22614 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22615 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22616 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22617 !! wikitext
22618 [[Foo_bar]]
22619 [[Foo_bar]]
22620 [[Foo_bar]]
22621 [[Toxine bactérienne]]
22622 !! end
22623
22624 !! test
22625 New wiki links (content string variations)
22626 !! options
22627 parsoid=html2wt
22628 !! html
22629 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22630 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22631 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22632 !! wikitext
22633 [[Foo_bar]]
22634 [[Foo bar]]
22635 [[Foo_bar|./Foo_bar]]
22636 !! end
22637
22638 !! test
22639 New category links (href variations)
22640 !! options
22641 parsoid=html2wt
22642 !! html
22643 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22644 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22645 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22646 !! wikitext
22647 [[Category:Toxine bactérienne]]
22648 [[Category:Toxine bactérienne]]
22649 [[Category:Toxine bactérienne]]
22650 !! end
22651
22652 !! test
22653 New sol transparent links don't need indent-pre nowiki protection
22654 !! options
22655 parsoid=html2wt
22656 language=de
22657 !! html
22658 <link rel="mw:PageProp/redirect" href="./Main_Page">
22659 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
22660 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
22661 !! wikitext
22662 #WEITERLEITUNG [[Main Page]]
22663 <!-- this is good --> [[Category:Good]]
22664 <!-- this is great --> [[Kategorie:Great]]
22665 !! end
22666
22667 !! test
22668 New interlanguage links (href variations)
22669 !! options
22670 parsoid=html2wt
22671 !! html
22672 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22673 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22674 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22675 !! wikitext
22676 [[es:Toxine bactérienne]]
22677 [[es:Toxine_bactérienne]]
22678 [[es:Toxine_bactérienne]]
22679 !! end
22680
22681 !! test
22682 Image: Modifying size of an image (1)
22683 !! options
22684 parsoid={
22685 "modes": ["wt2wt"],
22686 "changes": [
22687 ["img[height]", "attr", "height", "22"],
22688 ["img[width]", "attr", "width", "200"]
22689 ]
22690 }
22691 !! wikitext
22692 [[Image:Foobar.jpg|230x230px]]
22693 !! wikitext/edited
22694 [[Image:Foobar.jpg|200x200px]]
22695 !!end
22696
22697 !! test
22698 Image: Modifying size of an image (2)
22699 !! options
22700 parsoid={
22701 "modes": ["wt2wt"],
22702 "changes": [
22703 ["img[height]", "attr", "height", "100"],
22704 ["img[width]", "attr", "width", "500"]
22705 ]
22706 }
22707 !! wikitext
22708 [[Image:Foobar.jpg|230x230px]]
22709 !! wikitext/edited
22710 [[Image:Foobar.jpg|500x500px]]
22711 !!end
22712
22713 # Change in size is ignored so long as class='mw-default-size'
22714 !! test
22715 Image: Modifying size of an image (3)
22716 !! options
22717 parsoid={
22718 "modes": ["wt2wt"],
22719 "changes": [
22720 ["figure[class]", "removeClass", "mw-default-size"],
22721 ["figure img", "attr", "height", "19"],
22722 ["figure img", "attr", "width", "170"]
22723 ]
22724 }
22725 !! wikitext
22726 [[Image:Foobar.jpg|thumb]]
22727 !! wikitext/edited
22728 [[Image:Foobar.jpg|thumb|170x170px]]
22729 !!end
22730
22731 !! test
22732 Image: Modifying alignment of an image (bug 48665)
22733 !! options
22734 parsoid={
22735 "modes": ["wt2wt"],
22736 "changes": [
22737 ["figure[class]", "removeClass", "mw-halign-right"],
22738 ["figure[class]", "addClass", "mw-halign-left"]
22739 ]
22740 }
22741 !! wikitext
22742 [[Image:Foobar.jpg|thumb|caption|right]]
22743 !! wikitext/edited
22744 [[Image:Foobar.jpg|thumb|caption|left]]
22745 !! end
22746
22747 !! test
22748 Image: Modifying mw-default-size of an frameless image (bug 62805)
22749 !! options
22750 parsoid={
22751 "modes": ["wt2wt"],
22752 "changes": [
22753 ["figure.mw-default-size", "removeClass", "mw-default-size"]
22754 ]
22755 }
22756 !! wikitext
22757 [[Image:Foobar.jpg|frameless|right]]
22758 !! wikitext/edited
22759 [[Image:Foobar.jpg|frameless|right|220x220px]]
22760 !! end
22761
22762 !! test
22763 Image: Modifying valign of an image (bug 49221)
22764 !! options
22765 parsoid={
22766 "modes": ["wt2wt"],
22767 "changes": [
22768 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22769 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22770 ]
22771 }
22772 !! wikitext
22773 [[File:Foobar.jpg|20px|middle]]
22774 !! wikitext/edited
22775 [[File:Foobar.jpg|20px|text-top]]
22776 !! end
22777
22778 !! test
22779 Image: Modifying alt attribute of an image (bug 56400)
22780 !! options
22781 parsoid={
22782 "modes": ["wt2wt"],
22783 "changes": [
22784 ["img[alt]", "attr", "alt", "some alternate edited text"]
22785 ]
22786 }
22787 !! wikitext
22788 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22789 !! wikitext/edited
22790 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22791 !!end
22792
22793 !! test
22794 Image: Modifying caption of an image
22795 !! options
22796 parsoid={
22797 "modes": ["wt2wt"],
22798 "changes": [
22799 ["figcaption", "text", "new caption"]
22800 ]
22801 }
22802 !! wikitext
22803 [[Image:Foobar.jpg|thumb|original caption]]
22804 !! wikitext/edited
22805 [[Image:Foobar.jpg|thumb|new caption]]
22806 !!end
22807
22808 !! test
22809 Image: empty alt attribute (bug 48924)
22810 !! options
22811 parsoid
22812 !! wikitext
22813 [[File:Foobar.jpg|thumb|alt=|bar]]
22814 !! html
22815 <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>
22816 !! end
22817
22818 #!! test
22819 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22820 #!! options
22821 #parsoid=html2wt
22822 #language=ar
22823 #!! html
22824 #<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>
22825 #!! wikitext
22826 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22827 #!! end
22828
22829 !! test
22830 Image: Block level image should have \n before and after
22831 !! wikitext
22832 123
22833 [[File:Foobar.jpg|right|thumb|150x150px]]
22834 456
22835 !! html/parsoid
22836 <p>123</p>
22837 <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>
22838 <p>456</p>
22839 !!end
22840
22841 !! test
22842 Image: New block level image should have \n before and after (existing content)
22843 !! wikitext
22844 123
22845 [[File:Foobar.jpg|right|thumb|150x150px]]
22846 456
22847 !! html/parsoid
22848 <p>123</p>
22849 <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>
22850 <p>456</p>
22851 !!end
22852
22853 !! test
22854 Image: upright option (parsoid)
22855 !! options
22856 parsoid
22857 !! wikitext
22858 [[File:Foobar.jpg|thumb|upright|caption]]
22859 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22860 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22861 !! html
22862 <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>
22863 <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>
22864 <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>
22865 !!end
22866
22867 !! test
22868 Image: upright option is ignored on inline and frame images (parsoid)
22869 !! options
22870 parsoid
22871 !! wikitext
22872 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22873 !! html
22874 <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>
22875 !!end
22876
22877 !! test
22878 Image: from basic HTML (1)
22879 !! options
22880 parsoid=html2wt
22881 !! html/parsoid
22882 <span typeof="mw:Image">
22883 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22884 </span>
22885 !! wikitext
22886 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22887 !! end
22888
22889 !! test
22890 Image: from basic HTML (2)
22891 !! options
22892 parsoid=html2wt
22893 !! html/parsoid
22894 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22895 !! wikitext
22896 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22897 !! end
22898
22899 !! test
22900 Image: from basic HTML (3)
22901 !! options
22902 parsoid=html2wt
22903 !! html/parsoid
22904 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22905 !! wikitext
22906 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22907 !! end
22908
22909 !! test
22910 Image: from basic HTML (4)
22911 !! options
22912 parsoid=html2wt
22913 !! html/parsoid
22914 <img src="File:Foobar.jpg">
22915 !! wikitext
22916 [[File:Foobar.jpg|link=]]
22917 !! end
22918
22919 !! test
22920 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22921 !! options
22922 parsoid=html2wt
22923 !! html
22924 <ul>
22925 <li><p>foo</p></li>
22926 </ul>
22927 !! wikitext
22928 * foo
22929 !! end
22930
22931 !! test
22932 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22933 !! options
22934 parsoid=html2wt
22935 !! html
22936 <ul> <li>foo</li></ul>
22937 !! wikitext
22938 * foo
22939 !! end
22940
22941 !! test
22942 Don't strip leading whitespace when handling indent-pre suppressing tags
22943 !! options
22944 parsoid=html2wt
22945 !! html
22946 <table>
22947 <tr><td> indented row</td></tr>
22948 </table>
22949 <blockquote><p>
22950 <b>This is very bold of you!</b>
22951 </p>
22952 <table><tr><td>
22953 indented cell (no pre-wrapping!)
22954 </td></tr></table>
22955 </blockquote>
22956 <p>foo</p>
22957 <div>bar</div>
22958 !! wikitext
22959 {|
22960 | indented row
22961 |}
22962 <blockquote>
22963 '''This is very bold of you!'''
22964
22965 {|
22966 |
22967 indented cell (no pre-wrapping!)
22968 |}
22969 </blockquote>
22970 foo
22971 <div>bar</div>
22972 !! end
22973
22974 !! test
22975 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22976 !! options
22977 parsoid=html2wt
22978 !! wikitext
22979 foo
22980 <nowiki> </nowiki><span>bar</span>
22981
22982 <span>foo2
22983 <nowiki> </nowiki></span>bar2
22984
22985 <div>foo</div>
22986 <nowiki> </nowiki><span>bar</span>
22987
22988 <div>
22989 <nowiki> </nowiki><span>foo</span>
22990 </div>
22991 !! html
22992 <p>foo</p>
22993 <span>bar</span>
22994
22995 <span>foo2
22996 </span>bar2
22997
22998 <div>foo</div>
22999 <span>bar</span>
23000
23001 <div>
23002 <span>foo</span>
23003 </div>
23004 !! end
23005
23006 !! test
23007 Lists: Add space after bullets
23008 !! options
23009 parsoid=html2wt
23010 !! html
23011 <ul>
23012 <li>foo</li>
23013 <li> bar</li>
23014 <li><span> baz</span></li>
23015 </ul>
23016 !! wikitext
23017 * foo
23018 * bar
23019 * <span> baz</span>
23020 !! end
23021
23022 !! test
23023 Lists: Dont insert newlines in a serialized list item.
23024 !! options
23025 parsoid=html2wt
23026 !! html
23027 <ul><li>a<br>b</li><li>c</li></ul>
23028 !! wikitext
23029 * a<br>b
23030 * c
23031 !! end
23032
23033 !! test
23034 Headings: Add space before/after == (Bug 51744)
23035 !! options
23036 parsoid=html2wt
23037 !! html
23038 <h2>foo</h2>
23039 <h2> bar</h2>
23040 <h2>baz </h2>
23041 <h2><span> baz</span></h2>
23042 !! wikitext
23043 == foo ==
23044
23045 == bar ==
23046
23047 == baz ==
23048
23049 == <span> baz</span> ==
23050 !! end
23051
23052 !! test
23053 Headings: Force metas to serialize before/after
23054 !! options
23055 parsoid=html2wt
23056 !! html
23057 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23058 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23059
23060 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23061 !! wikitext
23062 == hello there ==
23063 [[Category:A1]]
23064
23065 [[Category:A2]]
23066 == hi pal ==
23067
23068 <!--foo--> [[Category:A3]]
23069 == how goes it ==
23070 !! end
23071
23072 !! test
23073 Parsoid: Serialize positional parameters with = in them as named parameter
23074 !! options
23075 parsoid=html2wt
23076 !! html
23077 <p about="#mwt1" typeof="mw:Transclusion"
23078 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23079
23080 <p about="#mwt1" typeof="mw:Transclusion"
23081 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23082
23083 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23084 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23085 <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>
23086 !! wikitext
23087 {{echo|1 = f=oo}}
23088
23089 {{echo|1 = f=oo|2 = bar}}
23090
23091 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23092 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23093 {{echo|<nowiki>f=oo</nowiki>|bar}}
23094 !! end
23095
23096 !! test
23097 Parsoid: Serialize positional parameters with = in extlink as named parameter
23098 !! options
23099 parsoid=html2wt
23100 !! html
23101 <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>
23102 !! wikitext
23103 {{echo|1 = http://stuff?is=ok}}
23104 !! end
23105
23106 !! test
23107 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23108 !! options
23109 parsoid=html2wt
23110 !! html
23111 <div>a<p>b</p></div>
23112 <div>a
23113 <p>b</p></div>
23114 <div>
23115 a
23116 <p>b</p></div>
23117 !! wikitext
23118 <div>a
23119 b
23120 </div>
23121 <div>a
23122 b
23123 </div>
23124 <div>
23125 a
23126
23127 b
23128 </div>
23129 !! end
23130
23131 !! test
23132 Substrings resembling wikitext in hrefs should not get nowiki escapes
23133 !! options
23134 parsoid=html2wt
23135 !! html
23136 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23137 !! wikitext
23138 [[Foo''bar''baz]]
23139 !! end
23140
23141 #-----------------------------
23142 # I/B quote minimization tests
23143 #-----------------------------
23144
23145 !! test
23146 1. I/B quote minimization: wikitext-only tags should be combined
23147 !! options
23148 parsoid=html2wt
23149 !! html
23150 <p><i>A</i><i>B</i></p>
23151 <p><b>A</b><b>B</b></p>
23152 <p><i>A</i><b><i>B</i></b></p>
23153 <p><b>A</b><i><b>B</b></i></p>
23154 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23155 <p><i><b>A</b></i><i><b>B</b></i></p>
23156 <p><i><b>A</b></i><b><i>B</i></b></p>
23157 <p><b><i>A</i></b><i><b>B</b></i></p>
23158 !! wikitext
23159 ''AB''
23160
23161 '''AB'''
23162
23163 ''A'''B'''''
23164
23165 '''A''B'''''
23166
23167 '''A''BC''D'''
23168
23169 '''''AB'''''
23170
23171 '''''AB'''''
23172
23173 '''''AB'''''
23174 !! end
23175
23176 !! test
23177 2. I/B quote minimization: wikitext and html tags should not be combined
23178 !! options
23179 parsoid=html2wt
23180 !! html
23181 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23182 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23183 !! wikitext
23184 ''A''<i>B</i>
23185
23186 ''A''<nowiki/>'''<i>B</i>'''
23187 !! end
23188
23189 !! test
23190 3. I/B quote minimization: templated content stops minimization
23191 !! options
23192 parsoid=html2wt
23193 !! html
23194 <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>
23195 <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>
23196 !! wikitext
23197 ''A''{{echo|''B''}}
23198
23199 ''A''{{echo|'''''B'''''}}
23200 !! end
23201
23202 !! test
23203 4. I/B quote minimization: new content should be mimimized with adjacent old content
23204 !! options
23205 parsoid=html2wt
23206 !! html
23207 <p><i>A</i><i>B</i></p>
23208 <p><b>A</b><b>B</b></p>
23209 <p><i>A</i><b><i>B</i></b></p>
23210 !! wikitext
23211 ''AB''
23212
23213 '''AB'''
23214
23215 ''A'''B'''''
23216 !! end
23217
23218 !! test
23219 5a. Merge adjacent quote nodes if they've been edited
23220 !! options
23221 parsoid={
23222 "modes": ["wt2wt"],
23223 "changes": [
23224 ["p", "contents", "remove", ":contains('b')"]
23225 ]
23226 }
23227 !! wikitext
23228 ''a''b''c''
23229 !! wikitext/edited
23230 ''ac''
23231 !! end
23232
23233 !! test
23234 5b. Merge adjacent quote nodes if they've been edited
23235 !! options
23236 parsoid={
23237 "modes": ["wt2wt"],
23238 "changes": [
23239 ["#x", "remove"]
23240 ]
23241 }
23242 !! wikitext
23243 ''a''<span id="x">b</span>''c''
23244 !! wikitext/edited
23245 ''ac''
23246 !! end
23247
23248 #------------------------------------
23249 # End of I/B quote minimization tests
23250 #------------------------------------
23251
23252 !!test
23253 Bug 54262: New entities
23254 !! options
23255 parsoid=html2wt
23256 !! wikitext
23257 &nbsp;
23258 !! html
23259 <span typeof="mw:Entity">&nbsp;</span>
23260 !! end
23261
23262 ## Note that there is no wikitext output for 'unknownproperty' ##
23263 ## Unknown magic words are silently dropped ##
23264
23265 !! test
23266 Magic words
23267 !! options
23268 parsoid=html2wt
23269 !! html
23270 <meta property='mw:PageProp/toc' />
23271 <meta property='mw:PageProp/notoc' />
23272 <meta property='mw:PageProp/forcetoc' />
23273 <meta property='mw:PageProp/index' />
23274 <meta property='mw:PageProp/noindex' />
23275 <meta property='mw:PageProp/nogallery' />
23276 <meta property='mw:PageProp/noeditsection' />
23277 <meta property='mw:PageProp/notitleconvert' />
23278 <meta property='mw:PageProp/nocontentconvert' />
23279 <meta property='mw:PageProp/unknownproperty' />
23280 !! wikitext
23281 __TOC__
23282 __NOTOC__
23283 __FORCETOC__
23284 __INDEX__
23285 __NOINDEX__
23286 __NOGALLERY__
23287 __NOEDITSECTION__
23288 __NOTITLECONVERT__
23289 __NOCONTENTCONVERT__
23290 !! end
23291
23292 !! test
23293 Consecutive <pre>s should not get merged
23294 !! options
23295 parsoid=html2wt,html2html
23296 !! html
23297 <pre>a</pre><pre>b</pre>
23298
23299 <pre>c
23300 </pre><pre>
23301 d</pre>
23302
23303 <pre>e
23304
23305 </pre><pre>
23306
23307 f</pre>
23308 !! wikitext
23309 a
23310
23311 b
23312
23313 c
23314
23315 d
23316
23317 e
23318
23319
23320
23321 f
23322 !! end
23323
23324 !! test
23325 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23326 !! options
23327 parsoid=html2wt
23328 !! html
23329 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23330 !! wikitext
23331 [[Special:BookSources/1234567890|ISBN 1234567895]]
23332 !! end
23333
23334 !! test
23335 Edited RFC links not serializable as RFC links should serialize as extlinks
23336 !! options
23337 parsoid=html2wt
23338 !! html
23339 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23340 !! wikitext
23341 [//tools.ietf.org/html/rfc123 New RFC]
23342 !! end
23343
23344 !! test
23345 Edited PMID links not serializable as PMID links should serialize as extlinks
23346 !! options
23347 parsoid=html2wt
23348 !! html
23349 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23350 !! wikitext
23351 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23352 !! end
23353
23354 !! test
23355 WTS of autolinks with trailing/surrounding context
23356 !! options
23357 parsoid=html2wt
23358 !! html/parsoid
23359 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23360 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23361 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23362 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23363 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23364 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23365 !! wikitext
23366 http://cscott.net<nowiki/>'''foo'''
23367
23368 http://cscott.net<b>foo</b>
23369
23370 '''http://cscott.net<nowiki/>'''
23371
23372 '''http://cscott.net '''
23373
23374 '''http://cscott.net<nowiki/>x'''
23375
23376 http://cscott.net<nowiki/>x
23377 !! end
23378
23379 !! test
23380 WTS of autolinks with nowikis (round-trip)
23381 !! wikitext
23382 x<nowiki/>http://cscott.net<nowiki/>x
23383 !! html/parsoid
23384 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23385 !! end
23386
23387 # this is the "easy" test because it leaves in place all the
23388 # data-parsoid information indicating this is an autolink
23389 !! test
23390 WTS of autolinks with escapes (editing)
23391 !! options
23392 parsoid={
23393 "modes": ["wt2wt"],
23394 "changes": [
23395 [ "meta", "remove" ]
23396 ]
23397 }
23398 !! wikitext
23399 x<nowiki/>http://cscott.net<nowiki/>x
23400 !! wikitext/edited
23401 x<nowiki/>http://cscott.net<nowiki/>x
23402 !! end
23403
23404 !! test
23405 Edited Redirect link should emit a non-piped wikitext link
23406 !! options
23407 parsoid=html2wt
23408 !! html
23409 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23410 !! wikitext
23411 #REDIRECT [[Bar]]
23412 !! end
23413
23414 !! test
23415 T75121: Infer extension name from typeOf if data-mw is not present
23416 !! options
23417 parsoid=html2wt
23418 !! html
23419 <div typeOf="mw:Extension/foo"></div>
23420 !! wikitext
23421 <foo />
23422 !! end
23423
23424 # -----------------------------------------------------------------
23425 # End of section for Parsoid-only html2wt tests for serialization
23426 # of new content
23427 # -----------------------------------------------------------------
23428
23429 TODO:
23430 more images
23431 more tables
23432 character entities
23433 and much more
23434 Try for 100% code coverage